--- trunk/src/brains/BlockSnapshotManager.cpp 2012/08/22 02:28:28 1782 +++ trunk/src/brains/BlockSnapshotManager.cpp 2014/01/24 14:17:42 1966 @@ -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). */ @@ -67,8 +67,13 @@ namespace OpenMD { // RealType avaliablePhysMem = physMem - rssMem; int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); - int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; + int bytesPerCutoffGroup = DataStorage::getBytesPerStuntDouble(DataStorage::dslPosition); + int bytesPerFrameData = Snapshot::getFrameDataSize(); + int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble + + nCutoffGroups_ * bytesPerCutoffGroup + + bytesPerFrameData; + // total number of frames that can fit in memory //RealType frameCapacity = avaliablePhysMem / bytesPerFrame; RealType frameCapacity = (RealType) memSize_ / (RealType) bytesPerFrame; @@ -76,6 +81,9 @@ namespace OpenMD { // number of frames in each block given the need to hold multiple blocks // in memory at the same time: nSnapshotPerBlock_ = int(frameCapacity) / blockCapacity_; + if (nSnapshotPerBlock_ <= 0) { + std::cerr << "not enough memory to hold two configs!" << std::endl; + } reader_ = new DumpReader(info, filename); nframes_ = reader_->getNFrames(); int nblocks = nframes_ / nSnapshotPerBlock_; @@ -91,20 +99,33 @@ namespace OpenMD { snapshots_.insert(snapshots_.begin(), nframes_, static_cast(NULL)); - std::cout << "-----------------------------------------------------"<setID(frame); snapshot->clearDerivedProperties(); - /** @todo fixed me */ - Snapshot* oldSnapshot = currentSnapshot_; currentSnapshot_ = snapshot; reader_->readFrame(frame); - // What was this for? It doesn't make sense! - //currentSnapshot_ = oldSnapshot; - return snapshot; }