Repository navigation
Releases
v0.0.4
Added
-
enantiomer(g),is_chiral(g)andcanonical_enantiomer(g)for the four graph
types (P50, P60).enantiomerinverts every chiral LS (Tetrahedral,AtropBond,
TrigonalBipyramidal,Octahedral, and a reaction graph's change slots), keeping
planar bonds, undetermined LS and atom indices.is_chiralcompares the canonical
JSON of the two, a reaction graph's in its canonical direction (P75: N inversion,
whose mirror image is its own reverse, is achiral).canonical_enantiomerreturns whichever has the smaller canonical
JSON (a tie keepsg); on a reaction graph each is compared in its canonical
direction, so the choice doesn't depend on the direction. -
The canonical TS, documented in
user_guide/02-identity.qmdand tested:
canonical_direction(canonical_enantiomer(ts))is the same for a TS, its reverse,
its mirror image and the mirror image reversed (P60). No new function. -
from_reaction_smiles(smiles, *, charge=None, spin=None)reads an atom-mapped
reaction SMILES into aStereoReactionGraph(P62): atom k is the atom with the k-th
smallest map number, each side is perceived asfrom_smilesdoes, and thets
slots are set by the TS-slot rules, aslow_tsets them (it is a reader, P84).
Every atom, H included, must be mapped, and both sides must have the same map
numbers; the default spin is the lower of the two
sides' radical counts. -
stereoisomers(g)forStereoMolGraph(P65): the distinct
determined stereoisomers, both mirror images kept, withg's atom indices. Every
undetermined LS takes each configuration, determined ones are kept, and the results
are deduplicated up to atom numbering. It takes stereo graphs only (P83): a
MolGraphorReactionGraphraisesTypeError, and gets its sites first with
stereoisomers(low_t(g)). Gives StereoMolGraph SI-001's 10 stereoisomers. An
allene's two collapse to one, as the back-end drops chain LS (P45). On a
StereoReactionGraph(P74), each change's side slots are expanded and itstsslot
follows by the TS-slot rules, so the results are the channels: a rotation's two
twisted TSs, an open SN2 centre's backside and frontside TSs and their mirror
images. A bifurcation'stsslot stays undetermined (one channel per product). -
transition_state(srg)(P74, P5): where the TS-slot rules leave a change'sts
slot undetermined with its sides determined (a bifurcation), the side slots become
undetermined too, so a bifurcation's channels give one TS graph; any other graph is
returned as it is. -
rings(g)andreacting_core(g)(P85, P67), for any graph:ringsis a minimum
cycle basis (SSSR) of the condensed graph, each ring in cycle order from its lowest
atom toward the lower of its ring neighbours, the list sorted (rings are fluxional
in v1, P88);reacting_coreis the atoms CREST holds at a TS, those of the
breaking and forming bonds, or of the changing sites when no bond changes. -
rotors(g) -> list[Rotor]andRotor(axis, top), a frozen model (P63, P85, P86),
for stereo graphs only (P83): a bond with no bond LS, in no ring, with a neighbour
beyond each end and no linear (sp) end is a rotor axis; a linear chain gives one
axis between its outer ends (2-butyne).topis the smaller side, with no axis
atom (MESS'sGroup). At a TS the condensed graph is read, its rings are rigid, a
transferred atom counts as linear, and a bond LS in any slot of a change holds its
bond. -
umbrellas(g) -> list[Umbrella]andUmbrella(center, neighbors), a frozen model
(P63, P87), for stereo graphs only: an atom with three neighbours, at no atom LS's
centre or bond LS's end, that is an N, P or As with a lone pair or a radical C
([CH3]; a high-T NH3). At a TS the condensed graph's neighbours and every change
slot count. -
symmetry_number(g)(P64, P89, P90), for stereo graphs only: the number of
stereo-preserving automorphisms, the total σ for MESS'sSymmetryFactor(every
rotor atSymmetry 1); a TS's on its condensed graph, its change slots included.
Chain LS count (allene 4), filtered on the back-end's automorphisms. It raises
GraphErrorfor an undetermined LS (an undeterminedtsslot is allowed) and for a
flexible ring of 4 or more atoms (a bond no bond LS holds), until a ring model
exists. Tested on the Experiments-SymmetryNumberssigma.csvandkinbot.csv
sets (tests/data/symmetry_numbers/, aslowmarker), with the species where
|Aut| differs from the expected value listed with the reason.
Changed
- TS sites (P67-P74, P80, P81): the
tsslot of each change at a TS site (an LS with
an atom in the reacting core: the atoms of the breaking and forming bonds, or of the
changing site when no bond changes) is now set by rule, where it was alwaysNone.
One side only: that side's LS, or undetermined when the other side has a triple
bond there (a bifurcation); a centre that swaps a neighbour: the backside
TrigonalBipyramidal(inversion) or aTetrahedralwithNonewhere the leaving
and attacking atoms meet (retention); a rotation: anAtropBond, undetermined,
whose two paritiesstereoisomersgives; a lone-pair inversion:None. The rules
are the low-T scheme's (P84):low_tand the readerfrom_reaction_smilesset the
slots, whilets_graphsandreaction_graph(which build a reaction graph from its
sides) and the constructors leave them empty. The pipeline for a TS is
ts_graphs→low_t→stereoisomers, sots_graphsgives one channel per
topology and side stereo, and a rotation's two twisted TSs are
stereoisomers(low_t(ch)). A TS's graph fromlow_t, and so its canonical JSON,
changes (examples.abstraction_ts(), which islow_tof its channel, among them);
species graphs don't. geometry_mismatchestakes a reaction graph's geometry to be its TS's (P69, P82):
it reads the determinedtsslots too (aTrigonalBipyramidalas stereomolgraph
reads one: the widest angle is axial), and its newreacting_bondsfield lists the
breaking and forming bonds that aren't partial (a full bond, up to 1.05 times the
covalent-radius sum, or longer than twice it). An end point is checked on its side,
geometry_mismatches(products(ts), geo).canonical_form,canonical_json,relabelandcanonical_directionaccept a
union argument (AnyGraph, orReactionGraph | StereoReactionGraphfor
canonical_direction), which ty rejected before; a precise argument still gives the
precise type back (P59). So doreverseandremove_stereo(P76). Typing only.
v0.0.3
Added
low_t(g)forMolGraph | StereoMolGraph(giving aStereoMolGraph) and
ReactionGraph | StereoReactionGraph(giving aStereoReactionGraph): the low-T
scheme's sites, perceived on a Lewis structure of the graph. A site the graph has
keeps its LS and parity, a site the scheme drops loses its LS, and an added site is
undetermined, or fixed if trivial. A reaction graph's sides are reassigned
separately; eachStereoChangeslot follows its side's site, and the TS slots are
kept. It is idempotent and a no-op onfrom_smilesandfrom_geometryoutput, but
for a carbonyl-oxide radical whose perceived Lewis structure is a peroxy radical
(open question 11).canonical_direction(gra) -> (graph, reversed)for aReactionGraphor
StereoReactionGraph:graorreverse(gra), whichever has the smaller
canonical_json, and whether it was reversed (a tie keepsgra). Atom indices are
kept, so an atom map fromcanonical_formof the result applies to the input's atoms.
A reaction graph and its reverse give the same result, so one TS imported in either
direction gets one identity.
Changed
from_smilesandfrom_geometryput a lone-pairTetrahedralon exactly the
pyramidal atoms of the low-T scheme: N, P or S with three neighbours and one lone pair
(amines, phosphines, sulfoxides, sulfonium ions), but not an N next to a π system or
a radical centre (amides, anilines, enamines, nitroxides, α-amino radicals). Phosphines
and sulfoxides used to get one only from a chiral tag.- Radicals with formal charges, and vinoxy radicals from their carbonyl form, get an LS
on each resonating double bond (stereomolgraph's radical resonance, fixed on the fork's
protomolbranch). from_smileskeeps a chiral tag on a pyramidal N (C[N@](F)Cl), which RDKit drops.- A chiral centre with a lone pair that starts its SMILES fragment reads the lone pair
where an implicit H would go (Open Babel, CDK), not last (RDKit):[N@](C)(F)Clis
C[N@@](F)Cl. This flips atom-first N, P and S centres. - An acyclic double bond or cumulated chain with a radical end (an alkenyl or allenyl
radical) gets no LS: the low-T scheme lumps its cis and trans forms. - A site is filled as trivial only if it is trivial for every configuration of the other
undetermined sites: the centres of 1,4-dimethylcyclohexane (cis/trans) and the
pseudoasymmetric C of 2,3,4-trihydroxyglutaric acid stay undetermined. - Every site InChI keeps is a low-T site: arsines, selenoxides and selenonium ions get a
lone-pairTetrahedral, and so does an N in a three-membered ring even when it is
conjugated (N-acyl, N-aryl aziridines).embedmakes such a centre pyramidal when
ETKDG leaves it flat. - A σ-radical C in a three-membered ring gets a
Tetrahedralwith its unpaired
electron in theNoneslot if the ring has a heteroatom (oxiranyl, aziridinyl) or the
C bears an N, O, F or Cl (α-fluoro cyclopropyl); a plain cyclopropyl radical does not.
from_smileskeeps a chiral tag on such a centre (C[C@H]1O[C@]1C). - An alkenyl or allenyl radical whose radical C bears an N, O, F or Cl keeps its bond or
chain LS (F[C]=CC), with the unpaired electron in aNoneslot. - A single bond with a closed-shell partial double bond gets a
PlanarBond: an N with
three neighbours (not in a three-membered ring) on a C=O, C=S or N=O (amides,
thioamides, carbamates, ureas, imides, hydroxamic acids, nitrosamines), and the C-C of
a vinyl carbonyl oxide (acrolein oxide's s-cis/s-trans). A ring of seven or fewer
atoms holds it cis (lactams, caprolactam included). Esters, amidines, enamines and
enones get none. - A ring of seven atoms holds a double bond cis, as InChI does: a cycloheptene C=C is
trivial, not undetermined (stereomolgraph's ring cutoff, fixed on the fork's
protomolbranch).
v0.0.2
Added
canonical_form(gra) -> (canonical, atom_map)for the four graph types, with
atom_map[k]the input index of canonical atom k (a tuple), andcanonical_json(gra),
the JSON of the canonical graph. The numbering is stereomolgraph'scanon_atom_num;
it doesn't see chain LS yet.isomorphism(g1, g2): an atom mapmwithrelabel(g1, m) == g2, orNone
(stereomolgraph's VF2++, comparing stereo, breaking and forming bonds, stereo changes,
charge and spin), anddeduplicate(graphs): the first graph of each isomorphism class,
in input order.from_geometry(geo): theStereoMolGraphof anautogeom.Geometry, keeping its atom
order, charge and spin. Bonds come from covalent radii and a Lewis structure from
autogeom's solver. The LS sites are the low-T onesfrom_smilesgives, and every
parity is read from the coordinates (undetermined only for a flat centre or a double
bond twisted by about 90°).embed(gra): anautogeom.Geometryof aMolGraphorStereoMolGraph, in its atom
order, from RDKit's ETKDG on a perceived Lewis structure (autogeom's solver, so
radicals work), with the determined LS as constraints. Every determined LS is checked
on the result, sofrom_geometry(embed(gra)) == grafor a determined graph. Fixed
seeds make it reproducible; fragments are set 3 Å apart.
Changed
-
protomol depends on autogeom 0.0.5 or later (from the
avcopan/automechchannel on
prefix.dev), whose Lewis solver keeps onium octets, sofrom_geometrykeeps the C=O⁺ and
C=N⁺PlanarBondof Criegee intermediates and nitrones. -
ts_graphscompares and deduplicates its channels withisomorphismand
deduplicate.
Fixed
AtropBond's permutation group: an end swap now keeps the helicity (the axis's C2),
so a 1,3-disubstituted allene or a symmetric twisted TS no longer equals its mirror
image. The normal form, and so the JSON, of anAtropBondmay change. The vendored
stereomolgraph now tracks the fork'sprotomolbranch, which has the same fix.
v0.0.1
Added
- The four graph types,
MolGraph,StereoMolGraph,ReactionGraphand
StereoReactionGraph: frozen pydantic models with keyword-only constructors that
normalize and validate, andAnyGraph, their union discriminated bytype. - Local stereodescriptors:
Tetrahedral,SquarePlanar,TrigonalBipyramidal,
Octahedral,PlanarBondandAtropBond(with achainfor cumulated chains), and
StereoChangefor a reaction graph's changing sites;invert,isomersandsite. with_stereo,remove_stereo,stereo_at,neighborsandis_determined.to_jsonandfrom_json: one compact, deterministic JSON string per graph.from_smiles, with every atom explicit in SMILES order, the low-T stereo scheme
(trivial sites filled, unspecified ones left undetermined), and one LS per cumulated
chain.reaction_graph,reactants,products,reverse,relabelandwithout_stereo.ts_graphs: the transition-state graphs of a reaction, fewest bonds first (ported from
autoccv), each one elementary step that changes something: a degenerate reaction gives
its bond-changing channels, and a stereoisomerization its one rotation or lone-pair
inversion.displayand Jupyter drawings of the four types.protomol.examples:species,abstraction_tsandstereoisomerization_ts.