Skip to content

Conversation

@jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Jan 9, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Added option to couple XYZ molecular motion in pressure-controlled simulations and thermal expansion calculations.

✏️ Tip: You can customize this high-level summary in your review settings.

@jan-janssen jan-janssen requested a review from prabhath-c January 9, 2026 11:29
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

A single-file enhancement adds a couple_xyz boolean parameter to two LAMMPS NPT molecular dynamics functions, enabling conditional runtime selection of the LAMMPS ensemble string with optional "couple xyz" coupling.

Changes

Cohort / File(s) Summary
NPT Ensemble Coupling Parameter
src/atomistics/calculators/lammps/libcalculator.py
Added couple_xyz: bool = False parameter to calc_molecular_dynamics_npt_with_lammpslib() and calc_molecular_dynamics_thermal_expansion_with_lammpslib(). Introduced runtime branching to conditionally append " couple xyz" to LAMMPS_ENSEMBLE_NPT_XYZ string and propagate usage through init and run string construction paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A coupling twist, so xyz and grand,
Two functions dance at my command,
With boolean flags, the ensemble bends,
Where pressure meets motion at both ends! 🎩✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'LAMMPS: Add option to couple xyz for npt' accurately summarizes the main change: adding a couple_xyz parameter to NPT-related LAMMPS functions.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
src/atomistics/calculators/lammps/libcalculator.py (2)

481-481: Consider consistency with NPT function.

The implementation mirrors the pattern from calc_molecular_dynamics_npt_with_lammpslib, which is good for consistency. The same variable naming suggestion applies here: consider using lowercase lammps_ensemble_npt_xyz instead of ALL_CAPS.

The conditional logic (lines 496-499) is duplicated from lines 241-244. While extracting it to a helper function could reduce duplication, with only two occurrences and 4 lines each, this is acceptable as-is.

Also applies to: 496-500


236-244: The LAMMPS syntax is correct, but consider lowercase naming for local variables.

The implementation correctly appends " couple xyz" to the ensemble command. LAMMPS documentation confirms this is the proper syntax for coupling NPT ensemble dimensions.

However, the variable LAMMPS_ENSEMBLE_NPT_XYZ uses ALL_CAPS naming typically reserved for module-level constants. Since this is a locally scoped variable, consider renaming it to ensemble_npt_xyz or similar lowercase format to follow Python conventions.

This pattern repeats in the second function as well.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aee9634 and 9937b3a.

📒 Files selected for processing (1)
  • src/atomistics/calculators/lammps/libcalculator.py
🧰 Additional context used
🪛 Ruff (0.14.10)
src/atomistics/calculators/lammps/libcalculator.py

238-238: Do not perform function call OutputMolecularDynamics.keys in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
  • GitHub Check: unittest_matrix (ubuntu-latest, 3.14)
  • GitHub Check: unittest_matrix (ubuntu-latest, 3.12)
  • GitHub Check: unittest_matrix (ubuntu-latest, 3.13)
  • GitHub Check: unittest_matrix (ubuntu-latest, 3.11)
  • GitHub Check: notebooks
  • GitHub Check: unittest_grace
  • GitHub Check: unittest_mace
  • GitHub Check: coverage
  • GitHub Check: unittest_old
  • GitHub Check: unittest_qe
  • GitHub Check: unittest_siesta
  • GitHub Check: unittest_matrix (macos-latest, 3.14)
  • GitHub Check: unittest_matrix (windows-latest, 3.14)
  • GitHub Check: unittest_sphinxdft
  • GitHub Check: unittest_gpaw
  • GitHub Check: unittest_abinit
  • GitHub Check: minimal

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (aee9634) to head (9937b3a).

Files with missing lines Patch % Lines
src/atomistics/calculators/lammps/libcalculator.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
- Coverage   86.81%   86.76%   -0.05%     
==========================================
  Files          43       43              
  Lines        2419     2425       +6     
==========================================
+ Hits         2100     2104       +4     
- Misses        319      321       +2     

☔ 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.

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.

2 participants