# Re: editing the code of the non bonded pair potentials

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Aug 30 2013 - 09:10:35 CDT

On Fri, Aug 30, 2013 at 12:26 PM, Asaf Farhi <asaf.farhi_at_weizmann.ac.il> wrote:
> Thanks Dr. Kohlmeyer
>
> Dear NAMD developers
>
> Hi. My name is Asaf and I'm trying to implement a method to calculate free energy differences in NAMD.
> I will really appreciate your help on this.
> What I need to do is to change the non bonded pair potential and force.
>
> It can either be to place a cutoff energy (upper limit) of each VDW and electrical pair terms :
> If (E_VDW>E_c)
> {
> E_VDW=E_c;
> f_VDW=0;
> }
> If (E_el>E_c)
> {
> E_el=E_c;
> f_el=0;
> }
>
> where E_VDW denoted the pair VDW energy f_VDW denotes the pair VDW force and E_c is a const.
> or to change the total pair non bonded interaction:
>
> If (E_non_bonded>E_c)
> {
> E_non_bonded=E_c;
> f_non_bonded=0;
> }
>
> I found this place in the code of ComputeNonbondedUtil.C:
>
> *(vdwa_i++) = vdwa_energy;
> 00866 *(vdwa_i++) = 0;
> 00867 *(vdwa_i++) = 0;
> 00868 *(vdwb_i++) = vdwb_energy;
> 00870 *(vdwb_i++) = 0;
> 00871 *(vdwb_i++) = 0;
>
> Does anyone know if it will be a good idea to the change before this code - e.g to add:

the only way to identify a "good change" is to come up with several
representative (and simple) test cases, try out the change and check
whether you get the result that that matches what you computed
externally for the same test case. your result won't be any more or
less correct, if somebody here say "yay" or "nay". there is no point
in making a change to a code unless you are convinced yourself that
this is the correct change.

> if ((vdwa_energy+vdwb_energy)>7)
> {
> *(vdwa_i++) = 0;
> 00865 *(vdwa_i++) = 0;
> 00866 *(vdwa_i++) = 0;
> 00867 *(vdwa_i++) = 0;
> 00868 *(vdwb_i++) = 7;
> 00869 *(vdwb_i++) = 0;
> 00870 *(vdwb_i++) = 0;
> 00871 *(vdwb_i++) = 0;
> }
> else
> {
> the former code
> }
>
> Does anyone know how can I change the electric bonded pair energy and force because I didn't manage to find it?

sorry, but what you are asking for is essentially that somebody else
out how to integrate it into NAMD, debug it, and then tell you whether
this is the correct way to do it. i seriously doubt that there is a
chance that somebody will do this, because what would be the point?
after all, your questions are about *your* method. if you are trying
to modify NAMD, but have difficulties identifying how rather
fundamental features in it work, then you probably should modify an MD
code that is simpler to understand and modify. there are many of those
around.

> In addition I'm interested to multiply non bonded terms of certain atoms by a constant (lambda).
> Can anyone help me with how to do it?

same type of question, same type of answer. why would somebody want to

axel.

> Best regards,
> Asaf
> _______________________________________
> From: Axel Kohlmeyer [akohlmey_at_gmail.com]
> Sent: Friday, August 30, 2013 12:34 PM
> To: Asaf Farhi
> Cc: namd-l_at_ks.uiuc.edu
> Subject: Re: namd-l: editing the code of the non bonded pair potentials
>
> On Fri, Aug 30, 2013 at 11:27 AM, Asaf Farhi <asaf.farhi_at_weizmann.ac.il> wrote:
>> Dear NAMD developers
>>
>> Hi. My name is Asaf.
>>
>> In the last two years I've been working on methods for calculating free
>> energy differences.
>> I have worked on the first method that is aimed for MC simulations.
>> The article on the first method was published:
>> http://authors.elsevier.com/sd/article/S0378437113006468
>>
>> I then worked on another method that is aimed for MD simulations.
>> The article is at:
>> http://authors.elsevier.com/sd/article/S0378437113006468
>>
>> I submitted the 2nd article and the referees asked to add a MD
>> demonstration.
>> I decided to implement it using NAMD and studied the software for a week.
>> Then I simulated phenol in water.
>> Now I need to very slightly edit the code in order to implement the method
>> but I don't know where in the code is the relevant place.
>> I posted on the mailing list the question but so far without reply.
>
> you did post a mail, but there was no real question in it. why should
> questions.
>
>> Now I don't know what to do.
>
> pick a different code that is easier for you to understand and modify,
> or ask better questions (i.e if you don't describe what exactly you
> need to modify, where you already looked and what you tried and how
> this modification would be affected by parallel execution).
>
> axel.
>
>>
>> Best regards,
>> Asaf
>
>
>
> --
> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
> International Centre for Theoretical Physics, Trieste. Italy.
>

```--
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.
```

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