Question about Fix::v_tally

Dear all,

I have a question about the Fix:v_tally method. It seems that this command only tallies virial locally but doesn’t influence the virial for ghost atom (i.e. The possible additional virial of ghost atom isn’t communicated reversely to the process owing ghost atom). Does it mean if my fix adds virial for ghost atom which isn’t calculated on ghost atom process, I need to communicate the virial back?

Thank you.

Dear all,

I have a question about the Fix:v_tally method. It seems that this command
only tallies virial locally but doesn't influence the virial for ghost atom
(i.e. The possible additional virial of ghost atom isn't communicated
reversely to the process owing ghost atom). Does it mean if my fix adds
virial for ghost atom which isn't calculated on ghost atom process, I need
to communicate the virial back?

​virial contributions for ghost atoms are only computed with
newton_pair/newton_bond enabled and during the pair/molecule/kspace​ force
computation. the necessary reverse communication happens directly after the
force computation (from ghost to local). a forward communication (from
local to ghost) does not happen at all. so if your fix acts at the
Fix::post_force() or Fix::end_of_step() stage, you should only
access/modify contributions to local atoms (and perform the necessary
communication, if needed).

axel.

Thanks for your kind help! Axel.

Another quick question, If I ensure the forces is calculated correctly, is it a reasonable way to check global virial by comparing the calculated global virial to the summation of sum(F*r) (F is the total force on an atom after post_force style fix. r is the coordinate of the atom)? Or if there is any other better way?

Thank you!

A strategy that I often take is to use the following lines from compute stress/atom doc page:

compute              peratom all stress/atom NULL
compute              p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable     press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
thermo_style custom step temp etotal press v_press