[lammps-users] How to average in space "extensive" quantities (non per-atom quantities) ?

Dear Lammps users and Steve,

Thank you for your previous comments.

How can I average in space “extensive” quantities (non per-atom quantities) ? For example, it seems tha Lammps cannot do the following:

compute ket_w wshake ke
fix 10 wshake ave/spatial 1 2 2 y lower 4.0 y c_ket_w file temp.profile.waters.dat units box

Thank you, Javier

How can I average in space "extensive" quantities (non per-atom quantities) ?

What do you mean by this? In your example you want to take
a ke which is computed by averaging over all the atoms in the system,
and then average that quantity locally in space? Doesn't make sense
to me.

Steve

Hi Steve,

It seems that I did not explain myself correctly. I have a molecular system with different substances (with different degrees of freedom), divided in slabs along z and I would like to compute the temperature of each slab. In some slabs there are two substances, while in others there is only one. In this sense, the temperature of a slab with two substances can be obtained as:

T = (ke_sub1 + ke_sub2) / (ke_sub1/Tsub1 + ke_sub2/Tsub2)

where: ke_sub and Tsub are the total kinetic energy of a given substance and its temperature.

Hence, what I want is to obtain the total kinetic energy of each slab averaged of over time, to then obtain T.

Thank you for your advice, Javier

Fix ave/spatial will sum per-atom quantities within slabs.
The per-atom quantity can be from a compute (e.g. ke/atom)
or a variable, which you define, which can also access per-atom
quantities such as mass and velocity. Both the fix ave/spatial
and compute ke/atom can operate only on a group of atoms,
e.g. one of your substances.

If you can figure out how to cast your formula in that mode,
then LAMMPS will compute it. You might have to use
two different fix ave/spatial, one for each substance. Then
output the answers and do the final combining yourself.

Steve