| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
| 39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
#include <stdio.h> |
| 54 |
|
SC::SC() : name_("SC"), initialized_(false), forceField_(NULL), |
| 55 |
|
scRcut_(0.0), np_(3000) {} |
| 56 |
|
|
| 56 |
– |
SCParam SC::getSCParam(AtomType* atomType) { |
| 57 |
– |
|
| 58 |
– |
// Do sanity checking on the AtomType we were passed before |
| 59 |
– |
// building any data structures: |
| 60 |
– |
if (!atomType->isSC()) { |
| 61 |
– |
sprintf( painCave.errMsg, |
| 62 |
– |
"SC::getSCParam was passed an atomType (%s) that does not\n" |
| 63 |
– |
"\tappear to be a Sutton-Chen (SC) atom.\n", |
| 64 |
– |
atomType->getName().c_str()); |
| 65 |
– |
painCave.severity = OPENMD_ERROR; |
| 66 |
– |
painCave.isFatal = 1; |
| 67 |
– |
simError(); |
| 68 |
– |
} |
| 69 |
– |
|
| 70 |
– |
GenericData* data = atomType->getPropertyByName("SC"); |
| 71 |
– |
if (data == NULL) { |
| 72 |
– |
sprintf( painCave.errMsg, "SC::getSCParam could not find SC\n" |
| 73 |
– |
"\tparameters for atomType %s.\n", |
| 74 |
– |
atomType->getName().c_str()); |
| 75 |
– |
painCave.severity = OPENMD_ERROR; |
| 76 |
– |
painCave.isFatal = 1; |
| 77 |
– |
simError(); |
| 78 |
– |
} |
| 79 |
– |
|
| 80 |
– |
SCParamGenericData* scData = dynamic_cast<SCParamGenericData*>(data); |
| 81 |
– |
if (scData == NULL) { |
| 82 |
– |
sprintf( painCave.errMsg, |
| 83 |
– |
"SC::getSCParam could not convert GenericData to SCParamGenericData\n" |
| 84 |
– |
"\tfor atom type %s\n", atomType->getName().c_str()); |
| 85 |
– |
painCave.severity = OPENMD_ERROR; |
| 86 |
– |
painCave.isFatal = 1; |
| 87 |
– |
simError(); |
| 88 |
– |
} |
| 89 |
– |
|
| 90 |
– |
return scData->getData(); |
| 91 |
– |
} |
| 92 |
– |
|
| 93 |
– |
RealType SC::getC(AtomType* atomType) { |
| 94 |
– |
SCParam scParam = getSCParam(atomType); |
| 95 |
– |
return scParam.c; |
| 96 |
– |
} |
| 97 |
– |
|
| 98 |
– |
RealType SC::getM(AtomType* atomType) { |
| 99 |
– |
SCParam scParam = getSCParam(atomType); |
| 100 |
– |
return scParam.m; |
| 101 |
– |
} |
| 102 |
– |
|
| 57 |
|
RealType SC::getM(AtomType* atomType1, AtomType* atomType2) { |
| 58 |
< |
RealType m1 = getM(atomType1); |
| 59 |
< |
RealType m2 = getM(atomType2); |
| 58 |
> |
SuttonChenAdapter sca1 = SuttonChenAdapter(atomType1); |
| 59 |
> |
SuttonChenAdapter sca2 = SuttonChenAdapter(atomType2); |
| 60 |
> |
RealType m1 = sca1.getM(); |
| 61 |
> |
RealType m2 = sca2.getM(); |
| 62 |
|
return 0.5 * (m1 + m2); |
| 63 |
|
} |
| 64 |
|
|
| 109 |
– |
RealType SC::getN(AtomType* atomType) { |
| 110 |
– |
SCParam scParam = getSCParam(atomType); |
| 111 |
– |
return scParam.n; |
| 112 |
– |
} |
| 113 |
– |
|
| 65 |
|
RealType SC::getN(AtomType* atomType1, AtomType* atomType2) { |
| 66 |
< |
RealType n1 = getN(atomType1); |
| 67 |
< |
RealType n2 = getN(atomType2); |
| 66 |
> |
SuttonChenAdapter sca1 = SuttonChenAdapter(atomType1); |
| 67 |
> |
SuttonChenAdapter sca2 = SuttonChenAdapter(atomType2); |
| 68 |
> |
RealType n1 = sca1.getN(); |
| 69 |
> |
RealType n2 = sca2.getN(); |
| 70 |
|
return 0.5 * (n1 + n2); |
| 71 |
|
} |
| 72 |
|
|
| 120 |
– |
RealType SC::getAlpha(AtomType* atomType) { |
| 121 |
– |
SCParam scParam = getSCParam(atomType); |
| 122 |
– |
return scParam.alpha; |
| 123 |
– |
} |
| 124 |
– |
|
| 73 |
|
RealType SC::getAlpha(AtomType* atomType1, AtomType* atomType2) { |
| 74 |
< |
RealType alpha1 = getAlpha(atomType1); |
| 75 |
< |
RealType alpha2 = getAlpha(atomType2); |
| 74 |
> |
SuttonChenAdapter sca1 = SuttonChenAdapter(atomType1); |
| 75 |
> |
SuttonChenAdapter sca2 = SuttonChenAdapter(atomType2); |
| 76 |
> |
RealType alpha1 = sca1.getAlpha(); |
| 77 |
> |
RealType alpha2 = sca2.getAlpha(); |
| 78 |
|
|
| 79 |
|
ForceFieldOptions& fopts = forceField_->getForceFieldOptions(); |
| 80 |
|
std::string DistanceMix = fopts.getDistanceMixingRule(); |
| 86 |
|
return 0.5 * (alpha1 + alpha2); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
< |
RealType SC::getEpsilon(AtomType* atomType) { |
| 90 |
< |
SCParam scParam = getSCParam(atomType); |
| 91 |
< |
return scParam.epsilon; |
| 92 |
< |
} |
| 93 |
< |
|
| 144 |
< |
RealType SC::getEpsilon(AtomType* atomType1, AtomType* atomType2) { |
| 145 |
< |
RealType epsilon1 = getEpsilon(atomType1); |
| 146 |
< |
RealType epsilon2 = getEpsilon(atomType2); |
| 89 |
> |
RealType SC::getEpsilon(AtomType* atomType1, AtomType* atomType2) { |
| 90 |
> |
SuttonChenAdapter sca1 = SuttonChenAdapter(atomType1); |
| 91 |
> |
SuttonChenAdapter sca2 = SuttonChenAdapter(atomType2); |
| 92 |
> |
RealType epsilon1 = sca1.getEpsilon(); |
| 93 |
> |
RealType epsilon2 = sca2.getEpsilon(); |
| 94 |
|
return sqrt(epsilon1 * epsilon2); |
| 95 |
|
} |
| 96 |
|
|
| 102 |
|
|
| 103 |
|
for (at = atomTypes->beginType(i); at != NULL; |
| 104 |
|
at = atomTypes->nextType(i)) { |
| 105 |
< |
if (at->isSC()) |
| 105 |
> |
SuttonChenAdapter sca = SuttonChenAdapter(at); |
| 106 |
> |
if (sca.isSuttonChen()) |
| 107 |
|
addType(at); |
| 108 |
|
} |
| 109 |
|
initialized_ = true; |
| 113 |
|
|
| 114 |
|
void SC::addType(AtomType* atomType){ |
| 115 |
|
|
| 116 |
+ |
SuttonChenAdapter sca = SuttonChenAdapter(atomType); |
| 117 |
|
SCAtomData scAtomData; |
| 118 |
|
|
| 119 |
< |
scAtomData.c = getC(atomType); |
| 120 |
< |
scAtomData.m = getM(atomType); |
| 121 |
< |
scAtomData.n = getN(atomType); |
| 122 |
< |
scAtomData.alpha = getAlpha(atomType); |
| 123 |
< |
scAtomData.epsilon = getEpsilon(atomType); |
| 119 |
> |
scAtomData.c = sca.getC(); |
| 120 |
> |
scAtomData.m = sca.getM(); |
| 121 |
> |
scAtomData.n = sca.getN(); |
| 122 |
> |
scAtomData.alpha = sca.getAlpha(); |
| 123 |
> |
scAtomData.epsilon = sca.getEpsilon(); |
| 124 |
|
scAtomData.rCut = 2.0 * scAtomData.alpha; |
| 125 |
|
|
| 126 |
|
// add it to the map: |
| 178 |
– |
AtomTypeProperties atp = atomType->getATP(); |
| 127 |
|
|
| 128 |
|
pair<map<int,AtomType*>::iterator,bool> ret; |
| 129 |
< |
ret = SClist.insert( pair<int, AtomType*>(atp.ident, atomType) ); |
| 129 |
> |
ret = SClist.insert( pair<int, AtomType*>(atomType->getIdent(), atomType) ); |
| 130 |
|
if (ret.second == false) { |
| 131 |
|
sprintf( painCave.errMsg, |
| 132 |
|
"SC already had a previous entry with ident %d\n", |
| 133 |
< |
atp.ident); |
| 133 |
> |
atomType->getIdent() ); |
| 134 |
|
painCave.severity = OPENMD_INFO; |
| 135 |
|
painCave.isFatal = 0; |
| 136 |
|
simError(); |
| 327 |
|
*(idat.particlePot1) -= data2.c * data2.epsilon * |
| 328 |
|
sqrt( *(idat.rho2) - rhtmp) + *(idat.frho2); |
| 329 |
|
|
| 330 |
< |
*(idat.particlePot1) -= data1.c * data1.epsilon * |
| 330 |
> |
*(idat.particlePot2) -= data1.c * data1.epsilon * |
| 331 |
|
sqrt( *(idat.rho1) - rhtmp) + *(idat.frho1); |
| 332 |
|
|
| 333 |
|
(*(idat.pot))[METALLIC_FAMILY] += pot_temp; |