Skip to content

Fix setting initial temperature#297

Merged
jan-janssen merged 3 commits intomainfrom
initial_temperature
Jan 24, 2026
Merged

Fix setting initial temperature#297
jan-janssen merged 3 commits intomainfrom
initial_temperature

Conversation

@jan-janssen
Copy link
Copy Markdown
Member

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

Summary by CodeRabbit

  • Bug Fixes

    • Velocity initialization now only runs when temperature parameters are specified, preventing unintended velocity setup.
    • Improved parameter handling so input dictionaries passed into calculations are no longer mutated.
  • Tests

    • Updated expectations to align with the adjusted velocity behavior in generated simulation inputs.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Conditional initial-velocity creation was added to calc_md (only when initial_temperature is set > 0) and calc_kwargs is now defensively copied to avoid mutating caller-provided dictionaries. A test expectation was adjusted to remove the initial velocity creation line.

Changes

Cohort / File(s) Summary
Velocity Setup Conditioning
src/pyiron_lammps/compatibility/calculate.py
calc_md now calls _set_initial_velocity only if initial_temperature is not None and > 0; when initial_temperature is None or ≤ 0 no initial velocity is appended. Review flows that assume velocity creation.
Defensive Parameter Copying
src/pyiron_lammps/compatibility/file.py
calc_kwargs is copied when provided to avoid mutating the caller's dict; ensure downstream modifications still behave as intended.
Test Expectation Update
tests/test_compatibility_file.py
Test test_calc_md_nve updated to remove assertion for the velocity all create ... gaussian line from expected LAMMPS input.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through bytes and gentle code,

I guarded args on every road,
If temps are zero, no race begins,
I copy papers, dodge the sins,
A tiny tweak — the rabbit grins.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix setting initial temperature' directly corresponds to the main change—making initial velocity setup conditional based on initial_temperature value.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.15%. Comparing base (783c651) to head (902dfa3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #297      +/-   ##
==========================================
+ Coverage   82.12%   82.15%   +0.03%     
==========================================
  Files          11       11              
  Lines        1141     1143       +2     
==========================================
+ Hits          937      939       +2     
  Misses        204      204              

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

@jan-janssen jan-janssen merged commit a51e7f6 into main Jan 24, 2026
21 checks passed
@jan-janssen jan-janssen deleted the initial_temperature branch January 24, 2026 19:51
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