Viscosity calculation¶
The shear viscosity is a property of liquids that can be determined easily by experiment. It is useful for parameterizing a force field because it is a kinetic property, while most other properties which are used for parameterization are thermodynamic. The viscosity is also an important property, since it influences the rates of conformational changes of molecules solvated in the liquid.
The viscosity can be calculated from an equilibrium simulation using an Einstein relation:
This can be done with gmx energy. This method converges very slowly 149, and as such a nanosecond simulation might not be long enough for an accurate determination of the viscosity. The result is very dependent on the treatment of the electrostatics. Using a (short) cut-off results in large noise on the off-diagonal pressure elements, which can increase the calculated viscosity by an order of magnitude.
GROMACS also has a non-equilibrium method for determining the viscosity 149. This makes use of the fact that energy, which is fed into system by external forces, is dissipated through viscous friction. The generated heat is removed by coupling to a heat bath. For a Newtonian liquid adding a small force will result in a velocity gradient according to the following equation:
Here we have applied an acceleration \(a_x(z)\) in the \(x\)-direction, which is a function of the \(z\)-coordinate. In GROMACS the acceleration profile is:
where \(l_z\) is the height of the box. The generated velocity profile is:
The viscosity can be calculated from \(A\) and \(V\):
In the simulation \(V\) is defined as:
The generated velocity profile is not coupled to the heat bath. Moreover, the velocity profile is excluded from the kinetic energy. One would like \(V\) to be as large as possible to get good statistics. However, the shear rate should not be so high that the system gets too far from equilibrium. The maximum shear rate occurs where the cosine is zero, the rate being:
For a simulation with: \(\eta=10^{-3}\) [kgm\(^{-1}\)s\(^{-1}\)], \(\rho=10^3\)[kgm\(^{-3}\)] and \(l_z=2\pi\)[nm], \(\mbox{sh}_{\max}=1\)[psnm\(^{-1}\)] \(A\). This shear rate should be smaller than one over the longest correlation time in the system. For most liquids, this will be the rotation correlation time, which is around 10 ps. In this case, \(A\) should be smaller than 0.1[nmps\(^{-2}\)]. When the shear rate is too high, the observed viscosity will be too low. Because \(V\) is proportional to the square of the box height, the optimal box is elongated in the \(z\)-direction. In general, a simulation length of 100 ps is enough to obtain an accurate value for the viscosity.
The heat generated by the viscous friction is removed by coupling to a heat bath. Because this coupling is not instantaneous the real temperature of the liquid will be slightly lower than the observed temperature. Berendsen derived this temperature shift 31, which can be written in terms of the shear rate as:
where \(\tau\) is the coupling time for the Berendsen thermostat and \(C_v\) is the heat capacity. Using the values of the example above, \(\tau=10^{-13}\) [s] and \(C_v=2 \cdot 10^3\)[J kg\(^{-1}\)K\(^{-1}\)], we get: \(T_s=25\)[Kps\(^{-2}\)]sh\(_{\max}^2\). When we want the shear rate to be smaller than \(1/10\)[ps\(^{-1}\)], \(T_s\) is smaller than 0.25[K], which is negligible.
Note that the system has to build up the velocity profile when starting from an equilibrium state. This build-up time is of the order of the correlation time of the liquid.
Two quantities are written to the energy file, along with their averages and fluctuations: \(V\) and \(1/\eta\), as obtained from ((412)).