RE: editing the code of the non bonded pair potentials

From: Asaf Farhi (
Date: Fri Aug 30 2013 - 05:26:41 CDT

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)
If (E_el>E_c)

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)

I found this place in the code of ComputeNonbondedUtil.C:

              *(vdwa_i++) = vdwa_energy;
00865 *(vdwa_i++) = vdwa_gradient;
00866 *(vdwa_i++) = 0;
00867 *(vdwa_i++) = 0;
00868 *(vdwb_i++) = vdwb_energy;
00869 *(vdwb_i++) = vdwb_gradient;
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:

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;
 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?

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?

Thanks in advance,
Best regards,
From: Axel Kohlmeyer []
Sent: Friday, August 30, 2013 12:34 PM
To: Asaf Farhi
Subject: Re: namd-l: editing the code of the non bonded pair potentials

On Fri, Aug 30, 2013 at 11:27 AM, Asaf Farhi <> 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:
> I then worked on another method that is aimed for MD simulations.
> The article is at:
> 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
somebody reply to that. to get a (good) answer you have to ask better

> Now I don't know what to do.
> Could you please advise me?

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).


> Thanks in advance,
> Best regards,
> Asaf

Dr. Axel Kohlmeyer
International Centre for Theoretical Physics, Trieste. Italy.

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