Re: [AMBER] Changing the Lennard Jones potential

From: Jason Swails <>
Date: Sun, 29 Sep 2013 07:58:23 -0400

On Sat, Sep 28, 2013 at 6:44 PM, Pengzhi Zhang <>wrote:

> Dear amber users,
> I am trying to implement a modified vdw potential in sander of amber 10
> with
> a desolvation barrier (~r^10). In this case, a 6-10-12 form of potential is
> used.
> I plan to achieve this by editing the prmtop, %FLAG LENNARD_JONES_ACOEF,
> and correspondingly add another array in the src code cn1(),cn2(),
> cn3()(this array is added).

Did you allocate this array?

> I have a problem reading the third array correctly. Compilation stopped
> with
> "Segmentation fault", and I printed out the arrays, they were all 0.

Compiling rarely yields a segfault (unless the compiler is buggy). I'm
assuming you mean that when you ran your modified program it segfaulted.
 Was this in serial or parallel? If parallel, does it work in serial?

If you know how to use valgrind or gdb, it can point you to the exact line
of the segfault (as long as you compile with debug symbols and turn off
compiler optimizations). (Keep in mind that the line it points to is in
the _xxxxxx.f file (note the leading underscore). [This is not true in
Amber 12 -- it corresponds to real line numbers of the actual files.]

> I
> mainly changed the file rdparm.f and changed the integration force in
> ew_directe.h and short_ene.f. Is there anyone who has some idea about what
> need to pay attention when trying to read ? Any help is appreciated.

A segfault is a memory violation. In this type of situation, my guess is
that some of the memory you're trying to write to or read from the new
arrays you just made (but perhaps forgot to allocate).

Jason M. Swails
Rutgers University
Postdoctoral Researcher
AMBER mailing list
Received on Sun Sep 29 2013 - 05:00:04 PDT
Custom Search