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

Comparing trunk/src/perturbations/ElectricField.cpp (file contents):
Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC vs.
Revision 1987 by gezelter, Thu Apr 17 19:07:31 2014 UTC

# Line 94 | Line 94 | namespace OpenMD {
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);
# Line 109 | Line 113 | namespace OpenMD {
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);
# Line 141 | Line 144 | namespace OpenMD {
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();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines