--- trunk/src/brains/SimInfo.cpp 2005/10/04 19:34:03 645 +++ trunk/src/brains/SimInfo.cpp 2005/11/02 20:36:15 709 @@ -54,6 +54,7 @@ #include "primitives/Molecule.hpp" #include "UseTheForce/fCutoffPolicy.h" #include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" +#include "UseTheForce/DarkSide/fScreeningMethod.h" #include "UseTheForce/doForces_interface.h" #include "UseTheForce/DarkSide/electrostatic_interface.h" #include "UseTheForce/notifyCutoffs_interface.h" @@ -526,15 +527,27 @@ namespace oopse { int useDirectionalAtom = 0; int useElectrostatics = 0; //usePBC and useRF are from simParams - int usePBC = simParams_->getPBC(); + int usePBC = simParams_->getUsePeriodicBoundaryConditions(); int useRF; + int useDW; + std::string myMethod; // set the useRF logical - std::string myMethod = simParams_->getElectrostaticSummationMethod(); - if (myMethod == "REACTION_FIELD") - useRF = 1; - else - useRF = 0; + useRF = 0; + useDW = 0; + + + if (simParams_->haveElectrostaticSummationMethod()) { + std::string myMethod = simParams_->getElectrostaticSummationMethod(); + toUpper(myMethod); + if (myMethod == "REACTION_FIELD") { + useRF=1; + } else { + if (myMethod == "SHIFTED_POTENTIAL") { + useDW = 1; + } + } + } //loop over all of the atom types for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { @@ -600,6 +613,9 @@ namespace oopse { temp = useRF; MPI_Allreduce(&temp, &useRF, 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; @@ -615,9 +631,10 @@ namespace oopse { fInfo_.SIM_uses_Shapes = useShape; fInfo_.SIM_uses_FLARB = useFLARB; fInfo_.SIM_uses_RF = useRF; + fInfo_.SIM_uses_DampedWolf = useDW; - if( fInfo_.SIM_uses_Dipoles && myMethod == "REACTION_FIELD") { - + if( myMethod == "REACTION_FIELD") { + if (simParams_->haveDielectric()) { fInfo_.dielect = simParams_->getDielectric(); } else { @@ -627,10 +644,7 @@ namespace oopse { "\tsetting a dielectric constant!\n"); painCave.isFatal = 1; simError(); - } - - } else { - fInfo_.dielect = 0.0; + } } } @@ -806,7 +820,7 @@ namespace oopse { if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) { - if (!simParams_->haveRcut()){ + if (!simParams_->haveCutoffRadius()){ sprintf(painCave.errMsg, "SimCreator Warning: No value was set for the cutoffRadius.\n" "\tOOPSE will use a default value of 15.0 angstroms" @@ -815,34 +829,34 @@ namespace oopse { simError(); rcut = 15.0; } else{ - rcut = simParams_->getRcut(); + rcut = simParams_->getCutoffRadius(); } - if (!simParams_->haveRsw()){ + if (!simParams_->haveSwitchingRadius()){ sprintf(painCave.errMsg, "SimCreator Warning: No value was set for switchingRadius.\n" "\tOOPSE will use a default value of\n" - "\t0.95 * cutoffRadius for the switchingRadius\n"); + "\t0.85 * cutoffRadius for the switchingRadius\n"); painCave.isFatal = 0; simError(); - rsw = 0.95 * rcut; + rsw = 0.85 * rcut; } else{ - rsw = simParams_->getRsw(); + rsw = simParams_->getSwitchingRadius(); } } else { // if charge, dipole or reaction field is not used and the cutofff radius is not specified in //meta-data file, the maximum cutoff radius calculated from forcefiled will be used - if (simParams_->haveRcut()) { - rcut = simParams_->getRcut(); + if (simParams_->haveCutoffRadius()) { + rcut = simParams_->getCutoffRadius(); } else { //set cutoff radius to the maximum cutoff radius based on atom types in the whole system rcut = calcMaxCutoffRadius(); } - if (simParams_->haveRsw()) { - rsw = simParams_->getRsw(); + if (simParams_->haveSwitchingRadius()) { + rsw = simParams_->getSwitchingRadius(); } else { rsw = rcut; } @@ -859,6 +873,7 @@ namespace oopse { int cp = TRADITIONAL_CUTOFF_POLICY; if (simParams_->haveCutoffPolicy()) { std::string myPolicy = simParams_->getCutoffPolicy(); + toUpper(myPolicy); if (myPolicy == "MIX") { cp = MIX_CUTOFF_POLICY; } else { @@ -885,13 +900,14 @@ namespace oopse { notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); // also send cutoff notification to electrostatics - setElectrostaticCutoffRadius(&rcut_); + setElectrostaticCutoffRadius(&rcut_, &rsw_); } void SimInfo::setupElectrostaticSummationMethod( int isError ) { int errorOut; int esm = NONE; + int sm = UNDAMPED; double alphaVal; double dielectric; @@ -901,38 +917,62 @@ namespace oopse { if (simParams_->haveElectrostaticSummationMethod()) { std::string myMethod = simParams_->getElectrostaticSummationMethod(); + toUpper(myMethod); if (myMethod == "NONE") { esm = NONE; } else { - if (myMethod == "UNDAMPED_WOLF") { - esm = UNDAMPED_WOLF; + if (myMethod == "SWITCHING_FUNCTION") { + esm = SWITCHING_FUNCTION; } else { - if (myMethod == "DAMPED_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.", alphaVal); - painCave.isFatal = 0; - simError(); - } - } else { - if (myMethod == "REACTION_FIELD") { - esm = REACTION_FIELD; + if (myMethod == "SHIFTED_POTENTIAL") { + esm = SHIFTED_POTENTIAL; + } else { + if (myMethod == "SHIFTED_FORCE") { + esm = SHIFTED_FORCE; } 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(); - } - } + 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\", \"shifted_potential\", \"shifted_force\", or \"reaction_field\".", myMethod.c_str() ); + painCave.isFatal = 1; + simError(); + } + } + } } } } + + if (simParams_->haveScreeningMethod()) { + std::string myScreen = simParams_->getScreeningMethod(); + toUpper(myScreen); + if (myScreen == "UNDAMPED") { + sm = UNDAMPED; + } else { + if (myScreen == "DAMPED") { + sm = DAMPED; + 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.", alphaVal); + painCave.isFatal = 0; + simError(); + } else { + // throw error + sprintf( painCave.errMsg, + "SimInfo error: Unknown electrostaticSummationMethod. (Input file specified %s .)\n\telectrostaticSummationMethod must be one of: \"undamped\" or \"damped\".", myScreen.c_str() ); + painCave.isFatal = 1; + simError(); + } + } + } + } // let's pass some summation method variables to fortran setElectrostaticSummationMethod( &esm ); - setDampedWolfAlpha( &alphaVal ); + setScreeningMethod( &sm ); + setDampingAlpha( &alphaVal ); setReactionFieldDielectric( &dielectric ); initFortranFF( &esm, &errorOut ); }