-
Notifications
You must be signed in to change notification settings - Fork 38
500 optimization err only script #235
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
500 optimization err only script #235
Conversation
The `velocities` and `cell_velocities` are initialized to `None` in the `(FrechetCell)FIREState`. However, when using the `InFlightAutoBatcher` during an optimization, the current and new states are concatenated in `torch_sim.state.concatenate_states`. When trying to merge states that were already processed for a few iterations (i.e., velocities are not None anymore) and newly initialized ones, an error is raised because the code tries to merge a `Tensor` with a `None`. Here, we initialize the `(cell_)velocities` as tensors full of `nan` instead, so that one can merge already processed and newly initialized states. During the first initialization, the `fire` methods look for `nan` rows and replace them with zeros.
Caution Review failedThe pull request is closed. WalkthroughTwo new scripts were added: one for generating and relaxing random Zn-based structures, and another for batched structure optimization using a MACE model. Model checkpoint URLs were updated to versioned links in both the test and model code. The autobatching logic was adjusted to increase the number of states in the initial batch during simulation by fetching additional states after memory scaler finalization. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Script (500_err.py)
participant ModelLoader
participant MaceModel
participant Simulator
User->>Script (500_err.py): Run script
Script (500_err.py)->>ModelLoader: Load MACE model (from URL or checkpoint)
ModelLoader-->>Script (500_err.py): Return model
Script (500_err.py)->>MaceModel: Wrap model for forces/stress
Script (500_err.py)->>Simulator: Generate 500 random Zn structures
Script (500_err.py)->>Simulator: Initialize simulation state
Script (500_err.py)->>Simulator: Run optimization (FIRE, convergence check)
Simulator-->>Script (500_err.py): Return relaxed state
Script (500_err.py)->>User: Print final state
sequenceDiagram
participant User
participant Script (create_zn_structure.py)
participant Utils
participant PyTorch/torch_sim
User->>Script (create_zn_structure.py): Call structure generation function
Script (create_zn_structure.py)->>Utils: Compute volume per atom, box size
Script (create_zn_structure.py)->>Utils: Generate random structure
Script (create_zn_structure.py)->>PyTorch/torch_sim: Pack with soft-sphere, relax with ORB model
PyTorch/torch_sim-->>Script (create_zn_structure.py): Return relaxed structure
Script (create_zn_structure.py)-->>User: Output SimState
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
I opened this PR in the wrong repo. Cause PRs default upstream (which is really annoying https://github.com/orgs/community/discussions/11729) |
Summary
Checklist
Before a pull request can be merged, the following items must be checked:
uvx ty check
on the repo.We highly recommended installing the pre-commit hooks running in CI locally to speedup the development process. Simply run
pip install pre-commit && pre-commit install
to install the hooks which will check your code before each commit.Summary by CodeRabbit
New Features
Bug Fixes
Chores