-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bond visualization; data handling. (#4502)
Add updates for bond data in OpenGL visualizer. Up to now, the OpenGL visualizer collected information about the bonds in a system only once, on initialization. Simulations that dynamically add or remove bonds while running were therefore not correctly visualized. Note that still dynamic removal of particles or bonds may result in race conditions, if during the drawing process new data has been fetched from the core where particles are no longer available. To lower the chance of this to happen, the data collection now happens with just one communication of `system.parts.all()` as well as bond drawing catching (and ignoring) this exception. (Another point where that might happen is `_draw_system_particles()`, if this proves to be an issue, I can give it another look.) While this increases the amount of data being communicated, it also reduces the number of communications. To check the performance impact, both the old and new version of the `_update_particles` method were tested on a simple LJ fluid (868 particles). When communicating the minimum number of attributes (`pos` and `type`) the slowdown is about 4 %, when communicating all attributes we get about 4 % speedup. In practice, this does not seem to have a noticeable impact on visualization performance of common simulation setups. Also, parts of the visualizer, such as the `_draw_system_particles()` method, relied on the particle ids communicated by the core to be contiguous. Description of changes: - fetch bond data at every visualizer update - reduce number of communications of particle data - store a dictionary mapping the particle id to array index to access the correct data -- not relying on contiguous particle ids
- Loading branch information
Showing
1 changed file
with
72 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters