LAMMPS usage error with OpenKIM


I am getting the following error when i run my lammps input script that uses OpenKIM potential:

WARNING: ‘kim_’ has been renamed to ‘kim ’. Please update your input.

ERROR: Unknown command: kim init Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_003 metal (src/input.cpp:391)

Attaching the LAMMPS input file herewith. (2.3 KB)

Please let us know your exact LAMMPS version.

LAMMPS version: 20191120+dfsg1-2build2

That is too old.

Oh, I see. I have installed LAMMPS using the pre-build Ubuntu Linux executable for the Ubuntu version 20.04.5 LTS. When i use

sudo apt-get update

to update the LAMMPS version, the version i get is 20191120+dfsg1-2build2

How do i obtain the latest LAMMPS version for my OS then?

You have three options:

  1. Complain to the people who do the packaging of LAMMPS for your Linux distribution that they need to update the package (and by preference to the most recent version) and wait for them to post an update.
  2. Build LAMMPS from source: 3. Build LAMMPS — LAMMPS documentation
  3. Switch to a different Linux flavor where the LAMMPS packages are updated more regularly

There is a fourth option: update to Ubuntu 22.04LTS. That one seems to ship with the 29 Sep 2021 version. While that is not the latest, it is two years more recent that the one for Ubuntu 20.04LTS.

I have updated my LAMMPS version by building from source. Still getting the same error:

LAMMPS (23 Jun 2022)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
using 1 OpenMP thread(s) per MPI task
ERROR: Unknown command: kim init Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_003 metal (src/input.cpp:302)
Last command: kim init Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_003 metal
Traceback (most recent call last):

It works for me. Did you compile LAMMPS with the Kim package enabled? What is the output of: lmp - h
Is the input still exactly the same as in your original post?

Not sure about the first question.

Output of lmp -h:

Large-scale Atomic/Molecular Massively Parallel Simulator - 23 Jun 2022 - Update 1
Git info (stable / stable_23Jun2022_update1)

Usage example: lmp -var t 300 -echo screen -in in.alloy

List of command line options supported by this LAMMPS executable:

-echo none/screen/log/both  : echoing of input script (-e)
-help                       : print this help message (-h)
-in none/filename           : read input from file or stdin (default) (-i)
-kokkos on/off ...          : turn KOKKOS mode on or off (-k)
-log none/filename          : where to send log output (-l)
-mdi '<mdi flags>'          : pass flags to the MolSSI Driver Interface
-mpicolor color             : which exe in a multi-exe mpirun cmd (-m)
-cite                       : select citation reminder style (-c)
-nocite                     : disable citation reminder (-nc)
-package style ...          : invoke package command (-pk)
-partition size1 size2 ...  : assign partition sizes (-p)
-plog basename              : basename for partition logs (-pl)
-pscreen basename           : basename for partition screens (-ps)
-restart2data rfile dfile ... : convert restart to data file (-r2data)
-restart2dump rfile dgroup dstyle dfile ... 
                            : convert restart to dump file (-r2dump)
-reorder topology-specs     : processor reordering (-r)
-screen none/filename       : where to send screen output (-sc)
-skiprun                    : skip loops in run and minimize (-sr)
-suffix gpu/intel/opt/omp   : style suffix to apply (-sf)
-var varname value          : set index style variable (-v)

OS: Linux "Ubuntu 20.04.5 LTS" 5.15.0-46-generic x86_64

Compiler: GNU C++ 9.4.0 with OpenMP 4.5
C++ standard: C++11
MPI v3.1: Open MPI v4.0.3, package: Debian OpenMPI, ident: 4.0.3, repo rev: v4.0.3, Mar 03, 2020

Accelerator configuration:

Active compile time flags:

sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint):   32-bit
sizeof(bigint):   64-bit

Available compression formats:

Extension: .gz     Command: gzip
Extension: .bz2    Command: bzip2
Extension: .xz     Command: xz
Extension: .lzma   Command: xz
Extension: .lz4    Command: lz4

Installed packages:

List of individual style options included in this LAMMPS executable

* Atom styles:

