Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CodeEntropy/entropy/nodes/configurational.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self, shared_data: MutableMapping[str, Any], **_: Any) -> dict[str, Any]
fragments = universe.atoms.fragments
results: dict[int, dict[str, float]] = {}

for group_id, mol_ids in groups.items():
for group_id, mol_ids in sorted(groups.items()):
results[group_id] = {"ua": 0.0, "res": 0.0, "poly": 0.0}
if not mol_ids:
continue
Expand Down
2 changes: 1 addition & 1 deletion CodeEntropy/entropy/nodes/orientational.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run(self, shared_data: MutableMapping[str, Any], **_: Any) -> dict[str, Any]

results: dict[int, float] = {}

for group_id, mol_ids in groups.items():
for group_id, mol_ids in sorted(groups.items()):
results[group_id] = 0
if not mol_ids:
continue
Expand Down
4 changes: 2 additions & 2 deletions CodeEntropy/entropy/nodes/vibrational.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def run(self, shared_data: MutableMapping[str, Any], **_: Any) -> dict[str, Any]

results: dict[int, dict[str, dict[str, float]]] = {}

for group_id, mol_ids in groups.items():
for group_id, mol_ids in sorted(groups.items()):
results[group_id] = {}
if not mol_ids:
continue
Expand Down Expand Up @@ -198,7 +198,7 @@ def _get_group_id_to_index(self, shared_data: Mapping[str, Any]) -> dict[int, in
if isinstance(gid2i, dict) and gid2i:
return gid2i
groups = shared_data["groups"]
return {gid: i for i, gid in enumerate(groups.keys())}
return {gid: i for i, gid in enumerate(sorted(groups.keys()))}

def _get_ua_frame_counts(self, shared_data: Mapping[str, Any]) -> dict[CovKey, int]:
"""Extract per-(group,residue) frame counts for united-atom covariances.
Expand Down
6 changes: 3 additions & 3 deletions CodeEntropy/entropy/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ def _split_water_groups(

water_groups = {
gid: mol_ids
for gid, mol_ids in groups.items()
for gid, mol_ids in sorted(groups.items())
if any(
res.resid in water_resids
for mol in [universe.atoms.fragments[i] for i in mol_ids]
for res in mol.residues
)
}
nonwater_groups = {
gid: g for gid, g in groups.items() if gid not in water_groups
gid: g for gid, g in sorted(groups.items()) if gid not in water_groups
}
return nonwater_groups, water_groups

Expand Down Expand Up @@ -354,7 +354,7 @@ def _finalize_molecule_results(self) -> None:
except (TypeError, ValueError):
logger.warning("Skipping invalid entry: %s, %s", group_id, result)

for group_id, total in entropy_by_group.items():
for group_id, total in sorted(entropy_by_group.items()):
self._reporter.molecule_data.append(
(group_id, "Group Total", "Group Total Entropy", total)
)
Expand Down
2 changes: 1 addition & 1 deletion CodeEntropy/levels/nodes/covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def run(self, ctx: FrameCtx) -> dict[str, Any]:
res_molcount: dict[int, int] = {}
poly_molcount: dict[int, int] = {}

for group_id, mol_ids in groups.items():
for group_id, mol_ids in sorted(groups.items()):
for mol_id in mol_ids:
mol = fragments[mol_id]
level_list = levels[mol_id]
Expand Down
4 changes: 2 additions & 2 deletions CodeEntropy/results/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ def _build_grouped_payload(
key = f"{level}:{typ}"
groups[gid]["components"][key] = val

for _gid, g in groups.items():
for g in groups.values():
if g["total"] is None:
comps = g["components"].values()
comps = sorted(g["components"].values())
g["total"] = float(sum(comps)) if comps else 0.0

payload: dict[str, Any] = {
Expand Down
26 changes: 13 additions & 13 deletions tests/regression/baselines/ethyl-acetate/axes_off.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"args": {
"top_traj_file": [
"/home/harry-swift/BioSim/software/CodeEntropy/.testdata/benzaldehyde/molecules.top",
"/home/harry-swift/BioSim/software/CodeEntropy/.testdata/benzaldehyde/trajectory.crd"
"/home/harry-swift/BioSim/software/CodeEntropy/.testdata/ethyl-acetate/molecules.top",
"/home/harry-swift/BioSim/software/CodeEntropy/.testdata/ethyl-acetate/trajectory.crd"
],
"force_file": "/home/harry-swift/BioSim/software/CodeEntropy/.testdata/benzaldehyde/forces.frc",
"force_file": "/home/harry-swift/BioSim/software/CodeEntropy/.testdata/ethyl-acetate/forces.frc",
"file_format": "MDCRD",
"kcal_force_units": true,
"selection_string": "resid 1:10",
Expand All @@ -14,7 +14,7 @@
"bin_width": 30,
"temperature": 298.0,
"verbose": false,
"output_file": "/tmp/pytest-of-harry-swift/pytest-47/test_regression_matches_baseli0/job001/output_file.json",
"output_file": "/tmp/pytest-of-harry-swift/pytest-1/popen-gw0/test_regression_matches_baseli0/job001/output_file.json",
"force_partitioning": 0.5,
"water_entropy": true,
"grouping": "molecules",
Expand All @@ -24,22 +24,22 @@
},
"provenance": {
"python": "3.14.3",
"platform": "Linux-6.17.0-19-generic-x86_64-with-glibc2.39",
"platform": "Linux-6.17.0-20-generic-x86_64-with-glibc2.39",
"codeentropy_version": "2.1.0",
"git_sha": "be46d826f4ae38e3c6e62a7d5bcddeca85e31590"
"git_sha": "35b54c7d4ea40dac345db7fe8f6a0285bf6852e8"
},
"groups": {
"0": {
"components": {
"united_atom:Transvibrational": 0.08982962903796131,
"united_atom:Rovibrational": 32.16018134884085,
"residue:FTmat-Transvibrational": 88.7671666695003,
"residue:FTmat-Rovibrational": 61.61036267672132,
"united_atom:Conformational": 0.0,
"united_atom:Transvibrational": 1.2655393305199973,
"united_atom:Rovibrational": 68.85184585731292,
"residue:FTmat-Transvibrational": 77.33844477785695,
"residue:FTmat-Rovibrational": 56.03921993686319,
"united_atom:Conformational": 8.140778318198597,
"residue:Conformational": 0.0,
"residue:Orientational": 7.791711490122748
"residue:Orientational": 3.2718547817092687
},
"total": 190.41925181422317
"total": 214.9076830024609
}
}
}
6 changes: 3 additions & 3 deletions tests/regression/configs/ethyl-acetate/axes_off.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---

run1:
force_file: ".testdata/benzaldehyde/forces.frc"
force_file: ".testdata/ethyl-acetate/forces.frc"
top_traj_file:
- ".testdata/benzaldehyde/molecules.top"
- ".testdata/benzaldehyde/trajectory.crd"
- ".testdata/ethyl-acetate/molecules.top"
- ".testdata/ethyl-acetate/trajectory.crd"
selection_string: "resid 1:10"
start: 0
end: 1
Expand Down
Loading