Developing/Debugging a new functionality


I’d like to develop a new minimization scheme in LAMMPS, but I have some basic questions about debugging with LAMMPS in general. Do I have to recompile LAMMPS every time whenever I modify my .cpp or .h files? Is there a quicker way for debugging since compiling LAMMPS alone can take minutes.

Also, do you know any IDE (integrated development environment) or debugger that lets me easily debug LAMMPS codes line by line or set breakpoints?

Thanks a lot,


You don’t need to recompile the entire package every time you change a file; however, you do need to recompile the changed files, and then link the files to make the executable. Some additional files that are listed as dependencies may also need to be recompiled.

Others can probably make better recommendations on the IDE’s



I am using eclipse for development (with the CDT plugin) which is available on many linux flavors (i.e. RedHat).


-------- Original-Nachricht --------

As Ahmed said, if you're using a Makefile, it should only
re-compile the files you've changed. If you have a multi-core
box, check out make -j which does a parallel make. I can build
LAMMPS (from scratch) in about 10 secs.


Thanks everybody.

By the way, Christian’s suggestion about using Eclipse is good. Eclipse is giving me what I was looking for.

If anyone has trouble trying to compile LAMMPS in Eclipse, this link below gives excellent instructions.

The instructions should also work in Linux with some simple changes.


One comment to the eclipse setup of LAMMPS. Instead of going through all the hoops of setting all necessary build steps up yourself, you can just as well tell eclipse to use the provided Makefiles. Basically you just go to the properties of your project and in "C/C++ Build" you put in the "behaviour" tab the machine name extension of your makefile (i.e. openmpi if you want to use MAKE/Makefile.openmpi) in the "Build (Incremental build)" text field. As Steve suggestet adding -j 8 or so can help as well ;-).


-------- Original-Nachricht --------