Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 7 additions & 8 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
markdown-link-check:
link-check:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Run markdown link check
uses: gaurav-nelson/github-action-markdown-link-check@v1
- name: Discover broken links
uses: lycheeverse/lychee-action@v2
with:
config-file: .github/workflows/link-check-config.json
# ignore ipynb links since they're generated on the fly
args: --exclude-path dist --exclude '\.ipynb$' --accept 100..=103,200..=299,403,429,500 -- ./**/*.{md,py,yml,json}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ repos:
hooks:
- id: ruff
args: [--fix]
types_or: [python, jupyter]
- id: ruff-format
types_or: [python, jupyter]
exclude: \.pyx$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-symlinks
- id: check-yaml
exclude: .*\/copilot\/.*
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: forbid-new-submodules
Expand All @@ -34,7 +30,6 @@ repos:
hooks:
- id: codespell
stages: [pre-commit, commit-msg]
args: [--ignore-words-list, "statics,atomate,nd,te,titel,coo,slite,fro"]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.44.0
Expand Down
10 changes: 5 additions & 5 deletions examples/scripts/7_Others/7.3_Batched_neighbor_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from ase.build import bulk

import torch_sim as ts
from torch_sim import transforms
from torch_sim.neighbors import torch_nl_linked_cell, torch_nl_n2
from torch_sim.transforms import compute_cell_shifts, compute_distances_with_cell_shifts


atoms_list = [bulk("Si", "diamond", a=5.43), bulk("Ge", "diamond", a=5.65)]
Expand All @@ -28,8 +28,8 @@
mapping, mapping_batch, shifts_idx = torch_nl_linked_cell(
cutoff, pos, cell, pbc_tensor, batch, self_interaction
)
cell_shifts = compute_cell_shifts(cell, shifts_idx, mapping_batch)
dds = compute_distances_with_cell_shifts(pos, mapping, cell_shifts)
cell_shifts = transforms.compute_cell_shifts(cell, shifts_idx, mapping_batch)
dds = transforms.compute_distances_with_cell_shifts(pos, mapping, cell_shifts)

print(mapping.shape)
print(mapping_batch.shape)
Expand All @@ -40,8 +40,8 @@
mapping_n2, mapping_batch_n2, shifts_idx_n2 = torch_nl_n2(
cutoff, pos, cell, pbc_tensor, batch, self_interaction
)
cell_shifts_n2 = compute_cell_shifts(cell, shifts_idx_n2, mapping_batch_n2)
dds_n2 = compute_distances_with_cell_shifts(pos, mapping_n2, cell_shifts_n2)
cell_shifts_n2 = transforms.compute_cell_shifts(cell, shifts_idx_n2, mapping_batch_n2)
dds_n2 = transforms.compute_distances_with_cell_shifts(pos, mapping_n2, cell_shifts_n2)

print(mapping_n2.shape)
print(mapping_batch_n2.shape)
Expand Down
6 changes: 4 additions & 2 deletions examples/scripts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ This folder contains a series of examples demonstrating the use of TorchSim, a l

1. **Batched MACE Gradient Descent** - [`examples/2_Structural_optimization/2.6_Batched_MACE_Gradient_Descent.py`](2_Structural_optimization/2.6_Batched_MACE_Gradient_Descent.py): Optimize multiple structures simultaneously using batched gradient descent with the MACE model.

1. **Batched MACE UnitCellFilter Gradient Descent** - [`examples/2_Structural_optimization/2.7_Batched_MACE_UnitCellFilter_Gradient_Descent.py`](2_Structural_optimization/2.7_Batched_MACE_UnitCellFilter_Gradient_Descent.py): Optimize multiple structures and their unit cells using batched gradient descent with MACE.
1. **Batched MACE FIRE** - [`examples/2_Structural_optimization/2.7_Batched_MACE_FIRE.py`](2_Structural_optimization/2.7_Batched_MACE_FIRE.py): Optimize multiple structures simultaneously using the batched FIRE optimizer with MACE.

1. **Batched MACE UnitCellFilter FIRE** - [`examples/2_Structural_optimization/2.8_Batched_MACE_UnitCellFilter_FIRE.py`](2_Structural_optimization/2.8_Batched_MACE_UnitCellFilter_FIRE.py): Optimize multiple structures and their unit cells using the batched FIRE optimizer with MACE.
1. **Batched MACE UnitCellFilter Gradient Descent** - [`examples/2_Structural_optimization/2.8_Batched_MACE_UnitCellFilter_Gradient_Descent.py`](2_Structural_optimization/2.8_Batched_MACE_UnitCellFilter_Gradient_Descent.py): Optimize multiple structures and their unit cells using batched gradient descent with MACE.

