NAMD
ComputeNonbondedSplitting.h
Go to the documentation of this file.
1 
7 #ifndef COMPUTENONBONDEDSPLITTING_H
8 #define COMPUTENONBONDEDSPLITTING_H
9 
10 // Several special cases are defined:
11 // NBPAIR, NBSELF, NBEXCL switch environment (mutually exclusive)
12 // FULLELECT full electrostatics calculation?
13 
14 #include "LJTable.h"
15 #include "Molecule.h"
16 #include "ComputeNonbondedUtil.h"
17 
18 // ************************************************************
19 // Various switching functions (for inlining)
20 inline void ComputeNonbondedUtil::shifting (
21  BigReal &shiftVal, BigReal &dShiftVal,
22  const BigReal &r, const BigReal &r2,
23  const BigReal &c5, const BigReal &c6)
24 {
25  // Basic electrostatics shifting function for cutoff simulations
26  shiftVal = 1.0 - r2*c5;
27  dShiftVal = c6*shiftVal*r;
28  shiftVal *= shiftVal;
29 }
30 
31 inline void ComputeNonbondedUtil::xplorsplitting (
32  BigReal &shiftVal, BigReal &dShiftVal,
33  const BigReal &switchVal, const BigReal &dSwitchVal)
34 {
35  // X-plor electrostatics splitting function for multiple timestepping
36  // Same as X-plor VdW switching function so copy from above.
37  shiftVal = switchVal;
38  dShiftVal = dSwitchVal;
39 }
40 
41 inline void ComputeNonbondedUtil::c1splitting (
42  BigReal &shiftVal, BigReal &dShiftVal,
43  const BigReal &r, const BigReal &d0, const BigReal &switchOn)
44 {
45  // C1 electrostatics splitting function for multiple timestepping
46  dShiftVal = 0; // formula only correct for forces
47  if (r > switchOn)
48  {
49  const BigReal d1 = d0*(r-switchOn);
50  shiftVal = 1.0 + d1*d1*(2.0*d1-3.0);
51  }
52  else
53  {
54  shiftVal = 1;
55  }
56 }
57 
58 #endif
59 
double BigReal
Definition: common.h:114