Skip to content

Add integration test#354

Merged
jan-janssen merged 13 commits into
mainfrom
integration
Jun 3, 2026
Merged

Add integration test#354
jan-janssen merged 13 commits into
mainfrom
integration

Conversation

@jan-janssen
Copy link
Copy Markdown
Member

@jan-janssen jan-janssen commented Jun 3, 2026

Summary by CodeRabbit

  • Tests

    • Added integration tests for LAMMPS compatibility validation across MPICH and OpenMPI implementations, including force field calculations verification.
  • Chores

    • Expanded CI pipeline with dedicated integration test environments for OpenMPI and MPICH, enabling comprehensive multi-MPI compatibility testing across configurations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 59 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 47a13c88-364d-4a3a-8a33-15bf8ca68d91

📥 Commits

Reviewing files that changed from the base of the PR and between 0f8e650 and b489a54.

📒 Files selected for processing (4)
  • .ci_support/environment-integration-mpich.yml
  • .ci_support/environment-integration-openmpi.yml
  • .github/workflows/pipeline.yml
  • tests/test_compatibility_integration.py
📝 Walkthrough

Walkthrough

This PR establishes a multi-MPI integration testing framework for LAMMPS compatibility. It introduces environment-specific conda configurations for MPICH and OpenMPI, wires them into parallel GitHub Actions jobs that build environments and run tests, and adds an integration test that validates force calculations on fixed-atom structures.

Changes

LAMMPS Integration Testing Infrastructure

Layer / File(s) Summary
MPI Environment Configurations
.ci_support/environment-integration-mpich.yml, .ci_support/environment-integration-openmpi.yml
Two new conda environment files define conda-forge as the channel and pin LAMMPS builds to specific MPI variants: MPICH matches *_mpi_mpich_* and OpenMPI pins 2024.08.29=*_mpi_openmpi_*.
CI Workflow Jobs
.github/workflows/pipeline.yml
Two new jobs (integration_openmpi and integration_mpich) merge the base environment with MPI-specific configs, set up Mambaforge with Python 3.13, install the project, and run the integration test suite. Both jobs depend on the black job and use conda-forge as the sole channel.
Integration Test Implementation
tests/test_compatibility_integration.py
New test module conditionally imports and runs LAMMPS compatibility checks. Constructs an ASE aluminum bulk structure, fixes alternating atoms using FixAtoms, invokes lammps_file_interface_function, and asserts zero net force in x and z components by validating force column sums. Skips gracefully if LAMMPS is unavailable.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 New CI jobs hop into place,
Testing LAMMPS across the MPI space,
With OpenMPI and MPICH in stride,
Forces balanced, atoms fixed with pride!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add integration test' directly and accurately summarizes the main change: introducing new integration test files and CI workflows to test LAMMPS compatibility with different MPI implementations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (ce89a30) to head (b489a54).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #354   +/-   ##
=======================================
  Coverage   89.61%   89.61%           
=======================================
  Files          13       13           
  Lines        1204     1204           
=======================================
  Hits         1079     1079           
  Misses        125      125           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
.github/workflows/pipeline.yml (2)

213-257: ⚡ Quick win

integration_openmpi and integration_mpich are near-identical; consider a matrix.

The two jobs differ only by the integration env filename. A strategy.matrix over the MPI variant would remove the duplication and keep them in sync.

♻️ Example consolidation
  integration:
    needs: [black]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        mpi: [openmpi, mpich]
    steps:
      - uses: actions/checkout@v4
      - name: Merge integration environment
        run: |
          cp .ci_support/environment.yml environment.yml
          tail --lines=+4 .ci_support/environment-integration-${{ matrix.mpi }}.yml >> environment.yml
      - name: Setup Mambaforge
        uses: conda-incubator/setup-miniconda@v3
        with:
          python-version: "3.13"
          miniforge-version: latest
          channels: conda-forge
          conda-remove-defaults: "true"
          environment-file: environment.yml
      - name: Test
        shell: bash -l {0}
        run: |
          pip install . --no-deps --no-build-isolation
          python -m unittest tests/test_compatibility_integration.py
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pipeline.yml around lines 213 - 257, Replace the
duplicated jobs integration_openmpi and integration_mpich with a single
parameterized job (e.g., integration) that uses a strategy.matrix over an mpi
variable (values: openmpi, mpich); update the Merge Notebook environment step to
reference the matrix value (e.g., tail ...-integration-${{ matrix.mpi }}.yml)
and keep the Checkout, Setup Mambaforge and Test steps unchanged but using the
matrix job name to run both variants. Ensure the new job name (integration)
replaces the two originals and that any job dependencies (needs: [black]) remain
on the consolidated job.

