orthonym.rules.main_ring_cycles#

Note

Internal API. Names and behaviour may change between releases.

The main ring of a ring system of many rings, found as a longest cycle.

The main-ring search of polycyclic._find_main_ring_impl lists, for every pair of bridgeheads, the simple paths between them and pairs them (main_ring_paths, main_ring_pairs). The number of paths grows exponentially with the rings: a ring system of 21 rings and 65 atoms lists hundreds of thousands of paths for one pair, runs the perf budget out and is abstained, and a hundred times the budget does not name it either. Above CYCLE_FIRST_MIN_RINGS rings the search here takes its place.

It starts from the rule rather than from the bridgeheads. “Selection of the main ring” (the Blue Book Blue Book): “The main ring of a polycyclic hydrocarbon ring system is selected so as to include as many skeletal atoms of the structure as possible”, so the main ring is a longest cycle of the ring system. Every longest cycle is listed (longest_cycles()). For each, the main bridge is the longest path between two atoms of the cycle through the atoms off it

“Selection of the main bridge”, :9603: “The main bridge is selected so as to be as

large as possible”), and of two equal main bridges the one that divides the main ring more symmetrically wins “Selection of the main bridge and secondary bridges”, rule

at :9661: “The main ring must be divided as symmetrically as possible by the main

bridge”). The candidates are scored as polycyclic._MainRingBest scores those of the path search, (ring size, main bridge, balance), and every candidate at the top is returned, so the numbering choice among them (_choose_lowest_locant_numbering) sees them all.

A longest cycle always has a main bridge: the ring system is biconnected and has more bonds than atoms, so some path through the atoms off the cycle joins two of its atoms. The two atoms are not neighbours on the cycle, as the path and the cycle without their bond would be a longer cycle.

The DFS that lists the cycles is a branch and bound. At an atom v of a path that started at s, the path can still be closed through the atoms not yet used, and only through the blocks (biconnected components) on the way from v to s in the graph of those atoms: a block off that way can be entered and never left. The atoms of those blocks bound the length of the cycle, and a path whose bound is below the longest cycle found is cut. On the 21-ring system above the search visits about 32,000 paths (1.6 s) where a bound on the atoms reachable from v visits 5.6 million.

orthonym.rules.main_ring_cycles.CYCLE_FIRST_MIN_RINGS = 16#

The search here runs for a ring system of at least this many rings (circuit rank,. The best-effort ceiling of the first attempt is 15 rings (vonbaeyer_universal. BEST_EFFORT_MAX_CAGE_RINGS), so every system of today’s PIN and first-attempt ceilings is searched by the path search as before, with the same result; only the lifted ceilings of the late best-effort offer (lifted_ring_ceiling_scope, 16 to 30 rings, never a PIN) reach this search.

orthonym.rules.main_ring_cycles.FREE_ATOMS_PER_UNIT = 3#

a visit computes the blocks of the free atoms (about 50 microseconds on 65 atoms, in proportion to the atoms), and a unit is the work of one to two microseconds.

Type:

Free atoms per perf-budget unit charged when the DFS visits a path

orthonym.rules.main_ring_cycles.UNITS_PER_BRIDGE_FRAME = 1#

Perf-budget units per frame of the main-bridge DFS through the atoms off a cycle.

orthonym.rules.main_ring_cycles.MAX_CYCLES = 2000#

the candidates are a part of the tie, the name is still verified by its read-back, and it is not a PIN at these ring counts.

Type:

Longest cycles kept. Past it the list stops growing

orthonym.rules.main_ring_cycles.longest_cycles(nbrs, order, spend)#

The longest simple cycles of the ring system whose atoms are order (each atom’s ring neighbours in nbrs): (length, cycles, complete). Each cycle is listed once, from its atom first in order, in the direction whose second atom comes first in order; complete is False when MAX_CYCLES cut the list (the first cycles of a DFS that takes the atoms and their neighbours in the order of order).

orthonym.rules.main_ring_cycles.main_bicycles(nbrs, ring_atoms, rank, spend, allow_multiatom_bridge=True)#

The main bicycles at the top of the -> -> cascade: (ring, bh1, bh2, branch1, branch2, main_bridge) for _MainRingBest.consider, ring the main ring from bh1, bh1 < bh2, in a spelling-invariant order (the canonical ranks of the ring’s atoms). allow_multiatom_bridge False keeps main bridges of 0 or 1 atoms (the second pass of analyze) when a longest cycle has one.