@molcrafts/molrs 0.0.7 → 0.0.8

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/molrs_bg.js CHANGED
@@ -2,14 +2,14 @@
2
2
  * Column-oriented data store with typed arrays.
3
3
  *
4
4
  * Each column is identified by a string key and has a fixed data type
5
- * (`f32`, `i32`, `u32`, `string`). All columns in a block must have
5
+ * (`F`, `i32`, `u32`, `string`). All columns in a block must have
6
6
  * the same number of rows.
7
7
  *
8
8
  * # Supported column types
9
9
  *
10
10
  * | JS type | Rust type | dtype string | Setter | Getter (copy) | Getter (view) |
11
11
  * |---------|-----------|-------------|--------|---------------|---------------|
12
- * | `Float32Array` | `f32` | `"f32"` | `setColF32` | `copyColF32` | `viewColF32` |
12
+ * | `Float32Array` / `Float64Array` | `F` | `"f32"` / `"f64"` | `setColF` | `copyColF` | `viewColF` |
13
13
  * | `Int32Array` | `i32` | `"i32"` | `setColI32` | `copyColI32` | `viewColI32` |
14
14
  * | `Uint32Array` | `u32` | `"u32"` | `setColU32` | `copyColU32` | `viewColU32` |
15
15
  * | `string[]` | `String` | `"string"` | `setColStr` | `copyColStr` | -- |
@@ -18,12 +18,12 @@
18
18
  *
19
19
  * ```js
20
20
  * const block = new Block();
21
- * block.setColF32("x", new Float32Array([1.0, 2.0, 3.0]));
22
- * block.setColF32("y", new Float32Array([0.0, 0.0, 0.0]));
21
+ * block.setColF("x", coordsX);
22
+ * block.setColF("y", coordsY);
23
23
  * console.log(block.nrows()); // 3
24
24
  * console.log(block.keys()); // ["x", "y"]
25
25
  *
26
- * const x = block.copyColF32("x"); // owned copy, safe to keep
26
+ * const x = block.copyColF("x"); // owned copy, safe to keep
27
27
  * ```
28
28
  */
