| 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 | 
  | 
 */ | 
| 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 | 
< | 
          atom->addElectricField(EF * chrgToKcal); | 
| 96 | 
< | 
 | 
| 97 | 
< | 
          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(); | 
| 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; |