Repository navigation
Conversation
Experimental eigvalsh/eigh fallback for issues MDAnalysis#945 and MDAnalysis#1747. Implementation generated with GPT during the numerical investigation. The derivative threshold remains experimental.
Cover issues MDAnalysis#945 and MDAnalysis#1747, weighted inputs, native float32/float64, and RMSD-only fallback dispatch. Check returned rotation invariants instead of requiring the identity. Tests generated with GPT.
Replace identity-only expectations with orthogonality, determinant and achieved RMSD checks. Test changes generated with GPT.
Documentation build overview
8 files changed ·
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5525 +/- ##
========================================
Coverage 93.91% 93.91%
========================================
Files 184 184
Lines 22644 22661 +17
Branches 3219 3223 +4
========================================
+ Hits 21267 21283 +16
- Misses 917 918 +1
Partials 460 460 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Can you explain the math with the proper equations? You can use mathjax/latex in GH markdown. |
Why QCP needs a fallbackQCP aims to find the rotation between 2 sets of points that minimizes the following term We can write it in terms of rotation Minimizing In both issues, the centered point sets are collinear and their cross-correlation matrix has rank one. If The two examples have zero or very small minimum RMSD, so Newton starts at or near the double root Here is the 3 different cases where the fallback is activated, the 2 original issues refer to the first part of the first case: 1.
|
|
I hope is detailed enough, or maybe I wrote too much, I don't know how deep I should have gone, let me know. I didn't talk about the rotation recovery problem that Astra reported to me after fixing the QCP. Let me know if you want me to write something about it. |
|
Thanks for providing more detail. It will likely take a while until I have time to look at this closely. Thank you for your patience. I'd be happy if someone else jumped in an commented/reviewed! |
|
Thanks for the answer. I’ll wait for some feedback then. If I can make a suggestion to who is going to look at this, I’d focus on the |
Fixes #945, fixes #1747.
Changes made in this Pull Request:
Related issues: #945 and #1747.
Problem
Both issues are caused by the same problem, QCP failure. After centering, both examples have rank-one centered coordinates. This causes repeated largest eigenvalue and the inital estimate E0 to be equal or numerically very close to that value. This causes having to deal with a vanishing derivative which creates zero divisions or unstable convergence for the algorithm.
Proposed Approach
keep the existing QCP standard approach with a fallback in these situations:
Rotation Recovery
Solving the newton update problem exposed a second one, in the case of repeated largest eigenvalues the cofactors to solve K - λI vanish, if every candidate quaternion is too small, the implementation returns the identity matrix. This matrix could work but not necessarily.
Proposed Approach
A fallback to replace this identity return with a normalized eigenvector associated with the largest eigenvalue, which is then converted in a rotation matrix
LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes
I wrote this PR description and worked through the problem and design choices in discussion with GPT 6.1 Sol and Astra. GPT generated the experimental implementation, validation scripts, and ran the local checks. I have the full understanding of the math involved in this problem and what happened inside the code.
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS? (If it is not, add it!)Developers Certificate of Origin
I certify that I can submit this code contribution as described in the [Developer Certificate of Origin](https://developercertificate.org/), under the MDAnalysis [LICENSE](https://github.com/MDAnalysis/mdanalysis/blob/develop/LICENSE).