Skip to content

Add LAMMPS testing #78

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

Merged
merged 34 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7e22116
Test box module with LAMMPS.
clpetix Apr 28, 2025
7f3ab64
Test data file module with LAMMPS
mayukhkundu14 May 6, 2025
ac8671b
Minor fix
mayukhkundu14 May 6, 2025
5133811
Modify topology test for the data file
mayukh33 May 9, 2025
987e93b
Minor comment fix
mayukh33 May 9, 2025
cabb042
Apply suggested fixes
mayukh33 May 14, 2025
1f9a779
Ensure tests only run when LAMMPS is found and clean up topology test.
clpetix May 14, 2025
efcc22a
Remove redundant LAMMPS checks on the box.
clpetix May 14, 2025
2ff7749
Add LAMMPS testing to copy_from methods in dump file.
clpetix May 14, 2025
00f4641
Add LAMMPS skip condition to copy_from tests
clpetix May 14, 2025
f6c05fd
Fix triclinic box dimensions in fixtures and tests to ensure all part…
clpetix May 20, 2025
1fdf46b
Test copy from methods using LAMMPS.
clpetix May 20, 2025
e9b8817
Test dump file with all parameters with LAMMPS.
clpetix May 20, 2025
6f319ec
Add LAMMPS skip condition to test_dump_file_all_lammps if LAMMPS is n…
clpetix May 20, 2025
2e87def
Add LAMMPS testing job to GitHub Actions workflow
clpetix May 22, 2025
4174ce9
Fix LAMMPS testing with GitHub runners.
clpetix May 22, 2025
07af0e3
Remove MPI portions and duplicate test from test.yml
clpetix May 27, 2025
02310cd
Use tmp_path in test_data_file.
clpetix May 27, 2025
ecf8cb3
Apply reviewer's suggestions to test_data_file.
clpetix May 27, 2025
2346be9
Combine GitHub tests to one step.
clpetix May 27, 2025
ac59c42
Remove vestigial sorting.
clpetix May 27, 2025
bdc99c9
Fix test_dump to only test dump and streamline test.
clpetix May 27, 2025
a5620fc
Add lammps marker to ensure tests only run once.
clpetix May 27, 2025
d6193b1
Include custom marker.
clpetix May 27, 2025
4a55978
Remove reliance on os to check file exists.
clpetix May 27, 2025
3f85f19
Add dump minimum LAMMPS test.
clpetix May 27, 2025
c38d27e
Make creation of two atoms separate cmds.
clpetix May 27, 2025
38c66fd
Add comment to clarify atom ID assignment in LAMMPS test
clpetix May 27, 2025
19ead46
Fix small typos in tests.
clpetix May 27, 2025
f23181b
Do LAMMPS test with optins by default.
clpetix May 28, 2025
64760a8
Update LAMMPS test implementations.
clpetix May 28, 2025
30f43d1
Fix white space in test_data_file_topology_lammps file.
clpetix May 28, 2025
c6c198f
Put LAMMPS version in test names.
clpetix May 28, 2025
5145555
Apply suggestions from code review
mphoward May 28, 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
43 changes: 41 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,49 @@ jobs:
pip install .
- name: Test
run: |
python -m pytest
python -m pytest -m "not lammps"
- name: Install optional dependencies
run: |
pip install -r tests/requirements-optin.txt
- name: Test (optin)
run: |
python -m pytest
python -m pytest -m "not lammps"
test-lammps:
name: unit test lammps [python-${{ matrix.python-version }}, lammps-${{ matrix.lammps-version }}]
needs: test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
lammps-version: ["2023.08.02", "2024.08.29"]
exclude:
- python-version: "3.12"
lammps-version: "2023.08.02"
- python-version: "3.13"
lammps-version: "2023.08.02"
- python-version: "3.13"
lammps-version: "2024.08.29"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
channel-priority: strict
python-version: ${{ matrix.python-version }}
- name: Install LAMMPS
run: |
conda install "lammps=${{ matrix.lammps-version }}"
- name: Install
run: |
python -m pip install pip --upgrade pip
pip install -r tests/requirements.txt -r tests/requirements-optin.txt
pip install .
- name: Test
run: |
python -m pytest -m lammps
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ target-version = ["py39"]

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
markers = ["lammps"]
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

@pytest.fixture
def orthorhombic():
return lammpsio.Box([-5.0, -10.0, 0.0], [1.0, 10.0, 8.0])
return lammpsio.Box([-5.0, -10.0, -1.0], [2.0, 10.0, 8.0])


@pytest.fixture
def triclinic():
return lammpsio.Box([-5.0, -10.0, 0.0], [1.0, 10.0, 8.0], [1.0, -2.0, 0.5])
return lammpsio.Box([-5.0, -10.0, -1.0], [2.0, 10.0, 8.0], [2, -2.0, 0.5])


@pytest.fixture(params=[lf("orthorhombic"), lf("triclinic")])
Expand Down
10 changes: 5 additions & 5 deletions tests/test_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

def test_orthorhombic(orthorhombic):
box = orthorhombic
assert numpy.allclose(box.low, [-5, -10, 0])
assert numpy.allclose(box.high, [1, 10, 8])
assert numpy.allclose(box.low, [-5, -10, -1])
assert numpy.allclose(box.high, [2, 10, 8])
assert box.tilt is None

box.low = [0, 0, 0]
Expand All @@ -21,9 +21,9 @@ def test_orthorhombic(orthorhombic):

def test_triclinic(triclinic):
box = triclinic
assert numpy.allclose(box.low, [-5, -10, 0])
assert numpy.allclose(box.high, [1, 10, 8])
assert numpy.allclose(box.tilt, [1.0, -2.0, 0.5])
assert numpy.allclose(box.low, [-5, -10, -1])
assert numpy.allclose(box.high, [2, 10, 8])
assert numpy.allclose(box.tilt, [2.0, -2.0, 0.5])

box.low = [0, 0, 0]
assert numpy.allclose(box.low, [0, 0, 0])
Expand Down
Loading