--- branches/development/src/nonbonded/SC.cpp 2012/05/18 21:44:02 1710 +++ branches/development/src/nonbonded/SC.cpp 2013/04/30 15:56:54 1868 @@ -35,7 +35,7 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ @@ -54,6 +54,21 @@ namespace OpenMD { SC::SC() : name_("SC"), initialized_(false), forceField_(NULL), scRcut_(0.0), np_(3000) {} + SC::~SC() { + initialized_ = false; + + map, SCInteractionData>::iterator it; + for (it = MixingMap.begin(); it != MixingMap.end(); ++it) { + SCInteractionData mixer = (*it).second; + delete mixer.V; + delete mixer.phi; + } + + MixingMap.clear(); + SCMap.clear(); + SClist.clear(); + } + RealType SC::getM(AtomType* atomType1, AtomType* atomType2) { SuttonChenAdapter sca1 = SuttonChenAdapter(atomType1); SuttonChenAdapter sca2 = SuttonChenAdapter(atomType2); @@ -278,8 +293,10 @@ namespace OpenMD { *(sdat.dfrhodrho) = 0.5 * *(sdat.frho) / *(sdat.rho); (*(sdat.pot))[METALLIC_FAMILY] += u; - *(sdat.particlePot) += u; - + if (sdat.doParticlePot) { + *(sdat.particlePot) += u; + } + return; } @@ -315,20 +332,22 @@ namespace OpenMD { *(idat.f1) += *(idat.d) * dudr / *(idat.rij) ; - // particlePot is the difference between the full potential and - // the full potential without the presence of a particular - // particle (atom1). - // - // This reduces the density at other particle locations, so we - // need to recompute the density at atom2 assuming atom1 didn't - // contribute. This then requires recomputing the density - // functional for atom2 as well. - - *(idat.particlePot1) -= data2.c * data2.epsilon * - sqrt( *(idat.rho2) - rhtmp) + *(idat.frho2); + if (idat.doParticlePot) { + // particlePot is the difference between the full potential and + // the full potential without the presence of a particular + // particle (atom1). + // + // This reduces the density at other particle locations, so we + // need to recompute the density at atom2 assuming atom1 didn't + // contribute. This then requires recomputing the density + // functional for atom2 as well. + + *(idat.particlePot1) -= data2.c * data2.epsilon * + sqrt( *(idat.rho2) - rhtmp) + *(idat.frho2); - *(idat.particlePot2) -= data1.c * data1.epsilon * - sqrt( *(idat.rho1) - rhtmp) + *(idat.frho1); + *(idat.particlePot2) -= data1.c * data1.epsilon * + sqrt( *(idat.rho1) - rhtmp) + *(idat.frho1); + } (*(idat.pot))[METALLIC_FAMILY] += pot_temp; }