Skip to content

Update calculate.py#302

Merged
jan-janssen merged 2 commits intopyiron:mainfrom
Atilaac:bug-fix/pressure_parsing
Jan 25, 2026
Merged

Update calculate.py#302
jan-janssen merged 2 commits intopyiron:mainfrom
Atilaac:bug-fix/pressure_parsing

Conversation

@Atilaac
Copy link
Copy Markdown
Contributor

@Atilaac Atilaac commented Jan 25, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved rotation handling: when rotation data is missing, the system now defaults to a neutral rotation and uniformly evaluates whether to apply rotation, resulting in more consistent and robust processing of configurations.

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

@Atilaac Atilaac requested a review from jan-janssen as a code owner January 25, 2026 09:55
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

Adds an identity fallback when rotation_matrix is None and removes the explicit None guard from the rotation decision; rotation is now determined by the matrix trace (vs. identity) and pressure isotropy, ensuring downstream code can assume a valid rotation_matrix.

Changes

Cohort / File(s) Summary
Rotation matrix fallback & rotation check
src/pyiron_lammps/compatibility/calculate.py
When rotation_matrix is None, replace with a 3×3 identity matrix; remove explicit rotation_matrix is not None check and decide rotation based on the matrix trace (not close to 3) and whether pressure is isotropic. No signature/API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Fix rotation matrix is None #300: Modifies the same pressure/rotation handling in src/pyiron_lammps/compatibility/calculate.py but takes the opposite approach (adds an explicit None check to skip rotation).

Poem

🐰 I found a matrix out in the wild,
So I gave it identity—calm and mild.
Now rotations decide by a trace,
No None to hide or misplace.
Hop, patch, and one small cheer—matrix aligned and clear!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "Update calculate.py" is vague and does not clearly convey the main change; it merely states a file is being updated without describing what was actually changed or why. Use a more descriptive title that summarizes the key change, such as "Add identity matrix fallback for rotation_matrix in pressure tensor calculation" to clearly communicate the purpose of the update.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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: 1

🤖 Fix all issues with AI agents
In `@src/pyiron_lammps/compatibility/calculate.py`:
- Around line 388-391: The fallback for rotation_matrix has a syntax error: the
np.eye call is missing a closing parenthesis. In the block that checks "if
rotation_matrix is None" (where rotation_matrix and np.eye are used), close the
np.eye(3) call by adding the missing ")" so rotation_matrix = np.eye(3) is
valid.

Comment thread src/pyiron_lammps/compatibility/calculate.py
@jan-janssen jan-janssen linked an issue Jan 25, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.36%. Comparing base (06ab1f2) to head (a32b14d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
+ Coverage   82.33%   82.36%   +0.03%     
==========================================
  Files          11       11              
  Lines        1155     1157       +2     
==========================================
+ Hits          951      953       +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 0cff5ce into pyiron:main Jan 25, 2026
20 checks passed
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.

issue with pressure to lammps

2 participants