ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/nonbonded/Electrostatic.cpp
(Generate patch)

Comparing branches/development/src/nonbonded/Electrostatic.cpp (file contents):
Revision 1822 by gezelter, Tue Jan 8 15:29:03 2013 UTC vs.
Revision 1823 by gezelter, Tue Jan 8 21:02:27 2013 UTC

# Line 106 | Line 106 | namespace OpenMD {
106      angstromToM_ = 1.0e-10;
107      debyeToCm_ = 3.33564095198e-30;
108      
109 <    // number of points for electrostatic splines
110 <    np_ = 1000;
109 >    // Default number of points for electrostatic splines
110 >    np_ = 140;
111      
112      // variables to handle different summation methods for long-range
113      // electrostatics:
# Line 246 | Line 246 | namespace OpenMD {
246        b3c = (5.0 * b2c + pow(2.0*a2, 3) * expTerm * invArootPi) / r2;
247        b4c = (7.0 * b3c + pow(2.0*a2, 4) * expTerm * invArootPi) / r2;
248        b5c = (9.0 * b4c + pow(2.0*a2, 5) * expTerm * invArootPi) / r2;
249 <      selfMult_ = b0c  +  2.0 * a2 * invArootPi;
249 >      selfMult_ = b0c + a2 * invArootPi;
250      } else {
251        a2 = 0.0;
252        b0c = 1.0 / r;
# Line 279 | Line 279 | namespace OpenMD {
279      // working variables for Taylor expansion:
280      RealType rmRc, rmRc2, rmRc3, rmRc4;
281  
282 +    // Approximate using splines using a maximum of 0.1 Angstroms
283 +    // between points.
284 +    int nptest = int((cutoffRadius_ + 2.0) / 0.1);
285 +    np_ = (np_ > nptest) ? np_ : nptest;
286 +  
287      // Add a 2 angstrom safety window to deal with cutoffGroups that
288      // have charged atoms longer than the cutoffRadius away from each
289      // other.  Splining is almost certainly the best choice here.
# Line 1088 | Line 1093 | namespace OpenMD {
1093          *(idat.t2) += *(idat.sw) * indirect_Tb;
1094      }
1095      return;
1096 <  }  
1096 >  }
1097      
1098    void Electrostatic::calcSelfCorrection(SelfData &sdat) {
1099  
# Line 1131 | Line 1136 | namespace OpenMD {
1136        
1137      case esm_SHIFTED_FORCE:
1138      case esm_SHIFTED_POTENTIAL:
1139 <      if (i_is_Charge) {        
1140 <        self = -0.5 * selfMult_ * C_a * (C_a + *(sdat.skippedCharge)) * pre11_;
1139 >      if (i_is_Charge) {
1140 >        self = - selfMult_ * C_a * (C_a + *(sdat.skippedCharge)) * pre11_;
1141          (*(sdat.pot))[ELECTROSTATIC_FAMILY] += self;
1142        }
1143        break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines