Skip to content

Commit

Permalink
deploy: b90c171
Browse files Browse the repository at this point in the history
  • Loading branch information
zulissimeta committed Apr 14, 2024
1 parent c0a818b commit 9f4910e
Show file tree
Hide file tree
Showing 178 changed files with 1,756 additions and 1,979 deletions.
16 changes: 8 additions & 8 deletions _downloads/5fdddbed2260616231dbf7b0d94bb665/train.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
2024-04-14 01:18:42 (INFO): Project root: /home/runner/work/ocp/ocp
2024-04-14 13:46:21 (INFO): Project root: /home/runner/work/ocp/ocp
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/cuda/amp/grad_scaler.py:126: UserWarning: torch.cuda.amp.GradScaler is enabled, but CUDA is not available. Disabling.
warnings.warn(
2024-04-14 01:18:44 (WARNING): Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
2024-04-14 01:18:44 (INFO): amp: true
2024-04-14 13:46:23 (WARNING): Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
2024-04-14 13:46:23 (INFO): amp: true
cmd:
checkpoint_dir: fine-tuning/checkpoints/2024-04-14-01-18-56-ft-oxides
commit: 42bd551
checkpoint_dir: fine-tuning/checkpoints/2024-04-14-13-45-36-ft-oxides
commit: b90c171
identifier: ft-oxides
logs_dir: fine-tuning/logs/wandb/2024-04-14-01-18-56-ft-oxides
logs_dir: fine-tuning/logs/wandb/2024-04-14-13-45-36-ft-oxides
print_every: 10
results_dir: fine-tuning/results/2024-04-14-01-18-56-ft-oxides
results_dir: fine-tuning/results/2024-04-14-13-45-36-ft-oxides
seed: 0
timestamp_id: 2024-04-14-01-18-56-ft-oxides
timestamp_id: 2024-04-14-13-45-36-ft-oxides
dataset:
a2g_args:
r_energy: true
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions _sources/core/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ with ase.db.connect('full_data.db') as full_db:

You have to choose a checkpoint to start with. The newer checkpoints may require too much memory for this environment.

```{code-cell} ipython3
import torch
torch.set_num_threads(4)
```

```{code-cell} ipython3
from ocpmodels.models.model_registry import available_pretrained_models
print(available_pretrained_models)
Expand Down
8 changes: 0 additions & 8 deletions _sources/tutorials/NRR/NRR_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Using OCP to enumerate adsorbates on alloy catalyst surfaces

In the previous example, we constructed slab models of adsorbates on desired sites. Here we leverage code to automate this process. The goal in this section is to generate candidate structures, compute energetics, and then filter out the most relevant ones.

```{code-cell} ipython3
import torch
torch.set_num_threads(4)
```

```{code-cell} ipython3
from ocpmodels.common.relaxation.ase_utils import OCPCalculator
Expand Down Expand Up @@ -433,7 +429,3 @@ ax2.set_ylabel("dE *H literature [eV]")
f.set_figwidth(15)
f.set_figheight(7)
```

# Next steps

Next we consider [fine-tuning](../fine-tuning/fine-tuning-oxides).
63 changes: 36 additions & 27 deletions _sources/tutorials/advanced/embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ import os
checkpoint_path = model_name_to_local_file('GemNet-OCOC20+OC22', local_cache='/tmp/ocp_checkpoints/')
calc = OCPCalculator(checkpoint_path=checkpoint_path)
calc.trainer._unwrapped_model.return_embedding = True
```

## Bulk Cu equation of state example

Here we simply compute an equation of state by varying the lattice constant. You will see a small unphysical feature near 3.7 angstroms. We will investigate why that happens.

```{code-cell} ipython3
#calc.trainer._unwrapped_model.return_embedding = False
a0 = 3.63
E = []
Expand All @@ -78,7 +79,7 @@ plt.xlabel('Lattice constant (A)')
plt.ylabel('Energy (eV)');
```

Something is a little off in this equation of state, there is an unphysical bump in it. We now rerun this and get the embeddings. You simply call the `calc.embed` method. We need a reference configuration to compare too. We choose a lattice constant of 3.63 angstroms and compute three different embeddings.
Something is a little off in this equation of state, there is an unphysical bump in it. We now rerun this and get the embeddings. You simply set `calc.trainer._unwrapped_model.return_embedding = True` and the calculator will return useful embeddings if possible (e.g. for GemNet-OC). We need a reference configuration to compare too. We choose a lattice constant of 3.63 angstroms and compute three different embeddings.

```{code-cell} ipython3
a0 = 3.63
Expand All @@ -91,9 +92,9 @@ atoms = atoms.repeat((2, 2, 2))
atoms.set_tags(np.ones(len(atoms)))
atoms.calc = calc
out = calc.embed(atoms)
atoms.get_potential_energy()
x1, x2, x3 = out['h sum'], out['x_E sum'], out['x_F sum']
x1, x2, x3 = atoms.calc.results['h sum'], atoms.calc.results['x_E sum'], atoms.calc.results['x_F sum']
```

Next, we loop over a grid of lattice constants, and we compare the cosine similarity of the embeddings for each one to the reference embeddings above. A similarity of 1 means they are the same, and as the similarity decreases it means the embbedings are more and more different (and so is the energy).
Expand All @@ -111,12 +112,12 @@ for a in LC:
pbc=True)
atoms = atoms.repeat((2, 2, 2))
atoms.set_tags(np.ones(len(atoms)))
atoms.get_potential_energy()
out = calc.embed(atoms)
cossim1.append(torch.cosine_similarity(x1, out["h sum"]).item())
cossim2.append(torch.cosine_similarity(x2, out["x_E sum"]).item())
cossim3.append(torch.cosine_similarity(x3, out["x_F sum"]).item())
cossim1.append(torch.cosine_similarity(x1, atoms.calc.results["h sum"]).item())
cossim2.append(torch.cosine_similarity(x2, atoms.calc.results["x_E sum"]).item())
cossim3.append(torch.cosine_similarity(x3, atoms.calc.results["x_F sum"]).item())
E += [out['energy']]
```

Expand Down Expand Up @@ -152,28 +153,29 @@ We use this example to show that we can cluster structures by embedding similari
from ase.build import bulk
from ase.cluster import Octahedron
calc.trainer._unwrapped_model.return_embedding = True
embeddings = []
labels = []
oct = Octahedron('Cu', 2)
oct.set_tags(np.ones(len(oct)))
oct.calc = calc
for i in range(20):
oct.rattle(0.01)
embeddings += [calc.embed(oct)['x_E sum'][0].numpy()]
oct.get_potential_energy()
embeddings += [oct.calc.results['x_E sum'][0].numpy()]
labels += [0]
```

