Julia interface to the KIM-API (Knowledgebase of Interatomic Models). This is a low-level interface to the KIM-API, allowing you to access interatomic models directly from Julia. Think of it as the Julia equivalent of the KIMPY Python package.
For latest version:
using Pkg
Pkg.add(url="https://github.com/openkim/KIM_API.jl")For stable version:
using Pkg
Pkg.add("KIM_API")This package was earlier called KIMPortableModels.jl
Export the location of the KIM-API library:
export KIM_API_LIB=/path/to/libkim-api.soThen, you can use the package as follows:
using KIM_API, StaticArrays, LinearAlgebra
# Create model function
model = KIM_API.KIMModel("SW_StillingerWeber_1985_Si__MO_405512056662_006")
# Define system
species = ["Si", "Si"]
positions = [
SVector(0. , 0. , 0. ),
SVector(1.3575, 1.3575, 1.3575),
]
cell = Matrix([[0.0 2.715 2.715]
[2.715 0.0 2.715]
[2.715 2.715 0.0]])
pbc = [true, true, true]
# Compute properties
results = model(species, positions, cell, pbc)
println("Energy: ", results[:energy])
println("Forces: ", results[:forces])You can directly use KIM_API calculators as general interactions in Molly.jl simulations:
using Molly, KIM_API, StaticArrays, Unitful, UnitfulAtomic
calc = KIM_API.KIMCalculator("SW_StillingerWeber_1985_Si__MO_405512056662_006";
units=:metal)
sys = System(atoms = fill(Atom(atom_type="Si", mass=28.0855u"u"), 2),
coords = [SVector(0.,0.,0.), SVector(3.,0.,0.)] .* u"Å",
boundary = CubicBoundary(20.0u"Å"),
general_inters = (kim = calc,),
force_units = u"eV/Å",
energy_units = u"eV")
println(forces(sys), potential_energy(sys))- Access to all KIM models
- Automatic neighbor list generation
- Support for periodic boundary conditions
- Multiple unit systems (metal, real, SI, CGS, electron)
- Julia 1.10+
- KIM-API library (for model calculations)
- KIMNeighborList.jl (C++ backend), StaticArrays.jl
Full documentation is available at https://openkim.github.io/KIM_API.jl/
Run the test suite with:
using Pkg
Pkg.test("KIM_API")- Move to 1 based numbering internally for consistency
- Performance optimizations
- Additional model features support
- Test ML models
MIT
