11"""Hierarchy-level DAG orchestration.
22
33LevelDAG owns hierarchy-level workflow order. Static setup nodes prepare
4- structural and conformational data, then frame-local covariance and neighbour
5- observables are executed through deterministic frame map-reduce .
4+ structural data. ConformationDAG computes trajectory-series conformational
5+ states. FrameScheduler executes frame-local covariance and neighbour work .
66"""
77
88from __future__ import annotations
1212import networkx as nx
1313
1414from CodeEntropy .levels .axes import AxesCalculator
15+ from CodeEntropy .levels .conformation_dag import ConformationDAG
1516from CodeEntropy .levels .execution .policy import ExecutionPolicy
1617from CodeEntropy .levels .execution .reducers import NeighborReducer
1718from CodeEntropy .levels .execution .scheduler import FrameScheduler
1819from CodeEntropy .levels .frame_dag import FrameGraph
1920from CodeEntropy .levels .neighbors import Neighbors
2021from CodeEntropy .levels .nodes .accumulators import InitCovarianceAccumulatorsNode
2122from CodeEntropy .levels .nodes .beads import BuildBeadsNode
22- from CodeEntropy .levels .nodes .conformations import ComputeConformationalStatesNode
2323from CodeEntropy .levels .nodes .detect_levels import DetectLevelsNode
2424from CodeEntropy .levels .nodes .detect_molecules import DetectMoleculesNode
2525from CodeEntropy .results .reporter import _RichProgressSink
@@ -38,15 +38,14 @@ def __init__(self, universe_operations: Any | None = None) -> None:
3838 self ._universe_operations = universe_operations
3939 self ._static_graph = nx .DiGraph ()
4040 self ._static_nodes : dict [str , Any ] = {}
41+ self ._conformation_dag = ConformationDAG (
42+ universe_operations = universe_operations
43+ )
4144 self ._frame_dag = FrameGraph (universe_operations = universe_operations )
4245 self ._policy = ExecutionPolicy ()
4346
4447 def build (self ) -> LevelDAG :
45- """Build static and frame-level DAG topology.
46-
47- Returns:
48- The current ``LevelDAG`` instance for fluent construction.
49- """
48+ """Build the static, conformation, and frame DAG topology."""
5049 self ._add_static ("detect_molecules" , DetectMoleculesNode ())
5150 self ._add_static ("detect_levels" , DetectLevelsNode (), deps = ["detect_molecules" ])
5251 self ._add_static ("build_beads" , BuildBeadsNode (), deps = ["detect_levels" ])
@@ -55,12 +54,8 @@ def build(self) -> LevelDAG:
5554 InitCovarianceAccumulatorsNode (),
5655 deps = ["detect_levels" ],
5756 )
58- self ._add_static (
59- "compute_conformational_states" ,
60- ComputeConformationalStatesNode (self ._universe_operations ),
61- deps = ["detect_levels" ],
62- )
6357
58+ self ._conformation_dag .build ()
6459 self ._frame_dag .build ()
6560 return self
6661
@@ -87,6 +82,8 @@ def execute(
8782 shared_data .setdefault ("axes_manager" , AxesCalculator ())
8883
8984 self ._run_static_stage (shared_data , progress = progress )
85+ self ._run_conformation_stage (shared_data , progress = progress )
86+
9087 self ._initialise_neighbor_metadata (shared_data )
9188 NeighborReducer .initialise (shared_data )
9289 self ._run_frame_stage (shared_data , progress = progress )
@@ -137,6 +134,15 @@ def _add_static(
137134 for dep in deps or []:
138135 self ._static_graph .add_edge (dep , name )
139136
137+ def _run_conformation_stage (
138+ self ,
139+ shared_data : dict [str , Any ],
140+ * ,
141+ progress : _RichProgressSink | None = None ,
142+ ) -> None :
143+ """Run conformational-state construction after static setup."""
144+ self ._conformation_dag .execute (shared_data , progress = progress )
145+
140146 def _run_frame_stage (
141147 self ,
142148 shared_data : dict [str , Any ],
0 commit comments