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 1780 by jmarr, Mon Aug 20 18:28:22 2012 UTC vs.
Revision 1839 by gezelter, Fri Jan 25 15:21:04 2013 UTC

# Line 78 | Line 78 | namespace OpenMD {
78      Vector3d EFfrc;                            
79      Vector3d pos;
80      RealType chrg;
81 <    RealType pot, fieldPot, moment;
81 >    RealType pot, fieldPot;
82      RealType chrgToKcal = 23.0609;
83      RealType debyeToKcal = 4.8018969509;
84      bool isCharge;
# Line 92 | Line 92 | namespace OpenMD {
92            isCharge = false;
93            chrg = 0.0;
94  
95 +          atom->addElectricField(EF * chrgToKcal);
96 +
97            FixedChargeAdapter fca = FixedChargeAdapter(atom->getAtomType());
98            if ( fca.isFixedCharge() ) {
99              isCharge = true;
# Line 108 | Line 110 | namespace OpenMD {
110              EFfrc = EF*chrg;
111              EFfrc *= chrgToKcal;
112              atom->addFrc(EFfrc);
113 <            // totally ad-hoc choice of the origin for potential calculation
113 >            // ad-hoc choice of the origin for potential calculation
114              pos = atom->getPos();
115              pot = -dot(pos, EFfrc);
116              if (doParticlePot) {      
# Line 119 | Line 121 | namespace OpenMD {
121              
122            MultipoleAdapter ma = MultipoleAdapter(atom->getAtomType());
123            if (ma.isDipole() ) {
124 <            Vector3d u_i = atom->getElectroFrame().getColumn(2);
125 <            moment = ma.getDipoleMoment();
126 <            moment *= debyeToKcal;
127 <            dip = u_i * moment;
126 <            trq = cross(dip, EF);
127 <            //cerr << "dip = " << dip << "\n";
128 <            // cerr << "trq = " << trq << "\n";
124 >            Vector3d dipole = atom->getDipole();
125 >            dipole *= debyeToKcal;
126 >
127 >            trq = cross(dipole, EF);
128              atom->addTrq(trq);
129 <            pot = -dot(dip, EF);
130 <            //cerr << "pot = " << pot << "\n";
129 >
130 >            pot = -dot(dipole, EF);
131              if (doParticlePot) {      
132                atom->addParticlePot(pot);
133              }
# Line 142 | Line 141 | namespace OpenMD {
141   #endif
142        Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot();
143        longRangePotential = snap->getLongRangePotentials();
145      // << "longRangePotential = " << longRangePotential << "\n";
144        longRangePotential[ELECTROSTATIC_FAMILY] += fieldPot;
147      //cerr << "longRangePotential[ELECTROSTATIC_FAMILY] = " << longRangePotential[ELECTROSTATIC_FAMILY] << "\n";
145        snap->setLongRangePotential(longRangePotential);
146      }
147    }
151
148   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines