Skip to content

Commit 5010a8c

Browse files
committed
update execute() within entropy_manager.py to use DAG system
1 parent 03c3fe5 commit 5010a8c

1 file changed

Lines changed: 29 additions & 73 deletions

File tree

‎CodeEntropy/entropy/entropy_manager.py‎

Lines changed: 29 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
)
1414

1515
from CodeEntropy.config.logging_config import LoggingConfig
16+
from CodeEntropy.entropy.entropy_graph import EntropyGraph
17+
from CodeEntropy.levels.hierarchy_graph import LevelGraph
1618

1719
logger = logging.getLogger(__name__)
1820
console = LoggingConfig.get_console()
@@ -59,44 +61,28 @@ def __init__(
5961

6062
def execute(self):
6163
"""
62-
Run the full entropy computation workflow.
63-
64-
This method orchestrates the entire entropy analysis pipeline, including:
65-
- Handling water entropy if present.
66-
- Initializing molecular structures and levels.
67-
- Building force and torque covariance matrices.
68-
- Computing vibrational and conformational entropies.
69-
- Finalizing and logging results.
64+
Run the full entropy computation workflow using the DAG system.
65+
66+
Workflow:
67+
1. Parse trajectory frame bounds
68+
2. Build reduced universe
69+
3. Detect molecules + levels
70+
4. Run LEVEL DAG
71+
5. Run ENTROPY DAG
72+
6. Log and store results
7073
"""
71-
# Set up initial information
7274
start, end, step = self._get_trajectory_bounds()
7375
number_frames = self._get_number_frames(start, end, step)
7476

7577
console.print(
7678
f"Analyzing a total of {number_frames} frames in this calculation."
7779
)
7880

79-
# ve = VibrationalEntropy(
80-
# self._run_manager,
81-
# self._args,
82-
# self._universe,
83-
# self._data_logger,
84-
# self._level_manager,
85-
# self._group_molecules,
86-
# )
87-
# ce = ConformationalEntropy(
88-
# self._run_manager,
89-
# self._args,
90-
# self._universe,
91-
# self._data_logger,
92-
# self._level_manager,
93-
# self._group_molecules,
94-
# )
95-
9681
reduced_atom, number_molecules, levels, groups = self._initialize_molecules()
97-
logger.debug(f"Universe 3: {reduced_atom}")
82+
logger.debug(f"[EntropyManager] Reduced universe loaded: {reduced_atom}")
83+
9884
water_atoms = self._universe.select_atoms("water")
99-
water_resids = set(res.resid for res in water_atoms.residues)
85+
water_resids = {res.resid for res in water_atoms.residues}
10086

10187
water_groups = {
10288
gid: g
@@ -116,52 +102,22 @@ def execute(self):
116102
else:
117103
nonwater_groups.update(water_groups)
118104

119-
force_matrices, torque_matrices, frame_counts = (
120-
self._level_manager.build_covariance_matrices(
121-
self,
122-
reduced_atom,
123-
levels,
124-
nonwater_groups,
125-
start,
126-
end,
127-
step,
128-
number_frames,
129-
self._args.force_partitioning,
130-
)
131-
)
105+
shared_data = {
106+
"universe": self._universe,
107+
"reduced_universe": reduced_atom,
108+
"levels": levels,
109+
"groups": nonwater_groups,
110+
"args": self._args,
111+
"start": start,
112+
"end": end,
113+
"step": step,
114+
"n_frames": number_frames,
115+
}
116+
117+
level_results = LevelGraph().build().execute(shared_data)
118+
entropy_results = EntropyGraph().build().execute(level_results)
132119

133-
# # Identify the conformational states from dihedral angles for the
134-
# # conformational entropy calculations
135-
# states_ua, states_res = self._level_manager.build_conformational_states(
136-
# self,
137-
# reduced_atom,
138-
# levels,
139-
# nonwater_groups,
140-
# start,
141-
# end,
142-
# step,
143-
# number_frames,
144-
# self._args.bin_width,
145-
# ce,
146-
# )
147-
148-
# # Complete the entropy calculations
149-
# self._compute_entropies(
150-
# reduced_atom,
151-
# levels,
152-
# nonwater_groups,
153-
# force_matrices,
154-
# torque_matrices,
155-
# states_ua,
156-
# states_res,
157-
# frame_counts,
158-
# number_frames,
159-
# ve,
160-
# ce,
161-
# )
162-
163-
# Print the results in a nicely formated way
164-
self._finalize_molecule_results()
120+
self._finalize_outputs(entropy_results)
165121
self._data_logger.log_tables()
166122

167123
def _handle_water_entropy(self, start, end, step, water_groups):

0 commit comments

Comments
 (0)