Re: [AMBER] Truncated octahedron

From: Jason Swails <>
Date: Wed, 11 Mar 2015 12:06:19 -0400

On Wed, Mar 11, 2015 at 11:24 AM, Arjun Sharma <>

> Dear Amber users,
> How to calculate the distance between the nearest atoms in periodic
> boundary conditions for polymer structure in truncated octahedron solvent
> box. Here is the fortran code I used for polymer in rectilinear solvent
> box, how do I modify it for truncated octahedron.

​If you have access to Mark Tuckerman's textbook on statistical mechanics
and molecular simulation, appendix B.9 contains a simple formula to compute
distances according to the minimum image convention.

A Python version of the code is here: ​

The first thing you need to do is generate the reciprocal box vectors.
Taking the inner product of this matrix with the coordinates of the two
points will transform them into the reciprocal vector space. Then you do
the same thing you did for orthorhombic boxes, which gives you the minimum
image distance in the reciprocal unit cell space. Taking the inner product
of this with the original box vectors puts you back into real space, giving
you the distance you are looking for.

Notice that orthogonal boxes are actually a special case of this. You can
simplify the calculation, though, since the unit cell matrix is simply a
diagonal matrix whose diagonal elements are the vector lengths, with
off-diagonal elements being 0. The inverse matrix is the diagonal matrix
with the diagonal elements being 1/cell lengths.

But again, if you have access to the Tuckerman text, I believe he puts the
formula more succinctly and also includes some pseudo-code for this task.


Jason M. Swails
Rutgers University
Postdoctoral Researcher
AMBER mailing list
Received on Wed Mar 11 2015 - 09:30:03 PDT
Custom Search