-
Notifications
You must be signed in to change notification settings - Fork 2
Introduce Basic Orientational Entropy Calculations #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
eedd9d1
adding basic orientational entropy
skfegan 46f650e
Merge branch 'main' into 27-orientational-entropy
skfegan ab8ff89
fixing output formating for orientational entropy
skfegan 85d126a
adding documentation about orientational entropy
skfegan a694bd0
adding rdkit to pyproject.toml
skfegan 44bd758
tidy up code
skfegan 6c984e6
update regression test baselines
skfegan a06e379
removing redundant tests
skfegan c18e010
tests
skfegan b146c1b
more testing
skfegan 99aead1
tests: fix RDKit mocking in `_get_linear` tests
harryswift01 8f92ef7
include `rdkit` within `autodoc_mock_imports`
harryswift01 4b5d7f3
remove `search_object` argument from `get_grid_neighbors`
harryswift01 a3f0229
test for grid search
skfegan da86beb
Merge branch '27-orientational-entropy' of https://github.com/CCPBioS…
skfegan 260df88
fix type checking within `reporter.py` and `dihedrals`
harryswift01 851f6d5
fix(types): resolve Pylance optional access errors and tighten typing…
harryswift01 284ddc9
fix(types): allow optional dict by changing data to dict[str, Any] | …
harryswift01 734001d
fix(types): update `level_dag.py` to correct pylance typings
harryswift01 98b65e7
marking regression tests as slow except for dna which is quick
skfegan b98888b
ci(tests): remove pytest -q to show real-time test progress
harryswift01 72e3964
test(unit): add tests for `Neighbors.get_symmetry`
harryswift01 281fa2d
test(unit): add unit tests for `Neighbors._get_rdkit_mol`
harryswift01 da89675
test(unit): add branch coverage tests for Search neighbor methods
harryswift01 69dc68c
test(unit): add tests for `ForceTorqueCalculator._displacements_relat…
harryswift01 9b462c5
ci(tests): remove `timeout-minutes` from `weekly-regression.yaml`
harryswift01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| """Node for computing orientational entropy from neighbors.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| from typing import ( | ||
| Any, | ||
| Dict, | ||
| MutableMapping, | ||
| Sequence, | ||
| Tuple, | ||
| Union, | ||
| ) | ||
|
|
||
| import numpy as np | ||
|
|
||
| from CodeEntropy.entropy.orientational import OrientationalEntropy | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| GroupId = int | ||
| ResidueId = int | ||
| StateKey = Tuple[GroupId, ResidueId] | ||
| StateSequence = Union[Sequence[Any], np.ndarray] | ||
|
|
||
|
|
||
| class OrientationalEntropyNode: | ||
| """Compute orientational entropy using precomputed neighbors and symmetry. | ||
|
|
||
| This node reads number of neighbors and symmetry from ``shared_data`` and | ||
| computes entropy contributions at the molecular (highest) level. | ||
|
|
||
| Results are written back into ``shared_data["orientational_entropy"]``. | ||
| """ | ||
|
|
||
| def run(self, shared_data: MutableMapping[str, Any], **_: Any) -> Dict[str, Any]: | ||
| """Execute orientational entropy calculation. | ||
|
|
||
| Args: | ||
| shared_data: Shared workflow state dictionary. | ||
|
|
||
| Returns: | ||
| Dictionary containing orientational entropy results. | ||
|
|
||
| Raises: | ||
| KeyError: If required keys are missing. | ||
| """ | ||
| groups = shared_data["groups"] | ||
| levels = shared_data["levels"] | ||
| neighbors = shared_data["neighbors"] | ||
| symmetry_number = shared_data["symmetry_number"] | ||
| linear = shared_data["linear"] | ||
| reporter = shared_data.get("reporter") | ||
|
|
||
| oe = self._build_entropy_engine() | ||
|
|
||
| results: Dict[int, float] = {} | ||
|
|
||
| for group_id, mol_ids in groups.items(): | ||
| rep_mol_id = mol_ids[0] | ||
| highest_level = levels[rep_mol_id][-1] | ||
|
|
||
| neighbor = neighbors[group_id] | ||
| symmetry = symmetry_number[group_id] | ||
| line = linear[group_id] | ||
|
|
||
| result_value = oe.calculate_orientational( | ||
| neighbor, | ||
| symmetry, | ||
| line, | ||
| ) | ||
| results[group_id] = result_value | ||
|
|
||
| if reporter is not None: | ||
| reporter.add_results_data( | ||
| group_id, highest_level, "Orientational", result_value | ||
| ) | ||
|
|
||
| shared_data["orientational_entropy"] = results | ||
|
|
||
| return {"orientational_entropy": results} | ||
|
|
||
| def _build_entropy_engine(self) -> OrientationalEntropy: | ||
| """Create the entropy calculation engine.""" | ||
| return OrientationalEntropy() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.