@kent-tokyo/chematic 1.0.33 → 1.0.35

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.0.33. The binding keeps bounded parsing,
7
+ The current workspace line is 1.0.35. 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
 
@@ -1746,6 +1746,13 @@ export function mol_block_from_smiles(smiles: string): string;
1746
1746
  */
1747
1747
  export function mol_block_stereo_diagnostics_json(mol_block: string): string;
1748
1748
 
1749
+ /**
1750
+ * The stereo [`to_mol_block`] does not carry, as JSON:
1751
+ * `{"centres": [atom...], "double_bonds": [bond...],
1752
+ * "non_tetrahedral_centres": [atom...], "stereo_groups_dropped": bool}`.
1753
+ */
1754
+ export function mol_block_stereo_loss_json(mol: MolHandle): string;
1755
+
1749
1756
  /**
1750
1757
  * Only the first molecular fragment in the document is returned.
1751
1758
  * Returns a JS error if the document cannot be parsed.
@@ -2458,10 +2465,12 @@ export function run_reactants(smirks: string, reactants_smiles: string): string;
2458
2465
  * Apply a SMIRKS template with explicit outcome accounting as a JSON string.
2459
2466
  *
2460
2467
  * `reactants_smiles` is pipe-separated, as for [`run_reactants`]. With
2461
- * `rdkit_compat = true`, tetrahedral reactant-side `@`/`@@` templates that
2462
- * differ from pinned RDKit 2026.03.6 return `typed_unsupported` and a stable
2463
- * reason code instead of an apparently compatible product. Native semantics
2464
- * and the existing [`run_reactants`] API are unchanged. Product graph/origin/
2468
+ * `rdkit_compat = true`, matching and product stereochemistry follow pinned
2469
+ * RDKit 2026.03.6; inputs it cannot reproduce return `typed_unsupported` and
2470
+ * a stable reason code (`ambiguous_stereo_bond_order`,
2471
+ * `ez_reactant_template_semantics`, `chiral_reactant_template_semantics`)
2472
+ * instead of an apparently compatible product. Native semantics and the
2473
+ * existing [`run_reactants`] API are unchanged. Product graph/origin/
2465
2474
  * template-map parity remains a separate oracle gate. Source indices and
2466
2475
  * product-template map labels are returned alongside the product SMILES;
2467
2476
  * their atom positions match the canonical SMILES parse order.
@@ -2825,9 +2834,20 @@ export function to_extxyz_json(mol: MolHandle, coords_json: string, options_json
2825
2834
  *
2826
2835
  * Atom positions are computed via the same layout engine used for SVG depiction
2827
2836
  * and converted to Ångström units (`1.5 Å` per bond).
2837
+ *
2838
+ * A molecule with stereo gets the MOL writer's stereo layout (E/Z set by
2839
+ * the geometry, one checked wedge per centre); a centre or E/Z bond that
2840
+ * layout cannot express is lost silently here. Use [`to_mol_block_strict`]
2841
+ * to get an error instead, or [`mol_block_stereo_loss_json`] for the list.
2828
2842
  */
2829
2843
  export function to_mol_block(mol: MolHandle): string;
2830
2844
 
2845
+ /**
2846
+ * [`to_mol_block`] that fails, naming the lost centres and bonds, when the
2847
+ * block would not carry all of the molecule's stereo.
2848
+ */
2849
+ export function to_mol_block_strict(mol: MolHandle): string;
2850
+
2831
2851
  /**
2832
2852
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
2833
2853
  */
@@ -3180,6 +3200,7 @@ export interface InitOutput {
3180
3200
  readonly mol_block_coords_json: (a: number, b: number) => [number, number, number, number];
3181
3201
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
3182
3202
  readonly mol_block_stereo_diagnostics_json: (a: number, b: number) => [number, number, number, number];
3203
+ readonly mol_block_stereo_loss_json: (a: number) => [number, number];
3183
3204
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
3184
3205
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
3185
3206
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
@@ -3391,6 +3412,7 @@ export interface InitOutput {
3391
3412
  readonly to_cml: (a: number) => [number, number];
3392
3413
  readonly to_extxyz_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3393
3414
  readonly to_mol_block: (a: number) => [number, number];
3415
+ readonly to_mol_block_strict: (a: number) => [number, number, number, number];
3394
3416
  readonly to_mol_v3000_block: (a: number) => [number, number];
3395
3417
  readonly to_moljson: (a: number) => [number, number];
3396
3418
  readonly to_qcschema_molecule_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number, number, number];
package/chematic_wasm.js CHANGED
@@ -4424,6 +4424,27 @@ export function mol_block_stereo_diagnostics_json(mol_block) {
4424
4424
  }
4425
4425
  }
