From: Olaf Lenz (
Date: Sat Apr 18 2009 - 04:18:50 CDT


Dan Lussier wrote:
> To 'correct' the problem I am looking to use the pbctools suite on the
> alpha version of 1.8.7 on Linux (32-bit). What I would like to do is to
> wrap the coordinates into the nearest image and then fix the elongated
> bonds problem. In looking at the pbctools documentation I thought of
> trying:
> pbc join res -ref "chain W"
> pbc wrap -all

 From you description of the problem, I think that this approach is
*almost* correct.

1. The first thing that might want to do is to wrap all coordinates into
the central image, by using
   pbc wrap
This is only required, if the particles are distributed over various
images *in the first frame*, and it is required only for the first frame.

2. Then, you should join the water molecules *in the first frame* to
avoid the long bonds. This can be done via
   pbc join res
The "ref" argument is only required for fine-tuning, so I would
recommend not to use it until you notice that you need it. For water
molecules, I think it doesn't matter.

3. Finally, you should use
   pbc unwrap
which will see to it that atoms will not be wrapped in the course of the

> In trying this series of commands I don't get very far though as the pbc
> join ... command causes VMD to crash (terminate called after throwing an
> instance of 'std::bad_alloc' what(): St9bad_alloc).

This must be a bug somewhere in VMD as it is an error message of C++,
and not of Tcl. Probably the system is very big and this is a simple
"Out-of-memory" message? This might in fact be caused by the -ref
argument that you used, as the "chain" might easily contain all water
molecules. So just test not using the ref argument.
Otherwise, to be able to debug, it would help if you could send me the
DCD and PSF file (please do not send it to the list, but to me personally).
Also, try to use "pbc join res -verbose" which will output some more
information which might make it easier to find the problematic piece of

> At this point I'm not sure where the problem lies because I'm not sure
> that my instructions to the pbc join command are ok as I wasn't sure how
> to interpret the instructions for identifying the 'compound' in the pbc
> join command.

I think that your instructions should be OK. The compound argument
denotes, what compounds join will try to join. For example, when you
simulate a protein, it might be interesting to all atoms of the
residues, or the whole chains, depending on what you look at. In your
case, you can use "fragment", which will join all atoms that are somehow
bonded, but using "res" might be faster - if the water molecules are in
fact different residues.