--- trunk/src/brains/SimInfo.cpp 2005/09/07 20:46:46 586 +++ trunk/src/brains/SimInfo.cpp 2005/09/16 16:07:39 603 @@ -53,6 +53,7 @@ #include "math/Vector3.hpp" #include "primitives/Molecule.hpp" #include "UseTheForce/fCutoffPolicy.h" +#include "UseTheForce/fCoulombicCorrection.h" #include "UseTheForce/doForces_interface.h" #include "UseTheForce/notifyCutoffs_interface.h" #include "utils/MemoryUtils.hpp" @@ -463,8 +464,9 @@ namespace oopse { //setup fortran force field /** @deprecate */ int isError = 0; - initFortranFF( &fInfo_.SIM_uses_RF, &fInfo_.SIM_uses_UW, - &fInfo_.SIM_uses_DW, &isError ); + + setupElectrostaticSummationMethod( isError ); + if(isError){ sprintf( painCave.errMsg, "ForceField error: There was an error initializing the forceField in fortran.\n" ); @@ -520,9 +522,6 @@ namespace oopse { int useElectrostatics = 0; //usePBC and useRF are from simParams int usePBC = simParams_->getPBC(); - int useRF = simParams_->getUseRF(); - int useUW = simParams_->getUseUndampedWolf(); - int useDW = simParams_->getUseDampedWolf(); //loop over all of the atom types for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { @@ -585,15 +584,6 @@ 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); - - temp = useUW; - MPI_Allreduce(&temp, &useUW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); - - temp = useDW; - MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); - #endif fInfo_.SIM_uses_PBC = usePBC; @@ -608,9 +598,6 @@ namespace oopse { fInfo_.SIM_uses_EAM = useEAM; fInfo_.SIM_uses_Shapes = useShape; fInfo_.SIM_uses_FLARB = useFLARB; - fInfo_.SIM_uses_RF = useRF; - fInfo_.SIM_uses_UW = useUW; - fInfo_.SIM_uses_DW = useDW; if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) { @@ -870,6 +857,49 @@ namespace oopse { } } notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); + } + + void SimInfo::setupElectrostaticSummationMethod( int isError ) { + + int errorOut; + int esm = NONE; + double alphaVal; + + errorOut = isError; + + if (simParams_->haveElectrostaticSummationMethod()) { + std::string myCorrection = simParams_->getElectrostaticSummationMethod(); + if (myMethod == "NONE") { + esm = NONE; + } else { + if (myMethod == "UNDAMPED_WOLF") { + esm = UNDAMPED_WOLF; + } else { + if (myMethod == "DAMPED_WOLF") { + esm = 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()); + painCave.isFatal = 0; + simError(); + } + alphaVal = simParams_->getDampingAlpha(); + } else { + if (myMethod == "REACTION_FIELD") { + esm = REACTION_FIELD; + } else { + // throw error + sprintf( painCave.errMsg, + "SimInfo error: Unknown electrostaticSummationMethod. (Input file specified %s .)\n\telectrostaticSummationMethod must be one of: \"none\", \"undamped_wolf\", \"damped_wolf\", or \"reaction_field\".", myMethod.c_str() ); + painCave.isFatal = 1; + simError(); + } + } + } + } + } + initFortranFF( &fInfo_.SIM_uses_RF, &esm, &alphaVal, &errorOut ); } void SimInfo::addProperty(GenericData* genData) {