[gmx-developers] virial

David van der Spoel spoel at xray.bmc.uu.se
Thu Jan 11 09:12:07 CET 2007

Jason de Joannis wrote:
> Let me revive an old topic concerning the fshift correction
> to the virial. This term is added up in the calc_vir function and
> I believe it is equivalent to the second term in Eq(2) of the 2005 
> Gromacs paper or Eq. B.11 of the manual. Since that term is
> rather simple it should be easy to check with the following snippet of 
> code:
>  clear_mat(virtest);
>  for (n=start; n<start+homenr; n++)
>    for (i=0;i<DIM;i++) for (j=0;j<DIM;j++)
>      virtest[i][j] -= 0.25*box[i][i]*graph->ishift[n][i]*f[n][j];
> Unfortunately I am not getting the same number for the trace of the
> virial tensor. Any suggestions would be appreciated.
> /Jason

Do you have a rectangular box? Otherwise you need to use box[i][j].

Have you run mdrun with -debug? It will print temp variables to mdrun.log.

David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  	75124 Uppsala, Sweden
phone:	46 18 471 4205		fax: 46 18 511 755
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://folding.bmc.uu.se

More information about the gromacs.org_gmx-developers mailing list