[gmx-users] Writing velocity of particles using template.c
Mark Abraham
Mark.Abraham at anu.edu.au
Thu Jul 26 12:56:00 CEST 2012
On 26/07/2012 8:22 PM, prithvi raj pandey wrote:
> Dear gmx users,
>
> I am using template.c of gromacs 4.0.7 for writing my own analysis
> tool. When I am using the fr.x[i][XX], it writes the coordinates of
> the particles (i crosschecked it with the coordinates written by the
> trjconv command). But the problem arises when I use fr.v[i][XX] for
> writing the velocities of the particles or fr.f[i][XX] for writing the
> force. The program compiles fine by using make command. But finally
> the template stops showing segmentation fault. The main loop is as
> follows -
>
> do {
>
> fprintf(fp,"BOX %f %f %f %f
> \n",fr.time,fr.box[XX][XX],fr.box[YY][YY],fr.box[ZZ][ZZ]);
>
> for (i=0; i<top.atoms.nr; i++)
> {
> fprintf(fp,"Velocity at t=%8.3f : %f %f
> %f\n",fr.time,fr.v[i][XX],fr.v[i][YY],fr.v[i][ZZ]);
> }
> } while(read_next_frame(status,&fr));
>
> Am I using the variable used for writing velocity/force wrongly?
Did you verify that the trajectory has velocities, and that you read
them, and that they're found in fr.v? Look at the code for a tool that
reads velocities (g_velacc, I guess).
Mark
More information about the gromacs.org_gmx-users
mailing list