Compile OpenKIM and use its potential database within LAMMPS

Compile OpenKIM and use potentials from its database within LAMMPS

Official OpenKIM website: https://openkim.org/

Official documentation to KIM package in LAMMPS: https://docs.lammps.org/pair_kim.html

What is OpenKIM: OpenKIM (Knowledgebase of Interatomic Models) provides a comprehensive database of interatomic potentials. It is supported by LAMMPS and allows for easy integrations of potentials from the OpenKIM database in the input LAMMPS scripts without downloading any additional files. 

Install OpenKIM (https://openkim.org/doc/usage/obtaining-models/#installing_models):

sudo add-apt-repository ppa:openkim/latest
sudo apt-get update
sudo apt-get install libkim-api-dev openkim-models

List all the available pre-compiled potentials within the installed OpenKIM database:

kim-api-collections-management list

To support OpenKIM in LAMMPS, compile it with KIM package. Activate the correct version of OpenMPI (the standardly compiled one by GCC compilers), enter the build directory of your previously compiled LAMMPS (see how to compile LAMMPS here: https://implant.fs.cvut.cz/lammps-gpu-compile/), use ccmake, find KIM package and turn it ON. Then configure and compile:

ccmake .
make -j
sudo make install -j

Not all potentials available in the OpenKIM are pre-installed. To use a specific potential from OpenKIM, it must be manually installed using its unique identifier. For instance, if I want to use this https://openkim.org/id/MO_070542625990_002#item-citation, I need its unique OpenKIM identificator: ‚MEAM_LAMMPS_KimLee_2008_TiN__MO_070542625990_002′ and install it with:

kim-api-collections-management install user MEAM_LAMMPS_KimLee_2008_TiN__MO_070542625990_002

All the available potentials in the OpenKIM database can be found at:

https://openkim.org/browse/models/by-species

On this site, enter the elements you are searching for, and the corresponding potentials in OpenKIM database will be listed. Choose your desired potential and refer to the instructions below for its usage in LAMMPS (you may need to install it first using the command provided above). The necessary identifier for each potential is listed under ‚Model‘ (as indicated by the arrow), e.g.: „LJ_ElliottAkerson_2015_Universal__MO_959249795837_003“.

Use potentials from OpenKIM database in LAMMPS:

Example task: I want to use 2NN-MEAM potential developed for Ti-N (https://openkim.org/id/MEAM_LAMMPS_KimLee_2008_TiN__MO_070542625990_002) for simulations with pure titanium.
For that, I can write one of the following (all listed options are equivalent) in an input file for LAMMPS:

Without KIM package (Option 1):

units metal
dimension 3
boundary p p p
atom_style atomic
read_data Ti_inter_4%.lmp

pair_style meam
pair_coeff * * libr.meam Ti TiN.meam Ti

With KIM package (Option 2):

kim init MEAM_LAMMPS_KimLee_2008_TiN__MO_070542625990_002 metal
boundary p p p
read_data Ti_inter_4%.lmp
kim interactions Ti

With KIM package (Option 3):

units metal
dimension 3
boundary p p p
atom_style atomic
read_data Ti_inter_4%.lmp
pair_style kim MEAM_LAMMPS_KimLee_2008_TiN__MO_070542625990_002
pair_coeff * * Ti

I have encountered some performance issues, as the simulations using the potential from KIM were slower. The following shows the total simulation times:

Option 1:    0:11
Option 2:    0:29
Option 3:    0:29