88
99from typing import Any
1010
11- from CodeEntropy .levels .dihedrals import ConformationStateBuilder
11+ from CodeEntropy .levels .dihedrals .conformational_state_builder import (
12+ ConformationStateBuilder ,
13+ )
14+ from CodeEntropy .levels .execution .policy import ExecutionPolicy
1215from CodeEntropy .trajectory .frames import FrameSelection
1316
1417SharedData = dict [str , Any ]
@@ -20,9 +23,16 @@ class ConformationDAG:
2023 """Execute conformational-state construction for selected trajectory frames."""
2124
2225 def __init__ (self , universe_operations : Any | None = None ) -> None :
26+ """Initialize the conformational DAG.
27+
28+ Args:
29+ universe_operations: Optional universe-operation adapter passed to the
30+ underlying conformation-state builder.
31+ """
2332 self ._builder = ConformationStateBuilder (
2433 universe_operations = universe_operations
2534 )
35+ self ._policy = ExecutionPolicy ()
2636
2737 def build (self ) -> ConformationDAG :
2838 """Build the conformational DAG topology.
@@ -44,6 +54,7 @@ def execute(
4454 shared_data: Shared workflow data containing ``reduced_universe``,
4555 ``levels``, ``groups``, ``frame_selection``, and ``args.bin_width``.
4656 progress: Optional progress sink forwarded to the conformation builder.
57+
4758 Returns:
4859 A dictionary containing the computed ``conformational_states`` mapping.
4960 """
@@ -52,6 +63,10 @@ def execute(
5263 groups = shared_data ["groups" ]
5364 frame_selection : FrameSelection = shared_data ["frame_selection" ]
5465 bin_width = int (shared_data ["args" ].bin_width )
66+ chunk_size = self ._policy .frame_chunk_size (
67+ shared_data ,
68+ n_frames = frame_selection .n_frames ,
69+ )
5570
5671 states_ua , states_res , flexible_ua , flexible_res = (
5772 self ._builder .build_conformational_states (
@@ -61,6 +76,7 @@ def execute(
6176 bin_width = bin_width ,
6277 frame_selection = frame_selection ,
6378 progress = progress ,
79+ chunk_size = chunk_size ,
6480 )
6581 )
6682
0 commit comments