sci-form-wasm 0.1.7 → 0.3.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.1.7",
5
+ "version": "0.3.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,108 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Assemble a framework crystal structure.
6
+ *
7
+ * `topology`: "pcu", "dia", or "sql"
8
+ * `metal`: atomic number of the metal center
9
+ * `geometry`: "linear", "tetrahedral", "octahedral", "square_planar", "trigonal"
10
+ * `lattice_a`: cubic lattice parameter in Å
11
+ * `supercell`: replication factor (1 = no replication)
12
+ */
13
+ export function assemble_framework(topology: string, metal: number, geometry: string, lattice_a: number, supercell: number): string;
14
+
15
+ /**
16
+ * Compute Gasteiger-Marsili partial charges from a SMILES string.
17
+ *
18
+ * Returns JSON with charges, iterations, total_charge.
19
+ */
20
+ export function compute_charges(smiles: string): string;
21
+
22
+ /**
23
+ * Compute molecular dipole moment.
24
+ */
25
+ export function compute_dipole(elements: string, coords_flat: string): string;
26
+
27
+ /**
28
+ * Compute DOS/PDOS from EHT orbital energies.
29
+ */
30
+ export function compute_dos(elements: string, coords_flat: string, sigma: number, e_min: number, e_max: number, n_points: number): string;
31
+
32
+ /**
33
+ * Get ESP grid metadata (origin, spacing, dimensions) as JSON.
34
+ */
35
+ export function compute_esp_grid_info(elements: string, coords_flat: string, spacing: number, padding: number): string;
36
+
37
+ /**
38
+ * Compute ESP grid and return values as Float64Array (typed-array transfer).
39
+ *
40
+ * Returns Float64Array of grid values. Grid metadata available via compute_esp_grid_info().
41
+ */
42
+ export function compute_esp_grid_typed(elements: string, coords_flat: string, spacing: number, padding: number): Float64Array;
43
+
44
+ /**
45
+ * Compute Mulliken & Löwdin population analysis.
46
+ * Elements: JSON array of atomic numbers. Coords: JSON array of flat xyz.
47
+ */
48
+ export function compute_population(elements: string, coords_flat: string): string;
49
+
50
+ /**
51
+ * Compute RMSD between two coordinate sets after Kabsch alignment.
52
+ */
53
+ export function compute_rmsd(coords: string, reference: string): string;
54
+
55
+ /**
56
+ * Compute solvent-accessible surface area from atomic numbers and coordinates.
57
+ *
58
+ * - `elements`: JSON array of atomic numbers, e.g. `[8,1,1]`
59
+ * - `coords_flat`: JSON array of flat xyz coordinates
60
+ * - `probe_radius`: probe radius in Å (pass 0.0 for default 1.4)
61
+ *
62
+ * Returns JSON with total_sasa, atom_sasa, probe_radius, num_points.
63
+ */
64
+ export function compute_sasa(elements: string, coords_flat: string, probe_radius: number): string;
65
+
66
+ /**
67
+ * Compute UFF force field energy.
68
+ */
69
+ export function compute_uff_energy(smiles: string, coords: string): string;
70
+
71
+ /**
72
+ * Create a unit cell and return parameters + volume as JSON.
73
+ */
74
+ export function create_unit_cell(a: number, b: number, c: number, alpha: number, beta: number, gamma: number): string;
75
+
76
+ /**
77
+ * Run an EHT calculation on a molecule given its elements and flat XYZ coordinates.
78
+ *
79
+ * - `elements`: JSON array of atomic numbers, e.g. `[8,1,1]`
80
+ * - `coords_flat`: JSON array of flat xyz coordinates `[x0,y0,z0,x1,y1,z1,...]`
81
+ * - `k`: Wolfsberg-Helmholtz constant (pass 0.0 for default 1.75)
82
+ *
83
+ * Returns JSON with energies, coefficients, HOMO/LUMO info.
84
+ */
85
+ export function eht_calculate(elements: string, coords_flat: string, k: number): string;
86
+
87
+ /**
88
+ * Compute orbital grid as Float32Array (typed-array transfer).
89
+ *
90
+ * Returns the flat volumetric grid as Float32Array for GPU volume rendering.
91
+ */
92
+ export function eht_orbital_grid_typed(elements: string, coords_flat: string, mo_index: number, spacing: number): Float32Array;
93
+
94
+ /**
95
+ * Generate an orbital volumetric grid and extract an isosurface mesh.
96
+ *
97
+ * - `elements`, `coords_flat`: same as `eht_calculate()`
98
+ * - `mo_index`: molecular orbital index (0-based)
99
+ * - `spacing`: grid spacing in Ångström (e.g. 0.2)
100
+ * - `isovalue`: isosurface cutoff (e.g. 0.02)
101
+ *
102
+ * Returns JSON with mesh vertices, normals, indices.
103
+ */
104
+ export function eht_orbital_mesh(elements: string, coords_flat: string, mo_index: number, spacing: number, isovalue: number): string;
105
+
4
106
  /**
5
107
  * Generate a 3D conformer from a SMILES string.
6
108
  *
@@ -22,11 +124,39 @@ export function embed_batch(smiles_list: string, seed: number): string;
22
124
  */