atomic          body            charge          ellipsoid       hybrid          
line            sphere          tri             

* Integrate styles:

respa           verlet          

* Minimize styles:

cg              fire            fire/old        hftn            quickmin        

* Pair styles:

born            buck            buck/coul/cut   coul/cut        coul/debye      
coul/dsf        coul/wolf       reax            hybrid          hybrid/overlay  
hybrid/scaled   lj/cut          lj/cut/coul/cut lj/expand       morse           
soft            table           yukawa          zbl             zero            

* Bond styles:

hybrid          zero            

* Angle styles:

hybrid          zero            

* Dihedral styles:

hybrid          zero            

* Improper styles:

hybrid          zero            

* KSpace styles:

* Fix styles

adapt           addforce        ave/atom        ave/chunk       ave/correlate   
ave/histo       ave/histo/weight                ave/time        aveforce        
balance         box/relax       deform          deposit         ave/spatial     
ave/spatial/sphere              lb/pc           lb/rigid/pc/sphere              
client/md       dt/reset        efield          enforce2d       evaporate       
external        gravity         halt            heat            indent          
langevin        lineforce       momentum        move            nph             
nph/sphere      npt             npt/sphere      nve             nve/limit       
nve/noforce     nve/sphere      nvt             nvt/sllod       nvt/sphere      
planeforce      press/berendsen print           property/atom   recenter        
restrain        setforce        spring          spring/chunk    spring/self     
store/force     store/state     temp/berendsen  temp/rescale    
thermal/conductivity            vector          viscous         wall/harmonic   
wall/lj1043     wall/lj126      wall/lj93       wall/morse      wall/reflect    

* Compute styles:

aggregate/atom  angle           angle/local     angmom/chunk    bond            
bond/local      centro/atom     centroid/stress/atom            chunk/atom      
chunk/spread/atom               cluster/atom    cna/atom        com             
com/chunk       coord/atom      dihedral        dihedral/local  dipole          
dipole/chunk    displace/atom   erotate/sphere  erotate/sphere/atom             
fragment/atom   global/atom     group/group     gyration        gyration/chunk  
heat/flux       improper        improper/local  inertia/chunk   ke              
ke/atom         msd             msd/chunk       omega/chunk     orientorder/atom                
pair            pair/local      pe              pe/atom         pressure        
property/atom   property/chunk  property/local  rdf             reduce          
reduce/chunk    reduce/region   slice           stress/atom     temp            
temp/chunk      temp/com        temp/deform     temp/partial    temp/profile    
temp/ramp       temp/region     temp/sphere     torque/chunk    vacf            

* Region styles:

block           cone            cylinder        ellipsoid       intersect       
plane           prism           sphere          union           

* Dump styles:

atom            cfg             custom          image           local           
movie           xyz             

* Command styles

balance         change_box      create_atoms    create_bonds    create_box      
delete_atoms    delete_bonds    reset_ids       kim_init        kim_interactions                
kim_param       kim_property    kim_query       message         server          
displace_atoms  info            minimize        read_data       read_dump       
read_restart    replicate       rerun           reset_atom_ids  reset_mol_ids   
run             set             velocity        write_coeff     write_data      
write_dump      write_restart   

Yes the input file is the same.

Hi @imomnipresent, to clarify @akohlmey remark: the KIM package is an external package that is not necessary to compile LAMMPS. You need to specifically add it (and install kim-api and models).

See sections 3.1, 3.2 and 3.7 of the Build Section from the manual that @akohlmey already posted. Section 3.7 has a dedicated section on how to add kim package.

From you output it seems that the kim command and pair_style are absent from your executable so I do not think it was compiled with the package.

The lmp -h output confirms, there are no additional packages included in your LAMMPS binary and thus also not the KIM package. You need to enable it (and first activate your kim-api installation so CMake can detect it) and then recompile LAMMPS. 3.7. Packages with extra build options — LAMMPS documentation


When you recompile, it is usually a good idea to add the “basic packages preset” to also install a few packages with the most commonly used features beyond the absolute minimum or the “most packages preset” with most packages that do not need extra setup or external libraries.