Description:
This task executes a major architectural refactor to distinguish between the chemical connectivity provided by the user and the physical force field topology required for simulation. Currently, "Aromatic" is treated as a bond type that persists through the pipeline, and resonance detection relies on a broad, third-party algorithm that often over-assigns conjugation. This update separates InputBondOrder from TopologyBondOrder, ensuring that "Resonant" bonds are treated strictly as a derived property. Furthermore, the resonance perception logic will be rewritten to remove external dependencies and rely on a strict "allowlist" of motifs (Aromatic systems, Carboxylates, Nitro groups, Guanidinium, and Amides). This ensures that only chemically significant delocalization results in a partial bond order in the final topology.
Tasks:
Description:
This task executes a major architectural refactor to distinguish between the chemical connectivity provided by the user and the physical force field topology required for simulation. Currently, "Aromatic" is treated as a bond type that persists through the pipeline, and resonance detection relies on a broad, third-party algorithm that often over-assigns conjugation. This update separates
InputBondOrderfromTopologyBondOrder, ensuring that "Resonant" bonds are treated strictly as a derived property. Furthermore, the resonance perception logic will be rewritten to remove external dependencies and rely on a strict "allowlist" of motifs (Aromatic systems, Carboxylates, Nitro groups, Guanidinium, and Amides). This ensures that only chemically significant delocalization results in a partial bond order in the final topology.Tasks:
Phase 1: Refactor Core Data Structures
src/core/properties.rs, replace the singleBondOrderenum with two distinct types:InputBondOrder: VariantsSingle,Double,Triple,Aromatic. Used byMolecularGraph.TopologyBondOrder: VariantsSingle,Double,Triple,Resonant. Used byMolecularTopology.src/core/graph.rsto useInputBondOrderinMolecularGraphandBondEdge.src/core/graph.rsto useTopologyBondOrderin the finalBondstruct withinMolecularTopology.src/perception/model.rssoAnnotatedMoleculeusesInputBondOrder(or a Kekulized equivalent) for internal adjacency, while preparing to store resonance metadata separately.Phase 2: Reimplement Resonance Perception
paulingcrate dependency fromCargo.toml.src/perception/model.rs, add aresonance_systems: Vec<ResonanceSystem>field toAnnotatedMolecule. AResonanceSystemshould track both atom IDs and bond IDs involved.src/perception/resonance.rsto implement Strict Resonance Detection:C(=O)O-motifs.N(=O)O-motifs.C(N)3+motifs.O=C-Nmotifs.is_in_conjugated_systemandis_resonantatom flags are updated based solely on membership in these strict systems.Phase 3: Upgrade Topology Builder
src/builder/mod.rs, update thebuild_bondsfunction.ResonanceSystemidentified in Phase 2.TopologyBondOrder::Resonant.InputBondOrder(Single/Double/Triple) to the correspondingTopologyBondOrder.Phase 4: Verification and Cleanup
tests/cases/to use the newInputBondOrderenum variants in their blueprints.Resonantbonds within rings but aSinglebond between rings.Resonantbond orders in the final topology.