Skip to content

Add symmetry_number option for the orientational entropy - #500

Open
michalkrompiec wants to merge 3 commits into
CCPBioSim:mainfrom
michalkrompiec:497-symmetry-number-option
Open

michalkrompiec wants to merge 3 commits into
CCPBioSim:mainfrom
michalkrompiec:497-symmetry-number-option

Conversation

@michalkrompiec

Copy link
Copy Markdown

Summary

Adds a symmetry_number argument that sets the symmetry number σ used in the orientational entropy, in place of the value computed by Neighbors._get_symmetry_number. Closes #497.

The computed value counts graph automorphisms of the heavy-atom skeleton, which can be larger than the rotational symmetry number of the point group (24 rather than 12 for methane, 6 rather than 3 for ammonia). When σ exceeds the orientation count, Ω is floored at 1 and the orientational term becomes zero. The new argument lets the user give the rotational symmetry number directly. If it is not set, the computed value is used as before.

Changes

  • CodeEntropy/config/argparse.py: new symmetry_number argument (int, default None), set from the CLI or config.yaml. validate_inputs refuses negative or non-integer values. 0 keeps its existing meaning (no orientational entropy).
  • CodeEntropy/levels/graph/level_dag.py: _initialise_neighbor_metadata replaces the computed symmetry number of every molecule group with args.symmetry_number when it is set, and logs the given and computed values at INFO level.
  • Docs: new row in the arguments table (getting_started.rst) and a short paragraph in the orientational entropy section (science.rst) on how σ is computed and how to override it.
  • Tests: unit tests for parsing, YAML resolution, validation, the level DAG override and the resulting orientational entropy; a fast regression case benzaldehyde/symmetry_number (the selection_subset config with symmetry_number: 1).

Testing

  • pytest tests/unit: 710 tests pass (695 before this change; the same two divide-by-zero warnings as on main); coverage of argparse.py and level_dag.py stays at 100%.
  • pytest tests/regression --system benzaldehyde and --system methane (fast cases): existing baselines unchanged. In the new benzaldehyde case the computed σ is 2; with symmetry_number: 1 only residue:Orientational changes, from 20.48 to 26.24 J/mol/K, a difference of R ln 2.
  • pre-commit run --all-files and the docs build with -W pass.
  • Manual run: a negative value stops the run with ValueError: Invalid 'symmetry_number': -1. It must be an integer greater than or equal to 0.

Impact

  • No change to results unless symmetry_number is set.
  • One value applies to all molecule groups. A per-group or per-residue-name value could be added later if needed.

Checklist

  • Tests added or updated
  • Documentation updated
  • If dependencies in pyproject.toml changed, the lower bounds were reviewed deliberately (no dependency changes)

When set, the given symmetry number replaces the value computed by
`Neighbors.get_symmetry` for every molecule group. Unset keeps the
computed value. Negative or non-integer values are refused in
`validate_inputs`.
Adds unit tests for parsing, validation, the level DAG override and the
resulting orientational entropy, and a fast benzaldehyde regression case
with `symmetry_number: 1`.
@michalkrompiec
michalkrompiec marked this pull request as ready for review November 27, 2026 17:19

This branch has not been deployed

No deployments
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.

[Feature]: Option to set the symmetry number used in the orientational entropy

1 participant