{"id":13698112,"url":"https://github.com/openkim/kliff","last_synced_at":"2026-02-22T11:07:21.948Z","repository":{"id":37939809,"uuid":"99040973","full_name":"openkim/kliff","owner":"openkim","description":"KIM-based Learning-Integrated Fitting Framework for interatomic potentials. ","archived":false,"fork":false,"pushed_at":"2025-04-08T05:31:09.000Z","size":6063,"stargazers_count":35,"open_issues_count":26,"forks_count":21,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-09T18:57:11.853Z","etag":null,"topics":["force-fields","interatomic-potentials","kim","machine-learning","materials-modelling","molecular-dynamics"],"latest_commit_sha":null,"homepage":"https://kliff.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openkim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-01T20:33:58.000Z","updated_at":"2025-04-08T05:23:32.000Z","dependencies_parsed_at":"2023-12-20T06:38:40.612Z","dependency_job_id":null,"html_url":"https://github.com/openkim/kliff","commit_stats":{"total_commits":757,"total_committers":11,"mean_commits":68.81818181818181,"dds":0.4147952443857331,"last_synced_commit":"4b81dcd75a8cc11248d91e8e997848c589e80e4b"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openkim%2Fkliff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openkim%2Fkliff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openkim%2Fkliff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openkim%2Fkliff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openkim","download_url":"https://codeload.github.com/openkim/kliff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252272944,"owners_count":21721831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["force-fields","interatomic-potentials","kim","machine-learning","materials-modelling","molecular-dynamics"],"created_at":"2024-08-02T19:00:40.175Z","updated_at":"2025-10-21T19:54:44.050Z","avatar_url":"https://github.com/openkim.png","language":"Python","funding_links":[],"categories":["Software","Interatomic Potentials (ML-IAP)"],"sub_categories":[],"readme":"# KIM-based Learning-Integrated Fitting Framework (KLIFF)\n\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/openkim/kliff/testing.yml)\n[![Documentation Status](https://readthedocs.org/projects/kliff/badge/?version=latest)](https://kliff.readthedocs.io/en/latest/?badge=latest)\n[![Anaconda-Server Badge](https://img.shields.io/conda/vn/conda-forge/kliff.svg)](https://anaconda.org/conda-forge/kliff)\n[![PyPI](https://img.shields.io/pypi/v/kliff.svg)](https://pypi.python.org/pypi/kliff)\n\n### Documentation at: \u003chttps://kliff.readthedocs.io\u003e\n\nKLIFF is an interatomic potential fitting package that can be used to fit\nphysics-motivated (PM) potentials, as well as machine learning potentials such\nas the neural network (NN) models.\n\n\n## Installation\n\n### Using conda (recommended)\n\n```sh\nconda install -c conda-forge kliff\n```\n\n### Using pip\n\n```sh\npip install kliff\n```\n\n### From source\n```\ngit clone https://github.com/openkim/kliff\npip install ./kliff\n```\n\n### Dependencies\n\n- KLIFF requires the [kim-api](https://openkim.org/kim-api/) and [kimpy](https://github.com/openkim/kimpy) packages.\n  If you install using `conda` as described above, these packages will be installed automatically. Alternatively, they can be installed from source or via [pip](https://pip.pypa.io/en/stable/).\n  See [Installation](https://kliff.readthedocs.io/en/latest/installation.html) for more information.\n\n- In addition, [PyTorch](https://pytorch.org) is needed if you want to train machine learning models. See the official [PyTorch website](https://pytorch.org/get-started/locally/) for installation instructions.\n\n## A quick example to train a neural network potential\n\n```python\nfrom kliff.legacy import nn\nfrom kliff.legacy.calculators import CalculatorTorch\nfrom kliff.legacy.descriptors import SymmetryFunction\nfrom kliff.dataset import Dataset\nfrom kliff.models import NeuralNetwork\nfrom kliff.legacy.loss import Loss\nfrom kliff.utils import download_dataset\n\n# Descriptor to featurize atomic configurations\ndescriptor = SymmetryFunction(\n    cut_name=\"cos\", cut_dists={\"Si-Si\": 5.0}, hyperparams=\"set51\", normalize=True\n)\n\n# Fully-connected neural network model with 2 hidden layers, each with 10 units\nN1 = 10\nN2 = 10\nmodel = NeuralNetwork(descriptor)\nmodel.add_layers(\n    # first hidden layer\n    nn.Linear(descriptor.get_size(), N1),\n    nn.Tanh(),\n    # second hidden layer\n    nn.Linear(N1, N2),\n    nn.Tanh(),\n    # output layer\n    nn.Linear(N2, 1),\n)\n\n# Training set (dataset will be downloaded from:\n# https://github.com/openkim/kliff/blob/master/examples/Si_training_set.tar.gz)\ndataset_path = download_dataset(dataset_name=\"Si_training_set\")\ndataset_path = dataset_path.joinpath(\"varying_alat\")\ntrain_set = Dataset.from_path(dataset_path)\nconfigs = train_set.get_configs()\n\n# Set up calculator to compute energy and forces for atomic configurations in the\n# training set using the neural network model\ncalc = CalculatorTorch(model, gpu=False)\ncalc.create(configs)\n\n# Define a loss function and train the model by minimizing the loss\nloss = Loss(calc)\nresult = loss.minimize(method=\"Adam\", num_epochs=10, batch_size=100, lr=0.001)\n\n# Write trained model as a KIM model to be used in other codes such as LAMMPS and ASE\nmodel.write_kim_model()\n```\n\nDetailed explanation and more tutorial examples can be found in the\n[documentation](https://kliff.readthedocs.io/en/latest/tutorials.html).\n\n\n## Why you want to use KLIFF (or not use it)\n\n- Interacting seamlessly with[ KIM](https://openkim.org), the fitted model can be readily used in simulation codes such as LAMMPS and ASE via the `KIM API`\n- Creating mixed PM and NN models\n- High level API, fitting with a few lines of codes\n- Low level API for creating complex NN models\n- Parallel execution\n- [PyTorch](https://pytorch.org) backend for NN (include GPU training)\n- Support for deploying trained ML models with TorchScript and KIM-API\n\n## Citing KLIFF\n\n```\n@Article{wen2022kliff,\n  title   = {{KLIFF}: A framework to develop physics-based and machine learning interatomic potentials},\n  author  = {Mingjian Wen and Yaser Afshar and Ryan S. Elliott and Ellad B. Tadmor},\n  journal = {Computer Physics Communications},\n  volume  = {272},\n  pages   = {108218},\n  year    = {2022},\n  doi     = {10.1016/j.cpc.2021.108218},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenkim%2Fkliff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenkim%2Fkliff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenkim%2Fkliff/lists"}