code wiki / (root) / nx_chem_molecule.nx

nx_chem_molecule.nx

buildroot/runtime/nx_chem_molecule.nx

13177 B330 linesdepth 6pulls 6 transitivereach 31 importersview sourcekind librarytopic chem
docsdependenciesstructsconstsfunctions

about

nx_chem_molecule.nx -- C2.0 milestone: molecule graph primitive. MolGraph is the typed atom + bond graph used by cheminformatics primitives (SMILES parser, fingerprints, substructure search, etc). Composes nx_chem.nx Element / Molecule (stoichiometric) and nx_chem_periodic.nx AtomicData (per-Z lookups) without modifying either. Field layout chosen to be forward-compatible with EXCEED axes: - aromaticity stored as 6-model bitfield per atom + per bond (E3: 6-aromaticity tuple returned, never silently picked) - stereo stored per-atom (sp3 @ / @@ + atropisomer slots) and per-bond (sp2 E/Z / cis / trans) (E4: stereo round-trip) - isotope + charge + h_count + radical + map_num all explicit (E7: first-class radicals + organometallic-friendly) nx_safety_envelope: intended_use: cheminformatics graph backbone for nx_chem_smiles + downstream sil_target: SIL1 evidence: [C2.0 KAT in nx_chem_molecule_test.nx] verdict: BENCH-PENDING

dependencies 1 imports · 31 importers

nx_kernel_v2.nx nx_chem_molecule.nx nx_chem_adulterant_db.nx nx_chem_adulterant_db_test.nx nx_chem_descriptors.nx nx_chem_descriptors_test.nx nx_chem_fingerprint.nx nx_chem_fingerprint_test.nx nx_chem_isotope_pattern.nx nx_chem_isotope_pattern_test.nx nx_chem_mass.nx nx_chem_mass_test.nx

diagram shows first 10 each side; +0 more imports, +21 more importers in the complete lists below.

imports: nx_kernel_v2.nx

imported by: nx_chem_adulterant_db.nxnx_chem_adulterant_db_test.nxnx_chem_descriptors.nxnx_chem_descriptors_test.nxnx_chem_fingerprint.nxnx_chem_fingerprint_test.nxnx_chem_isotope_pattern.nxnx_chem_isotope_pattern_test.nxnx_chem_mass.nxnx_chem_mass_test.nxnx_chem_molecule_test.nxnx_chem_morgan.nxnx_chem_morgan_test.nxnx_chem_peak_list_test.nxnx_chem_report_csv.nxnx_chem_report_csv_test.nxnx_chem_report_json.nxnx_chem_report_json_test.nxnx_chem_sildenafil_probe_test.nxnx_chem_smiles.nxnx_chem_smiles_emit.nxnx_chem_smiles_emit_test.nxnx_chem_smiles_test.nxnx_chem_stereo_test.nxnx_chem_tadalafil_probe_test.nxnx_chem_valence.nxnx_chem_valence_test.nxnx_supplement.nxnx_supplement_batch.nxnx_supplement_check.nxnx_supplement_csv.nx

structs

74struct Atom
94struct Bond
105struct MolGraph

consts

26const NX_CHEM_SYM_MOL_GRAPH: nx_int = 415010
27const NX_CHEM_SYM_ATOM: nx_int = 415011
28const NX_CHEM_SYM_BOND: nx_int = 415012
31const NX_MOL_OK: nx_int = 0
32const NX_MOL_ERR_ATOM_OVERFLOW: nx_int = 1
33const NX_MOL_ERR_BOND_OVERFLOW: nx_int = 2
34const NX_MOL_ERR_BAD_ATOM_INDEX: nx_int = 3
35const NX_MOL_ERR_BAD_BOND_ORDER: nx_int = 4
36const NX_MOL_ERR_SMILES_BAD_CHAR: nx_int = 5
37const NX_MOL_ERR_SMILES_UNCLOSED_BR: nx_int = 6
38const NX_MOL_ERR_SMILES_UNCLOSED_PAREN: nx_int = 7
39const NX_MOL_ERR_SMILES_ORPHAN_RING: nx_int = 8
40const NX_MOL_ERR_SMILES_EMPTY: nx_int = 9
41const NX_MOL_ERR_SMILES_INVALID_BR: nx_int = 10
42const NX_MOL_ERR_SMILES_BAD_BOND: nx_int = 11
45const NX_BOND_ZERO: nx_int = 0 // zero-order (dative / virtual)
46const NX_BOND_SINGLE: nx_int = 1
47const NX_BOND_DOUBLE: nx_int = 2
48const NX_BOND_TRIPLE: nx_int = 3
49const NX_BOND_AROMATIC: nx_int = 4
50const NX_BOND_QUAD: nx_int = 5 // quadruple (e.g. Re2Cl8 2-)
53const NX_AROM_DAYLIGHT: nx_int = 1 // bit 0
54const NX_AROM_OPENEYE: nx_int = 2 // bit 1
55const NX_AROM_RDKIT: nx_int = 4 // bit 2
56const NX_AROM_MDL: nx_int = 8 // bit 3
57const NX_AROM_TRIPOS: nx_int = 16 // bit 4
58const NX_AROM_MMFF: nx_int = 32 // bit 5
61const NX_STEREO_NONE: nx_int = 0
62const NX_STEREO_CCW: nx_int = 1 // @ (counter-clockwise looking from first neighbor)
63const NX_STEREO_CW: nx_int = 2 // @@ (clockwise)
67const NX_BSTEREO_NONE: nx_int = 0
68const NX_BSTEREO_UP: nx_int = 1 // /
69const NX_BSTEREO_DOWN: nx_int = 2 // \
70const NX_BSTEREO_CIS: nx_int = 3
71const NX_BSTEREO_TRANS: nx_int = 4
91const NX_ATOM_BYTES: nx_int = 104
102const NX_BOND_BYTES: nx_int = 48
116const NX_MOL_GRAPH_BYTES: nx_int = 72

functions

121func nx_chem_mol_new(cap_atoms: nx_int, cap_bonds: nx_int) -> *MolGraph
137func nx_chem_mol_atom(m: *MolGraph, i: nx_int) -> *Atom
144func nx_chem_mol_bond(m: *MolGraph, i: nx_int) -> *Bond
153func nx_chem_mol_atom_add(m: *MolGraph, z: nx_int) -> nx_int
181func nx_chem_mol_bond_add(m: *MolGraph, a: nx_int, b: nx_int, order: nx_int) -> nx_int
230func nx_chem_mol_count_z(m: *MolGraph, target_z: nx_int) -> nx_int
251func nx_chem_mol_water() -> *MolGraph
258func nx_chem_mol_methane() -> *MolGraph
265func nx_chem_mol_ethanol() -> *MolGraph
276func nx_chem_mol_ethene() -> *MolGraph
285func nx_chem_mol_ethyne() -> *MolGraph
298func nx_chem_mol_benzene() -> *MolGraph