@kent-tokyo/chematic 1.0.34 → 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.34. 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.
@@ -2827,9 +2834,20 @@ export function to_extxyz_json(mol: MolHandle, coords_json: string, options_json
2827
2834
  *
2828
2835
  * Atom positions are computed via the same layout engine used for SVG depiction
2829
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.
2830
2842
  */
2831
2843
  export function to_mol_block(mol: MolHandle): string;
2832
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
+
2833
2851
  /**
2834
2852
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
2835
2853
  */
@@ -3182,6 +3200,7 @@ export interface InitOutput {
3182
3200
  readonly mol_block_coords_json: (a: number, b: number) => [number, number, number, number];
3183
3201
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
3184
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];
3185
3204
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
3186
3205
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
3187
3206
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
@@ -3393,6 +3412,7 @@ export interface InitOutput {
3393
3412
  readonly to_cml: (a: number) => [number, number];
3394
3413
  readonly to_extxyz_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3395
3414
  readonly to_mol_block: (a: number) => [number, number];
3415
+ readonly to_mol_block_strict: (a: number) => [number, number, number, number];
3396
3416
  readonly to_mol_v3000_block: (a: number) => [number, number];
3397
3417
  readonly to_moljson: (a: number) => [number, number];
3398
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.
@@ -7427,6 +7448,11 @@ export function to_extxyz_json(mol, coords_json, options_json) {
7427
7448
  *
7428
7449
  * Atom positions are computed via the same layout engine used for SVG depiction
7429
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.
7430
7456
  * @param {MolHandle} mol
7431
7457
  * @returns {string}
7432
7458
  */
@@ -7444,6 +7470,32 @@ export function to_mol_block(mol) {
7444
7470
  }
7445
7471
  }
7446
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
+
7447
7499
  /**
7448
7500
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
7449
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.34",
8
+ "version": "1.0.35",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",