29
29
  export class Block {
@@ -45,9 +45,9 @@ export class Block {
45
45
  wasm.__wbg_block_free(ptr, 0);
46
46
  }
47
47
  /**
48
- * Owned `Float32Array` copy of a column.
48
+ * Owned JS float typed-array copy of a column.
49
49
  *
50
- * Returns a new JS `Float32Array` that is an independent copy of
50
+ * Returns a new JS float typed array that is an independent copy of
51
51
  * the column data. Safe to store and use across allocations.
52
52
  *
53
53
  * # Arguments
@@ -56,25 +56,25 @@ export class Block {
56
56
  *
57
57
  * # Returns
58
58
  *
59
- * An owned `Float32Array` copy of the column.
59
+ * An owned JS float typed-array copy of the column.
60
60
  *
61
61
  * # Errors
62
62
  *
63
- * Throws if the column does not exist or is not of type `f32`.
63
+ * Throws if the column does not exist or is not of the active float type.
64
64
  *
65
65
  * # Example (JavaScript)
66
66
  *
67
67
  * ```js
68
- * const x = block.copyColF32("x");
68
+ * const x = block.copyColF("x");
69
69
  * console.log(x[0]); // 1.0
70
70
  * ```
71
71
  * @param {string} key
72
- * @returns {Float32Array}
72
+ * @returns {Float64Array}
73
73
  */
74
- copyColF32(key) {
74
+ copyColF(key) {
75
75
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
76
76
  const len0 = WASM_VECTOR_LEN;
77
- const ret = wasm.block_copyColF32(this.__wbg_ptr, ptr0, len0);
77
+ const ret = wasm.block_copyColF(this.__wbg_ptr, ptr0, len0);
78
78
  if (ret[2]) {
79
79
  throw takeFromExternrefTable0(ret[1]);
80
80
  }
@@ -172,7 +172,8 @@ export class Block {
172
172
  /**
173
173
  * Return the data type string for a column.
174
174
  *
175
- * Possible return values: `"f32"`, `"i32"`, `"u32"`, `"bool"`,
175
+ * Possible return values: `"f32"` or `"f64"` for float columns,
176
+ * plus `"i32"`, `"u32"`, `"bool"`,
176
177
  * `"string"`, `"u8"`. Returns `undefined` if the column does
177
178
  * not exist.
178
179
  *
@@ -187,7 +188,7 @@ export class Block {
187
188
  * # Example (JavaScript)
188
189
  *
189
190
  * ```js
190
- * console.log(block.dtype("x")); // "f32"
191
+ * console.log(block.dtype("x")); // "f32" or "f64"
191
192
  * console.log(block.dtype("symbol")); // "string"
192
193
  * ```
193
194
  * @param {string} key
@@ -282,7 +283,7 @@ export class Block {
282
283
  *
283
284
  * ```js
284
285
  * const block = new Block();
285
- * block.setColF32("values", new Float32Array([1, 2, 3]));
286
+ * block.setColF("values", values);
286
287
  * ```
287
288
  */
288
289
  constructor() {
@@ -354,12 +355,12 @@ export class Block {
354
355
  return ret[0] !== 0;
355
356
  }
356
357
  /**
357
- * Set a float column from a `Float32Array`.
358
+ * Set a float column from a JS float typed array.
358
359
  *
359
360
  * # Arguments
360
361
  *
361
362
  * * `key` - Column name (e.g., `"x"`, `"mass"`, `"charge"`)
362
- * * `data` - `Float32Array` with the column values
363
+ * * `data` - JS float typed array with the column values
363
364
  * * `shape` - Optional shape array for multi-dimensional data
364
365
  * (e.g., `[N, 3]` for an Nx3 matrix stored flat). If omitted,
365
366
  * the data is stored as a 1D column.
@@ -372,20 +373,20 @@ export class Block {
372
373
  * # Example (JavaScript)
373
374
  *
374
375
  * ```js
375
- * block.setColF32("x", new Float32Array([1.0, 2.0, 3.0]));
376
+ * block.setColF("x", xCoords);
376
377
  * // Multi-dimensional: 2 rows x 3 columns
377
- * block.setColF32("pos", new Float32Array([1,2,3, 4,5,6]), [2, 3]);
378
+ * block.setColF("pos", positions, [2, 3]);
378
379
  * ```
379
380
  * @param {string} key
380
- * @param {Float32Array} data
381
+ * @param {Float64Array} data
381
382
  * @param {Uint32Array | null} [shape]
382
383
  */
383
- setColF32(key, data, shape) {
384
+ setColF(key, data, shape) {
384
385
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
385
386
  const len0 = WASM_VECTOR_LEN;
386
387
  var ptr1 = isLikeNone(shape) ? 0 : passArray32ToWasm0(shape, wasm.__wbindgen_malloc_command_export);
387
388
  var len1 = WASM_VECTOR_LEN;
388
- const ret = wasm.block_setColF32(this.__wbg_ptr, ptr0, len0, data, ptr1, len1);
389
+ const ret = wasm.block_setColF(this.__wbg_ptr, ptr0, len0, data, ptr1, len1);
389
390
  if (ret[1]) {
390
391
  throw takeFromExternrefTable0(ret[0]);
391
392
  }
@@ -478,13 +479,13 @@ export class Block {
478
479
  }
479
480
  }
480
481
  /**
481
- * Zero-copy `Float32Array` view into WASM linear memory.
482
+ * Zero-copy JS float typed-array view into WASM linear memory.
482
483
  *
483
484
  * Returns a view backed directly by the block's storage in WASM
484
485
  * memory. This avoids copying but the view becomes **invalid**
485
486
  * if WASM linear memory grows (due to any allocation).
486
487
  *
487
- * Use [`copyColF32`](Block::copy_col_f32) for a safe, long-lived copy.
488
+ * Use [`copyColF`](Block::copy_col_f) for a safe, long-lived copy.
488
489
  *
489
490
  * # Arguments
490
491
  *
@@ -492,25 +493,25 @@ export class Block {
492
493
  *
493
494
  * # Returns
494
495
  *
495
- * A `Float32Array` view into WASM memory.
496
+ * A JS float typed-array view into WASM memory.
496
497
  *
497
498
  * # Errors
498
499
  *
499
- * Throws if the column does not exist or is not of type `f32`.
500
+ * Throws if the column does not exist or is not of the active float type.
500
501
  *
501
502
  * # Example (JavaScript)
502
503
  *
503
504
  * ```js
504
- * const view = block.viewColF32("x"); // zero-copy, use immediately
505
- * const copy = block.copyColF32("x"); // safe to keep
505
+ * const view = block.viewColF("x"); // zero-copy, use immediately
506
+ * const copy = block.copyColF("x"); // safe to keep
506
507
  * ```
507
508
  * @param {string} key
508
- * @returns {Float32Array}
509
+ * @returns {Float64Array}
509
510
  */
510
- viewColF32(key) {
511
+ viewColF(key) {
511
512
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
512
513
  const len0 = WASM_VECTOR_LEN;
513
- const ret = wasm.block_viewColF32(this.__wbg_ptr, ptr0, len0);
514
+ const ret = wasm.block_viewColF(this.__wbg_ptr, ptr0, len0);
514
515
  if (ret[2]) {
515
516
  throw takeFromExternrefTable0(ret[1]);
516
517
  }
@@ -594,8 +595,8 @@ if (Symbol.dispose) Block.prototype[Symbol.dispose] = Block.prototype.free;
594
595
  * # Example (JavaScript)
595
596
  *
596
597
  * ```js
597
- * const h = new Float32Array([10, 0, 0, 0, 10, 0, 0, 0, 10]);
598
- * const origin = new Float32Array([0, 0, 0]);
598
+ * const h = floatArrayH;
599
+ * const origin = floatArrayOrigin;
599
600
  * const box = new Box(h, origin, true, true, true);
600
601
  * console.log(box.volume()); // 1000.0
601
602
  * console.log(box.lengths().toCopy()); // [10, 10, 10]
@@ -625,7 +626,7 @@ export class Box {
625
626
  * # Arguments
626
627
  *
627
628
  * * `a` - Side length of the cube in angstrom (A)
628
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
629
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
629
630
  * `[x, y, z]` in angstrom
630
631
  * * `pbc_x` - Enable periodic boundary in x direction
631
632
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -642,12 +643,12 @@ export class Box {
642
643
  * # Example (JavaScript)
643
644
  *
644
645
  * ```js
645
- * const origin = new Float32Array([0, 0, 0]);
646
+ * const origin = originVec;
646
647
  * const box = Box.cube(10.0, origin, true, true, true);
647
648
  * console.log(box.volume()); // 1000.0
648
649
  * ```
649
650
  * @param {number} a
650
- * @param {Float32Array} origin
651
+ * @param {Float64Array} origin
651
652
  * @param {boolean} pbc_x
652
653
  * @param {boolean} pbc_y
653
654
  * @param {boolean} pbc_z
@@ -688,8 +689,8 @@ export class Box {
688
689
  * # Example (JavaScript)
689
690
  *
690
691
  * ```js
691
- * const a = WasmArray.from(new Float32Array([1,1,1]), [1,3]);
692
- * const b = WasmArray.from(new Float32Array([9,9,9]), [1,3]);
692
+ * const a = WasmArray.from(aCoords, [1, 3]);
693
+ * const b = WasmArray.from(bCoords, [1, 3]);
693
694
  * const d = box.delta(a, b, true); // minimum-image displacement
694
695
  * ```
695
696
  * @param {WasmArray} a
@@ -718,7 +719,7 @@ export class Box {
718
719
  * * `b` - `WasmArray` with shape `[N, 3]` (target positions in A)
719
720
  * * `minimum_image` - If `true`, apply minimum image convention
720
721
  * * `out_block` - Target [`Block`] to write the result into
721
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
722
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
722
723
  *
723
724
  * # Errors
724
725
  *
@@ -779,7 +780,7 @@ export class Box {
779
780
  * # Example (JavaScript)
780
781
  *
781
782
  * ```js
782
- * const L = box.lengths().toCopy(); // Float32Array [10, 10, 10]
783
+ * const L = box.lengths().toCopy(); // Float32Array or Float64Array [10, 10, 10]
783
784
  * ```
784
785
  * @returns {WasmArray}
785
786
  */
@@ -792,10 +793,10 @@ export class Box {
792
793
  *
793
794
  * # Arguments
794
795
  *
795
- * * `h` - 3x3 cell matrix as `Float32Array` with 9 elements in
796
+ * * `h` - 3x3 cell matrix as a float typed array with 9 elements in
796
797
  * row-major order: `[h00, h01, h02, h10, h11, h12, h20, h21, h22]`.
797
798
  * All values in angstrom (A).
798
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
799
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
799
800
  * `[x, y, z]` in angstrom.
800
801
  * * `pbc_x` - Enable periodic boundary in x direction
801
802
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -814,12 +815,12 @@ export class Box {
814
815
  *
815
816
  * ```js
816
817
  * // Triclinic box
817
- * const h = new Float32Array([10, 2, 0, 0, 10, 0, 0, 0, 10]);
818
- * const origin = new Float32Array([0, 0, 0]);
818
+ * const h = hMatrix;
819
+ * const origin = originVec;
819
820
  * const box = new Box(h, origin, true, true, true);
820
821
  * ```
821
- * @param {Float32Array} h
822
- * @param {Float32Array} origin
822
+ * @param {Float64Array} h
823
+ * @param {Float64Array} origin
823
824
  * @param {boolean} pbc_x
824
825
  * @param {boolean} pbc_y
825
826
  * @param {boolean} pbc_z
@@ -845,7 +846,7 @@ export class Box {
845
846
  * # Example (JavaScript)
846
847
  *
847
848
  * ```js
848
- * const o = box.origin().toCopy(); // Float32Array [0, 0, 0]
849
+ * const o = box.origin().toCopy(); // Float32Array or Float64Array [0, 0, 0]
849
850
  * ```
850
851
  * @returns {WasmArray}
851
852
  */
@@ -858,9 +859,9 @@ export class Box {
858
859
  *
859
860
  * # Arguments
860
861
  *
861
- * * `lengths` - Box dimensions as `Float32Array` with 3 elements
862
+ * * `lengths` - Box dimensions as a float typed array with 3 elements
862
863
  * `[lx, ly, lz]` in angstrom (A)
863
- * * `origin` - 3D origin vector as `Float32Array` with 3 elements
864
+ * * `origin` - 3D origin vector as a float typed array with 3 elements
864
865
  * `[x, y, z]` in angstrom
865
866
  * * `pbc_x` - Enable periodic boundary in x direction
866
867
  * * `pbc_y` - Enable periodic boundary in y direction
@@ -877,12 +878,12 @@ export class Box {
877
878
  * # Example (JavaScript)
878
879
  *
879
880
  * ```js
880
- * const origin = new Float32Array([0, 0, 0]);
881
- * const box = Box.ortho(new Float32Array([10, 20, 30]), origin, true, true, true);
881
+ * const origin = originVec;
882
+ * const box = Box.ortho(lengthsVec, origin, true, true, true);
882
883
  * console.log(box.volume()); // 6000.0
883
884
  * ```
884
- * @param {Float32Array} lengths
885
- * @param {Float32Array} origin
885
+ * @param {Float64Array} lengths
886
+ * @param {Float64Array} origin
886
887
  * @param {boolean} pbc_x
887
888
  * @param {boolean} pbc_y
888
889
  * @param {boolean} pbc_z
@@ -910,7 +911,7 @@ export class Box {
910
911
  * # Example (JavaScript)
911
912
  *
912
913
  * ```js
913
- * const t = box.tilts().toCopy(); // Float32Array [0, 0, 0]
914
+ * const t = box.tilts().toCopy(); // Float32Array or Float64Array [0, 0, 0]
914
915
  * ```
915
916
  * @returns {WasmArray}
916
917
  */
@@ -926,7 +927,7 @@ export class Box {
926
927
  *
927
928
  * * `coords` - `WasmArray` with shape `[N, 3]` (fractional, dimensionless)
928
929
  * * `out_block` - Target [`Block`]
929
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
930
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
930
931
  *
931
932
  * # Errors
932
933
  *
@@ -959,7 +960,7 @@ export class Box {
959
960
  *
960
961
  * * `coords` - `WasmArray` with shape `[N, 3]` (Cartesian, A)
961
962
  * * `out_block` - Target [`Block`]
962
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
963
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
963
964
  *
964
965
  * # Errors
965
966
  *
@@ -1004,7 +1005,7 @@ export class Box {
1004
1005
  * # Example (JavaScript)
1005
1006
  *
1006
1007
  * ```js
1007
- * const frac = WasmArray.from(new Float32Array([0.5, 0.5, 0.5]), [1, 3]);
1008
+ * const frac = WasmArray.from(fracCoords, [1, 3]);
1008
1009
  * const cart = box.toCart(frac);
1009
1010
  * console.log(cart.toCopy()); // [5, 5, 5] for a 10x10x10 box
1010
1011
  * ```
@@ -1042,7 +1043,7 @@ export class Box {
1042
1043
  * # Example (JavaScript)
1043
1044
  *
1044
1045
  * ```js
1045
- * const cart = WasmArray.from(new Float32Array([5, 5, 5]), [1, 3]);
1046
+ * const cart = WasmArray.from(coords, [1, 3]);
1046
1047
  * const frac = box.toFrac(cart);
1047
1048
  * console.log(frac.toCopy()); // [0.5, 0.5, 0.5] for a 10x10x10 box
1048
1049
  * ```
@@ -1095,7 +1096,7 @@ export class Box {
1095
1096
  * # Example (JavaScript)
1096
1097
  *
1097
1098
  * ```js
1098
- * const pos = WasmArray.from(new Float32Array([12, -1, 5]), [1, 3]);
1099
+ * const pos = WasmArray.from(positions, [1, 3]);
1099
1100
  * const wrapped = box.wrap(pos); // wraps into [0, lx) x [0, ly) x [0, lz)
1100
1101
  * ```
1101
1102
  * @param {WasmArray} coords
@@ -1120,7 +1121,7 @@ export class Box {
1120
1121
  * * `coords` - `WasmArray` with shape `[N, 3]` containing
1121
1122
  * Cartesian coordinates in angstrom (A)
1122
1123
  * * `out_block` - Target [`Block`] to write the result into
1123
- * * `out_key` - Column name for the result (f32, shape `[N, 3]`)
1124
+ * * `out_key` - Column name for the result (float, shape `[N, 3]`)
1124
1125
  *
1125
1126
  * # Errors
1126
1127
  *
@@ -1181,11 +1182,11 @@ export class CenterOfMass {
1181
1182
  /**
1182
1183
  * Create a center-of-mass calculator.
1183
1184
  *
1184
- * Pass `null` for uniform masses, or a `Float32Array` of per-particle masses.
1185
- * @param {Float32Array | null} [masses]
1185
+ * Pass `null` for uniform masses, or a float typed array of per-particle masses.
1186
+ * @param {Float64Array | null} [masses]
1186
1187
  */
1187
1188
  constructor(masses) {
1188
- var ptr0 = isLikeNone(masses) ? 0 : passArrayF32ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
1189
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
1189
1190
  var len0 = WASM_VECTOR_LEN;
1190
1191
  const ret = wasm.centerofmass_new(ptr0, len0);
1191
1192
  this.__wbg_ptr = ret >>> 0;
@@ -1202,8 +1203,8 @@ if (Symbol.dispose) CenterOfMass.prototype[Symbol.dispose] = CenterOfMass.protot
1202
1203
  *
1203
1204
  * ```js
1204
1205
  * const com = new CenterOfMass().compute(frame, clusterResult);
1205
- * com.centersOfMass(); // Float32Array [x0,y0,z0, ...]
1206
- * com.clusterMasses(); // Float32Array
1206
+ * com.centersOfMass(); // Float32Array or Float64Array [x0,y0,z0, ...]
1207
+ * com.clusterMasses(); // Float32Array or Float64Array
1207
1208
  * ```
1208
1209
  */
1209
1210
  export class CenterOfMassResult {
@@ -1225,24 +1226,22 @@ export class CenterOfMassResult {
1225
1226
  wasm.__wbg_centerofmassresult_free(ptr, 0);
1226
1227
  }
1227
1228
  /**
1228
- * Mass-weighted centers, flat `[x0,y0,z0, x1,y1,z1, ...]`.
1229
- * @returns {Float32Array}
1229
+ * Zero-copy `Float64Array` view of mass-weighted centers, flat
1230
+ * `[x0,y0,z0, x1,y1,z1, ...]`. **Invalidated** on WASM memory growth.
1231
+ * @returns {Float64Array}
1230
1232
  */
1231
1233
  centersOfMass() {
1232
1234
  const ret = wasm.centerofmassresult_centersOfMass(this.__wbg_ptr);
1233
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1234
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
1235
- return v1;
1235
+ return ret;
1236
1236
  }
1237
1237
  /**
1238
- * Total mass per cluster.
1239
- * @returns {Float32Array}
1238
+ * Zero-copy `Float64Array` view of total mass per cluster.
1239
+ * **Invalidated** on WASM memory growth.
1240
+ * @returns {Float64Array}
1240
1241
  */
1241
1242
  clusterMasses() {
1242
1243
  const ret = wasm.centerofmassresult_clusterMasses(this.__wbg_ptr);
1243
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1244
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
1245
- return v1;
1244
+ return ret;
1246
1245
  }
1247
1246
  /**
1248
1247
  * Number of clusters.
@@ -1354,7 +1353,7 @@ if (Symbol.dispose) Cluster.prototype[Symbol.dispose] = Cluster.prototype.free;
1354
1353
  *
1355
1354
  * ```js
1356
1355
  * const centers = new ClusterCenters().compute(frame, clusterResult);
1357
- * // Float32Array [x0,y0,z0, x1,y1,z1, ...]
1356
+ * // Float32Array or Float64Array [x0,y0,z0, x1,y1,z1, ...]
1358
1357
  * ```
1359
1358
  */
1360
1359
  export class ClusterCenters {
@@ -1369,10 +1368,10 @@ export class ClusterCenters {
1369
1368
  wasm.__wbg_clustercenters_free(ptr, 0);
1370
1369
  }
1371
1370
  /**
1372
- * Compute geometric centers. Returns flat `Float32Array` `[x0,y0,z0, ...]`.
1371
+ * Compute geometric centers. Returns a flat float typed array `[x0,y0,z0, ...]`.
1373
1372
  * @param {Frame} frame
1374
1373
  * @param {ClusterResult} cluster_result
1375
- * @returns {Float32Array}
1374
+ * @returns {Float64Array}
1376
1375
  */
1377
1376
  compute(frame, cluster_result) {
1378
1377
  _assertClass(frame, Frame);
@@ -1381,8 +1380,8 @@ export class ClusterCenters {
1381
1380
  if (ret[3]) {
1382
1381
  throw takeFromExternrefTable0(ret[2]);
1383
1382
  }
1384
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1385
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
1383
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1384
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
1386
1385
  return v1;
1387
1386
  }
1388
1387
  constructor() {
@@ -1480,10 +1479,10 @@ if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prot
1480
1479
  * # Conventions
1481
1480
  *
1482
1481
  * - The `"atoms"` block should contain per-atom properties: `symbol`
1483
- * (string), `x`/`y`/`z` (f32, coordinates in angstrom), and optionally
1484
- * `mass` (f32, atomic mass units) and `charge` (f32, elementary charges).
1482
+ * (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
1483
+ * `mass` (F, atomic mass units) and `charge` (F, elementary charges).
1485
1484
  * - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
1486
- * zero-based atom indices) and `order` (f32, bond order: 1.0 = single,
1485
+ * zero-based atom indices) and `order` (F, bond order: 1.0 = single,
1487
1486
  * 1.5 = aromatic, 2.0 = double, 3.0 = triple).
1488
1487
  *
1489
1488
  * # Example (JavaScript)
@@ -1491,7 +1490,7 @@ if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prot
1491
1490
  * ```js
1492
1491
  * const frame = new Frame();
1493
1492
  * const atoms = frame.createBlock("atoms");
1494
- * atoms.setColF32("x", new Float32Array([0.0, 1.54]));
1493
+ * atoms.setColF("x", xCoords);
1495
1494
  * ```
1496
1495
  */
1497
1496
  export class Frame {
@@ -1553,7 +1552,7 @@ export class Frame {
1553
1552
  *
1554
1553
  * ```js
1555
1554
  * const atoms = frame.createBlock("atoms");
1556
- * atoms.setColF32("x", new Float32Array([1.0, 2.0]));
1555
+ * atoms.setColF("x", xCoords);
1557
1556
  * ```
1558
1557
  * @param {string} key
1559
1558
  * @returns {Block}
@@ -1608,7 +1607,7 @@ export class Frame {
1608
1607
  * ```js
1609
1608
  * const atoms = frame.getBlock("atoms");
1610
1609
  * if (atoms) {
1611
- * const x = atoms.copyColF32("x");
1610
+ * const x = atoms.copyColF("x");
1612
1611
  * }
1613
1612
  * ```
1614
1613
  * @param {string} key
@@ -1620,6 +1619,79 @@ export class Frame {
1620
1619
  const ret = wasm.frame_getBlock(this.__wbg_ptr, ptr0, len0);
1621
1620
  return ret === 0 ? undefined : Block.__wrap(ret);
1622
1621
  }
1622
+ /**
1623
+ * Retrieve a named grid attached to this frame.
1624
+ *
1625
+ * Returns a cloned [`Grid`] wrapper, or `undefined` if the grid does
1626
+ * not exist. The returned object is independent of the frame — mutations
1627
+ * to it are not reflected in the frame without a subsequent
1628
+ * [`insertGrid`](Frame::insert_grid) call.
1629
+ *
1630
+ * # Arguments
1631
+ *
1632
+ * * `name` — Grid name to retrieve.
1633
+ *
1634
+ * # Example (JavaScript)
1635
+ *
1636
+ * ```js
1637
+ * const g = frame.getGrid("chgcar");
1638
+ * if (g) {
1639
+ * const arr = g.getArray("rho");
1640
+ * }
1641
+ * ```
1642
+ * @param {string} name
1643
+ * @returns {Grid | undefined}
1644
+ */
1645
+ getGrid(name) {
1646
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1647
+ const len0 = WASM_VECTOR_LEN;
1648
+ const ret = wasm.frame_getGrid(this.__wbg_ptr, ptr0, len0);
1649
+ if (ret[2]) {
1650
+ throw takeFromExternrefTable0(ret[1]);
1651
+ }
1652
+ return ret[0] === 0 ? undefined : Grid.__wrap(ret[0]);
1653
+ }
1654
+ /**
1655
+ * Return the names of all grids attached to this frame.
1656
+ *
1657
+ * # Example (JavaScript)
1658
+ *
1659
+ * ```js
1660
+ * const names = frame.gridNames(); // e.g. ["chgcar", "spin"]
1661
+ * ```
1662
+ * @returns {Array<any>}
1663
+ */
1664
+ gridNames() {
1665
+ const ret = wasm.frame_gridNames(this.__wbg_ptr);
1666
+ if (ret[2]) {
1667
+ throw takeFromExternrefTable0(ret[1]);
1668
+ }
1669
+ return takeFromExternrefTable0(ret[0]);
1670
+ }
1671
+ /**
1672
+ * Returns `true` if a named grid is attached to this frame.
1673
+ *
1674
+ * # Arguments
1675
+ *
1676
+ * * `name` — Grid name to look up.
1677
+ *
1678
+ * # Example (JavaScript)
1679
+ *
1680
+ * ```js
1681
+ * frame.hasGrid("chgcar"); // true or false
1682
+ * ```
1683
+ * @param {string} name
1684
+ * @returns {boolean}
1685
+ */
1686
+ hasGrid(name) {
1687
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1688
+ const len0 = WASM_VECTOR_LEN;
1689
+ const ret = wasm.frame_hasGrid(this.__wbg_ptr, ptr0, len0);
1690
+ if (ret[2]) {
1691
+ throw takeFromExternrefTable0(ret[1]);
1692
+ }
1693
+ return ret[0] !== 0;
1694
+ }
1623
1695
  /**
1624
1696
  * Insert a block by deep-copying its data into this frame's store.
1625
1697
  *
@@ -1658,6 +1730,42 @@ export class Frame {
1658
1730
  throw takeFromExternrefTable0(ret[0]);
1659
1731
  }
1660
1732
  }
1733
+ /**
1734
+ * Attach a grid to this frame under the given name.
1735
+ *
1736
+ * If a grid with the same name already exists it is replaced. The grid
1737
+ * data is moved into the frame; the JS `Grid` object becomes empty after
1738
+ * this call and should not be reused.
1739
+ *
1740
+ * # Arguments
1741
+ *
1742
+ * * `name` — Name to store the grid under (e.g., `"chgcar"`).
1743
+ * * `grid` — The [`Grid`] to attach.
1744
+ *
1745
+ * # Errors
1746
+ *
1747
+ * Throws a `JsValue` string if the frame has been dropped.
1748
+ *
1749
+ * # Example (JavaScript)
1750
+ *
1751
+ * ```js
1752
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
1753
+ * grid.insertArray("rho", rhoData);
1754
+ * frame.insertGrid("chgcar", grid);
1755
+ * ```
1756
+ * @param {string} name
1757
+ * @param {Grid} grid
1758
+ */
1759
+ insertGrid(name, grid) {
1760
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1761
+ const len0 = WASM_VECTOR_LEN;
1762
+ _assertClass(grid, Grid);
1763
+ var ptr1 = grid.__destroy_into_raw();
1764
+ const ret = wasm.frame_insertGrid(this.__wbg_ptr, ptr0, len0, ptr1);
1765
+ if (ret[1]) {
1766
+ throw takeFromExternrefTable0(ret[0]);
1767
+ }
1768
+ }
1661
1769
  /**
1662
1770
  * Create a new, empty `Frame` with no blocks and no simulation box.
1663
1771
  *
@@ -1700,6 +1808,32 @@ export class Frame {
1700
1808
  throw takeFromExternrefTable0(ret[0]);
1701
1809
  }
1702
1810
  }
1811
+ /**
1812
+ * Remove a named grid from this frame.
1813
+ *
1814
+ * # Arguments
1815
+ *
1816
+ * * `name` — Grid name to remove.
1817
+ *
1818
+ * # Errors
1819
+ *
1820
+ * Throws a `JsValue` string if the frame has been dropped.
1821
+ *
1822
+ * # Example (JavaScript)
1823
+ *
1824
+ * ```js
1825
+ * frame.removeGrid("chgcar");
1826
+ * ```
1827
+ * @param {string} name
1828
+ */
1829
+ removeGrid(name) {
1830
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1831
+ const len0 = WASM_VECTOR_LEN;
1832
+ const ret = wasm.frame_removeGrid(this.__wbg_ptr, ptr0, len0);
1833
+ if (ret[1]) {
1834
+ throw takeFromExternrefTable0(ret[0]);
1835
+ }
1836
+ }
1703
1837
  /**
1704
1838
  * Rename a block from `old_key` to `new_key`.
1705
1839
  *
@@ -1795,7 +1929,7 @@ export class Frame {
1795
1929
  * # Example (JavaScript)
1796
1930
  *
1797
1931
  * ```js
1798
- * const origin = new Float32Array([0, 0, 0]);
1932
+ * const origin = originVec;
1799
1933
  * frame.simbox = Box.cube(10.0, origin, true, true, true);
1800
1934
  * ```
1801
1935
  * @param {Box | null} [simbox]
@@ -1836,6 +1970,306 @@ export class Frame {
1836
1970
  }
1837
1971
  if (Symbol.dispose) Frame.prototype[Symbol.dispose] = Frame.prototype.free;
1838
1972
 
1973
+ /**
1974
+ * A uniform spatial grid storing multiple named scalar arrays.
1975
+ *
1976
+ * All arrays in a `Grid` share the same spatial definition: dimensions
1977
+ * (`[nx, ny, nz]`), Cartesian origin, cell matrix (columns are lattice
1978
+ * vectors, matching VASP/molrs convention), and periodic boundary flags.
1979
+ *
1980
+ * # Example (JavaScript)
1981
+ *
1982
+ * ```js
1983
+ * // Create a 10×10×10 cubic grid
1984
+ * const origin = new Float32Array([0, 0, 0]);
1985
+ * const cell = new Float32Array([
1986
+ * 10, 0, 0, // first column (a vector)
1987
+ * 0,10, 0, // second column (b vector)
1988
+ * 0, 0,10, // third column (c vector)
1989
+ * ]);
1990
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
1991
+ *
1992
+ * // Insert a density array (must have length = 10*10*10 = 1000)
1993
+ * const rho = new Float32Array(1000).fill(1.0);
1994
+ * grid.insertArray("rho", rho);
1995
+ *
1996
+ * // Retrieve it
1997
+ * const arr = grid.getArray("rho");
1998
+ * console.log(arr.toCopy());
1999
+ * ```
2000
+ */
2001
+ export class Grid {
2002
+ static __wrap(ptr) {
2003
+ ptr = ptr >>> 0;
2004
+ const obj = Object.create(Grid.prototype);
2005
+ obj.__wbg_ptr = ptr;
2006
+ GridFinalization.register(obj, obj.__wbg_ptr, obj);
2007
+ return obj;
2008
+ }
2009
+ __destroy_into_raw() {
2010
+ const ptr = this.__wbg_ptr;
2011
+ this.__wbg_ptr = 0;
2012
+ GridFinalization.unregister(this);
2013
+ return ptr;
2014
+ }
2015
+ free() {
2016
+ const ptr = this.__destroy_into_raw();
2017
+ wasm.__wbg_grid_free(ptr, 0);
2018
+ }
2019
+ /**
2020
+ * Names of all scalar arrays stored in this grid.
2021
+ *
2022
+ * # Example (JavaScript)
2023
+ *
2024
+ * ```js
2025
+ * const names = grid.arrayNames(); // e.g. ["rho", "spin"]
2026
+ * ```
2027
+ * @returns {Array<any>}
2028
+ */
2029
+ arrayNames() {
2030
+ const ret = wasm.grid_arrayNames(this.__wbg_ptr);
2031
+ return ret;
2032
+ }
2033
+ /**
2034
+ * Cell matrix in Ångström as a flat array of length 9 in column-major
2035
+ * order (columns are lattice vectors, matching VASP/molrs convention).
2036
+ *
2037
+ * Layout: `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`
2038
+ *
2039
+ * # Example (JavaScript)
2040
+ *
2041
+ * ```js
2042
+ * const c = grid.cell();
2043
+ * const flat = c.toCopy(); // Float32Array of length 9
2044
+ * ```
2045
+ * @returns {WasmArray}
2046
+ */
2047
+ cell() {
2048
+ const ret = wasm.grid_cell(this.__wbg_ptr);
2049
+ return WasmArray.__wrap(ret);
2050
+ }
2051
+ /**
2052
+ * Grid dimensions `[nx, ny, nz]`.
2053
+ *
2054
+ * # Example (JavaScript)
2055
+ *
2056
+ * ```js
2057
+ * console.log(grid.dim()); // [10, 10, 10]
2058
+ * ```
2059
+ * @returns {Uint32Array}
2060
+ */
2061
+ dim() {
2062
+ const ret = wasm.grid_dim(this.__wbg_ptr);
2063
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2064
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2065
+ return v1;
2066
+ }
2067
+ /**
2068
+ * Retrieve a named scalar array as a zero-copy `Float64Array` view
2069
+ * over the underlying WASM memory. Flat row-major order, length
2070
+ * `nx * ny * nz`. Use [`Grid::dim`] for shape.
2071
+ *
2072
+ * **Warning**: the view is invalidated on any WASM memory growth.
2073
+ * Copy it in JS (`new Float64Array(view)`) if it needs to outlive
2074
+ * subsequent allocations.
2075
+ *
2076
+ * Returns `undefined` if the named array does not exist.
2077
+ *
2078
+ * # Example (JavaScript)
2079
+ *
2080
+ * ```js
2081
+ * const view = grid.getArray("rho"); // zero-copy
2082
+ * const copy = new Float64Array(view); // owned copy if needed
2083
+ * ```
2084
+ * @param {string} name
2085
+ * @returns {Float64Array | undefined}
2086
+ */
2087
+ getArray(name) {
2088
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2089
+ const len0 = WASM_VECTOR_LEN;
2090
+ const ret = wasm.grid_getArray(this.__wbg_ptr, ptr0, len0);
2091
+ return ret;
2092
+ }
2093
+ /**
2094
+ * Returns `true` if a named array is present in this grid.
2095
+ *
2096
+ * # Arguments
2097
+ *
2098
+ * * `name` — Array name to look up.
2099
+ *
2100
+ * # Example (JavaScript)
2101
+ *
2102
+ * ```js
2103
+ * grid.hasArray("rho"); // true or false
2104
+ * ```
2105
+ * @param {string} name
2106
+ * @returns {boolean}
2107
+ */
2108
+ hasArray(name) {
2109
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2110
+ const len0 = WASM_VECTOR_LEN;
2111
+ const ret = wasm.grid_hasArray(this.__wbg_ptr, ptr0, len0);
2112
+ return ret !== 0;
2113
+ }
2114
+ /**
2115
+ * Insert (or replace) a named scalar array.
2116
+ *
2117
+ * The provided `data` must have exactly `nx * ny * nz` elements in
2118
+ * row-major `(ix, iy, iz)` order.
2119
+ *
2120
+ * # Arguments
2121
+ *
2122
+ * * `name` — Array name.
2123
+ * * `data` — Float32Array with length equal to `grid.total()`.
2124
+ *
2125
+ * # Errors
2126
+ *
2127
+ * Throws if `data.length != nx * ny * nz`.
2128
+ *
2129
+ * # Example (JavaScript)
2130
+ *
2131
+ * ```js
2132
+ * const rho = new Float32Array(grid.total()).fill(0.5);
2133
+ * grid.insertArray("rho", rho);
2134
+ * ```
2135
+ * @param {string} name
2136
+ * @param {Float64Array} data
2137
+ */
2138
+ insertArray(name, data) {
2139
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
2140
+ const len0 = WASM_VECTOR_LEN;
2141
+ const ptr1 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc_command_export);
2142
+ const len1 = WASM_VECTOR_LEN;
2143
+ const ret = wasm.grid_insertArray(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2144
+ if (ret[1]) {
2145
+ throw takeFromExternrefTable0(ret[0]);
2146
+ }
2147
+ }
2148
+ /**
2149
+ * Returns `true` if no arrays are stored.
2150
+ *
2151
+ * # Example (JavaScript)
2152
+ *
2153
+ * ```js
2154
+ * console.log(grid.isEmpty()); // true for a freshly created grid
2155
+ * ```
2156
+ * @returns {boolean}
2157
+ */
2158
+ isEmpty() {
2159
+ const ret = wasm.grid_isEmpty(this.__wbg_ptr);
2160
+ return ret !== 0;
2161
+ }
2162
+ /**
2163
+ * Number of named arrays stored in this grid.
2164
+ *
2165
+ * # Example (JavaScript)
2166
+ *
2167
+ * ```js
2168
+ * console.log(grid.len()); // e.g. 2
2169
+ * ```
2170
+ * @returns {number}
2171
+ */
2172
+ len() {
2173
+ const ret = wasm.grid_len(this.__wbg_ptr);
2174
+ return ret >>> 0;
2175
+ }
2176
+ /**
2177
+ * Create a new empty grid with the given spatial definition.
2178
+ *
2179
+ * # Arguments
2180
+ *
2181
+ * * `dim_x`, `dim_y`, `dim_z` — Number of grid points along each axis.
2182
+ * * `origin` — Float32Array of length 3: Cartesian origin in Ångström.
2183
+ * * `cell` — Float32Array of length 9: cell matrix in column-major order.
2184
+ * `cell[0..3]` is the first lattice vector (a), `cell[3..6]` is b,
2185
+ * `cell[6..9]` is c (matching VASP/molrs convention where columns are
2186
+ * lattice vectors).
2187
+ * * `pbc_x`, `pbc_y`, `pbc_z` — Periodic boundary flags for each axis.
2188
+ *
2189
+ * # Errors
2190
+ *
2191
+ * Throws if `origin` does not have length 3, or `cell` does not have
2192
+ * length 9.
2193
+ *
2194
+ * # Example (JavaScript)
2195
+ *
2196
+ * ```js
2197
+ * const origin = new Float32Array([0, 0, 0]);
2198
+ * const cell = new Float32Array([10,0,0, 0,10,0, 0,0,10]);
2199
+ * const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
2200
+ * ```
2201
+ * @param {number} dim_x
2202
+ * @param {number} dim_y
2203
+ * @param {number} dim_z
2204
+ * @param {Float64Array} origin
2205
+ * @param {Float64Array} cell
2206
+ * @param {boolean} pbc_x
2207
+ * @param {boolean} pbc_y
2208
+ * @param {boolean} pbc_z
2209
+ */
2210
+ constructor(dim_x, dim_y, dim_z, origin, cell, pbc_x, pbc_y, pbc_z) {
2211
+ const ptr0 = passArrayF64ToWasm0(origin, wasm.__wbindgen_malloc_command_export);
2212
+ const len0 = WASM_VECTOR_LEN;
2213
+ const ptr1 = passArrayF64ToWasm0(cell, wasm.__wbindgen_malloc_command_export);
2214
+ const len1 = WASM_VECTOR_LEN;
2215
+ const ret = wasm.grid_new(dim_x, dim_y, dim_z, ptr0, len0, ptr1, len1, pbc_x, pbc_y, pbc_z);
2216
+ if (ret[2]) {
2217
+ throw takeFromExternrefTable0(ret[1]);
2218
+ }
2219
+ this.__wbg_ptr = ret[0] >>> 0;
2220
+ GridFinalization.register(this, this.__wbg_ptr, this);
2221
+ return this;
2222
+ }
2223
+ /**
2224
+ * Cartesian origin in Ångström as a 1-D array of length 3.
2225
+ *
2226
+ * # Example (JavaScript)
2227
+ *
2228
+ * ```js
2229
+ * const o = grid.origin();
2230
+ * const arr = o.toCopy(); // Float32Array [ox, oy, oz]
2231
+ * ```
2232
+ * @returns {WasmArray}
2233
+ */
2234
+ origin() {
2235
+ const ret = wasm.grid_origin(this.__wbg_ptr);
2236
+ return WasmArray.__wrap(ret);
2237
+ }
2238
+ /**
2239
+ * Periodic boundary flags as a `Uint8Array`-compatible slice.
2240
+ *
2241
+ * Each element is `1` (periodic) or `0` (not periodic).
2242
+ *
2243
+ * # Example (JavaScript)
2244
+ *
2245
+ * ```js
2246
+ * console.log(grid.pbc()); // [1, 1, 1]
2247
+ * ```
2248
+ * @returns {Uint8Array}
2249
+ */
2250
+ pbc() {
2251
+ const ret = wasm.grid_pbc(this.__wbg_ptr);
2252
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2253
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
2254
+ return v1;
2255
+ }
2256
+ /**
2257
+ * Total number of voxels: `nx * ny * nz`.
2258
+ *
2259
+ * # Example (JavaScript)
2260
+ *
2261
+ * ```js
2262
+ * console.log(grid.total()); // 1000 for a 10×10×10 grid
2263
+ * ```
2264
+ * @returns {number}
2265
+ */
2266
+ total() {
2267
+ const ret = wasm.grid_total(this.__wbg_ptr);
2268
+ return ret >>> 0;
2269
+ }
2270
+ }
2271
+ if (Symbol.dispose) Grid.prototype[Symbol.dispose] = Grid.prototype.free;
2272
+
1839
2273
  /**
1840
2274
  * Gyration tensor per cluster.
1841
2275
  *
@@ -1853,10 +2287,10 @@ export class GyrationTensor {
1853
2287
  wasm.__wbg_gyrationtensor_free(ptr, 0);
1854
2288
  }
1855
2289
  /**
1856
- * Compute gyration tensors. Returns flat `Float32Array` (9 values per cluster).
2290
+ * Compute gyration tensors. Returns a flat float typed array (9 values per cluster).
1857
2291
  * @param {Frame} frame
1858
2292
  * @param {ClusterResult} cluster_result
1859
- * @returns {Float32Array}
2293
+ * @returns {Float64Array}
1860
2294
  */
1861
2295
  compute(frame, cluster_result) {
1862
2296
  _assertClass(frame, Frame);
@@ -1865,8 +2299,8 @@ export class GyrationTensor {
1865
2299
  if (ret[3]) {
1866
2300
  throw takeFromExternrefTable0(ret[2]);
1867
2301
  }
1868
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1869
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2302
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2303
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
1870
2304
  return v1;
1871
2305
  }
1872
2306
  constructor() {
@@ -1893,10 +2327,10 @@ export class InertiaTensor {
1893
2327
  wasm.__wbg_inertiatensor_free(ptr, 0);
1894
2328
  }
1895
2329
  /**
1896
- * Compute inertia tensors. Returns flat `Float32Array` (9 values per cluster).
2330
+ * Compute inertia tensors. Returns a flat float typed array (9 values per cluster).
1897
2331
  * @param {Frame} frame
1898
2332
  * @param {ClusterResult} cluster_result
1899
- * @returns {Float32Array}
2333
+ * @returns {Float64Array}
1900
2334
  */
1901
2335
  compute(frame, cluster_result) {
1902
2336
  _assertClass(frame, Frame);
@@ -1905,15 +2339,15 @@ export class InertiaTensor {
1905
2339
  if (ret[3]) {
1906
2340
  throw takeFromExternrefTable0(ret[2]);
1907
2341
  }
1908
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1909
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2342
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2343
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
1910
2344
  return v1;
1911
2345
  }
1912
2346
  /**
1913
- * @param {Float32Array | null} [masses]
2347
+ * @param {Float64Array | null} [masses]
1914
2348
  */
1915
2349
  constructor(masses) {
1916
- var ptr0 = isLikeNone(masses) ? 0 : passArrayF32ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
2350
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
1917
2351
  var len0 = WASM_VECTOR_LEN;
1918
2352
  const ret = wasm.inertiatensor_new(ptr0, len0);
1919
2353
  this.__wbg_ptr = ret >>> 0;
@@ -2006,8 +2440,8 @@ if (Symbol.dispose) LAMMPSDumpReader.prototype[Symbol.dispose] = LAMMPSDumpReade
2006
2440
  * Reads LAMMPS data files (the format written by `write_data`). The
2007
2441
  * reader produces a [`Frame`] containing:
2008
2442
  *
2009
- * - `"atoms"` block: `type` (i32), `x`, `y`, `z` (f32, angstrom),
2010
- * and optionally `charge` (f32)
2443
+ * - `"atoms"` block: `type` (i32), `x`, `y`, `z` (F, angstrom),
2444
+ * and optionally `charge` (F)
2011
2445
  * - `"bonds"` block (if present): `i`, `j` (u32), `type` (i32)
2012
2446
  * - Simulation box (`simbox`) with PBC
2013
2447
  *
@@ -2158,7 +2592,7 @@ export class LinkedCell {
2158
2592
  * Finds all unique pairs `(i < j)` of atoms within the cutoff
2159
2593
  * distance using the cell-list algorithm.
2160
2594
  *
2161
- * The frame must have an `"atoms"` block with `x`, `y`, `z` (f32) columns.
2595
+ * The frame must have an `"atoms"` block with `x`, `y`, `z` (F) columns.
2162
2596
  * If the frame has a `simbox`, periodic boundary conditions are used.
2163
2597
  * Otherwise, a free-boundary bounding box is auto-generated.
2164
2598
  *
@@ -2179,7 +2613,7 @@ export class LinkedCell {
2179
2613
  * ```js
2180
2614
  * const lc = new LinkedCell(3.0);
2181
2615
  * const nlist = lc.build(frame);
2182
- * const dists = nlist.distances(); // Float32Array
2616
+ * const dists = nlist.distances(); // Float32Array or Float64Array
2183
2617
  * ```
2184
2618
  * @param {Frame} frame
2185
2619
  * @returns {NeighborList}
@@ -2306,7 +2740,7 @@ export class MSD {
2306
2740
  * # Arguments
2307
2741
  *
2308
2742
  * * `frame` - Frame with `"atoms"` block containing
2309
- * `x`, `y`, `z` (f32) columns
2743
+ * `x`, `y`, `z` (F) columns
2310
2744
  *
2311
2745
  * # Errors
2312
2746
  *
@@ -2384,7 +2818,7 @@ if (Symbol.dispose) MSD.prototype[Symbol.dispose] = MSD.prototype.free;
2384
2818
  * ```js
2385
2819
  * const result = msd.compute(frame);
2386
2820
  * console.log(result.mean); // number (A^2)
2387
- * console.log(result.perParticle()); // Float32Array (A^2)
2821
+ * console.log(result.perParticle()); // Float32Array or Float64Array (A^2)
2388
2822
  * ```
2389
2823
  */
2390
2824
  export class MSDResult {
@@ -2417,21 +2851,78 @@ export class MSDResult {
2417
2851
  return ret;
2418
2852
  }
2419
2853
  /**
2420
- * Per-particle squared displacements as `Float32Array` in A^2.
2421
- *
2422
- * `perParticle()[i]` is `|r_i(t) - r_i(0)|^2` for particle `i`.
2423
- * Length equals the number of atoms.
2424
- * @returns {Float32Array}
2854
+ * Zero-copy `Float64Array` view of per-particle squared displacements
2855
+ * in A². `perParticle()[i]` is `|r_i(t) - r_i(0)|²` for particle `i`.
2856
+ * **Invalidated** on WASM memory growth; copy in JS if needed.
2857
+ * @returns {Float64Array}
2425
2858
  */
2426
2859
  perParticle() {
2427
2860
  const ret = wasm.msdresult_perParticle(this.__wbg_ptr);
2428
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2429
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2430
- return v1;
2861
+ return ret;
2431
2862
  }
2432
2863
  }
2433
2864
  if (Symbol.dispose) MSDResult.prototype[Symbol.dispose] = MSDResult.prototype.free;
2434
2865
 
2866
+ /**
2867
+ * Reader for MolRec Zarr v3 archives.
2868
+ */
2869
+ export class MolRecReader {
2870
+ __destroy_into_raw() {
2871
+ const ptr = this.__wbg_ptr;
2872
+ this.__wbg_ptr = 0;
2873
+ MolRecReaderFinalization.unregister(this);
2874
+ return ptr;
2875
+ }
2876
+ free() {
2877
+ const ptr = this.__destroy_into_raw();
2878
+ wasm.__wbg_molrecreader_free(ptr, 0);
2879
+ }
2880
+ /**
2881
+ * @returns {number}
2882
+ */
2883
+ countAtoms() {
2884
+ const ret = wasm.molrecreader_countAtoms(this.__wbg_ptr);
2885
+ return ret >>> 0;
2886
+ }
2887
+ /**
2888
+ * @returns {number}
2889
+ */
2890
+ countFrames() {
2891
+ const ret = wasm.molrecreader_countFrames(this.__wbg_ptr);
2892
+ if (ret[2]) {
2893
+ throw takeFromExternrefTable0(ret[1]);
2894
+ }
2895
+ return ret[0] >>> 0;
2896
+ }
2897
+ free() {
2898
+ wasm.molrecreader_free(this.__wbg_ptr);
2899
+ }
2900
+ /**
2901
+ * @param {Map<any, any>} files
2902
+ */
2903
+ constructor(files) {
2904
+ const ret = wasm.molrecreader_new(files);
2905
+ if (ret[2]) {
2906
+ throw takeFromExternrefTable0(ret[1]);
2907
+ }
2908
+ this.__wbg_ptr = ret[0] >>> 0;
2909
+ MolRecReaderFinalization.register(this, this.__wbg_ptr, this);
2910
+ return this;
2911
+ }
2912
+ /**
2913
+ * @param {number} t
2914
+ * @returns {Frame | undefined}
2915
+ */
2916
+ readFrame(t) {
2917
+ const ret = wasm.molrecreader_readFrame(this.__wbg_ptr, t);
2918
+ if (ret[2]) {
2919
+ throw takeFromExternrefTable0(ret[1]);
2920
+ }
2921
+ return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
2922
+ }
2923
+ }
2924
+ if (Symbol.dispose) MolRecReader.prototype[Symbol.dispose] = MolRecReader.prototype.free;
2925
+
2435
2926
  /**
2436
2927
  * Result of a neighbor search: all atom pairs within a distance cutoff.
2437
2928
  *
@@ -2456,7 +2947,7 @@ if (Symbol.dispose) MSDResult.prototype[Symbol.dispose] = MSDResult.prototype.fr
2456
2947
  *
2457
2948
  * const i = nlist.queryPointIndices(); // Uint32Array
2458
2949
  * const j = nlist.pointIndices(); // Uint32Array
2459
- * const d = nlist.distances(); // Float32Array (in A)
2950
+ * const d = nlist.distances(); // Float32Array or Float64Array (in A)
2460
2951
  * ```
2461
2952
  */
2462
2953
  export class NeighborList {
@@ -2478,29 +2969,25 @@ export class NeighborList {
2478
2969
  wasm.__wbg_neighborlist_free(ptr, 0);
2479
2970
  }
2480
2971
  /**
2481
- * Squared pairwise distances in A^2, as a `Float32Array`.
2482
- *
2483
- * More efficient than `distances()` when you only need to
2484
- * compare or threshold distances.
2485
- * @returns {Float32Array}
2972
+ * Zero-copy `Float64Array` view of squared pairwise distances in A^2.
2973
+ * Same invalidation caveat as [`queryPointIndices`](Self::query_point_indices).
2974
+ * @returns {Float64Array}
2486
2975
  */
2487
2976
  distSq() {
2488
2977
  const ret = wasm.neighborlist_distSq(this.__wbg_ptr);
2489
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2490
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2491
- return v1;
2978
+ return ret;
2492
2979
  }
2493
2980
  /**
2494
- * Pairwise distances in angstrom (A), as a `Float32Array`.
2981
+ * Pairwise distances in angstrom (A). Computed lazily from `distSq`.
2495
2982
  *
2496
- * `distances()[k]` is the distance between query point
2497
- * `queryPointIndices()[k]` and reference point `pointIndices()[k]`.
2498
- * @returns {Float32Array}
2983
+ * Returns an owned copy because distances are derived on the fly
2984
+ * (`sqrt` per pair) rather than stored.
2985
+ * @returns {Float64Array}
2499
2986
  */
2500
2987
  distances() {
2501
2988
  const ret = wasm.neighborlist_distances(this.__wbg_ptr);
2502
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2503
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2989
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2990
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
2504
2991
  return v1;
2505
2992
  }
2506
2993
  /**
@@ -2540,27 +3027,23 @@ export class NeighborList {
2540
3027
  return ret >>> 0;
2541
3028
  }
2542
3029
  /**
2543
- * Reference point indices (`j`) for each pair, as a `Uint32Array`.
3030
+ * Zero-copy `Uint32Array` view of reference point indices (`j`).
3031
+ * Same invalidation caveat as [`queryPointIndices`](Self::query_point_indices).
2544
3032
  * @returns {Uint32Array}
2545
3033
  */
2546
3034
  pointIndices() {
2547
3035
  const ret = wasm.neighborlist_pointIndices(this.__wbg_ptr);
2548
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2549
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2550
- return v1;
3036
+ return ret;
2551
3037
  }
2552
3038
  /**
2553
- * Query point indices (`i`) for each pair, as a `Uint32Array`.
2554
- *
2555
- * The `k`-th pair connects query point `queryPointIndices()[k]`
2556
- * to reference point `pointIndices()[k]`.
3039
+ * Zero-copy `Uint32Array` view of query point indices (`i`) over
3040
+ * WASM memory. **Invalidated** on any WASM memory growth — copy
3041
+ * in JS (`new Uint32Array(view)`) if it needs to outlive later calls.
2557
3042
  * @returns {Uint32Array}
2558
3043
  */
2559
3044
  queryPointIndices() {
2560
3045
  const ret = wasm.neighborlist_queryPointIndices(this.__wbg_ptr);
2561
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
2562
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2563
- return v1;
3046
+ return ret;
2564
3047
  }
2565
3048
  }
2566
3049
  if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.prototype.free;
@@ -2570,8 +3053,8 @@ if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.protot
2570
3053
  *
2571
3054
  * PDB files contain a single molecular structure. The reader produces
2572
3055
  * a [`Frame`] with an `"atoms"` block containing columns such as
2573
- * `name` (string), `resname` (string), `x`, `y`, `z` (f32, angstrom),
2574
- * and optionally `occupancy` and `bfactor` (f32).
3056
+ * `name` (string), `resname` (string), `x`, `y`, `z` (F, angstrom),
3057
+ * and optionally `occupancy` and `bfactor` (F).
2575
3058
  *
2576
3059
  * # Example (JavaScript)
2577
3060
  *
@@ -2580,7 +3063,7 @@ if (Symbol.dispose) NeighborList.prototype[Symbol.dispose] = NeighborList.protot
2580
3063
  * const frame = reader.read(0);
2581
3064
  * const atoms = frame.getBlock("atoms");
2582
3065
  * const names = atoms.copyColStr("name"); // ["CA", "CB", ...]
2583
- * const x = atoms.copyColF32("x");
3066
+ * const x = atoms.copyColF("x");
2584
3067
  * ```
2585
3068
  */
2586
3069
  export class PDBReader {
@@ -2705,8 +3188,8 @@ if (Symbol.dispose) PDBReader.prototype[Symbol.dispose] = PDBReader.prototype.fr
2705
3188
  * const rdf = new RDF(100, 5.0);
2706
3189
  * const result = rdf.compute(frame, nlist);
2707
3190
  *
2708
- * const r = result.binCenters(); // Float32Array, bin centers in A
2709
- * const gr = result.rdf(); // Float32Array, g(r) values
3191
+ * const r = result.binCenters(); // Float32Array or Float64Array, bin centers in A
3192
+ * const gr = result.rdf(); // Float32Array or Float64Array, g(r) values
2710
3193
  * ```
2711
3194
  */
2712
3195
  export class RDF {
@@ -2744,7 +3227,7 @@ export class RDF {
2744
3227
  *
2745
3228
  * ```js
2746
3229
  * const result = rdf.compute(frame, nlist);
2747
- * const gr = result.rdf(); // Float32Array
3230
+ * const gr = result.rdf(); // Float32Array or Float64Array
2748
3231
  * ```
2749
3232
  * @param {Frame} frame
2750
3233
  * @param {NeighborList} neighbors
@@ -2795,9 +3278,9 @@ if (Symbol.dispose) RDF.prototype[Symbol.dispose] = RDF.prototype.free;
2795
3278
  *
2796
3279
  * ```js
2797
3280
  * const result = rdf.compute(frame, nlist);
2798
- * const r = result.binCenters(); // Float32Array [0.025, 0.075, ...]
2799
- * const gr = result.rdf(); // Float32Array, normalized g(r)
2800
- * const nr = result.pairCounts(); // Float32Array, raw counts
3281
+ * const r = result.binCenters(); // Float32Array or Float64Array [0.025, 0.075, ...]
3282
+ * const gr = result.rdf(); // Float32Array or Float64Array, normalized g(r)
3283
+ * const nr = result.pairCounts(); // Float32Array or Float64Array, raw counts
2801
3284
  * console.log("Volume:", result.volume, "A^3");
2802
3285
  * console.log("N_ref:", result.numPoints);
2803
3286
  * ```
@@ -2821,28 +3304,23 @@ export class RDFResult {
2821
3304
  wasm.__wbg_rdfresult_free(ptr, 0);
2822
3305
  }
2823
3306
  /**
2824
- * Bin center positions as `Float32Array` in angstrom (A).
2825
- *
2826
- * Length equals `n_bins` (the value passed to the `RDF` constructor).
2827
- * @returns {Float32Array}
3307
+ * Zero-copy `Float64Array` view of bin center positions in A.
3308
+ * Length equals `n_bins`. **Invalidated** on WASM memory growth;
3309
+ * copy in JS if it needs to outlive later calls.
3310
+ * @returns {Float64Array}
2828
3311
  */
2829
3312
  binCenters() {
2830
3313
  const ret = wasm.rdfresult_binCenters(this.__wbg_ptr);
2831
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2832
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2833
- return v1;
3314
+ return ret;
2834
3315
  }
2835
3316
  /**
2836
- * Bin edge positions as `Float32Array` in angstrom (A).
2837
- *
2838
- * Length is `n_bins + 1` (one more than bin centers).
2839
- * @returns {Float32Array}
3317
+ * Zero-copy `Float64Array` view of bin edge positions in A.
3318
+ * Length is `n_bins + 1`. Same invalidation caveat.
3319
+ * @returns {Float64Array}
2840
3320
  */
2841
3321
  binEdges() {
2842
3322
  const ret = wasm.rdfresult_binEdges(this.__wbg_ptr);
2843
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2844
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2845
- return v1;
3323
+ return ret;
2846
3324
  }
2847
3325
  /**
2848
3326
  * Number of reference points used in the normalization.
@@ -2853,27 +3331,22 @@ export class RDFResult {
2853
3331
  return ret >>> 0;
2854
3332
  }
2855
3333
  /**
2856
- * Raw (un-normalized) pair counts per bin as `Float32Array`.
2857
- * @returns {Float32Array}
3334
+ * Zero-copy `Float64Array` view of raw (un-normalized) pair counts
3335
+ * per bin. Same invalidation caveat.
3336
+ * @returns {Float64Array}
2858
3337
  */
2859
3338
  pairCounts() {
2860
3339
  const ret = wasm.rdfresult_pairCounts(this.__wbg_ptr);
2861
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2862
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2863
- return v1;
3340
+ return ret;
2864
3341
  }
2865
3342
  /**
2866
- * Normalized g(r) values as `Float32Array` (dimensionless).
2867
- *
2868
- * A uniform ideal gas has g(r) = 1.0 everywhere. Peaks indicate
2869
- * preferred interatomic distances (coordination shells).
2870
- * @returns {Float32Array}
3343
+ * Zero-copy `Float64Array` view of normalized g(r). Same invalidation
3344
+ * caveat.
3345
+ * @returns {Float64Array}
2871
3346
  */
2872
3347
  rdf() {
2873
3348
  const ret = wasm.rdfresult_rdf(this.__wbg_ptr);
2874
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2875
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
2876
- return v1;
3349
+ return ret;
2877
3350
  }
2878
3351
  /**
2879
3352
  * Simulation box volume used in the normalization, in A^3.
@@ -2901,10 +3374,10 @@ export class RadiusOfGyration {
2901
3374
  wasm.__wbg_radiusofgyration_free(ptr, 0);
2902
3375
  }
2903
3376
  /**
2904
- * Compute radii of gyration. Returns `Float32Array` of length `numClusters`.
3377
+ * Compute radii of gyration. Returns a float typed array of length `numClusters`.
2905
3378
  * @param {Frame} frame
2906
3379
  * @param {ClusterResult} cluster_result
2907
- * @returns {Float32Array}
3380
+ * @returns {Float64Array}
2908
3381
  */
2909
3382
  compute(frame, cluster_result) {
2910
3383
  _assertClass(frame, Frame);
@@ -2913,15 +3386,15 @@ export class RadiusOfGyration {
2913
3386
  if (ret[3]) {
2914
3387
  throw takeFromExternrefTable0(ret[2]);
2915
3388
  }
2916
- var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2917
- wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
3389
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3390
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
2918
3391
  return v1;
2919
3392
  }
2920
3393
  /**
2921
- * @param {Float32Array | null} [masses]
3394
+ * @param {Float64Array | null} [masses]
2922
3395
  */
2923
3396
  constructor(masses) {
2924
- var ptr0 = isLikeNone(masses) ? 0 : passArrayF32ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
3397
+ var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
2925
3398
  var len0 = WASM_VECTOR_LEN;
2926
3399
  const ret = wasm.radiusofgyration_new(ptr0, len0);
2927
3400
  this.__wbg_ptr = ret >>> 0;
@@ -2932,150 +3405,90 @@ export class RadiusOfGyration {
2932
3405
  if (Symbol.dispose) RadiusOfGyration.prototype[Symbol.dispose] = RadiusOfGyration.prototype.free;
2933
3406
 
2934
3407
  /**
2935
- * Reader for Zarr V3 simulation archives.
3408
+ * MDL molfile / SDF (V2000 CTAB) reader.
3409
+ *
3410
+ * Parses the connection table found in `.mol` files and the record
3411
+ * blocks of `.sdf` files. Coordinates come directly from the file —
3412
+ * no 3D generation is performed. Only V2000 is supported; V3000
3413
+ * records throw on read.
2936
3414
  *
2937
- * Wraps [`SimulationStore`] from `molrs-core` for reading trajectory
2938
- * frames and system metadata from an in-memory Zarr store. The store
2939
- * is populated from a `Map<string, Uint8Array>` of file paths to
2940
- * binary content.
3415
+ * Produces a [`Frame`] with:
3416
+ * - `"atoms"` block: `element` (string), `id` (u32, 1-based),
3417
+ * `x`, `y`, `z` (F, angstrom)
3418
+ * - `"bonds"` block (if present): `atomi`, `atomj` (u32, 0-based),
3419
+ * `order` (u32)
3420
+ *
3421
+ * Multi-record SDF files expose each record as a separate frame via
3422
+ * `read(step)`.
2941
3423
  *
2942
3424
  * # Example (JavaScript)
2943
3425
  *
2944
3426
  * ```js
2945
- * const files = new Map();
2946
- * files.set("zarr.json", new Uint8Array([...]));
2947
- * files.set("system/.zarray", new Uint8Array([...]));
2948
- * // ... etc.
2949
- *
2950
- * const reader = new SimulationReader(files);
2951
- * const frame = reader.readFrame(0);
3427
+ * const reader = new SDFReader(sdfContent);
3428
+ * const frame = reader.read(0);
3429
+ * const atoms = frame.getBlock("atoms");
3430
+ * const x = atoms.copyColF("x");
2952
3431
  * ```
2953
3432
  */
2954
- export class SimulationReader {
3433
+ export class SDFReader {
2955
3434
  __destroy_into_raw() {
2956
3435
  const ptr = this.__wbg_ptr;
2957
3436
  this.__wbg_ptr = 0;
2958
- SimulationReaderFinalization.unregister(this);
3437
+ SDFReaderFinalization.unregister(this);
2959
3438
  return ptr;
2960
3439
  }
2961
3440
  free() {
2962
3441
  const ptr = this.__destroy_into_raw();
2963
- wasm.__wbg_simulationreader_free(ptr, 0);
3442
+ wasm.__wbg_sdfreader_free(ptr, 0);
2964
3443
  }
2965
3444
  /**
2966
- * Return the number of atoms in the system topology.
2967
- *
2968
- * # Example (JavaScript)
2969
- *
2970
- * ```js
2971
- * console.log(reader.countAtoms()); // e.g., 256
2972
- * ```
2973
- * @returns {number}
3445
+ * Check whether the file contains no records.
3446
+ * @returns {boolean}
2974
3447
  */
2975
- countAtoms() {
2976
- const ret = wasm.simulationreader_countAtoms(this.__wbg_ptr);
2977
- return ret >>> 0;
3448
+ isEmpty() {
3449
+ const ret = wasm.sdfreader_isEmpty(this.__wbg_ptr);
3450
+ if (ret[2]) {
3451
+ throw takeFromExternrefTable0(ret[1]);
3452
+ }
3453
+ return ret[0] !== 0;
2978
3454
  }
2979
3455
  /**
2980
- * Return the number of trajectory frames in the archive.
2981
- *
2982
- * Returns `0` if no trajectory data is present.
2983
- *
2984
- * # Errors
2985
- *
2986
- * Throws a `JsValue` string on I/O errors.
2987
- *
2988
- * # Example (JavaScript)
2989
- *
2990
- * ```js
2991
- * console.log(reader.countFrames()); // e.g., 1000
2992
- * ```
3456
+ * Return the total number of records in the SDF file.
2993
3457
  * @returns {number}
2994
3458
  */
2995
- countFrames() {
2996
- const ret = wasm.simulationreader_countFrames(this.__wbg_ptr);
3459
+ len() {
3460
+ const ret = wasm.sdfreader_len(this.__wbg_ptr);
2997
3461
  if (ret[2]) {
2998
3462
  throw takeFromExternrefTable0(ret[1]);
2999
3463
  }
3000
3464
  return ret[0] >>> 0;
3001
3465
  }
3002
3466
  /**
3003
- * Create a reader from a map of file paths to binary content.
3004
- *
3005
- * The map keys are relative paths within the Zarr archive
3006
- * (e.g., `"zarr.json"`, `"system/.zarray"`). Values are the
3007
- * raw bytes of each file as `Uint8Array`.
3008
- *
3009
- * # Arguments
3010
- *
3011
- * * `files` - `Map<string, Uint8Array>` mapping archive paths
3012
- * to their binary content
3013
- *
3014
- * # Returns
3015
- *
3016
- * A new `SimulationReader` ready to read frames.
3017
- *
3018
- * # Errors
3019
- *
3020
- * Throws a `JsValue` string if the archive cannot be opened
3021
- * (e.g., missing required metadata files).
3022
- *
3023
- * # Example (JavaScript)
3024
- *
3025
- * ```js
3026
- * const reader = new SimulationReader(filesMap);
3027
- * ```
3028
- * @param {Map<any, any>} files
3467
+ * Create a new SDF reader from a string containing the file content.
3468
+ * @param {string} content
3029
3469
  */
3030
- constructor(files) {
3031
- const ret = wasm.simulationreader_new(files);
3032
- if (ret[2]) {
3033
- throw takeFromExternrefTable0(ret[1]);
3034
- }
3035
- this.__wbg_ptr = ret[0] >>> 0;
3036
- SimulationReaderFinalization.register(this, this.__wbg_ptr, this);
3470
+ constructor(content) {
3471
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
3472
+ const len0 = WASM_VECTOR_LEN;
3473
+ const ret = wasm.sdfreader_new(ptr0, len0);
3474
+ this.__wbg_ptr = ret >>> 0;
3475
+ SDFReaderFinalization.register(this, this.__wbg_ptr, this);
3037
3476
  return this;
3038
3477
  }
3039
3478
  /**
3040
- * Read a trajectory frame at the given time index.
3041
- *
3042
- * The returned [`Frame`] merges the static system topology
3043
- * (atoms, bonds) with the per-frame trajectory data (positions,
3044
- * velocities, etc.) at time step `t`.
3045
- *
3046
- * # Arguments
3047
- *
3048
- * * `t` - Zero-based time step index
3049
- *
3050
- * # Returns
3051
- *
3052
- * A [`Frame`] with merged system + trajectory data, or `undefined`
3053
- * if no trajectory is present.
3054
- *
3055
- * # Errors
3056
- *
3057
- * Throws a `JsValue` string on I/O or deserialization errors.
3058
- *
3059
- * # Example (JavaScript)
3060
- *
3061
- * ```js
3062
- * const frame = reader.readFrame(0);
3063
- * if (frame) {
3064
- * const x = frame.getBlock("atoms").copyColF32("x");
3065
- * }
3066
- * ```
3067
- * @param {number} t
3479
+ * Read the frame (SDF record) at the given step index.
3480
+ * @param {number} step
3068
3481
  * @returns {Frame | undefined}
3069
3482
  */
3070
- readFrame(t) {
3071
- const ret = wasm.simulationreader_readFrame(this.__wbg_ptr, t);
3483
+ read(step) {
3484
+ const ret = wasm.sdfreader_read(this.__wbg_ptr, step);
3072
3485
  if (ret[2]) {
3073
3486
  throw takeFromExternrefTable0(ret[1]);
3074
3487
  }
3075
3488
  return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
3076
3489
  }
3077
3490
  }
3078
- if (Symbol.dispose) SimulationReader.prototype[Symbol.dispose] = SimulationReader.prototype.free;
3491
+ if (Symbol.dispose) SDFReader.prototype[Symbol.dispose] = SDFReader.prototype.free;
3079
3492
 
3080
3493
  /**
3081
3494
  * Intermediate representation of a parsed SMILES string.
@@ -3095,7 +3508,7 @@ if (Symbol.dispose) SimulationReader.prototype[Symbol.dispose] = SimulationReade
3095
3508
  *
3096
3509
  * const frame = ir.toFrame();
3097
3510
  * const atoms = frame.getBlock("atoms");
3098
- * console.log(atoms.copyColStr("symbol")); // ["C", "C", "O", "H", ...]
3511
+ * console.log(atoms.copyColStr("element")); // ["C", "C", "O", "H", ...]
3099
3512
  * ```
3100
3513
  */
3101
3514
  export class SmilesIR {
@@ -3143,7 +3556,7 @@ export class SmilesIR {
3143
3556
  * are added. No 3D coordinates are present -- use
3144
3557
  * [`generate3D`](crate::generate_3d_wasm) to embed coordinates.
3145
3558
  * - `"bonds"` block: `i`, `j` (u32, zero-based atom indices),
3146
- * `order` (f32, bond order: 1.0 = single, 1.5 = aromatic,
3559
+ * `order` (F, bond order: 1.0 = single, 1.5 = aromatic,
3147
3560
  * 2.0 = double, 3.0 = triple).
3148
3561
  *
3149
3562
  * # Returns
@@ -3160,7 +3573,7 @@ export class SmilesIR {
3160
3573
  * ```js
3161
3574
  * const frame = ir.toFrame();
3162
3575
  * const bonds = frame.getBlock("bonds");
3163
- * const order = bonds.copyColF32("order");
3576
+ * const order = bonds.copyColF("order");
3164
3577
  * ```
3165
3578
  * @returns {Frame}
3166
3579
  */
@@ -3495,26 +3908,26 @@ export class TopologyRingInfo {
3495
3908
  if (Symbol.dispose) TopologyRingInfo.prototype[Symbol.dispose] = TopologyRingInfo.prototype.free;
3496
3909
 
3497
3910
  /**
3498
- * Owned f32 array with ndarray-compatible shape metadata.
3911
+ * Owned float array with ndarray-compatible shape metadata.
3499
3912
  *
3500
- * Stores a flat `Vec<f32>` together with a shape descriptor (e.g.,
3913
+ * Stores a flat `Vec<F>` together with a shape descriptor (e.g.,
3501
3914
  * `[N, 3]` for an Nx3 coordinate matrix). Used for passing
3502
3915
  * multi-dimensional numeric data across the WASM boundary.
3503
3916
  *
3504
3917
  * # Memory layout
3505
3918
  *
3506
3919
  * Data is stored in row-major (C) order, matching ndarray's default
3507
- * and JavaScript's `Float32Array` convention.
3920
+ * and JavaScript's float typed-array convention.
3508
3921
  *
3509
3922
  * # Example (JavaScript)
3510
3923
  *
3511
3924
  * ```js
3512
3925
  * // Create a 2x3 zero array
3513
3926
  * const arr = new WasmArray([2, 3]);
3514
- * arr.writeFrom(new Float32Array([1,2,3, 4,5,6]));
3927
+ * arr.writeFrom(floatArray);
3515
3928
  *
3516
3929
  * // Or from existing data
3517
- * const arr2 = WasmArray.from(new Float32Array([1,2,3]), [1, 3]);
3930
+ * const arr2 = WasmArray.from(floatArray, [1, 3]);
3518
3931
  *
3519
3932
  * // Get data back
3520
3933
  * const copy = arr.toCopy(); // safe owned copy
@@ -3540,7 +3953,7 @@ export class WasmArray {
3540
3953
  wasm.__wbg_wasmarray_free(ptr, 0);
3541
3954
  }
3542
3955
  /**
3543
- * Return the data type string. Always `"float"` for `WasmArray`.
3956
+ * Return the concrete float dtype string for this build.
3544
3957
  * @returns {string}
3545
3958
  */
3546
3959
  dtype() {
@@ -3556,11 +3969,11 @@ export class WasmArray {
3556
3969
  }
3557
3970
  }
3558
3971
  /**
3559
- * Create a `WasmArray` from an existing JS `Float32Array`.
3972
+ * Create a `WasmArray` from an existing JS float typed array.
3560
3973
  *
3561
3974
  * # Arguments
3562
3975
  *
3563
- * * `data` - Source `Float32Array`
3976
+ * * `data` - Source float typed array (`Float32Array` or `Float64Array`)
3564
3977
  * * `shape` - Optional shape. If omitted, defaults to `[data.length]` (1D).
3565
3978
  *
3566
3979
  * # Returns
@@ -3574,10 +3987,10 @@ export class WasmArray {
3574
3987
  * # Example (JavaScript)
3575
3988
  *
3576
3989
  * ```js
3577
- * const arr = WasmArray.from(new Float32Array([1,2,3,4,5,6]), [2, 3]);
3990
+ * const arr = WasmArray.from(floatArray, [2, 3]);
3578
3991
  * console.log(arr.shape()); // [2, 3]
3579
3992
  * ```
3580
- * @param {Float32Array} data
3993
+ * @param {Float64Array} data
3581
3994
  * @param {Uint32Array | null} [shape]
3582
3995
  * @returns {WasmArray}
3583
3996
  */
@@ -3675,7 +4088,7 @@ export class WasmArray {
3675
4088
  * # Example (JavaScript)
3676
4089
  *
3677
4090
  * ```js
3678
- * const arr = WasmArray.from(new Float32Array([1, 2, 3]));
4091
+ * const arr = WasmArray.from(floatArray);
3679
4092
  * console.log(arr.sum()); // 6.0
3680
4093
  * ```
3681
4094
  * @returns {number}
@@ -3685,7 +4098,7 @@ export class WasmArray {
3685
4098
  return ret;
3686
4099
  }
3687
4100
  /**
3688
- * Create an owned JS `Float32Array` copy of the data.
4101
+ * Create an owned JS float typed-array copy of the data.
3689
4102
  *
3690
4103
  * The returned array is an independent copy that is safe to store
3691
4104
  * and use regardless of subsequent WASM memory operations.
@@ -3695,14 +4108,14 @@ export class WasmArray {
3695
4108
  * ```js
3696
4109
  * const copy = arr.toCopy(); // safe to keep indefinitely
3697
4110
  * ```
3698
- * @returns {Float32Array}
4111
+ * @returns {Float64Array}
3699
4112
  */
3700
4113
  toCopy() {
3701
4114
  const ret = wasm.wasmarray_toCopy(this.__wbg_ptr);
3702
4115
  return ret;
3703
4116
  }
3704
4117
  /**
3705
- * Zero-copy `Float32Array` view over this array's backing storage.
4118
+ * Zero-copy float typed-array view over this array's backing storage.
3706
4119
  *
3707
4120
  * **Warning**: The returned view becomes **invalid** if WASM linear
3708
4121
  * memory grows (due to any allocation). Use [`toCopy`](WasmArray::to_copy)
@@ -3710,7 +4123,8 @@ export class WasmArray {
3710
4123
  *
3711
4124
  * # Safety (internal)
3712
4125
  *
3713
- * Uses `Float32Array::view` which creates an unowned view into
4126
+ * Uses the corresponding JS float typed-array `view` constructor,
4127
+ * which creates an unowned view into
3714
4128
  * WASM memory. The view must not outlive the `WasmArray` and must
3715
4129
  * not be used after any allocation that could trigger memory growth.
3716
4130
  *
@@ -3720,21 +4134,21 @@ export class WasmArray {
3720
4134
  * const view = arr.toTypedArray(); // use immediately
3721
4135
  * // Do NOT allocate between view creation and use
3722
4136
  * ```
3723
- * @returns {Float32Array}
4137
+ * @returns {Float64Array}
3724
4138
  */
3725
4139
  toTypedArray() {
3726
4140
  const ret = wasm.wasmarray_toTypedArray(this.__wbg_ptr);
3727
4141
  return ret;
3728
4142
  }
3729
4143
  /**
3730
- * Overwrite the array contents from a JS `Float32Array`.
4144
+ * Overwrite the array contents from a JS float typed array.
3731
4145
  *
3732
4146
  * The source array must have exactly the same number of elements
3733
4147
  * as this `WasmArray` (i.e., the shape is preserved).
3734
4148
  *
3735
4149
  * # Arguments
3736
4150
  *
3737
- * * `arr` - Source `Float32Array` with matching length
4151
+ * * `arr` - Source float typed array with matching length
3738
4152
  *
3739
4153
  * # Errors
3740
4154
  *
@@ -3744,9 +4158,9 @@ export class WasmArray {
3744
4158
  *
3745
4159
  * ```js
3746
4160
  * const wa = new WasmArray([3]);
3747
- * wa.writeFrom(new Float32Array([1.0, 2.0, 3.0]));
4161
+ * wa.writeFrom(floatArray);
3748
4162
  * ```
3749
- * @param {Float32Array} arr
4163
+ * @param {Float64Array} arr
3750
4164
  */
3751
4165
  write_from(arr) {
3752
4166
  const ret = wasm.wasmarray_write_from(this.__wbg_ptr, arr);
@@ -3762,7 +4176,7 @@ if (Symbol.dispose) WasmArray.prototype[Symbol.dispose] = WasmArray.prototype.fr
3762
4176
  *
3763
4177
  * Supports multi-frame trajectory files. Each frame produces a
3764
4178
  * [`Frame`] with an `"atoms"` block containing `element` (string)
3765
- * and `x`, `y`, `z` (f32, coordinates in angstrom) columns.
4179
+ * and `x`, `y`, `z` (F, coordinates in angstrom) columns.
3766
4180
  *
3767
4181
  * # Example (JavaScript)
3768
4182
  *
@@ -3773,7 +4187,7 @@ if (Symbol.dispose) WasmArray.prototype[Symbol.dispose] = WasmArray.prototype.fr
3773
4187
  *
3774
4188
  * const frame = reader.read(0); // first frame
3775
4189
  * const atoms = frame.getBlock("atoms");
3776
- * const x = atoms.copyColF32("x");
4190
+ * const x = atoms.copyColF("x");
3777
4191
  * ```
3778
4192
  */
3779
4193
  export class XYZReader {
@@ -3889,13 +4303,13 @@ if (Symbol.dispose) XYZReader.prototype[Symbol.dispose] = XYZReader.prototype.fr
3889
4303
  /**
3890
4304
  * Generate 3D coordinates for a molecular [`Frame`].
3891
4305
  *
3892
- * The input frame must have an `"atoms"` block with a `"symbol"`
4306
+ * The input frame must have an `"atoms"` block with a `"element"`
3893
4307
  * string column (element symbols like `"C"`, `"N"`, `"O"`). A
3894
- * `"bonds"` block with `i`, `j` (u32) and `order` (f32) columns
4308
+ * `"bonds"` block with `i`, `j` (u32) and `order` (F) columns
3895
4309
  * is required for correct geometry.
3896
4310
  *
3897
4311
  * Returns a **new** [`Frame`] with 3D coordinates added as `x`, `y`,
3898
- * `z` (f32, angstrom) columns in the `"atoms"` block.
4312
+ * `z` (F, angstrom) columns in the `"atoms"` block.
3899
4313
  *
3900
4314
  * # Arguments
3901
4315
  *
@@ -3928,9 +4342,9 @@ if (Symbol.dispose) XYZReader.prototype[Symbol.dispose] = XYZReader.prototype.fr
3928
4342
  * const frame3d = generate3D(frame2d, "fast", 42);
3929
4343
  *
3930
4344
  * const atoms = frame3d.getBlock("atoms");
3931
- * const x = atoms.copyColF32("x"); // Float32Array with 3D x-coords
3932
- * const y = atoms.copyColF32("y");
3933
- * const z = atoms.copyColF32("z");
4345
+ * const x = atoms.copyColF("x"); // Float32Array or Float64Array with 3D x-coords
4346
+ * const y = atoms.copyColF("y");
4347
+ * const z = atoms.copyColF("z");
3934
4348
  * ```
3935
4349
  * @param {Frame} frame
3936
4350
  * @param {string | null} [speed]
@@ -4007,7 +4421,7 @@ export function start() {
4007
4421
  *
4008
4422
  * ```js
4009
4423
  * const mem = wasmMemory();
4010
- * const buf = new Float32Array(mem.buffer, ptr, len);
4424
+ * const buf = new Float64Array(mem.buffer, ptr, len); // or Float32Array in default builds
4011
4425
  * ```
4012
4426
  * @returns {WebAssembly.Memory}
4013
4427
  */
@@ -4078,18 +4492,18 @@ export function writeFrame(frame, format) {
4078
4492
  wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
4079
4493
  }
4080
4494
  }
4081
- export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
4495
+ export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
4082
4496
  const ret = debugString(arg1);
4083
4497
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
4084
4498
  const len1 = WASM_VECTOR_LEN;
4085
4499
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4086
4500
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4087
4501
  }
4088
- export function __wbg___wbindgen_memory_edb3f01e3930bbf6() {
4502
+ export function __wbg___wbindgen_memory_dfa12096f400c9bd() {
4089
4503
  const ret = wasm.memory;
4090
4504
  return ret;
4091
4505
  }
4092
- export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
4506
+ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
4093
4507
  const obj = arg1;
4094
4508
  const ret = typeof(obj) === 'string' ? obj : undefined;
4095
4509
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -4097,10 +4511,10 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
4097
4511
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4098
4512
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4099
4513
  }
4100
- export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
4514
+ export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
4101
4515
  throw new Error(getStringFromWasm0(arg0, arg1));
4102
4516
  }
4103
- export function __wbg_done_08ce71ee07e3bd17(arg0) {
4517
+ export function __wbg_done_9158f7cc8751ba32(arg0) {
4104
4518
  const ret = arg0.done;
4105
4519
  return ret;
4106
4520
  }
@@ -4118,35 +4532,35 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
4118
4532
  export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
4119
4533
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
4120
4534
  }, arguments); }
4121
- export function __wbg_get_10ee87d86a58fb49(arg0, arg1) {
4535
+ export function __wbg_get_ef70f6ce70a05af6(arg0, arg1) {
4122
4536
  const ret = arg0.get(arg1);
4123
4537
  return ret;
4124
4538
  }
4125
- export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
4539
+ export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
4126
4540
  const ret = arg0[arg1 >>> 0];
4127
4541
  return ret;
4128
4542
  }
4129
- export function __wbg_keys_3fff7686656d707e(arg0) {
4543
+ export function __wbg_keys_7fc58fd5f4899356(arg0) {
4130
4544
  const ret = arg0.keys();
4131
4545
  return ret;
4132
4546
  }
4133
- export function __wbg_length_259ee9d041e381ad(arg0) {
4547
+ export function __wbg_length_3d4ecd04bd8d22f1(arg0) {
4134
4548
  const ret = arg0.length;
4135
4549
  return ret;
4136
4550
  }
4137
- export function __wbg_length_27280eca2d70010e(arg0) {
4551
+ export function __wbg_length_7da87610a31a2ef9(arg0) {
4138
4552
  const ret = arg0.length;
4139
4553
  return ret;
4140
4554
  }
4141
- export function __wbg_length_76eefdd571f24b00(arg0) {
4555
+ export function __wbg_length_9f1775224cf1d815(arg0) {
4142
4556
  const ret = arg0.length;
4143
4557
  return ret;
4144
4558
  }
4145
- export function __wbg_length_b3416cf66a5452c8(arg0) {
4559
+ export function __wbg_length_d807629e96c741b8(arg0) {
4146
4560
  const ret = arg0.length;
4147
4561
  return ret;
4148
4562
  }
4149
- export function __wbg_length_ea16607d7b61445b(arg0) {
4563
+ export function __wbg_length_fab29957ea6bdb8c(arg0) {
4150
4564
  const ret = arg0.length;
4151
4565
  return ret;
4152
4566
  }
@@ -4154,47 +4568,47 @@ export function __wbg_msdresult_new(arg0) {
4154
4568
  const ret = MSDResult.__wrap(arg0);
4155
4569
  return ret;
4156
4570
  }
4157
- export function __wbg_new_227d7c05414eb861() {
4158
- const ret = new Error();
4571
+ export function __wbg_new_0c7403db6e782f19(arg0) {
4572
+ const ret = new Uint8Array(arg0);
4159
4573
  return ret;
4160
4574
  }
4161
- export function __wbg_new_5f486cdf45a04d78(arg0) {
4162
- const ret = new Uint8Array(arg0);
4575
+ export function __wbg_new_227d7c05414eb861() {
4576
+ const ret = new Error();
4163
4577
  return ret;
4164
4578
  }
4165
- export function __wbg_new_a70fbab9066b301f() {
4579
+ export function __wbg_new_682678e2f47e32bc() {
4166
4580
  const ret = new Array();
4167
4581
  return ret;
4168
4582
  }
4169
- export function __wbg_new_from_slice_898ac63cbd46f332(arg0, arg1) {
4583
+ export function __wbg_new_from_slice_01793f7edd3b321a(arg0, arg1) {
4170
4584
  const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
4171
4585
  return ret;
4172
4586
  }
4173
- export function __wbg_new_from_slice_c62f8165d6102476(arg0, arg1) {
4174
- const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
4587
+ export function __wbg_new_from_slice_3115b094b1002246(arg0, arg1) {
4588
+ const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
4175
4589
  return ret;
4176
4590
  }
4177
- export function __wbg_new_from_slice_ff2c15e8e05ffdfc(arg0, arg1) {
4178
- const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
4591
+ export function __wbg_new_from_slice_ede497d29b90a4ad(arg0, arg1) {
4592
+ const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
4179
4593
  return ret;
4180
4594
  }
4181
- export function __wbg_next_11b99ee6237339e3() { return handleError(function (arg0) {
4595
+ export function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {
4182
4596
  const ret = arg0.next();
4183
4597
  return ret;
4184
4598
  }, arguments); }
4185
- export function __wbg_prototypesetcall_247ac4333d4d3cb4(arg0, arg1, arg2) {
4186
- Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
4187
- }
4188
- export function __wbg_prototypesetcall_52ca14fb142bc37b(arg0, arg1, arg2) {
4189
- Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
4190
- }
4191
- export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
4599
+ export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
4192
4600
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
4193
4601
  }
4194
- export function __wbg_prototypesetcall_f04613188bde902d(arg0, arg1, arg2) {
4602
+ export function __wbg_prototypesetcall_c5875dab42ff6b97(arg0, arg1, arg2) {
4603
+ Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
4604
+ }
4605
+ export function __wbg_prototypesetcall_d412f763861ea165(arg0, arg1, arg2) {
4195
4606
  Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), arg2);
4196
4607
  }
4197
- export function __wbg_push_e87b0e732085a946(arg0, arg1) {
4608
+ export function __wbg_prototypesetcall_db677c7a1d7d3039(arg0, arg1, arg2) {
4609
+ Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
4610
+ }
4611
+ export function __wbg_push_471a5b068a5295f6(arg0, arg1) {
4198
4612
  const ret = arg0.push(arg1);
4199
4613
  return ret;
4200
4614
  }
@@ -4205,13 +4619,13 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
4205
4619
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4206
4620
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4207
4621
  }
4208
- export function __wbg_value_21fc78aab0322612(arg0) {
4622
+ export function __wbg_value_ee3a06f4579184fa(arg0) {
4209
4623
  const ret = arg0.value;
4210
4624
  return ret;
4211
4625
  }
4212
4626
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
4213
- // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
4214
- const ret = getArrayF32FromWasm0(arg0, arg1);
4627
+ // Cast intrinsic for `Ref(Slice(F64)) -> NamedExternref("Float64Array")`.
4628
+ const ret = getArrayF64FromWasm0(arg0, arg1);
4215
4629
  return ret;
4216
4630
  }
4217
4631
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
@@ -4262,6 +4676,9 @@ const ClusterResultFinalization = (typeof FinalizationRegistry === 'undefined')
4262
4676
  const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
4263
4677
  ? { register: () => {}, unregister: () => {} }
4264
4678
  : new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr >>> 0, 1));
4679
+ const GridFinalization = (typeof FinalizationRegistry === 'undefined')
4680
+ ? { register: () => {}, unregister: () => {} }
4681
+ : new FinalizationRegistry(ptr => wasm.__wbg_grid_free(ptr >>> 0, 1));
4265
4682
  const GyrationTensorFinalization = (typeof FinalizationRegistry === 'undefined')
4266
4683
  ? { register: () => {}, unregister: () => {} }
4267
4684
  : new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr >>> 0, 1));
@@ -4283,6 +4700,9 @@ const MSDFinalization = (typeof FinalizationRegistry === 'undefined')
4283
4700
  const MSDResultFinalization = (typeof FinalizationRegistry === 'undefined')
4284
4701
  ? { register: () => {}, unregister: () => {} }
4285
4702
  : new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr >>> 0, 1));
4703
+ const MolRecReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4704
+ ? { register: () => {}, unregister: () => {} }
4705
+ : new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr >>> 0, 1));
4286
4706
  const NeighborListFinalization = (typeof FinalizationRegistry === 'undefined')
4287
4707
  ? { register: () => {}, unregister: () => {} }
4288
4708
  : new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr >>> 0, 1));
@@ -4298,9 +4718,9 @@ const RDFResultFinalization = (typeof FinalizationRegistry === 'undefined')
4298
4718
  const RadiusOfGyrationFinalization = (typeof FinalizationRegistry === 'undefined')
4299
4719
  ? { register: () => {}, unregister: () => {} }
4300
4720
  : new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr >>> 0, 1));
4301
- const SimulationReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4721
+ const SDFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
4302
4722
  ? { register: () => {}, unregister: () => {} }
4303
- : new FinalizationRegistry(ptr => wasm.__wbg_simulationreader_free(ptr >>> 0, 1));
4723
+ : new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr >>> 0, 1));
4304
4724
  const TopologyRingInfoFinalization = (typeof FinalizationRegistry === 'undefined')
4305
4725
  ? { register: () => {}, unregister: () => {} }
4306
4726
  : new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr >>> 0, 1));
@@ -4394,9 +4814,9 @@ function debugString(val) {
4394
4814
  return className;
4395
4815
  }
4396
4816
 
4397
- function getArrayF32FromWasm0(ptr, len) {
4817
+ function getArrayF64FromWasm0(ptr, len) {
4398
4818
  ptr = ptr >>> 0;
4399
- return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
4819
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
4400
4820
  }
4401
4821
 
4402
4822
  function getArrayI32FromWasm0(ptr, len) {
@@ -4433,12 +4853,12 @@ function getDataViewMemory0() {
4433
4853
  return cachedDataViewMemory0;
4434
4854
  }
4435
4855
 
4436
- let cachedFloat32ArrayMemory0 = null;
4437
- function getFloat32ArrayMemory0() {
4438
- if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
4439
- cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
4856
+ let cachedFloat64ArrayMemory0 = null;
4857
+ function getFloat64ArrayMemory0() {
4858
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
4859
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
4440
4860
  }
4441
- return cachedFloat32ArrayMemory0;
4861
+ return cachedFloat64ArrayMemory0;
4442
4862
  }
4443
4863
 
4444
4864
  let cachedInt32ArrayMemory0 = null;
@@ -4490,9 +4910,9 @@ function passArray32ToWasm0(arg, malloc) {
4490
4910
  return ptr;
4491
4911
  }
4492
4912
 
4493
- function passArrayF32ToWasm0(arg, malloc) {
4494
- const ptr = malloc(arg.length * 4, 4) >>> 0;
4495
- getFloat32ArrayMemory0().set(arg, ptr / 4);
4913
+ function passArrayF64ToWasm0(arg, malloc) {
4914
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
4915
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
4496
4916
  WASM_VECTOR_LEN = arg.length;
4497
4917
  return ptr;
4498
4918
  }