[lammps-users] Output of the "fix store/state" in the context of atoms owned by the processor

Hello lammps developers and users,

I’m trying to write a compute style for my custom requirement and it requires the average per-atomc kinetic energy. So what I’m gonna do is compute the average per atomic kinetic energy from a initial run and then import it to my custom compute via a “fix store/state” as bellow,

fix NVE all nve #time integration
compute KE all ke/atom #compute per atomic kinetic energy
fix Ave_KE_cal all ave/atom 1 100000 100000 c_KE #averaging the per-atomic kinetic energy
run 100000

fix Ave_KE all store/state 0 f_Ave_KE_cal #store the averaged per-atomic kinetic energy at the end of the above run

compute My_Custom_Compute all Mystyle f_Ave_KE #my custom compute style that takes “fix store/state” as a input argument
run 100000


However, I’m not sure about the content of the per-atomic vector I get when I access the output of “fix store/state” inside my custom compute. As per my knowledge, it should return the per-atom vector that contains the average kinetic energy of the atoms owned by the processor (nlocal amount of atoms,not for all the atoms). Is that so, does it contain the values of the atoms currently on the processor or does it contain the values of the atoms that were on the processor when the fix was originally evaluated?

Any advice would be kindly appreciated and if there is a better way to import the per-atomic average kinetic energy to a custom compute rather than using “fix store/state”, please advise me on that too to get a free ticket straight to heaven :smiley:

Thank you very much, Stay Safe.


Fix store state manages the per-atom data with the atoms and thus it is migrated between subdomains with those atoms and therefore always matches the ID and index of the atoms currently on an MPI ranks. You can see that from the presence of the pack_exchange() and unpack_exchange() functions and what data is packed or unpacked by those.