Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ".extxyz" file suffix #84

Merged
merged 1 commit into from
Feb 19, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .ase import read_structures_ase

STRUCTURE_READERS = {".xyz": read_structures_ase}
STRUCTURE_READERS = {".extxyz": read_structures_ase, ".xyz": read_structures_ase}
""":py:class:`dict`: dictionary mapping file suffixes to a structure reader"""
8 changes: 4 additions & 4 deletions src/metatensor/models/utils/data/readers/targets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from .ase import read_energy_ase, read_forces_ase, read_stress_ase, read_virial_ase

ENERGY_READERS = {".xyz": read_energy_ase}
ENERGY_READERS = {".extxyz": read_energy_ase, ".xyz": read_energy_ase}
""":py:class:`dict`: dictionary mapping file suffixes to a target energy reader"""

FORCES_READERS = {".xyz": read_forces_ase}
FORCES_READERS = {".extxyz": read_forces_ase, ".xyz": read_forces_ase}
""":py:class:`dict`: dictionary mapping file suffixes to a target forces reader"""

STRESS_READERS = {".xyz": read_stress_ase}
STRESS_READERS = {".extxyz": read_stress_ase, ".xyz": read_stress_ase}
""":py:class:`dict`: dictionary mapping file suffixes to a target stress reader"""

VIRIAL_READERS = {".xyz": read_virial_ase}
VIRIAL_READERS = {".extxyz": read_virial_ase, ".xyz": read_virial_ase}
""":py:class:`dict`: dictionary mapping file suffixes to a target virial reader"""
8 changes: 4 additions & 4 deletions tests/utils/data/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


@pytest.mark.parametrize("fileformat", (None, ".xyz"))
@pytest.mark.parametrize("fileformat", (None, ".xyz", ".extxyz"))
def test_read_structures(fileformat, monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)

Expand Down Expand Up @@ -49,7 +49,7 @@ def test_read_structures_unknown_fileformat():
read_structures("foo.bar")


@pytest.mark.parametrize("fileformat", (None, ".xyz"))
@pytest.mark.parametrize("fileformat", (None, ".xyz", ".extxyz"))
def test_read_energies(fileformat, monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)

Expand All @@ -70,7 +70,7 @@ def test_read_energies(fileformat, monkeypatch, tmp_path):
assert result.properties == Labels.single()


@pytest.mark.parametrize("fileformat", (None, ".xyz"))
@pytest.mark.parametrize("fileformat", (None, ".xyz", ".extxyz"))
def test_read_forces(fileformat, monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)

Expand All @@ -94,7 +94,7 @@ def test_read_forces(fileformat, monkeypatch, tmp_path):


@pytest.mark.parametrize("reader", [read_stress, read_virial])
@pytest.mark.parametrize("fileformat", (None, ".xyz"))
@pytest.mark.parametrize("fileformat", (None, ".xyz", ".extxyz"))
def test_read_stress_virial(reader, fileformat, monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)

Expand Down
Loading