This tutorial demonstrates the basic usage of KIM models in LAMMPS and ASE. Other supported calculators are listed here. Also included is a demonstration of advanced querying of the new EquilibriumCrystalStructure tests for arbitrary crystals to construct a thermodynamic convex hull for an interatomic potential.
To run any cells with code, click on them and press shift+enter or press the run button. Commands with a leading ``!" are shell commands, otherwise they are Python.
This Binder is an instance of the KIM Developer Platform (KDP). Most of the examples in this tutorial are relevant to using OpenKIM models in production simulations. If you are interested in the special features of the KDP for KIM content development, see the following notebook:
To use KIM models, the KIM API must be installed, as well as the models you wish to use. See Obtaining KIM Models for instructions on installing the API and models separately or as a single package.
The KIM API is already installed in this Binder. In addition to the API for using KIM models in simulations, it provides the kim-api-collections-management
utility with several subcommands, some of which are demonstrated here. Use it to install some models now (first set for the LAMMPS demo, second for the ASE demo):
!kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_006
!kim-api-collections-management install user Sim_LAMMPS_ReaxFF_ManzanoMoeiniMarinelli_2012_CaSiOH__SM_714124634215_000
!kim-api-collections-management install user EAM_Dynamo_SongMendelev_2021_AlSm__MO_722733117926_000
The following command shows the installed models:
!kim-api-collections-management list
Because everything archived in OpenKIM can be queried, the possibilities of using OpenKIM queries are endless. We have already seen how they can be used to query lattice constants to set up simulations. For more information about ways to query OpenKIM, see:
https://openkim.org/doc/usage/kim-query/
As a simple example, we can use the kim-query Python package to query the bulk moduli of the two models we examined in the LAMMPS example to see if we ranked them correctly:
from kim_query import get_bulk_modulus_isothermal_cubic
print(get_bulk_modulus_isothermal_cubic(["SW_StillingerWeber_1985_Si__MO_405512056662_006"],["diamond"],["Si"],["GPa"]))
print(get_bulk_modulus_isothermal_cubic(["Sim_LAMMPS_ReaxFF_ManzanoMoeiniMarinelli_2012_CaSiOH__SM_714124634215_000"],["diamond"],["Si"],["GPa"]))
As the final demo we show how to use advanced querying to construct a thermodynamic convex hull from the results of the new EquilibriumCrystalStructure test driver and compare them to reference data. A convex hull is a common product of of DFT materials discovery databases such as AFLOW. Compounds on the hull, and only those on the hull, are predicted to be stable. Now that OpenKIM is able to compute properties for arbitrary multi-species crystals, we can compare the hulls computed by interatomic potentials to those computed by DFT.
Note that for now we have only created tests and reference data for the AFLOW-ICSD catalog, so the number of structures is sparse and the reference data was computed using the Hubbard U correction, which is not the preferred type of calculation for convex hull construction. Stay tuned as we incorporate all 3.5 million materials from AFLOW!
You are encouraged to look at the included Python file hull_functions.py to see how the advanced querying works.
from hull_functions import plot_model_hull_vs_rd
import matplotlib.pyplot as plt
species=["Al","Ti"]
model="EAM_Dynamo_ZopeMishin_2003_TiAl__MO_117656786760_005"
#model="EAM_Dynamo_FarkasJones_1996_NbTiAl__MO_042691367780_000"
#model="MEAM_LAMMPS_AlmyrasSangiovanniSarakinos_2019_NAlTi__MO_958395190627_001"
#model="MEAM_LAMMPS_KimKimJung_2016_AlTi__MO_618133763375_001"
#model="MEAM_LAMMPS_KimKimJung_2017_NiAlTi__MO_478967255435_001"
#model="MEAM_LAMMPS_SunRamachandranWick_2018_TiAl__MO_022920256108_001"
#model="Tersoff_LAMMPS_PlummerRathodSrivastava_2021_TiAlC__MO_992900971352_000"
assert len(species)==2
plot_model_hull_vs_rd(species,model)