# [gmx-users] Scalar virial

David van der Spoel spoel at xray.bmc.uu.se
Sun Feb 5 09:52:55 CET 2006

```Tandia, Adama wrote:
> Dear All,
>
> I'm running a NVT MD where I quench a system from 3000K to 1000K. At the
> end of the quench,  I want to use the following relation:
>
> 	P = Rho*k_B*T + (1/3V) * < Sum_{i<j}[F(r_ij).r_ij] >
>
> where Rho is a number density, V the volume of the system, and k_B the
> Boltzmann constant.
> 1- How can one extract the scalar virial (< Sum_{i<j}[F(r_ij).r_ij] >)
> from the simulation?
> 2- I have considered taking the scalar virial as
> (1/3)(virial_XX+virial_YY+virial_ZZ) from the virial tensor, and
> recalculate the pressure but there seems to be a problem in the values.
> The pressure that I have from this calculation is very different from
> that one calculated from the trace of the pressure tensor. I saw on the
> list there was a bug in the virial calculation. Has this been fixed in
> the version 3.2.1?
> Anyone has an idea what is going on?
>
Try to compute the scalar virial from the pressure and the kinetic
energy, using:

P = (2/V) [ Ekin - Vir ] (chapter 3.4)

And see how it compares. Note that you need a conversion factor from MD
units to bar for the pressure. The factor is roughly 16.6

--
David.
________________________________________________________________________
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://xray.bmc.uu.se/~spoel
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

```