[lammps-users] Setforce and dump

Dear Lammps community,

I am using fix setforce command to zero out the forces applied to a group of atoms during a simulation. I wonder if there is a way to actually dump these forces before they are set to zero? If not, would it be possible to impose “setforce” only every few time steps (say every 10) and to dump the forces in those time steps when they are not set to zero (9 steps)?

Best regards,
-Taner

I don't know any simple way to do this in LAMMPS.

You could implement your idea by simply adding a line at the
top of the post-force routine in fix_set_force.cpp to check
the timestep and exit if it's not a multiple of 10.

If all you want is the sum of the force on the zeroed atoms,
you could add code to accumulate that quantity, then print
it out, either in post_force or add a routine to set_force to print
it at some other time ...

Steve