Units in "Compute Viscosity"

Dear community,

I am trying to compute the viscosity of a liquid using “compute viscosity” together with “fix accelerate/cos”, and I don’t fully understand the units. I am using “units real”. The relevant equations are found on

https://docs.lammps.org/fix_accelerate_cos.html

I refer to the source code example from the “compute viscosity” page:

compute  cos all viscosity/cos
variable V equal c_cos[7]
variable A equal 0.02E-5
variable density equal density
variable lz equal lz
variable reciprocalViscosity equal v_V/${A}/v_density*39.4784/v_lz/v_lz*100

If I see it correctly, the acceleration A is in units of kCal Angstrom^-1 g^-1, the velocity V in units of Angstrom fs^-1, the density in g cm^-3, and Lz in Angstrom. The 39.4784 is the 4pi^2, that’s clear. But how does the factor 100 appear? When I try to obtain units of (Pa*s)^-1 for the reciprocal viscosity, I obtain an additional factor of 238.85 … The “kCal” from the acceleration does not shorten out as far as I see, so the “4.18” should appear somewhere.

Could somebody help me to understand what the resulting output unit of the above code example from the LAMMPS manual is?

Best regards,
Martin

Your best shot is to contact the author of that code. Contact info should be in the source code.

Thanks for this suggestion. I contacted the author of the code (Zheng Gong), and he immediately replied. There is an inconsistency in the LAMMPS documentation of “fix accelerate/cos”. There it is written that the acceleration is specified in units of force/mass, but it is actually specified in position/time^2. With this new information, everything seems to be consistent now, and the code example from above yields the reciprocal viscosity in (Pa*s)^-1 as expected.

Zheng wrote that he is going to update the LAMMPS documentation.

Best regards,
Martin

1 Like

Thanks for reporting back. This is highly welcome as it avoids frustration in people that search the web for similar issues and see an inquiry without the resolution.