ERROR: KIM Model name not found

Greetings,
I have been running LAMMPS on Linux Virtual Machine integrated into Windows. I followed the installation procedure described here: 8.6.4. Using LAMMPS on Windows 10 with WSL — LAMMPS documentation
Now I need to use the Openkim potential. I have installed KIM API from source following the instructions given here: OpenKIM · Obtaining KIM Models · Interatomic Potentials and Force Fields. [I could not use the $ gpg commands]
I downloaded the archive file and pasted in my home directory after unpacking the home directory looks as follows:

koushik@DESKTOP-4LIPJ5O:~$ ls
kim-api-2.3.0 kim-api-2.3.0.txz kim-api-2.3.0.txz:Zone.Identifier lammps stable_3Mar2020.tar.gz

I followed all the steps mentioned in the previous link and downloaded two items with kim-api-collections-management. ‘kim-api-collections-management list’ command shows these two items under User collection

User Collection


Model Drivers: ‘/home/koushik/.kim-api/2.3.0+GNU.GNU.GNU.2022-12-28-09-30-14/model-drivers-dir’
EDIP_LAMMPS__MD_783584031339_000
SW__MD_335816936951_004

Portable Models: ‘/home/koushik/.kim-api/2.3.0+GNU.GNU.GNU.2022-12-28-09-30-14/portable-models-dir’
EDIP_LAMMPS_Marks_2000_C__MO_374144505645_000
SW_StillingerWeber_1985_Si__MO_405512056662_005

Simulator Models: ‘/home/koushik/.kim-api/2.3.0+GNU.GNU.GNU.2022-12-28-09-30-14/simulator-models-dir’
–empty–

Then I went to the lammps build directory and typed in the following commands

cmake …/cmake/presets/basic.cmake …/cmake
cmake -D PKG_KIM=yes …/cmake
cmake -D DOWNLOAD_KIM=yes …/cmake
cmake -D LMP_DEBUG_CURL=on …/cmake
cmake -D LMP_NO_SSL_CHECK=yes …/cmake
cmake -D KIM_EXTRA_UNITTESTS=yes …/cmake
make -j 4

Some of the above mentioned command are listed in this link: 3.7. Packages with extra build options — LAMMPS documentation

The installation was successful.
I have run an example from the examples directory of LAMMPS. The input script had the following command
‘kim_init LennardJones_Ar real’

I was able to run this script. But when I tried to run another script with ‘kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real’, the following error was shown:

ERROR: KIM Model name not found. (src/KIM/kim_init.cpp:189)
Last command: kim_init SW_StillingerWeber_1985_Si__MO_405512056662_005 real

Even though I clearly downloaded necessary elements to run this potential.
I have little experience working with linux OS, so I tried to describe the installation procedure in detail in case I made a mistake in following the instructions. I would be grateful if someone can point out what I have done wrong and how can I fix it.

Regards
Koushik Sarkar

Hi Koushik,

I am not exactly sure what’s going on here, but I noticed a couple of odd things about your report:

  1. The WSL page on LAMMPS documentation specifies an outdated version of LAMMPS, which I noticed because the commands to use OpenKIM in the example are deprecated (the modern syntax is “kim init” instead of “kim_init” and “kim interactions” instead of “kim_interactions”. So I would either replace “stable_3Mar2020” with a more recent version like “patch_22Dec2022.tar.gz”, or use “Option 2” using git, which will automatically download the newest development version.
  2. If you are following the WSL LAMMPS example, that means you installed Ubuntu. This installation works exactly like a native Ubuntu installation, so you don’t need to build the KIM API from source. You can use the “Ubuntu Linux PPA” or “Ubuntu Linux Release” options on OpenKIM · Obtaining KIM Models · Interatomic Potentials and Force Fields

I don’t guarantee that this will fix your issues, but it will get us on a more uniform starting point – especially 2), since it eliminates the possibility of things going wrong when building kim-api from source.

If you don’t have any serious work saved to your WSL, I believe the easiest way to start over would be to just reset the Ubuntu app: How to reset Ubuntu (and other Linux distributions) in Windows Subsystem for Linux | by Gaurav Nelson | Medium
You can also choose to install Ubuntu 22 LTS instead of 20 LTS if you want a newer version.

