Skip to content

Add widget for MSD analysis#35

Open
PardhavMaradani wants to merge 7 commits into
MDAnalysis:mainfrom
PardhavMaradani:add-msd-widget
Open

Add widget for MSD analysis#35
PardhavMaradani wants to merge 7 commits into
MDAnalysis:mainfrom
PardhavMaradani:add-msd-widget

Conversation

@PardhavMaradani

Copy link
Copy Markdown
Collaborator

Changes made in this Pull Request:

  • Added widget for MSD analysis

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

Hi @orbeckst, @jeremyleung521, @amruthesht, @HeydenLabASU,

This PR adds a new 'MSD Analysis' widget based on issue #34 raised by @amruthesht that uses MDAnalysis.analysis.msd.EinsteinMSD.

The widget runs every-frame and uses the timestep values from the sliding window buffer to create the plot. In the screenshots shown below, the 'Batch size' / 'Buffer size' is configured as 100 in 'Settings > Universe configuration' and hence the lag time shows up to 2 ps (each step is 0.02 ps in this example simulation).

Here is an example plot with all default values (select='all', msd_type='xyz', fft=False, non_linear=False):

msd-all-defaults

Here is the same plot with a log scale (configurable from the GUI):

msd-all-defaults-loglog

Here is the plot with fft=True:

msd-all-fft

Here is the plot with non_linear=True:

msd-all-non-linear

Here are the configurable inputs for this widget:

msd-inputs

I added parallel support for this as it seemed to take a bit of time.

Here is a plot with a different selection phrase:

msd-protein-defaults

Thanks

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a1eb59e) to head (0d85f72).

Additional details and impacted files
Components Coverage Δ
frontend 100.00% <ø> (ø)
backend 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amruthesht amruthesht left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@PardhavMaradani, the PR looks like a good start for other lag-time based analyses. There are some issues with the current implementation that I have pointed out. Once resolved, it should be good to go.
Let me know if you need any help or clarification with any points raised or want to discuss possible solutions.

Comment thread mdadash/backend/analyses/msd.py Outdated
Comment thread mdadash/backend/analyses/msd.py Outdated
Comment thread mdadash/backend/analyses/msd.py Outdated
- Add a new SlidingWindowMSD class that is O(n) for each window
@PardhavMaradani

Copy link
Copy Markdown
Collaborator Author

Hi @amruthesht , updated the code based on your example in #34 .

I had to make a few minor changes to get this working correctly (verified that the plots were identical to the MDA's MSD ones):

  • The indexing was comparing frame 0 with the rest - changed it to compare the most recent one (last in the list) to all the previous ones
  • changed msd_dict to use a deque instead of a list to keep this from not growing forever
  • had to round the time delta to prevent jagged edges (similar to the non-linear case in MDA's MSD graph above)
  • added support for selection phrase and msd_type

Could you please review and let me know if there are any changes needed. Thanks

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.

2 participants