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