23
125
  export function embed_coords(smiles: string, seed: number): string;
24
126
 
127
+ /**
128
+ * Generate 3D coordinates as a Float64Array (typed-array transfer).
129
+ *
130
+ * Returns a Float64Array [x0,y0,z0, x1,y1,z1,...] or empty on failure.
131
+ */
132
+ export function embed_coords_typed(smiles: string, seed: number): Float64Array;
133
+
134
+ /**
135
+ * Estimate optimal number of Web Workers for a batch size.
136
+ */
137
+ export function estimate_workers(n_items: number, max_workers: number): number;
138
+
139
+ /**
140
+ * Pack a batch of conformer results into Arrow-compatible columnar format.
141
+ *
142
+ * Input: JSON array of ConformerResult objects.
143
+ * Output: JSON RecordBatch with typed columns for zero-copy transfer.
144
+ */
145
+ export function pack_batch_arrow(results_json: string): string;
146
+
25
147
  /**
26
148
  * Parse a SMILES string and return molecular info (no 3D).
27
149
  */
28
150
  export function parse_smiles(smiles: string): string;
29
151
 
152
+ /**
153
+ * Split a batch of SMILES into worker tasks for Web Worker dispatch.
154
+ *
155
+ * Input: JSON array of SMILES strings.
156
+ * Output: JSON array of WorkerTask objects.
157
+ */
158
+ export function split_worker_tasks(smiles_json: string, n_workers: number, seed: number): string;
159
+
30
160
  /**
31
161
  * Library version.
32
162
  */
package/sci_form_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./sci_form_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- embed, embed_batch, embed_coords, parse_smiles, version
8
+ assemble_framework, compute_charges, compute_dipole, compute_dos, compute_esp_grid_info, compute_esp_grid_typed, compute_population, compute_rmsd, compute_sasa, compute_uff_energy, create_unit_cell, eht_calculate, eht_orbital_grid_typed, eht_orbital_mesh, embed, embed_batch, embed_coords, embed_coords_typed, estimate_workers, pack_batch_arrow, parse_smiles, split_worker_tasks, version
9
9
  } from "./sci_form_wasm_bg.js";
