From: Axel Kohlmeyer (
Date: Mon Dec 09 2013 - 10:21:08 CST

On Mon, Dec 9, 2013 at 4:55 PM, Ali Alizadeh <> wrote:
> Dear Axel,
> Thank you very much for your reply.
> I know I am ready for scripting but If possible I need some guides. I have
> found I can calculate the COM of molecules but I do not know how I can
> save them and write in to standard trajectory.

here is the recipe in 'vmd shorthand':
you need to build a new molecule with "mol new atoms ###" where ### is
the number of molecules, create a selection for this molecule
containing all atoms with atomselect, and then loop over the existing
trajectory, collect the COMs in a list of xyz coordinate triples,
create a new frame in the new molecule with "animate dup", then step
the selection to that frame and assign the coordinate list to the {x y
z} property.

once the loop is complete, you can save the new molecule as a .dcd or
similar file. for easier processing, you may assign some other
properties (type, name, mass, etc.) to the atoms in the molecule and
write out a .psf file as well.

more detailed explanations for all those steps are in the users guide
and some examples for parts of these tasks are in some of the
available tutorials as well. each step by itself is fairly simple, the
complications come from having to combine and properly assemble all of
them. you are better off first writing small test scriptlets where you
practice each feature and piece separately until you are confident to
know what you are doing. any more detailed guide would be the same as
writing the script directly.


> On Mon, Dec 9, 2013 at 6:32 AM, Axel Kohlmeyer <> wrote:
>> Possible? Yes.
>> Automatic? No.
>> It would require quite a bit of custom vmd scripting. Not very difficult,
>> but you would have to combine different pieces of scripting that have been
>> discussed before.
>> Axel.
>> --
>> Dr. Axel Kohlmeyer
>> International Centre for Theoretical Physics, Trieste. Italy.
>> ________________________________
>> From: Ali Alizadeh <>
>> Sender:
>> Date: Mon, 9 Dec 2013 16:39:30 +0330
>> To: Vmd l<>
>> Subject: vmd-l: Atomic trajectory to COM trajectory,
>> Dear All users,
>> I have done an NVT ensemble with LAMMPS package. I have saved its
>> trajectory in trr format.
>> Now, I want to convert that atomic trajectory to trajectory of center of
>> mass of molecules. Is it
>> possible? Does any body have experience? I want to do this for calculation
>> of density and g(r)
>> values of COMs in VMD. Can I save the coordinates of atomic trajectory of
>> atoms as COM
>> trajectory?
>> --
>> Sincerely
>> Ali Alizadeh
> --
> Sincerely
> Ali Alizadeh

Dr. Axel Kohlmeyer
International Centre for Theoretical Physics, Trieste. Italy.