--- trunk/src/brains/SimInfo.cpp 2005/09/16 16:07:39 603 +++ trunk/src/brains/SimInfo.cpp 2005/09/19 23:21:46 611 @@ -53,8 +53,9 @@ #include "math/Vector3.hpp" #include "primitives/Molecule.hpp" #include "UseTheForce/fCutoffPolicy.h" -#include "UseTheForce/fCoulombicCorrection.h" +#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" #include "UseTheForce/doForces_interface.h" +#include "UseTheForce/DarkSide/electrostatic_interface.h" #include "UseTheForce/notifyCutoffs_interface.h" #include "utils/MemoryUtils.hpp" #include "utils/simError.h" @@ -522,7 +523,15 @@ namespace oopse { int useElectrostatics = 0; //usePBC and useRF are from simParams int usePBC = simParams_->getPBC(); + int useRF; + // set the useRF logical + std::string myMethod = simParams_->getElectrostaticSummationMethod(); + if (myMethod == "REACTION_FIELD") + useRF = 1; + else + useRF = 0; + //loop over all of the atom types for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { useLennardJones |= (*i)->isLennardJones(); @@ -583,6 +592,9 @@ namespace oopse { temp = useFLARB; MPI_Allreduce(&temp, &useFLARB, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); + + temp = useRF; + MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); #endif @@ -598,8 +610,9 @@ namespace oopse { fInfo_.SIM_uses_EAM = useEAM; fInfo_.SIM_uses_Shapes = useShape; fInfo_.SIM_uses_FLARB = useFLARB; + fInfo_.SIM_uses_RF = useRF; - if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) { + if( fInfo_.SIM_uses_Dipoles && myMethod == "REACTION_FIELD") { if (simParams_->haveDielectric()) { fInfo_.dielect = simParams_->getDielectric(); @@ -857,6 +870,8 @@ namespace oopse { } } notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); + // also send cutoff notification to electrostatics + setElectrostaticCutoffRadius(&rcut_); } void SimInfo::setupElectrostaticSummationMethod( int isError ) { @@ -864,11 +879,14 @@ namespace oopse { int errorOut; int esm = NONE; double alphaVal; + double dielectric; errorOut = isError; + alphaVal = simParams_->getDampingAlpha(); + dielectric = simParams_->getDielectric(); if (simParams_->haveElectrostaticSummationMethod()) { - std::string myCorrection = simParams_->getElectrostaticSummationMethod(); + std::string myMethod = simParams_->getElectrostaticSummationMethod(); if (myMethod == "NONE") { esm = NONE; } else { @@ -876,15 +894,14 @@ namespace oopse { esm = UNDAMPED_WOLF; } else { if (myMethod == "DAMPED_WOLF") { - esm = WOLF; + esm = DAMPED_WOLF; if (!simParams_->haveDampingAlpha()) { //throw error sprintf( painCave.errMsg, - "SimInfo warning: dampingAlpha was not specified in the input file. A default value of %f (1/ang) will be used for the Damped Wolf Method.", simParams_->getDampingAlpha()); + "SimInfo warning: dampingAlpha was not specified in the input file. A default value of %f (1/ang) will be used for the Damped Wolf Method.", alphaVal); painCave.isFatal = 0; simError(); } - alphaVal = simParams_->getDampingAlpha(); } else { if (myMethod == "REACTION_FIELD") { esm = REACTION_FIELD; @@ -899,7 +916,11 @@ namespace oopse { } } } - initFortranFF( &fInfo_.SIM_uses_RF, &esm, &alphaVal, &errorOut ); + // let's pass some summation method variables to fortran + setElectrostaticSummationMethod( &esm ); + setDampedWolfAlpha( &alphaVal ); + setReactionFieldDielectric( &dielectric ); + initFortranFF( &esm, &errorOut ); } void SimInfo::addProperty(GenericData* genData) {