1 |
mmeineke |
377 |
#ifdef IS_MPI |
2 |
|
|
#include <iostream> |
3 |
|
|
#include <fstream> |
4 |
|
|
#include <cstdlib> |
5 |
|
|
#include <cmath> |
6 |
|
|
#include <cstring> |
7 |
|
|
#include <mpi.h> |
8 |
|
|
|
9 |
mmeineke |
888 |
#ifdef PROFILE |
10 |
|
|
#include "mdProfile.hpp" |
11 |
|
|
#endif // PROFILE |
12 |
|
|
|
13 |
mmeineke |
377 |
#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 |
gezelter |
1169 |
#include "OOPSEMinimizer.hpp" |
21 |
mmeineke |
377 |
|
22 |
|
|
char* program_name; |
23 |
|
|
using namespace std; |
24 |
|
|
|
25 |
|
|
int main(int argc,char* argv[]){ |
26 |
|
|
|
27 |
|
|
char* in_name; |
28 |
|
|
SimSetup* startMe; |
29 |
|
|
SimInfo* entry_plug; |
30 |
gezelter |
1169 |
|
31 |
mmeineke |
377 |
// first things first, all of the initializations |
32 |
|
|
|
33 |
|
|
MPI_Init( &argc, &argv ); // the MPI communicators |
34 |
mmeineke |
888 |
|
35 |
mmeineke |
377 |
initSimError(); // the error handler |
36 |
|
|
srand48( 1337 ); // the random number generator. |
37 |
|
|
|
38 |
mmeineke |
888 |
#ifdef PROFILE |
39 |
|
|
initProfile(); |
40 |
|
|
#endif //profile |
41 |
mmeineke |
377 |
|
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 |
gezelter |
1169 |
|
59 |
mmeineke |
377 |
// create the simulation objects, and get the show on the road |
60 |
|
|
|
61 |
|
|
entry_plug = new SimInfo; |
62 |
|
|
startMe = new SimSetup; |
63 |
|
|
|
64 |
|
|
startMe->setSimInfo( entry_plug ); |
65 |
mmeineke |
888 |
|
66 |
|
|
|
67 |
mmeineke |
377 |
startMe->parseFile( in_name ); |
68 |
mmeineke |
888 |
|
69 |
|
|
|
70 |
mmeineke |
377 |
startMe->createSim(); |
71 |
|
|
|
72 |
|
|
delete startMe; |
73 |
mmeineke |
888 |
|
74 |
gezelter |
1169 |
if (!entry_plug->has_minimizer) |
75 |
|
|
entry_plug->the_integrator->integrate(); |
76 |
|
|
else |
77 |
|
|
entry_plug->the_minimizer->minimize(); |
78 |
mmeineke |
377 |
|
79 |
mmeineke |
888 |
#ifdef PROFILE |
80 |
|
|
writeProfiles(); |
81 |
|
|
#endif //profile |
82 |
|
|
|
83 |
mmeineke |
377 |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
84 |
|
|
MPIcheckPoint(); |
85 |
|
|
|
86 |
|
|
MPI_Finalize(); |
87 |
|
|
return 0 ; |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
#endif |