Skip to content

Refactor LevelManager and Modularize Hierarchical Entropy Computations #173

@harryswift01

Description

@harryswift01

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

  • Map current LevelManager methods to the proposed modular classes.
  • Implement LevelHierarchy to manage levels and beads.
  • Implement CoordinateSystem for axes and position calculations.
  • Implement StructuralAnalysis for dihedral and structural calculations.
  • Implement MatrixOperations for submatrix and matrix handling.
  • Implement ForceTorqueManager for weighted force and torque calculations.
  • Introduce DAG-based representation of levels and beads to pre-map dependencies.
  • Update LevelManager to coordinate modular components and DAG-based computation.
  • Unit test each new class independently.
  • Document new architecture and DAG-based workflow.

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions