@kent-tokyo/chematic 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@ WebAssembly bindings for [chematic](https://github.com/kent-tokyo/chematic), a p
4
4
 
5
5
  Published to npm as [`@kent-tokyo/chematic`](https://www.npmjs.com/package/@kent-tokyo/chematic).
6
6
 
7
- The current workspace line is 1.1.4. The binding keeps bounded parsing,
7
+ The current workspace line is 1.1.6. The binding keeps bounded parsing,
8
8
  typed failures, and opt-in `embed_pipeline_v2_json`; 3D/MMFF94 behavior remains
9
9
  Experimental and is not a claim of full RDKit parity.
10
10
 
@@ -480,6 +480,15 @@ export class MolHandle {
480
480
  * diagonal and lower bounds below it. At most 512 atoms are accepted.
481
481
  */
482
482
  rdkit_bounds_matrix_json(set15bounds: boolean, do_triangle_smoothing: boolean, use_macrocycle_14_config: boolean): string;
483
+ /**
484
+ * Distance-geometry bounds with user bond-length, angle and torsion
485
+ * constraints injected before triangle smoothing.
486
+ *
487
+ * `constraintsJson` contains optional camelCase arrays `bondLengths`,
488
+ * `bondAngles`, and `torsions`; atom indices are zero based. Lengths use
489
+ * angstrom and angles use degrees.
490
+ */
491
+ rdkit_bounds_matrix_with_constraints_json(constraints_json: string, set15bounds: boolean, do_triangle_smoothing: boolean, use_macrocycle_14_config: boolean): string;
483
492
  /**
484
493
  * RDKit `CalcRMS`, bounded by `max_matches <= 1_000_000`.
485
494
  */
@@ -492,11 +501,21 @@ export class MolHandle {
492
501
  * RDKit-compatible CXSMARTS.
493
502
  */
494
503
  rdkit_cx_smarts(): string;
504
+ /**
505
+ * Checked 3D matrix in prepared RDKit atom order. JSON has one [x,y,z]
506
+ * row per prepared atom; malformed/nonfinite/unrepresentable input refuses.
507
+ */
508
+ rdkit_distance_matrix_3d_checked_json(coords_json: string, use_atom_wts: boolean): string;
495
509
  /**
496
510
  * Seeded RDKit ETKDGv3 coordinates as JSON. Call on an
497
511
  * explicit-hydrogen molecule. At most 512 atoms are accepted.
498
512
  */
499
513
  rdkit_embed_json(random_seed: number, max_iterations: number): string;
514
+ /**
515
+ * Seeded ETKDG embedding using constraints injected before triangle
516
+ * smoothing. Returns one `[x,y,z]` row per atom as JSON.
517
+ */
518
+ rdkit_embed_with_constraints_json(constraints_json: string, random_seed: number, max_iterations: number): string;
500
519
  /**
501
520
  * RDKit MolHash by case-insensitive function name.
502
521
  */
@@ -547,6 +566,11 @@ export class MolHandle {
547
566
  * Number of rotatable bonds.
548
567
  */
549
568
  rotatable_bond_count(): number;
569
+ /**
570
+ * Checked rooted SMILES as {smiles, atom_order}; order maps parsed to original indices.
571
+ * Limited to 256 atoms and verified ordinary tetrahedral frames; see the Rust API.
572
+ */
573
+ smiles_rooted_checked_json(rooted_at_atom: number): string;
550
574
  /**
551
575
  * Sum of EState indices over all heavy atoms.
552
576
  */
@@ -693,6 +717,24 @@ export class SmilesBatchStreamHandle {
693
717
  stop_json(terminal_reason: string): string;
694
718
  }
695
719
 
720
+ /**
721
+ * One proof result. The witness maps original atoms to a copy with only the
722
+ * selected tetrahedral declaration inverted; it fixes that selected atom.
723
+ */
724
+ export class TetrahedralCleanupResult {
725
+ private constructor();
726
+ free(): void;
727
+ [Symbol.dispose](): void;
728
+ report_json(): string;
729
+ readonly atom_index: number;
730
+ /**
731
+ * Independent molecule; all source labels and other configurations remain.
732
+ */
733
+ readonly molecule: MolHandle;
734
+ readonly removed: boolean;
735
+ readonly search_visits: number;
736
+ }
737
+
696
738
  /**
697
739
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
698
740
  */
@@ -888,6 +930,12 @@ export function cdxml_document_projection_json_v1(cdxml: string): string;
888
930
  */
889
931
  export function cdxml_to_smiles_json(cdxml: string): string;
890
932
 
933
+ /**
934
+ * Read all CDXML fragments with optional Bold/Hash/Dash stereo inference.
935
+ * Retains the existing input/atom/fragment limits and JSON result shape.
936
+ */
937
+ export function cdxml_to_smiles_json_with_options(cdxml: string, infer_nondirectional_stereo: boolean): string;
938
+
891
939
  /**
892
940
  * Compute the charge Parent and return a status-shaped JSON result.
893
941
  */
@@ -902,6 +950,12 @@ export function charge_parent_json(mol: MolHandle): string;
902
950
  */
903
951
  export function chematic_version(): string;
904
952
 
953
+ /**
954
+ * Exact source bytes, projected XML, fragment coordinates and CDX omission tags.
955
+ * CDXML uses the existing graph projection; omissions lists CDX tags only.
956
+ */
957
+ export function chemdraw_block_report_json(data: Uint8Array, format: string, allow_metadata_loss: boolean): string;
958
+
905
959
  /**
906
960
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
907
961
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
@@ -1420,7 +1474,9 @@ export function generic_murcko_scaffold(mol: MolHandle): MolHandle;
1420
1474
  *
1421
1475
  * Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
1422
1476
  * `charge` (formal charge integer), `isAromatic` (bool),
1423
- * `totalHydrogens` (explicit + implicit H count, integer).
1477
+ * `totalHydrogens` (attached H: bracket/inferred plus explicit H neighbors).
1478
+ * This excludes the atom itself when it is H; use `num_hydrogens` for the
1479
+ * molecule's total. Isotopic H neighbors count as hydrogen.
1424
1480
  * sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
1425
1481
  */
1426
1482
  export function get_atom_info(mol: MolHandle, idx: number): string;
@@ -1582,6 +1638,12 @@ export function is_valid_smiles(s: string): boolean;
1582
1638
  */
1583
1639
  export function isotope_parent_json(mol: MolHandle): string;
1584
1640
 
1641
+ /**
1642
+ * Replace only ar bond tokens in a bounded neutral aromatic MOL2 record.
1643
+ * Retains atom types and every other source byte; errors throw, no partial text.
1644
+ */
1645
+ export function kekulize_mol2_record(text: string): string;
1646
+
1585
1647
  /**
1586
1648
  * Per-atom Labute approximate surface area contributions as a JSON array of f64.
1587
1649
  *
@@ -1979,12 +2041,25 @@ export function mol_block_stereo_diagnostics_json(mol_block: string): string;
1979
2041
  */
1980
2042
  export function mol_block_stereo_loss_json(mol: MolHandle): string;
1981
2043
 
2044
+ /**
2045
+ * Project explicit CCD topology. Unassigned stereo annotations require
2046
+ * explicit loss consent; coordinates remain in parse_ccd_json's record.
2047
+ */
2048
+ export function mol_from_ccd(text: string, allow_stereo_loss: boolean): MolHandle;
2049
+
1982
2050
  /**
1983
2051
  * Only the first molecular fragment in the document is returned.
1984
2052
  * Returns a JS error if the document cannot be parsed.
1985
2053
  */
1986
2054
  export function mol_from_cdxml(cdxml: string): MolHandle;
1987
2055
 
2056
+ /**
2057
+ * Read the first CDXML fragment, optionally inferring Bold/Hash/Dash stereo.
2058
+ * Non-directional displays are heuristic: ambiguous or degenerate drawings
2059
+ * remain unassigned. `false` has the same behavior as `mol_from_cdxml`.
2060
+ */
2061
+ export function mol_from_cdxml_with_options(cdxml: string, infer_nondirectional_stereo: boolean): MolHandle;
2062
+
1988
2063
  /**
1989
2064
  * Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
1990
2065
  *
@@ -2070,6 +2145,12 @@ export function mol_from_orca_input(text: string): MolHandle;
2070
2145
  */
2071
2146
  export function mol_from_pdb(pdb: string): MolHandle;
2072
2147
 
2148
+ /**
2149
+ * Explicit CONECT graph, without distance-based bonding. Only unmodelled,
2150
+ * single-location atoms with explicit element fields are accepted.
2151
+ */
2152
+ export function mol_from_pdb_conect(input: string, allow_extended_targets: boolean): MolHandle;
2153
+
2073
2154
  /**
2074
2155
  * Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
2075
2156
  * return an error instead of producing a partially recovered molecule.
@@ -2200,6 +2281,11 @@ export function mol_with_bond_removed(mol: MolHandle, idx: number): MolHandle;
2200
2281
  */
2201
2282
  export function molecule_report_json(smiles: string): string;
2202
2283
 
2284
+ /**
2285
+ * Concrete CDX/CDXML fragment handles, in source fragment order.
2286
+ */
2287
+ export function mols_from_chemdraw_block(data: Uint8Array, format: string, allow_metadata_loss: boolean): MolHandle[];
2288
+
2203
2289
  /**
2204
2290
  * MQN descriptor (42 integer values: Molecular Quantum Numbers).
2205
2291
  */
@@ -2261,6 +2347,12 @@ export function nucleic_acid_apply_json_command(document_json: string, command_j
2261
2347
  */
2262
2348
  export function nucleic_acid_validate_json(document_json: string): string;
2263
2349
 
2350
+ /**
2351
+ * Total hydrogen nuclei: explicit nodes plus attached bracket/inferred H.
2352
+ * Isotopic, charged, bridging and disconnected H nodes each count once.
2353
+ */
2354
+ export function num_hydrogens(mol: MolHandle): number;
2355
+
2264
2356
  /**
2265
2357
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
2266
2358
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
@@ -2321,6 +2413,12 @@ export function orca_output_to_json(text: string): string;
2321
2413
  */
2322
2414
  export function pains_matches_json(mol: MolHandle): string;
2323
2415
 
2416
+ /**
2417
+ * One CCD template including source IDs, charges, explicit bonds, optional
2418
+ * coordinates and unassigned stereo labels. No atom_site bond perception.
2419
+ */
2420
+ export function parse_ccd_json(text: string): string;
2421
+
2324
2422
  /**
2325
2423
  * Inspect strictly validated CJSON with exact source and opaque field paths.
2326
2424
  */
@@ -2342,6 +2440,11 @@ export function parse_cxsmarts_json(s: string): string;
2342
2440
  */
2343
2441
  export function parse_cxsmiles_json(s: string): string;
2344
2442
 
2443
+ /**
2444
+ * Inspect the bounded HIN record, including literal aromatic bonds and charges.
2445
+ */
2446
+ export function parse_hin_record_json(text: string): string;
2447
+
2345
2448
  /**
2346
2449
  * Inspect partial charges, atom types and source retention for MOL2.
2347
2450
  */
@@ -2354,6 +2457,12 @@ export function parse_mol2_record_json(text: string): string;
2354
2457
  */
2355
2458
  export function parse_smiles(s: string): MolHandle;
2356
2459
 
2460
+ /**
2461
+ * Indexed atoms/charges, bonds, coordinates and source serials for the same
2462
+ * explicit CONECT projection. Molecular identity and coordinate order agree.
2463
+ */
2464
+ export function pdb_conect_frame_json(input: string, allow_extended_targets: boolean): string;
2465
+
2357
2466
  /**
2358
2467
  * Extract the atomic coordinates from a PDB block, in the SAME atom order
2359
2468
  * `mol_from_pdb` returns topology for (both read the identical underlying
@@ -2685,6 +2794,13 @@ export function reaction_smarts_match(smarts: string, reaction_smiles: string):
2685
2794
  */
2686
2795
  export function remove_hydrogens(mol: MolHandle): MolHandle;
2687
2796
 
2797
+ /**
2798
+ * Opt-in exact tetrahedral cleanup. Both index and budget must be JS numbers
2799
+ * containing integers (bool/string/null are rejected). The kernel caps inputs
2800
+ * at 64 atoms/128 bonds and max_visits at 10000000. Errors throw without a result.
2801
+ */
2802
+ export function remove_redundant_tetrahedral_stereo(mol: MolHandle, atom_index: any, max_visits: any): TetrahedralCleanupResult;
2803
+
2688
2804
  /**
2689
2805
  * Single-step retrosynthetic disconnection (issue #91).
2690
2806
  *
@@ -2757,6 +2873,11 @@ export function ring_families_json(mol: MolHandle): string;
2757
2873
  */
2758
2874
  export function roundtrip_cjson_record(text: string): string;
2759
2875
 
2876
+ /**
2877
+ * Validate a single HIN record and retain exact source text and line endings.
2878
+ */
2879
+ export function roundtrip_hin_record(text: string): string;
2880
+
2760
2881
  /**
2761
2882
  * Validate one MOL2 record and preserve its exact source, including metadata.
2762
2883
  */
@@ -2997,9 +3118,11 @@ export function smiles_array_to_sdf(smiles_json: string): string;
2997
3118
  /**
2998
3119
  * Convert a SMILES to a minimal Tripos MOL2 string (no 3D coordinates).
2999
3120
  *
3000
- * Returns `"error:<msg>"` on parse failure.
3121
+ * Optional `atom_bond_adjacent=true` emits ATOM → BOND → UNITY. Some
3122
+ * readers (including Open Babel 3.2.1) ignore UNITY charges in this order.
3123
+ * Omit it to retain existing bytes. Returns `"error:<msg>"` on parse failure.
3001
3124
  */
3002
- export function smiles_to_mol2(smiles: string): string;
3125
+ export function smiles_to_mol2(smiles: string, atom_bond_adjacent?: boolean | null): string;
3003
3126
 
3004
3127
  /**
3005
3128
  * Write a molecule to AutoDock PDBQT format.
@@ -3012,6 +3135,15 @@ export function smiles_to_mol2(smiles: string): string;
3012
3135
  */
3013
3136
  export function smiles_to_pdbqt(smiles: string, coords_json: string, charges_json: string, name: string): string;
3014
3137
 
3138
+ /**
3139
+ * Write rigid PDBQT or throw for malformed/unrepresentable input. Coordinates
3140
+ * are JSON [x,y,z] arrays in Å; charges are JSON numbers in e. Both arrays must
3141
+ * contain exactly one value per graph atom, including explicit H. No defaults,
3142
+ * charge calculation, atom removal or ligand torsion preparation are applied.
3143
+ * AutoDock types retain the legacy heuristic, with unknown `X` types rejected.
3144
+ */
3145
+ export function smiles_to_pdbqt_checked(smiles: string, coords_json: string, charges_json: string, name: string): string;
3146
+
3015
3147
  /**
3016
3148
  * Render a highlighted SVG from a SMILES string in one call.
3017
3149
  *
@@ -3400,6 +3532,7 @@ export interface InitOutput {
3400
3532
  readonly __wbg_rdkitreadresult_free: (a: number, b: number) => void;
3401
3533
  readonly __wbg_rdkitsearchindex_free: (a: number, b: number) => void;
3402
3534
  readonly __wbg_smilesbatchstreamhandle_free: (a: number, b: number) => void;
3535
+ readonly __wbg_tetrahedralcleanupresult_free: (a: number, b: number) => void;
3403
3536
  readonly add_hydrogens: (a: number) => number;
3404
3537
  readonly admet_profile_json: (a: number, b: number) => [number, number];
3405
3538
  readonly atom_pair_bitvec: (a: number) => [number, number];
@@ -3422,8 +3555,10 @@ export interface InitOutput {
3422
3555
  readonly cdxml_document_json_v1: (a: number, b: number) => [number, number, number, number];
3423
3556
  readonly cdxml_document_projection_json_v1: (a: number, b: number) => [number, number, number, number];
3424
3557
  readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
3558
+ readonly cdxml_to_smiles_json_with_options: (a: number, b: number, c: number) => [number, number, number, number];
3425
3559
  readonly charge_parent_json: (a: number) => [number, number];
3426
3560
  readonly chematic_version: () => [number, number];
3561
+ readonly chemdraw_block_report_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3427
3562
  readonly cip_assignments_accurate_json: (a: number) => [number, number];
3428
3563
  readonly cip_assignments_json: (a: number) => [number, number];
3429
3564
  readonly cip_unresolved_json: (a: number) => [number, number];
@@ -3521,6 +3656,7 @@ export interface InitOutput {
3521
3656
  readonly invert_stereocenter_at: (a: number, b: number) => [number, number, number];
3522
3657
  readonly is_valid_smiles: (a: number, b: number) => number;
3523
3658
  readonly isotope_parent_json: (a: number) => [number, number];
3659
+ readonly kekulize_mol2_record: (a: number, b: number) => [number, number, number, number];
3524
3660
  readonly labute_asa_per_atom_json: (a: number) => [number, number];
3525
3661
  readonly lammps_data_to_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3526
3662
  readonly lammps_dump_cartesian_positions_f64: (a: number, b: number) => [number, number, number];
@@ -3561,7 +3697,9 @@ export interface InitOutput {
3561
3697
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
3562
3698
  readonly mol_block_stereo_diagnostics_json: (a: number, b: number) => [number, number, number, number];
3563
3699
  readonly mol_block_stereo_loss_json: (a: number) => [number, number];
3700
+ readonly mol_from_ccd: (a: number, b: number, c: number) => [number, number, number];
3564
3701
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
3702
+ readonly mol_from_cdxml_with_options: (a: number, b: number, c: number) => [number, number, number];
3565
3703
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
3566
3704
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
3567
3705
  readonly mol_from_cml_strict: (a: number, b: number) => [number, number, number];
@@ -3571,6 +3709,7 @@ export interface InitOutput {
3571
3709
  readonly mol_from_moljson: (a: number, b: number) => [number, number, number];
3572
3710
  readonly mol_from_orca_input: (a: number, b: number) => [number, number, number];
3573
3711
  readonly mol_from_pdb: (a: number, b: number) => number;
3712
+ readonly mol_from_pdb_conect: (a: number, b: number, c: number) => [number, number, number];
3574
3713
  readonly mol_from_pdb_strict: (a: number, b: number) => [number, number, number];
3575
3714
  readonly mol_from_pdbqt: (a: number, b: number) => [number, number, number];
3576
3715
  readonly mol_from_pqr: (a: number, b: number) => [number, number, number];
@@ -3662,10 +3801,13 @@ export interface InitOutput {
3662
3801
  readonly molhandle_rdkit_best_alignment_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
3663
3802
  readonly molhandle_rdkit_best_rms: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
3664
3803
  readonly molhandle_rdkit_bounds_matrix_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3804
+ readonly molhandle_rdkit_bounds_matrix_with_constraints_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
3665
3805
  readonly molhandle_rdkit_calc_rms: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
3666
3806
  readonly molhandle_rdkit_chiral_centers_json: (a: number, b: number) => [number, number, number, number];
3667
3807
  readonly molhandle_rdkit_cx_smarts: (a: number) => [number, number, number, number];
3808
+ readonly molhandle_rdkit_distance_matrix_3d_checked_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3668
3809
  readonly molhandle_rdkit_embed_json: (a: number, b: number, c: number) => [number, number, number, number];
3810
+ readonly molhandle_rdkit_embed_with_constraints_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3669
3811
  readonly molhandle_rdkit_mol_hash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3670
3812
  readonly molhandle_rdkit_morgan_bit_info_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3671
3813
  readonly molhandle_rdkit_murcko_scaffold: (a: number) => [number, number, number, number];
@@ -3677,6 +3819,7 @@ export interface InitOutput {
3677
3819
  readonly molhandle_reos_passes: (a: number) => number;
3678
3820
  readonly molhandle_ring_count: (a: number) => number;
3679
3821
  readonly molhandle_rotatable_bond_count: (a: number) => number;
3822
+ readonly molhandle_smiles_rooted_checked_json: (a: number, b: number) => [number, number, number, number];
3680
3823
  readonly molhandle_sum_estate: (a: number) => number;
3681
3824
  readonly molhandle_to_inchi: (a: number) => [number, number];
3682
3825
  readonly molhandle_to_inchikey: (a: number) => [number, number];
@@ -3684,6 +3827,7 @@ export interface InitOutput {
3684
3827
  readonly molhandle_veber_passes: (a: number) => number;
3685
3828
  readonly molhandle_wiener_index: (a: number) => number;
3686
3829
  readonly molhandle_zagreb_index_m1: (a: number) => number;
3830
+ readonly mols_from_chemdraw_block: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3687
3831
  readonly mqn_json: (a: number) => [number, number];
3688
3832
  readonly mr_per_atom_json: (a: number) => [number, number];
3689
3833
  readonly murcko_scaffold: (a: number) => number;
@@ -3693,6 +3837,7 @@ export interface InitOutput {
3693
3837
  readonly normalize_reaction_smiles: (a: number, b: number) => [number, number, number, number];
3694
3838
  readonly nucleic_acid_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number];
3695
3839
  readonly nucleic_acid_validate_json: (a: number, b: number) => [number, number];
3840
+ readonly num_hydrogens: (a: number) => number;
3696
3841
  readonly opendx_grid_json: (a: number, b: number) => [number, number, number, number];
3697
3842
  readonly opendx_shape_u32: (a: number, b: number) => [number, number, number];
3698
3843
  readonly opendx_values_f64: (a: number, b: number) => [number, number, number];
@@ -3700,11 +3845,14 @@ export interface InitOutput {
3700
3845
  readonly orca_input_to_json: (a: number, b: number) => [number, number, number, number];
3701
3846
  readonly orca_output_to_json: (a: number, b: number) => [number, number, number, number];
3702
3847
  readonly pains_matches_json: (a: number) => [number, number];
3848
+ readonly parse_ccd_json: (a: number, b: number) => [number, number, number, number];
3703
3849
  readonly parse_cjson_record_json: (a: number, b: number) => [number, number, number, number];
3704
3850
  readonly parse_cxsmarts_json: (a: number, b: number) => [number, number, number, number];
3705
3851
  readonly parse_cxsmiles_json: (a: number, b: number) => [number, number, number, number];
3852
+ readonly parse_hin_record_json: (a: number, b: number) => [number, number, number, number];
3706
3853
  readonly parse_mol2_record_json: (a: number, b: number) => [number, number, number, number];
3707
3854
  readonly parse_smiles: (a: number, b: number) => [number, number, number];
3855
+ readonly pdb_conect_frame_json: (a: number, b: number, c: number) => [number, number, number, number];
3708
3856
  readonly pdb_coords_json: (a: number, b: number) => [number, number];
3709
3857
  readonly peoe_vsa_json: (a: number) => [number, number];
3710
3858
  readonly periodic_structure_fingerprint_json: (a: number, b: number, c: number, d: number) => [number, number];
@@ -3754,11 +3902,13 @@ export interface InitOutput {
3754
3902
  readonly reaction_document_to_rxn_v1: (a: number, b: number) => [number, number, number, number];
3755
3903
  readonly reaction_smarts_match: (a: number, b: number, c: number, d: number) => [number, number, number];
3756
3904
  readonly remove_hydrogens: (a: number) => number;
3905
+ readonly remove_redundant_tetrahedral_stereo: (a: number, b: any, c: any) => [number, number, number];
3757
3906
  readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3758
3907
  readonly rgroup_decompose_columns_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3759
3908
  readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3760
3909
  readonly ring_families_json: (a: number) => [number, number, number, number];
3761
3910
  readonly roundtrip_cjson_record: (a: number, b: number) => [number, number, number, number];
3911
+ readonly roundtrip_hin_record: (a: number, b: number) => [number, number, number, number];
3762
3912
  readonly roundtrip_mol2_record: (a: number, b: number) => [number, number, number, number];
3763
3913
  readonly roundtrip_mol_v3000_block: (a: number, b: number) => [number, number, number, number];
3764
3914
  readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
@@ -3784,8 +3934,9 @@ export interface InitOutput {
3784
3934
  readonly smarts_match_atoms: (a: number, b: number, c: number) => [number, number, number, number];
3785
3935
  readonly smarts_match_atoms_with_chirality: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3786
3936
  readonly smiles_array_to_sdf: (a: number, b: number) => [number, number, number, number];
3787
- readonly smiles_to_mol2: (a: number, b: number) => [number, number];
3937
+ readonly smiles_to_mol2: (a: number, b: number, c: number) => [number, number];
3788
3938
  readonly smiles_to_pdbqt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
3939
+ readonly smiles_to_pdbqt_checked: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
3789
3940
  readonly smiles_to_svg_highlighted: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
3790
3941
  readonly smilesbatchstreamhandle_finish_json: (a: number) => [number, number, number, number];
3791
3942
  readonly smilesbatchstreamhandle_new: () => number;
@@ -3813,6 +3964,11 @@ export interface InitOutput {
3813
3964
  readonly tanimoto_topo_path: (a: number, b: number) => number;
3814
3965
  readonly tanimoto_torsion: (a: number, b: number) => number;
3815
3966
  readonly tautomer_parent_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
3967
+ readonly tetrahedralcleanupresult_atom_index: (a: number) => number;
3968
+ readonly tetrahedralcleanupresult_molecule: (a: number) => number;
3969
+ readonly tetrahedralcleanupresult_removed: (a: number) => number;
3970
+ readonly tetrahedralcleanupresult_report_json: (a: number) => [number, number];
3971
+ readonly tetrahedralcleanupresult_search_visits: (a: number) => number;
3816
3972
  readonly to_cml: (a: number) => [number, number];
3817
3973
  readonly to_extxyz_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3818
3974
  readonly to_mol_block: (a: number) => [number, number];
@@ -3849,6 +4005,7 @@ export interface InitOutput {
3849
4005
  readonly __wbindgen_externrefs: WebAssembly.Table;
3850
4006
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
3851
4007
  readonly __externref_table_dealloc: (a: number) => void;
4008
+ readonly __externref_drop_slice: (a: number, b: number) => void;
3852
4009
  readonly __wbindgen_start: () => void;
3853
4010
  }
3854
4011
 
package/chematic_wasm.js CHANGED
@@ -1243,6 +1243,39 @@ export class MolHandle {
1243
1243
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1244
1244
  }
1245
1245
  }
1246
+ /**
1247
+ * Distance-geometry bounds with user bond-length, angle and torsion
1248
+ * constraints injected before triangle smoothing.
1249
+ *
1250
+ * `constraintsJson` contains optional camelCase arrays `bondLengths`,
1251
+ * `bondAngles`, and `torsions`; atom indices are zero based. Lengths use
1252
+ * angstrom and angles use degrees.
1253
+ * @param {string} constraints_json
1254
+ * @param {boolean} set15bounds
1255
+ * @param {boolean} do_triangle_smoothing
1256
+ * @param {boolean} use_macrocycle_14_config
1257
+ * @returns {string}
1258
+ */
1259
+ rdkit_bounds_matrix_with_constraints_json(constraints_json, set15bounds, do_triangle_smoothing, use_macrocycle_14_config) {
1260
+ let deferred3_0;
1261
+ let deferred3_1;
1262
+ try {
1263
+ const ptr0 = passStringToWasm0(constraints_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1264
+ const len0 = WASM_VECTOR_LEN;
1265
+ const ret = wasm.molhandle_rdkit_bounds_matrix_with_constraints_json(this.__wbg_ptr, ptr0, len0, set15bounds, do_triangle_smoothing, use_macrocycle_14_config);
1266
+ var ptr2 = ret[0];
1267
+ var len2 = ret[1];
1268
+ if (ret[3]) {
1269
+ ptr2 = 0; len2 = 0;
1270
+ throw takeFromExternrefTable0(ret[2]);
1271
+ }
1272
+ deferred3_0 = ptr2;
1273
+ deferred3_1 = len2;
1274
+ return getStringFromWasm0(ptr2, len2);
1275
+ } finally {
1276
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1277
+ }
1278
+ }
1246
1279
  /**
1247
1280
  * RDKit `CalcRMS`, bounded by `max_matches <= 1_000_000`.
1248
1281
  * @param {string} probe_coords_json
@@ -1310,6 +1343,33 @@ export class MolHandle {
1310
1343
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1311
1344
  }
1312
1345
  }
1346
+ /**
1347
+ * Checked 3D matrix in prepared RDKit atom order. JSON has one [x,y,z]
1348
+ * row per prepared atom; malformed/nonfinite/unrepresentable input refuses.
1349
+ * @param {string} coords_json
1350
+ * @param {boolean} use_atom_wts
1351
+ * @returns {string}
1352
+ */
1353
+ rdkit_distance_matrix_3d_checked_json(coords_json, use_atom_wts) {
1354
+ let deferred3_0;
1355
+ let deferred3_1;
1356
+ try {
1357
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1358
+ const len0 = WASM_VECTOR_LEN;
1359
+ const ret = wasm.molhandle_rdkit_distance_matrix_3d_checked_json(this.__wbg_ptr, ptr0, len0, use_atom_wts);
1360
+ var ptr2 = ret[0];
1361
+ var len2 = ret[1];
1362
+ if (ret[3]) {
1363
+ ptr2 = 0; len2 = 0;
1364
+ throw takeFromExternrefTable0(ret[2]);
1365
+ }
1366
+ deferred3_0 = ptr2;
1367
+ deferred3_1 = len2;
1368
+ return getStringFromWasm0(ptr2, len2);
1369
+ } finally {
1370
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1371
+ }
1372
+ }
1313
1373
  /**
1314
1374
  * Seeded RDKit ETKDGv3 coordinates as JSON. Call on an
1315
1375
  * explicit-hydrogen molecule. At most 512 atoms are accepted.
@@ -1335,6 +1395,34 @@ export class MolHandle {
1335
1395
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1336
1396
  }
1337
1397
  }
1398
+ /**
1399
+ * Seeded ETKDG embedding using constraints injected before triangle
1400
+ * smoothing. Returns one `[x,y,z]` row per atom as JSON.
1401
+ * @param {string} constraints_json
1402
+ * @param {number} random_seed
1403
+ * @param {number} max_iterations
1404
+ * @returns {string}
1405
+ */
1406
+ rdkit_embed_with_constraints_json(constraints_json, random_seed, max_iterations) {
1407
+ let deferred3_0;
1408
+ let deferred3_1;
1409
+ try {
1410
+ const ptr0 = passStringToWasm0(constraints_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1411
+ const len0 = WASM_VECTOR_LEN;
1412
+ const ret = wasm.molhandle_rdkit_embed_with_constraints_json(this.__wbg_ptr, ptr0, len0, random_seed, max_iterations);
1413
+ var ptr2 = ret[0];
1414
+ var len2 = ret[1];
1415
+ if (ret[3]) {
1416
+ ptr2 = 0; len2 = 0;
1417
+ throw takeFromExternrefTable0(ret[2]);
1418
+ }
1419
+ deferred3_0 = ptr2;
1420
+ deferred3_1 = len2;
1421
+ return getStringFromWasm0(ptr2, len2);
1422
+ } finally {
1423
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1424
+ }
1425
+ }
1338
1426
  /**
1339
1427
  * RDKit MolHash by case-insensitive function name.
1340
1428
  * @param {string} _function
@@ -1554,6 +1642,30 @@ export class MolHandle {
1554
1642
  const ret = wasm.molhandle_rotatable_bond_count(this.__wbg_ptr);
1555
1643
  return ret >>> 0;
1556
1644
  }
1645
+ /**
1646
+ * Checked rooted SMILES as {smiles, atom_order}; order maps parsed to original indices.
1647
+ * Limited to 256 atoms and verified ordinary tetrahedral frames; see the Rust API.
1648
+ * @param {number} rooted_at_atom
1649
+ * @returns {string}
1650
+ */
1651
+ smiles_rooted_checked_json(rooted_at_atom) {
1652
+ let deferred2_0;
1653
+ let deferred2_1;
1654
+ try {
1655
+ const ret = wasm.molhandle_smiles_rooted_checked_json(this.__wbg_ptr, rooted_at_atom);
1656
+ var ptr1 = ret[0];
1657
+ var len1 = ret[1];
1658
+ if (ret[3]) {
1659
+ ptr1 = 0; len1 = 0;
1660
+ throw takeFromExternrefTable0(ret[2]);
1661
+ }
1662
+ deferred2_0 = ptr1;
1663
+ deferred2_1 = len1;
1664
+ return getStringFromWasm0(ptr1, len1);
1665
+ } finally {
1666
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1667
+ }
1668
+ }
1557
1669
  /**
1558
1670
  * Sum of EState indices over all heavy atoms.
1559
1671
  * @returns {number}
@@ -1971,6 +2083,74 @@ export class SmilesBatchStreamHandle {
1971
2083
  }
1972
2084
  if (Symbol.dispose) SmilesBatchStreamHandle.prototype[Symbol.dispose] = SmilesBatchStreamHandle.prototype.free;
1973
2085
 
2086
+ /**
2087
+ * One proof result. The witness maps original atoms to a copy with only the
2088
+ * selected tetrahedral declaration inverted; it fixes that selected atom.
2089
+ */
2090
+ export class TetrahedralCleanupResult {
2091
+ static __wrap(ptr) {
2092
+ const obj = Object.create(TetrahedralCleanupResult.prototype);
2093
+ obj.__wbg_ptr = ptr;
2094
+ TetrahedralCleanupResultFinalization.register(obj, obj.__wbg_ptr, obj);
2095
+ return obj;
2096
+ }
2097
+ __destroy_into_raw() {
2098
+ const ptr = this.__wbg_ptr;
2099
+ this.__wbg_ptr = 0;
2100
+ TetrahedralCleanupResultFinalization.unregister(this);
2101
+ return ptr;
2102
+ }
2103
+ free() {
2104
+ const ptr = this.__destroy_into_raw();
2105
+ wasm.__wbg_tetrahedralcleanupresult_free(ptr, 0);
2106
+ }
2107
+ /**
2108
+ * @returns {number}
2109
+ */
2110
+ get atom_index() {
2111
+ const ret = wasm.tetrahedralcleanupresult_atom_index(this.__wbg_ptr);
2112
+ return ret >>> 0;
2113
+ }
2114
+ /**
2115
+ * Independent molecule; all source labels and other configurations remain.
2116
+ * @returns {MolHandle}
2117
+ */
2118
+ get molecule() {
2119
+ const ret = wasm.tetrahedralcleanupresult_molecule(this.__wbg_ptr);
2120
+ return MolHandle.__wrap(ret);
2121
+ }
2122
+ /**
2123
+ * @returns {boolean}
2124
+ */
2125
+ get removed() {
2126
+ const ret = wasm.tetrahedralcleanupresult_removed(this.__wbg_ptr);
2127
+ return ret !== 0;
2128
+ }
2129
+ /**
2130
+ * @returns {string}
2131
+ */
2132
+ report_json() {
2133
+ let deferred1_0;
2134
+ let deferred1_1;
2135
+ try {
2136
+ const ret = wasm.tetrahedralcleanupresult_report_json(this.__wbg_ptr);
2137
+ deferred1_0 = ret[0];
2138
+ deferred1_1 = ret[1];
2139
+ return getStringFromWasm0(ret[0], ret[1]);
2140
+ } finally {
2141
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2142
+ }
2143
+ }
2144
+ /**
2145
+ * @returns {number}
2146
+ */
2147
+ get search_visits() {
2148
+ const ret = wasm.tetrahedralcleanupresult_search_visits(this.__wbg_ptr);
2149
+ return ret >>> 0;
2150
+ }
2151
+ }
2152
+ if (Symbol.dispose) TetrahedralCleanupResult.prototype[Symbol.dispose] = TetrahedralCleanupResult.prototype.free;
2153
+
1974
2154
  /**
1975
2155
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
1976
2156
  * @param {MolHandle} mol
@@ -2525,6 +2705,34 @@ export function cdxml_to_smiles_json(cdxml) {
2525
2705
  }
2526
2706
  }
2527
2707
 
2708
+ /**
2709
+ * Read all CDXML fragments with optional Bold/Hash/Dash stereo inference.
2710
+ * Retains the existing input/atom/fragment limits and JSON result shape.
2711
+ * @param {string} cdxml
2712
+ * @param {boolean} infer_nondirectional_stereo
2713
+ * @returns {string}
2714
+ */
2715
+ export function cdxml_to_smiles_json_with_options(cdxml, infer_nondirectional_stereo) {
2716
+ let deferred3_0;
2717
+ let deferred3_1;
2718
+ try {
2719
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2720
+ const len0 = WASM_VECTOR_LEN;
2721
+ const ret = wasm.cdxml_to_smiles_json_with_options(ptr0, len0, infer_nondirectional_stereo);
2722
+ var ptr2 = ret[0];
2723
+ var len2 = ret[1];
2724
+ if (ret[3]) {
2725
+ ptr2 = 0; len2 = 0;
2726
+ throw takeFromExternrefTable0(ret[2]);
2727
+ }
2728
+ deferred3_0 = ptr2;
2729
+ deferred3_1 = len2;
2730
+ return getStringFromWasm0(ptr2, len2);
2731
+ } finally {
2732
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2733
+ }
2734
+ }
2735
+
2528
2736
  /**
2529
2737
  * Compute the charge Parent and return a status-shaped JSON result.
2530
2738
  * @param {MolHandle} mol
@@ -2565,6 +2773,37 @@ export function chematic_version() {
2565
2773
  }
2566
2774
  }
2567
2775
 
2776
+ /**
2777
+ * Exact source bytes, projected XML, fragment coordinates and CDX omission tags.
2778
+ * CDXML uses the existing graph projection; omissions lists CDX tags only.
2779
+ * @param {Uint8Array} data
2780
+ * @param {string} format
2781
+ * @param {boolean} allow_metadata_loss
2782
+ * @returns {string}
2783
+ */
2784
+ export function chemdraw_block_report_json(data, format, allow_metadata_loss) {
2785
+ let deferred4_0;
2786
+ let deferred4_1;
2787
+ try {
2788
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2789
+ const len0 = WASM_VECTOR_LEN;
2790
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2791
+ const len1 = WASM_VECTOR_LEN;
2792
+ const ret = wasm.chemdraw_block_report_json(ptr0, len0, ptr1, len1, allow_metadata_loss);
2793
+ var ptr3 = ret[0];
2794
+ var len3 = ret[1];
2795
+ if (ret[3]) {
2796
+ ptr3 = 0; len3 = 0;
2797
+ throw takeFromExternrefTable0(ret[2]);
2798
+ }
2799
+ deferred4_0 = ptr3;
2800
+ deferred4_1 = len3;
2801
+ return getStringFromWasm0(ptr3, len3);
2802
+ } finally {
2803
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2804
+ }
2805
+ }
2806
+
2568
2807
  /**
2569
2808
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
2570
2809
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
@@ -3982,7 +4221,9 @@ export function generic_murcko_scaffold(mol) {
3982
4221
  *
3983
4222
  * Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
3984
4223
  * `charge` (formal charge integer), `isAromatic` (bool),
3985
- * `totalHydrogens` (explicit + implicit H count, integer).
4224
+ * `totalHydrogens` (attached H: bracket/inferred plus explicit H neighbors).
4225
+ * This excludes the atom itself when it is H; use `num_hydrogens` for the
4226
+ * molecule's total. Isotopic H neighbors count as hydrogen.
3986
4227
  * sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
3987
4228
  * @param {MolHandle} mol
3988
4229
  * @param {number} idx
@@ -4389,6 +4630,33 @@ export function isotope_parent_json(mol) {
4389
4630
  }
4390
4631
  }
4391
4632
 
4633
+ /**
4634
+ * Replace only ar bond tokens in a bounded neutral aromatic MOL2 record.
4635
+ * Retains atom types and every other source byte; errors throw, no partial text.
4636
+ * @param {string} text
4637
+ * @returns {string}
4638
+ */
4639
+ export function kekulize_mol2_record(text) {
4640
+ let deferred3_0;
4641
+ let deferred3_1;
4642
+ try {
4643
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4644
+ const len0 = WASM_VECTOR_LEN;
4645
+ const ret = wasm.kekulize_mol2_record(ptr0, len0);
4646
+ var ptr2 = ret[0];
4647
+ var len2 = ret[1];
4648
+ if (ret[3]) {
4649
+ ptr2 = 0; len2 = 0;
4650
+ throw takeFromExternrefTable0(ret[2]);
4651
+ }
4652
+ deferred3_0 = ptr2;
4653
+ deferred3_1 = len2;
4654
+ return getStringFromWasm0(ptr2, len2);
4655
+ } finally {
4656
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
4657
+ }
4658
+ }
4659
+
4392
4660
  /**
4393
4661
  * Per-atom Labute approximate surface area contributions as a JSON array of f64.
4394
4662
  *
@@ -5386,6 +5654,23 @@ export function mol_block_stereo_loss_json(mol) {
5386
5654
  }
5387
5655
  }
5388
5656
 
5657
+ /**
5658
+ * Project explicit CCD topology. Unassigned stereo annotations require
5659
+ * explicit loss consent; coordinates remain in parse_ccd_json's record.
5660
+ * @param {string} text
5661
+ * @param {boolean} allow_stereo_loss
5662
+ * @returns {MolHandle}
5663
+ */
5664
+ export function mol_from_ccd(text, allow_stereo_loss) {
5665
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5666
+ const len0 = WASM_VECTOR_LEN;
5667
+ const ret = wasm.mol_from_ccd(ptr0, len0, allow_stereo_loss);
5668
+ if (ret[2]) {
5669
+ throw takeFromExternrefTable0(ret[1]);
5670
+ }
5671
+ return MolHandle.__wrap(ret[0]);
5672
+ }
5673
+
5389
5674
  /**
5390
5675
  * Only the first molecular fragment in the document is returned.
5391
5676
  * Returns a JS error if the document cannot be parsed.
@@ -5402,6 +5687,24 @@ export function mol_from_cdxml(cdxml) {
5402
5687
  return MolHandle.__wrap(ret[0]);
5403
5688
  }
5404
5689
 
5690
+ /**
5691
+ * Read the first CDXML fragment, optionally inferring Bold/Hash/Dash stereo.
5692
+ * Non-directional displays are heuristic: ambiguous or degenerate drawings
5693
+ * remain unassigned. `false` has the same behavior as `mol_from_cdxml`.
5694
+ * @param {string} cdxml
5695
+ * @param {boolean} infer_nondirectional_stereo
5696
+ * @returns {MolHandle}
5697
+ */
5698
+ export function mol_from_cdxml_with_options(cdxml, infer_nondirectional_stereo) {
5699
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5700
+ const len0 = WASM_VECTOR_LEN;
5701
+ const ret = wasm.mol_from_cdxml_with_options(ptr0, len0, infer_nondirectional_stereo);
5702
+ if (ret[2]) {
5703
+ throw takeFromExternrefTable0(ret[1]);
5704
+ }
5705
+ return MolHandle.__wrap(ret[0]);
5706
+ }
5707
+
5405
5708
  /**
5406
5709
  * Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
5407
5710
  *
@@ -5574,6 +5877,23 @@ export function mol_from_pdb(pdb) {
5574
5877
  return MolHandle.__wrap(ret);
5575
5878
  }
5576
5879
 
5880
+ /**
5881
+ * Explicit CONECT graph, without distance-based bonding. Only unmodelled,
5882
+ * single-location atoms with explicit element fields are accepted.
5883
+ * @param {string} input
5884
+ * @param {boolean} allow_extended_targets
5885
+ * @returns {MolHandle}
5886
+ */
5887
+ export function mol_from_pdb_conect(input, allow_extended_targets) {
5888
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5889
+ const len0 = WASM_VECTOR_LEN;
5890
+ const ret = wasm.mol_from_pdb_conect(ptr0, len0, allow_extended_targets);
5891
+ if (ret[2]) {
5892
+ throw takeFromExternrefTable0(ret[1]);
5893
+ }
5894
+ return MolHandle.__wrap(ret[0]);
5895
+ }
5896
+
5577
5897
  /**
5578
5898
  * Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
5579
5899
  * return an error instead of producing a partially recovered molecule.
@@ -5903,6 +6223,27 @@ export function molecule_report_json(smiles) {
5903
6223
  }
5904
6224
  }
5905
6225
 
6226
+ /**
6227
+ * Concrete CDX/CDXML fragment handles, in source fragment order.
6228
+ * @param {Uint8Array} data
6229
+ * @param {string} format
6230
+ * @param {boolean} allow_metadata_loss
6231
+ * @returns {MolHandle[]}
6232
+ */
6233
+ export function mols_from_chemdraw_block(data, format, allow_metadata_loss) {
6234
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
6235
+ const len0 = WASM_VECTOR_LEN;
6236
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6237
+ const len1 = WASM_VECTOR_LEN;
6238
+ const ret = wasm.mols_from_chemdraw_block(ptr0, len0, ptr1, len1, allow_metadata_loss);
6239
+ if (ret[3]) {
6240
+ throw takeFromExternrefTable0(ret[2]);
6241
+ }
6242
+ var v3 = getArrayJsValueFromWasm0(ret[0], ret[1]);
6243
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6244
+ return v3;
6245
+ }
6246
+
5906
6247
  /**
5907
6248
  * MQN descriptor (42 integer values: Molecular Quantum Numbers).
5908
6249
  * @param {MolHandle} mol
@@ -6098,6 +6439,18 @@ export function nucleic_acid_validate_json(document_json) {
6098
6439
  }
6099
6440
  }
6100
6441
 
6442
+ /**
6443
+ * Total hydrogen nuclei: explicit nodes plus attached bracket/inferred H.
6444
+ * Isotopic, charged, bridging and disconnected H nodes each count once.
6445
+ * @param {MolHandle} mol
6446
+ * @returns {number}
6447
+ */
6448
+ export function num_hydrogens(mol) {
6449
+ _assertClass(mol, MolHandle);
6450
+ const ret = wasm.num_hydrogens(mol.__wbg_ptr);
6451
+ return ret >>> 0;
6452
+ }
6453
+
6101
6454
  /**
6102
6455
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
6103
6456
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
@@ -6276,6 +6629,33 @@ export function pains_matches_json(mol) {
6276
6629
  }
6277
6630
  }
6278
6631
 
6632
+ /**
6633
+ * One CCD template including source IDs, charges, explicit bonds, optional
6634
+ * coordinates and unassigned stereo labels. No atom_site bond perception.
6635
+ * @param {string} text
6636
+ * @returns {string}
6637
+ */
6638
+ export function parse_ccd_json(text) {
6639
+ let deferred3_0;
6640
+ let deferred3_1;
6641
+ try {
6642
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6643
+ const len0 = WASM_VECTOR_LEN;
6644
+ const ret = wasm.parse_ccd_json(ptr0, len0);
6645
+ var ptr2 = ret[0];
6646
+ var len2 = ret[1];
6647
+ if (ret[3]) {
6648
+ ptr2 = 0; len2 = 0;
6649
+ throw takeFromExternrefTable0(ret[2]);
6650
+ }
6651
+ deferred3_0 = ptr2;
6652
+ deferred3_1 = len2;
6653
+ return getStringFromWasm0(ptr2, len2);
6654
+ } finally {
6655
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6656
+ }
6657
+ }
6658
+
6279
6659
  /**
6280
6660
  * Inspect strictly validated CJSON with exact source and opaque field paths.
6281
6661
  * @param {string} text
@@ -6360,6 +6740,32 @@ export function parse_cxsmiles_json(s) {
6360
6740
  }
6361
6741
  }
6362
6742
 
6743
+ /**
6744
+ * Inspect the bounded HIN record, including literal aromatic bonds and charges.
6745
+ * @param {string} text
6746
+ * @returns {string}
6747
+ */
6748
+ export function parse_hin_record_json(text) {
6749
+ let deferred3_0;
6750
+ let deferred3_1;
6751
+ try {
6752
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6753
+ const len0 = WASM_VECTOR_LEN;
6754
+ const ret = wasm.parse_hin_record_json(ptr0, len0);
6755
+ var ptr2 = ret[0];
6756
+ var len2 = ret[1];
6757
+ if (ret[3]) {
6758
+ ptr2 = 0; len2 = 0;
6759
+ throw takeFromExternrefTable0(ret[2]);
6760
+ }
6761
+ deferred3_0 = ptr2;
6762
+ deferred3_1 = len2;
6763
+ return getStringFromWasm0(ptr2, len2);
6764
+ } finally {
6765
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6766
+ }
6767
+ }
6768
+
6363
6769
  /**
6364
6770
  * Inspect partial charges, atom types and source retention for MOL2.
6365
6771
  * @param {string} text
@@ -6403,6 +6809,34 @@ export function parse_smiles(s) {
6403
6809
  return MolHandle.__wrap(ret[0]);
6404
6810
  }
6405
6811
 
6812
+ /**
6813
+ * Indexed atoms/charges, bonds, coordinates and source serials for the same
6814
+ * explicit CONECT projection. Molecular identity and coordinate order agree.
6815
+ * @param {string} input
6816
+ * @param {boolean} allow_extended_targets
6817
+ * @returns {string}
6818
+ */
6819
+ export function pdb_conect_frame_json(input, allow_extended_targets) {
6820
+ let deferred3_0;
6821
+ let deferred3_1;
6822
+ try {
6823
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6824
+ const len0 = WASM_VECTOR_LEN;
6825
+ const ret = wasm.pdb_conect_frame_json(ptr0, len0, allow_extended_targets);
6826
+ var ptr2 = ret[0];
6827
+ var len2 = ret[1];
6828
+ if (ret[3]) {
6829
+ ptr2 = 0; len2 = 0;
6830
+ throw takeFromExternrefTable0(ret[2]);
6831
+ }
6832
+ deferred3_0 = ptr2;
6833
+ deferred3_1 = len2;
6834
+ return getStringFromWasm0(ptr2, len2);
6835
+ } finally {
6836
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6837
+ }
6838
+ }
6839
+
6406
6840
  /**
6407
6841
  * Extract the atomic coordinates from a PDB block, in the SAME atom order
6408
6842
  * `mol_from_pdb` returns topology for (both read the identical underlying
@@ -7360,6 +7794,24 @@ export function remove_hydrogens(mol) {
7360
7794
  return MolHandle.__wrap(ret);
7361
7795
  }
7362
7796
 
7797
+ /**
7798
+ * Opt-in exact tetrahedral cleanup. Both index and budget must be JS numbers
7799
+ * containing integers (bool/string/null are rejected). The kernel caps inputs
7800
+ * at 64 atoms/128 bonds and max_visits at 10000000. Errors throw without a result.
7801
+ * @param {MolHandle} mol
7802
+ * @param {any} atom_index
7803
+ * @param {any} max_visits
7804
+ * @returns {TetrahedralCleanupResult}
7805
+ */
7806
+ export function remove_redundant_tetrahedral_stereo(mol, atom_index, max_visits) {
7807
+ _assertClass(mol, MolHandle);
7808
+ const ret = wasm.remove_redundant_tetrahedral_stereo(mol.__wbg_ptr, atom_index, max_visits);
7809
+ if (ret[2]) {
7810
+ throw takeFromExternrefTable0(ret[1]);
7811
+ }
7812
+ return TetrahedralCleanupResult.__wrap(ret[0]);
7813
+ }
7814
+
7363
7815
  /**
7364
7816
  * Single-step retrosynthetic disconnection (issue #91).
7365
7817
  *
@@ -7545,6 +7997,32 @@ export function roundtrip_cjson_record(text) {
7545
7997
  }
7546
7998
  }
7547
7999
 
8000
+ /**
8001
+ * Validate a single HIN record and retain exact source text and line endings.
8002
+ * @param {string} text
8003
+ * @returns {string}
8004
+ */
8005
+ export function roundtrip_hin_record(text) {
8006
+ let deferred3_0;
8007
+ let deferred3_1;
8008
+ try {
8009
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8010
+ const len0 = WASM_VECTOR_LEN;
8011
+ const ret = wasm.roundtrip_hin_record(ptr0, len0);
8012
+ var ptr2 = ret[0];
8013
+ var len2 = ret[1];
8014
+ if (ret[3]) {
8015
+ ptr2 = 0; len2 = 0;
8016
+ throw takeFromExternrefTable0(ret[2]);
8017
+ }
8018
+ deferred3_0 = ptr2;
8019
+ deferred3_1 = len2;
8020
+ return getStringFromWasm0(ptr2, len2);
8021
+ } finally {
8022
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
8023
+ }
8024
+ }
8025
+
7548
8026
  /**
7549
8027
  * Validate one MOL2 record and preserve its exact source, including metadata.
7550
8028
  * @param {string} text
@@ -8314,17 +8792,20 @@ export function smiles_array_to_sdf(smiles_json) {
8314
8792
  /**
8315
8793
  * Convert a SMILES to a minimal Tripos MOL2 string (no 3D coordinates).
8316
8794
  *
8317
- * Returns `"error:<msg>"` on parse failure.
8795
+ * Optional `atom_bond_adjacent=true` emits ATOM → BOND → UNITY. Some
8796
+ * readers (including Open Babel 3.2.1) ignore UNITY charges in this order.
8797
+ * Omit it to retain existing bytes. Returns `"error:<msg>"` on parse failure.
8318
8798
  * @param {string} smiles
8799
+ * @param {boolean | null} [atom_bond_adjacent]
8319
8800
  * @returns {string}
8320
8801
  */
8321
- export function smiles_to_mol2(smiles) {
8802
+ export function smiles_to_mol2(smiles, atom_bond_adjacent) {
8322
8803
  let deferred2_0;
8323
8804
  let deferred2_1;
8324
8805
  try {
8325
8806
  const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8326
8807
  const len0 = WASM_VECTOR_LEN;
8327
- const ret = wasm.smiles_to_mol2(ptr0, len0);
8808
+ const ret = wasm.smiles_to_mol2(ptr0, len0, isLikeNone(atom_bond_adjacent) ? 0xFFFFFF : atom_bond_adjacent ? 1 : 0);
8328
8809
  deferred2_0 = ret[0];
8329
8810
  deferred2_1 = ret[1];
8330
8811
  return getStringFromWasm0(ret[0], ret[1]);
@@ -8368,6 +8849,45 @@ export function smiles_to_pdbqt(smiles, coords_json, charges_json, name) {
8368
8849
  }
8369
8850
  }
8370
8851
 
8852
+ /**
8853
+ * Write rigid PDBQT or throw for malformed/unrepresentable input. Coordinates
8854
+ * are JSON [x,y,z] arrays in Å; charges are JSON numbers in e. Both arrays must
8855
+ * contain exactly one value per graph atom, including explicit H. No defaults,
8856
+ * charge calculation, atom removal or ligand torsion preparation are applied.
8857
+ * AutoDock types retain the legacy heuristic, with unknown `X` types rejected.
8858
+ * @param {string} smiles
8859
+ * @param {string} coords_json
8860
+ * @param {string} charges_json
8861
+ * @param {string} name
8862
+ * @returns {string}
8863
+ */
8864
+ export function smiles_to_pdbqt_checked(smiles, coords_json, charges_json, name) {
8865
+ let deferred6_0;
8866
+ let deferred6_1;
8867
+ try {
8868
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8869
+ const len0 = WASM_VECTOR_LEN;
8870
+ const ptr1 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8871
+ const len1 = WASM_VECTOR_LEN;
8872
+ const ptr2 = passStringToWasm0(charges_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8873
+ const len2 = WASM_VECTOR_LEN;
8874
+ const ptr3 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8875
+ const len3 = WASM_VECTOR_LEN;
8876
+ const ret = wasm.smiles_to_pdbqt_checked(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
8877
+ var ptr5 = ret[0];
8878
+ var len5 = ret[1];
8879
+ if (ret[3]) {
8880
+ ptr5 = 0; len5 = 0;
8881
+ throw takeFromExternrefTable0(ret[2]);
8882
+ }
8883
+ deferred6_0 = ptr5;
8884
+ deferred6_1 = len5;
8885
+ return getStringFromWasm0(ptr5, len5);
8886
+ } finally {
8887
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
8888
+ }
8889
+ }
8890
+
8371
8891
  /**
8372
8892
  * Render a highlighted SVG from a SMILES string in one call.
8373
8893
  *
@@ -9560,6 +10080,12 @@ function __wbg_get_imports() {
9560
10080
  const ret = arg0 === undefined;
9561
10081
  return ret;
9562
10082
  },
10083
+ __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
10084
+ const obj = arg1;
10085
+ const ret = typeof(obj) === 'number' ? obj : undefined;
10086
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
10087
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
10088
+ },
9563
10089
  __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
9564
10090
  const obj = arg1;
9565
10091
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -9574,6 +10100,10 @@ function __wbg_get_imports() {
9574
10100
  __wbg_error_c9cf3fc2064683a9: function(arg0) {
9575
10101
  console.error(arg0);
9576
10102
  },
10103
+ __wbg_molhandle_new: function(arg0) {
10104
+ const ret = MolHandle.__wrap(arg0);
10105
+ return ret;
10106
+ },
9577
10107
  __wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
9578
10108
  const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
9579
10109
  return ret;
@@ -9656,6 +10186,9 @@ const RdkitSearchIndexFinalization = (typeof FinalizationRegistry === 'undefined
9656
10186
  const SmilesBatchStreamHandleFinalization = (typeof FinalizationRegistry === 'undefined')
9657
10187
  ? { register: () => {}, unregister: () => {} }
9658
10188
  : new FinalizationRegistry(ptr => wasm.__wbg_smilesbatchstreamhandle_free(ptr, 1));
10189
+ const TetrahedralCleanupResultFinalization = (typeof FinalizationRegistry === 'undefined')
10190
+ ? { register: () => {}, unregister: () => {} }
10191
+ : new FinalizationRegistry(ptr => wasm.__wbg_tetrahedralcleanupresult_free(ptr, 1));
9659
10192
 
9660
10193
  function addToExternrefTable0(obj) {
9661
10194
  const idx = wasm.__externref_table_alloc();
@@ -9674,6 +10207,17 @@ function getArrayF64FromWasm0(ptr, len) {
9674
10207
  return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
9675
10208
  }
9676
10209
 
10210
+ function getArrayJsValueFromWasm0(ptr, len) {
10211
+ ptr = ptr >>> 0;
10212
+ const mem = getDataViewMemory0();
10213
+ const result = [];
10214
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
10215
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
10216
+ }
10217
+ wasm.__externref_drop_slice(ptr, len);
10218
+ return result;
10219
+ }
10220
+
9677
10221
  function getArrayU32FromWasm0(ptr, len) {
9678
10222
  ptr = ptr >>> 0;
9679
10223
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
@@ -9731,6 +10275,13 @@ function passArray32ToWasm0(arg, malloc) {
9731
10275
  return ptr;
9732
10276
  }
9733
10277
 
10278
+ function passArray8ToWasm0(arg, malloc) {
10279
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
10280
+ getUint8ArrayMemory0().set(arg, ptr / 1);
10281
+ WASM_VECTOR_LEN = arg.length;
10282
+ return ptr;
10283
+ }
10284
+
9734
10285
  function passStringToWasm0(arg, malloc, realloc) {
9735
10286
  if (realloc === undefined) {
9736
10287
  const buf = cachedTextEncoder.encode(arg);
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Kentaro Tanabe (kent-tokyo) <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
8
- "version": "1.1.4",
8
+ "version": "1.1.6",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",