Compilation Error When Making LIGGGHTS

Submitted by johnjiang on Fri, 07/19/2013 - 12:41

Dear guys:

I am new to this forum, and I would like to seek some help in the compilation of LIGGGHTS

When I compiled LIGGGHTS using "make openmpi", I encounter the following error messages:

fix_gravity_omp.cpp: In member function virtual void LAMMPS_NS::FixGravityOMP::post_force(int):
fix_gravity_omp.cpp:48: error: dt was not declared in this scope
fix_gravity_omp.cpp:48: error: phigrad was not declared in this scope
fix_gravity_omp.cpp:50: error: thetagrad was not declared in this scope
fix_gravity_omp.cpp:56: error: dt was not declared in this scope
fix_gravity_omp.cpp:56: error: thetagrad was not declared in this scope

I think I have got all the settings in the Makefile.openmpi correctly set (as only a few blanks need to be filled), but I cannot figure out what caused the errors shown above. I tried to grep the keywords "dt","phigrad" and "thetagrad", latter two seem to have appeared only in the file fix_gravity_omp.cpp.

Could anybody give me a hand? Many thanks!!


johnjiang | Thu, 08/01/2013 - 09:40

sorry I get back really late. I have been working as volunteer in a part of china, where I cannot go online easily.

Thanks for your advice! The problem I metioned in my last post has been solved. I did "make yes-xxx" only to the packages that I needed to use. I guess the problem might be related to some packages. By the way my machine runs openSUSE, however I compiled the program successfully using the makefile "Makefile.ubuntuVTK", which is kind of strange.

I encountered on problem, though. When I included the packages that require libraries in the directory /path_to_liggghts/lib , the linker will report an error, saying that it cannot find the flags of the needed libraries (-lxxx). I wonder shouldn't the libraries have been compiled automatically, if needed, by the make machine command? Or should I compile those libraries manually before doing the make?

Thank you very much for your help!

PaulWinkler's picture

PaulWinkler | Thu, 08/01/2013 - 12:19

Ni hao

I recommend to begin from scratch. Delete your LIGGGHTS-PUBLIC folder and get the latest Liggghts version via git clone. Check if all needed packages are installed, mainly the compiler. Try to compile without using any extra packages. You may have to test some makefiles, first start with make serial. Before you run make serial (maybe you need super user rights), change to STUBS and just 'make'. Change back to src run make clean-all and make serial. At least this should work, now you can alter the configuration and may be change compiler/flags.
I guess you are planning to use Liggghts on a HPC with SELinux?

Zhu hao


ckloss_ | Mon, 08/05/2013 - 19:18


the OMP is not really up to date. It's work in progress and will take some more time. We left it in in case someone wants to play around or experiment with it.


johnjiang | Sun, 08/18/2013 - 11:42

Hi guys
Thank you for your advise!! After getting the latest version and starting all over again with "make no-all", the compilation was successful. I have excluded all the unnecessary packages, and left only the SPH one, which I am going to use for my project. the USER-SPH package does not depend on any external libraries, so the library problem is not urgent now. Thanks really a lot.

Most of the time I run liggghts on my ubuntu, and occationally on a cluster running openSUSE, when the job is large.