Problem with building Lammps with modified pair_sw.cpp files

Dear All,

I am trying to rebuild Lammps (version 7 Aug-19) in my Linux machine (Centos 07). The purpose of rebuilding is that I want to study MoS2 material with the SW potential well known in the literature. This specific SW potential requires modifying the source file which I obtained from the original paper’s supplemental section (please see attached the pair_sw.cpp source file). Now, when I try to build lammps by copying the source file in /src directory, I get the error message given below. I also want to add that, I tried rebuilding/updating the many-body package and adding the source file in the /src/MANYBODY directory as well but still got the same error. Also, the same Lammps version builds and works fine with the original pair_sw.cpp source file with no issue. In more recent works, other researchers reported results using the same potential. Can anybody please help me with this problem or suggest what should I try differently?

“…/pair_sw.cpp:474:20: error: no ‘void LAMMPS_NS::PairSW::setup()’ member function declared in class ‘LAMMPS_NS::PairSW’
void PairSW::setup()
^
make[1]: *** [pair_sw.o] Error 1”

The reference paper title: "Parametrization of Stillinger–Weber potential based on valence force field model: application to single-layer MoS2 and black phosphorus "

Thanks for your kind help.

Regards
Shoieb Ahmed Chowdhury

pair_sw.cpp (18.6 KB)

Scientific software like LAMMPS keeps evolving and improving over time. While we try to minimize the impact to the LAMMPS input files, the source code is not meant to be compatible across different versions. So if you want to use a modified version of a specific source file, you either need to compile it with the specific version of LAMMPS that it was taken from, or port the corresponding changes to the current LAMMPS code.
Since this is not part of the LAMMPS distribution, you have to contact the person who wrote the modified code in case you need any assistance with it.

Axel.