@kent-tokyo/chematic 1.0.36 → 1.0.38

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.36. The binding keeps bounded parsing,
7
+ The current workspace line is 1.0.38. 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
 
@@ -430,6 +430,14 @@ export class MolHandle {
430
430
  * χ₀ = Σ 1/√(d_i × d_j) over all bonds, where d is heavy-atom degree.
431
431
  */
432
432
  randic_index(): number;
433
+ /**
434
+ * Canonical SMILES exactly as RDKit 2026.03.1 writes it
435
+ * (`Chem.MolToSmiles(Chem.MolFromSmiles(s))` for a molecule parsed
436
+ * from the SMILES `s`). Throws instead of returning a string for
437
+ * inputs the RDKit port does not model or that RDKit's sanitization
438
+ * rejects; `canonical_smiles` is unchanged.
439
+ */
440
+ rdkit_smiles(): string;
433
441
  /**
434
442
  * Returns `true` if the molecule passes the REOS (Rapid Elimination Of Swill) filter.
435
443
  */
@@ -754,11 +762,14 @@ export function chematic_version(): string;
754
762
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
755
763
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
756
764
  * but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
757
- * see `docs/rfcs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
758
- * engine computes neither). Atoms it can't resolve are omitted here -- see
765
+ * see `docs/rfcs/cip_accurate_rfc.md`), E/Z ranked by the same engine and legacy's
766
+ * allene answers. Atoms it can't resolve are omitted here -- see
759
767
  * [`cip_unresolved_json`] -- never a silently-guessed label. A phosphorus on an
760
768
  * unsaturated ring (cyclophosphazene) gets RDKit's CIPLabeler label, which flips
761
769
  * with the ring's Kekulé spelling; its object carries `"kekuleDependent": true`.
770
+ * A ring centre with three single bonds and a lone pair (bridgehead amine)
771
+ * gets RDKit's label for the parsed SMILES spelling and carries
772
+ * `"spellingDependent": true`.
762
773
  * Returns `"null"` on an internal engine error (budget-independent computations
763
774
  * should not normally hit this).
764
775
  */
@@ -1675,6 +1686,14 @@ export function mmff94_charges_typed_json(mol: MolHandle): string;
1675
1686
  */
1676
1687
  export function mmff94_energy_breakdown_from_coords_json(mol: MolHandle, coords_json: string): string;
1677
1688
 
1689
+ /**
1690
+ * [`mmff94_energy_breakdown_from_coords_json`] with
1691
+ * `ignore_interfrag_interactions`: `true` leaves out van der Waals and
1692
+ * electrostatic pairs between disconnected fragments, as RDKit's
1693
+ * `MMFFGetMoleculeForceField` does by default.
1694
+ */
1695
+ export function mmff94_energy_breakdown_from_coords_json_with_options(mol: MolHandle, coords_json: string, ignore_interfrag_interactions: boolean): string;
1696
+
1678
1697
  /**
1679
1698
  * Computes energy on an internally generated conformer.
1680
1699
  * `MolHandle` stores topology only; coordinates previously read from PDB/XYZ
@@ -2024,6 +2043,20 @@ export function normalize_cxsmiles(s: string): string;
2024
2043
  */
2025
2044
  export function normalize_reaction_smiles(rxn_smiles: string): string;
2026
2045
 
2046
+ /**
2047
+ * Apply one bounded metadata edit without changing atom ownership or linkage
2048
+ * topology. Returns the same tagged envelope as validation.
2049
+ */
2050
+ export function nucleic_acid_apply_json_command(document_json: string, command_json: string): string;
2051
+
2052
+ /**
2053
+ * Validate and normalize a bounded `chematic.nucleic-acid.v1` document.
2054
+ *
2055
+ * Returns a stable JSON envelope with either `ok: true` and the normalized
2056
+ * document or `ok: false` and a typed error category.
2057
+ */
2058
+ export function nucleic_acid_validate_json(document_json: string): string;
2059
+
2027
2060
  /**
2028
2061
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
2029
2062
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
@@ -3196,6 +3229,7 @@ export interface InitOutput {
3196
3229
  readonly mmff94_charges_json: (a: number) => [number, number];
3197
3230
  readonly mmff94_charges_typed_json: (a: number) => [number, number];
3198
3231
  readonly mmff94_energy_breakdown_from_coords_json: (a: number, b: number, c: number) => [number, number];
3232
+ readonly mmff94_energy_breakdown_from_coords_json_with_options: (a: number, b: number, c: number, d: number) => [number, number];
3199
3233
  readonly mmff94_energy_breakdown_json: (a: number) => [number, number];
3200
3234
  readonly mmff94_partial_charges_json: (a: number) => [number, number];
3201
3235
  readonly mmp_pairs_json: (a: number, b: number) => [number, number, number, number];
@@ -3295,6 +3329,7 @@ export interface InitOutput {
3295
3329
  readonly molhandle_potential_stereocenter_indices: (a: number) => [number, number];
3296
3330
  readonly molhandle_qed: (a: number) => number;
3297
3331
  readonly molhandle_randic_index: (a: number) => number;
3332
+ readonly molhandle_rdkit_smiles: (a: number) => [number, number, number, number];
3298
3333
  readonly molhandle_reos_passes: (a: number) => number;
3299
3334
  readonly molhandle_ring_count: (a: number) => number;
3300
3335
  readonly molhandle_rotatable_bond_count: (a: number) => number;
@@ -3312,6 +3347,8 @@ export interface InitOutput {
3312
3347
  readonly neutralize_charges: (a: number) => number;
3313
3348
  readonly normalize_cxsmiles: (a: number, b: number) => [number, number, number, number];
3314
3349
  readonly normalize_reaction_smiles: (a: number, b: number) => [number, number, number, number];
3350
+ readonly nucleic_acid_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number];
3351
+ readonly nucleic_acid_validate_json: (a: number, b: number) => [number, number];
3315
3352
  readonly opendx_grid_json: (a: number, b: number) => [number, number, number, number];
3316
3353
  readonly opendx_shape_u32: (a: number, b: number) => [number, number, number];
3317
3354
  readonly opendx_values_f64: (a: number, b: number) => [number, number, number];
package/chematic_wasm.js CHANGED
@@ -1008,6 +1008,32 @@ export class MolHandle {
1008
1008
  const ret = wasm.molhandle_randic_index(this.__wbg_ptr);
1009
1009
  return ret;
1010
1010
  }
1011
+ /**
1012
+ * Canonical SMILES exactly as RDKit 2026.03.1 writes it
1013
+ * (`Chem.MolToSmiles(Chem.MolFromSmiles(s))` for a molecule parsed
1014
+ * from the SMILES `s`). Throws instead of returning a string for
1015
+ * inputs the RDKit port does not model or that RDKit's sanitization
1016
+ * rejects; `canonical_smiles` is unchanged.
1017
+ * @returns {string}
1018
+ */
1019
+ rdkit_smiles() {
1020
+ let deferred2_0;
1021
+ let deferred2_1;
1022
+ try {
1023
+ const ret = wasm.molhandle_rdkit_smiles(this.__wbg_ptr);
1024
+ var ptr1 = ret[0];
1025
+ var len1 = ret[1];
1026
+ if (ret[3]) {
1027
+ ptr1 = 0; len1 = 0;
1028
+ throw takeFromExternrefTable0(ret[2]);
1029
+ }
1030
+ deferred2_0 = ptr1;
1031
+ deferred2_1 = len1;
1032
+ return getStringFromWasm0(ptr1, len1);
1033
+ } finally {
1034
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1035
+ }
1036
+ }
1011
1037
  /**
1012
1038
  * Returns `true` if the molecule passes the REOS (Rapid Elimination Of Swill) filter.
1013
1039
  * @returns {boolean}
@@ -1889,11 +1915,14 @@ export function chematic_version() {
1889
1915
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
1890
1916
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
1891
1917
  * but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
1892
- * see `docs/rfcs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
1893
- * engine computes neither). Atoms it can't resolve are omitted here -- see
1918
+ * see `docs/rfcs/cip_accurate_rfc.md`), E/Z ranked by the same engine and legacy's
1919
+ * allene answers. Atoms it can't resolve are omitted here -- see
1894
1920
  * [`cip_unresolved_json`] -- never a silently-guessed label. A phosphorus on an
