Skip to content

Fix issue #543 and #544 - #545

Merged
lohedges merged 2 commits into
develfrom
fix_543_544
Nov 25, 2026
Merged

lohedges merged 2 commits into
develfrom
fix_543_544

Conversation

@lohedges

Copy link
Copy Markdown
Contributor

Closes #543. Closes #544.

patchIntrascale checked every atom pair in each end state, which took ~50 s per call for a protein the size of thrombin (4,622 atoms). It now only checks pairs that aren't (1,1) in at least one of the two matrices, using each CutGroup-pair block's non-default elements.

While timing this, I found that the SparseMatrix hash returned 0 for almost every key, so every entry shared a single bucket. This went unnoticed for small CutGroups but made lookups and inserts linear in the number of entries for large ones, e.g. the single CutGroup produced by a non-ROI BioSimSpace merge. The hash now uses Qt's 64-bit qHash on the combined index.

Timings for thrombin:

Case Before After
patchIntrascale, one CutGroup per residue ~54 s 0.08 s
patchIntrascale, single CutGroup — 0.05 s (12.5 s without the hash fix)
CLJNBPairs(connectivity, ...), single CutGroup 14.4 s 9.4 s

Results match the old implementation exactly for every atom pair across four test cases, including partial mappings. I added tests/io/test_patch_intrascale.py, which requires both scan directions. The IO, MM, convert and morph tests give the same results as on devel.

Changing the hash changes SparseMatrix iteration order. The only order-dependent code is the GROMACS topology writer's fallback for molecules without connectivity, which will write the same [ pairs ] lines in a different order.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the MIT license (the Python API) or the LGPLv3+ license (everything else), as described in the LICENSE file: [y]

@lohedges lohedges added the bug Something isn't working label Nov 25, 2026
@lohedges
lohedges merged commit 632028a into devel Nov 25, 2026
5 checks passed
@lohedges
lohedges deleted the fix_543_544 branch November 25, 2026 11:19

This branch was previously deployed

1 inactive deployment
sire-build — f985f508 Deployed Nov 25, 2026 by lohedges via build (3.14, windows) #477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

1 participant