AMBER Archive (2008)

Subject: Re: AMBER: writing out a distance between two atoms in sander

From: Thomas Steinbrecher (
Date: Mon Mar 10 2008 - 12:17:35 CDT

Hi Vlad,

if it is just two atoms that you want to track, I believe you might be
best served with putting an extra write statement into your sander code
and recompile a special version of amber just for this job.

The distance you want is calculated at every step anyway, so all you would
need to do is add a statement to print it out. Go to short_ene.f and
search for:

       ! Loop over the 12-6 LJ terms for eedmeth = 1

a few lines further down you will see

           j = cache_bckptr(im_new)

as far as I know at this point in the code, i and j are atom numbers for
nonbonded pairs and cache_df(im_new) contains the inverse of their

so putting something like this on the next line:

         if (i == XXX .and. j == YYY) then
                 write (6,'(a,i6,i6,f8.4)') 'distance between: ', i, j, 1/cache_df(im_new)
         end if

with XXX and YYY the numbers of the atoms that you want to track should
print the distance out once per MD step. I haven't tested this and
obviously its not the *right* way of solving this problem but it might
work good enough. It puts an if statement into a very important loop so
it might be very bad for performance. The good thing is that this will
take care of imaging and the minimum image convention automatically.
Maybe you have to experiment with the atom numbers for a bit, e.g. amber
might store them as 3*(actual number-1) or something. Start with a test
system were you can check the calculated distance by hand.



Dr. Thomas Steinbrecher
The Scripps Research Institute
10550 N. Torrey Pines Rd.
San Diego CA 92037, USA

On Mon, 10 Mar 2008, Vlad Cojocaru wrote:

> Dear Amber users,
> Is there a simple way to make sander output the distnce between two atoms
> during the MD run without using restraints defined with force constants equal
> to 0?
> I am asking because I would like to write out a non-restrained distance much
> more often than the trajectory frame output. I thought of using the
> restraints capabilities of sander to defined a pseudo-restraint in which the
> force constants are all equal to 0 but I am running an SMD simulation in
> which a different distance is subject to the time-dependent restraint and
> this type of simulaton only allows 1 restraint to be defined in the RST file.
> Thanks for any tips
> Best Wishes
> Vlad
> --
> ----------------------------------------------------------------------------
> Dr. Vlad Cojocaru
> EML Research gGmbH
> Schloss-Wolfsbrunnenweg 33
> 69118 Heidelberg
> Tel: ++49-6221-533266
> Fax: ++49-6221-533298
> e-mail:Vlad.Cojocaru[at]
> ----------------------------------------------------------------------------
> EML Research gGmbH
> Amtgericht Mannheim / HRB 337446
> Managing Partner: Dr. h.c. Klaus Tschira
> Scientific and Managing Director: Prof. Dr.-Ing. Andreas Reuter
> ----------------------------------------------------------------------------
> -----------------------------------------------------------------------
> The AMBER Mail Reflector
> To post, send mail to
> To unsubscribe, send "unsubscribe amber" to
The AMBER Mail Reflector
To post, send mail to
To unsubscribe, send "unsubscribe amber" to