@kent-tokyo/chematic 0.19.0 → 0.20.0

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
@@ -122,13 +122,34 @@ const response = JSON.parse(embed_pipeline_v2_json(mol, JSON.stringify({
122
122
  forceFieldPolicy: "none",
123
123
  forceFieldMaxIterations: 200,
124
124
  gateMmff94TorsionOop: false,
125
+ gateMmff94StretchBend: false,
125
126
  ringTorsionPolicy: "fail_closed",
126
127
  totalTimeoutMs: null,
128
+ enforceChirality: false,
129
+ expandImplicitHThroughPipeline: false,
127
130
  })));
128
131
  // response.ok, response.result / response.error — same shape as
129
132
  // Mol.embed_pipeline_v2() in the Python binding.
130
133
  ```
131
134
 
135
+ For ring-fused declared stereocenters (e.g. testosterone, cholesterol) that
136
+ `enforceChirality` alone can't repair, `stereoPolicy: "repair_and_verify"` +
137
+ `enforceChirality: true` + `expandImplicitHThroughPipeline: true` are needed
138
+ *together* (issue #291/#383) — `pipeline_v2_stereo_safe_config_json` builds
139
+ that exact combination so a caller can't set one and forget another:
140
+
141
+ ```js
142
+ const configResponse = JSON.parse(pipeline_v2_stereo_safe_config_json(
143
+ "mmff94_with_uff_fallback", "fail_closed"
144
+ ));
145
+ // configResponse.ok, configResponse.config (or configResponse.error, same
146
+ // shape as embed_pipeline_v2_json's own error) — modify configResponse.config
147
+ // (e.g. a different embedSeed) before passing it to embed_pipeline_v2_json.
148
+ const response = JSON.parse(
149
+ embed_pipeline_v2_json(mol, JSON.stringify(configResponse.config))
150
+ );
151
+ ```
152
+
132
153
  Verified working end-to-end under real WASM (both `wasm-pack --target nodejs`
133
154
  and `--target web`, the latter being what this package's npm build actually
134
155
  uses) — success, typed-failure, and typed-timeout paths all return real
@@ -1849,6 +1849,30 @@ export function pharmacophore_fp_2d_summary(mol: MolHandle): string;
1849
1849
  */
1850
1850
  export function pharmacophore_fp_3d_summary(mol: MolHandle): string;
1851
1851
 
1852
+ /**
1853
+ * Returns a ready-to-use `embed_pipeline_v2_json` config JSON string for the
1854
+ * "stereo-safe" configuration (issue #291/#383): `stereoPolicy:
1855
+ * "repair_and_verify"`, `enforceChirality: true`, and
1856
+ * `expandImplicitHThroughPipeline: true` together -- the exact combination
1857
+ * measured to correctly handle ring-fused declared stereocenters (e.g.
1858
+ * testosterone, cholesterol) that `enforceChirality` alone cannot repair.
1859
+ * Mirrors `PipelineV2Config::stereo_safe`/the Python binding's
1860
+ * `PipelineV2Config.stereo_safe(...)` -- prefer this over setting those three
1861
+ * fields individually: they only work correctly as a set, and forgetting one
1862
+ * silently falls back to a configuration issue #291 measured as unsound for
1863
+ * that molecule class. `forceFieldPolicy`/`ringTorsionPolicy` are still
1864
+ * required, explicit arguments; everything else takes the same conservative
1865
+ * defaults `embed_pipeline_v2_json`'s own documented examples do. The caller
1866
+ * may parse and further override individual fields before passing the result
1867
+ * to `embed_pipeline_v2_json` (e.g. a different `embedSeed`).
1868
+ *
1869
+ * Never throws, matching `embed_pipeline_v2_json`'s own convention: an
1870
+ * unknown `force_field`/`ring_torsion_policy` string returns the same
1871
+ * `{"ok": false, "error": {...}}` shape `embed_pipeline_v2_json` would for an
1872
+ * invalid config, tagged `schemaVersion: 1`.
1873
+ */
1874
+ export function pipeline_v2_stereo_safe_config_json(force_field: string, ring_torsion_policy: string): string;
1875
+
1852
1876
  /**
1853
1877
  * Cartesian coordinates from a PQR file, in the SAME atom order
1854
1878
  * [`mol_from_pqr`] returns topology for. Returns JSON `[[x,y,z],...]` (Å).
@@ -2727,6 +2751,7 @@ export interface InitOutput {
2727
2751
  readonly pharmacophore_features_json: (a: number) => [number, number];
2728
2752
  readonly pharmacophore_fp_2d_summary: (a: number) => [number, number];
2729
2753
  readonly pharmacophore_fp_3d_summary: (a: number) => [number, number];
2754
+ readonly pipeline_v2_stereo_safe_config_json: (a: number, b: number, c: number, d: number) => [number, number];
2730
2755
  readonly pqr_coords_json: (a: number, b: number) => [number, number, number, number];
2731
2756
  readonly pqr_infer_element: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
2732
2757
  readonly pqr_to_json: (a: number, b: number) => [number, number, number, number];
package/chematic_wasm.js CHANGED
@@ -4589,6 +4589,48 @@ export function pharmacophore_fp_3d_summary(mol) {
4589
4589
  }
4590
4590
  }
4591
4591
 
4592
+ /**
4593
+ * Returns a ready-to-use `embed_pipeline_v2_json` config JSON string for the
4594
+ * "stereo-safe" configuration (issue #291/#383): `stereoPolicy:
4595
+ * "repair_and_verify"`, `enforceChirality: true`, and
4596
+ * `expandImplicitHThroughPipeline: true` together -- the exact combination
4597
+ * measured to correctly handle ring-fused declared stereocenters (e.g.
4598
+ * testosterone, cholesterol) that `enforceChirality` alone cannot repair.
4599
+ * Mirrors `PipelineV2Config::stereo_safe`/the Python binding's
4600
+ * `PipelineV2Config.stereo_safe(...)` -- prefer this over setting those three
4601
+ * fields individually: they only work correctly as a set, and forgetting one
4602
+ * silently falls back to a configuration issue #291 measured as unsound for
4603
+ * that molecule class. `forceFieldPolicy`/`ringTorsionPolicy` are still
4604
+ * required, explicit arguments; everything else takes the same conservative
4605
+ * defaults `embed_pipeline_v2_json`'s own documented examples do. The caller
4606
+ * may parse and further override individual fields before passing the result
4607
+ * to `embed_pipeline_v2_json` (e.g. a different `embedSeed`).
4608
+ *
4609
+ * Never throws, matching `embed_pipeline_v2_json`'s own convention: an
4610
+ * unknown `force_field`/`ring_torsion_policy` string returns the same
4611
+ * `{"ok": false, "error": {...}}` shape `embed_pipeline_v2_json` would for an
4612
+ * invalid config, tagged `schemaVersion: 1`.
4613
+ * @param {string} force_field
4614
+ * @param {string} ring_torsion_policy
4615
+ * @returns {string}
4616
+ */
4617
+ export function pipeline_v2_stereo_safe_config_json(force_field, ring_torsion_policy) {
4618
+ let deferred3_0;
4619
+ let deferred3_1;
4620
+ try {
4621
+ const ptr0 = passStringToWasm0(force_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4622
+ const len0 = WASM_VECTOR_LEN;
4623
+ const ptr1 = passStringToWasm0(ring_torsion_policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4624
+ const len1 = WASM_VECTOR_LEN;
4625
+ const ret = wasm.pipeline_v2_stereo_safe_config_json(ptr0, len0, ptr1, len1);
4626
+ deferred3_0 = ret[0];
4627
+ deferred3_1 = ret[1];
4628
+ return getStringFromWasm0(ret[0], ret[1]);
4629
+ } finally {
4630
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
4631
+ }
4632
+ }
4633
+
4592
4634
  /**
4593
4635
  * Cartesian coordinates from a PQR file, in the SAME atom order
4594
4636
  * [`mol_from_pqr`] returns topology for. Returns JSON `[[x,y,z],...]` (Å).
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
8
- "version": "0.19.0",
8
+ "version": "0.20.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",