1 |
|
2 |
#ifdef IS_MPI |
3 |
#include <mpi.h> |
4 |
#endif |
5 |
|
6 |
#include "utils/simError.h" |
7 |
#include "brains/SimCreator.hpp" |
8 |
#include "brains/SimInfo.hpp" |
9 |
#include "integrators/IntegratorFactory.hpp" |
10 |
#include "integrators/IntegratorCreator.hpp" |
11 |
#include "integrators/Integrator.hpp" |
12 |
#include "integrators/NVE.hpp" |
13 |
#include "UseTheForce/DUFF.hpp" |
14 |
#include "UseTheForce/ForceFieldCreator.hpp" |
15 |
|
16 |
using namespace oopse; |
17 |
|
18 |
int main(int argc,char* argv[]){ |
19 |
|
20 |
// first things first, all of the initializations |
21 |
|
22 |
#ifdef IS_MPI |
23 |
MPI_Init( &argc, &argv ); // the MPI communicators |
24 |
#endif |
25 |
|
26 |
initSimError(); // the error handler |
27 |
srand48( 1337 ); // the random number generator. |
28 |
|
29 |
#ifdef IS_MPI |
30 |
if( worldRank == 0 ){ |
31 |
#endif |
32 |
std::cerr << |
33 |
" +----------------------------------------------------------------------+\n" << |
34 |
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
35 |
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
36 |
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
37 |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" << |
38 |
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
39 |
" | http://www.oopse.org |\n" << |
40 |
" | |\n" << |
41 |
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
42 |
" | any use subject to only one condition: |\n" << |
43 |
" | |\n" << |
44 |
" | Any published work resulting from the use of this code must cite the |\n" << |
45 |
" | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" << |
46 |
" | C. J. Fennell, and J. D. Gezelter, |\n" << |
47 |
" | J. Comp. Chem. XX, XXXX (2004). |\n" << |
48 |
" +----------------------------------------------------------------------+\n" << |
49 |
"\n"; |
50 |
|
51 |
if( argc < 2 ){ |
52 |
strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" ); |
53 |
painCave.isFatal = 1; |
54 |
simError(); |
55 |
} |
56 |
#ifdef IS_MPI |
57 |
} |
58 |
#endif |
59 |
|
60 |
#ifdef IS_MPI |
61 |
strcpy( checkPointMsg, "Successful number of arguments" ); |
62 |
MPIcheckPoint(); |
63 |
#endif |
64 |
|
65 |
static ForceFieldBuilder<DUFF>* DUFFCreator = new ForceFieldBuilder<DUFF>("DUFF"); |
66 |
static IntegratorBuilder<NVE>* NVECreator = new IntegratorBuilder<NVE>("NVE"); |
67 |
|
68 |
//create simulation model |
69 |
SimCreator creator; |
70 |
SimInfo* info = creator.createSim(argv[1]); |
71 |
|
72 |
//create Integrator |
73 |
Globals* simParams = info->getSimParams(); |
74 |
if (simParams->haveEnsemble()) { |
75 |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
76 |
|
77 |
//Thermodynamic Integration Method |
78 |
//ForceManager* fman = new ThermodynamicForceManager(info); |
79 |
//myIntegrator->setForceManager(fman); |
80 |
|
81 |
|
82 |
//Zconstraint-Method |
83 |
//ForceManager* fman = new ZconstraintForceManager(info); |
84 |
//myIntegrator->setForceManager(fman); |
85 |
|
86 |
if (myIntegrator == NULL) { |
87 |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
88 |
simParams->getEnsemble()); |
89 |
painCave.isFatal = 1; |
90 |
simError(); |
91 |
} |
92 |
|
93 |
myIntegrator->integrate(); |
94 |
delete myIntegrator; |
95 |
} |
96 |
//minimizer |
97 |
// Minimizer* minimizer = MinimizerFactory::getInstance()->createMininizer(); |
98 |
//minimizer->run(); |
99 |
//delete minimizer |
100 |
|
101 |
delete info; |
102 |
|
103 |
#ifdef IS_MPI |
104 |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
105 |
MPIcheckPoint(); |
106 |
|
107 |
MPI_Finalize(); |
108 |
#endif |
109 |
|
110 |
return 0 ; |
111 |
} |