--- branches/development/src/brains/SimInfo.cpp 2012/07/09 14:15:52 1769 +++ branches/development/src/brains/SimInfo.cpp 2013/01/09 19:27:52 1825 @@ -88,7 +88,8 @@ namespace OpenMD { vector components = simParams->getComponents(); - for (vector::iterator i = components.begin(); i !=components.end(); ++i) { + for (vector::iterator i = components.begin(); + i !=components.end(); ++i) { molStamp = (*i)->getMoleculeStamp(); nMolWithSameStamp = (*i)->getNMol(); @@ -267,8 +268,9 @@ namespace OpenMD { ndf_local -= nConstraints_; #ifdef IS_MPI - MPI_Allreduce(&ndf_local,&ndf_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(&nfq_local,&nGlobalFluctuatingCharges_,1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&ndf_local, &ndf_, 1, MPI::INT,MPI::SUM); + MPI::COMM_WORLD.Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1, + MPI::INT, MPI::SUM); #else ndf_ = ndf_local; nGlobalFluctuatingCharges_ = nfq_local; @@ -282,7 +284,7 @@ namespace OpenMD { int SimInfo::getFdf() { #ifdef IS_MPI - MPI_Allreduce(&fdf_local,&fdf_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&fdf_local, &fdf_, 1, MPI::INT, MPI::SUM); #else fdf_ = fdf_local; #endif @@ -338,7 +340,7 @@ namespace OpenMD { } #ifdef IS_MPI - MPI_Allreduce(&ndfRaw_local,&ndfRaw_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI::INT, MPI::SUM); #else ndfRaw_ = ndfRaw_local; #endif @@ -351,7 +353,8 @@ namespace OpenMD { #ifdef IS_MPI - MPI_Allreduce(&ndfTrans_local,&ndfTrans_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&ndfTrans_local, &ndfTrans_, 1, + MPI::INT, MPI::SUM); #else ndfTrans_ = ndfTrans_local; #endif @@ -781,7 +784,8 @@ namespace OpenMD { void SimInfo::setupSimVariables() { useAtomicVirial_ = simParams_->getUseAtomicVirial(); - // we only call setAccumulateBoxDipole if the accumulateBoxDipole parameter is true + // we only call setAccumulateBoxDipole if the accumulateBoxDipole + // parameter is true calcBoxDipole_ = false; if ( simParams_->haveAccumulateBoxDipole() ) if ( simParams_->getAccumulateBoxDipole() ) { @@ -875,7 +879,6 @@ namespace OpenMD { void SimInfo::prepareTopology() { - int nExclude, nOneTwo, nOneThree, nOneFour; //calculate mass ratio of cutoff group SimInfo::MoleculeIterator mi; @@ -924,11 +927,6 @@ namespace OpenMD { //scan topology - nExclude = excludedInteractions_.getSize(); - nOneTwo = oneTwoInteractions_.getSize(); - nOneThree = oneThreeInteractions_.getSize(); - nOneFour = oneFourInteractions_.getSize(); - int* excludeList = excludedInteractions_.getPairList(); int* oneTwoList = oneTwoInteractions_.getPairList(); int* oneThreeList = oneThreeInteractions_.getPairList(); @@ -979,15 +977,18 @@ namespace OpenMD { for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { - for (atom = mol->beginAtom(atomIter); atom != NULL; atom = mol->nextAtom(atomIter)) { + for (atom = mol->beginAtom(atomIter); atom != NULL; + atom = mol->nextAtom(atomIter)) { atom->setSnapshotManager(sman_); } - for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { + for (rb = mol->beginRigidBody(rbIter); rb != NULL; + rb = mol->nextRigidBody(rbIter)) { rb->setSnapshotManager(sman_); } - for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) { + for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; + cg = mol->nextCutoffGroup(cgIter)) { cg->setSnapshotManager(sman_); } } @@ -1002,28 +1003,26 @@ namespace OpenMD { StuntDouble* SimInfo::getIOIndexToIntegrableObject(int index) { - return IOIndexToIntegrableObject.at(index); + if (index >= IOIndexToIntegrableObject.size()) { + sprintf(painCave.errMsg, + "SimInfo::getIOIndexToIntegrableObject Error: Integrable Object\n" + "\tindex exceeds number of known objects!\n"); + painCave.isFatal = 1; + simError(); + return NULL; + } else + return IOIndexToIntegrableObject.at(index); } void SimInfo::setIOIndexToIntegrableObject(const vector& v) { IOIndexToIntegrableObject= v; } -/* - void SimInfo::setStuntDoubleFromGlobalIndex(vector v) { - assert( v.size() == nAtoms_ + nRigidBodies_); - sdByGlobalIndex_ = v; - } - StuntDouble* SimInfo::getStuntDoubleFromGlobalIndex(int index) { - //assert(index < nAtoms_ + nRigidBodies_); - return sdByGlobalIndex_.at(index); - } -*/ int SimInfo::getNGlobalConstraints() { int nGlobalConstraints; #ifdef IS_MPI - MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM, - MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&nConstraints_, &nGlobalConstraints, 1, + MPI::INT, MPI::SUM); #else nGlobalConstraints = nConstraints_; #endif