# questions about the script in manual to calculate the viscosity of Ar using Green−Kubo formula

Dear lammps-users

I have questions about the script in manual to calculate the viscosity of Ar using Green−Kubo formula (Manual version 18 Oct 2016 page 145). Part of the script used to calculate the viscosity is listed here

variable pxy equal pxy
variable pxz equal pxz
variable pyz equal pyz
fix SS all ave/correlate \$s \$p d & v_pxy v_pxz v_pyz type auto file S0St.dat ave running variable scale equal {convert}/(\${kB}\$T)\$V*s*{dt}
variable v11 equal trap(f_SS[3]){scale} variable v22 equal trap(f_SS[4])*{scale}
variable v33 equal trap(f_SS[5])
\${scale}
thermo_style custom step temp press v_pxy v_pxz v_pyz v_v11 v_v22 v_v33
run 100000
variable v equal (v_v11+v_v22+v_v33)/3.0
variable ndens equal count(all)/vol
print “average viscosity: \$v [Pa.s] @ T K, {ndens} /A^3”

The first question is to calculate the v11. It use trap(f_SS[3])\${scale} to calculate it. But why use f_SS[3]? According to manual, f_SS[3] means the third vector calculated by a fix ave/correlate. But fix ave/correlate just calcualte v_pxyv_pxy, v_pxzv_pxz, v_pyzv_pyz. I think f_SS[3] refers to v_pxy*v_pxy, if so, it is not suppose to be f_SS[3]. Can anyone explain it?

Another question is to calculate variable scale. According to the Green−Kubo formula

There is no s*{dt} in the constant part (V/Kb*T). Why there is s*{dt} in the variable scale?

Fan Li

Dear lammps-users

I have questions about the script in manual to calculate the viscosity of
Ar using Green−Kubo formula (Manual version 18 Oct 2016 page 145). Part of
the script used to calculate the viscosity is listed here

variable pxy equal pxy
variable pxz equal pxz
variable pyz equal pyz
fix SS all ave/correlate \$s \$p d &amp; v\_pxy v\_pxz v\_pyz type auto file S0St\.dat ave running variable scale equal {convert}/(\${kB}*\$T)*\$V*s\*{dt}
variable v11 equal trap(f_SS[3])*\{scale\} variable v22 equal trap\(f\_SS\[4\]\)\*{scale}
variable v33 equal trap(f_SS[5])*\${scale}
thermo_style custom step temp press v_pxy v_pxz v_pyz v_v11 v_v22 v_v33
run 100000
variable v equal (v_v11+v_v22+v_v33)/3.0
variable ndens equal count(all)/vol
print "average viscosity: \$v [Pa.s] @ T K, {ndens} /A^3"

The first question is to calculate the v11. It use trap(f_SS[3])*\${scale}
to calculate it. But why use f_SS[3]? According to manual, f_SS[3] means
the third vector calculated by a fix ave/correlate. But fix ave/correlate
just calcualte v_pxy*v_pxy, v_pxz*v_pxz, v_pyz*v_pyz. I think f_SS[3]
refers to v_pxy*v_pxy, if so, it is not suppose to be f_SS[3]. Can anyone
explain it?

​it *is* supposed to be f_SS[3]. here is the relevant section of the
documentation:

This fix computes a global array of values which can be accessed by
various "output commands"_Section_howto.html#howto_15. The values can
only be accessed on timesteps that are multiples of {Nfreq} since that
is when averaging is performed. The global array has # of rows =
{Nrepeat} and # of columns = Npair+2. The first column has the time
delta (in timesteps) between the pairs of input values used to
calculate the correlation, as described above. The 2nd column has the
number of samples contributing to the correlation average, as
described above. The remaining Npair columns are for I,J pairs of the
N input values, as determined by the {type} keyword, as described
above.

For {type} = {auto}, the Npair = N columns are ordered: C11, C22, ..., CNN.
[...]

Another question is to calculate variable scale. According to the
Green−Kubo formula

There is no s\*{dt} in the constant part (V/Kb*T). Why there is s\*{dt}
in the variable scale?

​this has been answered *very* recently on this mailing list. please check
the archives.

axel.​

Hi

I have checked the mailist which used the Green−Kubo formula either to calculate the thermal conductivity or viscosity and I learn a lot, but I do not find explaination about my questions. Could anyone give me a link or explaintion. Sorry for asking such questions.

Fan Li

Hi

I have checked the mailist which used the Green−Kubo formula either to
calculate the thermal conductivity or viscosity and I learn a lot, but I do
not find explaination about my questions. Could anyone give me a link or
explaintion. Sorry for asking such questions.​