3
# Calculate a table of pairwise energies and forces between "INT" atoms
4
# in the lipid membrane model described in
5
# Brannigan et al, Phys Rev E, 72, 011915 (2005)
6
# The energy of this interaction U(r) = eps*(0.4*(sigma/r)^12 - 3.0*(sigma/r)^2)
7
# I realized later this is not what we want because although energy is conserved
8
# all enrgies are shifted with respect to energies used in the Brannigan paper
9
# (by 0.27 kCal/mole) and the later Watson JCP 2011 paper (by 0.224 kCal/mole).
10
# (So don't use this.)
12
# Calculate and print a
14
def S(r, rc1, rc2, derivative=False):
16
Calculate the switching function S(r) which decays continuously
17
between 1 and 0 in the range from rc1 to rc2 (rc2>rc1):
18
S(r) = (rc2^2 - r^2)^2 * (rc2^2 + 2*r^2 - 3*rc1^2) / (rc2^2-rc1^2)^3
19
I'm using the same smoothing/switching cutoff function used by the CHARMM
20
force-fields. (I'm even using the same code to implement it, taken
21
from lammps charmm/coul/charmm pair style, rewritten in python.)
28
denom_lj_inv = (1.0 / ((rc2sq-rc1sq)*
39
rc2sq_minus_rsq = (rc2sq - rsq)
40
rc2sq_minus_rsq_sq = rc2sq_minus_rsq * rc2sq_minus_rsq
42
return (12.0 * rsq * rc2sq_minus_rsq * (rsq-rc1sq) * denom_lj_inv)
44
return (rc2sq_minus_rsq_sq *
45
(rc2sq + 2.0*rsq - 3.0*rc1sq) * denom_lj_inv)
49
return eps* (0.4*pow((sigma/r),12) - 3.0*sigma*sigma/(r*r))
52
return eps*(12*0.4*pow((sigma/r),13)/sigma - 2*3.0*sigma*sigma/(r*r*r))
54
epsilon = 2.75/4.184 # kCal/mole
63
r = Rmin + i*(Rmax-Rmin)/(N-1)
64
U_r = U(r, epsilon, sigma)
65
F_r = F(r, epsilon, sigma)
66
# Multiply U(r) & F(r) by the smoothing/switch function
67
U_r = U_r * S(r, Rc1, Rc2)
68
F_r = U_r * S(r, Rc1, Rc2, True) + F_r * S(r, Rc1, Rc2, False)
69
print(str(i+1)+' '+str(r)+' '+str(U_r)+' '+str(F_r))