| 1 | #ifdef IS_MPI | 
| 2 | #include <iostream> | 
| 3 | #include <fstream> | 
| 4 | #include <cstdlib> | 
| 5 | #include <cmath> | 
| 6 | #include <cstring> | 
| 7 | #include <mpi.h> | 
| 8 |  | 
| 9 | #ifdef PROFILE | 
| 10 | #include "mdProfile.hpp" | 
| 11 | #endif // PROFILE | 
| 12 |  | 
| 13 | #include "simError.h" | 
| 14 | #include "SimSetup.hpp" | 
| 15 | #include "SimInfo.hpp" | 
| 16 | #include "Atom.hpp" | 
| 17 | #include "Integrator.hpp" | 
| 18 | #include "Thermo.hpp" | 
| 19 | #include "ReadWrite.hpp" | 
| 20 |  | 
| 21 | char* program_name; | 
| 22 | using namespace std; | 
| 23 |  | 
| 24 | int main(int argc,char* argv[]){ | 
| 25 |  | 
| 26 | char* in_name; | 
| 27 | SimSetup* startMe; | 
| 28 | SimInfo* entry_plug; | 
| 29 |  | 
| 30 |  | 
| 31 | // first things first, all of the initializations | 
| 32 |  | 
| 33 | MPI_Init( &argc, &argv ); // the MPI communicators | 
| 34 |  | 
| 35 | initSimError();           // the error handler | 
| 36 | srand48( 1337 );          // the random number generator. | 
| 37 |  | 
| 38 | #ifdef PROFILE | 
| 39 | initProfile(); | 
| 40 | #endif //profile | 
| 41 |  | 
| 42 | // check command line arguments, and set the input file | 
| 43 |  | 
| 44 | program_name = argv[0]; // save the program name in case we need it | 
| 45 |  | 
| 46 | if( worldRank == 0 ){ | 
| 47 | if( argc < 2 ){ | 
| 48 | strcpy( painCave.errMsg, "Error, bass file is needed to run.\n" ); | 
| 49 | painCave.isFatal = 1; | 
| 50 | simError(); | 
| 51 | } | 
| 52 | } | 
| 53 |  | 
| 54 | in_name = argv[1]; | 
| 55 |  | 
| 56 | strcpy( checkPointMsg, "Successful number of arguments" ); | 
| 57 | MPIcheckPoint(); | 
| 58 |  | 
| 59 |  | 
| 60 | // create the simulation objects, and get the show on the road | 
| 61 |  | 
| 62 | entry_plug = new SimInfo; | 
| 63 | startMe = new SimSetup; | 
| 64 |  | 
| 65 | startMe->setSimInfo( entry_plug ); | 
| 66 |  | 
| 67 | #ifdef PROFILE | 
| 68 | startProfile( pro1 ); | 
| 69 | #endif //profile | 
| 70 |  | 
| 71 | startMe->parseFile( in_name ); | 
| 72 |  | 
| 73 | #ifdef PROFILE | 
| 74 | endProfile( pro1 ); | 
| 75 |  | 
| 76 | startProfile( pro2 ); | 
| 77 | #endif //profile | 
| 78 |  | 
| 79 | startMe->createSim(); | 
| 80 |  | 
| 81 | delete startMe; | 
| 82 |  | 
| 83 | #ifdef PROFILE | 
| 84 | endProfile( pro2 ); | 
| 85 |  | 
| 86 | startProfile( pro3 ); | 
| 87 | #endif //profile | 
| 88 |  | 
| 89 | entry_plug->the_integrator->integrate(); | 
| 90 |  | 
| 91 | #ifdef PROFILE | 
| 92 | endProfile( pro3 ); | 
| 93 |  | 
| 94 | writeProfiles(); | 
| 95 | #endif //profile | 
| 96 |  | 
| 97 | strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); | 
| 98 | MPIcheckPoint(); | 
| 99 |  | 
| 100 | MPI_Finalize(); | 
| 101 | return 0 ; | 
| 102 | } | 
| 103 |  | 
| 104 | #endif |