I am sure Dan will give you his solution, but here is mine with pytraj (
https://github.com/Amber-MD/pytraj)
#
https://gist.github.com/hainm/31e18ade8c1fb53c1d26
import pytraj as pt
import numpy as np
traj = pt.iterload('tz2.nc', 'tz2.parm7')
# note: use pt.load method if your trajectory is fit well to memory
c0 = pt.center_of_mass(traj, ':1-3')
c1 = pt.center_of_mass(traj, ':4-7')
c2 = pt.center_of_mass(traj, ':8-10')
c3 = pt.center_of_mass(traj, ':11-13')
# create a new array with shape=(n_frames, 4, 3)
xyz = np.hstack((c0, c1, c2, c3)).reshape(traj.n_frames, 4, 3)
print(xyz.shape)
# create a fake Topology with 4 atoms
fake_top = pt.tools.make_fake_topology(n_atoms=4)
# save to disk if using vmd
# fake_top.save('myfakeparm.parm7')
print(fake_top)
# write your fake trajectory
pt.write_traj('mytraj.nc', xyz, top=fake_top, overwrite=True)
good luck
Hai
On Sun, Mar 13, 2016 at 1:57 PM, Hirdesh Kumar <hirdesh.iitd.gmail.com>
wrote:
> ​Thanks Dan for your reply,
>
> I checked the suggested archive:
> http://archive.ambermd.org/201603/0049.html
>
> As your suggestion, indeed currently I am using 4 "vector" commands..
>
> But, in such case, I get four different trajectories, which I visualize
> only after uploading individual trajectory as different "new" molecules
> which is bit cumbersome.
>
> It would be great if I can visualize four center of masses as a "single"
> molecule in VMD.
>
> Thanks,
> Hirdesh
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Mar 13 2016 - 12:00:03 PDT