# [gmx-users] viscosity using green-kubo

David van der Spoel spoel at xray.bmc.uu.se
Wed Dec 16 17:45:06 CET 2015

```On 16/12/15 15:42, Gmx QA wrote:
> Dear gmx-users
>
> I sent mail a couple days ago about viscosity calculations, but no-one
> answered so maybe it was too lengthy, so better luck this time I hope.
>
> I want to calculate viscosity using Green-Kubo formalism, and have run a
> box with tip3p waters for 100 ps in NVE, saving data every 1 fs.
>
> For green-kubo, I then first use gmx energy to get (one of) the
> off-diagonal elements in the pressure tensor (Pxy in this case)
>
> \$ gmx energy -f nve_prod.edr -o nve_prod_pressure_tensor_pxy.xvg
>
> Then, I use gmx analyze to calculate the auto-correlation function of the
> Pxy pressure component
>
> \$ gmx analyze -f nve_prod_pressure_tensor_pxy.xvg -ac
> nve_prod_pressure_tensor_pxy_acf.xvg -nonormalize
>
> And then again gmx analyze to integrate it.
> \$ gmx analyze -f nve_prod_pressure_tensor_pxy_acf.xvg -integrate
>
> That gives me :
> Calculating the integral using the trapezium rule
> Integral 1  1940.24341  +/-    0.00000
>
> Which I then plug into the green-kubo formula
> eta = V/(kB*T)* int(…) = …=
>
> For my V=1.59e-26 m^3, T=303 K and with kB=1.38e-23 I get eta = 0.0074
>
> tried changing the unit of the pressure from bar to pascal by multiplying
> with 100000, but the results makes equally less sense.
>
> I have also read about averaging over several of the off-diagonal pressure
> tensor components, which I could try, but is there anything fundamental
> that I am missing above?
>
> Hope for better luck with some answers this time!
> /PK
>
Have you tried gmx energy -vis ?

--
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se
```