1
$\begingroup$

I am following the deepmd-kit documentation to implement this kit into a plugin version of LAMMPS, the documentation I am using is found here and here. I am close to completing everything, but am having issues when trying to install the deepmd-kit C++ interface. I know from the documentation, I need to run the line:

cmake -DUSE_TF_PYTHON_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=$deepmd_root ..

And I also know that for the plugin version of LAMMPS, I need to include the cmake argument into the command above; -DLAMMPS_SOURCE_ROOT=/path/to/lammps/source. What I have done for this step is that I cd'd into the LAMMPS folder until I could see all of the folders containing the source code, and I defined the variable lammps_src='pwd'. So all in all, I am using the command:

cmake -DUSE_TF_PYTHON_LIBS=TRUE -DLAMMPS_SOURCE_ROOT=lammps_src -DCMAKE_INSTALL_PREFIX=$deepmd_root ..

This process runs until it finds the LAMMPS folder, makes the header, and tries to find the version of LAMMPS I have, and am met with the error message that I have attached as an image.Error message.

Looking through the LAMMPS source code, I am able to see that the LAMMPSUtils.cmake file does actually exist. Seeing that this process can actually find the LAMMPS folder, I am unsure why it cannot find this file

Looking at the second error with the unknown cmake command... I searched for the CMakeLists.txt file it mentioned, and found these commands

cmake commands

From my understanding, the cmake job is supposed to look for a file named version.h in the LAMMPS source folder, but that file does not exist. I know that this shouldn't be an issue of the version of the libraries/packages I have installed. The relevant ones that I have are deepmd-kit v2.2.7, cmake v3.27.7, and tensorflow 2.14.0. The LAMMPS version I cloned is the Aug 2023 update 1 release that was mentioned in the documentation I followed. It is at this point where I do not know what to do to try and remove these issues, so any insight is welcome!

$\endgroup$
6
  • 1
    $\begingroup$ Please change out screenshots in favour of code outputs, formatted "verbatim" with backticks. From your first screenshot you have forgotten to substitute your variable -- you should have -DLAMMPS_SOURCE_ROOT=$lammps_src, and you're missing the dollar sign. $\endgroup$ Nov 9, 2023 at 2:47
  • $\begingroup$ I'll edit my post in a moment to accommodate for that. However, I will also note that adding the $ sign resulted in the same set of errors $\endgroup$
    – Baba Booey
    Nov 9, 2023 at 18:45
  • $\begingroup$ The next thing to consider is whether, when you say "I defined the variable lammps_src='pwd'", whether you did that correctly. You can check what your variables actually are using echo $lammps_src. $\endgroup$ Nov 9, 2023 at 21:13
  • $\begingroup$ An update... so I ended up starting from scratch to see if there were other problems that could have manifested from earlier steps (for example, tensorflow not being installed properly, or an incompatible gcc version or something), and instead of defining the variable lammps_src, I used the full directory. This seems to have solved the problem. After investigating some more, I found that defining the variable lammps_src causes these errors. So I am wondering now, even though my problem is somewhat solved, why the variable breaks the installation process $\endgroup$
    – Baba Booey
    Nov 13, 2023 at 19:01
  • $\begingroup$ Did you run the lammps_src='pwd literally or did you fill in pwd? I'm guessing if you wrote it literally, 'pwd' would not be expanded. $\endgroup$
    – Tyberius
    Nov 16, 2023 at 2:20

1 Answer 1

2
$\begingroup$

As I mentioned in my latest comments, I thought I solved this problem, discovered I didnt, and now I have truly solved my problem. I will now provide the steps I took in my particular use case, but these can be modified to suit other use cases. I should specify, my own use case is to run LAMMPS simulations via a supercomputer.

Starting from scratch in your $HOME directory, do the following

>mkdir -p $HOME/{venvs,sources,software}
>module load gcc/9.3.0 cuda/11.0 openmpi/4.0.3

>module load python/3.10.2 cudnn/8.0.3 mpi4py/3.0.3
##The module load commands are specific to my own use with the supercomputer. Load these in however you need
>virtualenv --no-download $HOME/venvs/deepmd
>source $HOME/venvs/deepmd/bin/activate
#Make sure the venv is activated for the rest of this process
>pip install --no-index --upgrade pip
>pip install --no-index tensorflow==2.14.0
>pip install --no-index horovod==0.28.1
>cd $HOME/sources
>git clone https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
>deepmd_source_dir=$HOME/sources/deepmd-kit
#as a sanity check, use the echo command to ensure this path was stored properly
>cd $deepmd_source_dir
>pip install .
>cd $HOME/sources
>wget https://github.com/lammps/lammps/archive/stable_2Aug2023_update1.tar.gz
>tar -xf stable_2Aug2023_update1.tar.gz
>lammps_source_dir=$HOME/sources/lammps-stable_2Aug2023_update1
>cd $deepmd_source_dir
>cd source
>mkdir build
>cd build
>deepmd_root=$HOME/software/deepmd
>cmake -DUSE_TF_PYTHON_LIBS=TRUE -DLAMMPS_SOURCE_ROOT=$lammps_source_dir -DCMAKE_INSTALL_PREFIX=$deepmd_root ..
#If you installed tensorflow a different way, you need to add a cmake argument that specifies the location of the tf source code
>make -j4
>make install
>cd $lammps_source_dir
>mkdir build
>cd build
>cmake -DPKG_PLUGIN=ON -DLAMMPS_INSTALL_RPATH=ON -DBUILD_SHARED_LIBS=yes -DCMAKE_INSTALL_PREFIX=${deepmd_root} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_FULL_LIBDIR=${deepmd_root}/lib ../cmake
>make -j4
>make install
>export PATH=$HOME/$deepmd_root/bin:$PATH

This installation process ideally should go well, however, it is at this point that two main issues can arise. This first is that LAMMPS cannot find the deepmd code despite defining the path variable during the installation process. In my specific user case, I have to run a bash script on the supercomputer I am using to be able to start the LAMMPS simulation. In that script, I need to have the following lines:

>module load gcc/9.3.0 cuda/11.0 openmpi/4.0.3
>module load python/3.10.2 cudnn/8.0.3 mpi4py/3.0.3
>source $HOME/venvs/deepmd/bin/activate
>deepmd_root=$HOME/software/deepmd
>export PATH=$deepmd_root/bin:$PATH

Adding these lines into my bash script solves the problem that LAMMPS cannot locate deepmd at all. The other main issue (which seems to be a commonly reported problem) is that when running a LAMMPS job with deepmd, the pair_style argument of deepmd is not recognized. For me, this had a very simple solution that does not appear to be documented well. During the installation process, a /deepmd/lib/ folder will be created, and it has a set of plugin files in it. So when creating the LAMMPS input script, you need to physically load that file for the pair style to be recognized. For me, I used the command "plugin load libdeepmd_lmp.so".

With these steps, I was able to successfully run a water simulation. I had my own input files, but the deepmd source code also provides an example water simulation as well as many others. I should note that these steps are specific to the GPU supported version. If one would like the CPU supported version, there will be a slight modification of the steps I provided above

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .