Using pair_style hybrid in MANYBODY

Dear All,

I’m using LAMMPS to relax two-dimensional TMDs (MX2).

I started from the input file: /examples/threebody/in.mos2.sw.mod
Since I want to tweak a bit the interaction, I need to go from the plain sw style to the hybrid one.

Following the tutorial in pair_style sw command — LAMMPS documentation, I changed the script related to the potential to:
########################## Define potentials ################################
pair_style hybrid/overlay sw/mod maxdelcs 0.25 0.35 sw threebody off
pair_coeff * * sw/mod …/tmd.sw.mod Mo S S
pair_coeff 1 1 sw …/mos2.sw Mo Mo Mo
#########################################################################

The last bit is taken from a paper that gives the two-body terms, since in my case (GBs), I also need to account for the metal-metal interaction.

However, I get the following message when running this updated bit (the un-updated one works fine).
ERROR: Illegal pair_style command (src/MANYBODY/pair_sw.cpp:234)
Last command: pair_style hybrid/overlay sw/mod maxdelcs 0.25 0.35 sw threebody off

After checking in pair_sw.cpp, I’m wondering if the hybrid mode is taken care of in the MANYBODY mode ? I guess it should, since the sw tutorial has an hybrid part.

Maybe I missed some steps in the installation bit.
FYI, I did:
cmake …/cmake -D PKG_MANYBODY=yes
cmake --build .

Thanks for your feedback.

This is not a tutorial, but the documentation of the command.

What is your LAMMPS version?
According to the documentation, the threebody keyword was added in version 3 Aug 2022. If you are using the 23 Jun 2022 stable version, you need to look at: pair_style sw command — LAMMPS documentation
If you are using an even older version of LAMMPS you need to look at the documentation that was bundled with the source package or recreate it.

This is inconsistent. The element symbols after the potential parameter file map (numeric) atom types to parameters in the potential files. So it should be Mo S S in both cases, or Mo NULL NULL for the second pair_coeff command (if you want to only use Mo-Mo interactions). Due to using hybrid/overlay those interactions will be added. Thus, I suspect you are making incorrect assumptions about how to “assemble” manybody interactions. Specifically you seem to be unaware of double counting. For any complex manipulations usually people either modify the potential file parameters or the source code and then recompile (that is how sw/mod came to be).

The handling of how to dispatch hybrid/overlay interactions is in the sources files pair_hybrid.cpp and pair_hybrid_overlay.cpp and also in the neighbor list code (too many files to list them all here).

I’m using the 23 Jun 2022 stable version. Since I need the style hybrid with sw/mod, I guess the github version is what I need ? (GitHub - lammps/lammps: Public development project of the LAMMPS MD software package)

Thanks for the clarification, I need indeed to look further in understanding on how to assemble manybody interactions.

Yes. I also looked in there. I was just wondering how does the hybrid and sw relate.

Thanks for your feedback.