218-218: 💤 Low value

Misleading step name in the integration jobs.

Both new jobs label the env-merge step Merge Notebook environment (copy-pasted from the notebooks job), which is confusing since these build the LAMMPS integration env.

♻️ Suggested rename
-      - name: Merge Notebook environment
+      - name: Merge integration environment

Also applies to: 241-241

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pipeline.yml at line 218, The step label "Merge Notebook
environment" is misleading in the two integration jobs; update the step name
string to reflect the LAMMPS integration (e.g. "Merge LAMMPS integration
environment" or "Merge LAMMPS environment") wherever the literal "Merge Notebook
environment" appears in the pipeline job definitions so the step names
accurately describe the work being done.
tests/test_compatibility_integration.py (1)

31-31: 💤 Low value

Unused unpacked return values.

shell_output and job_crashed are never used (Ruff RUF059). Prefix with underscores.

♻️ Diff
-        shell_output, parsed_output, job_crashed = lammps_file_interface_function(
+        _shell_output, parsed_output, _job_crashed = lammps_file_interface_function(
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_compatibility_integration.py` at line 31, The test unpacks three
values from lammps_file_interface_function but only uses parsed_output; rename
the unused variables to start with underscores to silence Ruff RUF059—change the
call in tests/test_compatibility_integration.py from "shell_output,
parsed_output, job_crashed = lammps_file_interface_function(...)" to use
"_shell_output, parsed_output, _job_crashed =
lammps_file_interface_function(...)" so the function name
lammps_file_interface_function and the used variable parsed_output remain
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pipeline.yml:
- Around line 230-234: The CI currently runs
tests/test_compatibility_integration.py but a `@unittest.skipIf`(skip_lammps_test,
...) can make the whole test silently skip (skip_lammps_test is set when import
lammps fails), so update the "Test" job to fail when the integration test is
skipped: run unittest with verbosity (python -m unittest
tests/test_compatibility_integration.py -v) and add a post-check that the test
run reported zero skipped tests (or replace the skip guard by failing the job
when skip_lammps_test is true); reference the skip_lammps_test symbol and the
tests/test_compatibility_integration.py file when implementing the check so the
workflow explicitly fails the job if the LAMMPS integration test did not
actually execute.

In `@tests/test_compatibility_integration.py`:
- Around line 45-46: The assertions in tests/test_compatibility_integration.py
use exact equality on floating sums
(np.sum(parsed_output["generic"]["forces"][:, 0]) == 0.0 and [:, 2]) which is
fragile; change these to tolerance-based checks using np.isclose or np.allclose
(e.g. assert np.isclose(np.sum(parsed_output["generic"]["forces"][:, 0]), 0.0,
atol=1e-8)) for the x and z columns (or use np.allclose on a slice like
parsed_output["generic"]["forces"][:, [0,2]]), and either add the y-column check
or a clear comment in the test explaining why the y-component is intentionally
omitted given the FixAtoms constraint.
- Around line 7-13: The test import guard is catching an ImportError because it
tries to import lammps_file_interface_function from a non-existent module
(compatibility.lammps); update the import in
tests/test_compatibility_integration.py to import lammps_file_interface_function
from lammpsparser.compatibility.file (i.e., replace "from
lammpsparser.compatibility.lammps import lammps_file_interface_function" with an
import that points to lammpsparser.compatibility.file), or alternatively add a
re-export in the package so compatibility.lammps exposes
lammps_file_interface_function; ensure the try/except only wraps the external
lammps import and not the local import of lammps_file_interface_function so
skip_lammps_test is set only when the external lammps package is missing.

---

Nitpick comments:
In @.github/workflows/pipeline.yml:
- Around line 213-257: Replace the duplicated jobs integration_openmpi and
integration_mpich with a single parameterized job (e.g., integration) that uses
a strategy.matrix over an mpi variable (values: openmpi, mpich); update the
Merge Notebook environment step to reference the matrix value (e.g., tail
...-integration-${{ matrix.mpi }}.yml) and keep the Checkout, Setup Mambaforge
and Test steps unchanged but using the matrix job name to run both variants.
Ensure the new job name (integration) replaces the two originals and that any
job dependencies (needs: [black]) remain on the consolidated job.
- Line 218: The step label "Merge Notebook environment" is misleading in the two
integration jobs; update the step name string to reflect the LAMMPS integration
(e.g. "Merge LAMMPS integration environment" or "Merge LAMMPS environment")
wherever the literal "Merge Notebook environment" appears in the pipeline job
definitions so the step names accurately describe the work being done.

In `@tests/test_compatibility_integration.py`:
- Line 31: The test unpacks three values from lammps_file_interface_function but
only uses parsed_output; rename the unused variables to start with underscores
to silence Ruff RUF059—change the call in
tests/test_compatibility_integration.py from "shell_output, parsed_output,
job_crashed = lammps_file_interface_function(...)" to use "_shell_output,
parsed_output, _job_crashed = lammps_file_interface_function(...)" so the
function name lammps_file_interface_function and the used variable parsed_output
remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f51feee-4d1b-466c-ad3b-3a10e3e7516f

📥 Commits

Reviewing files that changed from the base of the PR and between ce89a30 and 0f8e650.

📒 Files selected for processing (4)
  • .ci_support/environment-integration-mpich.yml
  • .ci_support/environment-integration-openmpi.yml
  • .github/workflows/pipeline.yml
  • tests/test_compatibility_integration.py

Comment thread .github/workflows/pipeline.yml
Comment thread tests/test_compatibility_integration.py
Comment on lines +45 to +46
self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 0]) == 0.0)
self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 2]) == 0.0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid exact floating-point equality for summed forces.

np.sum(...) == 0.0 is fragile: after an MD run the column sums are unlikely to be bit-exactly zero, so a tiny residual will fail the assertion. Use a tolerance. Also note only the x and z components are checked—please confirm omitting y is intentional given the alternating FixAtoms constraint.

🛠️ Suggested tolerance-based check
-        self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 0]) == 0.0)
-        self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 2]) == 0.0)
+        forces = parsed_output["generic"]["forces"]
+        self.assertAlmostEqual(float(np.sum(forces[:, 0])), 0.0, places=8)
+        self.assertAlmostEqual(float(np.sum(forces[:, 2])), 0.0, places=8)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 0]) == 0.0)
self.assertTrue(np.sum(parsed_output["generic"]["forces"][:, 2]) == 0.0)
forces = parsed_output["generic"]["forces"]
self.assertAlmostEqual(float(np.sum(forces[:, 0])), 0.0, places=8)
self.assertAlmostEqual(float(np.sum(forces[:, 2])), 0.0, places=8)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_compatibility_integration.py` around lines 45 - 46, The assertions
in tests/test_compatibility_integration.py use exact equality on floating sums
(np.sum(parsed_output["generic"]["forces"][:, 0]) == 0.0 and [:, 2]) which is
fragile; change these to tolerance-based checks using np.isclose or np.allclose
(e.g. assert np.isclose(np.sum(parsed_output["generic"]["forces"][:, 0]), 0.0,
atol=1e-8)) for the x and z columns (or use np.allclose on a slice like
parsed_output["generic"]["forces"][:, [0,2]]), and either add the y-column check
or a clear comment in the test explaining why the y-component is intentionally
omitted given the FixAtoms constraint.

@jan-janssen jan-janssen merged commit ab1fefc into main Jun 3, 2026
25 checks passed
@jan-janssen jan-janssen deleted the integration branch June 3, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant