[gmx-users] Saving velocities of one atom at every timestep

Justin Lemkul jalemkul at vt.edu
Mon Mar 31 00:06:21 CEST 2014

On 3/30/14, 5:40 PM, Andrew DeYoung wrote:
> Hi,
> I have a rather large system (~10,000 atoms) -- at least, I consider it
> rather large since I'm using a cluster, not a supercomputer.
> I want to save the velocities of a single atom of interest at every
> timestep, so that I can use g_velacc to calculate the velocity
> autocorrelation function.  I only care about the single atom of interest;
> I'm not interested in the coordinates, velocities, and forces of the other
> many thousands of atoms in my system.
> In other words, I have enough disk space to save the velocities of the atom
> of interest for every timestep for, say, several millions of steps.  But I
> don't have enough space to save the velocities of all 10,000 atoms for every
> timestep for several millions of steps.
> I'm running Gromacs version 4.5.5.  Setting nstxtcout = 1 allows one to save
> the coordinates of the groups specified in xtc-grps to the xtc trajectory.
> Is there any built-in way to save velocities -- rather than coordinates --
> for only a specified group (a single atom, in this situation)?

No such mechanism exists.

> Or would it be possible to use the xtc to save the coordinates of the atom
> of interest at every timestep, and then somehow convert these coordinates to
> velocities so that I can use g_velacc?  I'm using the leapfrog integrator
> (integrator = md).

Possibly, but recall that with a leap-frog integrator, velocities and positions 
do not co-exist.  Velocities are interpolated from t+dt/2 and t-dt/2.  That's 
true whether or not you back-calculate the velocities or save them on the fly, 

I can think of two alternatives:

1. Break your calculation into segments.  Run mdrun for as long as disk space 
will allow, stop and run trjconv on the .trr file to save only the atom of 
interest, delete the full trajectory, and use tpbconv to extend as you would any 
other simulation.  Loop to repeat.  You'll lose a bit of performance, but not as 
bad as the I/O cost of writing to a trajectory every single step.

2.  You can save the coordinates of interest using xtc-grps and set 
nstxout=nstfout=0 and nstvout=1 to reduce overall trajectory volume.  You'll 
still get the velocities of all the atoms, but you'll still have a compressed 
trajectory with the coordinates and the full-precision velocities at every time 



Justin A. Lemkul, Ph.D.
Ruth L. Kirschstein NRSA Postdoctoral Fellow

Department of Pharmaceutical Sciences
School of Pharmacy
Health Sciences Facility II, Room 601
University of Maryland, Baltimore
20 Penn St.
Baltimore, MD 21201

jalemkul at outerbanks.umaryland.edu | (410) 706-7441


More information about the gromacs.org_gmx-users mailing list