Dear LAMMPS users and developers,
I am trying to use the python interface to lammps to evaluate atomic forces for my system, and I wish to split the force values into two terms: the long-range interaction involving pairwise and k_space contributions a well as short-range interactions involving 2, 3 and 4-body terms. I have tried two methods:
- Evaluate the total forces using
lammps_pot.lmp.command(‘run 0’)
f = lammps_pot.lmp.gather_atoms(“f”, 1, 3)
and then evaluate the short range interactions via:
lammps_pot.lmp.command(‘kspace_modify compute no’)
lammps_pot.lmp.command(‘pair_modify compute no tail no’)
lammps_pot.lmp.command(‘run 0’)
fb = lammps_pot.lmp.gather_atoms(“f”, 1, 3)
Obtaining the long-range contributions by total_force - short_range_force
- Evaluate total forces by
lammps_pot.lmp.command(‘run 0’)
f = lammps_pot.lmp.gather_atoms(“f”, 1, 3)
and then finding out the long-range interactions using:
lammps_pot.lmp.command(‘bond_coeff * 0 0 0’)
lammps_pot.lmp.command(‘angle_coeff * 0 0’)
lammps_pot.lmp.command(‘dihedral_coeff * 0 1 1’)
lammps_pot.lmp.command(‘improper_coeff * 0 0 0’)
lammps_pot.lmp.command(‘run 0’)
flr = lammps_pot.lmp.gather_atoms(“f”, 1, 3)
Obtaining the short-range forces using total_force - long_range_force.
It would seem that both methods should give me the correct answer, but they produce different results which lead me to believe that there is a flaw in my approach. Could you let me know which would be the best way to obtain those split-contribution forces and how should I modify my methods to get it? I think I would prefer something along the lines of options one since it should be slightly faster as there is no need to re-set forcefield parameters nor re-calculate pairwise interactions which should be the most expensive part of the force evaluation.
I am sorry if a similar question has been already answerd, I have tried browsing through the mailing list but came empty handed.
All the best,
Jacek Golebiowski