sci-form-wasm 0.4.2 → 0.5.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/README.md +376 -0
- package/package.json +7 -4
- package/sci_form_wasm.d.ts +139 -0
- package/sci_form_wasm.js +529 -0
- package/sci_form_wasm_bg.wasm +0 -0
- package/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
# sci-form
|
|
2
|
+
|
|
3
|
+
**High-performance 3D molecular conformer generation and quantum-chemistry-inspired property computation**, written in pure Rust.
|
|
4
|
+
|
|
5
|
+
Generates chemically valid 3D coordinates from SMILES strings with RDKit-quality accuracy (ETKDGv2), and provides a full suite of computational chemistry tools: Extended Hückel Theory, electrostatic potentials, density of states, population analysis, molecular alignment, force field energy evaluation (UFF + MMFF94), partial charges, SASA, and materials framework assembly.
|
|
6
|
+
|
|
7
|
+
Native bindings for **Rust**, **Python**, **TypeScript/JavaScript (WASM)**, and a **cross-platform CLI**.
|
|
8
|
+
|
|
9
|
+
[](https://crates.io/crates/sci-form)
|
|
10
|
+
[](https://pypi.org/project/sciforma)
|
|
11
|
+
[](https://www.npmjs.com/package/sci-form-wasm)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
### Conformer Generation
|
|
17
|
+
- **ETKDGv2 Distance Geometry** — CSD torsion preferences (846 SMARTS patterns), matches RDKit accuracy
|
|
18
|
+
- **High Accuracy** — 0.00% heavy-atom RMSD > 0.5 Å vs RDKit on GDB-20 (2000 molecules, ensemble comparison)
|
|
19
|
+
- **Fast** — 60+ molecules/second in Rust, parallel batch processing via rayon
|
|
20
|
+
- **Full chemical coverage** — organics, stereocenters, macrocycles, fused rings, metals, halogens (He→Bi)
|
|
21
|
+
|
|
22
|
+
### Quantum Chemistry (EHT)
|
|
23
|
+
- **Extended Hückel Theory** — Wolfsberg-Helmholtz Hamiltonian, Löwdin orthogonalization, HOMO/LUMO gaps
|
|
24
|
+
- **Mulliken & Löwdin population analysis** — atomic orbital contributions per atom
|
|
25
|
+
- **Molecular dipole moment** — bond dipoles + lone-pair contributions in Debye
|
|
26
|
+
- **Volumetric orbital grids** — STO-3G basis, chunked evaluation for large molecules, marching cubes isosurfaces
|
|
27
|
+
- **Density of States** — total DOS + per-atom PDOS with Gaussian smearing, JSON export, MSE metric
|
|
28
|
+
|
|
29
|
+
### Electrostatics & Surface
|
|
30
|
+
- **Electrostatic Potential (ESP)** — Coulomb grid from Mulliken charges, color mapping (red/white/blue), `.cube` export
|
|
31
|
+
- **Parallel ESP** — rayon-accelerated grid computation (`parallel` feature)
|
|
32
|
+
- **Solvent-Accessible Surface Area (SASA)** — Shrake-Rupley algorithm, Fibonacci sphere, Bondi radii, parallelized per-atom evaluation
|
|
33
|
+
- **Gasteiger-Marsili partial charges** — 6-iteration electronegativity equalization
|
|
34
|
+
|
|
35
|
+
### Parallel Computation
|
|
36
|
+
- **Automatic rayon thread pool** — all compute functions (DOS, ESP SASA, population, dipole, etc.) parallelized with work-stealing queue
|
|
37
|
+
- **Zero-configuration** — no API changes needed; parallelization enabled by default via `parallel` feature
|
|
38
|
+
- **Intra-library parallelism** — grid point loops, per-atom evaluation, force field term accumulation all use `par_iter()`
|
|
39
|
+
- **CPU-aware workload balancing** — handles small molecules (sequential) and large molecules (parallel) automatically
|
|
40
|
+
|
|
41
|
+
### Force Fields
|
|
42
|
+
- **UFF** — Universal Force Field for 50+ element types (including transition metals Ti–Zn, Pd, Pt, Au)
|
|
43
|
+
- **MMFF94** — Merck force field (stretch, bend, torsion, van der Waals, electrostatics via 14-7 potential)
|
|
44
|
+
- **BFGS / L-BFGS minimizers** — dense BFGS for small molecules, L-BFGS for large systems
|
|
45
|
+
|
|
46
|
+
### Molecular Alignment
|
|
47
|
+
- **Kabsch alignment** — SVD-based optimal rotation, minimizes RMSD
|
|
48
|
+
- **Quaternion alignment** — Coutsias 2004 4×4 eigenproblem (faster for large molecules)
|
|
49
|
+
- **RMSD computation** — after optimal superposition
|
|
50
|
+
|
|
51
|
+
### Materials
|
|
52
|
+
- **Periodic unit cells** — lattice parameters (a, b, c, α, β, γ) to Cartesian tensor
|
|
53
|
+
- **Secondary Building Units (SBUs)** — node/linker topology with coordination sites
|
|
54
|
+
- **Framework assembly** — MOF-type crystal structure generation from SBUs + topology
|
|
55
|
+
|
|
56
|
+
### Platform
|
|
57
|
+
- **Multi-platform** — Rust lib, Python (PyO3), TypeScript/JS (WASM), CLI (Linux/macOS/Windows)
|
|
58
|
+
- **Zero runtime dependencies** — pure Rust, no C++ toolchain needed
|
|
59
|
+
- **SMILES + SMARTS** — full parser and substructure matcher; 60+ bracket elements
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
### Rust
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
[dependencies]
|
|
69
|
+
sci-form = "0.2"
|
|
70
|
+
# For parallel batch + ESP:
|
|
71
|
+
sci-form = { version = "0.2", features = ["parallel"] }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```rust
|
|
75
|
+
use sci_form::{embed, compute_charges, compute_esp, compute_dos, compute_population};
|
|
76
|
+
|
|
77
|
+
// 3D conformer
|
|
78
|
+
let result = sci_form::embed("CCO", 42);
|
|
79
|
+
println!("Atoms: {}, Time: {:.1}ms", result.num_atoms, result.time_ms);
|
|
80
|
+
|
|
81
|
+
// Gasteiger–Marsili charges
|
|
82
|
+
let charges = sci_form::compute_charges("CCO").unwrap();
|
|
83
|
+
println!("Charges: {:?}", charges.charges);
|
|
84
|
+
|
|
85
|
+
// EHT → population analysis
|
|
86
|
+
let mol = sci_form::parse("CCO").unwrap();
|
|
87
|
+
let elements: Vec<u8> = /* ... */ vec![8, 6, 6, 1, 1, 1, 1, 1, 1];
|
|
88
|
+
let positions: Vec<[f64; 3]> = /* ... from result.coords */ vec![];
|
|
89
|
+
let pop = sci_form::compute_population(&elements, &positions).unwrap();
|
|
90
|
+
println!("HOMO: {:.3} eV", pop.homo_energy);
|
|
91
|
+
|
|
92
|
+
// ESP grid
|
|
93
|
+
let esp = sci_form::compute_esp(&elements, &positions, 0.5, 3.0).unwrap();
|
|
94
|
+
|
|
95
|
+
// DOS / PDOS
|
|
96
|
+
let dos = sci_form::compute_dos(&elements, &positions, 0.2, -20.0, 5.0, 200).unwrap();
|
|
97
|
+
println!("HOMO–LUMO gap: {:.3} eV", dos.homo_lumo_gap.unwrap_or(0.0));
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
→ [Full Rust API reference](https://jigonzalez930209.github.io/sci-form/api/rust) · [Guide](https://jigonzalez930209.github.io/sci-form/guide/rust)
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Python
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install sciforma
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import sci_form
|
|
112
|
+
|
|
113
|
+
# 3D conformer
|
|
114
|
+
result = sci_form.embed("CCO")
|
|
115
|
+
print(f"Atoms: {result.num_atoms}, Time: {result.time_ms:.1f}ms")
|
|
116
|
+
|
|
117
|
+
# Batch
|
|
118
|
+
results = sci_form.embed_batch(["CCO", "c1ccccc1", "CC(=O)O"])
|
|
119
|
+
|
|
120
|
+
# Gasteiger charges
|
|
121
|
+
charges = sci_form.compute_charges("CCO")
|
|
122
|
+
print(charges["charges"]) # per-atom charges
|
|
123
|
+
|
|
124
|
+
# EHT + population analysis
|
|
125
|
+
elements = [8, 6, 6, 1, 1, 1, 1, 1, 1]
|
|
126
|
+
positions = [[0.0, 0.0, 0.0], ...] # from result.coords
|
|
127
|
+
pop = sci_form.compute_population(elements, positions)
|
|
128
|
+
print(f"HOMO: {pop['homo_energy']:.3f} eV")
|
|
129
|
+
|
|
130
|
+
# DOS / PDOS
|
|
131
|
+
dos = sci_form.compute_dos(elements, positions, sigma=0.2, e_min=-20.0, e_max=5.0, n_points=200)
|
|
132
|
+
print(f"Gap: {dos['homo_lumo_gap']:.3f} eV")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
→ [Full Python API reference](https://jigonzalez930209.github.io/sci-form/api/python) · [Guide](https://jigonzalez930209.github.io/sci-form/guide/python)
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### TypeScript / JavaScript (WASM)
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm install sci-form-wasm
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import init, {
|
|
147
|
+
embed, embed_coords_typed,
|
|
148
|
+
compute_esp_grid_typed, compute_esp_grid_info,
|
|
149
|
+
eht_calculate, eht_orbital_mesh, eht_orbital_grid_typed,
|
|
150
|
+
compute_charges, compute_dos
|
|
151
|
+
} from 'sci-form-wasm';
|
|
152
|
+
|
|
153
|
+
await init();
|
|
154
|
+
|
|
155
|
+
// Conformer as JSON
|
|
156
|
+
const result = JSON.parse(embed('CCO', 42));
|
|
157
|
+
console.log(result.num_atoms);
|
|
158
|
+
|
|
159
|
+
// Typed-array conformer (faster, no JSON overhead)
|
|
160
|
+
const coords: Float64Array = embed_coords_typed('CCO', 42);
|
|
161
|
+
|
|
162
|
+
// EHT calculation
|
|
163
|
+
const eht = JSON.parse(eht_calculate('[6,8,6,1,1,1,1,1,1]', coords.toString(), 1.75));
|
|
164
|
+
console.log(`HOMO: ${eht.homo_energy} eV, LUMO: ${eht.lumo_energy} eV`);
|
|
165
|
+
|
|
166
|
+
// Orbital isosurface mesh
|
|
167
|
+
const mesh = JSON.parse(eht_orbital_mesh('[6,8,6,1,1,1,1,1,1]', coords.toString(), 1.75, 0, 0.02));
|
|
168
|
+
// mesh.vertices, mesh.normals, mesh.indices
|
|
169
|
+
|
|
170
|
+
// ESP grid (typed array)
|
|
171
|
+
const espData: Float64Array = compute_esp_grid_typed('CCO', 42, 0.5, 3.0);
|
|
172
|
+
const espInfo = JSON.parse(compute_esp_grid_info('CCO', 42, 0.5, 3.0));
|
|
173
|
+
console.log(`Grid: ${espInfo.nx}×${espInfo.ny}×${espInfo.nz}`);
|
|
174
|
+
|
|
175
|
+
// DOS
|
|
176
|
+
const dos = JSON.parse(compute_dos('[6,8,6,1,1,1,1,1,1]', coords.toString(), 0.2, -20.0, 5.0, 200));
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
→ [Full TypeScript API reference](https://jigonzalez930209.github.io/sci-form/api/typescript) · [Guide](https://jigonzalez930209.github.io/sci-form/guide/typescript)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### CLI
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cargo install sci-form-cli
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Single molecule
|
|
191
|
+
sci-form embed "CCO" --format xyz
|
|
192
|
+
|
|
193
|
+
# Batch processing
|
|
194
|
+
sci-form batch -i molecules.smi -o output.sdf --format sdf --threads 8
|
|
195
|
+
|
|
196
|
+
# Parse only (no 3D)
|
|
197
|
+
sci-form parse "c1ccccc1"
|
|
198
|
+
|
|
199
|
+
# Gasteiger charges
|
|
200
|
+
sci-form charges "CCO"
|
|
201
|
+
|
|
202
|
+
# UFF energy
|
|
203
|
+
sci-form energy "CCO" --coords coords.json
|
|
204
|
+
|
|
205
|
+
# Version / features
|
|
206
|
+
sci-form info
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Prebuilt binaries available at [GitHub Releases](https://github.com/jigonzalez930209/sci-form/releases):
|
|
210
|
+
|
|
211
|
+
| Platform | File |
|
|
212
|
+
|----------|------|
|
|
213
|
+
| Linux x86_64 | `sci-form-linux-x86_64` |
|
|
214
|
+
| Linux aarch64 | `sci-form-linux-aarch64` |
|
|
215
|
+
| macOS x86_64 | `sci-form-macos-x86_64` |
|
|
216
|
+
| macOS Apple Silicon | `sci-form-macos-aarch64` |
|
|
217
|
+
| Windows x86_64 | `sci-form-windows-x86_64.exe` |
|
|
218
|
+
|
|
219
|
+
→ [Full CLI reference](https://jigonzalez930209.github.io/sci-form/api/cli) · [Guide](https://jigonzalez930209.github.io/sci-form/guide/cli)
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Benchmark Results
|
|
224
|
+
|
|
225
|
+
### Conformer Generation — Diverse Molecules (131 molecules, all functional groups)
|
|
226
|
+
|
|
227
|
+
| Metric | Value |
|
|
228
|
+
|--------|-------|
|
|
229
|
+
| Parse success | 100% |
|
|
230
|
+
| Embed success | 97.7% |
|
|
231
|
+
| Geometry quality | 97.7% |
|
|
232
|
+
| Throughput | 60 mol/s |
|
|
233
|
+
|
|
234
|
+
### RDKit Comparison — Heavy-atom pairwise-distance RMSD
|
|
235
|
+
|
|
236
|
+
| Metric | Value |
|
|
237
|
+
|--------|-------|
|
|
238
|
+
| Average RMSD | 0.064 Å |
|
|
239
|
+
| Median RMSD | 0.011 Å |
|
|
240
|
+
| < 0.5 Å | 98.4% |
|
|
241
|
+
| < 0.3 Å | 94.4% |
|
|
242
|
+
|
|
243
|
+
### GDB-20 Ensemble (2000 molecules × 10 seeds vs 21 RDKit seeds)
|
|
244
|
+
|
|
245
|
+
| Metric | All-atom | Heavy-atom |
|
|
246
|
+
|--------|----------|------------|
|
|
247
|
+
| Avg RMSD | 0.035 Å | 0.018 Å |
|
|
248
|
+
| > 0.5 Å | 0.95% | **0.00%** |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Module Overview
|
|
253
|
+
|
|
254
|
+
| Module | Description |
|
|
255
|
+
|--------|-------------|
|
|
256
|
+
| `sci_form::embed` | ETKDGv2 3D conformer generation from SMILES |
|
|
257
|
+
| `sci_form::embed_batch` | Parallel batch conformer generation (rayon) |
|
|
258
|
+
| `sci_form::parse` | SMILES → molecular graph |
|
|
259
|
+
| `sci_form::compute_charges` | Gasteiger-Marsili partial charges |
|
|
260
|
+
| `sci_form::compute_sasa` | Solvent-accessible surface area (SASA) |
|
|
261
|
+
| `sci_form::compute_population` | Mulliken & Löwdin population analysis (EHT) |
|
|
262
|
+
| `sci_form::compute_dipole` | Molecular dipole moment in Debye (EHT) |
|
|
263
|
+
| `sci_form::compute_esp` | Electrostatic potential grid (Mulliken charges) |
|
|
264
|
+
| `sci_form::compute_dos` | Density of states + PDOS (EHT orbital energies) |
|
|
265
|
+
| `sci_form::compute_rmsd` | RMSD after Kabsch alignment |
|
|
266
|
+
| `sci_form::compute_uff_energy` | UFF force field energy evaluation |
|
|
267
|
+
| `sci_form::create_unit_cell` | Periodic unit cell from lattice parameters |
|
|
268
|
+
| `sci_form::assemble_framework` | MOF-type framework assembly from SBUs |
|
|
269
|
+
|
|
270
|
+
### Sub-modules
|
|
271
|
+
|
|
272
|
+
| Module Path | Key API |
|
|
273
|
+
|-------------|---------|
|
|
274
|
+
| `sci_form::eht` | `solve_eht()`, `EhtResult`, `evaluate_orbital_on_grid_chunked()`, `marching_cubes()` |
|
|
275
|
+
| `sci_form::esp` | `compute_esp_grid_parallel()`, `esp_color_map()`, `esp_grid_to_colors()`, `export_cube()`, `read_cube()` |
|
|
276
|
+
| `sci_form::dos` | `compute_dos()`, `compute_pdos()`, `dos_mse()`, `export_dos_json()` |
|
|
277
|
+
| `sci_form::alignment` | `align_coordinates()`, `align_quaternion()`, `compute_rmsd()` |
|
|
278
|
+
| `sci_form::forcefield` | `build_uff_force_field()`, `Mmff94Builder::build()` |
|
|
279
|
+
| `sci_form::charges::gasteiger` | `gasteiger_marsili_charges()` |
|
|
280
|
+
| `sci_form::surface::sasa` | `compute_sasa()` |
|
|
281
|
+
| `sci_form::materials` | `UnitCell`, `Sbu`, `Topology`, `assemble_framework()` |
|
|
282
|
+
| `sci_form::transport` | `pack_batch_arrow()`, `ChunkedIterator`, `WorkerTask` |
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## The Conformer Pipeline
|
|
287
|
+
|
|
288
|
+
sci-form implements ETKDGv2 (Experimental Torsion Knowledge Distance Geometry):
|
|
289
|
+
|
|
290
|
+
1. **SMILES Parsing** → Molecular graph with atoms, bonds, hybridization
|
|
291
|
+
2. **Bounds Matrix** → 1-2, 1-3, 1-4, and VdW distance bounds from topology
|
|
292
|
+
3. **Triangle Smoothing** → Floyd-Warshall triangle inequality enforcement
|
|
293
|
+
4. **Distance Picking** → Random distances from smoothed bounds (MinstdRand)
|
|
294
|
+
5. **Metric Matrix Embedding** → Eigendecomposition → 4D coordinates
|
|
295
|
+
6. **Bounds Force Field** → BFGS minimization in 4D to satisfy distance constraints
|
|
296
|
+
7. **Projection to 3D** → Drop lowest-variance dimension
|
|
297
|
+
8. **ETKDG 3D Refinement** → Force field with CSD torsion preferences (846 patterns)
|
|
298
|
+
9. **Validation** → Tetrahedral centers, planarity, double-bond geometry
|
|
299
|
+
|
|
300
|
+
See the [algorithm documentation](https://jigonzalez930209.github.io/sci-form/algorithm/overview) for mathematical derivations and diagrams.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Building from Source
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Library + CLI
|
|
308
|
+
cargo build --release
|
|
309
|
+
|
|
310
|
+
# Python bindings
|
|
311
|
+
cd crates/python && pip install maturin && maturin develop --release
|
|
312
|
+
|
|
313
|
+
# WASM bindings
|
|
314
|
+
cd crates/wasm && wasm-pack build --target web --release
|
|
315
|
+
|
|
316
|
+
# With parallel feature
|
|
317
|
+
cargo build --release --features parallel
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Testing
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# All unit tests
|
|
326
|
+
cargo test --lib
|
|
327
|
+
|
|
328
|
+
# Integration — diverse molecules (97.7% pass rate)
|
|
329
|
+
cargo test --release --test test_diverse_molecules -- --nocapture
|
|
330
|
+
|
|
331
|
+
# Integration — gradient correctness
|
|
332
|
+
cargo test --release --test test_gradient_check -- --nocapture
|
|
333
|
+
|
|
334
|
+
# Lint & format
|
|
335
|
+
cargo fmt --all -- --check
|
|
336
|
+
cargo clippy --all-targets -- -D warnings
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Releasing a New Version
|
|
342
|
+
|
|
343
|
+
Use the provided bump script. It updates all version strings, commits, tags, and pushes:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Auto-increment patch (0.1.7 → 0.1.8)
|
|
347
|
+
./scripts/bump_version.sh
|
|
348
|
+
|
|
349
|
+
# Set a specific version
|
|
350
|
+
./scripts/bump_version.sh 0.2.0
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
This updates versions in:
|
|
354
|
+
- `Cargo.toml` (root lib)
|
|
355
|
+
- `crates/cli/Cargo.toml`
|
|
356
|
+
- `crates/python/Cargo.toml`
|
|
357
|
+
- `crates/wasm/Cargo.toml`
|
|
358
|
+
- `crates/python/pyproject.toml`
|
|
359
|
+
- `crates/wasm/pkg/package.json`
|
|
360
|
+
- `pkg/package.json` & `pkg-node/package.json`
|
|
361
|
+
|
|
362
|
+
Then creates a `vX.Y.Z` git tag, which triggers the [release workflow](.github/workflows/release.yml) to publish to **crates.io**, **PyPI**, and **npm** automatically.
|
|
363
|
+
|
|
364
|
+
**Required repository secrets:**
|
|
365
|
+
|
|
366
|
+
| Secret | Used for |
|
|
367
|
+
|--------|----------|
|
|
368
|
+
| `CARGO_REGISTRY_TOKEN` | Publishing to crates.io |
|
|
369
|
+
| `PYPI_API_TOKEN` | Publishing to PyPI (`sciforma`) |
|
|
370
|
+
| `NPM_TOKEN` | Publishing to npm (`sci-form-wasm`) — must be a **Granular Automation token** |
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## License
|
|
375
|
+
|
|
376
|
+
MIT
|
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
|
+
"version": "0.5.1",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"sci_form_wasm_bg.wasm",
|
|
13
13
|
"sci_form_wasm.js",
|
|
14
|
-
"sci_form_wasm.d.ts"
|
|
14
|
+
"sci_form_wasm.d.ts",
|
|
15
|
+
"snippets",
|
|
16
|
+
"README.md"
|
|
15
17
|
],
|
|
16
18
|
"main": "sci_form_wasm.js",
|
|
17
19
|
"types": "sci_form_wasm.d.ts",
|
|
18
20
|
"sideEffects": [
|
|
19
21
|
"./snippets/*"
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
+
],
|
|
23
|
+
"readme": "README.md"
|
|
24
|
+
}
|
package/sci_form_wasm.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Analyze aromaticity and graph-level stereocenters from a SMILES string.
|
|
6
|
+
*/
|
|
7
|
+
export function analyze_graph_features(smiles: string): string;
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
* Assemble a framework crystal structure.
|
|
6
11
|
*
|
|
@@ -12,6 +17,16 @@
|
|
|
12
17
|
*/
|
|
13
18
|
export function assemble_framework(topology: string, metal: number, geometry: string, lattice_a: number, supercell: number): string;
|
|
14
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Compare available methods on the same system/geometry.
|
|
22
|
+
*/
|
|
23
|
+
export function compare_methods(smiles: string, elements: string, coords_flat: string, allow_experimental_eht: boolean): string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Compute Wiberg-like and Mayer-like bond orders.
|
|
27
|
+
*/
|
|
28
|
+
export function compute_bond_orders(elements: string, coords_flat: string): string;
|
|
29
|
+
|
|
15
30
|
/**
|
|
16
31
|
* Compute Gasteiger-Marsili partial charges from a SMILES string.
|
|
17
32
|
*
|
|
@@ -29,6 +44,11 @@ export function compute_dipole(elements: string, coords_flat: string): string;
|
|
|
29
44
|
*/
|
|
30
45
|
export function compute_dos(elements: string, coords_flat: string, sigma: number, e_min: number, e_max: number, n_points: number): string;
|
|
31
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Estimate acidic/basic pKa sites from graph and charge heuristics.
|
|
49
|
+
*/
|
|
50
|
+
export function compute_empirical_pka(smiles: string): string;
|
|
51
|
+
|
|
32
52
|
/**
|
|
33
53
|
* Get ESP grid metadata (origin, spacing, dimensions) as JSON.
|
|
34
54
|
*/
|
|
@@ -41,12 +61,66 @@ export function compute_esp_grid_info(elements: string, coords_flat: string, spa
|
|
|
41
61
|
*/
|
|
42
62
|
export function compute_esp_grid_typed(elements: string, coords_flat: string, spacing: number, padding: number): Float64Array;
|
|
43
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Compute atom-resolved HOMO/LUMO frontier descriptors.
|
|
66
|
+
*/
|
|
67
|
+
export function compute_frontier_descriptors(elements: string, coords_flat: string): string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Compute Fukui-function workflows and condensed per-atom descriptors.
|
|
71
|
+
*/
|
|
72
|
+
export function compute_fukui_descriptors(elements: string, coords_flat: string): string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Predict molecular properties using ML proxy models.
|
|
76
|
+
*
|
|
77
|
+
* `smiles`: SMILES string.
|
|
78
|
+
*
|
|
79
|
+
* Returns: JSON with logp, molar_refractivity, log_solubility,
|
|
80
|
+
* lipinski_violations, lipinski_passes, druglikeness.
|
|
81
|
+
*/
|
|
82
|
+
export function compute_ml_properties(smiles: string): string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Compute MMFF94 force field energy.
|
|
86
|
+
*
|
|
87
|
+
* `smiles`: SMILES string for bond topology.
|
|
88
|
+
* `coords`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
89
|
+
*
|
|
90
|
+
* Returns: JSON `{"energy": <kcal/mol>}`
|
|
91
|
+
*/
|
|
92
|
+
export function compute_mmff94_energy(smiles: string, coords: string): string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Compute molecular descriptors from a SMILES string.
|
|
96
|
+
*
|
|
97
|
+
* Returns: JSON with molecular_weight, n_heavy_atoms, n_hbd, n_hba, fsp3,
|
|
98
|
+
* n_rotatable_bonds, n_rings, n_aromatic, wiener_index, etc.
|
|
99
|
+
*/
|
|
100
|
+
export function compute_molecular_descriptors(smiles: string): string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Run a PM3 semi-empirical calculation.
|
|
104
|
+
*
|
|
105
|
+
* `elements_json`: JSON array of atomic numbers, e.g. `"[6,1,1,1,1]"`.
|
|
106
|
+
* `coords_flat_json`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
107
|
+
*
|
|
108
|
+
* Returns: JSON Pm3Result with orbital_energies, total_energy, heat_of_formation,
|
|
109
|
+
* homo_energy, lumo_energy, gap, mulliken_charges, converged.
|
|
110
|
+
*/
|
|
111
|
+
export function compute_pm3(elements_json: string, coords_flat_json: string): string;
|
|
112
|
+
|
|
44
113
|
/**
|
|
45
114
|
* Compute Mulliken & Löwdin population analysis.
|
|
46
115
|
* Elements: JSON array of atomic numbers. Coords: JSON array of flat xyz.
|
|
47
116
|
*/
|
|
48
117
|
export function compute_population(elements: string, coords_flat: string): string;
|
|
49
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Build empirical local-reactivity rankings from Fukui descriptors and Mulliken charges.
|
|
121
|
+
*/
|
|
122
|
+
export function compute_reactivity_ranking(elements: string, coords_flat: string): string;
|
|
123
|
+
|
|
50
124
|
/**
|
|
51
125
|
* Compute RMSD between two coordinate sets after Kabsch alignment.
|
|
52
126
|
*/
|
|
@@ -63,11 +137,37 @@ export function compute_rmsd(coords: string, reference: string): string;
|
|
|
63
137
|
*/
|
|
64
138
|
export function compute_sasa(elements: string, coords_flat: string, probe_radius: number): string;
|
|
65
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Detect metal coordination geometry and return structured topology outputs.
|
|
142
|
+
*/
|
|
143
|
+
export function compute_topology(elements: string, coords_flat: string): string;
|
|
144
|
+
|
|
66
145
|
/**
|
|
67
146
|
* Compute UFF force field energy.
|
|
68
147
|
*/
|
|
69
148
|
export function compute_uff_energy(smiles: string, coords: string): string;
|
|
70
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Compute UFF energy with aromaticity-informed heuristic correction metadata.
|
|
152
|
+
*/
|
|
153
|
+
export function compute_uff_energy_with_aromatic_heuristics(smiles: string, coords: string): string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Build an exploratory UV-Vis-like spectrum from low-cost EHT transitions.
|
|
157
|
+
*/
|
|
158
|
+
export function compute_uv_vis_spectrum(elements: string, coords_flat: string, sigma: number, e_min: number, e_max: number, n_points: number): string;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Run an xTB tight-binding calculation.
|
|
162
|
+
*
|
|
163
|
+
* `elements_json`: JSON array of atomic numbers, e.g. `"[26,6,6]"`.
|
|
164
|
+
* `coords_flat_json`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
165
|
+
*
|
|
166
|
+
* Returns: JSON XtbResult with orbital_energies, total_energy, gap,
|
|
167
|
+
* homo_energy, lumo_energy, mulliken_charges, converged.
|
|
168
|
+
*/
|
|
169
|
+
export function compute_xtb(elements_json: string, coords_flat_json: string): string;
|
|
170
|
+
|
|
71
171
|
/**
|
|
72
172
|
* Create a unit cell and return parameters + volume as JSON.
|
|
73
173
|
*/
|
|
@@ -84,6 +184,11 @@ export function create_unit_cell(a: number, b: number, c: number, alpha: number,
|
|
|
84
184
|
*/
|
|
85
185
|
export function eht_calculate(elements: string, coords_flat: string, k: number): string;
|
|
86
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Run EHT or route to UFF fallback based on support/confidence.
|
|
189
|
+
*/
|
|
190
|
+
export function eht_or_uff_fallback(smiles: string, elements: string, coords_flat: string, allow_experimental_eht: boolean): string;
|
|
191
|
+
|
|
87
192
|
/**
|
|
88
193
|
* Compute orbital grid from precomputed EHT coefficients as Float32Array.
|
|
89
194
|
*/
|
|
@@ -108,6 +213,11 @@ export function eht_orbital_grid_typed(elements: string, coords_flat: string, mo
|
|
|
108
213
|
*/
|
|
109
214
|
export function eht_orbital_mesh(elements: string, coords_flat: string, mo_index: number, spacing: number, isovalue: number): string;
|
|
110
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Query EHT support metadata from a JSON element array.
|
|
218
|
+
*/
|
|
219
|
+
export function eht_support(elements: string): string;
|
|
220
|
+
|
|
111
221
|
/**
|
|
112
222
|
* Generate a 3D conformer from a SMILES string.
|
|
113
223
|
*
|
|
@@ -164,6 +274,16 @@ export function parse_smiles(smiles: string): string;
|
|
|
164
274
|
*/
|
|
165
275
|
export function split_worker_tasks(smiles_json: string, n_workers: number, seed: number): string;
|
|
166
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Query operation capabilities from a JSON element array.
|
|
279
|
+
*/
|
|
280
|
+
export function system_capabilities(elements: string): string;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Build a structured method plan from a JSON element array.
|
|
284
|
+
*/
|
|
285
|
+
export function system_method_plan(elements: string): string;
|
|
286
|
+
|
|
167
287
|
/**
|
|
168
288
|
* Library version.
|
|
169
289
|
*/
|
|
@@ -189,24 +309,43 @@ export interface InitOutput {
|
|
|
189
309
|
readonly eht_orbital_grid_typed: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
190
310
|
readonly eht_orbital_grid_from_coefficients_typed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
191
311
|
readonly version: (a: number) => void;
|
|
312
|
+
readonly system_capabilities: (a: number, b: number, c: number) => void;
|
|
313
|
+
readonly system_method_plan: (a: number, b: number, c: number) => void;
|
|
314
|
+
readonly compare_methods: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
315
|
+
readonly eht_support: (a: number, b: number, c: number) => void;
|
|
192
316
|
readonly embed: (a: number, b: number, c: number, d: number) => void;
|
|
193
317
|
readonly embed_coords: (a: number, b: number, c: number, d: number) => void;
|
|
194
318
|
readonly embed_batch: (a: number, b: number, c: number, d: number) => void;
|
|
195
319
|
readonly parse_smiles: (a: number, b: number, c: number) => void;
|
|
196
320
|
readonly eht_calculate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
321
|
+
readonly eht_or_uff_fallback: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
197
322
|
readonly eht_orbital_mesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
198
323
|
readonly compute_charges: (a: number, b: number, c: number) => void;
|
|
199
324
|
readonly compute_sasa: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
200
325
|
readonly compute_population: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
326
|
+
readonly compute_bond_orders: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
327
|
+
readonly compute_frontier_descriptors: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
328
|
+
readonly compute_fukui_descriptors: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
329
|
+
readonly compute_reactivity_ranking: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
330
|
+
readonly compute_uv_vis_spectrum: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
331
|
+
readonly analyze_graph_features: (a: number, b: number, c: number) => void;
|
|
332
|
+
readonly compute_topology: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
201
333
|
readonly compute_dipole: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
202
334
|
readonly compute_dos: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
203
335
|
readonly compute_rmsd: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
204
336
|
readonly compute_uff_energy: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
337
|
+
readonly compute_uff_energy_with_aromatic_heuristics: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
338
|
+
readonly compute_empirical_pka: (a: number, b: number, c: number) => void;
|
|
205
339
|
readonly create_unit_cell: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
206
340
|
readonly assemble_framework: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
207
341
|
readonly pack_batch_arrow: (a: number, b: number, c: number) => void;
|
|
208
342
|
readonly split_worker_tasks: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
209
343
|
readonly estimate_workers: (a: number, b: number) => number;
|
|
344
|
+
readonly compute_mmff94_energy: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
345
|
+
readonly compute_pm3: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
346
|
+
readonly compute_xtb: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
347
|
+
readonly compute_ml_properties: (a: number, b: number, c: number) => void;
|
|
348
|
+
readonly compute_molecular_descriptors: (a: number, b: number, c: number) => void;
|
|
210
349
|
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
|
|
211
350
|
readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
|
|
212
351
|
readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
|
package/sci_form_wasm.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
/* @ts-self-types="./sci_form_wasm.d.ts" */
|
|
2
2
|
import { startWorkers } from './snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Analyze aromaticity and graph-level stereocenters from a SMILES string.
|
|
6
|
+
* @param {string} smiles
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function analyze_graph_features(smiles) {
|
|
10
|
+
let deferred2_0;
|
|
11
|
+
let deferred2_1;
|
|
12
|
+
try {
|
|
13
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
14
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
15
|
+
const len0 = WASM_VECTOR_LEN;
|
|
16
|
+
wasm.analyze_graph_features(retptr, ptr0, len0);
|
|
17
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19
|
+
deferred2_0 = r0;
|
|
20
|
+
deferred2_1 = r1;
|
|
21
|
+
return getStringFromWasm0(r0, r1);
|
|
22
|
+
} finally {
|
|
23
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
24
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
/**
|
|
5
29
|
* Assemble a framework crystal structure.
|
|
6
30
|
*
|
|
@@ -37,6 +61,64 @@ export function assemble_framework(topology, metal, geometry, lattice_a, superce
|
|
|
37
61
|
}
|
|
38
62
|
}
|
|
39
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Compare available methods on the same system/geometry.
|
|
66
|
+
* @param {string} smiles
|
|
67
|
+
* @param {string} elements
|
|
68
|
+
* @param {string} coords_flat
|
|
69
|
+
* @param {boolean} allow_experimental_eht
|
|
70
|
+
* @returns {string}
|
|
71
|
+
*/
|
|
72
|
+
export function compare_methods(smiles, elements, coords_flat, allow_experimental_eht) {
|
|
73
|
+
let deferred4_0;
|
|
74
|
+
let deferred4_1;
|
|
75
|
+
try {
|
|
76
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
77
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
78
|
+
const len0 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr1 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
80
|
+
const len1 = WASM_VECTOR_LEN;
|
|
81
|
+
const ptr2 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
82
|
+
const len2 = WASM_VECTOR_LEN;
|
|
83
|
+
wasm.compare_methods(retptr, ptr0, len0, ptr1, len1, ptr2, len2, allow_experimental_eht);
|
|
84
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
85
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
86
|
+
deferred4_0 = r0;
|
|
87
|
+
deferred4_1 = r1;
|
|
88
|
+
return getStringFromWasm0(r0, r1);
|
|
89
|
+
} finally {
|
|
90
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
91
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Compute Wiberg-like and Mayer-like bond orders.
|
|
97
|
+
* @param {string} elements
|
|
98
|
+
* @param {string} coords_flat
|
|
99
|
+
* @returns {string}
|
|
100
|
+
*/
|
|
101
|
+
export function compute_bond_orders(elements, coords_flat) {
|
|
102
|
+
let deferred3_0;
|
|
103
|
+
let deferred3_1;
|
|
104
|
+
try {
|
|
105
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
106
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
107
|
+
const len0 = WASM_VECTOR_LEN;
|
|
108
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
109
|
+
const len1 = WASM_VECTOR_LEN;
|
|
110
|
+
wasm.compute_bond_orders(retptr, ptr0, len0, ptr1, len1);
|
|
111
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
112
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
113
|
+
deferred3_0 = r0;
|
|
114
|
+
deferred3_1 = r1;
|
|
115
|
+
return getStringFromWasm0(r0, r1);
|
|
116
|
+
} finally {
|
|
117
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
118
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
40
122
|
/**
|
|
41
123
|
* Compute Gasteiger-Marsili partial charges from a SMILES string.
|
|
42
124
|
*
|
|
@@ -121,6 +203,30 @@ export function compute_dos(elements, coords_flat, sigma, e_min, e_max, n_points
|
|
|
121
203
|
}
|
|
122
204
|
}
|
|
123
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Estimate acidic/basic pKa sites from graph and charge heuristics.
|
|
208
|
+
* @param {string} smiles
|
|
209
|
+
* @returns {string}
|
|
210
|
+
*/
|
|
211
|
+
export function compute_empirical_pka(smiles) {
|
|
212
|
+
let deferred2_0;
|
|
213
|
+
let deferred2_1;
|
|
214
|
+
try {
|
|
215
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
216
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
218
|
+
wasm.compute_empirical_pka(retptr, ptr0, len0);
|
|
219
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
220
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
221
|
+
deferred2_0 = r0;
|
|
222
|
+
deferred2_1 = r1;
|
|
223
|
+
return getStringFromWasm0(r0, r1);
|
|
224
|
+
} finally {
|
|
225
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
226
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
124
230
|
/**
|
|
125
231
|
* Get ESP grid metadata (origin, spacing, dimensions) as JSON.
|
|
126
232
|
* @param {string} elements
|
|
@@ -169,6 +275,181 @@ export function compute_esp_grid_typed(elements, coords_flat, spacing, padding)
|
|
|
169
275
|
return takeObject(ret);
|
|
170
276
|
}
|
|
171
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Compute atom-resolved HOMO/LUMO frontier descriptors.
|
|
280
|
+
* @param {string} elements
|
|
281
|
+
* @param {string} coords_flat
|
|
282
|
+
* @returns {string}
|
|
283
|
+
*/
|
|
284
|
+
export function compute_frontier_descriptors(elements, coords_flat) {
|
|
285
|
+
let deferred3_0;
|
|
286
|
+
let deferred3_1;
|
|
287
|
+
try {
|
|
288
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
289
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
290
|
+
const len0 = WASM_VECTOR_LEN;
|
|
291
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
292
|
+
const len1 = WASM_VECTOR_LEN;
|
|
293
|
+
wasm.compute_frontier_descriptors(retptr, ptr0, len0, ptr1, len1);
|
|
294
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
295
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
296
|
+
deferred3_0 = r0;
|
|
297
|
+
deferred3_1 = r1;
|
|
298
|
+
return getStringFromWasm0(r0, r1);
|
|
299
|
+
} finally {
|
|
300
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
301
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Compute Fukui-function workflows and condensed per-atom descriptors.
|
|
307
|
+
* @param {string} elements
|
|
308
|
+
* @param {string} coords_flat
|
|
309
|
+
* @returns {string}
|
|
310
|
+
*/
|
|
311
|
+
export function compute_fukui_descriptors(elements, coords_flat) {
|
|
312
|
+
let deferred3_0;
|
|
313
|
+
let deferred3_1;
|
|
314
|
+
try {
|
|
315
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
316
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
317
|
+
const len0 = WASM_VECTOR_LEN;
|
|
318
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
319
|
+
const len1 = WASM_VECTOR_LEN;
|
|
320
|
+
wasm.compute_fukui_descriptors(retptr, ptr0, len0, ptr1, len1);
|
|
321
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
322
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
323
|
+
deferred3_0 = r0;
|
|
324
|
+
deferred3_1 = r1;
|
|
325
|
+
return getStringFromWasm0(r0, r1);
|
|
326
|
+
} finally {
|
|
327
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
328
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Predict molecular properties using ML proxy models.
|
|
334
|
+
*
|
|
335
|
+
* `smiles`: SMILES string.
|
|
336
|
+
*
|
|
337
|
+
* Returns: JSON with logp, molar_refractivity, log_solubility,
|
|
338
|
+
* lipinski_violations, lipinski_passes, druglikeness.
|
|
339
|
+
* @param {string} smiles
|
|
340
|
+
* @returns {string}
|
|
341
|
+
*/
|
|
342
|
+
export function compute_ml_properties(smiles) {
|
|
343
|
+
let deferred2_0;
|
|
344
|
+
let deferred2_1;
|
|
345
|
+
try {
|
|
346
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
347
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
348
|
+
const len0 = WASM_VECTOR_LEN;
|
|
349
|
+
wasm.compute_ml_properties(retptr, ptr0, len0);
|
|
350
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
351
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
352
|
+
deferred2_0 = r0;
|
|
353
|
+
deferred2_1 = r1;
|
|
354
|
+
return getStringFromWasm0(r0, r1);
|
|
355
|
+
} finally {
|
|
356
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
357
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Compute MMFF94 force field energy.
|
|
363
|
+
*
|
|
364
|
+
* `smiles`: SMILES string for bond topology.
|
|
365
|
+
* `coords`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
366
|
+
*
|
|
367
|
+
* Returns: JSON `{"energy": <kcal/mol>}`
|
|
368
|
+
* @param {string} smiles
|
|
369
|
+
* @param {string} coords
|
|
370
|
+
* @returns {string}
|
|
371
|
+
*/
|
|
372
|
+
export function compute_mmff94_energy(smiles, coords) {
|
|
373
|
+
let deferred3_0;
|
|
374
|
+
let deferred3_1;
|
|
375
|
+
try {
|
|
376
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
377
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
379
|
+
const ptr1 = passStringToWasm0(coords, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
380
|
+
const len1 = WASM_VECTOR_LEN;
|
|
381
|
+
wasm.compute_mmff94_energy(retptr, ptr0, len0, ptr1, len1);
|
|
382
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
383
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
384
|
+
deferred3_0 = r0;
|
|
385
|
+
deferred3_1 = r1;
|
|
386
|
+
return getStringFromWasm0(r0, r1);
|
|
387
|
+
} finally {
|
|
388
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
389
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Compute molecular descriptors from a SMILES string.
|
|
395
|
+
*
|
|
396
|
+
* Returns: JSON with molecular_weight, n_heavy_atoms, n_hbd, n_hba, fsp3,
|
|
397
|
+
* n_rotatable_bonds, n_rings, n_aromatic, wiener_index, etc.
|
|
398
|
+
* @param {string} smiles
|
|
399
|
+
* @returns {string}
|
|
400
|
+
*/
|
|
401
|
+
export function compute_molecular_descriptors(smiles) {
|
|
402
|
+
let deferred2_0;
|
|
403
|
+
let deferred2_1;
|
|
404
|
+
try {
|
|
405
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
406
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
408
|
+
wasm.compute_molecular_descriptors(retptr, ptr0, len0);
|
|
409
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
410
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
411
|
+
deferred2_0 = r0;
|
|
412
|
+
deferred2_1 = r1;
|
|
413
|
+
return getStringFromWasm0(r0, r1);
|
|
414
|
+
} finally {
|
|
415
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
416
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Run a PM3 semi-empirical calculation.
|
|
422
|
+
*
|
|
423
|
+
* `elements_json`: JSON array of atomic numbers, e.g. `"[6,1,1,1,1]"`.
|
|
424
|
+
* `coords_flat_json`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
425
|
+
*
|
|
426
|
+
* Returns: JSON Pm3Result with orbital_energies, total_energy, heat_of_formation,
|
|
427
|
+
* homo_energy, lumo_energy, gap, mulliken_charges, converged.
|
|
428
|
+
* @param {string} elements_json
|
|
429
|
+
* @param {string} coords_flat_json
|
|
430
|
+
* @returns {string}
|
|
431
|
+
*/
|
|
432
|
+
export function compute_pm3(elements_json, coords_flat_json) {
|
|
433
|
+
let deferred3_0;
|
|
434
|
+
let deferred3_1;
|
|
435
|
+
try {
|
|
436
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
437
|
+
const ptr0 = passStringToWasm0(elements_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
438
|
+
const len0 = WASM_VECTOR_LEN;
|
|
439
|
+
const ptr1 = passStringToWasm0(coords_flat_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
440
|
+
const len1 = WASM_VECTOR_LEN;
|
|
441
|
+
wasm.compute_pm3(retptr, ptr0, len0, ptr1, len1);
|
|
442
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
443
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
444
|
+
deferred3_0 = r0;
|
|
445
|
+
deferred3_1 = r1;
|
|
446
|
+
return getStringFromWasm0(r0, r1);
|
|
447
|
+
} finally {
|
|
448
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
449
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
172
453
|
/**
|
|
173
454
|
* Compute Mulliken & Löwdin population analysis.
|
|
174
455
|
* Elements: JSON array of atomic numbers. Coords: JSON array of flat xyz.
|
|
@@ -197,6 +478,33 @@ export function compute_population(elements, coords_flat) {
|
|
|
197
478
|
}
|
|
198
479
|
}
|
|
199
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Build empirical local-reactivity rankings from Fukui descriptors and Mulliken charges.
|
|
483
|
+
* @param {string} elements
|
|
484
|
+
* @param {string} coords_flat
|
|
485
|
+
* @returns {string}
|
|
486
|
+
*/
|
|
487
|
+
export function compute_reactivity_ranking(elements, coords_flat) {
|
|
488
|
+
let deferred3_0;
|
|
489
|
+
let deferred3_1;
|
|
490
|
+
try {
|
|
491
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
492
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
493
|
+
const len0 = WASM_VECTOR_LEN;
|
|
494
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
495
|
+
const len1 = WASM_VECTOR_LEN;
|
|
496
|
+
wasm.compute_reactivity_ranking(retptr, ptr0, len0, ptr1, len1);
|
|
497
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
498
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
499
|
+
deferred3_0 = r0;
|
|
500
|
+
deferred3_1 = r1;
|
|
501
|
+
return getStringFromWasm0(r0, r1);
|
|
502
|
+
} finally {
|
|
503
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
504
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
200
508
|
/**
|
|
201
509
|
* Compute RMSD between two coordinate sets after Kabsch alignment.
|
|
202
510
|
* @param {string} coords
|
|
@@ -258,6 +566,33 @@ export function compute_sasa(elements, coords_flat, probe_radius) {
|
|
|
258
566
|
}
|
|
259
567
|
}
|
|
260
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Detect metal coordination geometry and return structured topology outputs.
|
|
571
|
+
* @param {string} elements
|
|
572
|
+
* @param {string} coords_flat
|
|
573
|
+
* @returns {string}
|
|
574
|
+
*/
|
|
575
|
+
export function compute_topology(elements, coords_flat) {
|
|
576
|
+
let deferred3_0;
|
|
577
|
+
let deferred3_1;
|
|
578
|
+
try {
|
|
579
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
580
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
581
|
+
const len0 = WASM_VECTOR_LEN;
|
|
582
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
583
|
+
const len1 = WASM_VECTOR_LEN;
|
|
584
|
+
wasm.compute_topology(retptr, ptr0, len0, ptr1, len1);
|
|
585
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
586
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
587
|
+
deferred3_0 = r0;
|
|
588
|
+
deferred3_1 = r1;
|
|
589
|
+
return getStringFromWasm0(r0, r1);
|
|
590
|
+
} finally {
|
|
591
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
592
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
261
596
|
/**
|
|
262
597
|
* Compute UFF force field energy.
|
|
263
598
|
* @param {string} smiles
|
|
@@ -285,6 +620,97 @@ export function compute_uff_energy(smiles, coords) {
|
|
|
285
620
|
}
|
|
286
621
|
}
|
|
287
622
|
|
|
623
|
+
/**
|
|
624
|
+
* Compute UFF energy with aromaticity-informed heuristic correction metadata.
|
|
625
|
+
* @param {string} smiles
|
|
626
|
+
* @param {string} coords
|
|
627
|
+
* @returns {string}
|
|
628
|
+
*/
|
|
629
|
+
export function compute_uff_energy_with_aromatic_heuristics(smiles, coords) {
|
|
630
|
+
let deferred3_0;
|
|
631
|
+
let deferred3_1;
|
|
632
|
+
try {
|
|
633
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
634
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
635
|
+
const len0 = WASM_VECTOR_LEN;
|
|
636
|
+
const ptr1 = passStringToWasm0(coords, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
637
|
+
const len1 = WASM_VECTOR_LEN;
|
|
638
|
+
wasm.compute_uff_energy_with_aromatic_heuristics(retptr, ptr0, len0, ptr1, len1);
|
|
639
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
640
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
641
|
+
deferred3_0 = r0;
|
|
642
|
+
deferred3_1 = r1;
|
|
643
|
+
return getStringFromWasm0(r0, r1);
|
|
644
|
+
} finally {
|
|
645
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
646
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Build an exploratory UV-Vis-like spectrum from low-cost EHT transitions.
|
|
652
|
+
* @param {string} elements
|
|
653
|
+
* @param {string} coords_flat
|
|
654
|
+
* @param {number} sigma
|
|
655
|
+
* @param {number} e_min
|
|
656
|
+
* @param {number} e_max
|
|
657
|
+
* @param {number} n_points
|
|
658
|
+
* @returns {string}
|
|
659
|
+
*/
|
|
660
|
+
export function compute_uv_vis_spectrum(elements, coords_flat, sigma, e_min, e_max, n_points) {
|
|
661
|
+
let deferred3_0;
|
|
662
|
+
let deferred3_1;
|
|
663
|
+
try {
|
|
664
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
665
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
666
|
+
const len0 = WASM_VECTOR_LEN;
|
|
667
|
+
const ptr1 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
668
|
+
const len1 = WASM_VECTOR_LEN;
|
|
669
|
+
wasm.compute_uv_vis_spectrum(retptr, ptr0, len0, ptr1, len1, sigma, e_min, e_max, n_points);
|
|
670
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
671
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
672
|
+
deferred3_0 = r0;
|
|
673
|
+
deferred3_1 = r1;
|
|
674
|
+
return getStringFromWasm0(r0, r1);
|
|
675
|
+
} finally {
|
|
676
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
677
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Run an xTB tight-binding calculation.
|
|
683
|
+
*
|
|
684
|
+
* `elements_json`: JSON array of atomic numbers, e.g. `"[26,6,6]"`.
|
|
685
|
+
* `coords_flat_json`: JSON array of flat xyz coords [x0,y0,z0, ...] in Å.
|
|
686
|
+
*
|
|
687
|
+
* Returns: JSON XtbResult with orbital_energies, total_energy, gap,
|
|
688
|
+
* homo_energy, lumo_energy, mulliken_charges, converged.
|
|
689
|
+
* @param {string} elements_json
|
|
690
|
+
* @param {string} coords_flat_json
|
|
691
|
+
* @returns {string}
|
|
692
|
+
*/
|
|
693
|
+
export function compute_xtb(elements_json, coords_flat_json) {
|
|
694
|
+
let deferred3_0;
|
|
695
|
+
let deferred3_1;
|
|
696
|
+
try {
|
|
697
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
698
|
+
const ptr0 = passStringToWasm0(elements_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
699
|
+
const len0 = WASM_VECTOR_LEN;
|
|
700
|
+
const ptr1 = passStringToWasm0(coords_flat_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
701
|
+
const len1 = WASM_VECTOR_LEN;
|
|
702
|
+
wasm.compute_xtb(retptr, ptr0, len0, ptr1, len1);
|
|
703
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
704
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
705
|
+
deferred3_0 = r0;
|
|
706
|
+
deferred3_1 = r1;
|
|
707
|
+
return getStringFromWasm0(r0, r1);
|
|
708
|
+
} finally {
|
|
709
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
710
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
288
714
|
/**
|
|
289
715
|
* Create a unit cell and return parameters + volume as JSON.
|
|
290
716
|
* @param {number} a
|
|
@@ -346,6 +772,37 @@ export function eht_calculate(elements, coords_flat, k) {
|
|
|
346
772
|
}
|
|
347
773
|
}
|
|
348
774
|
|
|
775
|
+
/**
|
|
776
|
+
* Run EHT or route to UFF fallback based on support/confidence.
|
|
777
|
+
* @param {string} smiles
|
|
778
|
+
* @param {string} elements
|
|
779
|
+
* @param {string} coords_flat
|
|
780
|
+
* @param {boolean} allow_experimental_eht
|
|
781
|
+
* @returns {string}
|
|
782
|
+
*/
|
|
783
|
+
export function eht_or_uff_fallback(smiles, elements, coords_flat, allow_experimental_eht) {
|
|
784
|
+
let deferred4_0;
|
|
785
|
+
let deferred4_1;
|
|
786
|
+
try {
|
|
787
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
788
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
789
|
+
const len0 = WASM_VECTOR_LEN;
|
|
790
|
+
const ptr1 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
791
|
+
const len1 = WASM_VECTOR_LEN;
|
|
792
|
+
const ptr2 = passStringToWasm0(coords_flat, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
793
|
+
const len2 = WASM_VECTOR_LEN;
|
|
794
|
+
wasm.eht_or_uff_fallback(retptr, ptr0, len0, ptr1, len1, ptr2, len2, allow_experimental_eht);
|
|
795
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
796
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
797
|
+
deferred4_0 = r0;
|
|
798
|
+
deferred4_1 = r1;
|
|
799
|
+
return getStringFromWasm0(r0, r1);
|
|
800
|
+
} finally {
|
|
801
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
802
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
349
806
|
/**
|
|
350
807
|
* Compute orbital grid from precomputed EHT coefficients as Float32Array.
|
|
351
808
|
* @param {string} elements
|
|
@@ -422,6 +879,30 @@ export function eht_orbital_mesh(elements, coords_flat, mo_index, spacing, isova
|
|
|
422
879
|
}
|
|
423
880
|
}
|
|
424
881
|
|
|
882
|
+
/**
|
|
883
|
+
* Query EHT support metadata from a JSON element array.
|
|
884
|
+
* @param {string} elements
|
|
885
|
+
* @returns {string}
|
|
886
|
+
*/
|
|
887
|
+
export function eht_support(elements) {
|
|
888
|
+
let deferred2_0;
|
|
889
|
+
let deferred2_1;
|
|
890
|
+
try {
|
|
891
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
892
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
893
|
+
const len0 = WASM_VECTOR_LEN;
|
|
894
|
+
wasm.eht_support(retptr, ptr0, len0);
|
|
895
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
896
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
897
|
+
deferred2_0 = r0;
|
|
898
|
+
deferred2_1 = r1;
|
|
899
|
+
return getStringFromWasm0(r0, r1);
|
|
900
|
+
} finally {
|
|
901
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
902
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
425
906
|
/**
|
|
426
907
|
* Generate a 3D conformer from a SMILES string.
|
|
427
908
|
*
|
|
@@ -618,6 +1099,54 @@ export function split_worker_tasks(smiles_json, n_workers, seed) {
|
|
|
618
1099
|
}
|
|
619
1100
|
}
|
|
620
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* Query operation capabilities from a JSON element array.
|
|
1104
|
+
* @param {string} elements
|
|
1105
|
+
* @returns {string}
|
|
1106
|
+
*/
|
|
1107
|
+
export function system_capabilities(elements) {
|
|
1108
|
+
let deferred2_0;
|
|
1109
|
+
let deferred2_1;
|
|
1110
|
+
try {
|
|
1111
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1112
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1113
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1114
|
+
wasm.system_capabilities(retptr, ptr0, len0);
|
|
1115
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1116
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1117
|
+
deferred2_0 = r0;
|
|
1118
|
+
deferred2_1 = r1;
|
|
1119
|
+
return getStringFromWasm0(r0, r1);
|
|
1120
|
+
} finally {
|
|
1121
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1122
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Build a structured method plan from a JSON element array.
|
|
1128
|
+
* @param {string} elements
|
|
1129
|
+
* @returns {string}
|
|
1130
|
+
*/
|
|
1131
|
+
export function system_method_plan(elements) {
|
|
1132
|
+
let deferred2_0;
|
|
1133
|
+
let deferred2_1;
|
|
1134
|
+
try {
|
|
1135
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1136
|
+
const ptr0 = passStringToWasm0(elements, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1138
|
+
wasm.system_method_plan(retptr, ptr0, len0);
|
|
1139
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1140
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1141
|
+
deferred2_0 = r0;
|
|
1142
|
+
deferred2_1 = r1;
|
|
1143
|
+
return getStringFromWasm0(r0, r1);
|
|
1144
|
+
} finally {
|
|
1145
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1146
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
621
1150
|
/**
|
|
622
1151
|
* Library version.
|
|
623
1152
|
* @returns {string}
|
package/sci_form_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google Inc. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
* See the License for the specific language governing permissions and
|
|
11
|
+
* limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
|
|
15
|
+
// we can handle bundling into other files, which might happen to have their
|
|
16
|
+
// own `postMessage`/`onmessage` communication channels.
|
|
17
|
+
//
|
|
18
|
+
// If we didn't take that into the account, we could send much simpler signals
|
|
19
|
+
// like just `0` or whatever, but the code would be less resilient.
|
|
20
|
+
|
|
21
|
+
function waitForMsgType(target, type) {
|
|
22
|
+
return new Promise(resolve => {
|
|
23
|
+
target.addEventListener('message', function onMsg({ data }) {
|
|
24
|
+
if (data?.type !== type) return;
|
|
25
|
+
target.removeEventListener('message', onMsg);
|
|
26
|
+
resolve(data);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
waitForMsgType(self, 'wasm_bindgen_worker_init').then(async ({ init, receiver }) => {
|
|
32
|
+
// # Note 1
|
|
33
|
+
// Our JS should have been generated in
|
|
34
|
+
// `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
|
|
35
|
+
// resolve the main module via `../../..`.
|
|
36
|
+
//
|
|
37
|
+
// This might need updating if the generated structure changes on wasm-bindgen
|
|
38
|
+
// side ever in the future, but works well with bundlers today. The whole
|
|
39
|
+
// point of this crate, after all, is to abstract away unstable features
|
|
40
|
+
// and temporary bugs so that you don't need to deal with them in your code.
|
|
41
|
+
//
|
|
42
|
+
// # Note 2
|
|
43
|
+
// This could be a regular import, but then some bundlers complain about
|
|
44
|
+
// circular deps.
|
|
45
|
+
//
|
|
46
|
+
// Dynamic import could be cheap if this file was inlined into the parent,
|
|
47
|
+
// which would require us just using `../../..` in `new Worker` below,
|
|
48
|
+
// but that doesn't work because wasm-pack unconditionally adds
|
|
49
|
+
// "sideEffects":false (see below).
|
|
50
|
+
//
|
|
51
|
+
// OTOH, even though it can't be inlined, it should be still reasonably
|
|
52
|
+
// cheap since the requested file is already in cache (it was loaded by
|
|
53
|
+
// the main thread).
|
|
54
|
+
const pkg = await import('../../..');
|
|
55
|
+
await pkg.default(init);
|
|
56
|
+
postMessage({ type: 'wasm_bindgen_worker_ready' });
|
|
57
|
+
pkg.wbg_rayon_start_worker(receiver);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Note: this is never used, but necessary to prevent a bug in Firefox
|
|
61
|
+
// (https://bugzilla.mozilla.org/show_bug.cgi?id=1702191) where it collects
|
|
62
|
+
// Web Workers that have a shared WebAssembly memory with the main thread,
|
|
63
|
+
// but are not explicitly rooted via a `Worker` instance.
|
|
64
|
+
//
|
|
65
|
+
// By storing them in a variable, we can keep `Worker` objects around and
|
|
66
|
+
// prevent them from getting GC-d.
|
|
67
|
+
let _workers;
|
|
68
|
+
|
|
69
|
+
export async function startWorkers(module, memory, builder) {
|
|
70
|
+
if (builder.numThreads() === 0) {
|
|
71
|
+
throw new Error(`num_threads must be > 0.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const workerInit = {
|
|
75
|
+
type: 'wasm_bindgen_worker_init',
|
|
76
|
+
init: { module_or_path: module, memory },
|
|
77
|
+
receiver: builder.receiver()
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
_workers = await Promise.all(
|
|
81
|
+
Array.from({ length: builder.numThreads() }, async () => {
|
|
82
|
+
// Self-spawn into a new Worker.
|
|
83
|
+
//
|
|
84
|
+
// TODO: while `new URL('...', import.meta.url) becomes a semi-standard
|
|
85
|
+
// way to get asset URLs relative to the module across various bundlers
|
|
86
|
+
// and browser, ideally we should switch to `import.meta.resolve`
|
|
87
|
+
// once it becomes a standard.
|
|
88
|
+
//
|
|
89
|
+
// Note: we could use `../../..` as the URL here to inline workerHelpers.js
|
|
90
|
+
// into the parent entry instead of creating another split point -
|
|
91
|
+
// this would be preferable from optimization perspective -
|
|
92
|
+
// however, Webpack then eliminates all message handler code
|
|
93
|
+
// because wasm-pack produces "sideEffects":false in package.json
|
|
94
|
+
// unconditionally.
|
|
95
|
+
//
|
|
96
|
+
// The only way to work around that is to have side effect code
|
|
97
|
+
// in an entry point such as Worker file itself.
|
|
98
|
+
const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
|
|
99
|
+
type: 'module'
|
|
100
|
+
});
|
|
101
|
+
worker.postMessage(workerInit);
|
|
102
|
+
await waitForMsgType(worker, 'wasm_bindgen_worker_ready');
|
|
103
|
+
return worker;
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
builder.build();
|
|
107
|
+
}
|