33 |
|
|
34 |
|
#include "brains/SimCreator.hpp" |
35 |
|
namespace oopse { |
36 |
– |
void SimCreator::parseFile(const string & mdfile) { |
36 |
|
|
37 |
+ |
void SimSetup::parseFile(char* mdfile, MakeStamps* stamps, Globals* globals){ |
38 |
+ |
#ifdef IS_MPI |
39 |
+ |
if (worldRank == 0){ |
40 |
+ |
#endif // is_mpi |
41 |
+ |
|
42 |
+ |
|
43 |
+ |
globals->initalize(); |
44 |
+ |
set_interface_stamps(stamps, globals); |
45 |
+ |
|
46 |
+ |
#ifdef IS_MPI |
47 |
+ |
mpiEventInit(); |
48 |
+ |
#endif |
49 |
+ |
|
50 |
+ |
yacc_BASS(mdfile); |
51 |
+ |
|
52 |
+ |
#ifdef IS_MPI |
53 |
+ |
throwMPIEvent(NULL); |
54 |
+ |
} |
55 |
+ |
else{ |
56 |
+ |
set_interface_stamps(stamps, globals); |
57 |
+ |
mpiEventInit(); |
58 |
+ |
MPIcheckPoint(); |
59 |
+ |
mpiEventLoop(); |
60 |
+ |
} |
61 |
+ |
#endif |
62 |
+ |
|
63 |
|
} |
64 |
|
|
65 |
+ |
|
66 |
+ |
SimModel* SimCreator::createSim(const std::string& mdfile) { |
67 |
+ |
MakeStamps* stamps; |
68 |
+ |
|
69 |
+ |
Globals* globals = new Globals(); |
70 |
+ |
|
71 |
+ |
//parse meta-data file |
72 |
+ |
parseFile(mdfile, stamps, globals); |
73 |
+ |
|
74 |
+ |
//create the force field |
75 |
+ |
ForceFiled* ff = ForceFiledFactory::getInstance()->createForceField(globals->getForceField()); |
76 |
+ |
|
77 |
+ |
//create SimModel |
78 |
+ |
model = new SimInfo(); |
79 |
+ |
|
80 |
+ |
//gather parameters |
81 |
+ |
gatherParameters(model); |
82 |
+ |
|
83 |
+ |
|
84 |
+ |
|
85 |
+ |
//divide the molecules and determine the global index of molecules |
86 |
+ |
|
87 |
+ |
//create the molecules |
88 |
+ |
|
89 |
+ |
//create atoms, bonds, bend, torsions, rigidbodies |
90 |
+ |
|
91 |
+ |
//allocate memory for DataStorage(circular reference, need to break it) |
92 |
+ |
model->setSnapshotManager(new SimSnapshotManager(model); |
93 |
+ |
|
94 |
+ |
//load initial coordinates |
95 |
+ |
DumpReader reader(); |
96 |
+ |
reader.readFrame(model); |
97 |
+ |
|
98 |
+ |
//initialize fortran |
99 |
+ |
return model; |
100 |
+ |
} |
101 |
+ |
|
102 |
+ |
void SimCreator::gatherParameters(SimModel* model) { |
103 |
+ |
model->addProperty(new StringGenericData("Ensemble", globals->getForceFiled())); |
104 |
+ |
model->addProperty(new DoubleGenericData("dt"), globals->getDt()); |
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
#ifdef IS_MPI |
108 |
+ |
void SimCreator::mpiMolDivide() { |
109 |
+ |
|
110 |
+ |
|
111 |
+ |
} |
112 |
+ |
|
113 |
+ |
#endif |
114 |
|
} //end namespace oopse |