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

Comparing branches/development/src/perturbations/ElectricField.cpp (file contents):
Revision 1787 by gezelter, Wed Aug 29 18:13:11 2012 UTC vs.
Revision 1844 by gezelter, Wed Jan 30 14:43:08 2013 UTC

# Line 72 | Line 72 | namespace OpenMD {
72      Molecule::AtomIterator  j;
73      Molecule* mol;
74      Atom* atom;
75 +    AtomType* atype;
76      potVec longRangePotential(0.0);
77      Vector3d dip;
78      Vector3d trq;
79      Vector3d EFfrc;                            
80      Vector3d pos;
81      RealType chrg;
82 <    RealType pot, fieldPot, moment;
82 >    RealType pot, fieldPot;
83      RealType chrgToKcal = 23.0609;
84      RealType debyeToKcal = 4.8018969509;
85      bool isCharge;
# Line 86 | Line 87 | namespace OpenMD {
87      if (doElectricField) {
88        fieldPot = 0.0;
89  
90 <      for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {      
90 >      for (mol = info_->beginMolecule(i); mol != NULL;
91 >           mol = info_->nextMolecule(i)) {      
92 >
93          for (atom = mol->beginAtom(j); atom != NULL;
94               atom = mol->nextAtom(j)) {
95 +
96            isCharge = false;
97            chrg = 0.0;
98 <
99 <          FixedChargeAdapter fca = FixedChargeAdapter(atom->getAtomType());
98 >          
99 >          atype = atom->getAtomType();
100 >          
101 >          if (atype->isElectrostatic()) {
102 >            atom->addElectricField(EF * chrgToKcal);
103 >          }
104 >          
105 >          FixedChargeAdapter fca = FixedChargeAdapter(atype);
106            if ( fca.isFixedCharge() ) {
107              isCharge = true;
108              chrg = fca.getCharge();
109            }
110            
111 <          FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atom->getAtomType());
111 >          FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atype);
112            if ( fqa.isFluctuatingCharge() ) {
113              isCharge = true;
114              chrg += atom->getFlucQPos();
# Line 117 | Line 127 | namespace OpenMD {
127              fieldPot += pot;
128            }
129              
130 <          MultipoleAdapter ma = MultipoleAdapter(atom->getAtomType());
130 >          MultipoleAdapter ma = MultipoleAdapter(atype);
131            if (ma.isDipole() ) {
132              Vector3d dipole = atom->getDipole();
133              dipole *= debyeToKcal;
# Line 143 | Line 153 | namespace OpenMD {
153        snap->setLongRangePotential(longRangePotential);
154      }
155    }
146
156   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines