AMBER Archive (2006)

Subject: Re: AMBER: imaging issue

From: Thomas Cheatham (
Date: Mon Oct 30 2006 - 14:54:20 CST

> Specifically, I have the situation which has been discussed many times
> on the reflector where I have two molecules that I would like to keep as
> close together as I can (I don't expect them to always be together but I
> would actually like to know how much they are together).

OK, I am confusing myself as I try to answer this...

At first thought, I think that the code is fine and that the problem is
that "image" thinks that the center of mass of both molecules (:1-15 and
:16-30) are within the primary unit cell. Hence, the molecule :16-30 does
not get moved. You calculated the distance and the minimal distance was
reported; to get the actual distance, turn on the "noimage" keyword.

  distance d :1-15 :16-30 noimage out d.dat

The imaging is simple; what is does is convert everything to
reciprocal coordinates such that atoms in the range of 0.0-1.0 are
within the primary unit cell. If molecules are not getting imaged close
together, likely the center of mass of both are within the primary unit
cell, so I would try:

(1) image using first atom rather than center of mass of the molecules
(i.e. remove the "center" option from image).

(2) try shifting molecule 1 off the center with translate and then

  center :1-15 mass origin
  translate x -18.0
  translate y -18.0
  translate z -18.0
  image origin center
  center :1-15 mass origin
  image origin center familiar

(3) use familiar (the familiar SHOULD find the shortest distance between
the centers of mass of the two molecules).

As I wrote this e-mail multiple times, and the further I thought about it,
I would expect that the "familiar" option should get around this problem.
In the process, I found a little bug, but this only relates to the use of
the offsets (xoffset, yoffset, zoffset).

actions.c ~line 7409

  boxZtrans += (action->darg1*ucell[2] + action->darg3*ucell[5] + action->darg3*ucell[8]);

should be

  boxZtrans += (action->darg1*ucell[2] + action->darg2*ucell[5] + action->darg3*ucell[8]);

So, I am still confused. If you would be willing to share the trajectory
in question (or part of it, something like a few frames that have the
molecules separated along with the prmtop), I can play. What I think I
need to do to generally fix this problem is to allow specification of the
atom about which to image, i.e. in addition to options for the "first"
atom (legacy) or the center of mass of a molecule, image with respect to a
particular atom (of couse how to specify this would be tricky) or to make
a smart imager that groups particular sets of molecules together.

The AMBER Mail Reflector
To post, send mail to
To unsubscribe, send "unsubscribe amber" to