# Re: Re: about the vdw Interpolation calculation in NAMD source code

From: 卢禹锟 (luyukun_at_itp.ac.cn)
Date: Thu Nov 20 2014 - 09:32:10 CST

Hi,

Thank you at first! Actually, I want to calculate the all atom force and the coarse grained force acting on virtual site at the same time. The input of the parameter is surprisingly easy for me to understand and i didn't stuck long in this problem. But I feel confusion in how the interpolation method return the theoretical formula.

The coarse grained interaction function i want to add is just the 12-6 LJ potential form plus with switch term.

The electrostatic part is qi*qj*erfc(rij)/rij, but I have to use the interpolation method for efficiency.

I guess the following code is the key interpolation form in calculating vdw ( in ComputeNonbondedBase2.h):
BigReal vdw_d = A * table_four_i[0] - B * table_four_i[4];
BigReal vdw_c = A * table_four_i[1] - B * table_four_i[5];
BigReal vdw_b = A * table_four_i[2] - B * table_four_i[6];
BigReal vdw_a = A * table_four_i[3] - B * table_four_i[7];

the vdw energy term is calculated in this way:
vdwenergy of ij_pair = - ( ( ( diffa * vdw_d * (1/6.)+ vdw_c * (1/4.)) * diffa + vdw_b *(1/2.)) * diffa + vdw_a );

but I find this energy does not equal to A/rij^12-B/rij^6 or (A/rij^12-B/rij^6)*switch_function(rij):

from left to right: patch_atomindex_i, patch_atomindex_j, interpolation value, analytic value
558 149: -7.48422e-11 -4.6242e-10
558 150: -1.50365e-12 -2.78378e-10
558 520: -5.98947e-06 -1.20509e-05
558 521: -8.25325e-10 -1.26156e-09
558 522: -5.30187e-10 -9.66423e-10
558 40: -1.38634e-05 -2.38436e-05
558 41: -2.01247e-07 -6.87222e-07

(the relative difference far exceed the interpolation error).

For the electrostatic part, I completely have no idea in the relation between FULL() or SLOW() macros and the calculation of qi*qj*erfc(rij)/rij.

I know the theory of the fast and slow force splitting method in namd, but how the interpolation return the desired formula is thus a headache for me.

Best Regards

> -----原始邮件-----
> 发件人: "Jim Phillips" <jim_at_ks.uiuc.edu>
> 发送时间: 2014年11月20日 星期四
> 收件人: namd-l_at_ks.uiuc.edu, "卢禹锟" <luyukun_at_itp.ac.cn>
> 抄送:
> 主题: Re: namd-l: about the vdw Interpolation calculation in NAMD source code
>
>
> What is the functional form (including parameters) of the new LJ potential
> you want? If it is A f(r) + B g(r) and you want to replace the existing
> LJ potential for all atom pairs then you just change f(r) and g(r) from
> r^-12 and r^-6 to your new form, and figure out how to read in your
> parameters, which would be somewhat more complex. We might be able to
> support this more easily in the future, but it will help to know what
> kinds of things people actually want to do.
>
> Jim
>
>
> On Thu, 20 Nov 2014, 卢禹锟 wrote:
>
> > Dear all,
>
>
> I try to modified the namd code to implement a new type force field. I want some help in understanding the nonbonded force calculation like VDW in namd. I have found some local experts, but none of them show interesting in such detail.
>
>
> The source code involving nonbonded calculation (ComputeNonbondedBase.h ComputeNonbondedBase2.h) show a very abstract interpolation method and a large number of macro definitions, completely beyond my ability to fully understand it.
>
>
> Could some one give me some hint in how this is realized in namd. For example, using the interpolation to calculate a new LJ potential energy.
>
>
> Best Regards
>
>
>
>
>
>
>
>
> --
> 卢禹锟(YuKun Lu)
>
>
> Address: Institute of Theoretical Physics, CAS,
> Zhong Guan Cun East Street 55 #,
> P. O. Box 2735, Beijing 100190, P. R. China
>
>
> Email：lcyqky_at_Gmail.com
> luyukun_at_itp.ac.cn

```--

Address: Institute of Theoretical Physics, CAS,
Zhong Guan Cun East Street 55 #,
P. O. Box 2735, Beijing 100190, P. R. China
Email：lcyqky_at_Gmail.com
luyukun_at_itp.ac.cn
```

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:23:02 CST