@@ -1,3 +1,404 @@
1
+ /**
2
+ * Assemble a framework crystal structure.
3
+ *
4
+ * `topology`: "pcu", "dia", or "sql"
5
+ * `metal`: atomic number of the metal center
6
+ * `geometry`: "linear", "tetrahedral", "octahedral", "square_planar", "trigonal"
7
+ * `lattice_a`: cubic lattice parameter in Å
8
+ * `supercell`: replication factor (1 = no replication)
9
+ * @param {string} topology
10
+ * @param {number} metal
11
+ * @param {string} geometry
12
+ * @param {number} lattice_a
13
+ * @param {number} supercell
14
+ * @returns {string}
15
+ */
16
+ export function assemble_framework(topology, metal, geometry, lattice_a, supercell) {
17
+ let deferred3_0;
18
+ let deferred3_1;
19
+ try {
20
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
21
+ const ptr0 = passStringToWasm0(topology, wasm.__wbindgen_export, wasm.__wbindgen_export2);
22
+ const len0 = WASM_VECTOR_LEN;
23
+ const ptr1 = passStringToWasm0(geometry, wasm.__wbindgen_export, wasm.__wbindgen_export2);
24
+ const len1 = WASM_VECTOR_LEN;
25
+ wasm.assemble_framework(retptr, ptr0, len0, metal, ptr1, len1, lattice_a, supercell);
26
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
27
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
28
+ deferred3_0 = r0;
29
+ deferred3_1 = r1;
30
+ return getStringFromWasm0(r0, r1);
31
+ } finally {
32
+ wasm.__wbindgen_add_to_stack_pointer(16);
33
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Compute Gasteiger-Marsili partial charges from a SMILES string.
39
+ *
40
+ * Returns JSON with charges, iterations, total_charge.
41
+ * @param {string} smiles
42
+ * @returns {string}
43
+ */
44
+ export function compute_charges(smiles) {
45
+ let deferred2_0;
46
+ let deferred2_1;
47
+ try {
48
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
49
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
50
+ const len0 = WASM_VECTOR_LEN;
51
+ wasm.compute_charges(retptr, ptr0, len0);
52
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
53
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
54
+ deferred2_0 = r0;
55
+ deferred2_1 = r1;
56
+ return getStringFromWasm0(r0, r1);
57
+ } finally {
58
+ wasm.__wbindgen_add_to_stack_pointer(16);
59
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Compute molecular dipole moment.
65
+ * @param {string} elements
66
+ * @param {string} coords_flat
67
+ * @returns {string}
68
+ */
69
+ export function compute_dipole(elements, coords_flat) {
70
+ let deferred3_0;
71
+ let deferred3_1;
72
+ try {
73
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
74
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
75
+ const len0 = WASM_VECTOR_LEN;
76
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
77
+ const len1 = WASM_VECTOR_LEN;
78
+ wasm.compute_dipole(retptr, ptr0, len0, ptr1, len1);
79
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
80
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
81
+ deferred3_0 = r0;
82
+ deferred3_1 = r1;
83
+ return getStringFromWasm0(r0, r1);
84
+ } finally {
85
+ wasm.__wbindgen_add_to_stack_pointer(16);
86
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Compute DOS/PDOS from EHT orbital energies.
92
+ * @param {string} elements
93
+ * @param {string} coords_flat
94
+ * @param {number} sigma
95
+ * @param {number} e_min
96
+ * @param {number} e_max
97
+ * @param {number} n_points
98
+ * @returns {string}
99
+ */
100
+ export function compute_dos(elements, coords_flat, sigma, e_min, e_max, n_points) {
101
+ let deferred3_0;
102
+ let deferred3_1;
103
+ try {
104
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
105
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
108
+ const len1 = WASM_VECTOR_LEN;
109
+ wasm.compute_dos(retptr, ptr0, len0, ptr1, len1, sigma, e_min, e_max, n_points);
110
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
111
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
112
+ deferred3_0 = r0;
113
+ deferred3_1 = r1;
114
+ return getStringFromWasm0(r0, r1);
115
+ } finally {
116
+ wasm.__wbindgen_add_to_stack_pointer(16);
117
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Get ESP grid metadata (origin, spacing, dimensions) as JSON.
123
+ * @param {string} elements
124
+ * @param {string} coords_flat
125
+ * @param {number} spacing
126
+ * @param {number} padding
127
+ * @returns {string}
128
+ */
129
+ export function compute_esp_grid_info(elements, coords_flat, spacing, padding) {
130
+ let deferred3_0;
131
+ let deferred3_1;
132
+ try {
133
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
134
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
137
+ const len1 = WASM_VECTOR_LEN;
138
+ wasm.compute_esp_grid_info(retptr, ptr0, len0, ptr1, len1, spacing, padding);
139
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
140
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
141
+ deferred3_0 = r0;
142
+ deferred3_1 = r1;
143
+ return getStringFromWasm0(r0, r1);
144
+ } finally {
145
+ wasm.__wbindgen_add_to_stack_pointer(16);
146
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Compute ESP grid and return values as Float64Array (typed-array transfer).
152
+ *
153
+ * Returns Float64Array of grid values. Grid metadata available via compute_esp_grid_info().
154
+ * @param {string} elements
155
+ * @param {string} coords_flat
156
+ * @param {number} spacing
157
+ * @param {number} padding
158
+ * @returns {Float64Array}
159
+ */
160
+ export function compute_esp_grid_typed(elements, coords_flat, spacing, padding) {
161
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
+ const len0 = WASM_VECTOR_LEN;
163
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
164
+ const len1 = WASM_VECTOR_LEN;
165
+ const ret = wasm.compute_esp_grid_typed(ptr0, len0, ptr1, len1, spacing, padding);
166
+ return takeObject(ret);
167
+ }
168
+
169
+ /**
170
+ * Compute Mulliken & Löwdin population analysis.
171
+ * Elements: JSON array of atomic numbers. Coords: JSON array of flat xyz.
172
+ * @param {string} elements
173
+ * @param {string} coords_flat
174
+ * @returns {string}
175
+ */
176
+ export function compute_population(elements, coords_flat) {
177
+ let deferred3_0;
178
+ let deferred3_1;
179
+ try {
180
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
181
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
182
+ const len0 = WASM_VECTOR_LEN;
183
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
184
+ const len1 = WASM_VECTOR_LEN;
185
+ wasm.compute_population(retptr, ptr0, len0, ptr1, len1);
186
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
187
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
188
+ deferred3_0 = r0;
189
+ deferred3_1 = r1;
190
+ return getStringFromWasm0(r0, r1);
191
+ } finally {
192
+ wasm.__wbindgen_add_to_stack_pointer(16);
193
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Compute RMSD between two coordinate sets after Kabsch alignment.
199
+ * @param {string} coords
200
+ * @param {string} reference
201
+ * @returns {string}
202
+ */
203
+ export function compute_rmsd(coords, reference) {
204
+ let deferred3_0;
205
+ let deferred3_1;
206
+ try {
207
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
208
+ const ptr0 = passStringToWasm0(coords, wasm.__wbindgen_export, wasm.__wbindgen_export2);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ptr1 = passStringToWasm0(reference, wasm.__wbindgen_export, wasm.__wbindgen_export2);
211
+ const len1 = WASM_VECTOR_LEN;
212
+ wasm.compute_rmsd(retptr, ptr0, len0, ptr1, len1);
213
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
214
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
215
+ deferred3_0 = r0;
216
+ deferred3_1 = r1;
217
+ return getStringFromWasm0(r0, r1);
218
+ } finally {
219
+ wasm.__wbindgen_add_to_stack_pointer(16);
220
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Compute solvent-accessible surface area from atomic numbers and coordinates.
226
+ *
227
+ * - `elements`: JSON array of atomic numbers, e.g. `[8,1,1]`
228
+ * - `coords_flat`: JSON array of flat xyz coordinates
229
+ * - `probe_radius`: probe radius in Å (pass 0.0 for default 1.4)
230
+ *
231
+ * Returns JSON with total_sasa, atom_sasa, probe_radius, num_points.
232
+ * @param {string} elements
233
+ * @param {string} coords_flat
234
+ * @param {number} probe_radius
235
+ * @returns {string}
236
+ */
237
+ export function compute_sasa(elements, coords_flat, probe_radius) {
238
+ let deferred3_0;
239
+ let deferred3_1;
240
+ try {
241
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
242
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
243
+ const len0 = WASM_VECTOR_LEN;
244
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
245
+ const len1 = WASM_VECTOR_LEN;
246
+ wasm.compute_sasa(retptr, ptr0, len0, ptr1, len1, probe_radius);
247
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
248
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
249
+ deferred3_0 = r0;
250
+ deferred3_1 = r1;
251
+ return getStringFromWasm0(r0, r1);
252
+ } finally {
253
+ wasm.__wbindgen_add_to_stack_pointer(16);
254
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Compute UFF force field energy.
260
+ * @param {string} smiles
261
+ * @param {string} coords
262
+ * @returns {string}
263
+ */
264
+ export function compute_uff_energy(smiles, coords) {
265
+ let deferred3_0;
266
+ let deferred3_1;
267
+ try {
268
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
269
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
+ const len0 = WASM_VECTOR_LEN;
271
+ const ptr1 = passStringToWasm0(coords, wasm.__wbindgen_export, wasm.__wbindgen_export2);
272
+ const len1 = WASM_VECTOR_LEN;
273
+ wasm.compute_uff_energy(retptr, ptr0, len0, ptr1, len1);
274
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
275
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
276
+ deferred3_0 = r0;
277
+ deferred3_1 = r1;
278
+ return getStringFromWasm0(r0, r1);
279
+ } finally {
280
+ wasm.__wbindgen_add_to_stack_pointer(16);
281
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
282
+ }
283
+ }
284
+
285
+ /**
286
+ * Create a unit cell and return parameters + volume as JSON.
287
+ * @param {number} a
288
+ * @param {number} b
289
+ * @param {number} c
290
+ * @param {number} alpha
291
+ * @param {number} beta
292
+ * @param {number} gamma
293
+ * @returns {string}
294
+ */
295
+ export function create_unit_cell(a, b, c, alpha, beta, gamma) {
296
+ let deferred1_0;
297
+ let deferred1_1;
298
+ try {
299
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
300
+ wasm.create_unit_cell(retptr, a, b, c, alpha, beta, gamma);
301
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
302
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
303
+ deferred1_0 = r0;
304
+ deferred1_1 = r1;
305
+ return getStringFromWasm0(r0, r1);
306
+ } finally {
307
+ wasm.__wbindgen_add_to_stack_pointer(16);
308
+ wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Run an EHT calculation on a molecule given its elements and flat XYZ coordinates.
314
+ *
315
+ * - `elements`: JSON array of atomic numbers, e.g. `[8,1,1]`
316
+ * - `coords_flat`: JSON array of flat xyz coordinates `[x0,y0,z0,x1,y1,z1,...]`
317
+ * - `k`: Wolfsberg-Helmholtz constant (pass 0.0 for default 1.75)
318
+ *
319
+ * Returns JSON with energies, coefficients, HOMO/LUMO info.
320
+ * @param {string} elements
321
+ * @param {string} coords_flat
322
+ * @param {number} k
323
+ * @returns {string}
324
+ */
325
+ export function eht_calculate(elements, coords_flat, k) {
326
+ let deferred3_0;
327
+ let deferred3_1;
328
+ try {
329
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
330
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
+ const len0 = WASM_VECTOR_LEN;
332
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
333
+ const len1 = WASM_VECTOR_LEN;
334
+ wasm.eht_calculate(retptr, ptr0, len0, ptr1, len1, k);
335
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
336
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
337
+ deferred3_0 = r0;
338
+ deferred3_1 = r1;
339
+ return getStringFromWasm0(r0, r1);
340
+ } finally {
341
+ wasm.__wbindgen_add_to_stack_pointer(16);
342
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
343
+ }
344
+ }
345
+
346
+ /**
347
+ * Compute orbital grid as Float32Array (typed-array transfer).
348
+ *
349
+ * Returns the flat volumetric grid as Float32Array for GPU volume rendering.
350
+ * @param {string} elements
351
+ * @param {string} coords_flat
352
+ * @param {number} mo_index
353
+ * @param {number} spacing
354
+ * @returns {Float32Array}
355
+ */
356
+ export function eht_orbital_grid_typed(elements, coords_flat, mo_index, spacing) {
357
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
358
+ const len0 = WASM_VECTOR_LEN;
359
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
360
+ const len1 = WASM_VECTOR_LEN;
361
+ const ret = wasm.eht_orbital_grid_typed(ptr0, len0, ptr1, len1, mo_index, spacing);
362
+ return takeObject(ret);
363
+ }
364
+
365
+ /**
366
+ * Generate an orbital volumetric grid and extract an isosurface mesh.
367
+ *
368
+ * - `elements`, `coords_flat`: same as `eht_calculate()`
369
+ * - `mo_index`: molecular orbital index (0-based)
370
+ * - `spacing`: grid spacing in Ångström (e.g. 0.2)
371
+ * - `isovalue`: isosurface cutoff (e.g. 0.02)
372
+ *
373
+ * Returns JSON with mesh vertices, normals, indices.
374
+ * @param {string} elements
375
+ * @param {string} coords_flat
376
+ * @param {number} mo_index
377
+ * @param {number} spacing
378
+ * @param {number} isovalue
379
+ * @returns {string}
380
+ */
381
+ export function eht_orbital_mesh(elements, coords_flat, mo_index, spacing, isovalue) {
382
+ let deferred3_0;
383
+ let deferred3_1;
384
+ try {
385
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
386
+ const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
389
+ const len1 = WASM_VECTOR_LEN;
390
+ wasm.eht_orbital_mesh(retptr, ptr0, len0, ptr1, len1, mo_index, spacing, isovalue);
391
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
392
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
393
+ deferred3_0 = r0;
394
+ deferred3_1 = r1;
395
+ return getStringFromWasm0(r0, r1);
396
+ } finally {
397
+ wasm.__wbindgen_add_to_stack_pointer(16);
398
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
399
+ }
400
+ }
401
+
1
402
  /**
2
403
  * Generate a 3D conformer from a SMILES string.
3
404
  *
@@ -79,6 +480,59 @@ export function embed_coords(smiles, seed) {
79
480
  }
80
481
  }
81
482
 
483
+ /**
484
+ * Generate 3D coordinates as a Float64Array (typed-array transfer).
485
+ *
486
+ * Returns a Float64Array [x0,y0,z0, x1,y1,z1,...] or empty on failure.
487
+ * @param {string} smiles
488
+ * @param {number} seed
489
+ * @returns {Float64Array}
490
+ */
491
+ export function embed_coords_typed(smiles, seed) {
492
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.embed_coords_typed(ptr0, len0, seed);
495
+ return takeObject(ret);
496
+ }
497
+
498
+ /**
499
+ * Estimate optimal number of Web Workers for a batch size.
500
+ * @param {number} n_items
501
+ * @param {number} max_workers
502
+ * @returns {number}
503
+ */
504
+ export function estimate_workers(n_items, max_workers) {
505
+ const ret = wasm.estimate_workers(n_items, max_workers);
506
+ return ret >>> 0;
507
+ }
508
+
509
+ /**
510
+ * Pack a batch of conformer results into Arrow-compatible columnar format.
511
+ *
512
+ * Input: JSON array of ConformerResult objects.
513
+ * Output: JSON RecordBatch with typed columns for zero-copy transfer.
514
+ * @param {string} results_json
515
+ * @returns {string}
516
+ */
517
+ export function pack_batch_arrow(results_json) {
518
+ let deferred2_0;
519
+ let deferred2_1;
520
+ try {
521
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
522
+ const ptr0 = passStringToWasm0(results_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ wasm.pack_batch_arrow(retptr, ptr0, len0);
525
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
526
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
527
+ deferred2_0 = r0;
528
+ deferred2_1 = r1;
529
+ return getStringFromWasm0(r0, r1);
530
+ } finally {
531
+ wasm.__wbindgen_add_to_stack_pointer(16);
532
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
533
+ }
534
+ }
535
+
82
536
  /**
83
537
  * Parse a SMILES string and return molecular info (no 3D).
84
538
  * @param {string} smiles
@@ -103,6 +557,35 @@ export function parse_smiles(smiles) {
103
557
  }
104
558
  }
105
559
 
560
+ /**
561
+ * Split a batch of SMILES into worker tasks for Web Worker dispatch.
562
+ *
563
+ * Input: JSON array of SMILES strings.
564
+ * Output: JSON array of WorkerTask objects.
565
+ * @param {string} smiles_json
566
+ * @param {number} n_workers
567
+ * @param {number} seed
568
+ * @returns {string}
569
+ */
570
+ export function split_worker_tasks(smiles_json, n_workers, seed) {
571
+ let deferred2_0;
572
+ let deferred2_1;
573
+ try {
574
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
575
+ const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
576
+ const len0 = WASM_VECTOR_LEN;
577
+ wasm.split_worker_tasks(retptr, ptr0, len0, n_workers, seed);
578
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
579
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
580
+ deferred2_0 = r0;
581
+ deferred2_1 = r1;
582
+ return getStringFromWasm0(r0, r1);
583
+ } finally {
584
+ wasm.__wbindgen_add_to_stack_pointer(16);
585
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
586
+ }
587
+ }
588
+
106
589
  /**
107
590
  * Library version.
108
591
  * @returns {string}
@@ -126,6 +609,53 @@ export function version() {
126
609
  export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
127
610
  throw new Error(getStringFromWasm0(arg0, arg1));
128
611
  }
612
+ export function __wbg_length_259ee9d041e381ad(arg0) {
613
+ const ret = getObject(arg0).length;
614
+ return ret;
615
+ }
616
+ export function __wbg_length_550d8a396009cd38(arg0) {
617
+ const ret = getObject(arg0).length;
618
+ return ret;
619
+ }
620
+ export function __wbg_new_with_length_81c1c31d4432cb9f(arg0) {
621
+ const ret = new Float32Array(arg0 >>> 0);
622
+ return addHeapObject(ret);
623
+ }
624
+ export function __wbg_new_with_length_eae667475c36c4e4(arg0) {
625
+ const ret = new Float64Array(arg0 >>> 0);
626
+ return addHeapObject(ret);
627
+ }
628
+ export function __wbg_set_361bc2460da3016f(arg0, arg1, arg2) {
629
+ getObject(arg0).set(getArrayF32FromWasm0(arg1, arg2));
630
+ }
631
+ export function __wbg_set_636d1e3e4286e068(arg0, arg1, arg2) {
632
+ getObject(arg0).set(getArrayF64FromWasm0(arg1, arg2));
633
+ }
634
+ function addHeapObject(obj) {
635
+ if (heap_next === heap.length) heap.push(heap.length + 1);
636
+ const idx = heap_next;
637
+ heap_next = heap[idx];
638
+
639
+ heap[idx] = obj;
640
+ return idx;
641
+ }
642
+
643
+ function dropObject(idx) {
644
+ if (idx < 1028) return;
645
+ heap[idx] = heap_next;
646
+ heap_next = idx;
647
+ }
648
+
649
+ function getArrayF32FromWasm0(ptr, len) {
650
+ ptr = ptr >>> 0;
651
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
652
+ }
653
+
654
+ function getArrayF64FromWasm0(ptr, len) {
655
+ ptr = ptr >>> 0;
656
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
657
+ }
658
+
129
659
  let cachedDataViewMemory0 = null;
130
660
  function getDataViewMemory0() {
131
661
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -134,6 +664,22 @@ function getDataViewMemory0() {
134
664
  return cachedDataViewMemory0;
135
665
  }
136
666
 
667
+ let cachedFloat32ArrayMemory0 = null;
668
+ function getFloat32ArrayMemory0() {
669
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
670
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
671
+ }
672
+ return cachedFloat32ArrayMemory0;
673
+ }
674
+
675
+ let cachedFloat64ArrayMemory0 = null;
676
+ function getFloat64ArrayMemory0() {
677
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
678
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
679
+ }
680
+ return cachedFloat64ArrayMemory0;
681
+ }
682
+
137
683
  function getStringFromWasm0(ptr, len) {
138
684
  ptr = ptr >>> 0;
139
685
  return decodeText(ptr, len);
@@ -147,6 +693,13 @@ function getUint8ArrayMemory0() {
147
693
  return cachedUint8ArrayMemory0;
148
694
  }
149
695
 
696
+ function getObject(idx) { return heap[idx]; }
697
+
698
+ let heap = new Array(1024).fill(undefined);
699
+ heap.push(undefined, null, true, false);
700
+
701
+ let heap_next = heap.length;
702
+
150
703
  function passStringToWasm0(arg, malloc, realloc) {
151
704
  if (realloc === undefined) {
152
705
  const buf = cachedTextEncoder.encode(arg);
@@ -184,6 +737,12 @@ function passStringToWasm0(arg, malloc, realloc) {
184
737
  return ptr;
185
738
  }
186
739
 
740
+ function takeObject(idx) {
741
+ const ret = getObject(idx);
742
+ dropObject(idx);
743
+ return ret;
744
+ }
745
+
187
746
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
188
747
  cachedTextDecoder.decode();
189
748
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
Binary file