ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/nonbonded/RepulsivePower.cpp
(Generate patch)

Comparing branches/development/src/nonbonded/RepulsivePower.cpp (file contents):
Revision 1624 by gezelter, Tue Sep 13 14:12:54 2011 UTC vs.
Revision 1656 by jmichalk, Tue Oct 11 19:46:51 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines