From: Axel Kohlmeyer (
Date: Sun Feb 16 2020 - 17:37:22 CST


are you sure that you are not mixing up things?

I thought for pbc unwrap, it was irrelevant what grouping you choose,
because it would avoid "jumps" for any atom on a per-atom basis.
So if a molecule is complete and not wrapped in the first frame, it will
remain so. So get the "complete" molecule, if it is not already, you would
use pbc join on that first frame, where indeed you have to specify which
kind of property you want to use to declare an entity "whole".
The compound also then comes into play, if you want to "wrap back" the
unwrapped molecules into the unit cell, as with unwrap, they will move and
spread out.

In summary, you typically would do a sequence of pbc join (needed only for
the first frame!, this is a rater slow operation), pbc unwrap and then pbc
wrap to get a trajectory as was requested by the OP.

BTW: if the plan is to make an animation, perhaps some additional
recommendation. Having molecules jump in an out of the box in every step,
makes for very difficult to watch and "busy" movies. so it can be more
pleasant to watch, if there is another post-processing step, where you loop
over the trajectory after the join/unwrap/wrap and do another unwrap, but
only for small chunks (say 10-20 frames), so that the jumps of molecules
are less frequent and thus less distracting.


On Sun, Feb 16, 2020 at 2:00 PM Giacomo Fiorin <>

> Hello Minjung, "pbc unwrap -compound fragment" (or "qunwrap compound
> fragment" - see link below) would be the way to go, but you should
> ensure that the fragment IDs are correctly assigned. Verify this with:
> set sel [atomselect top all]
> $sel get fragment
> If you don't get the same fragment ID for all the atoms inside one POPC
> molecule, you need to either use something else, e.g. "-compound residue"
> or tell VMD how to get the correct fragment IDs based on how your system is
> set up and the file format you use.
> On Sat, Feb 15, 2020 at 7:05 PM Minjung Godfrey <>
> wrote:
>> Hi,
>> I have a bilayer membrane with POPC with which I'm trying to study the
>> average diffusion rate of individual molecule. Basically, I need to unwrap
>> all, get the center of mass for each molecule, and calculate the average
>> diffusion coefficient of all molecules. When I unwrap it, some molecules
>> get stretched or cut. When it is wrapped, molecules on the boundary get cut
>> (part of the molecule appears on the other side of the box). "-compound
>> fragment -all" does not keep the molecules intact either. Is there a way to
>> keep the individual molecule intact as they jiggle around the edge? How can
>> I keep it whole and only jump to the other side of the box when, say, half
>> the molecule drifts across one boundary?
>> Thank you!
>> Minjung Godfrey
> --
> Giacomo Fiorin
> Associate Professor of Research, Temple University, Philadelphia, PA
> Research collaborator, National Institutes of Health, Bethesda, MD

Dr. Axel Kohlmeyer
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.