@kent-tokyo/chematic 1.0.34 → 1.0.36

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.36. 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
 
@@ -756,8 +756,11 @@ export function chematic_version(): string;
756
756
  * but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
757
757
  * see `docs/rfcs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
758
758
  * engine computes neither). Atoms it can't resolve are omitted here -- see
759
- * [`cip_unresolved_json`] -- never a silently-guessed label. Returns `"null"` on an
760
- * internal engine error (budget-independent computations should not normally hit this).
759
+ * [`cip_unresolved_json`] -- never a silently-guessed label. A phosphorus on an
760
+ * unsaturated ring (cyclophosphazene) gets RDKit's CIPLabeler label, which flips
761
+ * with the ring's Kekulé spelling; its object carries `"kekuleDependent": true`.
762
+ * Returns `"null"` on an internal engine error (budget-independent computations
763
+ * should not normally hit this).
761
764
  */
762
765
  export function cip_assignments_accurate_json(mol: MolHandle): string;
763
766
 
@@ -1746,6 +1749,13 @@ export function mol_block_from_smiles(smiles: string): string;
1746
1749
  */
1747
1750
  export function mol_block_stereo_diagnostics_json(mol_block: string): string;
1748
1751
 
1752
+ /**
1753
+ * The stereo [`to_mol_block`] does not carry, as JSON:
1754
+ * `{"centres": [atom...], "double_bonds": [bond...],
1755
+ * "non_tetrahedral_centres": [atom...], "stereo_groups_dropped": bool}`.
1756
+ */
1757
+ export function mol_block_stereo_loss_json(mol: MolHandle): string;
1758
+
1749
1759
  /**
1750
1760
  * Only the first molecular fragment in the document is returned.
1751
1761
  * Returns a JS error if the document cannot be parsed.
@@ -2827,9 +2837,20 @@ export function to_extxyz_json(mol: MolHandle, coords_json: string, options_json
2827
2837
  *
2828
2838
  * Atom positions are computed via the same layout engine used for SVG depiction
2829
2839
  * and converted to Ångström units (`1.5 Å` per bond).
2840
+ *
2841
+ * A molecule with stereo gets the MOL writer's stereo layout (E/Z set by
2842
+ * the geometry, one checked wedge per centre); a centre or E/Z bond that
2843
+ * layout cannot express is lost silently here. Use [`to_mol_block_strict`]
2844
+ * to get an error instead, or [`mol_block_stereo_loss_json`] for the list.
2830
2845
  */
2831
2846
  export function to_mol_block(mol: MolHandle): string;
2832
2847
 
2848
+ /**
2849
+ * [`to_mol_block`] that fails, naming the lost centres and bonds, when the
2850
+ * block would not carry all of the molecule's stereo.
2851
+ */
2852
+ export function to_mol_block_strict(mol: MolHandle): string;
2853
+
2833
2854
  /**
2834
2855
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
2835
2856
  */
@@ -3182,6 +3203,7 @@ export interface InitOutput {
3182
3203
  readonly mol_block_coords_json: (a: number, b: number) => [number, number, number, number];
3183
3204
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
3184
3205
  readonly mol_block_stereo_diagnostics_json: (a: number, b: number) => [number, number, number, number];
3206
+ readonly mol_block_stereo_loss_json: (a: number) => [number, number];
3185
3207
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
3186
3208
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
3187
3209
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
@@ -3393,6 +3415,7 @@ export interface InitOutput {
3393
3415
  readonly to_cml: (a: number) => [number, number];
3394
3416
  readonly to_extxyz_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3395
3417
  readonly to_mol_block: (a: number) => [number, number];
3418
+ readonly to_mol_block_strict: (a: number) => [number, number, number, number];
3396
3419
  readonly to_mol_v3000_block: (a: number) => [number, number];
3397
3420
  readonly to_moljson: (a: number) => [number, number];
3398
3421
  readonly to_qcschema_molecule_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number, number, number];
package/chematic_wasm.js CHANGED
@@ -1891,8 +1891,11 @@ export function chematic_version() {
1891
1891
  * but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
1892
1892
  * see `docs/rfcs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
