How to obtain the virial term

Hi, Steve Plimpton
Thanks for you help.
Could I ask you another question,please? As you told me, I have found the Virial Term in the Compute stress/atom command, as dipicted in Manual,“The tensor for each atom has 6 components and is stored as a 6-element vector in the following order: xx, yy, zz, xy, xz, yz.”
Now the question is, I want to calculate the average virial terms per paiticle of each species in my system,the result should be a saclar, but we only get the 6-element vector at last. How can I change the vector into the saclar? The command Compute reduce ave may be all right, as dipicted in manual “The ave
setting adds the vector values into a global total, then divides by the number of values in the vector”.
I want to know whether the vector is the 6-element vector or the Nx1 vector that consist of the component of the 6-element vector of different atoms at the same time (N is thenumber of particle)?
If the answer is the later one, the command is only simply to add the different direction component of the vector into a scalar?
Thanks for your time and your kindly help.
Best regards.

Do you want the virial terms or do you want something that doesn’t have any physical meaning? And worse, isn’t robust to changes of frame. Do you want your scalar to change if you rotate your system slightly? Those six elements are part of a stress tensor, and it can be reported as a six element vector because it is a symmetric tensor.

This is a conceptual issue and I suggest you look into stress tensor invariants and decompositions. No amount of computes can help you here.

missed this piece.

I want to know whether the vector is the 6-element vector or the Nx1 vector that consist of the component of the 6-element vector of different atoms at the same time (N is thenumber of particle)?

If you have applied fix ave/atom, the averaging has been done over the group of atoms you indicated in the fix. Then you will be left with a 6 row vector, the average stress/atom.