Unintuitive handling of advancing simulations with internal times during playback
- Dominant language
- Jupyter Notebook
- Stars
- 3
- Forks
- 4
- Avg merge
- 8h 48m
- Merged PRs (30d)
- 37
Description
Most simulations have their own internal time which does not relate to real-world time elapsed.
The current implementation of the `OmniRunner` uses a `VariableIntervalGenerator` to call a `advance_by_seconds`function common to all Simulation types, passing the real world time elapsed from its last call (0.03 s by default).
As previous Simulation implementations have not properly implemented this function it has not been an issue. However, the recent implementation of the `UniverseSimulation` for interfacing with MDAnalysis presents a problem.
MDAnalysis simulations have an internal time step between simulation frames which has no direct relation to the real world time elapsed - i.e. there is no strong justification to tie the time elapsed between when `advance_by_seconds` was last called to how much the simulation should jump ahead. Rather it makes more sense to be able to set a given timestep which can be consistently called (and modified) irrespective of when the last call was made.
A possible solution to the issue is to subclass the `Simulation` protocol to a `RealTimeSimulation` and a `InternalSimulation` (names wip) which would expose either a `advance_by_seconds` or a `advance_by_nanoseconds` function.
The `OmniRunner` would then be able check the type of simulation and either advance the simulation by the real-world time elapsed if playing a `RealTimeSimulation` or a constant timestep if using `InternalSimulation`.
That said, the above suggestion may just be avoiding dealing with the root cause of the issue and a more substantive solution may be required.
Contributor guide
Research direction
Start with OmniRunner, the Simulation protocol, and UniverseSimulation, focusing on how advance_by_seconds currently receives elapsed time. Review the MDAnalysis integration and determine the agreed advancement model; done means playback can consistently advance simulations with internal time without relying on real-world elapsed time.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100