Skip to content

Guard interfacial water entropy for solute-free systems and fix WaterEntropy reporter usage#297

Merged
harryswift01 merged 4 commits intomainfrom
296-bug-waterentropy-workflow
Mar 4, 2026
Merged

Guard interfacial water entropy for solute-free systems and fix WaterEntropy reporter usage#297
harryswift01 merged 4 commits intomainfrom
296-bug-waterentropy-workflow

Conversation

@harryswift01
Copy link
Member

Summary

This PR fixes a crash in water entropy calculations for pure solvent systems and improves correctness of water group detection when atom selections are applied.

Previously:

  • Water entropy was computed even when no solute existed, causing the interfacial solver to fail.
  • Water detection used the full universe instead of the reduced selection universe.
  • WaterEntropy was instantiated incorrectly without a reporter.
  • The wrong method was invoked when computing water entropy.
  • This PR resolves all of the above and improves workflow robustness.

Changes

Interfacial Water Entropy Guard

  • Water entropy is now computed only when both water and non-water groups exist
  • Prevents interfacial entropy from running on pure solvent systems
  • Avoids MDAnalysis selection failures caused by empty solute detection

Universe Consistency in Water Group Detection

  • _split_water_groups() now operates on the same universe used to generate molecule groups
  • Prevents mismatches between grouping and water classification
  • Ensures correct behavior when reduced atom selections are applied

Reporter Integration Fix

  • WaterEntropy is now instantiated with the required reporter:
  • WaterEntropy(self._args, self._reporter)
  • Fixes missing dependency required for logging results

Impact

  • Fixes runtime crash in pure solvent simulations
  • Improves correctness when using atom selections
  • Makes water entropy logic consistent with interfacial definition
  • No impact on mixed solute-solvent systems

@harryswift01 harryswift01 requested a review from jimboid March 2, 2026 13:54
@harryswift01 harryswift01 self-assigned this Mar 2, 2026
@harryswift01 harryswift01 added the bug Something isn't working label Mar 2, 2026
@harryswift01 harryswift01 linked an issue Mar 2, 2026 that may be closed by this pull request
Copy link
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 PR fixes an issue caused by renamed functions. It also guards the usage of waterentropy for interfacial water calculations when there are no water based systems in the molecular system.

- Update regression comparison to use an absolute tolerance of 0.5 kmol
- Replace previous numerical tolerance (1e-8) with a physically meaningful threshold
- Keep relative tolerance (rtol=1e-9) unchanged for floating-point stability
@harryswift01 harryswift01 merged commit 5d6697a into main Mar 4, 2026
14 checks passed
@harryswift01 harryswift01 deleted the 296-bug-waterentropy-workflow branch March 4, 2026 09:29
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]: WaterEntropy workflow instantiation not correct

2 participants