1. **Batched MACE UnitCellFilter FIRE** - [`examples/2_Structural_optimization/2.9_Batched_MACE_UnitCellFilter_FIRE.py`](2_Structural_optimization/2.9_Batched_MACE_UnitCellFilter_FIRE.py): Optimize multiple structures and their unit cells using the batched FIRE optimizer with MACE.

1. **Dynamics**

Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/using_graphpes_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Integrating TorchSim with `graph-pes`

This brief tutorial demonstrates how to use models trained with the
[graph-pes](https://github.com/mir-group/graph-pes) package to drive
[graph-pes](https://github.com/jla-gardner/graph-pes) package to drive
MD simulations and geometry optimizations in TorchSim.

## Step 1: loading a model
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_fairchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def ocp_calculator(model_path_oc20: str) -> OCPCalculator:


# Skip this test due to issues with how the older models
# handled supercells (see related issue here: https://github.com/FAIR-Chem/fairchem/issues/428)
# handled supercells (see related issue here: https://github.com/facebookresearch/fairchem/issues/428)

test_fairchem_ocp_model_outputs = pytest.mark.skipif(
os.environ.get("HF_TOKEN") is None,
Expand Down
23 changes: 15 additions & 8 deletions tests/test_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from ase.build import bulk, molecule
from ase.neighborlist import neighbor_list

from torch_sim import neighbors
from torch_sim.transforms import compute_cell_shifts, compute_distances_with_cell_shifts
from torch_sim import neighbors, transforms


@pytest.fixture
Expand Down Expand Up @@ -207,7 +206,9 @@ def test_primitive_neighbor_list(

# Calculate distances with cell shifts
cell_shifts_prim = torch.mm(shifts_tensor, row_vector_cell)
dds_prim = compute_distances_with_cell_shifts(pos, mapping, cell_shifts_prim)
dds_prim = transforms.compute_distances_with_cell_shifts(
pos, mapping, cell_shifts_prim
)
dds_prim = np.sort(dds_prim.numpy())

# Get the neighbor list from ase
Expand All @@ -229,7 +230,9 @@ def test_primitive_neighbor_list(

# Calculate distances with cell shifts
cell_shifts_ref = torch.mm(shifts_ref, row_vector_cell)
dds_ref = compute_distances_with_cell_shifts(pos, mapping_ref, cell_shifts_ref)
dds_ref = transforms.compute_distances_with_cell_shifts(
pos, mapping_ref, cell_shifts_ref
)

# Sort the distances
dds_ref = np.sort(dds_ref.numpy())
Expand Down Expand Up @@ -280,7 +283,7 @@ def test_neighbor_list_implementations(

# Calculate distances with cell shifts
cell_shifts = torch.mm(shifts, row_vector_cell)
dds = compute_distances_with_cell_shifts(pos, mapping, cell_shifts)
dds = transforms.compute_distances_with_cell_shifts(pos, mapping, cell_shifts)
dds = np.sort(dds.numpy())

# Get the reference neighbor list from ASE
Expand All @@ -300,7 +303,9 @@ def test_neighbor_list_implementations(
shifts_ref, dtype=torch.float64, device=torch.device("cpu")
)
cell_shifts_ref = torch.mm(shifts_ref, row_vector_cell)
dds_ref = compute_distances_with_cell_shifts(pos, mapping_ref, cell_shifts_ref)
dds_ref = transforms.compute_distances_with_cell_shifts(
pos, mapping_ref, cell_shifts_ref
)
dds_ref = np.sort(dds_ref.numpy())
dist_ref = np.sort(dist)

Expand Down Expand Up @@ -342,8 +347,10 @@ def test_torch_nl_implementations(
)

# Calculate distances
cell_shifts = compute_cell_shifts(row_vector_cell, shifts_idx, mapping_batch)
dds = compute_distances_with_cell_shifts(pos, mapping, cell_shifts)
cell_shifts = transforms.compute_cell_shifts(
row_vector_cell, shifts_idx, mapping_batch
)
dds = transforms.compute_distances_with_cell_shifts(pos, mapping, cell_shifts)
dds = np.sort(dds.numpy())

# Get reference results from ASE
Expand Down
Loading