Skip to content
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

Add data structure to save and restart a simulation. #149

Merged
merged 11 commits into from
Jul 12, 2024

Conversation

chrisjonesBSU
Copy link
Member

This PR adds Simulation.save_simulation_pickle and Simulation.from_simulation_pickle methods that save everything needed to save and restart a simulation (state, forces, reference values, and kwargs).

A couple notes:

  1. The save_simulation_pickle method writes a binary string to the file that is checked by from_simulation_pickle before opening the pickle with pickle.load.

  2. Using local snapshots, or state.get_snapshot() aren't pickleable, so we have to save a temp.gsd. file, then pickle the gsd.hoomd.Frame state instead.

@chrisjonesBSU chrisjonesBSU linked an issue Jul 7, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.90%. Comparing base (a600b73) to head (6dbdfcc).
Report is 20 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
+ Coverage   94.77%   94.90%   +0.13%     
==========================================
  Files          26       26              
  Lines        1970     2021      +51     
==========================================
+ Hits         1867     1918      +51     
  Misses        103      103              
Files Coverage Δ
flowermd/base/simulation.py 92.89% <100.00%> (+0.87%) ⬆️

Copy link
Collaborator

@marjanalbooyeh marjanalbooyeh left a comment

Choose a reason for hiding this comment

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

This is a really good PR. Thank you for putting the effort on this Chris.
I just added one question about wall forces.

flowermd/base/simulation.py Outdated Show resolved Hide resolved
@chrisjonesBSU chrisjonesBSU merged commit 6d723a6 into cmelab:main Jul 12, 2024
10 checks passed
@chrisjonesBSU chrisjonesBSU deleted the sim-json branch July 12, 2024 16:22
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.

Option to not include wall forces when pickling the forcefield
2 participants