| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
| 39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
/** |
| 77 |
|
#include "antlr/NoViableAltException.hpp" |
| 78 |
|
|
| 79 |
|
#ifdef IS_MPI |
| 80 |
+ |
#include "mpi.h" |
| 81 |
|
#include "math/ParallelRandNumGen.hpp" |
| 82 |
|
#endif |
| 83 |
|
|
| 84 |
|
namespace OpenMD { |
| 85 |
|
|
| 86 |
< |
Globals* SimCreator::parseFile(std::istream& rawMetaDataStream, const std::string& filename, int startOfMetaDataBlock ){ |
| 86 |
> |
Globals* SimCreator::parseFile(std::istream& rawMetaDataStream, const std::string& filename, int mdFileVersion, int startOfMetaDataBlock ){ |
| 87 |
|
Globals* simParams = NULL; |
| 88 |
|
try { |
| 89 |
|
|
| 94 |
|
const int masterNode = 0; |
| 95 |
|
int commStatus; |
| 96 |
|
if (worldRank == masterNode) { |
| 97 |
< |
#endif |
| 98 |
< |
|
| 97 |
> |
commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
| 98 |
> |
#endif |
| 99 |
|
SimplePreprocessor preprocessor; |
| 100 |
|
preprocessor.preprocess(rawMetaDataStream, filename, startOfMetaDataBlock, ppStream); |
| 101 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
} else { |
| 111 |
+ |
|
| 112 |
+ |
commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
| 113 |
+ |
|
| 114 |
|
//get stream size |
| 115 |
|
commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); |
| 116 |
|
|
| 234 |
|
simError(); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
+ |
simParams->setMDfileVersion(mdFileVersion); |
| 238 |
|
return simParams; |
| 239 |
|
} |
| 240 |
|
|
| 249 |
|
int metaDataBlockEnd = -1; |
| 250 |
|
int i; |
| 251 |
|
int mdOffset; |
| 252 |
+ |
int mdFileVersion; |
| 253 |
|
|
| 254 |
|
#ifdef IS_MPI |
| 255 |
|
const int masterNode = 0; |
| 283 |
|
painCave.isFatal = 1; |
| 284 |
|
simError(); |
| 285 |
|
} |
| 286 |
+ |
|
| 287 |
+ |
// found the correct opening string, now try to get the file |
| 288 |
+ |
// format version number. |
| 289 |
|
|
| 290 |
+ |
StringTokenizer tokenizer(line, "=<> \t\n\r"); |
| 291 |
+ |
std::string fileType = tokenizer.nextToken(); |
| 292 |
+ |
toUpper(fileType); |
| 293 |
+ |
|
| 294 |
+ |
mdFileVersion = 0; |
| 295 |
+ |
|
| 296 |
+ |
if (fileType == "OPENMD") { |
| 297 |
+ |
while (tokenizer.hasMoreTokens()) { |
| 298 |
+ |
std::string token(tokenizer.nextToken()); |
| 299 |
+ |
toUpper(token); |
| 300 |
+ |
if (token == "VERSION") { |
| 301 |
+ |
mdFileVersion = tokenizer.nextTokenAsInt(); |
| 302 |
+ |
break; |
| 303 |
+ |
} |
| 304 |
+ |
} |
| 305 |
+ |
} |
| 306 |
+ |
|
| 307 |
|
//scan through the input stream and find MetaData tag |
| 308 |
|
while(mdFile_.getline(buffer, bufferSize)) { |
| 309 |
|
++lineNo; |
| 359 |
|
std::stringstream rawMetaDataStream(mdRawData); |
| 360 |
|
|
| 361 |
|
//parse meta-data file |
| 362 |
< |
Globals* simParams = parseFile(rawMetaDataStream, mdFileName, metaDataBlockStart+1); |
| 362 |
> |
Globals* simParams = parseFile(rawMetaDataStream, mdFileName, mdFileVersion, |
| 363 |
> |
metaDataBlockStart + 1); |
| 364 |
|
|
| 365 |
|
//create the force field |
| 366 |
|
ForceField * ff = ForceFieldFactory::getInstance()->createForceField(simParams->getForceField()); |
| 617 |
|
MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); |
| 618 |
|
} |
| 619 |
|
|
| 592 |
– |
cerr << "molToProcMap:\n"; |
| 593 |
– |
for (int i = 0; i < molToProcMap.size(); i++) { |
| 594 |
– |
cerr << "m = " << i << " mtpr[m] = " << molToProcMap[i] <<"\n"; |
| 595 |
– |
} |
| 596 |
– |
|
| 620 |
|
info->setMolToProcMap(molToProcMap); |
| 621 |
|
sprintf(checkPointMsg, |
| 622 |
|
"Successfully divided the molecules among the processors.\n"); |
| 735 |
|
MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, |
| 736 |
|
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 737 |
|
info->setGlobalGroupMembership(tmpGroupMembership); |
| 715 |
– |
|
| 716 |
– |
cerr << "ggm:\n"; |
| 717 |
– |
for (int i = 0; i < tmpGroupMembership.size(); i++) |
| 718 |
– |
cerr << "i = " << i << "\t ggm(i) = " << tmpGroupMembership[i] << "\n"; |
| 719 |
– |
|
| 738 |
|
#else |
| 739 |
|
info->setGlobalGroupMembership(globalGroupMembership); |
| 740 |
|
#endif |
| 794 |
|
globalIO++; |
| 795 |
|
} |
| 796 |
|
} |
| 779 |
– |
cerr << "ioi2io:\n"; |
| 780 |
– |
for (int i = 0; i < IOIndexToIntegrableObject.size(); i++) { |
| 781 |
– |
if (IOIndexToIntegrableObject[i] != NULL) { |
| 782 |
– |
cerr << "i = " << i << "globalIOindex = " << IOIndexToIntegrableObject[i]->getGlobalIntegrableObjectIndex() << "\n"; |
| 783 |
– |
} |
| 784 |
– |
} |
| 797 |
|
|
| 798 |
|
info->setIOIndexToIntegrableObject(IOIndexToIntegrableObject); |
| 799 |
|
|