Skip to content

Reduce pyiron_lammps package #200

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 2 commits into from
Feb 24, 2025
Merged

Reduce pyiron_lammps package #200

merged 2 commits into from
Feb 24, 2025

Conversation

jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Feb 24, 2025

Summary by CodeRabbit

  • Chores

    • Updated environment and build configurations by removing an obsolete dependency.
  • Refactor

    • Simplified simulation input handling by streamlining control functionality.
    • Consolidated structure generation to use a unified atomic approach with enhanced velocity processing.

Copy link

coderabbitai bot commented Feb 24, 2025

Walkthrough

The changes remove the dependency on pyiron_base from environment configuration files and the project’s build settings. Additionally, the LammpsControl class and its associated tests have been removed. The LammpsStructure class has been refactored to focus solely on generating atomic structure inputs with a new internal method for handling velocities, and its corresponding tests have been updated.

Changes

File(s) Change Summary
.ci_support/environment-old.yml, .ci_support/environment.yml, pyproject.toml Removed dependency on pyiron_base (versions 0.10.0 and 0.11.5) from environment configurations and build/project requirements.
pyiron_lammps/control.py, tests/test_control.py Removed the LammpsControl class and all associated unit tests.
pyiron_lammps/structure.py, tests/test_structure.py Refactored the LammpsStructure class by simplifying the structure method to use atomic representation only and adding a private method for velocity input; updated tests (non-cubic and cubic) accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as User/Test
    participant LS as LammpsStructure
    participant AS as AtomicStructureHandler
    participant VSI as VelocityStringHandler

    Caller ->> LS: Call structure() method
    LS ->> AS: Invoke structure_atomic()
    AS -->> LS: Return atomic structure string
    LS ->> VSI: Invoke _get_velocities_input_string()
    VSI -->> LS: Return velocities string
    LS ->> Caller: Return combined input string
Loading

Poem

I’m a bunny with a keen coder’s eye,
Hopping through changes that simplify and fly.
Dependencies vanish like carrots in the breeze,
And structure flows neat as a row of trees.
With each leap in code, I cheer and sigh—
A happy rabbit under a clear blue sky! 🐰

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.45%. Comparing base (e999835) to head (913ed08).
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #200       +/-   ##
===========================================
+ Coverage   62.04%   86.45%   +24.41%     
===========================================
  Files           5        4        -1     
  Lines         901      480      -421     
===========================================
- Hits          559      415      -144     
+ Misses        342       65      -277     

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

Copy link

@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

🧹 Nitpick comments (3)
pyproject.toml (1)

2-2: Dependency Version Consistency Check
Notice that the build-system requirement for numpy does not pin a version while the project dependencies explicitly pin it as "numpy==2.2.3". If this divergence is intentional (e.g., to allow flexibility during build while enforcing a fixed runtime version), please document the rationale; otherwise, consider aligning the version specifications across sections.

Also applies to: 29-29

tests/test_structure.py (2)

70-70: Add a test with multiple atoms or negative velocities.
This single-atom velocity test is valid but might not fully exercise velocity handling for larger systems or diverse velocity vectors.


106-106: Consider using a tolerance-based check rather than an exact string match.
Relying on a literal numeric match for floating-point data can be fragile and might cause spurious test failures if small differences in numeric precision occur.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e999835 and 913ed08.

📒 Files selected for processing (7)
  • .ci_support/environment-old.yml (0 hunks)
  • .ci_support/environment.yml (0 hunks)
  • pyiron_lammps/control.py (0 hunks)
  • pyiron_lammps/structure.py (2 hunks)
  • pyproject.toml (1 hunks)
  • tests/test_control.py (0 hunks)
  • tests/test_structure.py (2 hunks)
💤 Files with no reviewable changes (4)
  • .ci_support/environment-old.yml
  • tests/test_control.py
  • .ci_support/environment.yml
  • pyiron_lammps/control.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: unittest_matrix (windows-latest, 3.12)
  • GitHub Check: unittest_matrix (macos-latest, 3.12)
🔇 Additional comments (4)
pyproject.toml (2)

2-2: Cleaned Build-System Dependencies
The removal of "pyiron_base" from the build-system requires array is in line with the objective to reduce unnecessary dependencies. Please ensure that any build scripts or processes that might have referenced pyiron_base are updated accordingly.


26-32: Streamlined Project Dependencies
The removal of "pyiron_base==0.11.5" from the [project] dependencies helps slim down the package and reduce dependency overhead. Verify that none of the project modules rely on features provided by pyiron_base, or that suitable alternatives are in place.

pyiron_lammps/structure.py (2)

232-234: Straightforward approach to embed velocity data in the main input string.
This concatenation makes sense to maintain a single _string_input for the final data file.


257-257: No issues found.
The return statement is correct and neatly ends the velocity block generation logic.

Comment on lines +235 to +242
def _get_velocities_input_string(self):
input_str = ""
if not np.all(
np.isclose(
self._structure.get_velocities(),
np.array([[0.0, 0.0, 0.0]] * len(self._structure)),
)
):
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Handle the case when velocities are not defined or partially zero.
If structure.get_velocities() is None, this check will fail. Consider adding a null check or defaulting to zero velocities to avoid runtime errors and ensure robust handling when velocities are unset.

@jan-janssen jan-janssen merged commit d17e01d into main Feb 24, 2025
19 checks passed
@jan-janssen jan-janssen deleted the reduce branch February 24, 2025 10:49
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