Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ac4a85
fea: add mattersim, revert sevennet to use reference neighbor list, f…
CompRhys Apr 5, 2025
7288111
fix: cell convention in mace and fairchem. revert fe unit cell to avo…
CompRhys Apr 5, 2025
51b9b4b
fea: create a test factory
CompRhys Apr 5, 2025
7fa161a
wip: parameterize the elastic tests
CompRhys Apr 5, 2025
62a3305
fix: address #113
CompRhys Apr 5, 2025
02bdc07
tests: move more atoms to conftest. rename supercells, default in unb…
CompRhys Apr 5, 2025
7dd7b3a
fea: mace no longer needs to touch default dtype, doc: describe the c…
CompRhys Apr 5, 2025
ab4ab6e
fix: casting Z to tkwargs breaks mace models with agnesi transforms
CompRhys Apr 5, 2025
072d726
fea: more consolidation of mace tests
CompRhys Apr 5, 2025
6a4bb11
fea: add a row vector cell property and setter to reduce number of tr…
CompRhys Apr 5, 2025
e05dfb8
fix: fix the elastic tests using row_vector_cell math, updates the fr…
CompRhys Apr 6, 2025
af04abb
tests: add tests for additions to state and mixin.
CompRhys Apr 6, 2025
320677d
test: round trip all the formats
CompRhys Apr 6, 2025
d09453a
fea: allow fairchem pbc
CompRhys Apr 6, 2025
cabe28e
fix: add device when creating tensors for sevennet data dict
abhijeetgangan Apr 6, 2025
393700f
reorganize fixtures to reduce redundancy and dependencies on unbatche…
orionarcher Apr 7, 2025
e859298
rewrite tests to use new fixtures
orionarcher Apr 7, 2025
04b835a
change back to cpu tests
orionarcher Apr 7, 2025
fa98362
lint
orionarcher Apr 7, 2025
82e730d
fix validate model fix
orionarcher Apr 7, 2025
869d962
fea: revert sevennet to vesin
CompRhys Apr 7, 2025
e0825c4
fea: add a rattled structure to test forces
CompRhys Apr 7, 2025
d8e9f96
tests: move test_elastic to batched code despite single states to bet…
CompRhys Apr 8, 2025
3009a3f
fea: fix row/column convention for classical potenials
CompRhys Apr 8, 2025
b1b8293
tests: parameterize again
CompRhys Apr 8, 2025
1a188d0
fea: make the rattled structure fixed
CompRhys Apr 8, 2025
d2301a7
fea: change rattled seed and make sure everything is in eval mode
CompRhys Apr 8, 2025
a5ae3b8
Merge branch 'fix-classical-row-column' into mattersim
CompRhys Apr 8, 2025
58e4d67
test: increase rtol for mace on rattled structure
CompRhys Apr 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ jobs:
- { python: "3.11", resolution: highest }
- { python: "3.12", resolution: lowest-direct }
model:
- { name: fairchem, test_path: "tests/models/test_fairchem.py" }
- { name: mace, test_path: "tests/models/test_mace.py" }
- { name: mace, test_path: "tests/test_elastic.py" }
- { name: mattersim, test_path: "tests/models/test_mattersim.py" }
- { name: orb, test_path: "tests/models/test_orb.py" }
- { name: sevenn, test_path: "tests/models/test_sevennet.py" }
- { name: fairchem, test_path: "tests/models/test_fairchem.py" }
runs-on: ${{ matrix.os }}

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ docs/reference/torch_sim.*

# ignore trajectory files
*.h5
*.h5md
*.hdf5
*.traj

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import torch
import torch_sim as ts

# run natively on gpus
device = torch.device("cuda")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# easily load the model from mace-mp
from mace.calculators.foundations_models import mace_mp
Expand All @@ -48,7 +48,7 @@ mace_model = MaceModel(model=mace, device=device)
from ase.build import bulk
cu_atoms = bulk("Cu", "fcc", a=3.58, cubic=True).repeat((2, 2, 2))
many_cu_atoms = [cu_atoms] * 50
trajectory_files = [f"Cu_traj_{i}" for i in range(len(many_cu_atoms))]
trajectory_files = [f"Cu_traj_{i}.h5md" for i in range(len(many_cu_atoms))]

# run them all simultaneously with batching
final_state = ts.integrate(
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"html_image",
]

autodoc_mock_imports = ["mace", "fairchem", "orb", "sevennet"]
autodoc_mock_imports = ["fairchem", "mace", "mattersim", "orb", "sevennet"]

# use type hints
autodoc_typehints = "description"
Expand Down
1 change: 0 additions & 1 deletion examples/scripts/1_Introduction/1.2_MACE.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
1 change: 0 additions & 1 deletion examples/scripts/1_Introduction/1.3_Batched_MACE.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
# Or load from compiled model
# model=compiled_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/2_Structural_optimization/2.3_MACE_FIRE.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
from torch_sim.unbatched.unbatched_optimizers import fire
Expand Down Expand Up @@ -54,7 +53,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from mace.calculators.foundations_models import mace_mp

from torch_sim.io import atoms_to_state
from torch_sim.neighbors import vesin_nl_ts
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
from torch_sim.unbatched.unbatched_optimizers import unit_cell_fire
from torch_sim.units import UnitConversion
Expand Down Expand Up @@ -52,7 +51,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from mace.calculators.foundations_models import mace_mp

from torch_sim.io import atoms_to_state
from torch_sim.neighbors import vesin_nl_ts
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
from torch_sim.unbatched.unbatched_optimizers import frechet_cell_fire
from torch_sim.units import UnitConversion
Expand Down Expand Up @@ -52,7 +51,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from torch_sim.io import atoms_to_state
from torch_sim.models.mace import MaceModel
from torch_sim.neighbors import vesin_nl_ts
from torch_sim.optimizers import gradient_descent


Expand Down Expand Up @@ -56,7 +55,6 @@
batched_model = MaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
model = ts.models.MaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
model = ts.models.MaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
model = ts.models.MaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.12_MACE_NPT_Langevin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kinetic_energy, calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -58,7 +57,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.13_MACE_NVE_non_pbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from mace.calculators.foundations_models import mace_off

from torch_sim.io import atoms_to_state
from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kinetic_energy
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
from torch_sim.unbatched.unbatched_integrators import nve
Expand Down Expand Up @@ -47,7 +46,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.2_MACE_NVE.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kinetic_energy
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -54,7 +53,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.3_MACE_NVE_cueq.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kinetic_energy
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -54,7 +53,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.4_MACE_NVT_Langevin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -53,7 +52,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.5_MACE_NVT_Nose_Hoover.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -56,7 +55,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from mace.calculators.foundations_models import mace_mp
from plotly.subplots import make_subplots

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -137,7 +136,6 @@ def get_kT(
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.8_MACE_NPT_Nose_Hoover.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kinetic_energy, calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -59,7 +58,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/3_Dynamics/3.9_MACE_NVT_staggered_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ase.build import bulk
from mace.calculators.foundations_models import mace_mp

from torch_sim.neighbors import vesin_nl_ts
from torch_sim.quantities import calc_kT
from torch_sim.state import SimState
from torch_sim.unbatched.models.mace import UnbatchedMaceModel
Expand Down Expand Up @@ -56,7 +55,6 @@
model = UnbatchedMaceModel(
model=loaded_model,
device=device,
neighbor_list_fn=vesin_nl_ts,
compute_forces=True,
compute_stress=False,
dtype=dtype,
Expand Down
1 change: 0 additions & 1 deletion examples/scripts/5_Workflow/5.1_a2c_silicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
model = UnbatchedMaceModel(
model=raw_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=False, # We don't need stress for MD
dtype=dtype,
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/5_Workflow/5.2_a2c_silicon_batched.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
model = UnbatchedMaceModel(
model=raw_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=False, # We don't need stress for MD
dtype=dtype,
Expand Down Expand Up @@ -205,7 +204,6 @@ def step_fn(
model = ts.models.MaceModel(
model=raw_model,
device=device,
neighbor_list_fn=ts.neighbors.vesin_nl_ts,
compute_forces=True,
compute_stress=True,
dtype=dtype,
Expand Down
Loading