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

Symmetry-corrected RMSD calculations #3547

Closed
wants to merge 31 commits into from
Closed

Conversation

RMeli
Copy link
Member

@RMeli RMeli commented Feb 26, 2022

This PR is an attempt to add a SymmRMSD class for symmetry-corrected RMSD calculations, powered by spyrmsd. For the time being, I created a separate class from the mainRMSD class because I believe the scope of symmetry-corrected RMSD calculations is much more narrow (and because there are some open issues with the current RMSD class, such as #2891).

Tests are currently missing, see MDAnalysis/MDAnalysisData#45.

Example usage:

import MDAnalysis as mda
from MDAnalysis.analysis import align, rms

from matplotlib import pyplot as plt

mobile = mda.Universe("npt_prod1.tpr", "npt_prod1.xtc")
ref = mda.Universe("npt_prod1.tpr", "npt_prod1.xtc", frame=0)

R = rms.RMSD(mobile, ref, select='name CA', groupselections=["resname LIG"])
R.run()

# Align trajectory to reference
# This is done internally by rms.RMSD, but it is not accessible
# See https://github.com/MDAnalysis/mdanalysis/issues/2891
_ = align.AlignTraj(mobile, ref, select='name CA',in_memory=True).run()

sR = rms.SymmRMSD(mobile, ref, select="resname LIG")
sR.run()

plt.figure()
plt.plot(R.results.rmsd[:,0], R.results.rmsd[:,-1], label="RMSD")
plt.plot(sR.results.rmsd[:,0], sR.results.rmsd[:,-1], label="SymmRMSD")
plt.legend()
plt.savefig("rmsd.png")

This is still very much WIP, but early comments/suggestions/criticisms are very welcome.

TODOs:

  • Allow to compute weighted RMSD
  • Documentation

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?

@pep8speaks
Copy link

pep8speaks commented Feb 26, 2022

Hello @RMeli! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 782:80: E501 line too long (82 > 79 characters)

Comment last updated at 2022-06-24 22:42:34 UTC

@RMeli RMeli marked this pull request as draft February 26, 2022 17:11
Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Just a couple of pre review comments

package/MDAnalysis/analysis/rms.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/rms.py Show resolved Hide resolved
package/MDAnalysis/analysis/rms.py Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/rms.py Outdated Show resolved Hide resolved
@RMeli
Copy link
Member Author

RMeli commented May 19, 2023

Closing in favor of a MDAKit (WIP): https://github.com/RMeli/spyrmsdkit

@RMeli RMeli closed this May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants