Skip to content

ElectronConfiguration

An electron configuration is a list of orbital / occupancy pairs, plus an optional term symbol for total angular momentum state.

FieldTypeDescription
orbitalsArray of [orbital, occ] pairsPairs like ["1s", "2"]
term_symbolTermSymbol (optional)Multiplicity / letter / J value

The TermSymbol struct has :multiplicity, :letter, :j_value fields, all strings.

┌─────────────────────────────────────┐
│ ElectronConfiguration │
│ │
│ orbitals[0] ("1s", "2") │
│ orbitals[1] ("2s", "2") │
│ orbitals[2] ("2p", "6") │
│ ... │
│ │
│ term_symbol (optional) │
│ ├── multiplicity │
│ ├── letter │
│ └── j_value │
└─────────────────────────────────────┘
electron_config := (orbital "^" occupancy){2,}
orbital := digits [spdfgh]
occupancy := digits

Two or more orbital^occupancy pairs in sequence.

Term symbols (^3P_2) are first-class in the model but the v1 parser doesn’t promote them from text. Use embedded math for now:

`^3P_2`
^ 3 P 2

The model is ready for the grammar extension in v0.3+.

FormatterEach orbital
MathML<msup><mi>1s</mi><mn>2</mn></msup> joined with non-breaking spaces
Text1s^2 2s^2 2p^6
HTML1s<sup>2</sup> joined with spaces
LaTeX\ce{1s^2 2s^2 2p^6}
SVGLinear ASCII
AsciiChem.parse("1s^2 2s^2").to_text # => "1s^2 2s^2"
AsciiChem.parse("1s^2 2s^2 2p^6 3s^2 3p^6 4s^2 3d^10").to_text # => same (zinc)
  • Box notation (orbital diagrams with up/down arrows) — needs SVG, deferred to 2D structural support (TODO 18).
  • Hund’s rule validation — out of scope for the parser; the linter could add a HundCheck.
  • Excited-state vs ground-state markers — needs syntax design.