Viscosity

Viscosity — transport_analysis.analysis.viscosity

This module offers a class for the lightweight computation of shear viscosity via the Einstein-Helfand method. It outputs the “viscosity function,” the product of viscosity and time as a function of time, from which the slope is taken to calculate the shear viscosity. This is described in eq. 5 of E M Kirova and G E Norman 2015 J. Phys.: Conf. Ser. 653 012106.

class transport_analysis.viscosity.ViscosityHelfand(atomgroup: AtomGroup, temp_avg: float = 300.0, dim_type: str = 'xyz', **kwargs)[source]

Class to calculate viscosity using the Einstein-Helfand approach. Note that the slope of the viscosity function, the product of viscosity and time as a function of time, must be taken to obtain the viscosity.

Parameters
  • atomgroup (AtomGroup) – An MDAnalysis AtomGroup. Note that UpdatingAtomGroup instances are not accepted.

  • temp_avg (float (optional, default 300)) – Average temperature over the course of the simulation, in Kelvin.

  • dim_type ({‘xyz’, ‘xy’, ‘yz’, ‘xz’, ‘x’, ‘y’, ‘z’}) – Desired dimensions to be included in the viscosity calculation. Defaults to ‘xyz’.

Variables
  • atomgroup (AtomGroup) – The atoms to which this analysis is applied

  • dim_fac (int) – Dimensionality \(d\) of the viscosity computation.

  • results.timeseries (numpy.ndarray) – The averaged viscosity function over all the particles with respect to lag-time. Obtained after calling ViscosityHelfand.run()

  • results.visc_by_particle (numpy.ndarray) – The viscosity function of each individual particle with respect to lag-time.

  • start (Optional[int]) – The first frame of the trajectory used to compute the analysis.

  • stop (Optional[int]) – The frame to stop at for the analysis.

  • step (Optional[int]) – Number of frames to skip between each analyzed frame.

  • n_frames (int) – Number of frames analysed in the trajectory.

  • n_particles (int) – Number of particles viscosity was calculated over.