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> |
46 |
|
#include <cmath> |
47 |
|
#include "nonbonded/RepulsivePower.hpp" |
48 |
|
#include "utils/simError.h" |
49 |
< |
#include "types/NonBondedInteractionType.hpp" |
49 |
> |
#include "types/RepulsivePowerInteractionType.hpp" |
50 |
|
|
51 |
|
using namespace std; |
52 |
|
|
59 |
|
|
60 |
|
ForceField::NonBondedInteractionTypeContainer* nbiTypes = forceField_->getNonBondedInteractionTypes(); |
61 |
|
ForceField::NonBondedInteractionTypeContainer::MapTypeIterator j; |
62 |
+ |
ForceField::NonBondedInteractionTypeContainer::KeyType keys; |
63 |
|
NonBondedInteractionType* nbt; |
64 |
|
|
65 |
|
for (nbt = nbiTypes->beginType(j); nbt != NULL; |
66 |
|
nbt = nbiTypes->nextType(j)) { |
67 |
|
|
68 |
|
if (nbt->isRepulsivePower()) { |
69 |
< |
|
70 |
< |
pair<AtomType*, AtomType*> atypes = nbt->getAtomTypes(); |
71 |
< |
|
72 |
< |
GenericData* data = nbt->getPropertyByName("RepulsivePower"); |
73 |
< |
if (data == NULL) { |
74 |
< |
sprintf( painCave.errMsg, "RepulsivePower::initialize could not\n" |
75 |
< |
"\tfind RepulsivePower parameters for %s - %s interaction.\n", |
76 |
< |
atypes.first->getName().c_str(), |
75 |
< |
atypes.second->getName().c_str()); |
76 |
< |
painCave.severity = OPENMD_ERROR; |
77 |
< |
painCave.isFatal = 1; |
78 |
< |
simError(); |
79 |
< |
} |
80 |
< |
|
81 |
< |
RepulsivePowerData* rpData = dynamic_cast<RepulsivePowerData*>(data); |
82 |
< |
if (rpData == NULL) { |
69 |
> |
keys = nbiTypes->getKeys(j); |
70 |
> |
AtomType* at1 = forceField_->getAtomType(keys[0]); |
71 |
> |
AtomType* at2 = forceField_->getAtomType(keys[1]); |
72 |
> |
|
73 |
> |
|
74 |
> |
RepulsivePowerInteractionType* rpit = dynamic_cast<RepulsivePowerInteractionType*>(nbt); |
75 |
> |
|
76 |
> |
if (rpit == NULL) { |
77 |
|
sprintf( painCave.errMsg, |
78 |
< |
"RepulsivePower::initialize could not convert GenericData\n" |
79 |
< |
"\tto RepulsivePowerData for %s - %s interaction.\n", |
80 |
< |
atypes.first->getName().c_str(), |
81 |
< |
atypes.second->getName().c_str()); |
78 |
> |
"RepulsivePower::initialize could not convert NonBondedInteractionType\n" |
79 |
> |
"\tto RepulsivePowerInteractionType for %s - %s interaction.\n", |
80 |
> |
at1->getName().c_str(), |
81 |
> |
at2->getName().c_str()); |
82 |
|
painCave.severity = OPENMD_ERROR; |
83 |
|
painCave.isFatal = 1; |
84 |
|
simError(); |
85 |
|
} |
86 |
+ |
|
87 |
|
|
88 |
< |
RepulsivePowerParam rpParam = rpData->getData(); |
88 |
> |
RealType sigma = rpit->getSigma(); |
89 |
> |
RealType epsilon = rpit->getEpsilon(); |
90 |
> |
int nRep = rpit->getNrep(); |
91 |
|
|
92 |
< |
RealType sigma = rpParam.sigma; |
96 |
< |
RealType epsilon = rpParam.epsilon; |
97 |
< |
int nRep = rpParam.nRep; |
98 |
< |
|
99 |
< |
addExplicitInteraction(atypes.first, atypes.second, |
100 |
< |
sigma, epsilon, nRep); |
92 |
> |
addExplicitInteraction(at1, at2, sigma, epsilon, nRep); |
93 |
|
} |
94 |
|
} |
95 |
|
initialized_ = true; |