4426
4426
 
4427
+ /**
4428
+ * The stereo [`to_mol_block`] does not carry, as JSON:
4429
+ * `{"centres": [atom...], "double_bonds": [bond...],
4430
+ * "non_tetrahedral_centres": [atom...], "stereo_groups_dropped": bool}`.
4431
+ * @param {MolHandle} mol
4432
+ * @returns {string}
4433
+ */
4434
+ export function mol_block_stereo_loss_json(mol) {
4435
+ let deferred1_0;
4436
+ let deferred1_1;
4437
+ try {
4438
+ _assertClass(mol, MolHandle);
4439
+ const ret = wasm.mol_block_stereo_loss_json(mol.__wbg_ptr);
4440
+ deferred1_0 = ret[0];
4441
+ deferred1_1 = ret[1];
4442
+ return getStringFromWasm0(ret[0], ret[1]);
4443
+ } finally {
4444
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4445
+ }
4446
+ }
4447
+
4427
4448
  /**
4428
4449
  * Only the first molecular fragment in the document is returned.
4429
4450
  * Returns a JS error if the document cannot be parsed.
@@ -6315,10 +6336,12 @@ export function run_reactants(smirks, reactants_smiles) {
6315
6336
  * Apply a SMIRKS template with explicit outcome accounting as a JSON string.
6316
6337
  *
6317
6338
  * `reactants_smiles` is pipe-separated, as for [`run_reactants`]. With
6318
- * `rdkit_compat = true`, tetrahedral reactant-side `@`/`@@` templates that
6319
- * differ from pinned RDKit 2026.03.6 return `typed_unsupported` and a stable
6320
- * reason code instead of an apparently compatible product. Native semantics
6321
- * and the existing [`run_reactants`] API are unchanged. Product graph/origin/
6339
+ * `rdkit_compat = true`, matching and product stereochemistry follow pinned
6340
+ * RDKit 2026.03.6; inputs it cannot reproduce return `typed_unsupported` and
6341
+ * a stable reason code (`ambiguous_stereo_bond_order`,
6342
+ * `ez_reactant_template_semantics`, `chiral_reactant_template_semantics`)
6343
+ * instead of an apparently compatible product. Native semantics and the
6344
+ * existing [`run_reactants`] API are unchanged. Product graph/origin/
6322
6345
  * template-map parity remains a separate oracle gate. Source indices and
6323
6346
  * product-template map labels are returned alongside the product SMILES;
6324
6347
  * their atom positions match the canonical SMILES parse order.
@@ -7425,6 +7448,11 @@ export function to_extxyz_json(mol, coords_json, options_json) {
7425
7448
  *
7426
7449
  * Atom positions are computed via the same layout engine used for SVG depiction
7427
7450
  * and converted to Ångström units (`1.5 Å` per bond).
7451
+ *
7452
+ * A molecule with stereo gets the MOL writer's stereo layout (E/Z set by
7453
+ * the geometry, one checked wedge per centre); a centre or E/Z bond that
7454
+ * layout cannot express is lost silently here. Use [`to_mol_block_strict`]
7455
+ * to get an error instead, or [`mol_block_stereo_loss_json`] for the list.
7428
7456
  * @param {MolHandle} mol
7429
7457
  * @returns {string}
7430
7458
  */
@@ -7442,6 +7470,32 @@ export function to_mol_block(mol) {
7442
7470
  }
7443
7471
  }
7444
7472
 
7473
+ /**
7474
+ * [`to_mol_block`] that fails, naming the lost centres and bonds, when the
7475
+ * block would not carry all of the molecule's stereo.
7476
+ * @param {MolHandle} mol
7477
+ * @returns {string}
7478
+ */
7479
+ export function to_mol_block_strict(mol) {
7480
+ let deferred2_0;
7481
+ let deferred2_1;
7482
+ try {
7483
+ _assertClass(mol, MolHandle);
7484
+ const ret = wasm.to_mol_block_strict(mol.__wbg_ptr);
7485
+ var ptr1 = ret[0];
7486
+ var len1 = ret[1];
7487
+ if (ret[3]) {
7488
+ ptr1 = 0; len1 = 0;
7489
+ throw takeFromExternrefTable0(ret[2]);
7490
+ }
7491
+ deferred2_0 = ptr1;
7492
+ deferred2_1 = len1;
7493
+ return getStringFromWasm0(ptr1, len1);
7494
+ } finally {
7495
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
7496
+ }
7497
+ }
7498
+
7445
7499
  /**
7446
7500
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
7447
7501
  * @param {MolHandle} mol
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.0.33",
8
+ "version": "1.0.35",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",