sci-form-wasm 0.10.6 → 0.12.3

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.
@@ -0,0 +1,204 @@
1
+ /**
2
+ * sci-form-wasm/alpha — TypeScript declarations.
3
+ *
4
+ * All functions accept/return JSON strings except where noted.
5
+ * Call `await init()` from the main `sci-form-wasm` package once before use.
6
+ */
7
+
8
+ // ── A1: Kohn-Sham DFT ─────────────────────────────────────────────────────
9
+
10
+ /**
11
+ * Run a Kohn-Sham DFT single-point calculation.
12
+ * @param elements_json JSON array of atomic numbers e.g. `"[6,1,1,1,1]"`
13
+ * @param coords_flat_json JSON flat coords `"[x0,y0,z0,...]"`
14
+ * @param method `"svwn"` (LDA) | `"pbe"` (GGA, default)
15
+ * @returns JSON DftResult:
16
+ * `{ energy, homo_energy, lumo_energy, gap, converged, n_basis,
17
+ * scf_iterations, mulliken_charges, orbital_energies,
18
+ * nuclear_repulsion, xc_energy }`
19
+ */
20
+ export declare function alpha_compute_dft(
21
+ elements_json: string,
22
+ coords_flat_json: string,
23
+ method?: string
24
+ ): string;
25
+
26
+ // ── A2: ReaxFF ────────────────────────────────────────────────────────────
27
+
28
+ /**
29
+ * Compute ReaxFF energy and analytical gradient.
30
+ * @returns JSON `{ energy_kcal_mol: number, gradient: number[] }`
31
+ */
32
+ export declare function alpha_compute_reaxff_gradient(
33
+ elements_json: string,
34
+ coords_flat_json: string
35
+ ): string;
36
+
37
+ /**
38
+ * Compute ReaxFF energy components (no gradient).
39
+ * @returns JSON `{ bonded, coulomb, van_der_waals, total }` in kcal/mol
40
+ */
41
+ export declare function alpha_compute_reaxff_energy(
42
+ elements_json: string,
43
+ coords_flat_json: string
44
+ ): string;
45
+
46
+ /**
47
+ * Compute EEM equilibrium point charges.
48
+ * @returns JSON `{ charges: number[], total_charge: number }`
49
+ */
50
+ export declare function alpha_compute_eem_charges(
51
+ elements_json: string,
52
+ coords_flat_json: string
53
+ ): string;
54
+
55
+ // ── A3: MLFF ─────────────────────────────────────────────────────────────
56
+
57
+ /**
58
+ * Compute MLFF energy and forces using element-specific neural networks.
59
+ * @param config_json JSON `MlffConfig` object
60
+ * @returns JSON `{ energy: number, atomic_energies: number[], forces: number[] }`
61
+ */
62
+ export declare function alpha_compute_mlff(
63
+ elements_json: string,
64
+ coords_flat_json: string,
65
+ config_json: string
66
+ ): string;
67
+
68
+ /**
69
+ * Compute Atomic Environment Vectors (AEVs) for each atom.
70
+ * @param params_json JSON `SymmetryFunctionParams` or `"{}"` for defaults
71
+ * @returns JSON `{ n_atoms, aev_length, aevs: number[][] }`
72
+ */
73
+ export declare function alpha_compute_aevs(
74
+ elements_json: string,
75
+ coords_flat_json: string,
76
+ params_json?: string
77
+ ): string;
78
+
79
+ // ── A4: Obara-Saika ERIs ─────────────────────────────────────────────────
80
+
81
+ /**
82
+ * Compute Boys function F_n(x).
83
+ * @returns JSON `{ value: number }`
84
+ */
85
+ export declare function alpha_boys_function(n: number, x: number): string;
86
+
87
+ /**
88
+ * Compute a (ss|ss) two-electron repulsion integral.
89
+ * Each shell JSON: `{ "alpha": number, "center": [x, y, z] }`
90
+ * @returns JSON `{ eri: number }`
91
+ */
92
+ export declare function alpha_eri_ssss(
93
+ shell_a_json: string,
94
+ shell_b_json: string,
95
+ shell_c_json: string,
96
+ shell_d_json: string
97
+ ): string;
98
+
99
+ /**
100
+ * Compute Schwarz pre-screening upper bound Q_ab = √⟨ab|ab⟩.
101
+ * @returns JSON `{ schwarz_bound: number }`
102
+ */
103
+ export declare function alpha_schwarz_bound(
104
+ alpha: number,
105
+ center_a_json: string,
106
+ beta: number,
107
+ center_b_json: string
108
+ ): string;
109
+
110
+ // ── A5: CGA Motor Algebra ────────────────────────────────────────────────
111
+
112
+ /**
113
+ * Rotate a sub-tree of atoms around a bond using a CGA motor.
114
+ * @param subtree_indices_json JSON array of atom indices to rotate
115
+ * @param axis_a_json / axis_b_json `[x, y, z]` of axis endpoints
116
+ * @param angle_rad Rotation angle in radians
117
+ * @returns JSON `{ coords: number[] }`
118
+ */
119
+ export declare function alpha_rotate_dihedral_cga(
120
+ coords_flat_json: string,
121
+ subtree_indices_json: string,
122
+ axis_a_json: string,
123
+ axis_b_json: string,
124
+ angle_rad: number
125
+ ): string;
126
+
127
+ /**
128
+ * Refine a dihedral to a target angle using CGA.
129
+ * @param torsion_indices_json JSON `[i, j, k, l]`
130
+ * @returns JSON `{ coords: number[] }`
131
+ */
132
+ export declare function alpha_refine_torsion_cga(
133
+ elements_json: string,
134
+ coords_flat_json: string,
135
+ smiles: string,
136
+ torsion_indices_json: string,
137
+ target_angle_rad: number
138
+ ): string;
139
+
140
+ // ── A6: Growing String Method ─────────────────────────────────────────────
141
+
142
+ /**
143
+ * Interpolate a reaction path node at t ∈ [0, 1].
144
+ * @returns JSON `{ coords: number[] }`
145
+ */
146
+ export declare function alpha_gsm_interpolate(
147
+ reactant_json: string,
148
+ product_json: string,
149
+ t: number
150
+ ): string;
151
+
152
+ /**
153
+ * Find transition state using Growing String Method with UFF energy.
154
+ * @param config_json JSON `GsmConfig` or `"{}"`
155
+ * @returns JSON `GsmResult`:
156
+ * `{ ts_coords, ts_energy, path_energies, n_nodes, converged }`
157
+ */
158
+ export declare function alpha_gsm_find_ts(
159
+ smiles: string,
160
+ reactant_coords_json: string,
161
+ product_coords_json: string,
162
+ config_json?: string
163
+ ): string;
164
+
165
+ // ── A7: SDR Embedding ────────────────────────────────────────────────────
166
+
167
+ /**
168
+ * Embed a molecule from pairwise distances using Semidefinite Relaxation.
169
+ * @param distance_pairs_json JSON `[[i, j, d_ij], ...]`
170
+ * @param n_atoms Total atom count
171
+ * @param config_json JSON `SdrConfig` or `"{}"`
172
+ * @returns JSON `{ coords, residual, converged, iterations }`
173
+ */
174
+ export declare function alpha_sdr_embed(
175
+ distance_pairs_json: string,
176
+ n_atoms: number,
177
+ config_json?: string
178
+ ): string;
179
+
180
+ // ── A8: Live MD ───────────────────────────────────────────────────────────
181
+
182
+ /** Live interactive molecular dynamics simulation handle. */
183
+ export declare class LiveSimulation {
184
+ constructor(smiles: string, coords_flat: string, backend: string);
185
+ step(n_steps: number, dt_fs: number): void;
186
+ apply_thermostat(target_temp: number, coupling: number): void;
187
+ apply_steering_force(atom_index: number, target: [number, number, number], k: number): void;
188
+ clear_steering(): void;
189
+ positions_json(): string;
190
+ positions_ptr(): number;
191
+ temperature(): number;
192
+ potential_energy(): number;
193
+ kinetic_energy(): number;
194
+ step_count(): number;
195
+ set_temperature(temp: number): void;
196
+ }
197
+
198
+ // ── Metadata ─────────────────────────────────────────────────────────────
199
+
200
+ /**
201
+ * Return available alpha module list and stability info.
202
+ * @returns JSON `{ alpha_modules: string[], stability: string, version: string }`
203
+ */
204
+ export declare function alpha_modules_info(): string;
package/alpha/index.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * sci-form-wasm/alpha — Alpha-tier experimental modules.
3
+ *
4
+ * Early-stage research implementations. APIs subject to breaking changes.
5
+ *
6
+ * Usage:
7
+ * ```js
8
+ * import init from 'sci-form-wasm';
9
+ * import {
10
+ * alpha_compute_dft,
11
+ * alpha_compute_reaxff_gradient,
12
+ * alpha_compute_reaxff_energy,
13
+ * alpha_compute_eem_charges,
14
+ * alpha_compute_mlff,
15
+ * alpha_compute_aevs,
16
+ * alpha_boys_function,
17
+ * alpha_eri_ssss,
18
+ * alpha_schwarz_bound,
19
+ * alpha_rotate_dihedral_cga,
20
+ * alpha_refine_torsion_cga,
21
+ * alpha_gsm_interpolate,
22
+ * alpha_gsm_find_ts,
23
+ * alpha_sdr_embed,
24
+ * alpha_modules_info,
25
+ * LiveSimulation,
26
+ * } from 'sci-form-wasm/alpha';
27
+ *
28
+ * await init();
29
+ * const result = JSON.parse(alpha_compute_dft(elements, coords, 'pbe'));
30
+ * ```
31
+ *
32
+ * Note: `init()` must be called once from the main `sci-form-wasm` entry point
33
+ * before using any alpha functions.
34
+ */
35
+
36
+ export {
37
+ // ── A1: Kohn-Sham DFT ─────────────────────────────────────────────────────
38
+ alpha_compute_dft,
39
+
40
+ // ── A2: ReaxFF ────────────────────────────────────────────────────────────
41
+ alpha_compute_reaxff_gradient,
42
+ alpha_compute_reaxff_energy,
43
+ alpha_compute_eem_charges,
44
+
45
+ // ── A3: MLFF Neural Network Force Field ───────────────────────────────────
46
+ alpha_compute_mlff,
47
+ alpha_compute_aevs,
48
+
49
+ // ── A4: Obara-Saika ERIs ──────────────────────────────────────────────────
50
+ alpha_boys_function,
51
+ alpha_eri_ssss,
52
+ alpha_schwarz_bound,
53
+
54
+ // ── A5: CGA Motor Algebra ─────────────────────────────────────────────────
55
+ alpha_rotate_dihedral_cga,
56
+ alpha_refine_torsion_cga,
57
+
58
+ // ── A6: Growing String Method ─────────────────────────────────────────────
59
+ alpha_gsm_interpolate,
60
+ alpha_gsm_find_ts,
61
+
62
+ // ── A7: SDR Embedding ─────────────────────────────────────────────────────
63
+ alpha_sdr_embed,
64
+
65
+ // ── A8: Live MD (also available via main entry) ───────────────────────────
66
+ LiveSimulation,
67
+
68
+ // ── Metadata ──────────────────────────────────────────────────────────────
69
+ alpha_modules_info,
70
+ } from '../sci_form_wasm.js';
@@ -0,0 +1,119 @@
1
+ /**
2
+ * sci-form-wasm/beta — TypeScript declarations.
3
+ *
4
+ * All functions accept/return JSON strings.
5
+ * Call `await init()` from the main `sci-form-wasm` package once before use.
6
+ */
7
+
8
+ // ── B1: KPM ──────────────────────────────────────────────────────────────
9
+
10
+ /**
11
+ * Compute EHT Density of States using Kernel Polynomial Method (O(N)).
12
+ *
13
+ * KPM scales linearly with system size vs. O(N³) exact diagonalization.
14
+ *
15
+ * @param elements_json JSON array of atomic numbers
16
+ * @param coords_flat_json JSON flat coords [x0,y0,z0,...]
17
+ * @param config_json Optional JSON config:
18
+ * `{ order?: number, n_points?: number, e_min?: number, e_max?: number, temperature?: number }`
19
+ * @returns JSON:
20
+ * `{ energies: number[], total_dos: number[], e_min, e_max, order }`
21
+ */
22
+ export declare function beta_compute_kpm_dos(
23
+ elements_json: string,
24
+ coords_flat_json: string,
25
+ config_json?: string
26
+ ): string;
27
+
28
+ /**
29
+ * Compute Mulliken populations using KPM stochastic trace (O(N)).
30
+ * @returns JSON `{ mulliken_charges: number[], orbital_populations: number[] }`
31
+ */
32
+ export declare function beta_compute_kpm_mulliken(
33
+ elements_json: string,
34
+ coords_flat_json: string
35
+ ): string;
36
+
37
+ // ── B2: MBH ──────────────────────────────────────────────────────────────
38
+
39
+ /**
40
+ * Compute vibrational frequencies using Mobile Block Hessian.
41
+ *
42
+ * Reduces degrees of freedom by treating rigid groups as blocks,
43
+ * giving speedup = n_dof_full / n_dof_reduced.
44
+ *
45
+ * @param smiles SMILES string for ring detection and UFF topology
46
+ * @returns JSON:
47
+ * `{ frequencies: number[], n_blocks, n_flexible,
48
+ * n_dof_reduced, n_dof_full, speedup }`
49
+ */
50
+ export declare function beta_compute_mbh_frequencies(
51
+ elements_json: string,
52
+ coords_flat_json: string,
53
+ smiles: string
54
+ ): string;
55
+
56
+ // ── B3: RandNLA ───────────────────────────────────────────────────────────
57
+
58
+ /**
59
+ * Solve the EHT generalized eigenvalue problem using randomized Nyström.
60
+ *
61
+ * Scales as O(N k²) instead of O(N³), where k ≈ √N by default.
62
+ *
63
+ * @param config_json Optional JSON:
64
+ * `{ sketch_size?: number, seed?: number, max_error?: number, fallback_enabled?: boolean }`
65
+ * @returns JSON:
66
+ * `{ orbital_energies, homo_index, homo_energy, lumo_energy, gap,
67
+ * k, residual_error, used_fallback }`
68
+ */
69
+ export declare function beta_solve_eht_randnla(
70
+ elements_json: string,
71
+ coords_flat_json: string,
72
+ config_json?: string
73
+ ): string;
74
+
75
+ // ── B4: Riemannian ────────────────────────────────────────────────────────
76
+
77
+ /**
78
+ * Compute Riemannian distance between two PSD matrices on the manifold.
79
+ * @param matrix_a_json / matrix_b_json JSON flat row-major arrays
80
+ * @param dim Matrix dimension (matrices are dim×dim)
81
+ * @returns JSON `{ distance: number }`
82
+ */
83
+ export declare function beta_psd_distance(
84
+ matrix_a_json: string,
85
+ matrix_b_json: string,
86
+ dim: number
87
+ ): string;
88
+
89
+ /**
90
+ * Project a symmetric matrix onto the PSD cone (zero negative eigenvalues).
91
+ * @param matrix_json JSON flat row-major array
92
+ * @param dim Matrix dimension
93
+ * @returns JSON `{ matrix: number[], was_psd: boolean }`
94
+ */
95
+ export declare function beta_psd_projection(
96
+ matrix_json: string,
97
+ dim: number
98
+ ): string;
99
+
100
+ // ── B5: CPM ───────────────────────────────────────────────────────────────
101
+
102
+ /**
103
+ * Compute constant-potential electrochemical charges.
104
+ * @param potential Target electrode potential in eV
105
+ * @returns JSON `{ charges: number[], total_charge: number, energy: number }`
106
+ */
107
+ export declare function beta_compute_cpm_charges(
108
+ elements_json: string,
109
+ coords_flat_json: string,
110
+ potential: number
111
+ ): string;
112
+
113
+ // ── Metadata ─────────────────────────────────────────────────────────────
114
+
115
+ /**
116
+ * Return available beta module list and stability info.
117
+ * @returns JSON `{ beta_modules: string[], stability: string, version: string }`
118
+ */
119
+ export declare function beta_modules_info(): string;
package/beta/index.js ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * sci-form-wasm/beta — Beta-tier experimental modules.
3
+ *
4
+ * Validated methods approaching stable release. APIs are relatively stable
5
+ * but may have minor changes before promotion to core.
6
+ *
7
+ * Usage:
8
+ * ```js
9
+ * import init from 'sci-form-wasm';
10
+ * import {
11
+ * beta_compute_kpm_dos,
12
+ * beta_compute_kpm_mulliken,
13
+ * beta_compute_mbh_frequencies,
14
+ * beta_solve_eht_randnla,
15
+ * beta_psd_distance,
16
+ * beta_psd_projection,
17
+ * beta_compute_cpm_charges,
18
+ * beta_modules_info,
19
+ * } from 'sci-form-wasm/beta';
20
+ *
21
+ * await init();
22
+ * const dos = JSON.parse(beta_compute_kpm_dos(elements, coords, '{}'));
23
+ * ```
24
+ */
25
+
26
+ export {
27
+ // ── B1: KPM — Kernel Polynomial Method ────────────────────────────────────
28
+ beta_compute_kpm_dos,
29
+ beta_compute_kpm_mulliken,
30
+
31
+ // ── B2: MBH — Mobile Block Hessian ─────────────────────────────────────────
32
+ beta_compute_mbh_frequencies,
33
+
34
+ // ── B3: RandNLA — Randomized EHT Eigensolver ──────────────────────────────
35
+ beta_solve_eht_randnla,
36
+
37
+ // ── B4: Riemannian Geometry ────────────────────────────────────────────────
38
+ beta_psd_distance,
39
+ beta_psd_projection,
40
+
41
+ // ── B5: CPM — Constant Potential Method ───────────────────────────────────
42
+ beta_compute_cpm_charges,
43
+
44
+ // ── Metadata ──────────────────────────────────────────────────────────────
45
+ beta_modules_info,
46
+ } from '../sci_form_wasm.js';
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.10.6",
5
+ "version": "0.12.3",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -13,12 +13,28 @@
13
13
  "sci_form_wasm.js",
14
14
  "sci_form_wasm.d.ts",
15
15
  "snippets",
16
- "README.md"
16
+ "README.md",
17
+ "alpha",
18
+ "beta"
17
19
  ],
18
20
  "main": "sci_form_wasm.js",
19
21
  "types": "sci_form_wasm.d.ts",
20
22
  "sideEffects": [
21
23
  "./snippets/*"
22
24
  ],
23
- "readme": "README.md"
25
+ "readme": "README.md",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./sci_form_wasm.d.ts",
29
+ "default": "./sci_form_wasm.js"
30
+ },
31
+ "./alpha": {
32
+ "types": "./alpha/index.d.ts",
33
+ "default": "./alpha/index.js"
34
+ },
35
+ "./beta": {
36
+ "types": "./beta/index.d.ts",
37
+ "default": "./beta/index.js"
38
+ }
39
+ }
24
40
  }