According to Rob’s reply:

Hi, Zhimin. What I do to get the whole stress tensor is simply to dump

the 3 elements of p_component[] (an array defined in pressure.cpp) to

the log file. If you use thermo_style one, you can easily implement by

adding a few lines to ThermoOne::compute such as

double press = pressure->p_total; // this line is already there

double pressX = pressure->p_component[0];

double pressY = pressure->p_component[1];

double pressZ = pressure->p_component[2];

I think you could add the off-diagonal elements of the pressure tensor

by extending p_component to 6 elements and modifying pressure.cpp to

access the 3,4,5 components of virial[] as appropriate.

Rob

I changed pressure.h, pressure.cpp to add the off-diagnoal pressure tensor, and

then make some modification in thermo_one.cpp to print all the pressure tensor

into the log file. I obtained these tensors and then calculated the stress autocorrelation

function to get the shear viscosity of the lj particle system, but it seemed that

the correlation function decays very fast( about 20 timestep to decay to 0) and the

fluctuation is very large at long time. I am wondering whether something was wrong

during the modification of the code and the calculation of the shear viscosity. Any

suggestion? Thanks!