Skip to content

Commit

Permalink
deploy: e357091
Browse files Browse the repository at this point in the history
  • Loading branch information
zulissimeta committed Apr 11, 2024
1 parent 2b05e2f commit 82ff9ea
Show file tree
Hide file tree
Showing 175 changed files with 1,930 additions and 730 deletions.
1 change: 0 additions & 1 deletion _sources/autoapi/ocpmodels/common/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Submodules
gp_utils/index.rst
hpo_utils/index.rst
logger/index.rst
model_registry/index.rst
registry/index.rst
transforms/index.rst
tutorial_utils/index.rst
Expand Down
34 changes: 0 additions & 34 deletions _sources/autoapi/ocpmodels/common/model_registry/index.rst

This file was deleted.

39 changes: 39 additions & 0 deletions _sources/autoapi/ocpmodels/models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ Submodules

base/index.rst
dimenet_plus_plus/index.rst
model_registry/index.rst
schnet/index.rst


Package Contents
----------------


Functions
~~~~~~~~~

.. autoapisummary::

ocpmodels.models.model_name_to_local_file



Attributes
~~~~~~~~~~

.. autoapisummary::

ocpmodels.models.available_pretrained_models


.. 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:



49 changes: 49 additions & 0 deletions _sources/autoapi/ocpmodels/models/model_registry/index.rst
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:



22 changes: 21 additions & 1 deletion _sources/core/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
## Installation
# Installation

## pip (fast, easy to get started)

Installing the OCP package and necessary dependencies is now as easy as:

(GPU)
```
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-1.13.1+cu117.html
pip install -i https://test.pypi.org/simple/ ocp-models
```

or if you want the CPU-only install (no cuda/etc):
```
pip install torch==1.13.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu # install CPU torch
pip install pyg_lib torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-1.13.1+cpu.html
pip install -i https://test.pypi.org/simple/ ocp-models
```

## Conda (preferred for model training & development)

- We'll use `conda` to install dependencies and set up the environment.
We recommend using the [Python 3.9 Miniconda installer](https://docs.conda.io/en/latest/miniconda.html#linux-installers).
Expand Down
55 changes: 55 additions & 0 deletions _sources/core/QUICKSTART.md
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()
```
Loading

0 comments on commit 82ff9ea

Please sign in to comment.