@kent-tokyo/chematic 1.1.0 → 1.1.2

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.0. The binding keeps bounded parsing,
7
+ The current workspace line is 1.1.2. 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
 
@@ -18,7 +18,7 @@ npm install @kent-tokyo/chematic
18
18
 
19
19
  - Parse SMILES strings into molecule handles
20
20
  - Molecular descriptors: MW, TPSA, LogP, Fsp3, QED, exact mass, rotatable bonds, HBD/HBA, aromatic ring count, Labute ASA
21
- - Drug-likeness filters: Lipinski, Veber, Egan, REOS, Ghose
21
+ - Drug-likeness filters: Lipinski, Veber, Egan, REOS, Ghose, PAINS, and Brenk
22
22
  - EState indices (Hall & Kier 1991): per-atom values, sum/max/min
23
23
  - Gasteiger-Marsili PEOE partial charges: per-heavy-atom charges
24
24
  - VSA descriptors: SlogP_VSA (×12), SMR_VSA (×10), PEOE_VSA (×14)
@@ -43,6 +43,11 @@ npm install @kent-tokyo/chematic
43
43
  `MolHandle.atom_pseudo_labels_json()` and immutable edits through
44
44
  `mol_with_atom_pseudo_label`; labels are bounded to `*`, `R`, and
45
45
  `R1..R9999`
46
+ - Label-stable R-group decomposition through
47
+ `rgroup_decompose_columns_json(smilesJson, coreSmarts)`. The returned JSON
48
+ contains input-aligned `Core`, `R1`, `R2`, ... columns and uses `null` for
49
+ unmatched molecules or substituents absent from a matched row. The legacy
50
+ `rgroup_decompose_json` row API is unchanged.
46
51
  - PDBx/mmCIF, PQR, QCSchema JSON, ORCA input/output, Gaussian Cube, OpenDX,
47
52
  and LAMMPS data/dump I/O (JSON-based bindings; see `format_io.rs`)
48
53
  - Topological descriptors: Wiener index, Hall-Kier κ, χ connectivity indices, Bertz CT
@@ -50,6 +55,8 @@ npm install @kent-tokyo/chematic
50
55
  - 2D SVG depiction with CPK colors and atom/bond highlighting
51
56
  - SVG grid layout for multiple molecules
52
57
  - Reaction SMILES/SMIRKS parsing and transform
58
+ (`run_reactants_checked` includes typed native and RDKit-profile rejection
59
+ diagnostics without returning rejected products as successes)
53
60
  - Add/remove explicit hydrogens
54
61
  - `embed_pipeline_v2_json`: torsion-knowledge-aware 3D embedding + stereo
55
62
  verification/repair + policy-gated force field, mirroring the Python
@@ -84,6 +91,7 @@ import init, {
84
91
  smr_vsa_json,
85
92
  peoe_vsa_json,
86
93
  identify_functional_groups,
94
+ brenk_report_json,
87
95
  } from '@kent-tokyo/chematic';
88
96
 
89
97
  await init();
@@ -106,6 +114,10 @@ console.log(mol.aromatic_ring_count()); // 1
106
114
  console.log(mol.lipinski_passes()); // true
107
115
  console.log(mol.canonical_smiles()); // canonical SMILES string
108
116
 
117
+ // Brenk alerts, fully local in the browser/Node runtime
118
+ console.log(JSON.parse(brenk_report_json('Oc1ccccc1')));
119
+ // { passes: false, alerts: ['phenol'] }
120
+
109
121
  // BRICS fragmentation
110
122
  console.log(brics_fragment_count(mol)); // ≥ 2
111
123
 
@@ -182,6 +182,14 @@ export class MolHandle {
182
182
  * Number of bonds.
183
183
  */
184
184
  bond_count(): number;
185
+ /**
186
+ * Returns `true` if the molecule has no Brenk structural alerts.
187
+ *
188
+ * This uses the same conservative core contract as the Rust, Python, and
189
+ * MCP bindings: an alert-search budget exhaustion is not reported as a
190
+ * clean pass.
191
+ */
192
+ brenk_passes(): boolean;
185
193
  /**
186
194
  * Palm (1997) Caco-2 intestinal permeability (logPCaco2).
187
195
  * > −5.5 = high permeability.
@@ -740,6 +748,24 @@ export function batch_report_html(smiles_lines: string): string;
740
748
  */
741
749
  export function boiled_egg_json(smiles: string): string;
742
750
 
751
+ /**
752
+ * Brenk structural-alert identifiers matched by `mol` as a JSON array.
753
+ *
754
+ * Returns `[]` when no alerts fire. Identifiers and ordering are identical to
755
+ * the Rust, Python, and MCP bindings.
756
+ */
757
+ export function brenk_matches_json(mol: MolHandle): string;
758
+
759
+ /**
760
+ * Parse `smiles` and return a complete Brenk report as JSON.
761
+ *
762
+ * The stable result shape is `{"passes":boolean,"alerts":string[]}`.
763
+ * Invalid or oversized SMILES throw the same ordinary JavaScript input error
764
+ * as `parse_smiles`; this function never converts invalid input into a clean
765
+ * report.
766
+ */
767
+ export function brenk_report_json(smiles: string): string;
768
+
743
769
  /**
744
770
  * Number of BRICS fragments produced by fragmenting the molecule.
745
771
  *
@@ -788,6 +814,11 @@ export function canonical_tautomer(mol: MolHandle): MolHandle;
788
814
  */
789
815
  export function canonical_tautomer_with_blocked_atoms_json(mol: MolHandle, blocked_atom_indices_json: string): string;
790
816
 
817
+ /**
818
+ * Return caller coordinates centered and aligned to their principal axes.
819
+ */
820
+ export function canonicalize_conformer_from_coords_json(mol: MolHandle, coords_json: string, center_json: string | null | undefined, normalize_covar: boolean, ignore_hs: boolean): string;
821
+
791
822
  /**
792
823
  * Canonicalize a bounded delimiter-separated SMILES batch.
793
824
  *
@@ -914,6 +945,14 @@ export function compare_molecules_batch_json(smiles_batch: string, delimiter: st
914
945
  */
915
946
  export function compare_molecules_json(smiles1: string, smiles2: string): string;
916
947
 
948
+ /**
949
+ * Compute an RDKit-style principal-axis transform from caller coordinates.
950
+ *
951
+ * Returns a row-major 4x4 JSON matrix. `center_json`, when supplied, must be
952
+ * `[x,y,z]`; otherwise the selected-atom centroid is used.
953
+ */
954
+ export function compute_canonical_transform_from_coords_json(mol: MolHandle, coords_json: string, center_json: string | null | undefined, normalize_covar: boolean, ignore_hs: boolean): string;
955
+
917
956
  /**
918
957
  * Generate multiple conformers with RMSD-based pruning.
919
958
  * Returns JSON: `{"conformers": [[[x,y,z],...], ...], "count": int}`.
@@ -925,12 +964,16 @@ export function conformer_ensemble_json(mol: MolHandle, n: number, rmsd_threshol
925
964
  *
926
965
  * This is the WASM counterpart of Python's `convert_format`. It supports
927
966
  * SMILES, MOL/SDF, MOL V3000, MOL2, CML, ChemicalJSON, MolJSON, and CDXML.
928
- * Coordinates and format-specific metadata are intentionally not carried
929
- * across this topology-only bridge; use the format-specific coordinate APIs
930
- * when those fields must be preserved.
967
+ * MOL2-to-MOL2 validates and retains the exact source. Other conversions use
968
+ * the topology-only bridge and do not carry format-specific metadata.
931
969
  */
932
970
  export function convert_common_format(text: string, input_format: string, output_format: string): string;
933
971
 
972
+ /**
973
+ * Checked MOL2/CJSON conversion using the shared report schema.
974
+ */
975
+ export function convert_with_report_json(text: string, input_format: string, output_format: string, policy: string): string;
976
+
934
977
  /**
935
978
  * Return the CPK color (CSS hex string) for the given element symbol.
936
979
  *
@@ -1342,6 +1385,11 @@ export function generic_murcko_scaffold(mol: MolHandle): MolHandle;
1342
1385
  */
1343
1386
  export function get_atom_info(mol: MolHandle, idx: number): string;
1344
1387
 
1388
+ /**
1389
+ * Measure angle i-j-k in degrees from caller-supplied coordinates.
1390
+ */
1391
+ export function get_bond_angle_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number, k: number): number;
1392
+
1345
1393
  /**
1346
1394
  * Return bond information as a JSON object, looked up by the two bonded atom indices.
1347
1395
  *
@@ -1363,6 +1411,15 @@ export function get_bond_between(mol: MolHandle, atom1: number, atom2: number):
1363
1411
  */
1364
1412
  export function get_bond_info(mol: MolHandle, idx: number): string;
1365
1413
 
1414
+ /**
1415
+ * Measure a bond length from caller-supplied coordinates.
1416
+ *
1417
+ * `coords_json` is `[[x,y,z], ...]` in molecule atom order. Unlike the
1418
+ * legacy SMILES convenience function, this does not generate a new
1419
+ * conformer, so callers can measure an imported or previously edited one.
1420
+ */
1421
+ export function get_bond_length_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number): number;
1422
+
1366
1423
  /**
1367
1424
  * Get bond length in Ångströms between two atoms from a SMILES string.
1368
1425
  * Returns -1.0 if parsing fails or atom indices are out of range.
@@ -1387,6 +1444,11 @@ export function get_bond_length_json(smiles: string, a: number, b: number): numb
1387
1444
  */
1388
1445
  export function get_descriptors_json(mol: MolHandle): string;
1389
1446
 
1447
+ /**
1448
+ * Measure dihedral i-j-k-l in degrees from caller-supplied coordinates.
1449
+ */
1450
+ export function get_dihedral_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number, k: number, l: number): number;
1451
+
1390
1452
  /**
1391
1453
  * Get dihedral angle A—B—C—D in degrees from a SMILES string.
1392
1454
  * Returns null (JSON null) if any atom index is out of range or atoms are collinear.
@@ -2219,6 +2281,11 @@ export function orca_output_to_json(text: string): string;
2219
2281
  */
2220
2282
  export function pains_matches_json(mol: MolHandle): string;
2221
2283
 
2284
+ /**
2285
+ * Inspect strictly validated CJSON with exact source and opaque field paths.
2286
+ */
2287
+ export function parse_cjson_record_json(text: string): string;
2288
+
2222
2289
  /**
2223
2290
  * Parse CXSMARTS and return preserved metadata as JSON.
2224
2291
  * Returns error if atom count exceeds 10,000.
@@ -2235,6 +2302,11 @@ export function parse_cxsmarts_json(s: string): string;
2235
2302
  */
2236
2303
  export function parse_cxsmiles_json(s: string): string;
2237
2304
 
2305
+ /**
2306
+ * Inspect partial charges, atom types and source retention for MOL2.
2307
+ */
2308
+ export function parse_mol2_record_json(text: string): string;
2309
+
2238
2310
  /**
2239
2311
  * Parse a SMILES string into a `MolHandle`.
2240
2312
  *
@@ -2565,6 +2637,18 @@ export function remove_hydrogens(mol: MolHandle): MolHandle;
2565
2637
  */
2566
2638
  export function retro_disconnect_json(mol: MolHandle, max_results: number, reaction_class: string): string;
2567
2639
 
2640
+ /**
2641
+ * Label-stable R-group decomposition returned as RDKit-style table columns.
2642
+ *
2643
+ * `core_smarts` accepts the bounded mapped-core contract used by Rust and
2644
+ * Python: terminal mapped wildcards such as `[*:2]`, or mapped core atoms.
2645
+ * The returned JSON object contains `Core`, `R1`, `R2`, ... arrays parallel
2646
+ * to the input rows. Unmatched rows and absent substituents are `null`.
2647
+ * Output fragments retain their mapped attachment wildcard. The legacy
2648
+ * [`super::rgroup_decompose_json`] function is unchanged.
2649
+ */
2650
+ export function rgroup_decompose_columns_json(smiles_json: string, core_smarts: string): string;
2651
+
2568
2652
  /**
2569
2653
  * Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
2570
2654
  *
@@ -2594,6 +2678,16 @@ export function rgroup_decompose_json(smiles_json: string, core_smarts: string):
2594
2678
  */
2595
2679
  export function ring_families_json(mol: MolHandle): string;
2596
2680
 
2681
+ /**
2682
+ * Validate the local CJSON profile and retain the exact UTF-8 source.
2683
+ */
2684
+ export function roundtrip_cjson_record(text: string): string;
2685
+
2686
+ /**
2687
+ * Validate one MOL2 record and preserve its exact source, including metadata.
2688
+ */
2689
+ export function roundtrip_mol2_record(text: string): string;
2690
+
2597
2691
  /**
2598
2692
  * Parse and serialize a V3000 block while preserving V3000 metadata.
2599
2693
  *
@@ -2744,6 +2838,29 @@ export function semantic_expand_json_with_limits(base_smiles: string, model_json
2744
2838
  */