1893
1893
  * engine computes neither). Atoms it can't resolve are omitted here -- see
1894
- * [`cip_unresolved_json`] -- never a silently-guessed label. Returns `"null"` on an
1895
- * internal engine error (budget-independent computations should not normally hit this).
1894
+ * [`cip_unresolved_json`] -- never a silently-guessed label. A phosphorus on an
1895
+ * unsaturated ring (cyclophosphazene) gets RDKit's CIPLabeler label, which flips
1896
+ * with the ring's Kekulé spelling; its object carries `"kekuleDependent": true`.
1897
+ * Returns `"null"` on an internal engine error (budget-independent computations
1898
+ * should not normally hit this).
1896
1899
  * @param {MolHandle} mol
1897
1900
  * @returns {string}
1898
1901
  */
@@ -4424,6 +4427,27 @@ export function mol_block_stereo_diagnostics_json(mol_block) {
4424
4427
  }
4425
4428
  }
4426
4429
 
4430
+ /**
4431
+ * The stereo [`to_mol_block`] does not carry, as JSON:
4432
+ * `{"centres": [atom...], "double_bonds": [bond...],
4433
+ * "non_tetrahedral_centres": [atom...], "stereo_groups_dropped": bool}`.
4434
+ * @param {MolHandle} mol
4435
+ * @returns {string}
4436
+ */
4437
+ export function mol_block_stereo_loss_json(mol) {
4438
+ let deferred1_0;
4439
+ let deferred1_1;
4440
+ try {
4441
+ _assertClass(mol, MolHandle);
4442
+ const ret = wasm.mol_block_stereo_loss_json(mol.__wbg_ptr);
4443
+ deferred1_0 = ret[0];
4444
+ deferred1_1 = ret[1];
4445
+ return getStringFromWasm0(ret[0], ret[1]);
4446
+ } finally {
4447
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4448
+ }
4449
+ }
4450
+
4427
4451
  /**
4428
4452
  * Only the first molecular fragment in the document is returned.
4429
4453
  * Returns a JS error if the document cannot be parsed.
@@ -7427,6 +7451,11 @@ export function to_extxyz_json(mol, coords_json, options_json) {
7427
7451
  *
7428
7452
  * Atom positions are computed via the same layout engine used for SVG depiction
7429
7453
  * and converted to Ångström units (`1.5 Å` per bond).
7454
+ *
7455
+ * A molecule with stereo gets the MOL writer's stereo layout (E/Z set by
7456
+ * the geometry, one checked wedge per centre); a centre or E/Z bond that
7457
+ * layout cannot express is lost silently here. Use [`to_mol_block_strict`]
7458
+ * to get an error instead, or [`mol_block_stereo_loss_json`] for the list.
7430
7459
  * @param {MolHandle} mol
7431
7460
  * @returns {string}
7432
7461
  */
@@ -7444,6 +7473,32 @@ export function to_mol_block(mol) {
7444
7473
  }
7445
7474
  }
7446
7475
 
7476
+ /**
7477
+ * [`to_mol_block`] that fails, naming the lost centres and bonds, when the
7478
+ * block would not carry all of the molecule's stereo.
7479
+ * @param {MolHandle} mol
7480
+ * @returns {string}
7481
+ */
7482
+ export function to_mol_block_strict(mol) {
7483
+ let deferred2_0;
7484
+ let deferred2_1;
7485
+ try {
7486
+ _assertClass(mol, MolHandle);
7487
+ const ret = wasm.to_mol_block_strict(mol.__wbg_ptr);
7488
+ var ptr1 = ret[0];
7489
+ var len1 = ret[1];
7490
+ if (ret[3]) {
7491
+ ptr1 = 0; len1 = 0;
7492
+ throw takeFromExternrefTable0(ret[2]);
7493
+ }
7494
+ deferred2_0 = ptr1;
7495
+ deferred2_1 = len1;
7496
+ return getStringFromWasm0(ptr1, len1);
7497
+ } finally {
7498
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
7499
+ }
7500
+ }
7501
+
7447
7502
  /**
7448
7503
  * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
7449
7504
  * @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.36",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",