Weighted Resonance / HEG Experiment
This is a code-side experiment. It treats resonance as a finite weighted family of localized graph states, then computes observables that survive, or disappear, under averaging. Most legacy cards can be clicked to switch between EFG and refined HEG views; cards labelled native HEG are generated directly from HalfEdgeMol objects.
visual proof from executable graph objects
The polar recombination rule is unavailable on the covalent contributor and available only on the two ionic contributors. The two ionic branches coalesce to the same covalent H-H product.
Atom moments
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 H | 0 | 0.5 | 0.25 | 0 |
| 2 H | 0 | 0.5 | 0.25 | 0 |
Charge covariance
| Cov(q) | 1 H | 2 H |
| 1 H | 0.5 | -0.5 |
| 2 H | -0.5 | 0.5 |
Bond moments
| pair | <bond order> | Var(bond order) |
| 1-2 | 0.5 | 0.25 |
Constructor checks
same labels: truesame sigma skeleton: falsesame total q: truesame electrons: true
| contributor | weight | total q | electrons | admissible | strict | violations |
| covalent | 0.5 | 0 | 2 | true | true | 0 |
| ionic_h1_minus_h2_plus | 0.25 | 0 | 2 | false | false | 1 |
| ionic_h1_plus_h2_minus | 0.25 | 0 | 2 | false | false | 1 |
Contributors
h2_charge_shift_toy / covalent (w=0.5)click image to switch EFG / HEG
h2_charge_shift_toy / ionic_h1_minus_h2_plus (w=0.25)click image to switch EFG / HEG
h2_charge_shift_toy / ionic_h1_plus_h2_minus (w=0.25)click image to switch EFG / HEG
Rule
The executable rule is drawn here as its toy graph schema. It consumes one lone pair on a formally negative donor and creates one shared pair to a formally positive acceptor.
Rule L: H- + H+click image to switch EFG / HEG
Rule K: two atom interfaceclick image to switch EFG / HEG
Rule R: H-H shared pairclick image to switch EFG / HEG
Fitting reference. The directly matching chemical motivation is charge-shift bonding: covalent and ionic VB structures are not merely averaged away; their resonance interaction is the chemically relevant object. See Shaik et al.,
Charge-Shift Bonding: A New and Unique Form of Bonding, Angew. Chem. Int. Ed. 59, 984-1001, DOI
10.1002/anie.201910085. The local background PDF
shaik_danovich_hiberty_2021_valence_bond_theory.pdf supplies the broader VB/Lewis context.
Minimal Julia
p = charge_shift_presentation()
rule = ionic_pair_recombination_rule()
push = product_pushforward(p, rule)
classes = coalesce_products(push.raw_products)
Polar rule availability
| rule | available weight | weighted matches | matches by contributor |
| ionic_pair_recombination | 0.5 | 0.5 | covalent: 0; ionic_h1_minus_h2_plus: 1; ionic_h1_plus_h2_minus: 1 |
Push-forward and coalescing
available weight0.5
unavailable weight0.5
raw branches2
coalesced classes1
| class | weight | branches | contributors | rules | same product reached twice? |
| 1 | 0.5 | 2 | ionic_h1_minus_h2_plus, ionic_h1_plus_h2_minus | ionic_pair_recombination | true |
charge_shift product class 1 (w=0.5)click image to switch EFG / HEG
Conclusion. The averaged formal charges are zero, but the weighted family still contains reactive ionic branches. Rule availability and product push-forward expose that hidden structure: only weight 0.5 reacts, and both reactive branches collapse to the same H-H product class.
This example is less about hidden selectivity and more about closure of a localized resonance family. The allyl radical shift moves the radical between terminal carbons while moving the pi bond; the weighted presentation then reports terminal radical density 0.5/0.5 and C-C bond orders 1.5/1.5.
Fitting reference. Linares, Humbel, and Braida apply a Lewis-structure-based valence-bond scheme to allyl ions and radical. See
The Nature of Resonance in Allyl Ions and Radical, J. Phys. Chem. A 112, 13249-13255, DOI
10.1021/jp8038169. The local PDF is
linares_humbel_braida_2008_resonance_allyl_ions_radical.pdf.
Allyl radical shift rule
The displayed rule shifts one electron-pair feature and one radical feature. The opposite shift is the inverse rule with L and R exchanged.
Rule L: pi left, radical rightclick image to switch EFG / HEG
Rule K: sigma skeletonclick image to switch EFG / HEG
Rule R: radical left, pi rightclick image to switch EFG / HEG
Minimal Julia
p = allyl_radical_presentation()
rules = [ER.allyl_shift_left_rule(), ER.allyl_shift_right_rule()]
push = product_pushforward(p, rules)
classes = coalesce_products(push.raw_products)
Radical-shift push-forward
| rule | available weight | weighted matches | matches by contributor |
| allyl_radical_shift_left | 1 | 1 | radical_right: 1; radical_left: 1 |
| allyl_radical_shift_right | 1 | 1 | radical_right: 1; radical_left: 1 |
available weight1
unavailable weight0
raw branches4
coalesced classes1
| class | weight | branches | contributors | rules | same product reached twice? |
| 1 | 1 | 4 | radical_left, radical_right | allyl_radical_shift_left, allyl_radical_shift_right | true |
allyl_radical product class 1 (w=1)click image to switch EFG / HEG
Executable trapping example
To make executability matter, the allyl system is made asymmetric and given an external methyl radical trap. Now the same radical recombination rule produces two non-isomorphic regioisomeric product classes.
Rule L: two carbon radicalsclick image to switch EFG / HEG
Rule K: atom interfaceclick image to switch EFG / HEG
Rule R: new C-C pairclick image to switch EFG / HEG
EFG trapping code
p = substituted_allyl_methyl_trap_presentation()
rule = ER.radical_recombination_rule()
push = product_pushforward(p, rule)
classes = coalesce_products(push.raw_products)
Trapping observables
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 C | 0 | 0 | 0 | 0.5 |
| 2 C | 0 | 0 | 0 | 0 |
| 3 C | 0 | 0 | 0 | 0.5 |
| 4 Cl | 6 | 0 | 0 | 0 |
| 5 H | 0 | 0 | 0 | 0 |
| 6 H | 0 | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 | 0 |
| 9 C | 0 | 0 | 0 | 1 |
| 10 H | 0 | 0 | 0 | 0 |
| 11 H | 0 | 0 | 0 | 0 |
| 12 H | 0 | 0 | 0 | 0 |
| pair | <bond order> | Var(bond order) |
| 1-2 | 1.5 | 0.25 |
| 1-4 | 1 | 0 |
| 1-5 | 1 | 0 |
| 2-3 | 1.5 | 0.25 |
| 2-6 | 1 | 0 |
| 3-7 | 1 | 0 |
| 3-8 | 1 | 0 |
| 9-10 | 1 | 0 |
| 9-11 | 1 | 0 |
| 9-12 | 1 | 0 |
Trapping checks
same labels: truesame sigma skeleton: truesame total q: truesame electrons: true
| contributor | weight | total q | electrons | admissible | strict | violations |
| left_radical | 0.5 | 6 | 24 | false | false | 3 |
| right_radical | 0.5 | 6 | 24 | false | false | 3 |
Trapping contributors
substituted_allyl_methyl_trap / left_radical (w=0.5)click image to switch EFG / HEG
substituted_allyl_methyl_trap / right_radical (w=0.5)click image to switch EFG / HEG
Trapping push-forward
| rule | available weight | weighted matches | matches by contributor |
| radical_recombination | 1 | 2 | left_radical: 2; right_radical: 2 |
available weight1
unavailable weight0
raw branches4
coalesced classes2
| class | weight | branches | contributors | rules | same product reached twice? |
| 1 | 0.5 | 2 | left_radical | radical_recombination | false |
| 2 | 0.5 | 2 | right_radical | radical_recombination | false |
substituted_allyl_trap product class 1 (w=0.5)click image to switch EFG / HEG
substituted_allyl_trap product class 2 (w=0.5)click image to switch EFG / HEG
Native HEG execution
This is the native HEG version. The contributors, rule, matches, products, and product coalescing below are HalfEdgeMol objects and use half_edge_cat(), not EFG execution with an HEG rendering.
Native HEG rule L: two unpaired half-edgesnative HEG
Native HEG rule K: preserved half-edgesnative HEG
Native HEG rule R: new pair objectnative HEG
Native HEG code
include("ElectronHEGResonance.jl")
using .ElectronHEGResonance
p = native_substituted_allyl_methyl_trap_presentation()
rule = HEG.native_radical_recombination_rule()
push = native_product_pushforward(p, rule)
classes = native_coalesce_products(push.raw_products)
Native HEG observables
| atom | <q> | lone pairs | radicals |
| 1 C | 0 | 0 | 0.5 |
| 2 C | 0 | 0 | 0 |
| 3 C | 0 | 0 | 0.5 |
| 4 Cl | 6 | 0 | 0 |
| 5 H | 0 | 0 | 0 |
| 6 H | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 |
| 9 C | 0 | 0 | 1 |
| 10 H | 0 | 0 | 0 |
| 11 H | 0 | 0 | 0 |
| 12 H | 0 | 0 | 0 |
| pair | <bond order> |
| 1-2 | 1.5 |
| 1-4 | 1 |
| 1-5 | 1 |
| 2-3 | 1.5 |
| 2-6 | 1 |
| 3-7 | 1 |
| 3-8 | 1 |
| 9-10 | 1 |
| 9-11 | 1 |
| 9-12 | 1 |
Native HEG push-forward
| native HEG rule | available weight | weighted matches | matches by contributor |
| native_radical_recombination | 1 | 2 | left_radical: 2; right_radical: 2 |
available weight1
unavailable weight0
raw branches4
coalesced classes2
| class | weight | branches | contributors | rules | same product reached twice? |
| 1 | 0.5 | 2 | left_radical | native_radical_recombination | false |
| 2 | 0.5 | 2 | right_radical | native_radical_recombination | false |
Native HEG contributors
native_substituted_allyl_methyl_trap / left_radical (w=0.5)native HEG
native_substituted_allyl_methyl_trap / right_radical (w=0.5)native HEG
Native HEG product classes
native_substituted_allyl_trap native product class 1 (w=0.5)native HEG
native_substituted_allyl_trap native product class 2 (w=0.5)native HEG
Allyl radical observables
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 C | 0 | 0 | 0 | 0.5 |
| 2 C | 0 | 0 | 0 | 0 |
| 3 C | 0 | 0 | 0 | 0.5 |
| 4 H | 0 | 0 | 0 | 0 |
| 5 H | 0 | 0 | 0 | 0 |
| 6 H | 0 | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 | 0 |
| pair | <bond order> | Var(bond order) |
| 1-2 | 1.5 | 0.25 |
| 1-4 | 1 | 0 |
| 1-5 | 1 | 0 |
| 2-3 | 1.5 | 0.25 |
| 2-6 | 1 | 0 |
| 3-7 | 1 | 0 |
| 3-8 | 1 | 0 |
Rule availability
| rule | available weight | weighted matches | matches by contributor |
| allyl_radical_shift_left | 1 | 1 | radical_right: 1; radical_left: 1 |
| allyl_radical_shift_right | 1 | 1 | radical_right: 1; radical_left: 1 |
allyl_radical / radical_right (w=0.5)click image to switch EFG / HEG
allyl_radical / radical_left (w=0.5)click image to switch EFG / HEG
Allyl cation
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 C | 0.5 | 0.25 | 0 | 0 |
| 2 C | 0 | 0 | 0 | 0 |
| 3 C | 0.5 | 0.25 | 0 | 0 |
| 4 H | 0 | 0 | 0 | 0 |
| 5 H | 0 | 0 | 0 | 0 |
| 6 H | 0 | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 | 0 |
| pair | <bond order> | Var(bond order) |
| 1-2 | 1.5 | 0.25 |
| 1-4 | 1 | 0 |
| 1-5 | 1 | 0 |
| 2-3 | 1.5 | 0.25 |
| 2-6 | 1 | 0 |
| 3-7 | 1 | 0 |
| 3-8 | 1 | 0 |
allyl_cation / cation_left (w=0.5)click image to switch EFG / HEG
allyl_cation / cation_right (w=0.5)click image to switch EFG / HEG
Allyl anion
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 C | -0.5 | 0.25 | 0.5 | 0 |
| 2 C | 0 | 0 | 0 | 0 |
| 3 C | -0.5 | 0.25 | 0.5 | 0 |
| 4 H | 0 | 0 | 0 | 0 |
| 5 H | 0 | 0 | 0 | 0 |
| 6 H | 0 | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 | 0 |
| pair | <bond order> | Var(bond order) |
| 1-2 | 1.5 | 0.25 |
| 1-4 | 1 | 0 |
| 1-5 | 1 | 0 |
| 2-3 | 1.5 | 0.25 |
| 2-6 | 1 | 0 |
| 3-7 | 1 | 0 |
| 3-8 | 1 | 0 |
allyl_anion / anion_left (w=0.5)click image to switch EFG / HEG
allyl_anion / anion_right (w=0.5)click image to switch EFG / HEG
Conclusion. Plain allyl shifting is mostly a closure sanity check. The asymmetric trapping variant is the first useful executable result: radical density is converted into explicit product classes. The push-forward has available weight 1, four raw branches, and two non-isomorphic coalesced products with weights 0.5 and 0.5.
The ylide proton-transfer rule and azo proton-transfer rule are distinct localized DPO spans. In this weighted presentation, both routes reach one protonated intermediate product class.
Diazomethane observables
| atom | <q> | Var(q) | lone pairs | radicals |
| 1 C | -0.5 | 0.25 | 0.5 | 0 |
| 2 N | 1 | 0 | 0 | 0 |
| 3 N | -0.5 | 0.25 | 1.5 | 0 |
| 4 H | 0 | 0 | 0 | 0 |
| 5 H | 0 | 0 | 0 | 0 |
| 6 C | 0 | 0 | 0 | 0 |
| 7 H | 0 | 0 | 0 | 0 |
| 8 H | 0 | 0 | 0 | 0 |
| 9 H | 0 | 0 | 0 | 0 |
| 10 C | 0 | 0 | 0 | 0 |
| 11 O | 0 | 0 | 2 | 0 |
| 12 O | 0 | 0 | 2 | 0 |
| 13 H | 0 | 0 | 0 | 0 |
| pair | <bond order> | Var(bond order) |
| 1-2 | 1.5 | 0.25 |
| 1-4 | 1 | 0 |
| 1-5 | 1 | 0 |
| 2-3 | 2.5 | 0.25 |
| 6-7 | 1 | 0 |
| 6-8 | 1 | 0 |
| 6-9 | 1 | 0 |
| 6-10 | 1 | 0 |
| 10-11 | 2 | 0 |
| 10-12 | 1 | 0 |
| 12-13 | 1 | 0 |
Checks
same labels: truesame sigma skeleton: truesame total q: truesame electrons: true
| contributor | weight | total q | electrons | admissible | strict | violations |
| diazo_ylide | 0.5 | 0 | 40 | true | true | 0 |
| azo_form | 0.5 | 0 | 40 | true | true | 0 |
Contributors
diazomethane_acid_forms / diazo_ylide (w=0.5)click image to switch EFG / HEG
diazomethane_acid_forms / azo_form (w=0.5)click image to switch EFG / HEG
Rule availability
| rule | available weight | weighted matches | matches by contributor |
| diazomethane_proton_transfer | 0.5 | 3 | diazo_ylide: 6; azo_form: 0 |
| diazomethane_azo_proton_transfer | 0.5 | 4 | diazo_ylide: 0; azo_form: 8 |
Push-forward and coalescing
available weight1
unavailable weight0
raw branches14
coalesced classes1
| class | weight | branches | contributors | rules | same product reached twice? |
| 1 | 1 | 14 | azo_form, diazo_ylide | diazomethane_azo_proton_transfer, diazomethane_proton_transfer | true |
diazomethane product class 1 (w=1)click image to switch EFG / HEG
Minimal Julia
include("ElectronResonance.jl")
using .ElectronResonance
p = diazomethane_acid_presentation()
rules = [ER.diazomethane_proton_transfer_rule(), ER.diazomethane_azo_proton_transfer_rule()]
push = product_pushforward(p, rules; branch_policy=:uniform_matches)
classes = coalesce_products(push.raw_products)
- Shaik, Danovich, and Hiberty 2021, Valence Bond Theory, DOI
10.3390/molecules26061624: local PDF shaik_danovich_hiberty_2021_valence_bond_theory.pdf. Used here as the VB background for localized covalent/ionic contributors and weighted resonance descriptions.
- Shaik et al., Charge-Shift Bonding: A New and Unique Form of Bonding, DOI
10.1002/anie.201910085. This is the closest reference for the charge-shift toy itself; it is referenced by DOI here because the current local paper folder only contains the broader 2021 VB review.
- Song and Gao 2008: local PDF
song_gao_2008_ab_initio_vb_surfaces.pdf. Used as bridge language between Lewis resonance structures and diabatic/VB-like states.
- Linares, Humbel, and Braida 2008, The Nature of Resonance in Allyl Ions and Radical, DOI
10.1021/jp8038169: local PDF linares_humbel_braida_2008_resonance_allyl_ions_radical.pdf. Used as the small allyl ions/radical target family.
- Harcourt 2010/2011 and NBO/NRT papers: kept as later targets for 3-center and published-weight examples after the second-moment layer is stable.
Summary output
charge-shift toy mean charges: 0, 0
charge-shift toy charge variances: 0.5, 0.5; covariance H1,H2=-0.5
charge-shift toy H-H mean bond order: 0.5; variance=0.25
ionic_pair_recombination: covalent=0 matches at w=0.5; ionic_h1_minus_h2_plus=1 matches at w=0.25; ionic_h1_plus_h2_minus=1 matches at w=0.25; available weight=0.5; weighted match count=0.5
charge-shift toy coalesced polar products: 1 with raw weight 0.5
benzene C-C ring orders: 1.5, 1.5, 1.5, 1.5, 1.5, 1.5
benzene radical density sum: 0
formate C-O orders: 1.5, 1.5
formate O charges: -0.5, -0.5
allyl C-C orders: 1.5, 1.5
allyl radical densities C1,C2,C3: 0.5, 0, 0.5
allyl_radical_shift_left: radical_right=1 matches at w=0.5; radical_left=1 matches at w=0.5; available weight=1; weighted match count=1
allyl_radical_shift_right: radical_right=1 matches at w=0.5; radical_left=1 matches at w=0.5; available weight=1; weighted match count=1
allyl cation C-C orders: 1.5, 1.5
allyl cation terminal charge means: 0.5, 0.5
allyl anion C-C orders: 1.5, 1.5
allyl anion terminal charge means: -0.5, -0.5
substituted allyl trap radical densities C1,C3,methyl: 0.5, 0.5, 1
radical_recombination: left_radical=2 matches at w=0.5; right_radical=2 matches at w=0.5; available weight=1; weighted match count=2
substituted allyl trap coalesced product classes: 2 with weights 0.5, 0.5
formamide C-N order: 1.2
formamide O,N charges: -0.2, 0.2
diazomethane_proton_transfer: diazo_ylide=1 matches at w=0.5; azo_form=0 matches at w=0.5; available weight=0.5; weighted match count=0.5
diazomethane_azo_proton_transfer: diazo_ylide=0 matches at w=0.5; azo_form=1 matches at w=0.5; available weight=0.5; weighted match count=0.5
diazomethane DPO push-forward available weight: 1
diazomethane coalesced product classes: 1 with weight 1
diazomethane coalesced from contributors: azo_form, diazo_ylide; rules: diazomethane_azo_proton_transfer, diazomethane_proton_transfer
assessment: executable analysis layer now; candidate appendix proposition for weighted observables and rule availability, not yet a strong theorem.