--- trunk/src/io/DumpReader.cpp 2012/09/10 18:38:44 1796 +++ trunk/src/io/DumpReader.cpp 2014/01/16 16:00:43 1964 @@ -35,7 +35,7 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ @@ -43,6 +43,10 @@ #define _LARGEFILE_SOURCE64 #define _FILE_OFFSET_BITS 64 +#ifdef IS_MPI +#include +#endif + #include #include @@ -59,10 +63,6 @@ #include "utils/MemoryUtils.hpp" #include "utils/StringTokenizer.hpp" #include "brains/Thermo.hpp" - -#ifdef IS_MPI -#include -#endif namespace OpenMD { @@ -128,7 +128,7 @@ namespace OpenMD { } void DumpReader::scanFile(void) { - int lineNo = 0; + std::streampos prevPos; std::streampos currPos; @@ -142,6 +142,7 @@ namespace OpenMD { bool foundOpenSnapshotTag = false; bool foundClosedSnapshotTag = false; + int lineNo = 0; while(inFile_->getline(buffer, bufferSize)) { ++lineNo; @@ -227,7 +228,9 @@ namespace OpenMD { needVel_ = false; } - if (storageLayout & DataStorage::dslAmat || storageLayout & DataStorage::dslElectroFrame) { + if (storageLayout & DataStorage::dslAmat || + storageLayout & DataStorage::dslDipole || + storageLayout & DataStorage::dslQuadrupole) { needQuaternion_ = true; } else { needQuaternion_ = false; @@ -517,7 +520,6 @@ namespace OpenMD { } } - } @@ -525,7 +527,7 @@ namespace OpenMD { StringTokenizer tokenizer(line); int nTokens; - + nTokens = tokenizer.countTokens(); if (nTokens < 2) { @@ -557,8 +559,11 @@ namespace OpenMD { if (i >> siteIndex) { // chew up this token and parse as an int: siteIndex = tokenizer.nextTokenAsInt(); - RigidBody* rb = static_cast(sd); - sd = rb->getAtoms()[siteIndex]; + + if (sd->isRigidBody()) { + RigidBody* rb = static_cast(sd); + sd = rb->getAtoms()[siteIndex]; + } } /** @@ -645,14 +650,12 @@ namespace OpenMD { void DumpReader::readSiteData(std::istream& inputStream) { - inputStream.getline(buffer, bufferSize); std::string line(buffer); - - if (line.find("") == std::string::npos) { - // site data isn't required for a simulation, so skip - return; - } + // We already found the starting tag or we wouldn't be + // here, so just start parsing until we get to the ending + // tag: + while(inputStream.getline(buffer, bufferSize)) { line = buffer;