Skip to content

Fix indexing issue for multiple dihedrals#339

Merged
skfegan merged 1 commit into
mainfrom
338-dihedrals-error-for-more-than-one-molecule
May 14, 2026
Merged

Fix indexing issue for multiple dihedrals#339
skfegan merged 1 commit into
mainfrom
338-dihedrals-error-for-more-than-one-molecule

Conversation

@skfegan
Copy link
Copy Markdown
Member

@skfegan skfegan commented May 14, 2026

Summary

For systems with two or more groups of molecules, there was an indexing error when looping over residues for the united atom level calculation it was using the first molecule of the system to count the number of residues instead of the first molecule of the group.

Changes

  • in dihedrals.py, change rep_mol index from 0 to molecules[0]

Impact

  • Should now not have out of index errors when the system contains molecules with different numbers of residues.

@skfegan skfegan linked an issue May 14, 2026 that may be closed by this pull request
@skfegan skfegan requested review from harryswift01 and jimboid May 14, 2026 13:23
Copy link
Copy Markdown
Member

@harryswift01 harryswift01 left a comment

Choose a reason for hiding this comment

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

Looks good to me, switching from the system-level molecule index (0) to the group-level reference (molecules[0]) fixes the residue indexing issue for multi-group systems and should prevent the out-of-index errors seen with differing residue counts. Happy to approve.

@harryswift01 harryswift01 added the bug Something isn't working label May 14, 2026
@harryswift01 harryswift01 changed the title fixing indexing issue for dihedrals Fix indexing issue for multiple dihedrals May 14, 2026
Copy link
Copy Markdown
Member

@jimboid jimboid left a comment

Choose a reason for hiding this comment

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

This looks like you have found the issue and the fix is in line with the impact statement in the PR. Happy to approve

@skfegan skfegan merged commit a45297e into main May 14, 2026
43 of 45 checks passed
@skfegan skfegan deleted the 338-dihedrals-error-for-more-than-one-molecule branch May 14, 2026 14:21
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

Development

Successfully merging this pull request may close these issues.

[Bug]: Dihedrals error for more than one molecule

3 participants