19 const BigReal inv_r6 = inv_r2*inv_r2*inv_r2;
20 *U = inv_r6*(A*inv_r6 - B);
21 *F = 6*inv_r2*(2*(*U) + B*inv_r6);
28 const BigReal inv_r6 = inv_r2*inv_r2*inv_r2;
29 *U = inv_r6*(A*inv_r6 - B);
38 if (r2 <= switchdist2) {
43 const BigReal cdiff2 = (cutoff2 - r2);
44 const BigReal sdiff2 = (r2 - switchdist2);
45 *switchmul = switchfactor*cdiff2*cdiff2*(cdiff2 + 3*sdiff2);
46 *switchmul2 = 12*switchfactor*cdiff2*sdiff2;
61 const BigReal inv_r6 = inv_r2*inv_r2*inv_r2;
62 const BigReal inv_r3 = sqrt(inv_r6);
63 const BigReal inv_cutoff6 = 1. / (cutoff2*cutoff2*cutoff2);
64 const BigReal inv_cutoff3 = sqrt(inv_cutoff6);
65 const BigReal switchdist6 = switchdist2*switchdist2*switchdist2;
66 const BigReal k_vdwa = A / (1 - switchdist6*inv_cutoff6);
67 const BigReal k_vdwb = B / (1 - sqrt(switchdist6*inv_cutoff6));
68 const BigReal tmpa = inv_r6 - inv_cutoff6;
69 const BigReal tmpb = inv_r3 - inv_cutoff3;
70 *U = k_vdwa*tmpa*tmpa - k_vdwb*tmpb*tmpb;
71 *F = 6*inv_r2*(2*k_vdwa*tmpa*inv_r6 - k_vdwb*tmpb*inv_r3);
80 const BigReal inv_r6 = inv_r2*inv_r2*inv_r2;
81 const BigReal inv_r3 = sqrt(inv_r6);
82 const BigReal inv_cutoff6 = 1. / (cutoff2*cutoff2*cutoff2);
83 const BigReal inv_cutoff3 = sqrt(inv_cutoff6);
84 const BigReal switchdist6 = switchdist2*switchdist2*switchdist2;
85 const BigReal k_vdwa = A / (1 - switchdist6*inv_cutoff6);
86 const BigReal k_vdwb = B / (1 - sqrt(switchdist6*inv_cutoff6));
87 const BigReal tmpa = inv_r6 - inv_cutoff6;
88 const BigReal tmpb = inv_r3 - inv_cutoff3;
89 *U = k_vdwa*tmpa*tmpa - k_vdwb*tmpb*tmpb;
100 const BigReal cutoff6 = cutoff2*cutoff2*cutoff2;
101 const BigReal switchdist6 = switchdist2*switchdist2*switchdist2;
102 const BigReal v_vdwa = -A / (cutoff6*switchdist6);
103 const BigReal v_vdwb = -B / sqrt(cutoff6*switchdist6);
104 *dU = v_vdwa - v_vdwb;
void vdw_fswitch_energy(const BigReal A, const BigReal B, const BigReal r2, const BigReal switchdist2, const BigReal cutoff2, BigReal *U)
void vdw_forceandenergy(const BigReal A, const BigReal B, const BigReal r2, BigReal *U, BigReal *F)
void vdw_switch(const BigReal r2, const BigReal switchdist2, const BigReal cutoff2, const BigReal switchfactor, BigReal *switchmul, BigReal *switchmul2)
void vdw_fswitch_forceandenergy(const BigReal A, const BigReal B, const BigReal r2, const BigReal switchdist2, const BigReal cutoff2, BigReal *U, BigReal *F)
void vdw_energy(const BigReal A, const BigReal B, const BigReal r2, BigReal *U)
void vdw_fswitch_shift(const BigReal A, const BigReal B, const BigReal switchdist2, const BigReal cutoff2, BigReal *dU)