LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

pair_style kim command

Syntax:

pair_style kim virialmode model 

Examples:

pair_style kim KIMvirial model_Ar_P_Morse
pair_coeff * * Ar Ar 

Description:

This pair style is a wrapper on the Knowledge Base for Interatomic Models (KIM) repository of interatomic potentials, so that they can be used by LAMMPS scripts.

In KIM lingo, a potential is a "model" and a model contains both the analytic formulas that define the potential as well as the parameters needed to run it for one or more materials, including coefficients and cutoffs.

The argument virialmode determines how the global virial is calculated. If KIMvirial is specified, the KIM model performs the global virial calculation (if it knows how). If LAMMPSvirial is specified, LAMMPS computes the global virial using its fdotr mechanism.

The argument model is the name of the KIM model for a specific potential as KIM defines it. In principle, LAMMPS can invoke any KIM model. You should get an error or warning message from either LAMMPS or KIM if there is an incompatibility.

Only a single pair_coeff command is used with the kim style which specifies the mapping of LAMMPS atom types to KIM elements. This is done by specifying N additional arguments after the * * in the pair_coeff command, where N is the number of LAMMPS atom types:

As an example, imagine the KIM model supports Si and C atoms. If your LAMMPS simulation has 4 atom types and you want the 1st 3 to be Si, and the 4th to be C, you would use the following pair_coeff command:

pair_coeff * * Si Si Si C 

The 1st 2 arguments must be * * so as to span all LAMMPS atom types. The first three Si arguments map LAMMPS atom types 1,2,3 to Si as defined within KIM. The final C argument maps LAMMPS atom type 4 to C as defined within KIM. If a mapping value is specified as NULL, the mapping is not performed. This can only be used when a kim potential is used as part of the hybrid pair style. The NULL values are placeholders for atom types that will be used with other potentials.


In addition to the usual LAMMPS error messages, the KIM library itself may generate errors, which should be printed to the screen. In this case it is also useful to check the kim.log file for additional error information. This file kim.log should be generated in the same directory where LAMMPS is running.


Here is information on how to build KIM for use with LAMMPS.

The KIM API is available for download from this site, namely https://openkim.org. The tarball you download is "openkim-api-vX.X.X.tgz", which can be unpacked via

tar xvfz openkim*tgz 

The openkim-api-vX.X.X/DOCS/ directory has further documentation. In order to compile and install the KIM API follow the instructions found in the file openkim-api-vX.X.X/INSTALL. (Don't forget to download and compile any Model Drivers and Models that you want to use.)

Once you have successfully compiled and installed the KIM API, you need to set up LAMMPS to use your KIM API system. In the LAMMPS package there is a directory src/KIM/ with an important file in it: Makefile.lammps. When you do 'make yes-kim' LAMMPS will use the settings in src/KIM/Makefile.lammps to find the KIM API header files and the KIM API library itself for linking purposes. Thus, you should edit src/KIM/Makefile.lammps to ensure it has the correct settings for your system and your build of KIM.

The following is an example of how to download, compile, and run LAMMPS with the KIM API:

mkdir lammps-kim
cd lammps-kim 

#
# download lammps and the KIM API
# 

wget http://lammps.sandia.gov/tars/lammps-DDMMMYY.tar.gz        # replace DDMMMYY as appropriate here and below
wget http://s3.openkim.org/openkim-api/openkim-api-vX.X.X.tgz   # replace X.X.X as appropriate here and below
tar zxvf openkim-api-vX.X.X.tgz 

#
# Get OpenKIM models, setup and compile
# 

cd openkim-api-vX.X.X
cp Makefile.KIM_Config.example Makefile.KIM_Config
vi Makefile.KIM_Config  # edit file as appropriate following the instructions given in the INSTALL file
cd MODEL_DRIVERS
wget --content-disposition 'https://kim-items.openkim.org/archive?kimid=EAM_Dynamo__MD_120291908751_000&compression=gz'
tar zxvf EAM_Dynamo__MD_120291908751_000.tgz
cd ../MODELS
wget --content-disposition 'https://kim-items.openkim.org/archive?kimid=EAM_Dynamo_Angelo_Moody_NiAlH__MO_418978237058_000&compression=gz'
tar zxvf EAM_Dynamo_Angelo_Moody_NiAlH__MO_418978237058_000.tgz
cd ../
make
cd ../ 

#
# setup and compile lammps
# 

tar zxvf lammps-DDMMMYY.tar.gz
cd lammps-DDMMMYY/src/KIM
vi Makefile.lammps  # edit the three lines to look like below:
                    #   kim_SYSINC  = -I../../../openkim-api-vX.X.X/KIM_API
                    #   kim_SYSLIB  = -lkim
                    #   kim_SYSPATH = -L../../../openkim-api-vX.X.X/KIM_API
cd ../
make yes-kim
cd STUBS
make
cd ../
make serial 

#
# run simple example with KIM model
# 

cd ../../
vi al-input  # create file with the following content
#----------------------------------------------------------------------------------------
variable        x index 1
variable        y index 1
variable        z index 1 

variable        xx equal 20*$x
variable        yy equal 20*$y
variable        zz equal 20*$z 

units           metal
atom_style      atomic 

lattice         fcc 4.0500
region          box block 0.0 ${xx} 0.0 ${yy} 0.0 ${zz}
create_box      1 box
create_atoms    1 box 

pair_style      kim KIMvirial EAM_Dynamo_Angelo_Moody_NiAlH__MO_418978237058_000
pair_coeff      * * Al 

mass            1 26.98
velocity        all create 200.0 232345 loop geom 

neighbor        0.3 bin
neigh_modify    delay 0 every 1 check yes 

fix             1 all nve 

run             100
#---------------------------------------------------------------------------------------- 

./lammps-DDMMYY/src/lmp_serial < al-input 


Mixing, shift, table, tail correction, restart, rRESPA info:

This pair style does not support the pair_modify mix, shift, table, and tail options.

This pair style does not write its information to binary restart files, since KIM stores the potential parameters. Thus, you need to re-specify the pair_style and pair_coeff commands in an input script that reads a restart file.

This pair style can only be used via the pair keyword of the run_style respa command. It does not support the inner, middle, outer keywords.


Restrictions:

This pair style is part of the KIM package. It is only enabled if LAMMPS was built with that package. See the Making LAMMPS section for more info.

This current version of pair_style kim is compatible with the openkim-api package version 1.2.0 and higher.

Related commands:

pair_coeff

Default: none