Greetings once again,
I’ve mentioned earlier that I am basically only using Lammps as an implementation of certain potentials, calling it through the C API to compute forces for structures.
I understand that this really is not the use case of LAMMPS, and it was discussed previously that I am probably better off implementing the potentials on my own. Unfortunately, reimplementing REBO is such a scary prospect that I have stubbornly continued to live with the current setup. I hope there is another solution to my current dilemma.
Here’s what I do:
- pair_style/pair_coeffs/create_box/create_atoms and etc.
- Set positions using
lammps_scatter_atoms
. run 0
- Gather forces using
lammps_gather_atoms
, and potential usinglammps_extract_compute
. - Repeat 2-4 ad nauseum.
(Between steps 4 and 5, control flow must return to my own code so I can e.g. use them in relaxation to find the next position)
This is slow on large structures, and when I look at perf report
, I see that most of the time is spent in LAMMPS_NS::NPairFullBinGhostOmp::build.
The changes in positions are almost always within skin distance. Atoms are never added or removed, their integer “types” never change, and the periodic lattice seldom changes. But it seems that run 0
always recomputes the bins regardless.
Is there something I can do instead to avoid the unnecessary rebinning?
Thanks,
Michael