recompile LAMMPS by replacing the default pair_sw.cpp module

Dear lammps users

I utilize the “MPICH3” and “FFTW2” to compile the LAMMPS (version 1Feb14). The r23 cutoff does not exist in LAMMPS version of the SW potential. Therefore, I have obtained the r23 implemented version of LAMMPS modules pair_sw.cpp in the “Thermal transport properties of MoS2 and MoSe2 monolayers” paper, such as “pair_sw-MoSe2.cpp” and “pair_sw-MoS2.cpp” in the e-mail attachment. Then recompile LAMMPS by replacing the default pair_sw.cpp module. When I only replaced one file with the original one provided by LAMMPS, and then will be recompiled successfully. However, the two SW potentials need to be used in my research at the same time. When I replace two files “pair_sw-MoSe2.cpp” and “pair_sw-MoS2.cpp” and then recompile the LAMMPS, there are some errors as follows. I have tried many times by modifying some code, and a part of errors have been reduced, but still failed. Can you give me some suggestions? Thank you!

Best regards,

Dan Han

Here are the all errors:

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::Pair::compute_inner()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:213: `LAMMPS_NS::PairSW::allocate()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:213:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::init_one(int, int)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:327: `LAMMPS_NS::PairSW::init_one(int, int)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:327:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::init_style()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:309: `LAMMPS_NS::PairSW::init_style()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:309:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::settings(int, char**)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:229: `LAMMPS_NS::PairSW::settings(int, char**)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:229:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::~PairSW()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:59: `LAMMPS_NS::PairSW::~PairSW()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:59:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::~PairSW()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:59: `LAMMPS_NS::PairSW::~PairSW()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:59:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::~PairSW()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:59: `LAMMPS_NS::PairSW::~PairSW()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:59:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::PairSW(LAMMPS_NS::LAMMPS*)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:41: `LAMMPS_NS::PairSW::PairSW(LAMMPS_NS::LAMMPS*)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:41:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::PairSW(LAMMPS_NS::LAMMPS*)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:41: `LAMMPS_NS::PairSW::PairSW(LAMMPS_NS::LAMMPS*)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:41:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::read_file(char*)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:336: `LAMMPS_NS::PairSW::read_file(char*)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:336:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::setup()’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:464: `LAMMPS_NS::PairSW::setup()'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:464:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::coeff(int, char**)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:237: `LAMMPS_NS::PairSW::coeff(int, char**)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:237:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::twobody(LAMMPS_NS::PairSW::Param*, double, double&, int, double&)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:542: `LAMMPS_NS::PairSW::twobody(LAMMPS_NS::PairSW::Param*, double, double&, int, double&)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:542:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::threebody(LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, double, double, double*, double*, double*, double*, int, double&)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:563: `LAMMPS_NS::PairSW::threebody(LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, double, double, double*, double*, double*, double*, int, double&)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:563:is firstly defined here

pair_sw-MoSe2.o:in the function ‘LAMMPS_NS::PairSW::compute(int, int)’:

/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoSe2.cpp:77: `LAMMPS_NS::PairSW::compute(int, int)'is defined multiple times

pair_sw-MoS2.o:/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi/…/pair_sw-MoS2.cpp:77:is firstly defined here

collect2: error: ld returned 1 exit status

Makefile:89: recipe for target ‘…/lmp_mpi’ failed

make[1]: *** […/lmp_mpi] Error 1

make[1]: Leave the directory “/home/sts/software/test/3/lammps-1Feb14/src/Obj_mpi”

Makefile:77: recipe for target ‘mpi’ failed

make: *** [mpi] Error 2

pair_sw-MoS2.cpp (17.9 KB)

pair_sw-MoSe2.cpp (17.9 KB)

Dear lammps users

I utilize the “MPICH3” and “FFTW2” to compile the LAMMPS (version 1Feb14). The r23 cutoff does not exist in LAMMPS version of the SW potential. Therefore, I have obtained the r23 implemented version of LAMMPS modules pair_sw.cpp in the “Thermal transport properties of MoS2 and MoSe2 monolayers” paper, such as “pair_sw-MoSe2.cpp” and “pair_sw-MoS2.cpp” in the e-mail attachment. Then recompile LAMMPS by replacing the default pair_sw.cpp module. When I only replaced one file with the original one provided by LAMMPS, and then will be recompiled successfully. However, the two SW potentials need to be used in my research at the same time. When I replace two files “pair_sw-MoSe2.cpp” and “pair_sw-MoS2.cpp” and then recompile the LAMMPS, there are some errors as follows. I have tried many times by modifying some code, and a part of errors have been reduced, but still failed. Can you give me some suggestions? Thank you!

you cannot have two different implementations using the same class names and pair style to class name mapping.
you have to give your modified class a different name and also adjust the PairStyle() macros in the header file.
for details, please see the LAMMPS manual and consult a C++ programming text book.

axel.

p.s.: do you think it is wise work with a over 4 1/2 year old version of LAMMPS? we have since identified and fixed a lot of problems and added many improvements since.