# Shear Viscosity

**URL:** <https://gromacs.bioexcel.eu/t/shear-viscosity/702>\
**Category:** User discussions\
**Created:** [August 25, 2020, 4:37am UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702 "2020-08-25T04:37:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sapkotadheeraj](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sapkotadheeraj](https://gromacs.bioexcel.eu/u/sapkotadheeraj)\
**Post date:** [August 25, 2020, 4:37am UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702/1 "2020-08-25T04:37:01Z")

</div>

GROMACS version: 5.1.2  
GROMACS modification: Yes/No  
Here post your question

Hi everyone,  
Is there any best tutorial to calculate shear viscosity of carbohydrate in water? I already obtained diffusion coefficient of carbohydrate in water. Do the files obtained during msd run work for calculating viscosity? I will be much thankful if any one could help me to know the steps to be followed to calculate shear viscosity.

---

<div class="post-metadata">

**Author:** ![pjohansson](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pjohansson/32/316_2.png) [@pjohansson](https://gromacs.bioexcel.eu/u/pjohansson)\
**Post date:** [August 25, 2020, 6:56am UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702/2 "2020-08-25T06:56:13Z")

</div>

Hello!

Viscosity calculation can be done using several methods, although their accuracy and sometimes results may vary. A few equilibrium and non-equilibrium methods are described and compared in (among many others) [Hess (2002)](https://doi.org/10.1063/1.1421362), and [Bordat & Müller-Plathe (2002)](https://doi.org/10.1063/1.1436124).

The former paper describes a few methods which are available in the Gromacs tools. [See this chapter in the manual for more information.](http://manual.gromacs.org/current/reference-manual/special/viscosity-calculation.html)

As an aside, unless you are required to use Gromacs 5.1.2 specifically, I would suggest upgrading to the newest release (2020.3). The 5-series is five years old at this point, and many improvements have since been made to both speed and usability.

Regards,  
Petter

---

<div class="post-metadata">

**Author:** ![sapkotadheeraj](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sapkotadheeraj](https://gromacs.bioexcel.eu/u/sapkotadheeraj)\
**Post date:** [September 5, 2020, 5:02pm UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702/3 "2020-09-05T17:02:13Z")

</div>

Dear pjohansson,  
Thank you very much for your help. I red two papers that you suggested. However, I’m facing problems to create .mdp files for the run to find viscosity. Secondly, could you help me to know the the exact procedures to follow (I mean the steps to be followed)?

---

<div class="post-metadata">

**Author:** ![pjohansson](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pjohansson/32/316_2.png) [@pjohansson](https://gromacs.bioexcel.eu/u/pjohansson)\
**Post date:** [September 7, 2020, 11:14am UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702/4 "2020-09-07T11:14:15Z")

</div>

The steps and .mdp options involved depend on which method you want to measure the viscosity through. As I mentioned, [this chapter in the manual](http://manual.gromacs.org/current/reference-manual/special/viscosity-calculation.html) has more information on how to use two of the methods that Gromacs supports. The first method uses `gmx energy -vis` along with a (very long) NPT ensemble simulation. The `-vis` flag makes `gmx-energy` output `evisco.xvg` and `eviscoi.xvg` which is the Einstein relation shear viscosity and its integral, respectively (of course you can calculate these by yourself using the relation and the pressure tensor components). Note that both files contains its component along all directions and then the average of them all. The second method uses [the `cos-acceleration` MDP option](http://manual.gromacs.org/documentation/current/user-guide/mdp-options.html#mdp-cos-acceleration). Typically, you want to simulate in double precision.

---

<div class="post-metadata">

**Author:** ![sapkotadheeraj](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sapkotadheeraj](https://gromacs.bioexcel.eu/u/sapkotadheeraj)\
**Post date:** [September 11, 2020, 8:11am UTC](https://gromacs.bioexcel.eu/t/shear-viscosity/702/5 "2020-09-11T08:11:37Z")

</div>

Im using periodic perturbation method to calculate the viscosity for carbohydrate in water. Here i have attached the .mdp file that i constructed. Please kindly suggest whether this mdp file parameters are sufficient or not .

;PREPROCESSING PARAMETERS  
define=DPOSRES

;RUN CONTROL  
integrator=md  
tinit=0  
dt=0.001  
nsteps=1200000

;BOND CONSTRAINTS  
constraints=none  
constraints\_algorithm=lincs  
lincs\_order=4

;OUTPUT CONTROL  
nstxout=1000  
nstvout=1000  
nstfout=0  
nstlog=1000  
nstenergy=1000

;NEIGHBOR LIST  
ns\_type=grid  
nstlist=5  
rlist=0.9  
pbc=xyz  
periodic\_molecules=no

;ELECTROSTATICS  
coulombtype=PME  
rcoulomb=0.9  
optimize\_fft=yes  
vdwtype=cut-off  
rvdw=0.9  
DispCorr=EnerPres

;TEMPERATURE COUPLING  
Tcoupl=berendsen  
tc-grps=system  
tau\_t=0.1  
ref\_t=300

;PRESSURE COUPLING  
Pcoupl=no  
Pcoupltype=isotropic  
tau\_p=1.0  
compressibility=4.5e-5  
ref\_p=1.0

;VELOCITY GENERATION  
gen\_vel=no  
gen\_temp=300  
gen\_seed=173529

;NON-EQUILIBRIUM MD  
cos-acceleration=0.025  
acc-grps=SYSTEM
