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 |
|
|
#include "simError.h" |
10 |
|
|
#include "SimSetup.hpp" |
11 |
|
|
#include "SimInfo.hpp" |
12 |
|
|
#include "Atom.hpp" |
13 |
|
|
#include "Integrator.hpp" |
14 |
|
|
#include "Thermo.hpp" |
15 |
|
|
#include "ReadWrite.hpp" |
16 |
|
|
|
17 |
|
|
char* program_name; |
18 |
|
|
using namespace std; |
19 |
|
|
|
20 |
|
|
int main(int argc,char* argv[]){ |
21 |
|
|
|
22 |
|
|
int i; |
23 |
|
|
unsigned int n_atoms, eo, xo; |
24 |
|
|
char* in_name; |
25 |
|
|
SimSetup* startMe; |
26 |
|
|
SimInfo* entry_plug; |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
// first things first, all of the initializations |
30 |
|
|
|
31 |
|
|
MPI_Init( &argc, &argv ); // the MPI communicators |
32 |
|
|
initSimError(); // the error handler |
33 |
|
|
srand48( 1337 ); // the random number generator. |
34 |
|
|
|
35 |
|
|
|
36 |
|
|
// check command line arguments, and set the input file |
37 |
|
|
|
38 |
|
|
program_name = argv[0]; // save the program name in case we need it |
39 |
|
|
|
40 |
|
|
if( worldRank == 0 ){ |
41 |
|
|
if( argc < 2 ){ |
42 |
|
|
strcpy( painCave.errMsg, "Error, bass file is needed to run.\n" ); |
43 |
|
|
painCave.isFatal = 1; |
44 |
|
|
simError(); |
45 |
|
|
} |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
in_name = argv[1]; |
49 |
|
|
|
50 |
|
|
strcpy( checkPointMsg, "Successful number of arguments" ); |
51 |
|
|
MPIcheckPoint(); |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
// create the simulation objects, and get the show on the road |
55 |
|
|
|
56 |
|
|
entry_plug = new SimInfo; |
57 |
|
|
startMe = new SimSetup; |
58 |
|
|
|
59 |
|
|
startMe->setSimInfo( entry_plug ); |
60 |
|
|
startMe->parseFile( in_name ); |
61 |
|
|
startMe->createSim(); |
62 |
|
|
|
63 |
|
|
delete startMe; |
64 |
|
|
|
65 |
|
|
entry_plug->the_integrator->integrate(); |
66 |
|
|
|
67 |
|
|
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
68 |
|
|
MPIcheckPoint(); |
69 |
|
|
|
70 |
|
|
MPI_Finalize(); |
71 |
|
|
return 0 ; |
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
#endif |