Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ocpapi

API Overview
PropertyValue
PurposeProgrammatic access to Open Catalyst Demo
InterfacePython async/await
LicenseMIT

Python library for programmatic use of the Open Catalyst Demo. Users unfamiliar with the Open Catalyst Demo are encouraged to read more about it before continuing.

Installation

Quickstart

The following examples are used to search for *OH binding sites on Pt surfaces. They use the find_adsorbate_binding_sites function, which is a high-level workflow on top of other methods included in this library. Once familiar with this routine, users are encouraged to learn about lower-level methods and features that support more advanced use cases.

Note about async methods

This package relies heavily on asyncio. The examples throughout this document can be copied to a python repl launched with:

Alternatively, an async function can be run in a script by wrapping it with asyncio.run():

Since this is being evaluated as a jupyter notebook, ipython will handle this for you automatically!

Search over all surfaces

Users will be prompted to select one or more surfaces that should be relaxed.

Input to this function includes:

This function will perform the following steps:

  1. Enumerate surfaces of the bulk material

  2. On each surface, enumerate initial guesses for adorbate binding sites

  3. Run local force-based relaxations of each adsorbate placement

In addition, this handles:

This should take 2-10 minutes to finish while tens to hundreds (depending on the number of surfaces that are selected) of individual adsorbate placements are relaxed on unique surfaces of Pt. Each of the objects in the returned list includes (among other details):

Supported bulks and adsorbates

A finite set of bulk materials and adsorbates can be referenced by ID throughout the OCP API. The lists of supported values can be viewed in two ways.

  1. Visit the UI at https://open-catalyst.metademolab.com/demo and explore the lists in Step 1 and Step 3.

  2. Use the low-level client that ships with this library:

Skip relaxation approval prompts

Calls to find_adsorbate_binding_sites() will, by default, show the user all pending relaxations and ask for approval before they are submitted. In order to run the relaxations automatically without manual approval, adslab_filter can be set to a function that automatically approves any or all adsorbate/slab (adslab) configurations.

Run relaxations for all slabs that are generated:

Run relaxations only for slabs with Miller Indices in the input set:

Persisting results

Results should be saved whenever possible in order to avoid expensive recomputation.

Assuming results was generated with the find_adsorbate_binding_sites method used above, it is an AdsorbateBindingSites object. This can be saved to file with:

Similarly, results can be read back from file to an AdsorbateBindingSites object with:

Viewing results in the web UI

Relaxation results can be viewed in a web UI. For example, https://open-catalyst.metademolab.com/results/7eaa0d63-83aa-473f-ac84-423ffd0c67f5 shows the results of relaxing *OH on a Pt (1,1,1) surface; the uuid, “7eaa0d63-83aa-473f-ac84-423ffd0c67f5”, is referred to as the system_id.

Extending the examples above, the URLs to visualize the results of relaxations on each Pt surface can be obtained with:

Advanced usage

Changing the model type

The API currently supports two models:

A specific model type can be requested with:

Converting to ase.Atoms objects

Important! The to_ase_atoms() method described below will fail with an import error if ase is not installed.

Two classes have support for generating ase.Atoms objects:

For example, the following would generate an ase.Atoms object for the first relaxed adsorbate configuration on the first slab generated for *OH binding on Pt:

Converting to other structure formats

From an ase.Atoms object (see previous section), is is possible to write to other structure formats. Extending the example above, the ase_atoms object could be written to a VASP POSCAR file with:

License

ocpapi is released under the MIT License.

Citing ocpapi

If you use ocpapi in your research, please consider citing the AdsorbML paper (in addition to the relevant datasets / models used):

@article{lan2023adsorbml,
  title={{AdsorbML}: a leap in efficiency for adsorption energy calculations using generalizable machine learning potentials},
  author={Lan*, Janice and Palizhati*, Aini and Shuaibi*, Muhammed and Wood*, Brandon M and Wander, Brook and Das, Abhishek and Uyttendaele, Matt and Zitnick, C Lawrence and Ulissi, Zachary W},
  journal={npj Computational Materials},
  year={2023},
}