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?
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).
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?