Description
The current LevelManager class has grown too large and handles multiple responsibilities, including managing levels, beads, coordinates, dihedrals, matrices, forces, and torques. This makes the code difficult to maintain, test, and extend.
This task aims to modularize the class into focused components and introduce a graph/DAG-based representation of hierarchical dependencies. This will simplify computations, reduce repeated loops, and make it easier to add new entropy estimates in the future.
Scope
- Split
LevelManager into multiple classes:
LevelHierarchy: manages levels and beads.
CoordinateSystem: computes axes, average positions, and coordinate transformations.
StructuralAnalysis: handles dihedrals and structural metrics.
MatrixOperations: handles submatrices and matrix utilities.
ForceTorqueManager: calculates weighted forces and torques.
- Implement a DAG-based computation order for hierarchical entropy calculations.
- Refactor existing methods into these classes without changing external behavior.
- Ensure
LevelManager acts only as a coordinator.
- Update internal documentation and APIs.
Tasks
Benefits
- Single Responsibility Principle: Each class has one clear responsibility.
- Testability: Easier to write unit tests and verify calculations.
- Maintainability: Refactoring or adding new features is safer and easier.
- Scalability: DAG ensures correct computation order and reduces redundant calculations.
- Future-Proofing: Adding new entropy estimates is straightforward using existing modular classes and DAG traversal.
Description
The current
LevelManagerclass has grown too large and handles multiple responsibilities, including managing levels, beads, coordinates, dihedrals, matrices, forces, and torques. This makes the code difficult to maintain, test, and extend.This task aims to modularize the class into focused components and introduce a graph/DAG-based representation of hierarchical dependencies. This will simplify computations, reduce repeated loops, and make it easier to add new entropy estimates in the future.
Scope
LevelManagerinto multiple classes:LevelHierarchy: manages levels and beads.CoordinateSystem: computes axes, average positions, and coordinate transformations.StructuralAnalysis: handles dihedrals and structural metrics.MatrixOperations: handles submatrices and matrix utilities.ForceTorqueManager: calculates weighted forces and torques.LevelManageracts only as a coordinator.Tasks
LevelManagermethods to the proposed modular classes.LevelHierarchyto manage levels and beads.CoordinateSystemfor axes and position calculations.StructuralAnalysisfor dihedral and structural calculations.MatrixOperationsfor submatrix and matrix handling.ForceTorqueManagerfor weighted force and torque calculations.LevelManagerto coordinate modular components and DAG-based computation.Benefits