I am rebuilding the lammps with potential files of pair_sw_zbl.cpp and pair_sw_zbl.h. through “Make mpi”, but the errors occur below:
../pair_sw_zbl.cpp:245:8: error: prototype for ‘double LAMMPS_NS::PairSWZBL::threebody(LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, double, double, double*, double*, double*, double*, int, double&)’ does not match any in class ‘LAMMPS_NS::PairSWZBL’
double PairSWZBL::threebody(Param *paramij, Param *paramik, Param *paramijk,
In file included from ../pair_sw_zbl.cpp:23:0:
../pair_sw_zbl.h:39:8: error: candidate is: void LAMMPS_NS::PairSWZBL::threebody(LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, LAMMPS_NS::PairSW::Param*, double, double, double*, double*, double*, double*, int, double&)
void threebody(Param *, Param *, Param *, double, double, double *, double *,
make: *** [pair_sw_zbl.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/huangtaiyi/lammps/src/Obj_mpi'
make: *** [mpi] Error 2
What do these prompts mean? I cannot figure out what is wrong with the files of pair_sw_zbl.cpp or pair_sw_zbl.h. The version of lammps is stable_16Mar2018. I just hope that someone can help me out with this issue.
Thanks a lot!
Common C++ error when people don’t pay attention to detail. The prototype of a function in the header must match the implementation in the .cpp file. In this case, your header has a return type of “void” while the implementation uses “double”. If your expertise in C++ is limited, you should consult with somebody local that does know C++ well enough before continuing to avoid making more subtle errors that the compiler will not be able to detect.
Why modify a five year old version of LAMMPS? You will have all the bugs in the code that have since been fixed (and there were quite a few that were found since we started to use automated testing and various forms of static code analysis to improve the overall reliability and code quality in LAMMPS, since few contributors to LAMMPS are trained programmers, the code quality used to vary quite a bit) and also the LAMMPS developers have moved on, so if you have problems, you are less likely to get help. Not to mention that you are making your life needlessly more complicated when you would contribute your modifications for inclusion into LAMMPS (which we surely hope you will do, once they are finished) as you would then have to port them to the current codebase.
Thank you again for your reply. Now I figure out the problem and recompile the Lammps successfully. However, there occurs a new problem below:
System init for write_data …
Reading potential file SiGe.sw.zbl with DATE: 2007-06-11
ERROR: Incorrect format in Stillinger-Weber potential file (…/pair_sw.cpp:418)
Last command: pair_coeff * * SiGe.sw.zbl Si Ge
I sense that there is something wrong about the connection between the pair_sw.cpp and pair_sw_zbl.cpp, or the corresponding header files when the Lammps is implementing the potential. I thought that it should read into the pair_sw_zbl.cpp where int params_per_line = 18, but it seemed to read into the pair_sw.cpp where int params_per_line = 14, which I think causes the problem of the incorrect format. I look into the files of pair_tersoff and pair_tersoff_zbl for similar expressions, but I find no relevant information for solving the problem. At this stage, I hope that you can give me some advice despite of the old version of Lammps and my insufficient knowledge of C++.
Thanks a lot.
Even if I wanted to, I cannot. There is not enough information here to make any suggestion.
However, as I already mentioned, with this kind of change and doing it for such an old version of LAMMPS, you are on your own, since I am not interested to know more and figure out the details.