sci-form-wasm 0.5.1 → 0.6.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sci-form-wasm",
3
3
  "type": "module",
4
4
  "description": "WASM/TypeScript bindings for high-performance 3D molecular conformer generation",
5
- "version": "0.5.1",
5
+ "version": "0.6.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -71,6 +71,28 @@ export function compute_frontier_descriptors(elements: string, coords_flat: stri
71
71
  */
72
72
  export function compute_fukui_descriptors(elements: string, coords_flat: string): string;
73
73
 
74
+ /**
75
+ * Generate HOSE codes for all atoms in a molecule.
76
+ *
77
+ * `smiles`: SMILES string.
78
+ * `max_radius`: maximum number of spheres (typically 2–4).
79
+ *
80
+ * Returns: JSON array of HoseCode objects.
81
+ */
82
+ export function compute_hose_codes(smiles: string, max_radius: number): string;
83
+
84
+ /**
85
+ * Generate a Lorentzian-broadened IR spectrum from vibrational analysis JSON.
86
+ *
87
+ * `analysis_json`: JSON VibrationalAnalysis (from compute_vibrational_analysis).
88
+ * `gamma`: line width in cm⁻¹.
89
+ * `wn_min`, `wn_max`: wavenumber range in cm⁻¹.
90
+ * `n_points`: grid resolution.
91
+ *
92
+ * Returns: JSON IrSpectrum with wavenumbers, intensities, peaks.
93
+ */
94
+ export function compute_ir_spectrum(analysis_json: string, gamma: number, wn_min: number, wn_max: number, n_points: number): string;
95
+
74
96
  /**
75
97
  * Predict molecular properties using ML proxy models.
76
98
  *
@@ -99,6 +121,19 @@ export function compute_mmff94_energy(smiles: string, coords: string): string;
99
121
  */
100
122
  export function compute_molecular_descriptors(smiles: string): string;
101
123
 
124
+ /**
125
+ * Generate a complete NMR spectrum from SMILES.
126
+ *
127
+ * `smiles`: SMILES string.
128
+ * `nucleus`: "1H" or "13C".
129
+ * `gamma`: Lorentzian line width in ppm.
130
+ * `ppm_min`, `ppm_max`: spectral window.
131
+ * `n_points`: grid resolution.
132
+ *
133
+ * Returns: JSON NmrSpectrum with ppm_axis, intensities, peaks.
134
+ */
135
+ export function compute_nmr_spectrum(smiles: string, nucleus: string, gamma: number, ppm_min: number, ppm_max: number, n_points: number): string;
136
+
102
137
  /**
103
138
  * Run a PM3 semi-empirical calculation.
104
139
  *
@@ -137,6 +172,21 @@ export function compute_rmsd(coords: string, reference: string): string;
137
172
  */
138
173
  export function compute_sasa(elements: string, coords_flat: string, probe_radius: number): string;
139
174
 
175
+ /**
176
+ * Compute an sTDA UV-Vis spectrum with proper oscillator strengths.
177
+ *
178
+ * `elements_json`: JSON array of atomic numbers.
179
+ * `coords_flat_json`: JSON array of flat xyz coords in Å.
180
+ * `sigma`: broadening width in eV.
181
+ * `e_min`, `e_max`: energy range in eV.
182
+ * `n_points`: grid resolution.
183
+ * `broadening`: "gaussian" or "lorentzian".
184
+ *
185
+ * Returns: JSON StdaUvVisSpectrum with energies_ev, wavelengths_nm,
186
+ * absorptivity, excitations, sigma, broadening.
187
+ */
188
+ export function compute_stda_uvvis(elements_json: string, coords_flat_json: string, sigma: number, e_min: number, e_max: number, n_points: number, broadening: string): string;
189
+
140
190
  /**
141
191
  * Detect metal coordination geometry and return structured topology outputs.
142
192
  */
@@ -157,6 +207,18 @@ export function compute_uff_energy_with_aromatic_heuristics(smiles: string, coor
157
207
  */
158
208
  export function compute_uv_vis_spectrum(elements: string, coords_flat: string, sigma: number, e_min: number, e_max: number, n_points: number): string;
159
209
 
210
+ /**
211
+ * Perform vibrational analysis via numerical Hessian.
212
+ *
213
+ * `elements_json`: JSON array of atomic numbers.
214
+ * `coords_flat_json`: JSON array of flat xyz coords in Å.
215
+ * `method`: "eht", "pm3", or "xtb".
216
+ * `step_size`: finite-difference step in Å (0 = default 0.005).
217
+ *
218
+ * Returns: JSON VibrationalAnalysis with modes, frequencies, IR intensities, ZPVE.
219
+ */
220
+ export function compute_vibrational_analysis(elements_json: string, coords_flat_json: string, method: string, step_size: number): string;
221
+
160
222
  /**
161
223
  * Run an xTB tight-binding calculation.
162
224
  *
@@ -266,6 +328,23 @@ export function pack_batch_arrow(results_json: string): string;
266
328
  */
267
329
  export function parse_smiles(smiles: string): string;
268
330
 
331
+ /**
332
+ * Predict J-coupling constants.
333
+ *
334
+ * `smiles`: SMILES string.
335
+ * `coords_flat_json`: JSON flat xyz coords (or "[]" for topological estimate).
336
+ *
337
+ * Returns: JSON array of JCoupling objects.
338
+ */
339
+ export function predict_nmr_couplings(smiles: string, coords_flat_json: string): string;
340
+
341
+ /**
342
+ * Predict ¹H and ¹³C NMR chemical shifts from SMILES (topology only).
343
+ *
344
+ * Returns: JSON NmrShiftResult with h_shifts, c_shifts arrays.
345
+ */
346
+ export function predict_nmr_shifts(smiles: string): string;
347
+
269
348
  /**
270
349
  * Split a batch of SMILES into worker tasks for Web Worker dispatch.
271
350
  *
@@ -346,6 +425,13 @@ export interface InitOutput {
346
425
  readonly compute_xtb: (a: number, b: number, c: number, d: number, e: number) => void;
347
426
  readonly compute_ml_properties: (a: number, b: number, c: number) => void;
348
427
  readonly compute_molecular_descriptors: (a: number, b: number, c: number) => void;
428
+ readonly compute_stda_uvvis: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
429
+ readonly compute_vibrational_analysis: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
430
+ readonly compute_ir_spectrum: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
431
+ readonly predict_nmr_shifts: (a: number, b: number, c: number) => void;
432
+ readonly predict_nmr_couplings: (a: number, b: number, c: number, d: number, e: number) => void;
433
+ readonly compute_nmr_spectrum: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
434
+ readonly compute_hose_codes: (a: number, b: number, c: number, d: number) => void;
349
435
  readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
350
436
  readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
351
437
  readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
package/sci_form_wasm.js CHANGED
@@ -329,6 +329,71 @@ export function compute_fukui_descriptors(elements, coords_flat) {
329
329
  }
330
330
  }
331
331
 
332
+ /**
333
+ * Generate HOSE codes for all atoms in a molecule.
334
+ *
335
+ * `smiles`: SMILES string.
336
+ * `max_radius`: maximum number of spheres (typically 2–4).
337
+ *
338
+ * Returns: JSON array of HoseCode objects.
339
+ * @param {string} smiles
340
+ * @param {number} max_radius
341
+ * @returns {string}
342
+ */
343
+ export function compute_hose_codes(smiles, max_radius) {
344
+ let deferred2_0;
345
+ let deferred2_1;
346
+ try {
347
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
348
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ wasm.compute_hose_codes(retptr, ptr0, len0, max_radius);
351
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
352
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
353
+ deferred2_0 = r0;
354
+ deferred2_1 = r1;
355
+ return getStringFromWasm0(r0, r1);
356
+ } finally {
357
+ wasm.__wbindgen_add_to_stack_pointer(16);
358
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Generate a Lorentzian-broadened IR spectrum from vibrational analysis JSON.
364
+ *
365
+ * `analysis_json`: JSON VibrationalAnalysis (from compute_vibrational_analysis).
366
+ * `gamma`: line width in cm⁻¹.
367
+ * `wn_min`, `wn_max`: wavenumber range in cm⁻¹.
368
+ * `n_points`: grid resolution.
369
+ *
370
+ * Returns: JSON IrSpectrum with wavenumbers, intensities, peaks.
371
+ * @param {string} analysis_json
372
+ * @param {number} gamma
373
+ * @param {number} wn_min
374
+ * @param {number} wn_max
375
+ * @param {number} n_points
376
+ * @returns {string}
377
+ */
378
+ export function compute_ir_spectrum(analysis_json, gamma, wn_min, wn_max, n_points) {
379
+ let deferred2_0;
380
+ let deferred2_1;
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ const ptr0 = passStringToWasm0(analysis_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
384
+ const len0 = WASM_VECTOR_LEN;
385
+ wasm.compute_ir_spectrum(retptr, ptr0, len0, gamma, wn_min, wn_max, n_points);
386
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
387
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
388
+ deferred2_0 = r0;
389
+ deferred2_1 = r1;
390
+ return getStringFromWasm0(r0, r1);
391
+ } finally {
392
+ wasm.__wbindgen_add_to_stack_pointer(16);
393
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
394
+ }
395
+ }
396
+
332
397
  /**
333
398
  * Predict molecular properties using ML proxy models.
334
399
  *
@@ -417,6 +482,45 @@ export function compute_molecular_descriptors(smiles) {
417
482
  }
418
483
  }
419
484
 
485
+ /**
486
+ * Generate a complete NMR spectrum from SMILES.
487
+ *
488
+ * `smiles`: SMILES string.
489
+ * `nucleus`: "1H" or "13C".
490
+ * `gamma`: Lorentzian line width in ppm.
491
+ * `ppm_min`, `ppm_max`: spectral window.
492
+ * `n_points`: grid resolution.
493
+ *
494
+ * Returns: JSON NmrSpectrum with ppm_axis, intensities, peaks.
495
+ * @param {string} smiles
496
+ * @param {string} nucleus
497
+ * @param {number} gamma
498
+ * @param {number} ppm_min
499
+ * @param {number} ppm_max
500
+ * @param {number} n_points
501
+ * @returns {string}
502
+ */
503
+ export function compute_nmr_spectrum(smiles, nucleus, gamma, ppm_min, ppm_max, n_points) {
504
+ let deferred3_0;
505
+ let deferred3_1;
506
+ try {
507
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
508
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
509
+ const len0 = WASM_VECTOR_LEN;
510
+ const ptr1 = passStringToWasm0(nucleus, wasm.__wbindgen_export, wasm.__wbindgen_export2);
511
+ const len1 = WASM_VECTOR_LEN;
512
+ wasm.compute_nmr_spectrum(retptr, ptr0, len0, ptr1, len1, gamma, ppm_min, ppm_max, n_points);
513
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
514
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
515
+ deferred3_0 = r0;
516
+ deferred3_1 = r1;
517
+ return getStringFromWasm0(r0, r1);
518
+ } finally {
519
+ wasm.__wbindgen_add_to_stack_pointer(16);
520
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
521
+ }
522
+ }
523
+
420
524
  /**
421
525
  * Run a PM3 semi-empirical calculation.
422
526
  *
@@ -566,6 +670,50 @@ export function compute_sasa(elements, coords_flat, probe_radius) {
566
670
  }
567
671
  }
568
672
 
673
+ /**
674
+ * Compute an sTDA UV-Vis spectrum with proper oscillator strengths.
675
+ *
676
+ * `elements_json`: JSON array of atomic numbers.
677
+ * `coords_flat_json`: JSON array of flat xyz coords in Å.
678
+ * `sigma`: broadening width in eV.
679
+ * `e_min`, `e_max`: energy range in eV.
680
+ * `n_points`: grid resolution.
681
+ * `broadening`: "gaussian" or "lorentzian".
682
+ *
683
+ * Returns: JSON StdaUvVisSpectrum with energies_ev, wavelengths_nm,
684
+ * absorptivity, excitations, sigma, broadening.
685
+ * @param {string} elements_json
686
+ * @param {string} coords_flat_json
687
+ * @param {number} sigma
688
+ * @param {number} e_min
689
+ * @param {number} e_max
690
+ * @param {number} n_points
691
+ * @param {string} broadening
692
+ * @returns {string}
693
+ */
694
+ export function compute_stda_uvvis(elements_json, coords_flat_json, sigma, e_min, e_max, n_points, broadening) {
695
+ let deferred4_0;
696
+ let deferred4_1;
697
+ try {
698
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
699
+ const ptr0 = passStringToWasm0(elements_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
700
+ const len0 = WASM_VECTOR_LEN;
701
+ const ptr1 = passStringToWasm0(coords_flat_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
702
+ const len1 = WASM_VECTOR_LEN;
703
+ const ptr2 = passStringToWasm0(broadening, wasm.__wbindgen_export, wasm.__wbindgen_export2);
704
+ const len2 = WASM_VECTOR_LEN;
705
+ wasm.compute_stda_uvvis(retptr, ptr0, len0, ptr1, len1, sigma, e_min, e_max, n_points, ptr2, len2);
706
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
707
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
708
+ deferred4_0 = r0;
709
+ deferred4_1 = r1;
710
+ return getStringFromWasm0(r0, r1);
711
+ } finally {
712
+ wasm.__wbindgen_add_to_stack_pointer(16);
713
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
714
+ }
715
+ }
716
+
569
717
  /**
570
718
  * Detect metal coordination geometry and return structured topology outputs.
571
719
  * @param {string} elements
@@ -678,6 +826,44 @@ export function compute_uv_vis_spectrum(elements, coords_flat, sigma, e_min, e_m
678
826
  }
679
827
  }
680
828
 
829
+ /**
830
+ * Perform vibrational analysis via numerical Hessian.
831
+ *
832
+ * `elements_json`: JSON array of atomic numbers.
833
+ * `coords_flat_json`: JSON array of flat xyz coords in Å.
834
+ * `method`: "eht", "pm3", or "xtb".
835
+ * `step_size`: finite-difference step in Å (0 = default 0.005).
836
+ *
837
+ * Returns: JSON VibrationalAnalysis with modes, frequencies, IR intensities, ZPVE.
838
+ * @param {string} elements_json
839
+ * @param {string} coords_flat_json
840
+ * @param {string} method
841
+ * @param {number} step_size
842
+ * @returns {string}
843
+ */
844
+ export function compute_vibrational_analysis(elements_json, coords_flat_json, method, step_size) {
845
+ let deferred4_0;
846
+ let deferred4_1;
847
+ try {
848
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
849
+ const ptr0 = passStringToWasm0(elements_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
850
+ const len0 = WASM_VECTOR_LEN;
851
+ const ptr1 = passStringToWasm0(coords_flat_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
852
+ const len1 = WASM_VECTOR_LEN;
853
+ const ptr2 = passStringToWasm0(method, wasm.__wbindgen_export, wasm.__wbindgen_export2);
854
+ const len2 = WASM_VECTOR_LEN;
855
+ wasm.compute_vibrational_analysis(retptr, ptr0, len0, ptr1, len1, ptr2, len2, step_size);
856
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
857
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
858
+ deferred4_0 = r0;
859
+ deferred4_1 = r1;
860
+ return getStringFromWasm0(r0, r1);
861
+ } finally {
862
+ wasm.__wbindgen_add_to_stack_pointer(16);
863
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
864
+ }
865
+ }
866
+
681
867
  /**
682
868
  * Run an xTB tight-binding calculation.
683
869
  *
@@ -1070,6 +1256,64 @@ export function parse_smiles(smiles) {
1070
1256
  }
1071
1257
  }
1072
1258
 
1259
+ /**
1260
+ * Predict J-coupling constants.
1261
+ *
1262
+ * `smiles`: SMILES string.
1263
+ * `coords_flat_json`: JSON flat xyz coords (or "[]" for topological estimate).
1264
+ *
1265
+ * Returns: JSON array of JCoupling objects.
1266
+ * @param {string} smiles
1267
+ * @param {string} coords_flat_json
1268
+ * @returns {string}
1269
+ */
1270
+ export function predict_nmr_couplings(smiles, coords_flat_json) {
1271
+ let deferred3_0;
1272
+ let deferred3_1;
1273
+ try {
1274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1275
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1276
+ const len0 = WASM_VECTOR_LEN;
1277
+ const ptr1 = passStringToWasm0(coords_flat_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1278
+ const len1 = WASM_VECTOR_LEN;
1279
+ wasm.predict_nmr_couplings(retptr, ptr0, len0, ptr1, len1);
1280
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1281
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1282
+ deferred3_0 = r0;
1283
+ deferred3_1 = r1;
1284
+ return getStringFromWasm0(r0, r1);
1285
+ } finally {
1286
+ wasm.__wbindgen_add_to_stack_pointer(16);
1287
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
1288
+ }
1289
+ }
1290
+
1291
+ /**
1292
+ * Predict ¹H and ¹³C NMR chemical shifts from SMILES (topology only).
1293
+ *
1294
+ * Returns: JSON NmrShiftResult with h_shifts, c_shifts arrays.
1295
+ * @param {string} smiles
1296
+ * @returns {string}
1297
+ */
1298
+ export function predict_nmr_shifts(smiles) {
1299
+ let deferred2_0;
1300
+ let deferred2_1;
1301
+ try {
1302
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1303
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1304
+ const len0 = WASM_VECTOR_LEN;
1305
+ wasm.predict_nmr_shifts(retptr, ptr0, len0);
1306
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1307
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1308
+ deferred2_0 = r0;
1309
+ deferred2_1 = r1;
1310
+ return getStringFromWasm0(r0, r1);
1311
+ } finally {
1312
+ wasm.__wbindgen_add_to_stack_pointer(16);
1313
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
1314
+ }
1315
+ }
1316
+
1073
1317
  /**
1074
1318
  * Split a batch of SMILES into worker tasks for Web Worker dispatch.
1075
1319
  *
Binary file