Calling a python based AMP code from openkim


I intend to call some of the models used in the python based Atomistic Machine Learning Code, (AMP) from Openkim.

Could you please suggest how can I go around the python-C++ interface?



Hello Swayam,

Thanks for your message. I'll need more details on what you want to do in order to help you.

How do you hope to couple openkim and AMP and what do you hope to achieve?

For example, is it that you want to use AMP with a KIM model to refit the model to a new training set using the AMP machine learning features?

Or is it that you want to implement a nureal net model within KIM using the tools from AMP?

If you can describe what you ultamitely want to achieve in more detail, then I should be able to point you in a good starting direction.



Hi Ryan,

Thanks for your email. I would in fact want to do the first type of coupling,

  • to use AMP with a KIM model to refit the model to a new training set using the AMP machine learning features? That I suppose can be done in openkim language (c/c++).


Hi Swayam,

OK. I would think about this as "calling a KIM model from within AMP".

You'll need to figure out how to have AMP "wrap" a KIM model so that it looks like a native AMP model. I'm not sure how that will work, but in effect, you will need to write code that makes AMP act like a Simulator from the KIM point of view.

Actually, now I see that AMP is designed to integrate closely with ASE. KIM can work nicely with ASE. You just need to do some work to get the KIM ASE interface setup.

I don't have the details for this setup at my finger tips right now, but I (or someone else) will post them in a little while.


Thanks a lot Ryan for the suggestion, will look into how to set up the KIM ASE interface, and then extend to AMP.



Hi, if someone has further ideas on how to build the interface between KIM (c++) and ASE (python), it will be great to know. thank you!


There are two relevant repositories for this:

The ‘openkim-python’ package needs to be installed first. After cloning
the repo, you’ll need to create a file within its directory called
‘setup.cfg’. See the file ‘setup.cfg.example’ for reference. After you’ve
created the config file, run the setup script in the repo by issuing
python build && python install.

Once openkim-python is installed, you can install openkim-kimcalculator-ase
by going into and issuing python build && python install
just as before.

Having installed these packages, you should be able to use kim Models
within your python scripts by creating kimcalculator.KIMCalculator
objects. For instance, if everything was installed correctly, you could
create an ASE calculator object for ex_model_Ar_P_Morse by doing something

import kimcalculator
calc = kimcalculator.KIMCalculator('ex_model_Ar_P_Morse')

An example KIM Test that we have that uses ASE that you might want to look
at is ASECohesiveEnergyFromQueryExample_fcc_Ar__TE_102111117114_001 Just go down to the
‘Files’ section near the bottom of the page click on ‘runner’; this is the
actual executable used by the Test.