Prerequisites
Before starting the debugging process, a test LAMMPS executable file should be built. When building with CMake (see Appendix A, Building LAMMPS with CMake), adding a –D CMAKE_BUILD_TYPE=Debug
flag assists in the debugging process since it does not optimize out any variable, that is, the compiler does not eliminate intermediate values.
After CMake configuration, it is fine if C++ flags only show up as –g
in the build configuration. Also, it is advisable to rename the executable from lmp
to lmp_test
to distinguish it accordingly. The following screenshot shows the build configuration after executing the CMake configuration:
Figure 13.1 – Screenshot showing the build configuration by CMake
As you can see, having created an executable, we will apply debugging tools to analyze the purpose of the sbmask()
method in pair_lj_cut.cpp
. A data file (test.data
) is created to construct a linear polymer chain consisting of 5
bonded atoms...