Skip to content

equi: write average position in out.lmp when if_dump_avg_posi=True#90

Merged
Yi-FanLi merged 5 commits intodeepmodeling:develfrom
Yi-FanLi:avg_posi
Mar 15, 2025
Merged

equi: write average position in out.lmp when if_dump_avg_posi=True#90
Yi-FanLi merged 5 commits intodeepmodeling:develfrom
Yi-FanLi:avg_posi

Conversation

@Yi-FanLi
Copy link
Collaborator

@Yi-FanLi Yi-FanLi commented Mar 15, 2025

When the user sets if_dump_avg_posi=True, write the average position in out.lmp.

Summary by CodeRabbit

  • Refactor
    • Streamlined simulation ensemble configuration to improve how simulation details are managed.
    • Updated the command‐line interface by removing legacy options, resulting in a clearer and more consistent simulation setup experience.

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2025

📝 Walkthrough

Walkthrough

The changes update the function signatures in dpti/equi.py. The gen_equi_ensemble_settings function now accepts an extra parameter (if_dump_avg_posi) to conditionally append specific commands to its output. In contrast, the gen_equi_lammps_input function has removed the if_dump_avg_posi parameter and now calls gen_equi_ensemble_settings with the updated interface. Additionally, the make_task function no longer accepts if_dump_avg_posi and now includes a new parameter (npt_dir), while the command-line argument --avg-posi has been removed.

Changes

File Change Summary
dpti/equi.py - gen_equi_ensemble_settings: Added if_dump_avg_posi parameter to conditionally append commands.
- gen_equi_lammps_input: Removed if_dump_avg_posi parameter and updated its call to gen_equi_ensemble_settings.
- make_task: Removed if_dump_avg_posi parameter and added new parameter npt_dir.
- Removed command-line argument --avg-posi from the argument parser.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/CLI
    participant L as gen_equi_lammps_input
    participant E as gen_equi_ensemble_settings
    participant T as make_task

    U->>L: Provide simulation configuration (no --avg-posi)
    L->>E: Call gen_equi_ensemble_settings(ens, if_dump_avg_posi)
    E-->>L: Return ensemble settings string
    L->>T: Call make_task(..., npt_dir)
    T-->>L: Confirm task creation
    L-->>U: Return simulation input configuration
Loading

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7009516 and 8769790.

📒 Files selected for processing (1)
  • dpti/equi.py (3 hunks)
🔇 Additional comments (2)
dpti/equi.py (2)

134-164: Correctly implemented feature to write average positions when if_dump_avg_posi=True

The modification to the gen_equi_ensemble_settings function adds support for writing average atom positions to the output file by updating the function signature and adding the necessary LAMMPS commands. The added code correctly:

  1. Undumps the previously dumped data
  2. Removes the average position fix
  3. Reads the average positions from the dump file before writing to out.lmp

This implementation achieves the PR objective of writing average positions to out.lmp when if_dump_avg_posi is True.

🧰 Tools
🪛 Ruff (0.8.2)

153-153: Use format specifiers instead of percent format

(UP031)


206-208: Properly updated function call to include if_dump_avg_posi parameter

The call to gen_equi_ensemble_settings has been correctly updated to pass the if_dump_avg_posi parameter, ensuring that the new functionality is accessible when needed.

✨ 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
🪧 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.
  • @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.

@Yi-FanLi Yi-FanLi merged commit ceea761 into deepmodeling:devel Mar 15, 2025
3 of 7 checks passed
felix5572 pushed a commit to felix5572/dpti that referenced this pull request Mar 16, 2025
…eepmodeling#90)

* avoid reading --avg-posi from cmd line; only read it from json

* write average position in out.lmp if if_dump_avg_posi=True

* support writing average position in out.lmp if if_dump_avg_posi=True

* improve indentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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