--- trunk/src/brains/SimInfo.cpp 2005/11/21 22:59:21 764 +++ trunk/src/brains/SimInfo.cpp 2005/12/30 23:15:59 834 @@ -63,6 +63,8 @@ #include "utils/MemoryUtils.hpp" #include "utils/simError.h" #include "selection/SelectionManager.hpp" +#include "io/ForceFieldOptions.hpp" +#include "UseTheForce/ForceField.hpp" #ifdef IS_MPI #include "UseTheForce/mpiComponentPlan.h" @@ -80,9 +82,8 @@ namespace oopse { return result; } - SimInfo::SimInfo(MakeStamps* stamps, std::vector >& molStampPairs, - ForceField* ff, Globals* simParams) : - stamps_(stamps), forceField_(ff), simParams_(simParams), + SimInfo::SimInfo(ForceField* ff, Globals* simParams) : + forceField_(ff), simParams_(simParams), ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), @@ -90,8 +91,6 @@ namespace oopse { nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0), sman_(NULL), fortranInitialized_(false) { - - std::vector >::iterator i; MoleculeStamp* molStamp; int nMolWithSameStamp; int nCutoffAtoms = 0; // number of atoms belong to cutoff groups @@ -99,23 +98,23 @@ namespace oopse { CutoffGroupStamp* cgStamp; RigidBodyStamp* rbStamp; int nRigidAtoms = 0; - - for (i = molStampPairs.begin(); i !=molStampPairs.end(); ++i) { - molStamp = i->first; - nMolWithSameStamp = i->second; + std::vector components = simParams->getComponents(); + + for (std::vector::iterator i = components.begin(); i !=components.end(); ++i) { + molStamp = (*i)->getMoleculeStamp(); + nMolWithSameStamp = (*i)->getNMol(); addMoleculeStamp(molStamp, nMolWithSameStamp); //calculate atoms in molecules nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp; - //calculate atoms in cutoff groups int nAtomsInGroups = 0; int nCutoffGroupsInStamp = molStamp->getNCutoffGroups(); for (int j=0; j < nCutoffGroupsInStamp; j++) { - cgStamp = molStamp->getCutoffGroup(j); + cgStamp = molStamp->getCutoffGroupStamp(j); nAtomsInGroups += cgStamp->getNMembers(); } @@ -128,7 +127,7 @@ namespace oopse { int nRigidBodiesInStamp = molStamp->getNRigidBodies(); for (int j=0; j < nRigidBodiesInStamp; j++) { - rbStamp = molStamp->getRigidBody(j); + rbStamp = molStamp->getRigidBodyStamp(j); nAtomsInRigidBodies += rbStamp->getNMembers(); } @@ -167,7 +166,6 @@ namespace oopse { } molecules_.clear(); - delete stamps_; delete sman_; delete simParams_; delete forceField_; @@ -274,8 +272,8 @@ namespace oopse { } } - }//end for (integrableObject) - }// end for (mol) + } + } // n_constraints is local, so subtract them on each processor ndf_local -= nConstraints_; @@ -924,10 +922,19 @@ namespace oopse { void SimInfo::setupCutoff() { + ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions(); + // Check the cutoff policy - int cp = TRADITIONAL_CUTOFF_POLICY; - if (simParams_->haveCutoffPolicy()) { - std::string myPolicy = simParams_->getCutoffPolicy(); + int cp = TRADITIONAL_CUTOFF_POLICY; // Set to traditional by default + + std::string myPolicy; + if (forceFieldOptions_.haveCutoffPolicy()){ + myPolicy = forceFieldOptions_.getCutoffPolicy(); + }else if (simParams_->haveCutoffPolicy()) { + myPolicy = simParams_->getCutoffPolicy(); + } + + if (!myPolicy.empty()){ toUpper(myPolicy); if (myPolicy == "MIX") { cp = MIX_CUTOFF_POLICY; @@ -1091,8 +1098,8 @@ namespace oopse { } // let's pass some summation method variables to fortran - setElectrostaticSummationMethod( &esm ); - notifyFortranElectrostaticMethod( &esm ); + setElectrostaticSumMethod( &esm ); + setFortranElectrostaticMethod( &esm ); setScreeningMethod( &sm ); setDampingAlpha( &alphaVal ); setReactionFieldDielectric( &dielectric );