KIM: Install downloaded and built package


I’m trying to install lammps with the optional KIM package. I got cmake to download and build kim, and then build lammps with kim and install lammps. But it appears that kim is not installed by the cmake --install . command. If I try to run lammps in python, I get the error

Python 3.10.9 (main, Dec  7 2022, 02:05:58) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lammps
>>> lmp = lammps.lammps()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pbro/Library/Python/3.10/lib/python/site-packages/lammps/", line 144, in __init__
    self.lib = CDLL(libpath,RTLD_GLOBAL)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(liblammps.dylib, 10): Library not loaded: @rpath/libkim-api.2.dylib
  Referenced from: /Users/pbro/.local/lib/liblammps.0.dylib
  Reason: image not found

The libkim-api.2.dylib sits happily in lammps/build/kim_build-prefix/lib, but has not been installed by the install command.

Is there a way for lammps to automatically also install the kim files (binaries, libraries) it built?

Thank you,


No, and it is not intended to be this way. The automatic download is mostly for LAMMPS testing.
If you want a usable OpenKIM API installation beyond running tests with LAMMPS, you need to do a proper OpenKIM installation first, then activate it, and only then configure and build LAMMPS. It will pick up your custom installation, if that was done properly.