Skip to content

Commit 5b3b610

Browse files
authored
Pin PET-MAD versions and did a bit of maintainance. (#164)
* Remove unnecessary mpl tweak This was a side-effect of a bug in STK brough in through chemiscope (!) * Start fixing the pet-mad-latest issue * Add copy button to the code boxes * Working version of the pet-mad snapshots * Update flashmd * flashmd update * Stray 1.0.1 in nc * Import thumbnail images directly rather than through a convoluted mpimg workaround * Linter * Use a recent pet-mad version for nc
1 parent 3abb81c commit 5b3b610

File tree

22 files changed

+43
-71
lines changed

22 files changed

+43
-71
lines changed

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ sphinx
22
sphinx-sitemap
33
sphinx-design
44
sphinx-gallery
5+
sphinx-copybutton
56
sphinx-toggleprompt
67
docutils
78
furo

docs/src/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
extensions = [
88
"sphinx_sitemap",
99
"sphinx_design",
10+
"sphinx_copybutton",
1011
"sphinx.ext.viewcode",
1112
"sphinx.ext.intersphinx",
1213
"sphinx_gallery.load_style",

examples/flashmd/data/input-al110-base.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</prng>
1111
<ffdirect name='driver' pbc="false">
1212
<pes>metatomic</pes>
13-
<parameters>{template:data/al110.xyz,model:pet-mad-latest.pt,device:cpu} </parameters>
13+
<parameters>{template:data/al110.xyz,model:pet-mad-v1.1.0.pt,device:cpu} </parameters>
1414
</ffdirect>
1515
<system>
1616
<forces>

examples/flashmd/data/input-ala2-base.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</prng>
1111
<ffdirect name='driver' pbc="false">
1212
<pes>metatomic</pes>
13-
<parameters>{template:data/ala2.xyz,model:pet-mad-latest.pt,device:cpu} </parameters>
13+
<parameters>{template:data/ala2.xyz,model:pet-mad-v1.1.0.pt,device:cpu} </parameters>
1414
</ffdirect>
1515
<system>
1616
<forces>

examples/flashmd/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- pip:
88
- ase>=3.23
99
- ipi==3.1.5
10-
- pet-mad>=1.2,<1.3
10+
- pet-mad>=1.3.1,<1.4
1111
- vesin[torch]>=0.3.2,<0.4
1212
- flashmd>=0.1.2
1313
- metatrain

examples/flashmd/flashmd-demo.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
`this preprint <http://arxiv.org/abs/2505.19350>`_.
1414
"""
1515

16+
# sphinx_gallery_thumbnail_path = '../../examples/flashmd/flashmd-scheme.png'
17+
1618
# %%
1719
#
1820
# Start by importing the required libraries. You will need the
@@ -26,8 +28,6 @@
2628
#
2729

2830
import chemiscope
29-
import matplotlib.image as mpimg
30-
import matplotlib.pyplot as plt
3131
from flashmd import get_universal_model
3232
from flashmd.ipi import get_npt_stepper, get_nvt_stepper
3333
from ipi.utils.parsing import read_output, read_trajectory
@@ -40,14 +40,9 @@
4040
# Each model is trained for a specific stride length, aiming to
4141
# reproduce the trajectories obtained with a traditional velocity
4242
# Verlet integrator.
43-
44-
# use matplotlib to display the image so it also display as a thumbnail
45-
fig, ax = plt.subplots(figsize=(5728 / 300, 2598 / 300), dpi=300)
46-
img = mpimg.imread("flashmd-scheme.png")
47-
ax.imshow(img)
48-
ax.axis("off")
49-
fig.tight_layout()
50-
plt.show()
43+
#
44+
# .. image:: flashmd-scheme.png
45+
# :align: center
5146

5247

5348
# %%
@@ -63,8 +58,8 @@
6358
flashmd_model_64 = get_universal_model(64)
6459
flashmd_model_64.to(device)
6560

66-
calculator = PETMADCalculator(version="latest", device=device)
67-
calculator._model.save("pet-mad-latest.pt")
61+
calculator = PETMADCalculator(version="1.1.0", device=device)
62+
calculator._model.save("pet-mad-v1.1.0.pt")
6863

6964

7065
# %%

examples/learn-tensors-with-mcov/learn-tensors-with-mcov.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
and can then be used in an ASE calculator.
1818
"""
1919

20+
# sphinx_gallery_thumbnail_path = '../../examples/learn-tensors-with-mcov/architecture.png' # noqa: E501
21+
2022
# %%
2123

2224
# Core packages
@@ -27,7 +29,6 @@
2729

2830
# Simulation and visualization tools
2931
import chemiscope
30-
import matplotlib.image as mpimg
3132
import matplotlib.pyplot as plt
3233
import metatensor as mts
3334
import numpy as np
@@ -173,16 +174,11 @@
173174
# Here is a schematic representation of the :math:`\lambda`-MCoV model which, in a
174175
# nutshell, allows us to learn a tensorial property of a system from a set of scalar
175176
# features used as linear expansion coefficients of a minimal set of basis tensors.
177+
#
178+
# .. image:: architecture.png
179+
# :align: center
176180

177181

178-
# visualize a scheme of the architecture that is also used as a thumbnail for the recipe
179-
fig, ax = plt.subplots(figsize=(5728 / 300, 2598 / 300), dpi=300)
180-
img = mpimg.imread("architecture.png")
181-
ax.imshow(img)
182-
ax.axis("off")
183-
fig.tight_layout()
184-
plt.show()
185-
186182
# %%
187183
#
188184
# We parametrize spherical tensors of order :math:`\lambda` as linear combinations

examples/metatomic-plumed/metatomic-plumed.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@
5353
import torch
5454

5555

56-
if hasattr(__import__("builtins"), "get_ipython"):
57-
get_ipython().run_line_magic("matplotlib", "inline") # noqa: F821
58-
5956
# %%
6057
#
6158
# Target structures

examples/pet-mad-nc/data/input-nc-nve-mts.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
<ffdirect name='cons' pbc="false">
1818
<pes>metatomic</pes>
19-
<parameters>{template:data/bmimcl.xyz,model:pet-mad-latest.pt,device:cpu,non_conservative:False} </parameters>
19+
<parameters>{template:data/bmimcl.xyz,model:pet-mad-v1.1.0.pt,device:cpu,non_conservative:False} </parameters>
2020
</ffdirect>
2121
<ffdirect name='nocons' pbc="false">
2222
<pes>metatomic</pes>
23-
<parameters>{template:data/bmimcl.xyz,model:pet-mad-latest.pt,device:cpu,non_conservative:True} </parameters>
23+
<parameters>{template:data/bmimcl.xyz,model:pet-mad-v1.1.0.pt,device:cpu,non_conservative:True} </parameters>
2424
</ffdirect>
2525
<system>
2626
<initialize nbeads="1">

examples/pet-mad-nc/data/input-nc-nve.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<prng><seed>12345</seed></prng>
1515
<ffdirect name='nocons' pbc="false">
1616
<pes>metatomic</pes>
17-
<parameters>{template:data/bmimcl.xyz,model:pet-mad-latest.pt,device:cpu,non_conservative:True} </parameters>
17+
<parameters>{template:data/bmimcl.xyz,model:pet-mad-v1.1.0.pt,device:cpu,non_conservative:True} </parameters>
1818
</ffdirect>
1919
<system>
2020
<initialize nbeads="1">

0 commit comments

Comments
 (0)