--- branches/development/src/nonbonded/Electrostatic.cpp 2011/05/27 16:45:44 1571 +++ branches/development/src/nonbonded/Electrostatic.cpp 2011/06/21 06:34:35 1586 @@ -52,11 +52,14 @@ namespace OpenMD { namespace OpenMD { Electrostatic::Electrostatic(): name_("Electrostatic"), initialized_(false), - forceField_(NULL) {} + forceField_(NULL), info_(NULL), haveCutoffRadius_(false), + haveDampingAlpha_(false), haveDielectric_(false), + haveElectroSpline_(false) + {} void Electrostatic::initialize() { - Globals* simParams_; + Globals* simParams_ = info_->getSimParams(); summationMap_["HARD"] = esm_HARD; summationMap_["SWITCHING_FUNCTION"] = esm_SWITCHING_FUNCTION; @@ -97,10 +100,6 @@ namespace OpenMD { screeningMethod_ = UNDAMPED; dielectric_ = 1.0; one_third_ = 1.0 / 3.0; - haveCutoffRadius_ = false; - haveDampingAlpha_ = false; - haveDielectric_ = false; - haveElectroSpline_ = false; // check the summation method: if (simParams_->haveElectrostaticSummationMethod()) { @@ -407,12 +406,14 @@ namespace OpenMD { return; } - void Electrostatic::setElectrostaticCutoffRadius( RealType theECR, - RealType theRSW ) { - cutoffRadius_ = theECR; - rrf_ = cutoffRadius_; - rt_ = theRSW; + void Electrostatic::setCutoffRadius( RealType rCut ) { + cutoffRadius_ = rCut; + rrf_ = cutoffRadius_; haveCutoffRadius_ = true; + } + + void Electrostatic::setSwitchingRadius( RealType rSwitch ) { + rt_ = rSwitch; } void Electrostatic::setElectrostaticSummationMethod( ElectrostaticSummationMethod esm ) { summationMethod_ = esm; @@ -909,7 +910,7 @@ namespace OpenMD { } } - idat.pot[ELECTROSTATIC_FAMILY] += epot; + (*(idat.pot))[ELECTROSTATIC_FAMILY] += epot; *(idat.f1) += dVdr; if (i_is_Dipole || i_is_Quadrupole) @@ -1020,7 +1021,7 @@ namespace OpenMD { } // accumulate the forces and torques resulting from the self term - idat.pot[ELECTROSTATIC_FAMILY] += myPot; + (*(idat.pot))[ELECTROSTATIC_FAMILY] += myPot; *(idat.f1) += dVdr; if (i_is_Dipole) @@ -1034,11 +1035,10 @@ namespace OpenMD { RealType mu1, preVal, chg1, self; if (!initialized_) initialize(); - + ElectrostaticAtomData data = ElectrostaticMap[sdat.atype]; // logicals - bool i_is_Charge = data.is_Charge; bool i_is_Dipole = data.is_Dipole; @@ -1046,7 +1046,7 @@ namespace OpenMD { if (i_is_Dipole) { mu1 = data.dipole_moment; preVal = pre22_ * preRF2_ * mu1 * mu1; - sdat.pot[2] -= 0.5 * preVal; + (*(sdat.pot))[ELECTROSTATIC_FAMILY] -= 0.5 * preVal; // The self-correction term adds into the reaction field vector Vector3d uz_i = sdat.eFrame->getColumn(2); @@ -1063,7 +1063,7 @@ namespace OpenMD { } else { self = - 0.5 * rcuti_ * chg1 * (chg1 + *(sdat.skippedCharge)) * pre11_; } - sdat.pot[ELECTROSTATIC_FAMILY] += self; + (*(sdat.pot))[ELECTROSTATIC_FAMILY] += self; } } }