--- trunk/src/brains/SimInfo.cpp 2005/12/02 15:38:03 770 +++ trunk/src/brains/SimInfo.cpp 2006/04/25 02:09:01 945 @@ -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" @@ -82,7 +84,7 @@ namespace oopse { SimInfo::SimInfo(ForceField* ff, Globals* simParams) : forceField_(ff), simParams_(simParams), - ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), + ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nRigidBodies_(0), @@ -288,6 +290,15 @@ namespace oopse { } + int SimInfo::getFdf() { +#ifdef IS_MPI + MPI_Allreduce(&fdf_local,&fdf_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); +#else + fdf_ = fdf_local; +#endif + return fdf_; + } + void SimInfo::calcNdfRaw() { int ndfRaw_local; @@ -920,10 +931,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; @@ -958,8 +978,28 @@ namespace oopse { if (simParams_->haveSwitchingRadius()) { rsw_ = simParams_->getSwitchingRadius(); } else { - rsw_ = rcut_; + if (fInfo_.SIM_uses_Charges | + fInfo_.SIM_uses_Dipoles | + fInfo_.SIM_uses_RF) { + + rsw_ = 0.85 * rcut_; + sprintf(painCave.errMsg, + "SimCreator Warning: No value was set for the switchingRadius.\n" + "\tOOPSE will use a default value of 85 percent of the cutoffRadius.\n" + "\tswitchingRadius = %f. for this simulation\n", rsw_); + painCave.isFatal = 0; + simError(); + } else { + rsw_ = rcut_; + sprintf(painCave.errMsg, + "SimCreator Warning: No value was set for the switchingRadius.\n" + "\tOOPSE will use the same value as the cutoffRadius.\n" + "\tswitchingRadius = %f. for this simulation\n", rsw_); + painCave.isFatal = 0; + simError(); + } } + notifyFortranCutoffs(&rcut_, &rsw_); } else { @@ -1088,7 +1128,7 @@ namespace oopse { // let's pass some summation method variables to fortran setElectrostaticSummationMethod( &esm ); - notifyFortranElectrostaticMethod( &esm ); + setFortranElectrostaticMethod( &esm ); setScreeningMethod( &sm ); setDampingAlpha( &alphaVal ); setReactionFieldDielectric( &dielectric );