Skip to content

Fix issue #66 - #67

Merged
lohedges merged 1 commit into
develfrom
fix_66
Nov 17, 2026
Merged

lohedges merged 1 commit into
develfrom
fix_66

Conversation

@lohedges

Copy link
Copy Markdown
Contributor

Closes #66.

num_waters() without a context failed after a move within a GCMC region:

  • It raised an AttributeError before any bulk move, since _openmm_context was never initialised.
  • Otherwise it returned the count from the start of the last batch, since accepted insertions and deletions updated _N but not _N_region.

This initialises _openmm_context in __init__ and refreshes _N_region at the end of move(). Test mode now breaks out of the batch loop rather than returning early, so that it goes through the same bookkeeping. A new test checks the stored count against a recount from the context after a real move.

I think it's fine to merge without review. Two of the three changes are clearly safe: initialising the attribute, and updating the stored count at the end of move().

The return to break change is the only one that touches control flow, and only in test mode. Nothing after the batch loop uses the counters, and it just runs the same updates that a normal move does.

@lohedges lohedges added the bug Something isn't working label Nov 17, 2026
@lohedges
lohedges merged commit 6937e82 into devel Nov 17, 2026
4 checks passed
@lohedges
lohedges deleted the fix_66 branch November 17, 2026 12:30
@lohedges lohedges mentioned this pull request Nov 17, 2026

This branch was successfully deployed

1 active deployment
loch-build — de9f8d06 Deployed Nov 17, 2026 by lohedges via build (3.13, linux) #37
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.

num_waters() raises AttributeError before the first bulk move when a reference is set

1 participant