1895
1921
  * unsaturated ring (cyclophosphazene) gets RDKit's CIPLabeler label, which flips
1896
1922
  * with the ring's Kekulé spelling; its object carries `"kekuleDependent": true`.
1923
+ * A ring centre with three single bonds and a lone pair (bridgehead amine)
1924
+ * gets RDKit's label for the parsed SMILES spelling and carries
1925
+ * `"spellingDependent": true`.
1897
1926
  * Returns `"null"` on an internal engine error (budget-independent computations
1898
1927
  * should not normally hit this).
1899
1928
  * @param {MolHandle} mol
@@ -4226,6 +4255,32 @@ export function mmff94_energy_breakdown_from_coords_json(mol, coords_json) {
4226
4255
  }
4227
4256
  }
4228
4257
 
4258
+ /**
4259
+ * [`mmff94_energy_breakdown_from_coords_json`] with
4260
+ * `ignore_interfrag_interactions`: `true` leaves out van der Waals and
4261
+ * electrostatic pairs between disconnected fragments, as RDKit's
4262
+ * `MMFFGetMoleculeForceField` does by default.
4263
+ * @param {MolHandle} mol
4264
+ * @param {string} coords_json
4265
+ * @param {boolean} ignore_interfrag_interactions
4266
+ * @returns {string}
4267
+ */
4268
+ export function mmff94_energy_breakdown_from_coords_json_with_options(mol, coords_json, ignore_interfrag_interactions) {
4269
+ let deferred2_0;
4270
+ let deferred2_1;
4271
+ try {
4272
+ _assertClass(mol, MolHandle);
4273
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4274
+ const len0 = WASM_VECTOR_LEN;
4275
+ const ret = wasm.mmff94_energy_breakdown_from_coords_json_with_options(mol.__wbg_ptr, ptr0, len0, ignore_interfrag_interactions);
4276
+ deferred2_0 = ret[0];
4277
+ deferred2_1 = ret[1];
4278
+ return getStringFromWasm0(ret[0], ret[1]);
4279
+ } finally {
4280
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
4281
+ }
4282
+ }
4283
+
4229
4284
  /**
4230
4285
  * Computes energy on an internally generated conformer.
4231
4286
  * `MolHandle` stores topology only; coordinates previously read from PDB/XYZ
@@ -5113,6 +5168,53 @@ export function normalize_reaction_smiles(rxn_smiles) {
5113
5168
  }
5114
5169
  }
5115
5170
 
5171
+ /**
5172
+ * Apply one bounded metadata edit without changing atom ownership or linkage
5173
+ * topology. Returns the same tagged envelope as validation.
5174
+ * @param {string} document_json
5175
+ * @param {string} command_json
5176
+ * @returns {string}
5177
+ */
5178
+ export function nucleic_acid_apply_json_command(document_json, command_json) {
5179
+ let deferred3_0;
5180
+ let deferred3_1;
5181
+ try {
5182
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5183
+ const len0 = WASM_VECTOR_LEN;
5184
+ const ptr1 = passStringToWasm0(command_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5185
+ const len1 = WASM_VECTOR_LEN;
5186
+ const ret = wasm.nucleic_acid_apply_json_command(ptr0, len0, ptr1, len1);
5187
+ deferred3_0 = ret[0];
5188
+ deferred3_1 = ret[1];
5189
+ return getStringFromWasm0(ret[0], ret[1]);
5190
+ } finally {
5191
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
5192
+ }
5193
+ }
5194
+
5195
+ /**
5196
+ * Validate and normalize a bounded `chematic.nucleic-acid.v1` document.
5197
+ *
5198
+ * Returns a stable JSON envelope with either `ok: true` and the normalized
5199
+ * document or `ok: false` and a typed error category.
5200
+ * @param {string} document_json
5201
+ * @returns {string}
5202
+ */
5203
+ export function nucleic_acid_validate_json(document_json) {
5204
+ let deferred2_0;
5205
+ let deferred2_1;
5206
+ try {
5207
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5208
+ const len0 = WASM_VECTOR_LEN;
5209
+ const ret = wasm.nucleic_acid_validate_json(ptr0, len0);
5210
+ deferred2_0 = ret[0];
5211
+ deferred2_1 = ret[1];
5212
+ return getStringFromWasm0(ret[0], ret[1]);
5213
+ } finally {
5214
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
5215
+ }
5216
+ }
5217
+
5116
5218
  /**
5117
5219
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
5118
5220
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
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.36",
8
+ "version": "1.0.38",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",