| 94 |
|
RealType chrg = 0.0; |
| 95 |
|
|
| 96 |
|
AtomType* atype = atom->getAtomType(); |
| 97 |
+ |
|
| 98 |
+ |
// ad-hoc choice of the origin for potential calculation and |
| 99 |
+ |
// fluctuating charge force: |
| 100 |
+ |
pos = atom->getPos(); |
| 101 |
|
|
| 102 |
|
if (atype->isElectrostatic()) { |
| 103 |
|
atom->addElectricField(EF * chrgToKcal); |
| 113 |
|
if ( fqa.isFluctuatingCharge() ) { |
| 114 |
|
isCharge = true; |
| 115 |
|
chrg += atom->getFlucQPos(); |
| 116 |
+ |
atom->addFlucQFrc( dot(pos,EF) * chrgToKcal ); |
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
if (isCharge) { |
| 120 |
|
EFfrc = EF*chrg; |
| 121 |
|
EFfrc *= chrgToKcal; |
| 122 |
|
atom->addFrc(EFfrc); |
| 118 |
– |
// ad-hoc choice of the origin for potential calculation |
| 119 |
– |
pos = atom->getPos(); |
| 123 |
|
pot = -dot(pos, EFfrc); |
| 124 |
|
if (doParticlePot) { |
| 125 |
|
atom->addParticlePot(pot); |
| 144 |
|
} |
| 145 |
|
} |
| 146 |
|
#ifdef IS_MPI |
| 147 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &fieldPot, 1, MPI::REALTYPE, |
| 148 |
< |
MPI::SUM); |
| 147 |
> |
MPI_Allreduce(MPI_IN_PLACE, &fieldPot, 1, MPI_REALTYPE, |
| 148 |
> |
MPI_SUM, MPI_COMM_WORLD); |
| 149 |
|
#endif |
| 150 |
|
Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 151 |
|
longRangePotential = snap->getLongRangePotentials(); |