# [gmx-users] Pressure Calculation in Gromacs

Brandon Wiebe Brandon.Wiebe at ufv.ca
Tue Jul 17 05:05:07 CEST 2018

```Thank you, Justin.

So if I wanted to simulate a system of Lennard-Jones particles under the NPT ensemble using reduced units, would I need to set ref_p to P*, or PRESFAC*(P*)?

Regards,
Brandon
________________________________________
From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se [gromacs.org_gmx-users-bounces at maillist.sys.kth.se] on behalf of Justin Lemkul [jalemkul at vt.edu]
Sent: Monday, July 16, 2018 7:23 PM
To: gmx-users at gromacs.org
Subject: Re: [gmx-users] Pressure Calculation in Gromacs

On 7/16/18 9:55 PM, Brandon Wiebe wrote:
> Hi there,
>
> I am wondering if anyone can break down exactly how the instantaneous pressure of any given frame is calculated in Gromacs?
>
> According to section 3.4.3 of the manual, the pressure tensor is given by: P = (2/V) * (Ek - W), where Ek is kinetic energy and W is the virial.
> I have taken a particular frame and calculated the volume, kinetic energy and virial.
> My calculated quantities all match quite closely with the values reported by Gromacs, however, the pressure that I get is significantly lower than the value reported by Gromacs.
> The elements of my calculated pressure tensor are all approximately 16.5 times smaller than those reported by Gromacs, even though the component quantities that go into the pressure calculation are nearly identical.

There's a unit conversion factor (see src/gromacs/math/units.h):

/* Pressure in MD units is:
* 1 bar = 1e5 Pa = 1e5 kg m^-1 s^-2 = 1e-28 kg nm^-1 ps^-2 = 1e-28 /
AMU amu nm^1 ps ^2
*/
#define BAR_MDUNITS      (1e5*NANO*PICO*PICO/AMU)
#define PRESFAC          (1.0/BAR_MDUNITS)

PRESFAC works out to be 16.6.

-Justin

> I have repeated this calculation for a number of frames, and have tried using Gromacs 4.6.7 and 5.0.4 to no avail.
> Clearly there is some systematic error in my methodology, where could this discrepancy come from?
>
> Regards,
> Brandon

--
==================================================

Justin A. Lemkul, Ph.D.
Assistant Professor
Virginia Tech Department of Biochemistry

303 Engel Hall
340 West Campus Dr.
Blacksburg, VA 24061

jalemkul at vt.edu | (540) 231-3129
http://www.thelemkullab.com

==================================================

--
Gromacs Users mailing list

* Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!

* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists

* For (un)subscribe requests visit
https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
```