-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Refactor AqueousEquilibrium in musica.mechanism_configuration to use composition instead of inheritance from _AqueousEquilibrium.
Acceptance Criteria
- The class no longer inherits from
_AqueousEquilibrium. - The internal C++ instance is held in
self._instance. - All properties (
name,aerosol_phase,aerosol_phase_water,reactants,products,A,C,k_reverse,other_properties) delegate to or updateself._instance. - Reactants and products use Python
SpeciesandPhaseobjects on the Python side and convert to/from C++_ReactionComponent. - The
serialize()method is converted from a static method to an instance method, operating solely on Python-visible data. - Public interface exposes only Python-native types, no direct C++ inheritance.
Ideas
- Use the
tuvx.pywrapper pattern as a model for composition. - Implement helper functions to convert between
Species/Phaseand_ReactionComponent. - Use
@propertydecorators for clean delegation of attributes. - Refactor
serialize()to eliminate static method usage. - Do the work similar to Refactor CondensedPhaseArrhenius to use composition instead of inheritance #461 Refactor Arrhenius class to use composition instead of inheritance #462, Refactor Troe class from inheritance to composition pattern #466, Refactor Branched class to use composition instead of inheritance #467
Tasks
- Remove inheritance from
_AqueousEquilibrium. - Add
self._instanceinitialized to_AqueousEquilibrium()inside__init__. - Forward all attribute access and mutations to
self._instancevia properties. - Convert reactants and products to Python objects on get, convert to C++ objects on set.
- Change
serialize()to an instance method accessing Python-side data. - Remove static
serialize()method and update callers accordingly.
Reactions are currently unavailable