# Bulk viscosity calculation using gmx

**URL:** <https://gromacs.bioexcel.eu/t/bulk-viscosity-calculation-using-gmx/6464>\
**Category:** User discussions\
**Created:** [May 22, 2023, 12:51pm UTC](https://gromacs.bioexcel.eu/t/bulk-viscosity-calculation-using-gmx/6464 "2023-05-22T12:51:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sancharitanni](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sancharitanni](https://gromacs.bioexcel.eu/u/sancharitanni)\
**Post date:** [May 22, 2023, 12:51pm UTC](https://gromacs.bioexcel.eu/t/bulk-viscosity-calculation-using-gmx/6464/1 "2023-05-22T12:51:38Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
module load gromacs/2021.5-gcc/9.5.0-mpi-openmp-cu11\_1  
I have been trying to calculate bulk viscosity using Einstein relation  
below is my vis.mdp file.when I am trying to  
gmx\_mpi energy -f vis.edr -vis viscosity.xvg ,it asked me about the  
Opened vis.edr as single precision energy file  
Enter the box volume (nm^3): 9  
Afterthat,I can see only two files generates evisco.xvg,eviscoi.xvg.I didnt see any viscosity value.I donot know Whether I am using the correct procedure to calculate bulk viscosity.Anyone having any idea to calculate bulk viscosity in gromacs?  
; very basics of the simulation  
integrator = md ; solve newtown’s equation of motion  
dt = 0.002 ; integration time step / ps  
nsteps = 50000000 ; number of steps (50000000 \* 0.002 = 100 ns)

; remove drifts of the center of mass  
comm-mode = linear ; remove COM translation  
nstcomm = 10 ; number of steps for COM removal  
comm-grps = System ; COM translation removed from system

; control frequency of output  
nstvout = 0 ; write velocities to trajectory file every number of steps  
nstfout = 0 ; write forces to trajectory file every number of steps  
nstlog = 10000 ; update log file every number of steps  
nstcalcenergy = 10 ; calculate energies/pressures every nstenergy steps  
nstenergy = 10 ; write energies to energy file every number of steps  
nstxout-compressed = 10000 ; write positions using compression (saves memory, worse quality)  
compressed-x-precision = 1000 ; precision to write compressed trajectory

; next neighbor search and periodic boundary conditions  
nstlist = 20 ; freq. to update neighbor list & long range forces (\>= 20 w/ GPUs)  
rlist = 1.4 ; short-range neighbor list cutoff (nm)  
cutoff-scheme = Verlet ; atom-based neighbor search with an implicit buffer region  
pbc = xyz ; periodicity in x, y and z

; coulomb interaction  
coulombtype = PME ; particle-mesh ewald summation for long range (\>rcoulomb)  
rcoulomb = 1.4 ; short-range electrostatic cutoff (in nm) (with PME,rcoulomb \>= rvdw)  
coulomb-modifier = Potential-shift-Verlet ; shifts potential by constant so potential is 0 at cut-off  
fourierspacing = 0.168 ; spacing of FFT in reciprocal space in PME long range treatment (in nm)  
pme-order = 4 ; cubic PME interpolation order

; lennard-jones potential handling  
vdwtype = cutoff ; simple truncation cutoff  
vdw-modifier = Potential-shift-Verlet ; shifts potential by constant so potential is 0 at cut-off  
rvdw = 1.4 ; short-range vdw cutoff (in nm)  
DispCorr = EnerPres ; long range correction for energy and pressure from using vdw cutoff

; temperature coupling  
tcoupl = v-rescale ; the algorithm to use, v-rescale generates correct canonical ensemble  
tc-grps = System ; groups to couple to temperature bath  
tau-t = 1.0 ; time constant (in ps), meaning varies by algorithm  
ref-t = 328 ; temperature for coupling (K)  
nsttcouple = 1 ; frequency to couple temperature

; velocity generation  
gen-vel = yes ; generate velocities according to Maxwell distr. (no for initial vel 0)  
gen-temp = 328 ; temperature for Maxwell distribution (K)  
gen-seed = -1 ; generate a random seed

; pressure coupling  
pcoupl = no ; the algorithm to use (no for NVT)

; constraints  
constraints = h-bonds ; constrains bonds only involving hydrogen  
constraint\_algorithm = lincs ; algorithm to use, lincs should NOT be used for angle constraining  
lincs-order = 4 ; highest order in constraint coupling matrix expansion  
lincs-iter = 1 ; accuracy of lincs algorithm  
continuation = no ; no for applying constraints at start of run
