Adding a custom package to LAMMPS CMake configuration

Dear All,

What is the proper way to add a custom package to the CMake configuration of LAMMPS?

We are working with collaborators at Temple University who have developed an in-house neural network potential package called “ML-ATOMNN”.

  • We are able to install this in an instance of LAMMPS built using conventional “make”.
  • However, we are working with a coupled molecular-continuum software called LibMultiScale (LMS: LibMultiScale / LibMultiScale · GitLab) that is built using CMake.
  • This software includes LAMMPS for its MD side of the simulations, and we are trying to include the ML-ATOMNN package in it.

The LMS developer said they can add the package to LMS, provided that we can troubleshoot an error in the package code when compiling it with the slightly older version of LAMMPS that they have in their build.

  • Therefore, we need to be able to add this package to the CMake configuration in LAMMPS, in order to test it.
  • Unfortunately, the developers of the ML-ATOMNN package only use conventional “make” to compile and are not strong with CMake.

Attached is the package (it is publicly available on its own GitHub page), along with instructions on how it is installed on a conventional “make” LAMMPS build.

  • Any assistance with this would be greatly appreciated.

Sincerely,

Scott Julien


Research Scientist
​Cold Spray Additive Manufacturing Lab
Mechanical & Industrial Engineering
Northeastern University
Boston, MA, USA

2022_08_18_LAMMPS_Temple_ANN_Ni_read_data.zip (13.6 KB)
Instructions_for_Installing_ANN_Package_in_a_LAMMPS_Installation_Compiled_using_Conventional_Make.pdf (249.5 KB)
ML-ATOMNN.zip (80.3 KB)

Attached are the steps that we’ve taken, thus far.
I believe we need to add some lines to the “lammps/cmale/CMakeLists.txt file” to tell it where to find the Eigen libraries, but we’re not familiar enough with CMake to know how to do this.
2022_09_16_LAMMPS_CMakeBuild_AddingML-ATOMNNPackage.pdf (332.4 KB)

It’s fairly easy. You just need to add a new line (ML-ATOMNN) in $LAMMPSDIR/cmake/CMakeLists.txt around line 240 and copy your directory to $LAMMPSDIR/src
Additionally, because you need Eigen library, you need a custom cmake file (called ML-ATOMNN.cmake) at $LAMMPSDIR/cmake/Modules/Packages. Look at the file MACHDYN.cmake in the same directory to see how to handle requesting Eigen.

Excellent! Thank you for getting back to us. We’ll give those steps a try and let you know how they turn out.

Scott Julien

Hi ‘mkanski’,

Thank you, again, for your advice on how to handle this problem. I’m sorry it took me so long to get back to you.

I went ahead and performed your steps. It almost worked! It just seemed to get snagged when compiling the ML-ATOMNN source, seemingly because it didn’t try searching for Eigen, beforehand. See attached. Any additional advice?

Many Thanks,

Scott Julien
2022_09_21_LAMMPS_Adding ML-ATOMNN to CMake Configuration.pdf (521.1 KB)

You also need to add the ML-ATOMNN package name into this loop around line 500 in cmake/CMakeLists.txt

foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
        PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE)
  if(PKG_${PKG_WITH_INCL})
    include(Packages/${PKG_WITH_INCL})
  endif()
endforeach()

This is required so that your added file in cmake/Modules/Packages/ is read and processed.

1 Like

It was my mistake, I missed one other change which needs to be done (see @akohlmey’s post).

Thank you, gentlemen. That worked.
I’ve summarized my steps in the attached procedure, in case it’s helpful in future inquiries on this subject.

Thanks for all your help. I don’t know how you keep up with all these forum inquiries. Your dedication to LAMMPS and the community is impressive.

Many Thanks,

Scott Julien

2022_09_21_LAMMPS_CMake_Adding ML-ATOMNN Package.pdf (621.8 KB)

1 Like