-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b05e2f
commit 82ff9ea
Showing
175 changed files
with
1,930 additions
and
730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
_sources/autoapi/ocpmodels/common/model_registry/index.rst
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
_sources/autoapi/ocpmodels/models/model_registry/index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
:py:mod:`ocpmodels.models.model_registry` | ||
========================================= | ||
|
||
.. py:module:: ocpmodels.models.model_registry | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
ocpmodels.models.model_registry.model_name_to_local_file | ||
|
||
|
||
|
||
Attributes | ||
~~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
ocpmodels.models.model_registry.MODEL_REGISTRY | ||
ocpmodels.models.model_registry.available_pretrained_models | ||
|
||
|
||
.. py:data:: MODEL_REGISTRY | ||
.. py:data:: available_pretrained_models | ||
.. py:function:: model_name_to_local_file(model_name: str, local_cache: str | pathlib.Path) -> str | ||
Download a pretrained checkpoint if it does not exist already | ||
|
||
:param model_name: the model name. See available_pretrained_checkpoints. | ||
:type model_name: str | ||
:param local_cache: | ||
:type local_cache: str | ||
|
||
Returns: | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
jupytext: | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
jupytext_version: 1.16.1 | ||
kernelspec: | ||
display_name: Python 3 (ipykernel) | ||
language: python | ||
name: python3 | ||
--- | ||
|
||
Quickstart simulation using pre-trained models | ||
---------- | ||
|
||
1. First, install OCP in a fresh python environment using one of the approaches in [installation documentation](INSTALL). | ||
2. See what pre-trained potentials are available | ||
```{code-cell} ipython3 | ||
from ocpmodels.models.model_registry import available_pretrained_models | ||
print(available_pretrained_models) | ||
``` | ||
3. Choose a checkpoint you want to use and download it automatically! We'll use the GemNet-OC potential, trained on both the OC20 and OC22 datasets. | ||
```{code-cell} ipython3 | ||
from ocpmodels.models.model_registry import model_name_to_local_file | ||
checkpoint_path = model_name_to_local_file('GemNet-OC OC20+OC22', local_cache='/tmp/ocp_checkpoints/') | ||
checkpoint_path | ||
``` | ||
4. Finally, use this checkpoint in an ASE calculator for a simple relaxation! | ||
``` | ||
from ocpmodels.common.relaxation.ase_utils import OCPCalculator | ||
from ase.build import fcc111, add_adsorbate | ||
from ase.optimize import BFGS | ||
import matplotlib.pyplot as plt | ||
from ase.visualize.plot import plot_atoms | ||
# Define the model atomic system, a Pt(111) slab with an *O adsorbate! | ||
slab = fcc111('Pt', size=(2, 2, 5), vacuum=10.0) | ||
add_adsorbate(slab, 'O', height=1.2, position='fcc') | ||
# Load the pre-trained checkpoint! | ||
calc = OCPCalculator(checkpoint_path=checkpoint_path, cpu=False) | ||
slab.set_calculator(calc) | ||
# Run the optimization! | ||
opt = BFGS(slab) | ||
opt.run(fmax=0.05, steps=100) | ||
# Visualize the result! | ||
fig, axs = plt.subplots(1, 2) | ||
plot_atoms(slab, axs[0]); | ||
plot_atoms(slab, axs[1], rotation=('-90x')) | ||
axs[0].set_axis_off() | ||
axs[1].set_axis_off() | ||
``` |
Oops, something went wrong.