Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ We kindly request that users of MatterSim version 1.0.0 cite our preprint availa

## Limitations

**MatterSim-v1** is designed specifically for atomistic simulations of bulk materials. Applications or interpretations beyond this scope should be approached with caution. For instance, when using the model for simulations involving surfaces, interfaces, or properties influenced by long-range interactions, the results may be qualitatively accurate but are not suitable for quantitative analysis. In such cases, we recommend fine-tuning the model to better align with the specific application.
**MatterSim-v1** is designed specifically for atomistic simulations of bulk materials. Applications or interpretations beyond this scope should be approached with caution. For instance, when using the model for simulations involving surfaces, interfaces, or properties influenced by long-range interactions, the results may be qualitatively accurate but are not suitable for quantitative analysis. For mixed-periodicity inputs, graph construction wraps coordinates only along periodic cell directions; this does not establish model accuracy for non-bulk systems. In such cases, we recommend fine-tuning the model to better align with the specific application.

## Trademarks

Expand Down
4 changes: 1 addition & 3 deletions src/mattersim/datasets/utils/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ def convert(
else:
raise ValueError("structure type not supported")

scaled_pos = atoms.get_scaled_positions()
scaled_pos = np.mod(scaled_pos, 1)
atoms.set_scaled_positions(scaled_pos)
atoms.wrap()
args = {}
if self.model_type == "m3gnet":
args["num_atoms"] = len(atoms)
Expand Down
45 changes: 45 additions & 0 deletions tests/datasets/utils/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"""

import numpy as np
import pytest
import torch
from ase import Atoms
from torch_geometric.data import Batch

from mattersim.datasets.utils.converter import (
Expand Down Expand Up @@ -83,3 +85,46 @@ def test_pbc_fallback_uses_int64(self, water_molecule):
converter = GraphConverter(model_type="m3gnet")
graph = converter.convert(water_molecule)
assert graph is not None

@pytest.mark.parametrize(
"pbc",
[
[True, True, False],
[True, False, False],
],
ids=["slab_TTF", "wire_TFF"],
)
def test_mixed_pbc_wrapping_preserves_nonperiodic_coordinates(self, pbc):
"""Wrapping must not create bonds across nonperiodic cell boundaries."""
nonperiodic_axis = pbc.index(False)
positions = np.zeros((3, 3), dtype=np.float64)
positions[:, 0] = 12.25
positions[:, nonperiodic_axis] = [1.0, 1.5, 11.2]

atoms = Atoms("Si3", positions=positions, cell=[10.0, 10.0, 10.0], pbc=pbc)
converter = GraphConverter(
model_type="m3gnet", twobody_cutoff=2.0, threebody_cutoff=2.0
)
graph = converter.convert(atoms)

np.testing.assert_allclose(
graph.atom_pos[:, nonperiodic_axis].detach().cpu().numpy(),
[1.0, 1.5, 11.2],
rtol=1e-5,
atol=1e-5,
)

np.testing.assert_allclose(
graph.atom_pos[:, 0].detach().cpu().numpy(),
2.25,
rtol=1e-5,
atol=1e-5,
)

# Exact edge pairs: only (0, 1) and (1, 0) within 2 A cutoff
edge_pairs = set(
zip(graph.edge_index[0].tolist(), graph.edge_index[1].tolist())
)
assert edge_pairs == {(0, 1), (1, 0)}

assert graph.num_three_body == 0