1 Like

I followed your suggestion and uninstalled Ubuntu and reinstalled everything.
I am still using Ubuntu 20 but this time I installed Openkim from PPA following this link: OpenKIM · Obtaining KIM Models · Interatomic Potentials and Force Fields
Then I downloaded lammps from git and included KIM package during compilation with Cmake. Here a point worth mentioning is this time a warning was showed after the following commands:
cmake -D LMP_DEBUG_CURL=on …/cmake
cmake -D LMP_NO_SSL_CHECK=yes …/cmake

The warning was:
CMake Warning:
Manually-specified variables were not used by the project:
LMP_DEBUG_CURL

The installation was completed. But same as before, the input script with the following line runs:
kim init LennardJones_Ar real

But for every other input script with different potential, the following error is shown:
ERROR: KIM Model name not found (src/KIM/kim_init.cpp:234)
Last command: kim init SW_StillingerWeber_1985_Si__MO_405512056662_005 real

In the input scripts an instruction was given as follows:
If this command does not work, you may need to setup your PATH to find the utility.
if you installed the kim-api using the LAMMPS CMake build, you can do the following
(where the current working directory is assumed to be the LAMMPS build directory)
source ./kim_build-prefix/bin/kim-api-activate

I tried running that command after going into LAMMPS build directory but nothing is shown on the console and the problem still persists.

I think I may have an idea what is causing this. I’m not 100% sure, I don’t have access to a computer where I can throw away my WSL installation right now to test, but here is my guess:

There are two kim-api-collections-management executables, one in /usr/bin, and one in [lammps-build-dir]/kim_build-prefix/bin
They each have separate collections of models. When you are doing kim-api-collections-management from command-line, you are using one set of collections, but LAMMPS is using the other.

When you say that the problem persists after running

source ./kim_build-prefix/bin/kim-api-activate

Did you check

kim-api-collections-management list

again after running that command?
If you do, you may find that the SW model that you had installed is no longer there. In that case, the fix is easy, you just need to install any models you want to use after running that source command, e.g.

kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_005

You can tell which kim-api-collections-management is currently being used (or any executable) with the command “which kim-api-collections-management”. The “source” command switches the executable in the command line to the one in the LAMMPS build directory (but does not change what LAMMPS uses).

If this is indeed what is happening and you want to avoid this problem in the first place, I would switch the order in which you install the KIM API and LAMMPS (even if the above doesn’t fix your issue, I would try this anyway).
EDIT: Instead of doing the above, I would instead try just installing LAMMPS with all the KIM options, and NOT install the API separately at all!

Because on my machine LAMMPS automatically uses the same collections as the default command-line kim-api-collections-managment (the one in /usr/bin), so I am guessing I installed KIM API first.

Finally, I want to inform you of the option of the KIM Developer Platform:
https://openkim.org/doc/evaluation/kim-developer-platform/
It is a Docker container that has KIM and LAMMPS and other programs pre-installed, and may be a more convenient option depending on what your needs are.

1 Like

I naively thought that installing with PPA would not require downloading individual models. I am able to run the scripts after downloading the models.

I tried running this command but it does not show any messge on the console.

I installed KIM API before installing LAMMPS.

I still have a minor issue of not being able to use “kim query” command. It probably has something to do with the warning shown during compilation

For now, I think my problem is solved. Thank you very much for being patient with me and guiding me through the installation steps.

1 Like

Great, glad that helped.

One final note. As mentioned on this page you linked:
https://docs.lammps.org/Build_extras.html#kim

If you wish to use an existing installation of the KIM API, DOWNLOAD_KIM should probably be set to “no”, which is the default.

If you do have multiple KIM API installations, you can switch between them by setting LD_LIBRARY_PATH to point to their respective libkim-api.so before running LAMMPS. For example, on my machine, I can do this with
export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu
and
export LD_LIBRARY_PATH=[lammps-build-dir]/kim_build-prefix/lib

1 Like

I totally overlooked that point that DOWNLOAD_KIM should be set to “no”. So I have installed KIM two times. Anyway it is working. Thanks again for everything.

1 Like