2745
2839
  export function semantic_model_json(model_json: string): string;
2746
2840
 
2841
+ /**
2842
+ * Set angle i-j-k in degrees and return updated coordinate JSON.
2843
+ *
2844
+ * Atoms i and j stay fixed; atom k and its side of the graph rotate
2845
+ * together. If both angle bonds belong to a ring the operation is rejected.
2846
+ */
2847
+ export function set_bond_angle_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number, k: number, angle_deg: number): string;
2848
+
2849
+ /**
2850
+ * Set bond length i-j in caller-supplied coordinates and return updated JSON.
2851
+ *
2852
+ * Atom i stays fixed; atom j and its side of the graph move together. Ring
2853
+ * bonds are rejected, following RDKit's `SetBondLength` contract.
2854
+ */
2855
+ export function set_bond_length_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number, length: number): string;
2856
+
2857
+ /**
2858
+ * Set dihedral i-j-k-l in degrees and return updated coordinate JSON.
2859
+ *
2860
+ * The central j-k bond must exist and must not belong to a ring.
2861
+ */
2862
+ export function set_dihedral_from_coords_json(mol: MolHandle, coords_json: string, i: number, j: number, k: number, l: number, angle_deg: number): string;
2863
+
2747
2864
  /**
2748
2865
  * Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
2749
2866
  * Rotates the D-side subtree around the B—C bond.
@@ -3215,11 +3332,14 @@ export interface InitOutput {
3215
3332
  readonly balance_check_json: (a: number, b: number) => [number, number];
3216
3333
  readonly batch_report_html: (a: number, b: number) => [number, number];
3217
3334
  readonly boiled_egg_json: (a: number, b: number) => [number, number];
3335
+ readonly brenk_matches_json: (a: number) => [number, number];
3336
+ readonly brenk_report_json: (a: number, b: number) => [number, number, number, number];
3218
3337
  readonly brics_fragment_count: (a: number) => number;
3219
3338
  readonly brics_fragments_json: (a: number) => [number, number];
3220
3339
  readonly butina_cluster_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
3221
3340
  readonly canonical_tautomer: (a: number) => number;
3222
3341
  readonly canonical_tautomer_with_blocked_atoms_json: (a: number, b: number, c: number) => [number, number];
3342
+ readonly canonicalize_conformer_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
3223
3343
  readonly canonicalize_smiles_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3224
3344
  readonly cdxml_document_from_json_v1: (a: number, b: number) => [number, number, number, number];
3225
3345
  readonly cdxml_document_json: (a: number, b: number) => [number, number, number, number];
@@ -3233,6 +3353,7 @@ export interface InitOutput {
3233
3353
  readonly cip_unresolved_json: (a: number) => [number, number];
3234
3354
  readonly compare_molecules_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3235
3355
  readonly compare_molecules_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3356
+ readonly compute_canonical_transform_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
3236
3357
  readonly conformer_ensemble_json: (a: number, b: number, c: number) => [number, number];
3237
3358
  readonly conformerhandle_add_generated_conformer: (a: number) => number;
3238
3359
  readonly conformerhandle_add_minimized_conformer: (a: number) => number;
@@ -3245,6 +3366,7 @@ export interface InitOutput {
3245
3366
  readonly conformerhandle_new: (a: number, b: number) => [number, number, number];
3246
3367
  readonly conformerhandle_remove_conformer: (a: number, b: number) => number;
3247
3368
  readonly convert_common_format: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
3369
+ readonly convert_with_report_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
3248
3370
  readonly cpk_color: (a: number, b: number) => [number, number];
3249
3371
  readonly cube_grid_json: (a: number, b: number) => [number, number, number, number];
3250
3372
  readonly cube_shape_u32: (a: number, b: number) => [number, number, number];
@@ -3303,10 +3425,13 @@ export interface InitOutput {
3303
3425
  readonly generate_3d_pdb: (a: number) => [number, number];
3304
3426
  readonly generic_murcko_scaffold: (a: number) => number;
3305
3427
  readonly get_atom_info: (a: number, b: number) => [number, number];
3428
+ readonly get_bond_angle_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
3306
3429
  readonly get_bond_between: (a: number, b: number, c: number) => [number, number];
3307
3430
  readonly get_bond_info: (a: number, b: number) => [number, number];
3431
+ readonly get_bond_length_from_coords_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
3308
3432
  readonly get_bond_length_json: (a: number, b: number, c: number, d: number) => number;
3309
3433
  readonly get_descriptors_json: (a: number) => [number, number];
3434
+ readonly get_dihedral_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
3310
3435
  readonly get_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
3311
3436
  readonly get_rdkit_descriptors_json: (a: number) => [number, number];
3312
3437
  readonly getaway_descriptors_json: (a: number) => [number, number];
@@ -3386,11 +3511,13 @@ export interface InitOutput {
3386
3511
  readonly molecule_report_json: (a: number, b: number) => [number, number, number, number];
3387
3512
  readonly molhandle_aromatic_ring_count: (a: number) => number;
3388
3513
  readonly molhandle_assign_cip_json: (a: number) => [number, number];
3514
+ readonly molhandle_atom_count: (a: number) => number;
3389
3515
  readonly molhandle_atom_pseudo_labels_json: (a: number) => [number, number];
3390
3516
  readonly molhandle_bbb_passes: (a: number) => number;
3391
3517
  readonly molhandle_bbb_score: (a: number) => number;
3392
3518
  readonly molhandle_bertz_ct: (a: number) => number;
3393
3519
  readonly molhandle_bond_count: (a: number) => number;
3520
+ readonly molhandle_brenk_passes: (a: number) => number;
3394
3521
  readonly molhandle_caco2_permeability: (a: number) => number;
3395
3522
  readonly molhandle_canonical_smiles: (a: number) => [number, number];
3396
3523
  readonly molhandle_chi0: (a: number) => number;
@@ -3491,8 +3618,10 @@ export interface InitOutput {
3491
3618
  readonly orca_input_to_json: (a: number, b: number) => [number, number, number, number];
3492
3619
  readonly orca_output_to_json: (a: number, b: number) => [number, number, number, number];
3493
3620
  readonly pains_matches_json: (a: number) => [number, number];
3621
+ readonly parse_cjson_record_json: (a: number, b: number) => [number, number, number, number];
3494
3622
  readonly parse_cxsmarts_json: (a: number, b: number) => [number, number, number, number];
3495
3623
  readonly parse_cxsmiles_json: (a: number, b: number) => [number, number, number, number];
3624
+ readonly parse_mol2_record_json: (a: number, b: number) => [number, number, number, number];
3496
3625
  readonly parse_smiles: (a: number, b: number) => [number, number, number];
3497
3626
  readonly pdb_coords_json: (a: number, b: number) => [number, number];
3498
3627
  readonly peoe_vsa_json: (a: number) => [number, number];
@@ -3539,8 +3668,11 @@ export interface InitOutput {
3539
3668
  readonly reaction_smarts_match: (a: number, b: number, c: number, d: number) => [number, number, number];
3540
3669
  readonly remove_hydrogens: (a: number) => number;
3541
3670
  readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3671
+ readonly rgroup_decompose_columns_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3542
3672
  readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3543
3673
  readonly ring_families_json: (a: number) => [number, number, number, number];
3674
+ readonly roundtrip_cjson_record: (a: number, b: number) => [number, number, number, number];
3675
+ readonly roundtrip_mol2_record: (a: number, b: number) => [number, number, number, number];
3544
3676
  readonly roundtrip_mol_v3000_block: (a: number, b: number) => [number, number, number, number];
3545
3677
  readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3546
3678
  readonly run_reactants_checked: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -3556,6 +3688,9 @@ export interface InitOutput {
3556
3688
  readonly semantic_expand_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3557
3689
  readonly semantic_expand_json_with_limits: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
3558
3690
  readonly semantic_model_json: (a: number, b: number) => [number, number, number, number];
3691
+ readonly set_bond_angle_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
3692
+ readonly set_bond_length_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
3693
+ readonly set_dihedral_from_coords_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
3559
3694
  readonly set_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
3560
3695
  readonly shape_descriptors_json: (a: number) => [number, number];
3561
3696
  readonly slogp_vsa_json: (a: number) => [number, number];
@@ -3574,6 +3709,7 @@ export interface InitOutput {
3574
3709
  readonly sssr_rings_json: (a: number) => [number, number];
3575
3710
  readonly standardize_smiles: (a: number, b: number) => [number, number];
3576
3711
  readonly standardize_smiles_report_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
3712
+ readonly start: () => void;
3577
3713
  readonly stereo_parent_json: (a: number) => [number, number];
3578
3714
  readonly stoichiometry_report_json: (a: number, b: number) => [number, number];
3579
3715
  readonly super_parent_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
@@ -3620,8 +3756,6 @@ export interface InitOutput {
3620
3756
  readonly xlogp3_json: (a: number) => [number, number];
3621
3757
  readonly xlogp3_per_atom_json: (a: number) => [number, number];
3622
3758
  readonly xyz_frames_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3623
- readonly molhandle_atom_count: (a: number) => number;
3624
- readonly start: () => void;
3625
3759
  readonly __wbindgen_malloc: (a: number, b: number) => number;
3626
3760
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
3627
3761
  readonly __externref_table_alloc: () => number;
package/chematic_wasm.js CHANGED
@@ -104,7 +104,7 @@ export class ConformerHandle {
104
104
  const ret = wasm.conformerhandle_get_conformer_pdb(this.__wbg_ptr, idx);
105
105
  let v1;
106
106
  if (ret[0] !== 0) {
107
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
107
+ v1 = getStringFromWasm0(ret[0], ret[1]);
108
108
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
109
109
  }
110
110
  return v1;
@@ -456,6 +456,18 @@ export class MolHandle {
456
456
  const ret = wasm.molhandle_bond_count(this.__wbg_ptr);
457
457
  return ret >>> 0;
458
458
  }
459
+ /**
460
+ * Returns `true` if the molecule has no Brenk structural alerts.
461
+ *
462
+ * This uses the same conservative core contract as the Rust, Python, and
463
+ * MCP bindings: an alert-search budget exhaustion is not reported as a
464
+ * clean pass.
465
+ * @returns {boolean}
466
+ */
467
+ brenk_passes() {
468
+ const ret = wasm.molhandle_brenk_passes(this.__wbg_ptr);
469
+ return ret !== 0;
470
+ }
459
471
  /**
460
472
  * Palm (1997) Caco-2 intestinal permeability (logPCaco2).
461
473
  * > −5.5 = high permeability.
@@ -2039,6 +2051,59 @@ export function boiled_egg_json(smiles) {
2039
2051
  }
2040
2052
  }
2041
2053
 
2054
+ /**
2055
+ * Brenk structural-alert identifiers matched by `mol` as a JSON array.
2056
+ *
2057
+ * Returns `[]` when no alerts fire. Identifiers and ordering are identical to
2058
+ * the Rust, Python, and MCP bindings.
2059
+ * @param {MolHandle} mol
2060
+ * @returns {string}
2061
+ */
2062
+ export function brenk_matches_json(mol) {
2063
+ let deferred1_0;
2064
+ let deferred1_1;
2065
+ try {
2066
+ _assertClass(mol, MolHandle);
2067
+ const ret = wasm.brenk_matches_json(mol.__wbg_ptr);
2068
+ deferred1_0 = ret[0];
2069
+ deferred1_1 = ret[1];
2070
+ return getStringFromWasm0(ret[0], ret[1]);
2071
+ } finally {
2072
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2073
+ }
2074
+ }
2075
+
2076
+ /**
2077
+ * Parse `smiles` and return a complete Brenk report as JSON.
2078
+ *
2079
+ * The stable result shape is `{"passes":boolean,"alerts":string[]}`.
2080
+ * Invalid or oversized SMILES throw the same ordinary JavaScript input error
2081
+ * as `parse_smiles`; this function never converts invalid input into a clean
2082
+ * report.
2083
+ * @param {string} smiles
2084
+ * @returns {string}
2085
+ */
2086
+ export function brenk_report_json(smiles) {
2087
+ let deferred3_0;
2088
+ let deferred3_1;
2089
+ try {
2090
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2091
+ const len0 = WASM_VECTOR_LEN;
2092
+ const ret = wasm.brenk_report_json(ptr0, len0);
2093
+ var ptr2 = ret[0];
2094
+ var len2 = ret[1];
2095
+ if (ret[3]) {
2096
+ ptr2 = 0; len2 = 0;
2097
+ throw takeFromExternrefTable0(ret[2]);
2098
+ }
2099
+ deferred3_0 = ptr2;
2100
+ deferred3_1 = len2;
2101
+ return getStringFromWasm0(ptr2, len2);
2102
+ } finally {
2103
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2104
+ }
2105
+ }
2106
+
2042
2107
  /**
2043
2108
  * Number of BRICS fragments produced by fragmenting the molecule.
2044
2109
  *
@@ -2152,6 +2217,39 @@ export function canonical_tautomer_with_blocked_atoms_json(mol, blocked_atom_ind
2152
2217
  }
2153
2218
  }
2154
2219
 
2220
+ /**
2221
+ * Return caller coordinates centered and aligned to their principal axes.
2222
+ * @param {MolHandle} mol
2223
+ * @param {string} coords_json
2224
+ * @param {string | null | undefined} center_json
2225
+ * @param {boolean} normalize_covar
2226
+ * @param {boolean} ignore_hs
2227
+ * @returns {string}
2228
+ */
2229
+ export function canonicalize_conformer_from_coords_json(mol, coords_json, center_json, normalize_covar, ignore_hs) {
2230
+ let deferred4_0;
2231
+ let deferred4_1;
2232
+ try {
2233
+ _assertClass(mol, MolHandle);
2234
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2235
+ const len0 = WASM_VECTOR_LEN;
2236
+ var ptr1 = isLikeNone(center_json) ? 0 : passStringToWasm0(center_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2237
+ var len1 = WASM_VECTOR_LEN;
2238
+ const ret = wasm.canonicalize_conformer_from_coords_json(mol.__wbg_ptr, ptr0, len0, ptr1, len1, normalize_covar, ignore_hs);
2239
+ var ptr3 = ret[0];
2240
+ var len3 = ret[1];
2241
+ if (ret[3]) {
2242
+ ptr3 = 0; len3 = 0;
2243
+ throw takeFromExternrefTable0(ret[2]);
2244
+ }
2245
+ deferred4_0 = ptr3;
2246
+ deferred4_1 = len3;
2247
+ return getStringFromWasm0(ptr3, len3);
2248
+ } finally {
2249
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2250
+ }
2251
+ }
2252
+
2155
2253
  /**
2156
2254
  * Canonicalize a bounded delimiter-separated SMILES batch.
2157
2255
  *
@@ -2523,6 +2621,42 @@ export function compare_molecules_json(smiles1, smiles2) {
2523
2621
  }
2524
2622
  }
2525
2623
 
2624
+ /**
2625
+ * Compute an RDKit-style principal-axis transform from caller coordinates.
2626
+ *
2627
+ * Returns a row-major 4x4 JSON matrix. `center_json`, when supplied, must be
2628
+ * `[x,y,z]`; otherwise the selected-atom centroid is used.
2629
+ * @param {MolHandle} mol
2630
+ * @param {string} coords_json
2631
+ * @param {string | null | undefined} center_json
2632
+ * @param {boolean} normalize_covar
2633
+ * @param {boolean} ignore_hs
2634
+ * @returns {string}
2635
+ */
2636
+ export function compute_canonical_transform_from_coords_json(mol, coords_json, center_json, normalize_covar, ignore_hs) {
2637
+ let deferred4_0;
2638
+ let deferred4_1;
2639
+ try {
2640
+ _assertClass(mol, MolHandle);
2641
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2642
+ const len0 = WASM_VECTOR_LEN;
2643
+ var ptr1 = isLikeNone(center_json) ? 0 : passStringToWasm0(center_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2644
+ var len1 = WASM_VECTOR_LEN;
2645
+ const ret = wasm.compute_canonical_transform_from_coords_json(mol.__wbg_ptr, ptr0, len0, ptr1, len1, normalize_covar, ignore_hs);
2646
+ var ptr3 = ret[0];
2647
+ var len3 = ret[1];
2648
+ if (ret[3]) {
2649
+ ptr3 = 0; len3 = 0;
2650
+ throw takeFromExternrefTable0(ret[2]);
2651
+ }
2652
+ deferred4_0 = ptr3;
2653
+ deferred4_1 = len3;
2654
+ return getStringFromWasm0(ptr3, len3);
2655
+ } finally {
2656
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2657
+ }
2658
+ }
2659
+
2526
2660
  /**
2527
2661
  * Generate multiple conformers with RMSD-based pruning.
2528
2662
  * Returns JSON: `{"conformers": [[[x,y,z],...], ...], "count": int}`.
@@ -2550,9 +2684,8 @@ export function conformer_ensemble_json(mol, n, rmsd_threshold) {
2550
2684
  *
2551
2685
  * This is the WASM counterpart of Python's `convert_format`. It supports
2552
2686
  * SMILES, MOL/SDF, MOL V3000, MOL2, CML, ChemicalJSON, MolJSON, and CDXML.
2553
- * Coordinates and format-specific metadata are intentionally not carried
2554
- * across this topology-only bridge; use the format-specific coordinate APIs
2555
- * when those fields must be preserved.
2687
+ * MOL2-to-MOL2 validates and retains the exact source. Other conversions use
2688
+ * the topology-only bridge and do not carry format-specific metadata.
2556
2689
  * @param {string} text
2557
2690
  * @param {string} input_format
2558
2691
  * @param {string} output_format
@@ -2583,6 +2716,41 @@ export function convert_common_format(text, input_format, output_format) {
2583
2716
  }
2584
2717
  }
2585
2718
 
2719
+ /**
2720
+ * Checked MOL2/CJSON conversion using the shared report schema.
2721
+ * @param {string} text
2722
+ * @param {string} input_format
2723
+ * @param {string} output_format
2724
+ * @param {string} policy
2725
+ * @returns {string}
2726
+ */
2727
+ export function convert_with_report_json(text, input_format, output_format, policy) {
2728
+ let deferred6_0;
2729
+ let deferred6_1;
2730
+ try {
2731
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2732
+ const len0 = WASM_VECTOR_LEN;
2733
+ const ptr1 = passStringToWasm0(input_format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2734
+ const len1 = WASM_VECTOR_LEN;
2735
+ const ptr2 = passStringToWasm0(output_format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2736
+ const len2 = WASM_VECTOR_LEN;
2737
+ const ptr3 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2738
+ const len3 = WASM_VECTOR_LEN;
2739
+ const ret = wasm.convert_with_report_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
2740
+ var ptr5 = ret[0];
2741
+ var len5 = ret[1];
2742
+ if (ret[3]) {
2743
+ ptr5 = 0; len5 = 0;
2744
+ throw takeFromExternrefTable0(ret[2]);
2745
+ }
2746
+ deferred6_0 = ptr5;
2747
+ deferred6_1 = len5;
2748
+ return getStringFromWasm0(ptr5, len5);
2749
+ } finally {
2750
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
2751
+ }
2752
+ }
2753
+
2586
2754
  /**
2587
2755
  * Return the CPK color (CSS hex string) for the given element symbol.
2588
2756
  *
@@ -3665,6 +3833,26 @@ export function get_atom_info(mol, idx) {
3665
3833
  }
3666
3834
  }
3667
3835
 
3836
+ /**
3837
+ * Measure angle i-j-k in degrees from caller-supplied coordinates.
3838
+ * @param {MolHandle} mol
3839
+ * @param {string} coords_json
3840
+ * @param {number} i
3841
+ * @param {number} j
3842
+ * @param {number} k
3843
+ * @returns {number}
3844
+ */
3845
+ export function get_bond_angle_from_coords_json(mol, coords_json, i, j, k) {
3846
+ _assertClass(mol, MolHandle);
3847
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3848
+ const len0 = WASM_VECTOR_LEN;
3849
+ const ret = wasm.get_bond_angle_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j, k);
3850
+ if (ret[2]) {
3851
+ throw takeFromExternrefTable0(ret[1]);
3852
+ }
3853
+ return ret[0];
3854
+ }
3855
+
3668
3856
  /**
3669
3857
  * Return bond information as a JSON object, looked up by the two bonded atom indices.
3670
3858
  *
@@ -3717,6 +3905,29 @@ export function get_bond_info(mol, idx) {
3717
3905
  }
3718
3906
  }
3719
3907
 
3908
+ /**
3909
+ * Measure a bond length from caller-supplied coordinates.
3910
+ *
3911
+ * `coords_json` is `[[x,y,z], ...]` in molecule atom order. Unlike the
3912
+ * legacy SMILES convenience function, this does not generate a new
3913
+ * conformer, so callers can measure an imported or previously edited one.
3914
+ * @param {MolHandle} mol
3915
+ * @param {string} coords_json
3916
+ * @param {number} i
3917
+ * @param {number} j
3918
+ * @returns {number}
3919
+ */
3920
+ export function get_bond_length_from_coords_json(mol, coords_json, i, j) {
3921
+ _assertClass(mol, MolHandle);
3922
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3923
+ const len0 = WASM_VECTOR_LEN;
3924
+ const ret = wasm.get_bond_length_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j);
3925
+ if (ret[2]) {
3926
+ throw takeFromExternrefTable0(ret[1]);
3927
+ }
3928
+ return ret[0];
3929
+ }
3930
+
3720
3931
  /**
3721
3932
  * Get bond length in Ångströms between two atoms from a SMILES string.
3722
3933
  * Returns -1.0 if parsing fails or atom indices are out of range.
@@ -3764,6 +3975,27 @@ export function get_descriptors_json(mol) {
3764
3975
  }
3765
3976
  }
3766
3977
 
3978
+ /**
3979
+ * Measure dihedral i-j-k-l in degrees from caller-supplied coordinates.
3980
+ * @param {MolHandle} mol
3981
+ * @param {string} coords_json
3982
+ * @param {number} i
3983
+ * @param {number} j
3984
+ * @param {number} k
3985
+ * @param {number} l
3986
+ * @returns {number}
3987
+ */
3988
+ export function get_dihedral_from_coords_json(mol, coords_json, i, j, k, l) {
3989
+ _assertClass(mol, MolHandle);
3990
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3991
+ const len0 = WASM_VECTOR_LEN;
3992
+ const ret = wasm.get_dihedral_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j, k, l);
3993
+ if (ret[2]) {
3994
+ throw takeFromExternrefTable0(ret[1]);
3995
+ }
3996
+ return ret[0];
3997
+ }
3998
+
3767
3999
  /**
3768
4000
  * Get dihedral angle A—B—C—D in degrees from a SMILES string.
3769
4001
  * Returns null (JSON null) if any atom index is out of range or atoms are collinear.
@@ -5875,6 +6107,32 @@ export function pains_matches_json(mol) {
5875
6107
  }
5876
6108
  }
5877
6109
 
6110
+ /**
6111
+ * Inspect strictly validated CJSON with exact source and opaque field paths.
6112
+ * @param {string} text
6113
+ * @returns {string}
6114
+ */
6115
+ export function parse_cjson_record_json(text) {
6116
+ let deferred3_0;
6117
+ let deferred3_1;
6118
+ try {
6119
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6120
+ const len0 = WASM_VECTOR_LEN;
6121
+ const ret = wasm.parse_cjson_record_json(ptr0, len0);
6122
+ var ptr2 = ret[0];
6123
+ var len2 = ret[1];
6124
+ if (ret[3]) {
6125
+ ptr2 = 0; len2 = 0;
6126
+ throw takeFromExternrefTable0(ret[2]);
6127
+ }
6128
+ deferred3_0 = ptr2;
6129
+ deferred3_1 = len2;
6130
+ return getStringFromWasm0(ptr2, len2);
6131
+ } finally {
6132
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6133
+ }
6134
+ }
6135
+
5878
6136
  /**
5879
6137
  * Parse CXSMARTS and return preserved metadata as JSON.
5880
6138
  * Returns error if atom count exceeds 10,000.
@@ -5933,6 +6191,32 @@ export function parse_cxsmiles_json(s) {
5933
6191
  }
5934
6192
  }
5935
6193
 
6194
+ /**
6195
+ * Inspect partial charges, atom types and source retention for MOL2.
6196
+ * @param {string} text
6197
+ * @returns {string}
6198
+ */
6199
+ export function parse_mol2_record_json(text) {
6200
+ let deferred3_0;
6201
+ let deferred3_1;
6202
+ try {
6203
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6204
+ const len0 = WASM_VECTOR_LEN;
6205
+ const ret = wasm.parse_mol2_record_json(ptr0, len0);
6206
+ var ptr2 = ret[0];
6207
+ var len2 = ret[1];
6208
+ if (ret[3]) {
6209
+ ptr2 = 0; len2 = 0;
6210
+ throw takeFromExternrefTable0(ret[2]);
6211
+ }
6212
+ deferred3_0 = ptr2;
6213
+ deferred3_1 = len2;
6214
+ return getStringFromWasm0(ptr2, len2);
6215
+ } finally {
6216
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6217
+ }
6218
+ }
6219
+
5936
6220
  /**
5937
6221
  * Parse a SMILES string into a `MolHandle`.
5938
6222
  *
@@ -6169,7 +6453,7 @@ export function pqr_infer_element(group_pdb, res_name, atom_name) {
6169
6453
  const ret = wasm.pqr_infer_element(ptr0, len0, ptr1, len1, ptr2, len2);
6170
6454
  let v4;
6171
6455
  if (ret[0] !== 0) {
6172
- v4 = getStringFromWasm0(ret[0], ret[1]).slice();
6456
+ v4 = getStringFromWasm0(ret[0], ret[1]);
6173
6457
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
6174
6458
  }
6175
6459
  return v4;
@@ -6833,6 +7117,42 @@ export function retro_disconnect_json(mol, max_results, reaction_class) {
6833
7117
  }
6834
7118
  }
6835
7119
 
7120
+ /**
7121
+ * Label-stable R-group decomposition returned as RDKit-style table columns.
7122
+ *
7123
+ * `core_smarts` accepts the bounded mapped-core contract used by Rust and
7124
+ * Python: terminal mapped wildcards such as `[*:2]`, or mapped core atoms.
7125
+ * The returned JSON object contains `Core`, `R1`, `R2`, ... arrays parallel
7126
+ * to the input rows. Unmatched rows and absent substituents are `null`.
7127
+ * Output fragments retain their mapped attachment wildcard. The legacy
7128
+ * [`super::rgroup_decompose_json`] function is unchanged.
7129
+ * @param {string} smiles_json
7130
+ * @param {string} core_smarts
7131
+ * @returns {string}
7132
+ */
7133
+ export function rgroup_decompose_columns_json(smiles_json, core_smarts) {
7134
+ let deferred4_0;
7135
+ let deferred4_1;
7136
+ try {
7137
+ const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7138
+ const len0 = WASM_VECTOR_LEN;
7139
+ const ptr1 = passStringToWasm0(core_smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7140
+ const len1 = WASM_VECTOR_LEN;
7141
+ const ret = wasm.rgroup_decompose_columns_json(ptr0, len0, ptr1, len1);
7142
+ var ptr3 = ret[0];
7143
+ var len3 = ret[1];
7144
+ if (ret[3]) {
7145
+ ptr3 = 0; len3 = 0;
7146
+ throw takeFromExternrefTable0(ret[2]);
7147
+ }
7148
+ deferred4_0 = ptr3;
7149
+ deferred4_1 = len3;
7150
+ return getStringFromWasm0(ptr3, len3);
7151
+ } finally {
7152
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
7153
+ }
7154
+ }
7155
+
6836
7156
  /**
6837
7157
  * Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
6838
7158
  *
@@ -6906,6 +7226,58 @@ export function ring_families_json(mol) {
6906
7226
  }
6907
7227
  }
6908
7228
 
7229
+ /**
7230
+ * Validate the local CJSON profile and retain the exact UTF-8 source.
7231
+ * @param {string} text
7232
+ * @returns {string}
7233
+ */
7234
+ export function roundtrip_cjson_record(text) {
7235
+ let deferred3_0;
7236
+ let deferred3_1;
7237
+ try {
7238
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7239
+ const len0 = WASM_VECTOR_LEN;
7240
+ const ret = wasm.roundtrip_cjson_record(ptr0, len0);
7241
+ var ptr2 = ret[0];
7242
+ var len2 = ret[1];
7243
+ if (ret[3]) {
7244
+ ptr2 = 0; len2 = 0;
7245
+ throw takeFromExternrefTable0(ret[2]);
7246
+ }
7247
+ deferred3_0 = ptr2;
7248
+ deferred3_1 = len2;
7249
+ return getStringFromWasm0(ptr2, len2);
7250
+ } finally {
7251
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7252
+ }
7253
+ }
7254
+
7255
+ /**
7256
+ * Validate one MOL2 record and preserve its exact source, including metadata.
7257
+ * @param {string} text
7258
+ * @returns {string}
7259
+ */
7260
+ export function roundtrip_mol2_record(text) {
7261
+ let deferred3_0;
7262
+ let deferred3_1;
7263
+ try {
7264
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7265
+ const len0 = WASM_VECTOR_LEN;
7266
+ const ret = wasm.roundtrip_mol2_record(ptr0, len0);
7267
+ var ptr2 = ret[0];
7268
+ var len2 = ret[1];
7269
+ if (ret[3]) {
7270
+ ptr2 = 0; len2 = 0;
7271
+ throw takeFromExternrefTable0(ret[2]);
7272
+ }
7273
+ deferred3_0 = ptr2;
7274
+ deferred3_1 = len2;
7275
+ return getStringFromWasm0(ptr2, len2);
7276
+ } finally {
7277
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7278
+ }
7279
+ }
7280
+
6909
7281
  /**
6910
7282
  * Parse and serialize a V3000 block while preserving V3000 metadata.
6911
7283
  *
@@ -7361,6 +7733,110 @@ export function semantic_model_json(model_json) {
7361
7733
  }
7362
7734
  }
7363
7735
 
7736
+ /**
7737
+ * Set angle i-j-k in degrees and return updated coordinate JSON.
7738
+ *
7739
+ * Atoms i and j stay fixed; atom k and its side of the graph rotate
7740
+ * together. If both angle bonds belong to a ring the operation is rejected.
7741
+ * @param {MolHandle} mol
7742
+ * @param {string} coords_json
7743
+ * @param {number} i
7744
+ * @param {number} j
7745
+ * @param {number} k
7746
+ * @param {number} angle_deg
7747
+ * @returns {string}
7748
+ */
7749
+ export function set_bond_angle_from_coords_json(mol, coords_json, i, j, k, angle_deg) {
7750
+ let deferred3_0;
7751
+ let deferred3_1;
7752
+ try {
7753
+ _assertClass(mol, MolHandle);
7754
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7755
+ const len0 = WASM_VECTOR_LEN;
7756
+ const ret = wasm.set_bond_angle_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j, k, angle_deg);
7757
+ var ptr2 = ret[0];
7758
+ var len2 = ret[1];
7759
+ if (ret[3]) {
7760
+ ptr2 = 0; len2 = 0;
7761
+ throw takeFromExternrefTable0(ret[2]);
7762
+ }
7763
+ deferred3_0 = ptr2;
7764
+ deferred3_1 = len2;
7765
+ return getStringFromWasm0(ptr2, len2);
7766
+ } finally {
7767
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7768
+ }
7769
+ }
7770
+
7771
+ /**
7772
+ * Set bond length i-j in caller-supplied coordinates and return updated JSON.
7773
+ *
7774
+ * Atom i stays fixed; atom j and its side of the graph move together. Ring
7775
+ * bonds are rejected, following RDKit's `SetBondLength` contract.
7776
+ * @param {MolHandle} mol
7777
+ * @param {string} coords_json
7778
+ * @param {number} i
7779
+ * @param {number} j
7780
+ * @param {number} length
7781
+ * @returns {string}
7782
+ */
7783
+ export function set_bond_length_from_coords_json(mol, coords_json, i, j, length) {
7784
+ let deferred3_0;
7785
+ let deferred3_1;
7786
+ try {
7787
+ _assertClass(mol, MolHandle);
7788
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7789
+ const len0 = WASM_VECTOR_LEN;
7790
+ const ret = wasm.set_bond_length_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j, length);
7791
+ var ptr2 = ret[0];
7792
+ var len2 = ret[1];
7793
+ if (ret[3]) {
7794
+ ptr2 = 0; len2 = 0;
7795
+ throw takeFromExternrefTable0(ret[2]);
7796
+ }
7797
+ deferred3_0 = ptr2;
7798
+ deferred3_1 = len2;
7799
+ return getStringFromWasm0(ptr2, len2);
7800
+ } finally {
7801
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7802
+ }
7803
+ }
7804
+
7805
+ /**
7806
+ * Set dihedral i-j-k-l in degrees and return updated coordinate JSON.
7807
+ *
7808
+ * The central j-k bond must exist and must not belong to a ring.
7809
+ * @param {MolHandle} mol
7810
+ * @param {string} coords_json
7811
+ * @param {number} i
7812
+ * @param {number} j
7813
+ * @param {number} k
7814
+ * @param {number} l
7815
+ * @param {number} angle_deg
7816
+ * @returns {string}
7817
+ */
7818
+ export function set_dihedral_from_coords_json(mol, coords_json, i, j, k, l, angle_deg) {
7819
+ let deferred3_0;
7820
+ let deferred3_1;
7821
+ try {
7822
+ _assertClass(mol, MolHandle);
7823
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7824
+ const len0 = WASM_VECTOR_LEN;
7825
+ const ret = wasm.set_dihedral_from_coords_json(mol.__wbg_ptr, ptr0, len0, i, j, k, l, angle_deg);
7826
+ var ptr2 = ret[0];
7827
+ var len2 = ret[1];
7828
+ if (ret[3]) {
7829
+ ptr2 = 0; len2 = 0;
7830
+ throw takeFromExternrefTable0(ret[2]);
7831
+ }
7832
+ deferred3_0 = ptr2;
7833
+ deferred3_1 = len2;
7834
+ return getStringFromWasm0(ptr2, len2);
7835
+ } finally {
7836
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7837
+ }
7838
+ }
7839
+
7364
7840
  /**
7365
7841
  * Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
7366
7842
  * Rotates the D-side subtree around the B—C bond.
@@ -8785,11 +9261,11 @@ export function xyz_frames_batch_json(text, offset, batch_size) {
8785
9261
  function __wbg_get_imports() {
8786
9262
  const import0 = {
8787
9263
  __proto__: null,
8788
- __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
9264
+ __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
8789
9265
  const ret = arg0 === undefined;
8790
9266
  return ret;
8791
9267
  },
8792
- __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
9268
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
8793
9269
  const obj = arg1;
8794
9270
  const ret = typeof(obj) === 'string' ? obj : undefined;
8795
9271
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -8797,18 +9273,18 @@ function __wbg_get_imports() {
8797
9273
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
8798
9274
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
8799
9275
  },
8800
- __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
9276
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
8801
9277
  throw new Error(getStringFromWasm0(arg0, arg1));
8802
9278
  },
8803
- __wbg_error_f085d7e62279b703: function(arg0) {
9279
+ __wbg_error_c9cf3fc2064683a9: function(arg0) {
8804
9280
  console.error(arg0);
8805
9281
  },
8806
- __wbg_new_from_slice_02962bf7778cf945: function(arg0, arg1) {
8807
- const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
9282
+ __wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
9283
+ const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
8808
9284
  return ret;
8809
9285
  },
8810
- __wbg_new_from_slice_f92bf65e9a895613: function(arg0, arg1) {
8811
- const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
9286
+ __wbg_new_from_slice_f545fd22ddc142b8: function(arg0, arg1) {
9287
+ const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
8812
9288
  return ret;
8813
9289
  },
8814
9290
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
@@ -8819,28 +9295,28 @@ function __wbg_get_imports() {
8819
9295
  const ret = arg0.performance;
8820
9296
  return ret;
8821
9297
  },
8822
- __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
8823
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
9298
+ __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
9299
+ const ret = typeof global === 'undefined' ? null : global;
8824
9300
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
8825
9301
  },
8826
- __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
8827
- const ret = typeof global === 'undefined' ? null : global;
9302
+ __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
9303
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
8828
9304
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
8829
9305
  },
8830
- __wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
9306
+ __wbg_static_accessor_SELF_0b583911f537483a: function() {
8831
9307
  const ret = typeof self === 'undefined' ? null : self;
8832
9308
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
8833
9309
  },
8834
- __wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
9310
+ __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
8835
9311
  const ret = typeof window === 'undefined' ? null : window;
8836
9312
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
8837
9313
  },
8838
- __wbindgen_cast_0000000000000001: function(arg0) {
9314
+ __wbindgen_generic_0000000000000001: function(arg0) {
8839
9315
  // Cast intrinsic for `F64 -> Externref`.
8840
9316
  const ret = arg0;
8841
9317
  return ret;
8842
9318
  },
8843
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
9319
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
8844
9320
  // Cast intrinsic for `Ref(String) -> Externref`.
8845
9321
  const ret = getStringFromWasm0(arg0, arg1);
8846
9322
  return ret;
@@ -9047,11 +9523,15 @@ function __wbg_finalize_init(instance, module) {
9047
9523
 
9048
9524
  async function __wbg_load(module, imports) {
9049
9525
  if (typeof Response === 'function' && module instanceof Response) {
9526
+ if (!module.ok) {
9527
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
9528
+ }
9529
+
9050
9530
  if (typeof WebAssembly.instantiateStreaming === 'function') {
9051
9531
  try {
9052
9532
  return await WebAssembly.instantiateStreaming(module, imports);
9053
9533
  } catch (e) {
9054
- const validResponse = module.ok && expectedResponseType(module.type);
9534
+ const validResponse = expectedResponseType(module.type);
9055
9535
 
9056
9536
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
9057
9537
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
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.0",
8
+ "version": "1.1.2",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",