AMBER Archive (2006)

Subject: RE: AMBER: Periodic boundary condition (PBC) > Problem now with ptraj

From: Thomas Cheatham (
Date: Thu Aug 31 2006 - 23:38:02 CDT

[summary: useful information follows on what the image/center commands of
ptraj actually do after which is discussed a little known feature that can
be used to generate more images/periodic neighbors of your system, useful
for seeing if your solute interacts with its images! (or for ultimately
building a larger crystal).]

> I have a crystal of calcium carbonate. I have made residues for Ca(+2)
> and CO3(-2) and used water molecule (POL3). I have tried as you have
> suggested with the following scripts
> -----------------------------------------
> trajin md.crd 1 5000 1
> trajout traj.crd
> box alpha 90.0 beta 90.0 gamma 74.8 fixalpha fixbeta fixgamma
> center :1-544 mass origin
> image origin center triclinic
> -----------------------------------------------
> I have deleted ' center @CA mass origin ' and added 'center :1-544 mass
> origin' as I have a total of 544 residues. Is that OK? What do you think

If you only have 544 residues, by doing the "center" command, what you are
doing is moving the center of mass of all the residues to 0.0, 0.0, 0.0.

Then you are imaging, and this is really rather simple. You have a
periodic box. If a molecule (in the default usage; in more complex usage
you can image by residue or atom mask) has its center of mass outside the
box (since you specified "center" in the image command; if you didn't use
"center" than if the first atom of the molecule was outside the box) the
molecule is translated back into the periodic box.

For normal usage, if I was looking at the crystal, what I would do is
center the center of mass of the crystal to the origin, and then image
relative to that so that the crystal was in the middle and water outside.
I would probably also image using the familiar keyword so that it would
look more like a solvated crystal.

center :CA,C03 mass origin
image origin center

(where CA and C03 are assumed to match the residue names of the ions).

...but this is different than what AMBER would do by default...

> P. S. If AMBER saves the last output coordinates and wrap it in the
> final .rst file, then ptraj should give the same results (structure) for
> the last step of trajectory - am I right??? Does AMBER and PTRAJ use
> different algorithm for wrapping molecules in the periodic box???????

The algorithm is the same, except (1) that the box "center" may be
different (i.e. whether the box is considered to be centered at the
origin, specifically 0,0,0; or at boxx/2, boxy/2, boxz/2) and (2) I
believe that AMBER still images based on the first atom of the molecule
rather than the center of mass of the molecule.

[Of course, this led to considerable confusion since in answering the
reply with my common usage pattern (i.e. box centered at origin and
imaging based on the center of mass of the molecule) I used conventions
opposite of AMBER.]

So, to get exactly the same thing, I think you need to do:

image triclinic

i.e. do NOT center and do not image with respect to the origin using the
center of mass of the molecules.

Hopefully this clears it up?


p.s. there is another nice feature of the image command. You can specify
an offset in the X, Y, or Z direction for imaging to build not only the
zero centered periodic images, but its neighbors. This allows you to see
if there is space between the periodic images or other problems such as
the solute interacting with itself.

I use a modification of the following script to build all the nearest
images... In your case, assuming I had a restrt file called "restrt" and
I wanted the residues named CA,CO3 centered, I can create a series of 27
separate PDB files.

#!/bin/csh -f

foreach x (0 1 2)
  foreach y ( 0 1 2)
     foreach z ( 0 1 2 )

ptraj prmtop << EOF

trajin restrt
trajout img_$x$y$z.pdb pdb

center :CA,CO3
image xoffset $x yoffset $y zoffset $z



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