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
9 changes: 3 additions & 6 deletions tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,12 @@ def test_pbc_wrap_batched_triclinic() -> None:
)
batch = torch.tensor([0, 1], device=DEVICE)

# Stack the cells for batched processing
cell = torch.stack([cell1, cell2])

# Apply wrapping
wrapped = ft.pbc_wrap_batched(positions, cell=cell, system_idx=batch)

# Calculate expected result for first atom (using original algorithm for verification)
expected1 = ft.pbc_wrap_general(positions[0:1], cell1)
expected2 = ft.pbc_wrap_general(positions[1:2], cell2)
Copy link
Collaborator Author

@curtischong curtischong Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing this test to wrap_positions removes our last dependence on the wrap_positions function in our codebase

# Calculate expected results by wrapping each system independently
expected1 = ft.wrap_positions(positions[0:1], cell1.T)
expected2 = ft.wrap_positions(positions[1:2], cell2.T)

# Verify results match the expected values
assert torch.allclose(wrapped[0:1], expected1, atol=1e-6)
Expand Down
2 changes: 2 additions & 0 deletions torch_sim/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import torch
from torch.types import _dtype
from typing_extensions import deprecated


def get_fractional_coordinates(
Expand Down Expand Up @@ -110,6 +111,7 @@ def inverse_box(box: torch.Tensor) -> torch.Tensor:
raise ValueError(f"Box must be either: a scalar, a vector, or a matrix. Found {box}.")


@deprecated("Use wrap_positions instead")
def pbc_wrap_general(
positions: torch.Tensor, lattice_vectors: torch.Tensor
) -> torch.Tensor:
Expand Down