Skip to content

Add conformer RMSD alignment modes - #281

Open
scal444 wants to merge 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:fix/conformer-rmsd-alignment-mode
Open

Add conformer RMSD alignment modes#281
scal444 wants to merge 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:fix/conformer-rmsd-alignment-mode

Conversation

@scal444

@scal444 scal444 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Distinguishes between two different common RDKit RMSD paths - the conformer RMSD matrix we were allegedly replacing in the first place aligns on a single conformer, whereas a true pairwise RMSD aligns individually.

Since the previous RMSD implementation worked by computing RMSD without actually aligning mols, we needed significant code to match. We could have done this via the original kabsch mechanism, but would give up an O(n) for O(n^2) path for the align on 0 mechanism.

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds pairwise and first-conformer RMSD alignment modes while preserving pairwise alignment as the public default.

  • Extends the Python and Boost.Python APIs with alignment-mode selection.
  • Adds CUDA kernels that align each conformer to conformer zero before calculating RMSDs.
  • Supports single-molecule and batched execution, including explicit CUDA streams and square output.
  • Adds tests covering RDKit agreement, input immutability, mixed conformer counts, validation, and stream behavior.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issues identified.

The public wrappers consistently route the new mode, the CUDA buffers remain valid through stream-ordered work, and the added tests cover the principal single, batch, and explicit-stream paths.

Important Files Changed

Filename Overview
nvmolkit/conformerRmsd.py Adds validated alignment-mode selection and forwards it consistently through single and batch public APIs.
nvmolkit/conformerRmsd.cpp Extends both native bindings with the first-conformer alignment flag and forwards argument order consistently from the public wrapper.
src/conformer_rmsd.cu Implements shared rigid-alignment moments, quaternion rotation, and single/batch first-conformer alignment kernels without an established correctness defect.
src/conformer_rmsd_mol.cpp Allocates temporary aligned-coordinate buffers and safely orders alignment, RMSD calculation, and asynchronous deallocation on the supplied stream.
nvmolkit/tests/test_conformer_rmsd.py Adds broad regression coverage for alignment semantics, batching, validation, immutability, and explicit streams.

Reviews (1): Last reviewed commit: "Add conformer RMSD alignment modes" | Re-trigger Greptile

@scal444
scal444 requested a review from evasnow1992 August 21, 2026 21:05
@scal444

scal444 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Fixes #277

@evasnow1992 I think starting at the python layer for review makes the most sense, our docstrings now spell out the modes explicitly and what they do.

@evasnow1992 evasnow1992 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good for me. Thank you for clearly distinguish the two modes.

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