Debugging on Linux OS


What type of IDE do the LAMMPS developers use to debug and compile the source code on LINUX?


There’s nothing special about working with the LAMMPS source compared to any other project. You can use whatever you like.

I use vim (no special plugins, just pen and paper if I’m looking at a part of the code I haven’t seen before).

I use the standard GNU tools to build and debug (g++/gdb) when I’m using my local machine.

If your question is “how do I compile LAMMPS?”, you should start here:


What type of IDE do the LAMMPS developers use to debug and compile the
source code on LINUX?

none. i just had several days of intense debugging and cleaning up code and
here is what i used:

- vim for small edits (most common when debugging)
- emacs for complex file edits, comparing different versions, reindentation
(most common when writing new code)
- sed for bulk edits (e.g. sed -i -e 's/ \+//' \-e 's/ \\\+// *.{cpp,h}
for bulk removal of trailing whitespace)
- grep to locate specific strings (e.g. variables, function calls) across
- git for tracking my edits, comparing against upstream and old versions,
feature branches and everything SCM
- make to manage compilation (on multi-core machines i use "make -j #" with
# being the number of cores plus 20% for parallel compiles. significant
compilation speedup comes from using ccache with a large cache)
- valgrind for tracking memory access, when in parallel i use it headless
mpirun -np 4 valgrind --log-file=valgrind-%p lmp_mpi -log none -echo screen
-in in.test
- gdb for debugging. for debugging in parallel i use: mpirun -np 4 rxvt -e
gdb -x gdbinit --args lmp_mpi -log none -echo screen -in in.test
- strace for tracking system calls (most commonly file access)

the (rather new) info command in LAMMPS can be helpful to debug LAMMPS
internals: LAMMPS Molecular Dynamics Simulator
it is quite tedious from inside a generic debugger to see what
regions/variables/fixes/computes are defined and what their names are.

​above all, the most important debugging tool is a clear head and careful
reading of the source code.​ some parts require some time staring at it to
understand what the programmer intended.