# Ensemble for viscosity calculation in Non equilibrium MD

**URL:** <https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [October 12, 2021, 1:35pm UTC](https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948 "2021-10-12T13:35:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kavya](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/kavya/32/1109_2.png) [@Kavya](https://gromacs.bioexcel.eu/u/Kavya)\
**Post date:** [October 12, 2021, 1:35pm UTC](https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948/1 "2021-10-12T13:35:12Z")

</div>

GROMACS version: 2020.1  
GROMACS modification: No

I am trying to understand the calculation of viscosity using combinations of different ensembles and different methods.

For non equilibrium MD calculation using periodic perturbation of external shear, which is the best ensemble that can be used? My values appear similar for NVT and NPT but vary significantly with NVE ensemble. I am assuming that NVE gives the best results because of no influence of thermostat and barostat and all of the change in energy due to the applied shear is captured in calculation of viscosity. Is my reasoning appropriate? Can someone direct me to a research paper with the right way of calculating viscosity using Non equilibrium MD?

Finally, which is the best way to calculate viscosity optimising computational time and accuracy of results?

---

<div class="post-metadata">

**Author:** ![Teslim](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Teslim](https://gromacs.bioexcel.eu/u/Teslim)\
**Post date:** [October 13, 2021, 10:52am UTC](https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948/2 "2021-10-13T10:52:18Z")

</div>

Read this paper

[https://www.livecomsjournal.org/index.php/livecoms/article/view/v1i1e6324](https://www.livecomsjournal.org/index.php/livecoms/article/view/v1i1e6324)

---

<div class="post-metadata">

**Author:** ![Kavya](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/kavya/32/1109_2.png) [@Kavya](https://gromacs.bioexcel.eu/u/Kavya)\
**Post date:** [October 13, 2021, 1:06pm UTC](https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948/3 "2021-10-13T13:06:43Z")

</div>

Thank you. I have gone through this one already and it is based on equilibrium MD. My intention was to find something similar for non-equilibrium MD.

---

<div class="post-metadata">

**Author:** ![MichelePellegrino](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/michelepellegrino/32/628_2.png) [@MichelePellegrino](https://gromacs.bioexcel.eu/u/MichelePellegrino)\
**Post date:** [October 14, 2021, 1:10pm UTC](https://gromacs.bioexcel.eu/t/ensemble-for-viscosity-calculation-in-non-equilibrium-md/2948/4 "2021-10-14T13:10:01Z")

</div>

Hi Kavya,

the thermostat influence in the non-equilibrium cosine perturbation approach is automatically taken care by GROMACS, which biases termperature rescaling based on the velocity profile of fluid particles.

However, some thermostats will introduce additional ‘artificial’ viscosity, so your reasoning is correct, I believe. However, from a practical standpoint I don’t see the reason why one would want to compute a nominal value of viscosity from a NVE simulation, mainly because of two reasons:

- production runs are rarely NVE, so you would want to use a consistent value for viscosity (and the one from NVE would be incorrect).
- viscosity itself is a function of temperature, so I’m not sure if it makes sense from a purely physical standpoint to estimate if by fixing the total energy, rather than temperature.

When it comes to pressure, as far as I know it may be problematic to estimate viscosity from _equilibrium_ NPT simulations (you want the cell volume not to fluctuate in order for the Green-Kubo formula to converge). I am not sure about non-equilibrium though; probably volume fluctuations are not a problem in NE.
