Skip to content

Commit

Permalink
simplify calc usage (#694)
Browse files Browse the repository at this point in the history
* simplify calc usage

* Add quick start

* trying to restore model_checkpoints.md

* update precommit version

* precommit

* add error when using both model_name and checkpoint_path

---------

Co-authored-by: Misko <misko@meta.com>
  • Loading branch information
mshuaibii and misko authored May 15, 2024
1 parent 2715160 commit d0f61fa
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.4.4
hooks:
- id: ruff
args: [ --fix ]
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ pip install -e packages/fairchem-{fairchem-package-name}
`fairchem.core` requires you to first create your environment
- [Installation Guide](https://fair-chem.github.io/core/install.html)

### Quick Start
Pretrained models can be used directly with ASE through our `OCPCalculator` interface:

```python
from ase.build import fcc100, add_adsorbate, molecule
from ase.optimize import LBFGS
from fairchem.core import OCPCalculator

# Set up your system as an ASE atoms object
slab = fcc100('Cu', (3, 3, 3), vacuum=8)
adsorbate = molecule("CO")
add_adsorbate(slab, adsorbate, 2.0, 'bridge')

calc = OCPCalculator(
model_name="EquiformerV2-31M-S2EF-OC20-All+MD",
local_cache="pretrained_models",
cpu=False,
)
slab.calc = calc

# Set up LBFGS dynamics object
dyn = LBFGS(slab)
dyn.run(0.05, 100)
```

If you are interested in training your own models or fine-tuning on your datasets, visit the [documentation](https://fair-chem.github.io/) for more details and examples.

### Why a single repository?
Since many of our repositories rely heavily on our other repositories, a single repository makes it really easy to test and ensure consistency across repositories. This should also help simplify the installation process for users who are interested in integrating many of the efforts into one place.

Expand Down
Loading

0 comments on commit d0f61fa

Please sign in to comment.