how to integrate a thermo variable on-the-fly

Dear LAMMPS developers and users,

I would like to compute the shear viscosity with the Einstein relation as shown as equation (2) in the following article:

To this end, I need to integration of Pxy on-the-fly for later use.

For example, I need to calculate: Integrate[pxy,0,1], Integrate[pxy,0,2], Integrate[pxy,0,3],…and use the data points for computing the slope, which is similar to calculating diffusivity with the Einstein relation.

So, besides either doing post-processing or modifying LAMMPS the source code, is there a way to do that within the input script?

Wish that I have made myself clear. Thank you for the help.

LC Liu

I think it would be easiest to do as a post-processing step, particularly
since calculating the slope involves fitting a line. You can look at the
fix ave/correlate and fix ave/time and variable trap() function (for trapezoidal
integration) to see if there is some way to compute the series of
integrate() functions
you list below. But I don't think so, since it requires LAMMPS to hold
on to a list of old pxy values. Since int(pxy,0,10) is just a one-term addition
to int(pxy,0,9), maybe there is some way to output the running integration
as a variable formula and using a loop for the run in your input script.