71 |
|
if (worldRank == 0) { |
72 |
|
#endif // is_mpi |
73 |
|
|
74 |
– |
simParams->initalize(); |
74 |
|
set_interface_stamps(stamps, simParams); |
75 |
|
|
76 |
|
#ifdef IS_MPI |
95 |
|
|
96 |
|
} |
97 |
|
|
98 |
< |
SimInfo* SimCreator::createSim(const std::string & mdFileName, bool loadInitCoords) { |
98 |
> |
SimInfo* SimCreator::createSim(const std::string & mdFileName, |
99 |
> |
bool loadInitCoords) { |
100 |
|
|
101 |
|
MakeStamps * stamps = new MakeStamps(); |
102 |
|
|
106 |
|
parseFile(mdFileName, stamps, simParams); |
107 |
|
|
108 |
|
//create the force field |
109 |
< |
ForceField * ff = ForceFieldFactory::getInstance()->createForceField( |
110 |
< |
simParams->getForceField()); |
109 |
> |
ForceField * ff = ForceFieldFactory::getInstance() |
110 |
> |
->createForceField(simParams->getForceField()); |
111 |
|
|
112 |
|
if (ff == NULL) { |
113 |
< |
sprintf(painCave.errMsg, "ForceField Factory can not create %s force field\n", |
114 |
< |
simParams->getForceField()); |
113 |
> |
sprintf(painCave.errMsg, |
114 |
> |
"ForceField Factory can not create %s force field\n", |
115 |
> |
simParams->getForceField().c_str()); |
116 |
|
painCave.isFatal = 1; |
117 |
|
simError(); |
118 |
|
} |
147 |
|
compList(stamps, simParams, moleculeStampPairs); |
148 |
|
|
149 |
|
//create SimInfo |
150 |
< |
SimInfo * info = new SimInfo(moleculeStampPairs, ff, simParams); |
151 |
< |
|
150 |
> |
SimInfo * info = new SimInfo(stamps, moleculeStampPairs, ff, simParams); |
151 |
> |
|
152 |
|
//gather parameters (SimCreator only retrieves part of the parameters) |
153 |
|
gatherParameters(info, mdFileName); |
154 |
|
|
179 |
|
info->addExcludePairs(mol); |
180 |
|
} |
181 |
|
|
181 |
– |
|
182 |
– |
//load initial coordinates, some extra information are pushed into SimInfo's property map ( such as |
183 |
– |
//eta, chi for NPT integrator) |
182 |
|
if (loadInitCoords) |
183 |
|
loadCoordinates(info); |
184 |
|
|
187 |
|
|
188 |
|
void SimCreator::gatherParameters(SimInfo *info, const std::string& mdfile) { |
189 |
|
|
190 |
< |
//figure out the ouput file names |
190 |
> |
//figure out the output file names |
191 |
|
std::string prefix; |
192 |
|
|
193 |
|
#ifdef IS_MPI |
398 |
|
std::vector < std::pair<MoleculeStamp *, int> > &moleculeStampPairs) { |
399 |
|
int i; |
400 |
|
char * id; |
403 |
– |
LinkedMolStamp* extractedStamp = NULL; |
401 |
|
MoleculeStamp * currentStamp; |
402 |
|
Component** the_components = simParams->getComponents(); |
403 |
|
int n_components = simParams->getNComponents(); |
418 |
|
} |
419 |
|
|
420 |
|
id = the_components[i]->getType(); |
421 |
< |
|
422 |
< |
extractedStamp = stamps->extractMolStamp(id); |
423 |
< |
if (extractedStamp == NULL) { |
421 |
> |
|
422 |
> |
currentStamp = stamps->getMolStamp(id); |
423 |
> |
if (currentStamp == NULL) { |
424 |
|
sprintf(painCave.errMsg, |
425 |
|
"SimCreator error: Component \"%s\" was not found in the " |
426 |
|
"list of declared molecules\n", id); |
429 |
|
simError(); |
430 |
|
} |
431 |
|
|
435 |
– |
currentStamp = extractedStamp->getStamp(); |
436 |
– |
|
437 |
– |
|
432 |
|
moleculeStampPairs.push_back( |
433 |
|
std::make_pair(currentStamp, the_components[i]->getNMol())); |
434 |
|
} //end for (i = 0; i < n_components; i++) |
603 |
|
//invalid initial coordinate file |
604 |
|
sprintf(painCave.errMsg, |
605 |
|
"Initial configuration file %s should at least contain one frame\n", |
606 |
< |
simParams->getInitialConfig()); |
606 |
> |
simParams->getInitialConfig().c_str()); |
607 |
|
painCave.isFatal = 1; |
608 |
|
simError(); |
609 |
|
} |