How to break evdwl into repulsive and attractive parts?


I would like to compute repulsive and attractive parts for pair_lj_cut_coul_long.cpp.

  1. I have defined evdwl12 and evdwl6 in pair_lj_cut_coul_long.cpp.
  2. Also added myev_tally in pair.cpp and mypair_tally_callback in compute.h
  3. Defined compute_evdwl12 and compute_evdwl6 in thermo.cpp

However E_vdwl12 + E_vdwl6 is not equal to E_vdwl. Even the values of E_vdwl12 and E_vdwl6 are the same.

Do you have any idea how I can break down evdwl to evdwl12 and evdwl6?
I have attached my pair_lj_cut_coul_long.cpp.


pair_lj_cut_coul_long.cpp (31.2 KB)

no one here is likely to debug your code.

Have you tried it in on a 2-atom system?

On a single proc, then on multiple procs?


also, i would suggest a simpler approach, that requires less
modifications to the LAMMPS sources.

1) run a normal simulation with the unmodified lj/cut/coul/long
2) modify lj/cut/coul/long to only store the repulsive energy in evdwl
and use the rerun to collect that info
3) modify lj/cut/coul/long to only store the attractive energy in
evdwl and use the rerun to collect that info

if you need to do it multiple times, you can either have multiple
executables, or rename the classes and style string so that you can
select the different variants from within the same executable.


Similar to Axel’s approach, it is fairly easy to create two new pair_styles:


These can be directly obtained from lj/cut/coul/long and lj/cut by commenting out a few lines, which is a low-risk operation.

You can then run them under MD using pair hybrid/overlay. Check that your total energy is the same as for lj/cut/coul/long.