From: Axel Kohlmeyer (
Date: Thu Jun 14 2012 - 13:51:02 CDT

On Thu, Jun 14, 2012 at 1:34 PM, Joshua D. Moore <> wrote:
> Not sure if you are having the same issue as I've had before, but I
> always had trouble with pbcunwrap if my starting frame was not already
> unwrapped.  So if I had a trajectory where frame 0 had everything
> nicely in the box, with no bonds, etc. crossing periodic boundaries,
> it seemed to work well, but if my frame 0 was wrapped and had
> molecules with bonds that stretched across the PBCs, I would get
> strange results.

yes. that is by design. for this step there is _pbc join_
(with two different algorithms, btw) and once you've
done that, you can unwrap based on that reference.
most of the time, you actually don't want to run
pbc unwrap, but rather pbc join. however, this is very
slow, while running pbc join on one frame and then
pbc unwrap and finally pbc wrap -compound fragment
or pbc wrap -compound residue is much more efficient.

> I think from what Jerome says (It does this by wrapping each frame
> around the (unwrapped) coordinates of the previous frame.", maybe this
> implies that you always need the first frame to be unwrapped?

yes, but "joined" not "unwrapped". unwrapping always works
by comparing two frames to detect, which particles moved
farther than half a box length.


> On Mon, Jun 11, 2012 at 7:05 PM, Edward Lyman <> wrote:
>> Hi Jerome,
>> Thanks for your reply. I think that means we must have some other
>> issue to figure out!
>> Best,
>> Ed
>> On Mon, Jun 11, 2012 at 10:54 AM, Jérôme Hénin <> wrote:
>>> Hi Edward,
>>> Unwrap tries to produce a trajectory without any jumps larger than
>>> half the cell size. It does this by wrapping each frame around the
>>> (unwrapped) coordinates of the previous frame.
>>> At not point does it try to put atoms back into a unit cell, so atoms
>>> may diffuse as far from the origin as they want, possibly many cell
>>> sizes away.
>>> Best,
>>> Jerome
>>> On 8 June 2012 17:09, Edward Lyman <> wrote:
>>>> Hi All,
>>>> We are trying to track some weirdness in a long trajectory which we
>>>> would like to unwrap. We are not unwrapping whole molecules just
>>>> single atoms---we have a trajectory of the phosphates only from a
>>>> bilayer simulation.
>>>> What we would like to know is if pbc unwrap will recognize when an
>>>> atom crosses a boundary twice consecutively in the same direction. In
>>>> other words the atom crosses the xmax boundary, then its unwrapped
>>>> image continues diffusing away and crosses the **image** of xmax.
>>>> Let's say the system size is L, and the x max boundary is at L/2. At
>>>> some time an atom crosses the boundary at x=L/2. Some time later, it
>>>> crosses the *same* boundary from the same direction. (without having
>>>> turned around and recrossed) At that point, its unwrapped image is
>>>> crossing an image of the boundary at 3L/2. Does pbc unwrap continue
>>>> the unwrapped image atom happily on his way? Or does he jump back to
>>>> the minimum image position, just across the boundary at L/2?
>>>> Thx,
>>>> Ed

Dr. Axel Kohlmeyer
College of Science and Technology
Temple University, Philadelphia PA, USA.