```{code-cell} ipython3
b = bulk('Cu')
b = b.repeat((2, 2, 2))
b.set_tags(np.ones(len(b)))
b.calc = calc
for i in range(40):
b.rattle(0.01)
embeddings += [calc.embed(b)['x_E sum'][0].numpy()]
embeddings += [b.calc.results['x_E sum'][0].numpy()]
labels += [1]
```

Expand Down Expand Up @@ -211,26 +213,28 @@ energies = []
oct = Octahedron('Cu', 2)
oct.set_tags(np.ones(len(oct)))
oct.calc = calc
for i in range(20):
oct.rattle(0.01)
out = calc.embed(oct)
for a in out['h'][0]:
oct.get_potential_energy()
for a in oct.calc.results['h'][0]:
embeddings += [a.numpy()]
labels += [0]
energies += [out['energy']]
energies += [oct.calc.results['energy']]
b = bulk('Cu')
b = b.repeat((2, 2, 2))
b.set_tags(np.ones(len(b)))
for i in range(20):
b.rattle(0.01)
out = calc.embed(b)
for a in out['h'][0]:
b.get_potential_energy()
for a in b.calc.results['h'][0]:
embeddings += [a.numpy()]
labels += [1]
energies += [out['energy']]
energies += [b.calc.results['energy']]
embeddings = np.array(embeddings)
Expand Down Expand Up @@ -266,30 +270,35 @@ data = vdict(space='cosine')
ethanol = molecule('CH3CH2OH')
ethanol.set_tags(np.ones(len(ethanol)))
ethanol_emb = calc.embed(ethanol)
ethanol.calc = calc
ethanol.get_potential_energy()
for i, atom in enumerate(ethanol):
data[ethanol.calc.results['x_E'][0][i].numpy()] = [i, ethanol]
methane = molecule('C2H6')
methane.set_tags(np.ones(len(methane)))
methane_emb = calc.embed(methane)
methane.calc = calc
methane.get_potential_energy()
for i, atom in enumerate(ethanol):
data[ethanol_emb['x_E'][0][i].numpy()] = [i, ethanol]
for i, atom in enumerate(methane):
data[methane_emb['x_E'][0][i].numpy()] = [i, methane]
data[methane.calc.results['x_E'][0][i].numpy()] = [i, methane]
```

Now we construct our "query". We inspect the Atoms object, see that the C atom is the first one, and then extract the embedding for that atom and save it in a variable.

```{code-cell} ipython3
methanol = molecule('CH3OH')
methanol.set_tags(np.ones(len(methanol)))
methanol_emb = calc.embed(methanol)
methanol.calc = calc
methanol.get_potential_energy()
methanol
```

```{code-cell} ipython3
query = methanol_emb['x_E'][0][0].numpy()
query = methanol.calc.results['x_E'][0][0].numpy()
```

We run our search with the syntax like a dictionary. It returns the closest found match.
Expand Down
1 change: 0 additions & 1 deletion autoapi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/data_parallel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/distutils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/flags/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/gp_utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/hpo_utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/logger/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/registry/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/relaxation/ase_utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/relaxation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/relaxation/optimizers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/transforms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/tutorial_utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/typing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/common/utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/datasets/_utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
1 change: 0 additions & 1 deletion autoapi/ocpmodels/datasets/ase_datasets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@




</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../../../../tutorials/advanced/advanced_toc.html">Advanced OCP usage</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
Loading

0 comments on commit 9f4910e

Please sign in to comment.