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 1825 by gezelter, Wed Jan 9 19:27:52 2013 UTC vs.
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 35 | Line 35
35   *                                                                      
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).          
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39   * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40   * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
# Line 81 | Line 81 | namespace OpenMD {
81      RealType pot, fieldPot;
82      RealType chrgToKcal = 23.0609;
83      RealType debyeToKcal = 4.8018969509;
84    bool isCharge;
84  
85 +
86      if (doElectricField) {
87        fieldPot = 0.0;
88  
89 <      for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {      
89 >      for (mol = info_->beginMolecule(i); mol != NULL;
90 >           mol = info_->nextMolecule(i)) {      
91 >
92          for (atom = mol->beginAtom(j); atom != NULL;
93               atom = mol->nextAtom(j)) {
92          isCharge = false;
93          chrg = 0.0;
94  
95 <          FixedChargeAdapter fca = FixedChargeAdapter(atom->getAtomType());
95 >          bool isCharge = false;
96 >          chrg = 0.0;
97 >          
98 >          AtomType* atype = atom->getAtomType();
99 >          
100 >          if (atype->isElectrostatic()) {
101 >            atom->addElectricField(EF * chrgToKcal);
102 >          }
103 >          
104 >          FixedChargeAdapter fca = FixedChargeAdapter(atype);
105            if ( fca.isFixedCharge() ) {
106              isCharge = true;
107              chrg = fca.getCharge();
108            }
109            
110 <          FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atom->getAtomType());
110 >          FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atype);
111            if ( fqa.isFluctuatingCharge() ) {
112              isCharge = true;
113              chrg += atom->getFlucQPos();
# Line 117 | Line 126 | namespace OpenMD {
126              fieldPot += pot;
127            }
128              
129 <          MultipoleAdapter ma = MultipoleAdapter(atom->getAtomType());
129 >          MultipoleAdapter ma = MultipoleAdapter(atype);
130            if (ma.isDipole() ) {
131              Vector3d dipole = atom->getDipole();
132              dipole *= debyeToKcal;
# Line 143 | Line 152 | namespace OpenMD {
152        snap->setLongRangePotential(longRangePotential);
153      }
154    }
146
155   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines