You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For MC simulations, it would be useful to be able to save all writable particle properties in a dict. Then, it would be easy to restore the particle later, if an MC move is rejected.
Came up during Gibbs ensemble work.
p = random_particle()
old_part_state = p.state_as_dict()
...
p.update(old_part_state)
The text was updated successfully, but these errors were encountered:
Fixes#3916
Add functions: `ParticleHandle.to_dict()` and `ParticleSlice.to_dict()`
Description of changes:
Returns the particles attributes as a dictionary, such that it can be used to save the particle data and recover it by using
```python
p = system.part.add(...)
particle_dict = p.to_dict()
system.part.add(particle_dict)
```
Codes are mainly written by @RiccardoFrenner
For MC simulations, it would be useful to be able to save all writable particle properties in a dict. Then, it would be easy to restore the particle later, if an MC move is rejected.
Came up during Gibbs ensemble work.
The text was updated successfully, but these errors were encountered: