xtalforge-wasm 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/xtalforge_wasm.d.ts +516 -1
- package/xtalforge_wasm.js +1 -1
- package/xtalforge_wasm_bg.js +2344 -159
- package/xtalforge_wasm_bg.wasm +0 -0
package/xtalforge_wasm_bg.js
CHANGED
|
@@ -286,6 +286,48 @@ export class WasmDocument {
|
|
|
286
286
|
}
|
|
287
287
|
if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
|
|
288
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Adsorption sites as JSON.
|
|
291
|
+
*
|
|
292
|
+
* # Errors
|
|
293
|
+
*
|
|
294
|
+
* Returns a JavaScript `Error` for invalid text or tolerance.
|
|
295
|
+
* @param {string} text
|
|
296
|
+
* @param {string} format_hint
|
|
297
|
+
* @param {number} tolerance
|
|
298
|
+
* @returns {string}
|
|
299
|
+
*/
|
|
300
|
+
export function adsorption_sites(text, format_hint, tolerance) {
|
|
301
|
+
let deferred5_0;
|
|
302
|
+
let deferred5_1;
|
|
303
|
+
try {
|
|
304
|
+
const val3 = +tolerance;
|
|
305
|
+
let ptr0, len0, ptr1, len1;
|
|
306
|
+
try {
|
|
307
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
308
|
+
len0 = WASM_VECTOR_LEN;
|
|
309
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
310
|
+
len1 = WASM_VECTOR_LEN;
|
|
311
|
+
} catch (e) {
|
|
312
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
313
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
314
|
+
throw e;
|
|
315
|
+
}
|
|
316
|
+
const ret = wasm.adsorption_sites(ptr0, len0, ptr1, len1, val3);
|
|
317
|
+
var ptr4 = ret[0];
|
|
318
|
+
var len4 = ret[1];
|
|
319
|
+
if (ret[3]) {
|
|
320
|
+
ptr4 = 0; len4 = 0;
|
|
321
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
322
|
+
}
|
|
323
|
+
deferred5_0 = ptr4;
|
|
324
|
+
deferred5_1 = len4;
|
|
325
|
+
return getStringFromWasm0(ptr4, len4);
|
|
326
|
+
} finally {
|
|
327
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
289
331
|
/**
|
|
290
332
|
* Runtime capability report as JSON.
|
|
291
333
|
* @returns {string}
|
|
@@ -397,6 +439,80 @@ export function asymmetrize_info(text, symprec) {
|
|
|
397
439
|
return takeFromExternrefTable0(ret[0]);
|
|
398
440
|
}
|
|
399
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Detects the symmetry and returns the asymmetric unit as CIF.
|
|
444
|
+
*
|
|
445
|
+
* # Errors
|
|
446
|
+
*
|
|
447
|
+
* Returns a JavaScript `Error` for invalid text or a failed search.
|
|
448
|
+
* @param {string} text
|
|
449
|
+
* @param {number} symprec
|
|
450
|
+
* @returns {string}
|
|
451
|
+
*/
|
|
452
|
+
export function asymmetrize_text(text, symprec) {
|
|
453
|
+
let deferred4_0;
|
|
454
|
+
let deferred4_1;
|
|
455
|
+
try {
|
|
456
|
+
const val2 = +symprec;
|
|
457
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
458
|
+
const len0 = WASM_VECTOR_LEN;
|
|
459
|
+
const ret = wasm.asymmetrize_text(ptr0, len0, val2);
|
|
460
|
+
var ptr3 = ret[0];
|
|
461
|
+
var len3 = ret[1];
|
|
462
|
+
if (ret[3]) {
|
|
463
|
+
ptr3 = 0; len3 = 0;
|
|
464
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
465
|
+
}
|
|
466
|
+
deferred4_0 = ptr3;
|
|
467
|
+
deferred4_1 = len3;
|
|
468
|
+
return getStringFromWasm0(ptr3, len3);
|
|
469
|
+
} finally {
|
|
470
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Bond-valence sums as JSON.
|
|
476
|
+
*
|
|
477
|
+
* # Errors
|
|
478
|
+
*
|
|
479
|
+
* Returns a JavaScript `Error` for invalid text or cutoff.
|
|
480
|
+
* @param {string} text
|
|
481
|
+
* @param {string} format_hint
|
|
482
|
+
* @param {number} cutoff
|
|
483
|
+
* @returns {string}
|
|
484
|
+
*/
|
|
485
|
+
export function bond_valence_sums(text, format_hint, cutoff) {
|
|
486
|
+
let deferred5_0;
|
|
487
|
+
let deferred5_1;
|
|
488
|
+
try {
|
|
489
|
+
const val3 = +cutoff;
|
|
490
|
+
let ptr0, len0, ptr1, len1;
|
|
491
|
+
try {
|
|
492
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
493
|
+
len0 = WASM_VECTOR_LEN;
|
|
494
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
495
|
+
len1 = WASM_VECTOR_LEN;
|
|
496
|
+
} catch (e) {
|
|
497
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
498
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
499
|
+
throw e;
|
|
500
|
+
}
|
|
501
|
+
const ret = wasm.bond_valence_sums(ptr0, len0, ptr1, len1, val3);
|
|
502
|
+
var ptr4 = ret[0];
|
|
503
|
+
var len4 = ret[1];
|
|
504
|
+
if (ret[3]) {
|
|
505
|
+
ptr4 = 0; len4 = 0;
|
|
506
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
507
|
+
}
|
|
508
|
+
deferred5_0 = ptr4;
|
|
509
|
+
deferred5_1 = len4;
|
|
510
|
+
return getStringFromWasm0(ptr4, len4);
|
|
511
|
+
} finally {
|
|
512
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
400
516
|
/**
|
|
401
517
|
* Perceives the bonds of a structure.
|
|
402
518
|
*
|
|
@@ -454,6 +570,33 @@ export function build_c20_info() {
|
|
|
454
570
|
return takeFromExternrefTable0(ret[0]);
|
|
455
571
|
}
|
|
456
572
|
|
|
573
|
+
/**
|
|
574
|
+
* Builds C20 and returns it as CIF.
|
|
575
|
+
*
|
|
576
|
+
* # Errors
|
|
577
|
+
*
|
|
578
|
+
* Returns a JavaScript `Error` when the embedded data is invalid.
|
|
579
|
+
* @returns {string}
|
|
580
|
+
*/
|
|
581
|
+
export function build_c20_text() {
|
|
582
|
+
let deferred2_0;
|
|
583
|
+
let deferred2_1;
|
|
584
|
+
try {
|
|
585
|
+
const ret = wasm.build_c20_text();
|
|
586
|
+
var ptr1 = ret[0];
|
|
587
|
+
var len1 = ret[1];
|
|
588
|
+
if (ret[3]) {
|
|
589
|
+
ptr1 = 0; len1 = 0;
|
|
590
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
591
|
+
}
|
|
592
|
+
deferred2_0 = ptr1;
|
|
593
|
+
deferred2_1 = len1;
|
|
594
|
+
return getStringFromWasm0(ptr1, len1);
|
|
595
|
+
} finally {
|
|
596
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
457
600
|
/**
|
|
458
601
|
* Builds C60 and returns its summary.
|
|
459
602
|
*
|
|
@@ -470,6 +613,33 @@ export function build_c60_info() {
|
|
|
470
613
|
return takeFromExternrefTable0(ret[0]);
|
|
471
614
|
}
|
|
472
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Builds C60 and returns it as CIF.
|
|
618
|
+
*
|
|
619
|
+
* # Errors
|
|
620
|
+
*
|
|
621
|
+
* Returns a JavaScript `Error` when the embedded data is invalid.
|
|
622
|
+
* @returns {string}
|
|
623
|
+
*/
|
|
624
|
+
export function build_c60_text() {
|
|
625
|
+
let deferred2_0;
|
|
626
|
+
let deferred2_1;
|
|
627
|
+
try {
|
|
628
|
+
const ret = wasm.build_c60_text();
|
|
629
|
+
var ptr1 = ret[0];
|
|
630
|
+
var len1 = ret[1];
|
|
631
|
+
if (ret[3]) {
|
|
632
|
+
ptr1 = 0; len1 = 0;
|
|
633
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
634
|
+
}
|
|
635
|
+
deferred2_0 = ptr1;
|
|
636
|
+
deferred2_1 = len1;
|
|
637
|
+
return getStringFromWasm0(ptr1, len1);
|
|
638
|
+
} finally {
|
|
639
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
473
643
|
/**
|
|
474
644
|
* Builds a disordered carbon from a recipe.
|
|
475
645
|
*
|
|
@@ -510,6 +680,45 @@ export function build_carbon_recipe_info(net, repeat_x, repeat_y, repeat_z, dens
|
|
|
510
680
|
return takeFromExternrefTable0(ret[0]);
|
|
511
681
|
}
|
|
512
682
|
|
|
683
|
+
/**
|
|
684
|
+
* Builds a disordered carbon from a net recipe and returns it as CIF.
|
|
685
|
+
*
|
|
686
|
+
* The other recipe fields keep their defaults; `build_carbon_recipe_info`
|
|
687
|
+
* exposes the full recipe and its statistics.
|
|
688
|
+
*
|
|
689
|
+
* # Errors
|
|
690
|
+
*
|
|
691
|
+
* Returns a JavaScript `Error` for an unknown net or invalid options.
|
|
692
|
+
* @param {string} net
|
|
693
|
+
* @param {number} repeat
|
|
694
|
+
* @param {number} density
|
|
695
|
+
* @param {number} seed
|
|
696
|
+
* @returns {string}
|
|
697
|
+
*/
|
|
698
|
+
export function build_carbon_text(net, repeat, density, seed) {
|
|
699
|
+
let deferred6_0;
|
|
700
|
+
let deferred6_1;
|
|
701
|
+
try {
|
|
702
|
+
const val2 = +repeat;
|
|
703
|
+
const val3 = +density;
|
|
704
|
+
const val4 = +seed;
|
|
705
|
+
const ptr0 = passStringToWasm0(net, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
706
|
+
const len0 = WASM_VECTOR_LEN;
|
|
707
|
+
const ret = wasm.build_carbon_text(ptr0, len0, val2, val3, val4);
|
|
708
|
+
var ptr5 = ret[0];
|
|
709
|
+
var len5 = ret[1];
|
|
710
|
+
if (ret[3]) {
|
|
711
|
+
ptr5 = 0; len5 = 0;
|
|
712
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
713
|
+
}
|
|
714
|
+
deferred6_0 = ptr5;
|
|
715
|
+
deferred6_1 = len5;
|
|
716
|
+
return getStringFromWasm0(ptr5, len5);
|
|
717
|
+
} finally {
|
|
718
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
513
722
|
/**
|
|
514
723
|
* Builds a graphene sheet and returns its summary.
|
|
515
724
|
*
|
|
@@ -531,6 +740,38 @@ export function build_graphene_info(nx, ny, layers, interlayer, vacuum) {
|
|
|
531
740
|
return takeFromExternrefTable0(ret[0]);
|
|
532
741
|
}
|
|
533
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Builds a graphene sheet and returns it as CIF.
|
|
745
|
+
*
|
|
746
|
+
* # Errors
|
|
747
|
+
*
|
|
748
|
+
* Returns a JavaScript `Error` for invalid repeats or spacing.
|
|
749
|
+
* @param {number} nx
|
|
750
|
+
* @param {number} ny
|
|
751
|
+
* @param {number} layers
|
|
752
|
+
* @param {number} interlayer
|
|
753
|
+
* @param {number} vacuum
|
|
754
|
+
* @returns {string}
|
|
755
|
+
*/
|
|
756
|
+
export function build_graphene_text(nx, ny, layers, interlayer, vacuum) {
|
|
757
|
+
let deferred2_0;
|
|
758
|
+
let deferred2_1;
|
|
759
|
+
try {
|
|
760
|
+
const ret = wasm.build_graphene_text(nx, ny, layers, interlayer, vacuum);
|
|
761
|
+
var ptr1 = ret[0];
|
|
762
|
+
var len1 = ret[1];
|
|
763
|
+
if (ret[3]) {
|
|
764
|
+
ptr1 = 0; len1 = 0;
|
|
765
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
766
|
+
}
|
|
767
|
+
deferred2_0 = ptr1;
|
|
768
|
+
deferred2_1 = len1;
|
|
769
|
+
return getStringFromWasm0(ptr1, len1);
|
|
770
|
+
} finally {
|
|
771
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
534
775
|
/**
|
|
535
776
|
* Builds a framework and returns its summary and warnings.
|
|
536
777
|
*
|
|
@@ -565,94 +806,27 @@ export function build_mof_info(topology, node, linker) {
|
|
|
565
806
|
}
|
|
566
807
|
|
|
567
808
|
/**
|
|
568
|
-
* Builds a
|
|
569
|
-
*
|
|
570
|
-
* # Errors
|
|
571
|
-
*
|
|
572
|
-
* Returns a JavaScript `Error` for a bad chiral vector or length.
|
|
573
|
-
* @param {number} n
|
|
574
|
-
* @param {number} m
|
|
575
|
-
* @param {number} length
|
|
576
|
-
* @param {number} vacuum
|
|
577
|
-
* @returns {any}
|
|
578
|
-
*/
|
|
579
|
-
export function build_nanotube_info(n, m, length, vacuum) {
|
|
580
|
-
const ret = wasm.build_nanotube_info(n, m, length, vacuum);
|
|
581
|
-
if (ret[2]) {
|
|
582
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
583
|
-
}
|
|
584
|
-
return takeFromExternrefTable0(ret[0]);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Volume of a cell in cubic Angstrom.
|
|
589
|
-
*
|
|
590
|
-
* # Errors
|
|
591
|
-
*
|
|
592
|
-
* Returns a JavaScript `Error` whose `code` property is the stable error
|
|
593
|
-
* code from the Rust core.
|
|
594
|
-
* @param {number} a
|
|
595
|
-
* @param {number} b
|
|
596
|
-
* @param {number} c
|
|
597
|
-
* @param {number} alpha
|
|
598
|
-
* @param {number} beta
|
|
599
|
-
* @param {number} gamma
|
|
600
|
-
* @returns {number}
|
|
601
|
-
*/
|
|
602
|
-
export function cell_volume(a, b, c, alpha, beta, gamma) {
|
|
603
|
-
const ret = wasm.cell_volume(a, b, c, alpha, beta, gamma);
|
|
604
|
-
if (ret[2]) {
|
|
605
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
606
|
-
}
|
|
607
|
-
return ret[0];
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Changes the setting of a structure to a Hall number.
|
|
612
|
-
*
|
|
613
|
-
* # Errors
|
|
614
|
-
*
|
|
615
|
-
* Returns a JavaScript `Error` for invalid text or an unknown Hall number.
|
|
616
|
-
* @param {string} text
|
|
617
|
-
* @param {number} hall_number
|
|
618
|
-
* @returns {any}
|
|
619
|
-
*/
|
|
620
|
-
export function change_setting_info(text, hall_number) {
|
|
621
|
-
const val2 = +hall_number;
|
|
622
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
623
|
-
const len0 = WASM_VECTOR_LEN;
|
|
624
|
-
const ret = wasm.change_setting_info(ptr0, len0, val2);
|
|
625
|
-
if (ret[2]) {
|
|
626
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
627
|
-
}
|
|
628
|
-
return takeFromExternrefTable0(ret[0]);
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Converts structure text to another format and returns the file contents.
|
|
633
|
-
*
|
|
634
|
-
* `format_hint` is the input format (`cif`, `poscar` or `xyz`, or empty to
|
|
635
|
-
* detect it) and `format` is the output format (`cif`, `poscar` or `xyz`).
|
|
809
|
+
* Builds a MOF and returns it as CIF.
|
|
636
810
|
*
|
|
637
811
|
* # Errors
|
|
638
812
|
*
|
|
639
|
-
* Returns a JavaScript `Error` for
|
|
640
|
-
* @param {string}
|
|
641
|
-
* @param {string}
|
|
642
|
-
* @param {string}
|
|
813
|
+
* Returns a JavaScript `Error` for an unknown topology or block.
|
|
814
|
+
* @param {string} topology
|
|
815
|
+
* @param {string} node
|
|
816
|
+
* @param {string} linker
|
|
643
817
|
* @returns {string}
|
|
644
818
|
*/
|
|
645
|
-
export function
|
|
819
|
+
export function build_mof_text(topology, node, linker) {
|
|
646
820
|
let deferred5_0;
|
|
647
821
|
let deferred5_1;
|
|
648
822
|
try {
|
|
649
823
|
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
650
824
|
try {
|
|
651
|
-
ptr0 = passStringToWasm0(
|
|
825
|
+
ptr0 = passStringToWasm0(topology, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
652
826
|
len0 = WASM_VECTOR_LEN;
|
|
653
|
-
ptr1 = passStringToWasm0(
|
|
827
|
+
ptr1 = passStringToWasm0(node, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
654
828
|
len1 = WASM_VECTOR_LEN;
|
|
655
|
-
ptr2 = passStringToWasm0(
|
|
829
|
+
ptr2 = passStringToWasm0(linker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
656
830
|
len2 = WASM_VECTOR_LEN;
|
|
657
831
|
} catch (e) {
|
|
658
832
|
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
@@ -660,7 +834,7 @@ export function convert_structure(text, format_hint, format) {
|
|
|
660
834
|
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
661
835
|
throw e;
|
|
662
836
|
}
|
|
663
|
-
const ret = wasm.
|
|
837
|
+
const ret = wasm.build_mof_text(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
664
838
|
var ptr4 = ret[0];
|
|
665
839
|
var len4 = ret[1];
|
|
666
840
|
if (ret[3]) {
|
|
@@ -676,10 +850,463 @@ export function convert_structure(text, format_hint, format) {
|
|
|
676
850
|
}
|
|
677
851
|
|
|
678
852
|
/**
|
|
679
|
-
*
|
|
853
|
+
* Builds a nanotube and returns its summary.
|
|
680
854
|
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
855
|
+
* # Errors
|
|
856
|
+
*
|
|
857
|
+
* Returns a JavaScript `Error` for a bad chiral vector or length.
|
|
858
|
+
* @param {number} n
|
|
859
|
+
* @param {number} m
|
|
860
|
+
* @param {number} length
|
|
861
|
+
* @param {number} vacuum
|
|
862
|
+
* @returns {any}
|
|
863
|
+
*/
|
|
864
|
+
export function build_nanotube_info(n, m, length, vacuum) {
|
|
865
|
+
const ret = wasm.build_nanotube_info(n, m, length, vacuum);
|
|
866
|
+
if (ret[2]) {
|
|
867
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
868
|
+
}
|
|
869
|
+
return takeFromExternrefTable0(ret[0]);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Builds a nanotube and returns it as CIF.
|
|
874
|
+
*
|
|
875
|
+
* # Errors
|
|
876
|
+
*
|
|
877
|
+
* Returns a JavaScript `Error` for a bad chiral vector or length.
|
|
878
|
+
* @param {number} n
|
|
879
|
+
* @param {number} m
|
|
880
|
+
* @param {number} length
|
|
881
|
+
* @param {number} vacuum
|
|
882
|
+
* @returns {string}
|
|
883
|
+
*/
|
|
884
|
+
export function build_nanotube_text(n, m, length, vacuum) {
|
|
885
|
+
let deferred2_0;
|
|
886
|
+
let deferred2_1;
|
|
887
|
+
try {
|
|
888
|
+
const ret = wasm.build_nanotube_text(n, m, length, vacuum);
|
|
889
|
+
var ptr1 = ret[0];
|
|
890
|
+
var len1 = ret[1];
|
|
891
|
+
if (ret[3]) {
|
|
892
|
+
ptr1 = 0; len1 = 0;
|
|
893
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
894
|
+
}
|
|
895
|
+
deferred2_0 = ptr1;
|
|
896
|
+
deferred2_1 = len1;
|
|
897
|
+
return getStringFromWasm0(ptr1, len1);
|
|
898
|
+
} finally {
|
|
899
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Builds a polymer chain and returns it as CIF.
|
|
905
|
+
*
|
|
906
|
+
* # Errors
|
|
907
|
+
*
|
|
908
|
+
* Returns a JavaScript `Error` for an invalid SMILES or density.
|
|
909
|
+
* @param {string} smiles
|
|
910
|
+
* @param {number} monomers
|
|
911
|
+
* @param {number} density
|
|
912
|
+
* @returns {string}
|
|
913
|
+
*/
|
|
914
|
+
export function build_polymer_text(smiles, monomers, density) {
|
|
915
|
+
let deferred5_0;
|
|
916
|
+
let deferred5_1;
|
|
917
|
+
try {
|
|
918
|
+
const val2 = +monomers;
|
|
919
|
+
const val3 = +density;
|
|
920
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
921
|
+
const len0 = WASM_VECTOR_LEN;
|
|
922
|
+
const ret = wasm.build_polymer_text(ptr0, len0, val2, val3);
|
|
923
|
+
var ptr4 = ret[0];
|
|
924
|
+
var len4 = ret[1];
|
|
925
|
+
if (ret[3]) {
|
|
926
|
+
ptr4 = 0; len4 = 0;
|
|
927
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
928
|
+
}
|
|
929
|
+
deferred5_0 = ptr4;
|
|
930
|
+
deferred5_1 = len4;
|
|
931
|
+
return getStringFromWasm0(ptr4, len4);
|
|
932
|
+
} finally {
|
|
933
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Builds a honeycomb nanoribbon and returns it as CIF.
|
|
939
|
+
*
|
|
940
|
+
* # Errors
|
|
941
|
+
*
|
|
942
|
+
* Returns a JavaScript `Error` for invalid dimensions.
|
|
943
|
+
* @param {number} width
|
|
944
|
+
* @param {number} length
|
|
945
|
+
* @param {number} vacuum
|
|
946
|
+
* @returns {string}
|
|
947
|
+
*/
|
|
948
|
+
export function build_ribbon_text(width, length, vacuum) {
|
|
949
|
+
let deferred2_0;
|
|
950
|
+
let deferred2_1;
|
|
951
|
+
try {
|
|
952
|
+
const ret = wasm.build_ribbon_text(width, length, vacuum);
|
|
953
|
+
var ptr1 = ret[0];
|
|
954
|
+
var len1 = ret[1];
|
|
955
|
+
if (ret[3]) {
|
|
956
|
+
ptr1 = 0; len1 = 0;
|
|
957
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
958
|
+
}
|
|
959
|
+
deferred2_0 = ptr1;
|
|
960
|
+
deferred2_1 = len1;
|
|
961
|
+
return getStringFromWasm0(ptr1, len1);
|
|
962
|
+
} finally {
|
|
963
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Builds a Schwarz P carbon model and returns it as CIF.
|
|
969
|
+
*
|
|
970
|
+
* # Errors
|
|
971
|
+
*
|
|
972
|
+
* Returns a JavaScript `Error` for invalid options.
|
|
973
|
+
* @param {number} samples
|
|
974
|
+
* @param {number} cell
|
|
975
|
+
* @param {number} isovalue
|
|
976
|
+
* @returns {string}
|
|
977
|
+
*/
|
|
978
|
+
export function build_schwarzite_text(samples, cell, isovalue) {
|
|
979
|
+
let deferred2_0;
|
|
980
|
+
let deferred2_1;
|
|
981
|
+
try {
|
|
982
|
+
const ret = wasm.build_schwarzite_text(samples, cell, isovalue);
|
|
983
|
+
var ptr1 = ret[0];
|
|
984
|
+
var len1 = ret[1];
|
|
985
|
+
if (ret[3]) {
|
|
986
|
+
ptr1 = 0; len1 = 0;
|
|
987
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
988
|
+
}
|
|
989
|
+
deferred2_0 = ptr1;
|
|
990
|
+
deferred2_1 = len1;
|
|
991
|
+
return getStringFromWasm0(ptr1, len1);
|
|
992
|
+
} finally {
|
|
993
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Builds two twisted graphene layers and returns them as CIF.
|
|
999
|
+
*
|
|
1000
|
+
* # Errors
|
|
1001
|
+
*
|
|
1002
|
+
* Returns a JavaScript `Error` for invalid repeats or angle.
|
|
1003
|
+
* @param {number} n
|
|
1004
|
+
* @param {number} m
|
|
1005
|
+
* @param {number} theta
|
|
1006
|
+
* @param {number} layers
|
|
1007
|
+
* @returns {string}
|
|
1008
|
+
*/
|
|
1009
|
+
export function build_twist_text(n, m, theta, layers) {
|
|
1010
|
+
let deferred2_0;
|
|
1011
|
+
let deferred2_1;
|
|
1012
|
+
try {
|
|
1013
|
+
const ret = wasm.build_twist_text(n, m, theta, layers);
|
|
1014
|
+
var ptr1 = ret[0];
|
|
1015
|
+
var len1 = ret[1];
|
|
1016
|
+
if (ret[3]) {
|
|
1017
|
+
ptr1 = 0; len1 = 0;
|
|
1018
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1019
|
+
}
|
|
1020
|
+
deferred2_0 = ptr1;
|
|
1021
|
+
deferred2_1 = len1;
|
|
1022
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1023
|
+
} finally {
|
|
1024
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Builds a gyroid ZTC carbon model and returns it as CIF.
|
|
1030
|
+
*
|
|
1031
|
+
* # Errors
|
|
1032
|
+
*
|
|
1033
|
+
* Returns a JavaScript `Error` for invalid options.
|
|
1034
|
+
* @param {number} samples
|
|
1035
|
+
* @param {number} cell
|
|
1036
|
+
* @param {number} isovalue
|
|
1037
|
+
* @returns {string}
|
|
1038
|
+
*/
|
|
1039
|
+
export function build_ztc_text(samples, cell, isovalue) {
|
|
1040
|
+
let deferred2_0;
|
|
1041
|
+
let deferred2_1;
|
|
1042
|
+
try {
|
|
1043
|
+
const ret = wasm.build_ztc_text(samples, cell, isovalue);
|
|
1044
|
+
var ptr1 = ret[0];
|
|
1045
|
+
var len1 = ret[1];
|
|
1046
|
+
if (ret[3]) {
|
|
1047
|
+
ptr1 = 0; len1 = 0;
|
|
1048
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1049
|
+
}
|
|
1050
|
+
deferred2_0 = ptr1;
|
|
1051
|
+
deferred2_1 = len1;
|
|
1052
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1053
|
+
} finally {
|
|
1054
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Volume of a cell in cubic Angstrom.
|
|
1060
|
+
*
|
|
1061
|
+
* # Errors
|
|
1062
|
+
*
|
|
1063
|
+
* Returns a JavaScript `Error` whose `code` property is the stable error
|
|
1064
|
+
* code from the Rust core.
|
|
1065
|
+
* @param {number} a
|
|
1066
|
+
* @param {number} b
|
|
1067
|
+
* @param {number} c
|
|
1068
|
+
* @param {number} alpha
|
|
1069
|
+
* @param {number} beta
|
|
1070
|
+
* @param {number} gamma
|
|
1071
|
+
* @returns {number}
|
|
1072
|
+
*/
|
|
1073
|
+
export function cell_volume(a, b, c, alpha, beta, gamma) {
|
|
1074
|
+
const ret = wasm.cell_volume(a, b, c, alpha, beta, gamma);
|
|
1075
|
+
if (ret[2]) {
|
|
1076
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1077
|
+
}
|
|
1078
|
+
return ret[0];
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Changes the setting of a structure to a Hall number.
|
|
1083
|
+
*
|
|
1084
|
+
* # Errors
|
|
1085
|
+
*
|
|
1086
|
+
* Returns a JavaScript `Error` for invalid text or an unknown Hall number.
|
|
1087
|
+
* @param {string} text
|
|
1088
|
+
* @param {number} hall_number
|
|
1089
|
+
* @returns {any}
|
|
1090
|
+
*/
|
|
1091
|
+
export function change_setting_info(text, hall_number) {
|
|
1092
|
+
const val2 = +hall_number;
|
|
1093
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1094
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1095
|
+
const ret = wasm.change_setting_info(ptr0, len0, val2);
|
|
1096
|
+
if (ret[2]) {
|
|
1097
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1098
|
+
}
|
|
1099
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Changes the space-group setting and returns the result as CIF.
|
|
1104
|
+
*
|
|
1105
|
+
* # Errors
|
|
1106
|
+
*
|
|
1107
|
+
* Returns a JavaScript `Error` for invalid text or a Hall number out of range.
|
|
1108
|
+
* @param {string} text
|
|
1109
|
+
* @param {number} hall_number
|
|
1110
|
+
* @returns {string}
|
|
1111
|
+
*/
|
|
1112
|
+
export function change_setting_text(text, hall_number) {
|
|
1113
|
+
let deferred4_0;
|
|
1114
|
+
let deferred4_1;
|
|
1115
|
+
try {
|
|
1116
|
+
const val2 = +hall_number;
|
|
1117
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1118
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1119
|
+
const ret = wasm.change_setting_text(ptr0, len0, val2);
|
|
1120
|
+
var ptr3 = ret[0];
|
|
1121
|
+
var len3 = ret[1];
|
|
1122
|
+
if (ret[3]) {
|
|
1123
|
+
ptr3 = 0; len3 = 0;
|
|
1124
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1125
|
+
}
|
|
1126
|
+
deferred4_0 = ptr3;
|
|
1127
|
+
deferred4_1 = len3;
|
|
1128
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1129
|
+
} finally {
|
|
1130
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Converts structure text to another format and returns the file contents.
|
|
1136
|
+
*
|
|
1137
|
+
* `format_hint` is the input format (`cif`, `poscar` or `xyz`, or empty to
|
|
1138
|
+
* detect it) and `format` is the output format (`cif`, `poscar` or `xyz`).
|
|
1139
|
+
*
|
|
1140
|
+
* # Errors
|
|
1141
|
+
*
|
|
1142
|
+
* Returns a JavaScript `Error` for invalid text or an unknown format.
|
|
1143
|
+
* @param {string} text
|
|
1144
|
+
* @param {string} format_hint
|
|
1145
|
+
* @param {string} format
|
|
1146
|
+
* @returns {string}
|
|
1147
|
+
*/
|
|
1148
|
+
export function convert_structure(text, format_hint, format) {
|
|
1149
|
+
let deferred5_0;
|
|
1150
|
+
let deferred5_1;
|
|
1151
|
+
try {
|
|
1152
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1153
|
+
try {
|
|
1154
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1155
|
+
len0 = WASM_VECTOR_LEN;
|
|
1156
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1157
|
+
len1 = WASM_VECTOR_LEN;
|
|
1158
|
+
ptr2 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1159
|
+
len2 = WASM_VECTOR_LEN;
|
|
1160
|
+
} catch (e) {
|
|
1161
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1162
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1163
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1164
|
+
throw e;
|
|
1165
|
+
}
|
|
1166
|
+
const ret = wasm.convert_structure(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1167
|
+
var ptr4 = ret[0];
|
|
1168
|
+
var len4 = ret[1];
|
|
1169
|
+
if (ret[3]) {
|
|
1170
|
+
ptr4 = 0; len4 = 0;
|
|
1171
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1172
|
+
}
|
|
1173
|
+
deferred5_0 = ptr4;
|
|
1174
|
+
deferred5_1 = len4;
|
|
1175
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1176
|
+
} finally {
|
|
1177
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Convex hull as JSON from a JSON list of phases.
|
|
1183
|
+
*
|
|
1184
|
+
* # Errors
|
|
1185
|
+
*
|
|
1186
|
+
* Returns a JavaScript `Error` for an invalid phase list.
|
|
1187
|
+
* @param {string} entries_json
|
|
1188
|
+
* @returns {string}
|
|
1189
|
+
*/
|
|
1190
|
+
export function convex_hull(entries_json) {
|
|
1191
|
+
let deferred3_0;
|
|
1192
|
+
let deferred3_1;
|
|
1193
|
+
try {
|
|
1194
|
+
const ptr0 = passStringToWasm0(entries_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1196
|
+
const ret = wasm.convex_hull(ptr0, len0);
|
|
1197
|
+
var ptr2 = ret[0];
|
|
1198
|
+
var len2 = ret[1];
|
|
1199
|
+
if (ret[3]) {
|
|
1200
|
+
ptr2 = 0; len2 = 0;
|
|
1201
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1202
|
+
}
|
|
1203
|
+
deferred3_0 = ptr2;
|
|
1204
|
+
deferred3_1 = len2;
|
|
1205
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1206
|
+
} finally {
|
|
1207
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Coordination shell and shape measures as JSON.
|
|
1213
|
+
*
|
|
1214
|
+
* # Errors
|
|
1215
|
+
*
|
|
1216
|
+
* Returns a JavaScript `Error` for invalid text or an out-of-range index.
|
|
1217
|
+
* @param {string} text
|
|
1218
|
+
* @param {string} format_hint
|
|
1219
|
+
* @param {number} index
|
|
1220
|
+
* @param {string} strategy
|
|
1221
|
+
* @param {number} cutoff
|
|
1222
|
+
* @param {number} solid_angle
|
|
1223
|
+
* @returns {string}
|
|
1224
|
+
*/
|
|
1225
|
+
export function coordination(text, format_hint, index, strategy, cutoff, solid_angle) {
|
|
1226
|
+
let deferred8_0;
|
|
1227
|
+
let deferred8_1;
|
|
1228
|
+
try {
|
|
1229
|
+
const val4 = +index;
|
|
1230
|
+
const val5 = +cutoff;
|
|
1231
|
+
const val6 = +solid_angle;
|
|
1232
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1233
|
+
try {
|
|
1234
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1235
|
+
len0 = WASM_VECTOR_LEN;
|
|
1236
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1237
|
+
len1 = WASM_VECTOR_LEN;
|
|
1238
|
+
ptr2 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1239
|
+
len2 = WASM_VECTOR_LEN;
|
|
1240
|
+
} catch (e) {
|
|
1241
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1242
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1243
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1244
|
+
throw e;
|
|
1245
|
+
}
|
|
1246
|
+
const ret = wasm.coordination(ptr0, len0, ptr1, len1, val4, ptr2, len2, val5, val6);
|
|
1247
|
+
var ptr7 = ret[0];
|
|
1248
|
+
var len7 = ret[1];
|
|
1249
|
+
if (ret[3]) {
|
|
1250
|
+
ptr7 = 0; len7 = 0;
|
|
1251
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1252
|
+
}
|
|
1253
|
+
deferred8_0 = ptr7;
|
|
1254
|
+
deferred8_1 = len7;
|
|
1255
|
+
return getStringFromWasm0(ptr7, len7);
|
|
1256
|
+
} finally {
|
|
1257
|
+
wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Applies a strain, gradient, volume or density and returns structure JSON.
|
|
1263
|
+
*
|
|
1264
|
+
* # Errors
|
|
1265
|
+
*
|
|
1266
|
+
* Returns a JavaScript `Error` for invalid text or deformation options.
|
|
1267
|
+
* @param {string} text
|
|
1268
|
+
* @param {string} format_hint
|
|
1269
|
+
* @param {string} options_json
|
|
1270
|
+
* @returns {string}
|
|
1271
|
+
*/
|
|
1272
|
+
export function deform(text, format_hint, options_json) {
|
|
1273
|
+
let deferred5_0;
|
|
1274
|
+
let deferred5_1;
|
|
1275
|
+
try {
|
|
1276
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1277
|
+
try {
|
|
1278
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1279
|
+
len0 = WASM_VECTOR_LEN;
|
|
1280
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1281
|
+
len1 = WASM_VECTOR_LEN;
|
|
1282
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1283
|
+
len2 = WASM_VECTOR_LEN;
|
|
1284
|
+
} catch (e) {
|
|
1285
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1286
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1287
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1288
|
+
throw e;
|
|
1289
|
+
}
|
|
1290
|
+
const ret = wasm.deform(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1291
|
+
var ptr4 = ret[0];
|
|
1292
|
+
var len4 = ret[1];
|
|
1293
|
+
if (ret[3]) {
|
|
1294
|
+
ptr4 = 0; len4 = 0;
|
|
1295
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1296
|
+
}
|
|
1297
|
+
deferred5_0 = ptr4;
|
|
1298
|
+
deferred5_1 = len4;
|
|
1299
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1300
|
+
} finally {
|
|
1301
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Detects the space group and returns the dataset as a JS object.
|
|
1307
|
+
*
|
|
1308
|
+
* The object carries `number`, `hall_number`, `hm_symbol`, `pearson_symbol`,
|
|
1309
|
+
* `operations` (rotation, translation, triplet), `orbits`, `wyckoffs`,
|
|
683
1310
|
* `site_symmetry_symbols`, `std_lattice`, `std_positions`,
|
|
684
1311
|
* `std_origin_shift` and `std_rotation_matrix`.
|
|
685
1312
|
*
|
|
@@ -728,30 +1355,116 @@ export function diagnose_info(text, symbol) {
|
|
|
728
1355
|
if (ret[2]) {
|
|
729
1356
|
throw takeFromExternrefTable0(ret[1]);
|
|
730
1357
|
}
|
|
731
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1358
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Minimum-image distance between two P1 atoms, in Angstrom.
|
|
1363
|
+
*
|
|
1364
|
+
* # Errors
|
|
1365
|
+
*
|
|
1366
|
+
* Returns a JavaScript `Error` for invalid text or an out-of-range index.
|
|
1367
|
+
* @param {string} text
|
|
1368
|
+
* @param {number} i
|
|
1369
|
+
* @param {number} j
|
|
1370
|
+
* @returns {number}
|
|
1371
|
+
*/
|
|
1372
|
+
export function distance(text, i, j) {
|
|
1373
|
+
const val2 = +i;
|
|
1374
|
+
const val3 = +j;
|
|
1375
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1377
|
+
const ret = wasm.distance(ptr0, len0, val2, val3);
|
|
1378
|
+
if (ret[2]) {
|
|
1379
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1380
|
+
}
|
|
1381
|
+
return ret[0];
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* Site edits; returns structure JSON.
|
|
1386
|
+
*
|
|
1387
|
+
* # Errors
|
|
1388
|
+
*
|
|
1389
|
+
* Returns a JavaScript `Error` for invalid text or edit options.
|
|
1390
|
+
* @param {string} text
|
|
1391
|
+
* @param {string} format_hint
|
|
1392
|
+
* @param {string} options_json
|
|
1393
|
+
* @returns {string}
|
|
1394
|
+
*/
|
|
1395
|
+
export function edit_structure(text, format_hint, options_json) {
|
|
1396
|
+
let deferred5_0;
|
|
1397
|
+
let deferred5_1;
|
|
1398
|
+
try {
|
|
1399
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1400
|
+
try {
|
|
1401
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1402
|
+
len0 = WASM_VECTOR_LEN;
|
|
1403
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1404
|
+
len1 = WASM_VECTOR_LEN;
|
|
1405
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1406
|
+
len2 = WASM_VECTOR_LEN;
|
|
1407
|
+
} catch (e) {
|
|
1408
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1409
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1410
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1411
|
+
throw e;
|
|
1412
|
+
}
|
|
1413
|
+
const ret = wasm.edit_structure(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1414
|
+
var ptr4 = ret[0];
|
|
1415
|
+
var len4 = ret[1];
|
|
1416
|
+
if (ret[3]) {
|
|
1417
|
+
ptr4 = 0; len4 = 0;
|
|
1418
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1419
|
+
}
|
|
1420
|
+
deferred5_0 = ptr4;
|
|
1421
|
+
deferred5_1 = len4;
|
|
1422
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1423
|
+
} finally {
|
|
1424
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1425
|
+
}
|
|
732
1426
|
}
|
|
733
1427
|
|
|
734
1428
|
/**
|
|
735
|
-
*
|
|
1429
|
+
* Elastic tensor from UFF stress finite differences as JSON.
|
|
736
1430
|
*
|
|
737
1431
|
* # Errors
|
|
738
1432
|
*
|
|
739
|
-
* Returns a JavaScript `Error` for invalid text or
|
|
1433
|
+
* Returns a JavaScript `Error` for invalid text or strain.
|
|
740
1434
|
* @param {string} text
|
|
741
|
-
* @param {
|
|
742
|
-
* @param {number}
|
|
743
|
-
* @returns {
|
|
1435
|
+
* @param {string} format_hint
|
|
1436
|
+
* @param {number} strain
|
|
1437
|
+
* @returns {string}
|
|
744
1438
|
*/
|
|
745
|
-
export function
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
1439
|
+
export function elastic_tensor(text, format_hint, strain) {
|
|
1440
|
+
let deferred5_0;
|
|
1441
|
+
let deferred5_1;
|
|
1442
|
+
try {
|
|
1443
|
+
const val3 = +strain;
|
|
1444
|
+
let ptr0, len0, ptr1, len1;
|
|
1445
|
+
try {
|
|
1446
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1447
|
+
len0 = WASM_VECTOR_LEN;
|
|
1448
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1449
|
+
len1 = WASM_VECTOR_LEN;
|
|
1450
|
+
} catch (e) {
|
|
1451
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1452
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1453
|
+
throw e;
|
|
1454
|
+
}
|
|
1455
|
+
const ret = wasm.elastic_tensor(ptr0, len0, ptr1, len1, val3);
|
|
1456
|
+
var ptr4 = ret[0];
|
|
1457
|
+
var len4 = ret[1];
|
|
1458
|
+
if (ret[3]) {
|
|
1459
|
+
ptr4 = 0; len4 = 0;
|
|
1460
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1461
|
+
}
|
|
1462
|
+
deferred5_0 = ptr4;
|
|
1463
|
+
deferred5_1 = len4;
|
|
1464
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1465
|
+
} finally {
|
|
1466
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
753
1467
|
}
|
|
754
|
-
return ret[0];
|
|
755
1468
|
}
|
|
756
1469
|
|
|
757
1470
|
/**
|
|
@@ -775,7 +1488,37 @@ export function element_info(input) {
|
|
|
775
1488
|
}
|
|
776
1489
|
|
|
777
1490
|
/**
|
|
778
|
-
*
|
|
1491
|
+
* Equation-of-state fit as JSON.
|
|
1492
|
+
*
|
|
1493
|
+
* # Errors
|
|
1494
|
+
*
|
|
1495
|
+
* Returns a JavaScript `Error` for an unknown model or too few points.
|
|
1496
|
+
* @param {string} options_json
|
|
1497
|
+
* @returns {string}
|
|
1498
|
+
*/
|
|
1499
|
+
export function eos_fit(options_json) {
|
|
1500
|
+
let deferred3_0;
|
|
1501
|
+
let deferred3_1;
|
|
1502
|
+
try {
|
|
1503
|
+
const ptr0 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1505
|
+
const ret = wasm.eos_fit(ptr0, len0);
|
|
1506
|
+
var ptr2 = ret[0];
|
|
1507
|
+
var len2 = ret[1];
|
|
1508
|
+
if (ret[3]) {
|
|
1509
|
+
ptr2 = 0; len2 = 0;
|
|
1510
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1511
|
+
}
|
|
1512
|
+
deferred3_0 = ptr2;
|
|
1513
|
+
deferred3_1 = len2;
|
|
1514
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1515
|
+
} finally {
|
|
1516
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Returns QEq, EQeq or EEQ2019 charges (`qeq`, `eqeq`, `eeq`).
|
|
779
1522
|
*
|
|
780
1523
|
* # Errors
|
|
781
1524
|
*
|
|
@@ -880,6 +1623,52 @@ export function ff_optimize_info(text, minimizer, max_steps, force_tolerance, ce
|
|
|
880
1623
|
return takeFromExternrefTable0(ret[0]);
|
|
881
1624
|
}
|
|
882
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* Relaxes a structure and returns the result as CIF.
|
|
1628
|
+
*
|
|
1629
|
+
* # Errors
|
|
1630
|
+
*
|
|
1631
|
+
* Returns a JavaScript `Error` for invalid text or an unknown minimizer.
|
|
1632
|
+
* @param {string} text
|
|
1633
|
+
* @param {string} minimizer
|
|
1634
|
+
* @param {number} max_steps
|
|
1635
|
+
* @param {number} force_tolerance
|
|
1636
|
+
* @param {boolean} cell
|
|
1637
|
+
* @returns {string}
|
|
1638
|
+
*/
|
|
1639
|
+
export function ff_optimize_text(text, minimizer, max_steps, force_tolerance, cell) {
|
|
1640
|
+
let deferred7_0;
|
|
1641
|
+
let deferred7_1;
|
|
1642
|
+
try {
|
|
1643
|
+
const val3 = +max_steps;
|
|
1644
|
+
const val4 = +force_tolerance;
|
|
1645
|
+
const val5 = +cell;
|
|
1646
|
+
let ptr0, len0, ptr1, len1;
|
|
1647
|
+
try {
|
|
1648
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1649
|
+
len0 = WASM_VECTOR_LEN;
|
|
1650
|
+
ptr1 = passStringToWasm0(minimizer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1651
|
+
len1 = WASM_VECTOR_LEN;
|
|
1652
|
+
} catch (e) {
|
|
1653
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1654
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1655
|
+
throw e;
|
|
1656
|
+
}
|
|
1657
|
+
const ret = wasm.ff_optimize_text(ptr0, len0, ptr1, len1, val3, val4, val5);
|
|
1658
|
+
var ptr6 = ret[0];
|
|
1659
|
+
var len6 = ret[1];
|
|
1660
|
+
if (ret[3]) {
|
|
1661
|
+
ptr6 = 0; len6 = 0;
|
|
1662
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1663
|
+
}
|
|
1664
|
+
deferred7_0 = ptr6;
|
|
1665
|
+
deferred7_1 = len6;
|
|
1666
|
+
return getStringFromWasm0(ptr6, len6);
|
|
1667
|
+
} finally {
|
|
1668
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
883
1672
|
/**
|
|
884
1673
|
* Runs the preparation pipeline and returns its report.
|
|
885
1674
|
*
|
|
@@ -976,6 +1765,87 @@ export function ff_vibrations_info(text, step) {
|
|
|
976
1765
|
return takeFromExternrefTable0(ret[0]);
|
|
977
1766
|
}
|
|
978
1767
|
|
|
1768
|
+
/**
|
|
1769
|
+
* Similarity of two fingerprints.
|
|
1770
|
+
*
|
|
1771
|
+
* # Errors
|
|
1772
|
+
*
|
|
1773
|
+
* Returns a JavaScript `Error` for invalid text.
|
|
1774
|
+
* @param {string} first
|
|
1775
|
+
* @param {string} second
|
|
1776
|
+
* @param {string} format_hint
|
|
1777
|
+
* @param {number} r_max
|
|
1778
|
+
* @param {number} bin_width
|
|
1779
|
+
* @returns {number}
|
|
1780
|
+
*/
|
|
1781
|
+
export function fingerprint_similarity(first, second, format_hint, r_max, bin_width) {
|
|
1782
|
+
const val4 = +r_max;
|
|
1783
|
+
const val5 = +bin_width;
|
|
1784
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1785
|
+
try {
|
|
1786
|
+
ptr0 = passStringToWasm0(first, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1787
|
+
len0 = WASM_VECTOR_LEN;
|
|
1788
|
+
ptr1 = passStringToWasm0(second, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1789
|
+
len1 = WASM_VECTOR_LEN;
|
|
1790
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1791
|
+
len2 = WASM_VECTOR_LEN;
|
|
1792
|
+
} catch (e) {
|
|
1793
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1794
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1795
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1796
|
+
throw e;
|
|
1797
|
+
}
|
|
1798
|
+
const ret = wasm.fingerprint_similarity(ptr0, len0, ptr1, len1, ptr2, len2, val4, val5);
|
|
1799
|
+
if (ret[2]) {
|
|
1800
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1801
|
+
}
|
|
1802
|
+
return ret[0];
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
/**
|
|
1806
|
+
* Equality classes of a list of structure texts.
|
|
1807
|
+
*
|
|
1808
|
+
* # Errors
|
|
1809
|
+
*
|
|
1810
|
+
* Returns a JavaScript `Error` for invalid text.
|
|
1811
|
+
* @param {string[]} structures
|
|
1812
|
+
* @param {string} format_hint
|
|
1813
|
+
* @param {string} options_json
|
|
1814
|
+
* @returns {string}
|
|
1815
|
+
*/
|
|
1816
|
+
export function group_structures(structures, format_hint, options_json) {
|
|
1817
|
+
let deferred5_0;
|
|
1818
|
+
let deferred5_1;
|
|
1819
|
+
try {
|
|
1820
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
1821
|
+
try {
|
|
1822
|
+
ptr0 = passArrayJsValueToWasm0(structures, wasm.__wbindgen_malloc);
|
|
1823
|
+
len0 = WASM_VECTOR_LEN;
|
|
1824
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1825
|
+
len1 = WASM_VECTOR_LEN;
|
|
1826
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1827
|
+
len2 = WASM_VECTOR_LEN;
|
|
1828
|
+
} catch (e) {
|
|
1829
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1830
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1831
|
+
if (ptr0) { wasm.__externref_drop_slice(ptr0, len0); wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
1832
|
+
throw e;
|
|
1833
|
+
}
|
|
1834
|
+
const ret = wasm.group_structures(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1835
|
+
var ptr4 = ret[0];
|
|
1836
|
+
var len4 = ret[1];
|
|
1837
|
+
if (ret[3]) {
|
|
1838
|
+
ptr4 = 0; len4 = 0;
|
|
1839
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1840
|
+
}
|
|
1841
|
+
deferred5_0 = ptr4;
|
|
1842
|
+
deferred5_1 = len4;
|
|
1843
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1844
|
+
} finally {
|
|
1845
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
|
|
979
1849
|
/**
|
|
980
1850
|
* Finds the functional groups of a structure.
|
|
981
1851
|
*
|
|
@@ -1016,7 +1886,178 @@ export function hydrogens_info(text, distance) {
|
|
|
1016
1886
|
if (ret[2]) {
|
|
1017
1887
|
throw takeFromExternrefTable0(ret[1]);
|
|
1018
1888
|
}
|
|
1019
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1889
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
/**
|
|
1893
|
+
* Adds hydrogens at the missing valences and returns the result as CIF.
|
|
1894
|
+
*
|
|
1895
|
+
* # Errors
|
|
1896
|
+
*
|
|
1897
|
+
* Returns a JavaScript `Error` for invalid text or a bad distance.
|
|
1898
|
+
* @param {string} text
|
|
1899
|
+
* @param {number} distance
|
|
1900
|
+
* @returns {string}
|
|
1901
|
+
*/
|
|
1902
|
+
export function hydrogens_text(text, distance) {
|
|
1903
|
+
let deferred4_0;
|
|
1904
|
+
let deferred4_1;
|
|
1905
|
+
try {
|
|
1906
|
+
const val2 = +distance;
|
|
1907
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1908
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1909
|
+
const ret = wasm.hydrogens_text(ptr0, len0, val2);
|
|
1910
|
+
var ptr3 = ret[0];
|
|
1911
|
+
var len3 = ret[1];
|
|
1912
|
+
if (ret[3]) {
|
|
1913
|
+
ptr3 = 0; len3 = 0;
|
|
1914
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1915
|
+
}
|
|
1916
|
+
deferred4_0 = ptr3;
|
|
1917
|
+
deferred4_1 = len3;
|
|
1918
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1919
|
+
} finally {
|
|
1920
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Linear interpolation between matched structures; returns a JSON array of
|
|
1926
|
+
* structure documents.
|
|
1927
|
+
*
|
|
1928
|
+
* # Errors
|
|
1929
|
+
*
|
|
1930
|
+
* Returns a JavaScript `Error` when the structures do not match.
|
|
1931
|
+
* @param {string} first
|
|
1932
|
+
* @param {string} second
|
|
1933
|
+
* @param {number} images
|
|
1934
|
+
* @param {string} format_hint
|
|
1935
|
+
* @param {string} options_json
|
|
1936
|
+
* @returns {string}
|
|
1937
|
+
*/
|
|
1938
|
+
export function interpolate(first, second, images, format_hint, options_json) {
|
|
1939
|
+
let deferred7_0;
|
|
1940
|
+
let deferred7_1;
|
|
1941
|
+
try {
|
|
1942
|
+
const val5 = +images;
|
|
1943
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
1944
|
+
try {
|
|
1945
|
+
ptr0 = passStringToWasm0(first, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1946
|
+
len0 = WASM_VECTOR_LEN;
|
|
1947
|
+
ptr1 = passStringToWasm0(second, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1948
|
+
len1 = WASM_VECTOR_LEN;
|
|
1949
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1950
|
+
len2 = WASM_VECTOR_LEN;
|
|
1951
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1952
|
+
len3 = WASM_VECTOR_LEN;
|
|
1953
|
+
} catch (e) {
|
|
1954
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
1955
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
1956
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1957
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1958
|
+
throw e;
|
|
1959
|
+
}
|
|
1960
|
+
const ret = wasm.interpolate(ptr0, len0, ptr1, len1, val5, ptr2, len2, ptr3, len3);
|
|
1961
|
+
var ptr6 = ret[0];
|
|
1962
|
+
var len6 = ret[1];
|
|
1963
|
+
if (ret[3]) {
|
|
1964
|
+
ptr6 = 0; len6 = 0;
|
|
1965
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1966
|
+
}
|
|
1967
|
+
deferred7_0 = ptr6;
|
|
1968
|
+
deferred7_1 = len6;
|
|
1969
|
+
return getStringFromWasm0(ptr6, len6);
|
|
1970
|
+
} finally {
|
|
1971
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Interstitial candidates as JSON.
|
|
1977
|
+
*
|
|
1978
|
+
* # Errors
|
|
1979
|
+
*
|
|
1980
|
+
* Returns a JavaScript `Error` for invalid text or options.
|
|
1981
|
+
* @param {string} text
|
|
1982
|
+
* @param {string} format_hint
|
|
1983
|
+
* @param {string} species
|
|
1984
|
+
* @param {string} options_json
|
|
1985
|
+
* @returns {string}
|
|
1986
|
+
*/
|
|
1987
|
+
export function interstitials(text, format_hint, species, options_json) {
|
|
1988
|
+
let deferred6_0;
|
|
1989
|
+
let deferred6_1;
|
|
1990
|
+
try {
|
|
1991
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
1992
|
+
try {
|
|
1993
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1994
|
+
len0 = WASM_VECTOR_LEN;
|
|
1995
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1996
|
+
len1 = WASM_VECTOR_LEN;
|
|
1997
|
+
ptr2 = passStringToWasm0(species, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1998
|
+
len2 = WASM_VECTOR_LEN;
|
|
1999
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2000
|
+
len3 = WASM_VECTOR_LEN;
|
|
2001
|
+
} catch (e) {
|
|
2002
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
2003
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2004
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2005
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2006
|
+
throw e;
|
|
2007
|
+
}
|
|
2008
|
+
const ret = wasm.interstitials(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2009
|
+
var ptr5 = ret[0];
|
|
2010
|
+
var len5 = ret[1];
|
|
2011
|
+
if (ret[3]) {
|
|
2012
|
+
ptr5 = 0; len5 = 0;
|
|
2013
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2014
|
+
}
|
|
2015
|
+
deferred6_0 = ptr5;
|
|
2016
|
+
deferred6_1 = len5;
|
|
2017
|
+
return getStringFromWasm0(ptr5, len5);
|
|
2018
|
+
} finally {
|
|
2019
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* Kabsch alignment; points are a flat `xyzxyz...` array.
|
|
2025
|
+
*
|
|
2026
|
+
* # Errors
|
|
2027
|
+
*
|
|
2028
|
+
* Returns a JavaScript `Error` for mismatched or non-finite point sets.
|
|
2029
|
+
* @param {Float64Array | number[]} points
|
|
2030
|
+
* @param {Float64Array | number[]} reference
|
|
2031
|
+
* @returns {string}
|
|
2032
|
+
*/
|
|
2033
|
+
export function kabsch_alignment(points, reference) {
|
|
2034
|
+
let deferred4_0;
|
|
2035
|
+
let deferred4_1;
|
|
2036
|
+
try {
|
|
2037
|
+
let ptr0, len0, ptr1, len1;
|
|
2038
|
+
try {
|
|
2039
|
+
ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
2040
|
+
len0 = WASM_VECTOR_LEN;
|
|
2041
|
+
ptr1 = passArrayF64ToWasm0(reference, wasm.__wbindgen_malloc);
|
|
2042
|
+
len1 = WASM_VECTOR_LEN;
|
|
2043
|
+
} catch (e) {
|
|
2044
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
2045
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
2046
|
+
throw e;
|
|
2047
|
+
}
|
|
2048
|
+
const ret = wasm.kabsch_alignment(ptr0, len0, ptr1, len1);
|
|
2049
|
+
var ptr3 = ret[0];
|
|
2050
|
+
var len3 = ret[1];
|
|
2051
|
+
if (ret[3]) {
|
|
2052
|
+
ptr3 = 0; len3 = 0;
|
|
2053
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2054
|
+
}
|
|
2055
|
+
deferred4_0 = ptr3;
|
|
2056
|
+
deferred4_1 = len3;
|
|
2057
|
+
return getStringFromWasm0(ptr3, len3);
|
|
2058
|
+
} finally {
|
|
2059
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
2060
|
+
}
|
|
1020
2061
|
}
|
|
1021
2062
|
|
|
1022
2063
|
/**
|
|
@@ -1061,6 +2102,54 @@ export function lattice_info(a, b, c, alpha, beta, gamma) {
|
|
|
1061
2102
|
return takeFromExternrefTable0(ret[0]);
|
|
1062
2103
|
}
|
|
1063
2104
|
|
|
2105
|
+
/**
|
|
2106
|
+
* Commensurate 2D lattice matches as JSON.
|
|
2107
|
+
*
|
|
2108
|
+
* # Errors
|
|
2109
|
+
*
|
|
2110
|
+
* Returns a JavaScript `Error` for invalid text or options.
|
|
2111
|
+
* @param {string} film
|
|
2112
|
+
* @param {string} substrate
|
|
2113
|
+
* @param {string} format_hint
|
|
2114
|
+
* @param {string} options_json
|
|
2115
|
+
* @returns {string}
|
|
2116
|
+
*/
|
|
2117
|
+
export function lattice_matches(film, substrate, format_hint, options_json) {
|
|
2118
|
+
let deferred6_0;
|
|
2119
|
+
let deferred6_1;
|
|
2120
|
+
try {
|
|
2121
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
2122
|
+
try {
|
|
2123
|
+
ptr0 = passStringToWasm0(film, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2124
|
+
len0 = WASM_VECTOR_LEN;
|
|
2125
|
+
ptr1 = passStringToWasm0(substrate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2126
|
+
len1 = WASM_VECTOR_LEN;
|
|
2127
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2128
|
+
len2 = WASM_VECTOR_LEN;
|
|
2129
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2130
|
+
len3 = WASM_VECTOR_LEN;
|
|
2131
|
+
} catch (e) {
|
|
2132
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
2133
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2134
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2135
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2136
|
+
throw e;
|
|
2137
|
+
}
|
|
2138
|
+
const ret = wasm.lattice_matches(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2139
|
+
var ptr5 = ret[0];
|
|
2140
|
+
var len5 = ret[1];
|
|
2141
|
+
if (ret[3]) {
|
|
2142
|
+
ptr5 = 0; len5 = 0;
|
|
2143
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2144
|
+
}
|
|
2145
|
+
deferred6_0 = ptr5;
|
|
2146
|
+
deferred6_1 = len5;
|
|
2147
|
+
return getStringFromWasm0(ptr5, len5);
|
|
2148
|
+
} finally {
|
|
2149
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
|
|
1064
2153
|
/**
|
|
1065
2154
|
* Minimum-image fractional vector and distance.
|
|
1066
2155
|
*
|
|
@@ -1198,6 +2287,40 @@ export function lower_to_subgroup_info(text, subgroup, tolerance) {
|
|
|
1198
2287
|
return takeFromExternrefTable0(ret[0]);
|
|
1199
2288
|
}
|
|
1200
2289
|
|
|
2290
|
+
/**
|
|
2291
|
+
* Lowers a structure to a subgroup and returns it as CIF.
|
|
2292
|
+
*
|
|
2293
|
+
* # Errors
|
|
2294
|
+
*
|
|
2295
|
+
* Returns a JavaScript `Error` for invalid text or an unknown subgroup.
|
|
2296
|
+
* @param {string} text
|
|
2297
|
+
* @param {number} subgroup_number
|
|
2298
|
+
* @param {number} tolerance
|
|
2299
|
+
* @returns {string}
|
|
2300
|
+
*/
|
|
2301
|
+
export function lower_to_subgroup_text(text, subgroup_number, tolerance) {
|
|
2302
|
+
let deferred5_0;
|
|
2303
|
+
let deferred5_1;
|
|
2304
|
+
try {
|
|
2305
|
+
const val2 = +subgroup_number;
|
|
2306
|
+
const val3 = +tolerance;
|
|
2307
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2309
|
+
const ret = wasm.lower_to_subgroup_text(ptr0, len0, val2, val3);
|
|
2310
|
+
var ptr4 = ret[0];
|
|
2311
|
+
var len4 = ret[1];
|
|
2312
|
+
if (ret[3]) {
|
|
2313
|
+
ptr4 = 0; len4 = 0;
|
|
2314
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2315
|
+
}
|
|
2316
|
+
deferred5_0 = ptr4;
|
|
2317
|
+
deferred5_1 = len4;
|
|
2318
|
+
return getStringFromWasm0(ptr4, len4);
|
|
2319
|
+
} finally {
|
|
2320
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
1201
2324
|
/**
|
|
1202
2325
|
* Detects the collinear magnetic space group (experimental).
|
|
1203
2326
|
*
|
|
@@ -1219,6 +2342,54 @@ export function magnetic_group_info(text, symprec) {
|
|
|
1219
2342
|
return takeFromExternrefTable0(ret[0]);
|
|
1220
2343
|
}
|
|
1221
2344
|
|
|
2345
|
+
/**
|
|
2346
|
+
* Matches two structures and returns the match record as JSON.
|
|
2347
|
+
*
|
|
2348
|
+
* # Errors
|
|
2349
|
+
*
|
|
2350
|
+
* Returns a JavaScript `Error` for invalid text or tolerances.
|
|
2351
|
+
* @param {string} first
|
|
2352
|
+
* @param {string} second
|
|
2353
|
+
* @param {string} format_hint
|
|
2354
|
+
* @param {string} options_json
|
|
2355
|
+
* @returns {string}
|
|
2356
|
+
*/
|
|
2357
|
+
export function match_structures(first, second, format_hint, options_json) {
|
|
2358
|
+
let deferred6_0;
|
|
2359
|
+
let deferred6_1;
|
|
2360
|
+
try {
|
|
2361
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
2362
|
+
try {
|
|
2363
|
+
ptr0 = passStringToWasm0(first, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2364
|
+
len0 = WASM_VECTOR_LEN;
|
|
2365
|
+
ptr1 = passStringToWasm0(second, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2366
|
+
len1 = WASM_VECTOR_LEN;
|
|
2367
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2368
|
+
len2 = WASM_VECTOR_LEN;
|
|
2369
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2370
|
+
len3 = WASM_VECTOR_LEN;
|
|
2371
|
+
} catch (e) {
|
|
2372
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
2373
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2374
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2375
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2376
|
+
throw e;
|
|
2377
|
+
}
|
|
2378
|
+
const ret = wasm.match_structures(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2379
|
+
var ptr5 = ret[0];
|
|
2380
|
+
var len5 = ret[1];
|
|
2381
|
+
if (ret[3]) {
|
|
2382
|
+
ptr5 = 0; len5 = 0;
|
|
2383
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2384
|
+
}
|
|
2385
|
+
deferred6_0 = ptr5;
|
|
2386
|
+
deferred6_1 = len5;
|
|
2387
|
+
return getStringFromWasm0(ptr5, len5);
|
|
2388
|
+
} finally {
|
|
2389
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
|
|
1222
2393
|
/**
|
|
1223
2394
|
* Builds an ASCII STL string.
|
|
1224
2395
|
*
|
|
@@ -1290,27 +2461,195 @@ export function mof_topologies_info() {
|
|
|
1290
2461
|
if (ret[2]) {
|
|
1291
2462
|
throw takeFromExternrefTable0(ret[1]);
|
|
1292
2463
|
}
|
|
1293
|
-
return takeFromExternrefTable0(ret[0]);
|
|
2464
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* Finds the periodic neighbors within `cutoff` Angstrom.
|
|
2469
|
+
*
|
|
2470
|
+
* Each element has `i`, `j`, `image` (the lattice translation of `j`) and
|
|
2471
|
+
* `distance`.
|
|
2472
|
+
*
|
|
2473
|
+
* # Errors
|
|
2474
|
+
*
|
|
2475
|
+
* Returns a JavaScript `Error` for invalid text or a non-positive cutoff.
|
|
2476
|
+
* @param {string} text
|
|
2477
|
+
* @param {number} cutoff
|
|
2478
|
+
* @returns {Array<any>}
|
|
2479
|
+
*/
|
|
2480
|
+
export function neighbors(text, cutoff) {
|
|
2481
|
+
const val2 = +cutoff;
|
|
2482
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2483
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2484
|
+
const ret = wasm.neighbors(ptr0, len0, val2);
|
|
2485
|
+
if (ret[2]) {
|
|
2486
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2487
|
+
}
|
|
2488
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* Returns the invariants of every CGD entry.
|
|
2493
|
+
*
|
|
2494
|
+
* # Errors
|
|
2495
|
+
*
|
|
2496
|
+
* Returns a JavaScript `Error` for an invalid net.
|
|
2497
|
+
* @param {string} text
|
|
2498
|
+
* @param {number} tolerance
|
|
2499
|
+
* @returns {Array<any>}
|
|
2500
|
+
*/
|
|
2501
|
+
export function net_invariants_info(text, tolerance) {
|
|
2502
|
+
const val2 = +tolerance;
|
|
2503
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2505
|
+
const ret = wasm.net_invariants_info(ptr0, len0, val2);
|
|
2506
|
+
if (ret[2]) {
|
|
2507
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2508
|
+
}
|
|
2509
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Supercell closest to a cube; returns structure JSON.
|
|
2514
|
+
*
|
|
2515
|
+
* # Errors
|
|
2516
|
+
*
|
|
2517
|
+
* Returns a JavaScript `Error` for an invalid cell count.
|
|
2518
|
+
* @param {string} text
|
|
2519
|
+
* @param {number} cells
|
|
2520
|
+
* @param {string} format_hint
|
|
2521
|
+
* @returns {string}
|
|
2522
|
+
*/
|
|
2523
|
+
export function optimal_supercell(text, cells, format_hint) {
|
|
2524
|
+
let deferred5_0;
|
|
2525
|
+
let deferred5_1;
|
|
2526
|
+
try {
|
|
2527
|
+
const val3 = +cells;
|
|
2528
|
+
let ptr0, len0, ptr1, len1;
|
|
2529
|
+
try {
|
|
2530
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2531
|
+
len0 = WASM_VECTOR_LEN;
|
|
2532
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2533
|
+
len1 = WASM_VECTOR_LEN;
|
|
2534
|
+
} catch (e) {
|
|
2535
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2536
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2537
|
+
throw e;
|
|
2538
|
+
}
|
|
2539
|
+
const ret = wasm.optimal_supercell(ptr0, len0, val3, ptr1, len1);
|
|
2540
|
+
var ptr4 = ret[0];
|
|
2541
|
+
var len4 = ret[1];
|
|
2542
|
+
if (ret[3]) {
|
|
2543
|
+
ptr4 = 0; len4 = 0;
|
|
2544
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2545
|
+
}
|
|
2546
|
+
deferred5_0 = ptr4;
|
|
2547
|
+
deferred5_1 = len4;
|
|
2548
|
+
return getStringFromWasm0(ptr4, len4);
|
|
2549
|
+
} finally {
|
|
2550
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
/**
|
|
2555
|
+
* Orderings of partial occupancies as JSON.
|
|
2556
|
+
*
|
|
2557
|
+
* # Errors
|
|
2558
|
+
*
|
|
2559
|
+
* Returns a JavaScript `Error` for a structure without partial occupancy.
|
|
2560
|
+
* @param {string} text
|
|
2561
|
+
* @param {string} format_hint
|
|
2562
|
+
* @param {string} options_json
|
|
2563
|
+
* @returns {string}
|
|
2564
|
+
*/
|
|
2565
|
+
export function orderings(text, format_hint, options_json) {
|
|
2566
|
+
let deferred5_0;
|
|
2567
|
+
let deferred5_1;
|
|
2568
|
+
try {
|
|
2569
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
2570
|
+
try {
|
|
2571
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2572
|
+
len0 = WASM_VECTOR_LEN;
|
|
2573
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2574
|
+
len1 = WASM_VECTOR_LEN;
|
|
2575
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2576
|
+
len2 = WASM_VECTOR_LEN;
|
|
2577
|
+
} catch (e) {
|
|
2578
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2579
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2580
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2581
|
+
throw e;
|
|
2582
|
+
}
|
|
2583
|
+
const ret = wasm.orderings(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2584
|
+
var ptr4 = ret[0];
|
|
2585
|
+
var len4 = ret[1];
|
|
2586
|
+
if (ret[3]) {
|
|
2587
|
+
ptr4 = 0; len4 = 0;
|
|
2588
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2589
|
+
}
|
|
2590
|
+
deferred5_0 = ptr4;
|
|
2591
|
+
deferred5_1 = len4;
|
|
2592
|
+
return getStringFromWasm0(ptr4, len4);
|
|
2593
|
+
} finally {
|
|
2594
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* Oxidation states as JSON.
|
|
2600
|
+
*
|
|
2601
|
+
* # Errors
|
|
2602
|
+
*
|
|
2603
|
+
* Returns a JavaScript `Error` for invalid text or cutoff.
|
|
2604
|
+
* @param {string} text
|
|
2605
|
+
* @param {string} format_hint
|
|
2606
|
+
* @param {number} cutoff
|
|
2607
|
+
* @returns {string}
|
|
2608
|
+
*/
|
|
2609
|
+
export function oxidation_states(text, format_hint, cutoff) {
|
|
2610
|
+
let deferred5_0;
|
|
2611
|
+
let deferred5_1;
|
|
2612
|
+
try {
|
|
2613
|
+
const val3 = +cutoff;
|
|
2614
|
+
let ptr0, len0, ptr1, len1;
|
|
2615
|
+
try {
|
|
2616
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2617
|
+
len0 = WASM_VECTOR_LEN;
|
|
2618
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2619
|
+
len1 = WASM_VECTOR_LEN;
|
|
2620
|
+
} catch (e) {
|
|
2621
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2622
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2623
|
+
throw e;
|
|
2624
|
+
}
|
|
2625
|
+
const ret = wasm.oxidation_states(ptr0, len0, ptr1, len1, val3);
|
|
2626
|
+
var ptr4 = ret[0];
|
|
2627
|
+
var len4 = ret[1];
|
|
2628
|
+
if (ret[3]) {
|
|
2629
|
+
ptr4 = 0; len4 = 0;
|
|
2630
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2631
|
+
}
|
|
2632
|
+
deferred5_0 = ptr4;
|
|
2633
|
+
deferred5_1 = len4;
|
|
2634
|
+
return getStringFromWasm0(ptr4, len4);
|
|
2635
|
+
} finally {
|
|
2636
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
2637
|
+
}
|
|
1294
2638
|
}
|
|
1295
2639
|
|
|
1296
2640
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1299
|
-
* Each element has `i`, `j`, `image` (the lattice translation of `j`) and
|
|
1300
|
-
* `distance`.
|
|
2641
|
+
* Returns the JSON schema of a built-in parameter preset.
|
|
1301
2642
|
*
|
|
1302
2643
|
* # Errors
|
|
1303
2644
|
*
|
|
1304
|
-
* Returns a JavaScript `Error` for
|
|
1305
|
-
* @param {string}
|
|
1306
|
-
* @
|
|
1307
|
-
* @returns {Array<any>}
|
|
2645
|
+
* Returns a JavaScript `Error` for an unknown preset.
|
|
2646
|
+
* @param {string} name
|
|
2647
|
+
* @returns {any}
|
|
1308
2648
|
*/
|
|
1309
|
-
export function
|
|
1310
|
-
const
|
|
1311
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2649
|
+
export function param_schema(name) {
|
|
2650
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1312
2651
|
const len0 = WASM_VECTOR_LEN;
|
|
1313
|
-
const ret = wasm.
|
|
2652
|
+
const ret = wasm.param_schema(ptr0, len0);
|
|
1314
2653
|
if (ret[2]) {
|
|
1315
2654
|
throw takeFromExternrefTable0(ret[1]);
|
|
1316
2655
|
}
|
|
@@ -1318,43 +2657,88 @@ export function neighbors(text, cutoff) {
|
|
|
1318
2657
|
}
|
|
1319
2658
|
|
|
1320
2659
|
/**
|
|
1321
|
-
*
|
|
2660
|
+
* Periodic RMSD for an explicit atom mapping.
|
|
1322
2661
|
*
|
|
1323
2662
|
* # Errors
|
|
1324
2663
|
*
|
|
1325
|
-
* Returns a JavaScript `Error` for an
|
|
1326
|
-
* @param {string}
|
|
1327
|
-
* @param {
|
|
1328
|
-
* @
|
|
2664
|
+
* Returns a JavaScript `Error` for invalid text or an incomplete mapping.
|
|
2665
|
+
* @param {string} first
|
|
2666
|
+
* @param {string} second
|
|
2667
|
+
* @param {Uint32Array | number[]} mapping
|
|
2668
|
+
* @param {string} format_hint
|
|
2669
|
+
* @returns {number}
|
|
1329
2670
|
*/
|
|
1330
|
-
export function
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
2671
|
+
export function periodic_rmsd(first, second, mapping, format_hint) {
|
|
2672
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
2673
|
+
try {
|
|
2674
|
+
ptr0 = passStringToWasm0(first, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2675
|
+
len0 = WASM_VECTOR_LEN;
|
|
2676
|
+
ptr1 = passStringToWasm0(second, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2677
|
+
len1 = WASM_VECTOR_LEN;
|
|
2678
|
+
ptr2 = passArray32ToWasm0(mapping, wasm.__wbindgen_malloc);
|
|
2679
|
+
len2 = WASM_VECTOR_LEN;
|
|
2680
|
+
ptr3 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2681
|
+
len3 = WASM_VECTOR_LEN;
|
|
2682
|
+
} catch (e) {
|
|
2683
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
2684
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 4, 4); }
|
|
2685
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2686
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2687
|
+
throw e;
|
|
2688
|
+
}
|
|
2689
|
+
const ret = wasm.periodic_rmsd(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1335
2690
|
if (ret[2]) {
|
|
1336
2691
|
throw takeFromExternrefTable0(ret[1]);
|
|
1337
2692
|
}
|
|
1338
|
-
return
|
|
2693
|
+
return ret[0];
|
|
1339
2694
|
}
|
|
1340
2695
|
|
|
1341
2696
|
/**
|
|
1342
|
-
*
|
|
2697
|
+
* Places a molecule on an adsorption site and returns structure JSON.
|
|
1343
2698
|
*
|
|
1344
2699
|
* # Errors
|
|
1345
2700
|
*
|
|
1346
|
-
* Returns a JavaScript `Error` for an
|
|
1347
|
-
* @param {string}
|
|
1348
|
-
* @
|
|
2701
|
+
* Returns a JavaScript `Error` for invalid text or an out-of-range site.
|
|
2702
|
+
* @param {string} slab
|
|
2703
|
+
* @param {string} molecule
|
|
2704
|
+
* @param {string} format_hint
|
|
2705
|
+
* @param {string} options_json
|
|
2706
|
+
* @returns {string}
|
|
1349
2707
|
*/
|
|
1350
|
-
export function
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
2708
|
+
export function place_molecule(slab, molecule, format_hint, options_json) {
|
|
2709
|
+
let deferred6_0;
|
|
2710
|
+
let deferred6_1;
|
|
2711
|
+
try {
|
|
2712
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
2713
|
+
try {
|
|
2714
|
+
ptr0 = passStringToWasm0(slab, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2715
|
+
len0 = WASM_VECTOR_LEN;
|
|
2716
|
+
ptr1 = passStringToWasm0(molecule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2717
|
+
len1 = WASM_VECTOR_LEN;
|
|
2718
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2719
|
+
len2 = WASM_VECTOR_LEN;
|
|
2720
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2721
|
+
len3 = WASM_VECTOR_LEN;
|
|
2722
|
+
} catch (e) {
|
|
2723
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
2724
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2725
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2726
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2727
|
+
throw e;
|
|
2728
|
+
}
|
|
2729
|
+
const ret = wasm.place_molecule(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2730
|
+
var ptr5 = ret[0];
|
|
2731
|
+
var len5 = ret[1];
|
|
2732
|
+
if (ret[3]) {
|
|
2733
|
+
ptr5 = 0; len5 = 0;
|
|
2734
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2735
|
+
}
|
|
2736
|
+
deferred6_0 = ptr5;
|
|
2737
|
+
deferred6_1 = len5;
|
|
2738
|
+
return getStringFromWasm0(ptr5, len5);
|
|
2739
|
+
} finally {
|
|
2740
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1356
2741
|
}
|
|
1357
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1358
2742
|
}
|
|
1359
2743
|
|
|
1360
2744
|
/**
|
|
@@ -1498,6 +2882,38 @@ export function powder_index_info(pattern_text, wavelength, max_index, tolerance
|
|
|
1498
2882
|
return takeFromExternrefTable0(ret[0]);
|
|
1499
2883
|
}
|
|
1500
2884
|
|
|
2885
|
+
/**
|
|
2886
|
+
* Le Bail extraction with the default options.
|
|
2887
|
+
*
|
|
2888
|
+
* Returns `{ positions, intensities, intensity_esds, r_factor, rwp,
|
|
2889
|
+
* chi_squared }`, the same fields as `xtalforge --json powder lebail`.
|
|
2890
|
+
*
|
|
2891
|
+
* # Errors
|
|
2892
|
+
*
|
|
2893
|
+
* Returns a JavaScript `Error` for invalid structure or pattern text.
|
|
2894
|
+
* @param {string} text
|
|
2895
|
+
* @param {string} pattern_text
|
|
2896
|
+
* @returns {any}
|
|
2897
|
+
*/
|
|
2898
|
+
export function powder_lebail_info(text, pattern_text) {
|
|
2899
|
+
let ptr0, len0, ptr1, len1;
|
|
2900
|
+
try {
|
|
2901
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2902
|
+
len0 = WASM_VECTOR_LEN;
|
|
2903
|
+
ptr1 = passStringToWasm0(pattern_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2904
|
+
len1 = WASM_VECTOR_LEN;
|
|
2905
|
+
} catch (e) {
|
|
2906
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2907
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2908
|
+
throw e;
|
|
2909
|
+
}
|
|
2910
|
+
const ret = wasm.powder_lebail_info(ptr0, len0, ptr1, len1);
|
|
2911
|
+
if (ret[2]) {
|
|
2912
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2913
|
+
}
|
|
2914
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2915
|
+
}
|
|
2916
|
+
|
|
1501
2917
|
/**
|
|
1502
2918
|
* Fits a Pawley model: free intensities, cell, zero shift and width model.
|
|
1503
2919
|
*
|
|
@@ -1531,6 +2947,45 @@ export function powder_pawley_info(text, pattern_text, profile) {
|
|
|
1531
2947
|
return takeFromExternrefTable0(ret[0]);
|
|
1532
2948
|
}
|
|
1533
2949
|
|
|
2950
|
+
/**
|
|
2951
|
+
* Pawley fit that can also refine the size (constant) and strain
|
|
2952
|
+
* (`tan theta`) width terms, like Python `powder_pawley(refine_size=...,
|
|
2953
|
+
* refine_strain=...)`.
|
|
2954
|
+
*
|
|
2955
|
+
* # Errors
|
|
2956
|
+
*
|
|
2957
|
+
* Returns a JavaScript `Error` for invalid text or a failed fit.
|
|
2958
|
+
* @param {string} text
|
|
2959
|
+
* @param {string} pattern_text
|
|
2960
|
+
* @param {string} profile
|
|
2961
|
+
* @param {boolean} refine_size
|
|
2962
|
+
* @param {boolean} refine_strain
|
|
2963
|
+
* @returns {any}
|
|
2964
|
+
*/
|
|
2965
|
+
export function powder_pawley_width_info(text, pattern_text, profile, refine_size, refine_strain) {
|
|
2966
|
+
const val4 = +refine_size;
|
|
2967
|
+
const val5 = +refine_strain;
|
|
2968
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
2969
|
+
try {
|
|
2970
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2971
|
+
len0 = WASM_VECTOR_LEN;
|
|
2972
|
+
ptr1 = passStringToWasm0(pattern_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2973
|
+
len1 = WASM_VECTOR_LEN;
|
|
2974
|
+
ptr2 = passStringToWasm0(profile, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2975
|
+
len2 = WASM_VECTOR_LEN;
|
|
2976
|
+
} catch (e) {
|
|
2977
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
2978
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
2979
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
2980
|
+
throw e;
|
|
2981
|
+
}
|
|
2982
|
+
const ret = wasm.powder_pawley_width_info(ptr0, len0, ptr1, len1, ptr2, len2, val4, val5);
|
|
2983
|
+
if (ret[2]) {
|
|
2984
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2985
|
+
}
|
|
2986
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2987
|
+
}
|
|
2988
|
+
|
|
1534
2989
|
/**
|
|
1535
2990
|
* Refines a phase with the McCusker stages.
|
|
1536
2991
|
*
|
|
@@ -1600,6 +3055,38 @@ export function primitive_info(text, symprec) {
|
|
|
1600
3055
|
return takeFromExternrefTable0(ret[0]);
|
|
1601
3056
|
}
|
|
1602
3057
|
|
|
3058
|
+
/**
|
|
3059
|
+
* Builds the primitive cell and returns it as CIF.
|
|
3060
|
+
*
|
|
3061
|
+
* # Errors
|
|
3062
|
+
*
|
|
3063
|
+
* Returns a JavaScript `Error` for invalid text or a failed search.
|
|
3064
|
+
* @param {string} text
|
|
3065
|
+
* @param {number} symprec
|
|
3066
|
+
* @returns {string}
|
|
3067
|
+
*/
|
|
3068
|
+
export function primitive_text(text, symprec) {
|
|
3069
|
+
let deferred4_0;
|
|
3070
|
+
let deferred4_1;
|
|
3071
|
+
try {
|
|
3072
|
+
const val2 = +symprec;
|
|
3073
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3074
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3075
|
+
const ret = wasm.primitive_text(ptr0, len0, val2);
|
|
3076
|
+
var ptr3 = ret[0];
|
|
3077
|
+
var len3 = ret[1];
|
|
3078
|
+
if (ret[3]) {
|
|
3079
|
+
ptr3 = 0; len3 = 0;
|
|
3080
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3081
|
+
}
|
|
3082
|
+
deferred4_0 = ptr3;
|
|
3083
|
+
deferred4_1 = len3;
|
|
3084
|
+
return getStringFromWasm0(ptr3, len3);
|
|
3085
|
+
} finally {
|
|
3086
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
|
|
1603
3090
|
/**
|
|
1604
3091
|
* Reads `.xtalproj` bytes and returns the structure summary.
|
|
1605
3092
|
*
|
|
@@ -1673,6 +3160,96 @@ export function pxrd_info(text, radiation, max_two_theta, step) {
|
|
|
1673
3160
|
return takeFromExternrefTable0(ret[0]);
|
|
1674
3161
|
}
|
|
1675
3162
|
|
|
3163
|
+
/**
|
|
3164
|
+
* Total and partial RDF as JSON.
|
|
3165
|
+
*
|
|
3166
|
+
* # Errors
|
|
3167
|
+
*
|
|
3168
|
+
* Returns a JavaScript `Error` for invalid text or range.
|
|
3169
|
+
* @param {string} text
|
|
3170
|
+
* @param {string} format_hint
|
|
3171
|
+
* @param {number} r_max
|
|
3172
|
+
* @param {number} bin_width
|
|
3173
|
+
* @param {number} smoothing
|
|
3174
|
+
* @returns {string}
|
|
3175
|
+
*/
|
|
3176
|
+
export function radial_distribution(text, format_hint, r_max, bin_width, smoothing) {
|
|
3177
|
+
let deferred7_0;
|
|
3178
|
+
let deferred7_1;
|
|
3179
|
+
try {
|
|
3180
|
+
const val3 = +r_max;
|
|
3181
|
+
const val4 = +bin_width;
|
|
3182
|
+
const val5 = +smoothing;
|
|
3183
|
+
let ptr0, len0, ptr1, len1;
|
|
3184
|
+
try {
|
|
3185
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3186
|
+
len0 = WASM_VECTOR_LEN;
|
|
3187
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3188
|
+
len1 = WASM_VECTOR_LEN;
|
|
3189
|
+
} catch (e) {
|
|
3190
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3191
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3192
|
+
throw e;
|
|
3193
|
+
}
|
|
3194
|
+
const ret = wasm.radial_distribution(ptr0, len0, ptr1, len1, val3, val4, val5);
|
|
3195
|
+
var ptr6 = ret[0];
|
|
3196
|
+
var len6 = ret[1];
|
|
3197
|
+
if (ret[3]) {
|
|
3198
|
+
ptr6 = 0; len6 = 0;
|
|
3199
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3200
|
+
}
|
|
3201
|
+
deferred7_0 = ptr6;
|
|
3202
|
+
deferred7_1 = len6;
|
|
3203
|
+
return getStringFromWasm0(ptr6, len6);
|
|
3204
|
+
} finally {
|
|
3205
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
/**
|
|
3210
|
+
* Random displacements with a fixed seed; returns structure JSON.
|
|
3211
|
+
*
|
|
3212
|
+
* # Errors
|
|
3213
|
+
*
|
|
3214
|
+
* Returns a JavaScript `Error` for invalid text or options.
|
|
3215
|
+
* @param {string} text
|
|
3216
|
+
* @param {string} format_hint
|
|
3217
|
+
* @param {string} options_json
|
|
3218
|
+
* @returns {string}
|
|
3219
|
+
*/
|
|
3220
|
+
export function rattle(text, format_hint, options_json) {
|
|
3221
|
+
let deferred5_0;
|
|
3222
|
+
let deferred5_1;
|
|
3223
|
+
try {
|
|
3224
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3225
|
+
try {
|
|
3226
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3227
|
+
len0 = WASM_VECTOR_LEN;
|
|
3228
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3229
|
+
len1 = WASM_VECTOR_LEN;
|
|
3230
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3231
|
+
len2 = WASM_VECTOR_LEN;
|
|
3232
|
+
} catch (e) {
|
|
3233
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3234
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3235
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3236
|
+
throw e;
|
|
3237
|
+
}
|
|
3238
|
+
const ret = wasm.rattle(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3239
|
+
var ptr4 = ret[0];
|
|
3240
|
+
var len4 = ret[1];
|
|
3241
|
+
if (ret[3]) {
|
|
3242
|
+
ptr4 = 0; len4 = 0;
|
|
3243
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3244
|
+
}
|
|
3245
|
+
deferred5_0 = ptr4;
|
|
3246
|
+
deferred5_1 = len4;
|
|
3247
|
+
return getStringFromWasm0(ptr4, len4);
|
|
3248
|
+
} finally {
|
|
3249
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
|
|
1676
3253
|
/**
|
|
1677
3254
|
* Reads a CIF and returns its summary object.
|
|
1678
3255
|
*
|
|
@@ -1757,7 +3334,47 @@ export function reduce_info(text, algorithm) {
|
|
|
1757
3334
|
if (ret[2]) {
|
|
1758
3335
|
throw takeFromExternrefTable0(ret[1]);
|
|
1759
3336
|
}
|
|
1760
|
-
return takeFromExternrefTable0(ret[0]);
|
|
3337
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
/**
|
|
3341
|
+
* Reduces a structure and returns it as CIF.
|
|
3342
|
+
*
|
|
3343
|
+
* # Errors
|
|
3344
|
+
*
|
|
3345
|
+
* Returns a JavaScript `Error` for invalid text or an unknown algorithm.
|
|
3346
|
+
* @param {string} text
|
|
3347
|
+
* @param {string} algorithm
|
|
3348
|
+
* @returns {string}
|
|
3349
|
+
*/
|
|
3350
|
+
export function reduce_text(text, algorithm) {
|
|
3351
|
+
let deferred4_0;
|
|
3352
|
+
let deferred4_1;
|
|
3353
|
+
try {
|
|
3354
|
+
let ptr0, len0, ptr1, len1;
|
|
3355
|
+
try {
|
|
3356
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3357
|
+
len0 = WASM_VECTOR_LEN;
|
|
3358
|
+
ptr1 = passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3359
|
+
len1 = WASM_VECTOR_LEN;
|
|
3360
|
+
} catch (e) {
|
|
3361
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3362
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3363
|
+
throw e;
|
|
3364
|
+
}
|
|
3365
|
+
const ret = wasm.reduce_text(ptr0, len0, ptr1, len1);
|
|
3366
|
+
var ptr3 = ret[0];
|
|
3367
|
+
var len3 = ret[1];
|
|
3368
|
+
if (ret[3]) {
|
|
3369
|
+
ptr3 = 0; len3 = 0;
|
|
3370
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3371
|
+
}
|
|
3372
|
+
deferred4_0 = ptr3;
|
|
3373
|
+
deferred4_1 = len3;
|
|
3374
|
+
return getStringFromWasm0(ptr3, len3);
|
|
3375
|
+
} finally {
|
|
3376
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
3377
|
+
}
|
|
1761
3378
|
}
|
|
1762
3379
|
|
|
1763
3380
|
/**
|
|
@@ -1814,6 +3431,48 @@ export function rings(text, max_size) {
|
|
|
1814
3431
|
return takeFromExternrefTable0(ret[0]);
|
|
1815
3432
|
}
|
|
1816
3433
|
|
|
3434
|
+
/**
|
|
3435
|
+
* Builds the full scene geometry for a structure.
|
|
3436
|
+
*
|
|
3437
|
+
* The object has three arrays:
|
|
3438
|
+
*
|
|
3439
|
+
* - `atoms`: `element`, `position` (Cartesian Angstrom), `radius`, `color`
|
|
3440
|
+
* (0-255 RGB), `index` in the P1 cell and `hidden`.
|
|
3441
|
+
* - `bonds`: `i`, `j`, `start`, `end`, `radius`, `color` and `order`.
|
|
3442
|
+
* - `cell_edges`: pairs of Cartesian endpoints.
|
|
3443
|
+
*
|
|
3444
|
+
* `settings` repeats the sanitized style, atom scale, bond radius, cell and
|
|
3445
|
+
* axes flags and background colour used to build the frame.
|
|
3446
|
+
*
|
|
3447
|
+
* # Errors
|
|
3448
|
+
*
|
|
3449
|
+
* Returns a JavaScript `Error` with a stable `code` property for invalid
|
|
3450
|
+
* structure text or an unknown draw style.
|
|
3451
|
+
* @param {string} text
|
|
3452
|
+
* @param {string} style
|
|
3453
|
+
* @param {number} scale
|
|
3454
|
+
* @returns {any}
|
|
3455
|
+
*/
|
|
3456
|
+
export function scene_data(text, style, scale) {
|
|
3457
|
+
const val3 = +scale;
|
|
3458
|
+
let ptr0, len0, ptr1, len1;
|
|
3459
|
+
try {
|
|
3460
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3461
|
+
len0 = WASM_VECTOR_LEN;
|
|
3462
|
+
ptr1 = passStringToWasm0(style, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3463
|
+
len1 = WASM_VECTOR_LEN;
|
|
3464
|
+
} catch (e) {
|
|
3465
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3466
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3467
|
+
throw e;
|
|
3468
|
+
}
|
|
3469
|
+
const ret = wasm.scene_data(ptr0, len0, ptr1, len1, val3);
|
|
3470
|
+
if (ret[2]) {
|
|
3471
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3472
|
+
}
|
|
3473
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3474
|
+
}
|
|
3475
|
+
|
|
1817
3476
|
/**
|
|
1818
3477
|
* Summarizes a scene for the given draw style.
|
|
1819
3478
|
*
|
|
@@ -1900,6 +3559,50 @@ export function set_space_group_info(text, symbol, mode) {
|
|
|
1900
3559
|
return takeFromExternrefTable0(ret[0]);
|
|
1901
3560
|
}
|
|
1902
3561
|
|
|
3562
|
+
/**
|
|
3563
|
+
* Applies a space group and returns the result as CIF.
|
|
3564
|
+
*
|
|
3565
|
+
* # Errors
|
|
3566
|
+
*
|
|
3567
|
+
* Returns a JavaScript `Error` for invalid text, an unknown symbol or mode.
|
|
3568
|
+
* @param {string} text
|
|
3569
|
+
* @param {string} symbol
|
|
3570
|
+
* @param {string} mode
|
|
3571
|
+
* @returns {string}
|
|
3572
|
+
*/
|
|
3573
|
+
export function set_space_group_text(text, symbol, mode) {
|
|
3574
|
+
let deferred5_0;
|
|
3575
|
+
let deferred5_1;
|
|
3576
|
+
try {
|
|
3577
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3578
|
+
try {
|
|
3579
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3580
|
+
len0 = WASM_VECTOR_LEN;
|
|
3581
|
+
ptr1 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3582
|
+
len1 = WASM_VECTOR_LEN;
|
|
3583
|
+
ptr2 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3584
|
+
len2 = WASM_VECTOR_LEN;
|
|
3585
|
+
} catch (e) {
|
|
3586
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3587
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3588
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3589
|
+
throw e;
|
|
3590
|
+
}
|
|
3591
|
+
const ret = wasm.set_space_group_text(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3592
|
+
var ptr4 = ret[0];
|
|
3593
|
+
var len4 = ret[1];
|
|
3594
|
+
if (ret[3]) {
|
|
3595
|
+
ptr4 = 0; len4 = 0;
|
|
3596
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3597
|
+
}
|
|
3598
|
+
deferred5_0 = ptr4;
|
|
3599
|
+
deferred5_1 = len4;
|
|
3600
|
+
return getStringFromWasm0(ptr4, len4);
|
|
3601
|
+
} finally {
|
|
3602
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
|
|
1903
3606
|
/**
|
|
1904
3607
|
* Cuts a slab and returns its summary object.
|
|
1905
3608
|
*
|
|
@@ -1933,6 +3636,50 @@ export function slab_info(text, h, k, l, layers, vacuum) {
|
|
|
1933
3636
|
return takeFromExternrefTable0(ret[0]);
|
|
1934
3637
|
}
|
|
1935
3638
|
|
|
3639
|
+
/**
|
|
3640
|
+
* Every termination of a surface as JSON with structure documents.
|
|
3641
|
+
*
|
|
3642
|
+
* # Errors
|
|
3643
|
+
*
|
|
3644
|
+
* Returns a JavaScript `Error` for invalid text or a degenerate plane.
|
|
3645
|
+
* @param {string} text
|
|
3646
|
+
* @param {string} format_hint
|
|
3647
|
+
* @param {string} options_json
|
|
3648
|
+
* @returns {string}
|
|
3649
|
+
*/
|
|
3650
|
+
export function slab_terminations(text, format_hint, options_json) {
|
|
3651
|
+
let deferred5_0;
|
|
3652
|
+
let deferred5_1;
|
|
3653
|
+
try {
|
|
3654
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3655
|
+
try {
|
|
3656
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3657
|
+
len0 = WASM_VECTOR_LEN;
|
|
3658
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3659
|
+
len1 = WASM_VECTOR_LEN;
|
|
3660
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3661
|
+
len2 = WASM_VECTOR_LEN;
|
|
3662
|
+
} catch (e) {
|
|
3663
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3664
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3665
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3666
|
+
throw e;
|
|
3667
|
+
}
|
|
3668
|
+
const ret = wasm.slab_terminations(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3669
|
+
var ptr4 = ret[0];
|
|
3670
|
+
var len4 = ret[1];
|
|
3671
|
+
if (ret[3]) {
|
|
3672
|
+
ptr4 = 0; len4 = 0;
|
|
3673
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3674
|
+
}
|
|
3675
|
+
deferred5_0 = ptr4;
|
|
3676
|
+
deferred5_1 = len4;
|
|
3677
|
+
return getStringFromWasm0(ptr4, len4);
|
|
3678
|
+
} finally {
|
|
3679
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
|
|
1936
3683
|
/**
|
|
1937
3684
|
* Cuts a slab and returns it as CIF text.
|
|
1938
3685
|
*
|
|
@@ -1963,36 +3710,204 @@ export function slab_text(text, h, k, l, layers, vacuum) {
|
|
|
1963
3710
|
var ptr7 = ret[0];
|
|
1964
3711
|
var len7 = ret[1];
|
|
1965
3712
|
if (ret[3]) {
|
|
1966
|
-
ptr7 = 0; len7 = 0;
|
|
3713
|
+
ptr7 = 0; len7 = 0;
|
|
3714
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3715
|
+
}
|
|
3716
|
+
deferred8_0 = ptr7;
|
|
3717
|
+
deferred8_1 = len7;
|
|
3718
|
+
return getStringFromWasm0(ptr7, len7);
|
|
3719
|
+
} finally {
|
|
3720
|
+
wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
/**
|
|
3725
|
+
* SQS generation as JSON.
|
|
3726
|
+
*
|
|
3727
|
+
* # Errors
|
|
3728
|
+
*
|
|
3729
|
+
* Returns a JavaScript `Error` for a structure without binary disorder.
|
|
3730
|
+
* @param {string} text
|
|
3731
|
+
* @param {string} format_hint
|
|
3732
|
+
* @param {string} options_json
|
|
3733
|
+
* @returns {string}
|
|
3734
|
+
*/
|
|
3735
|
+
export function special_quasirandom(text, format_hint, options_json) {
|
|
3736
|
+
let deferred5_0;
|
|
3737
|
+
let deferred5_1;
|
|
3738
|
+
try {
|
|
3739
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3740
|
+
try {
|
|
3741
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3742
|
+
len0 = WASM_VECTOR_LEN;
|
|
3743
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3744
|
+
len1 = WASM_VECTOR_LEN;
|
|
3745
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3746
|
+
len2 = WASM_VECTOR_LEN;
|
|
3747
|
+
} catch (e) {
|
|
3748
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3749
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3750
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3751
|
+
throw e;
|
|
3752
|
+
}
|
|
3753
|
+
const ret = wasm.special_quasirandom(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3754
|
+
var ptr4 = ret[0];
|
|
3755
|
+
var len4 = ret[1];
|
|
3756
|
+
if (ret[3]) {
|
|
3757
|
+
ptr4 = 0; len4 = 0;
|
|
3758
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3759
|
+
}
|
|
3760
|
+
deferred5_0 = ptr4;
|
|
3761
|
+
deferred5_1 = len4;
|
|
3762
|
+
return getStringFromWasm0(ptr4, len4);
|
|
3763
|
+
} finally {
|
|
3764
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
/**
|
|
3769
|
+
* Stacks a film on a substrate; returns structure JSON.
|
|
3770
|
+
*
|
|
3771
|
+
* # Errors
|
|
3772
|
+
*
|
|
3773
|
+
* Returns a JavaScript `Error` for empty slabs or invalid options.
|
|
3774
|
+
* @param {string} film
|
|
3775
|
+
* @param {string} substrate
|
|
3776
|
+
* @param {string} format_hint
|
|
3777
|
+
* @param {string} options_json
|
|
3778
|
+
* @returns {string}
|
|
3779
|
+
*/
|
|
3780
|
+
export function stack_slabs(film, substrate, format_hint, options_json) {
|
|
3781
|
+
let deferred6_0;
|
|
3782
|
+
let deferred6_1;
|
|
3783
|
+
try {
|
|
3784
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
3785
|
+
try {
|
|
3786
|
+
ptr0 = passStringToWasm0(film, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3787
|
+
len0 = WASM_VECTOR_LEN;
|
|
3788
|
+
ptr1 = passStringToWasm0(substrate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3789
|
+
len1 = WASM_VECTOR_LEN;
|
|
3790
|
+
ptr2 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3791
|
+
len2 = WASM_VECTOR_LEN;
|
|
3792
|
+
ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3793
|
+
len3 = WASM_VECTOR_LEN;
|
|
3794
|
+
} catch (e) {
|
|
3795
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
3796
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3797
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3798
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3799
|
+
throw e;
|
|
3800
|
+
}
|
|
3801
|
+
const ret = wasm.stack_slabs(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
3802
|
+
var ptr5 = ret[0];
|
|
3803
|
+
var len5 = ret[1];
|
|
3804
|
+
if (ret[3]) {
|
|
3805
|
+
ptr5 = 0; len5 = 0;
|
|
3806
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3807
|
+
}
|
|
3808
|
+
deferred6_0 = ptr5;
|
|
3809
|
+
deferred6_1 = len5;
|
|
3810
|
+
return getStringFromWasm0(ptr5, len5);
|
|
3811
|
+
} finally {
|
|
3812
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
/**
|
|
3817
|
+
* Standardizes a structure to the conventional cell.
|
|
3818
|
+
*
|
|
3819
|
+
* # Errors
|
|
3820
|
+
*
|
|
3821
|
+
* Returns a JavaScript `Error` for invalid text or a failed search.
|
|
3822
|
+
* @param {string} text
|
|
3823
|
+
* @param {number} symprec
|
|
3824
|
+
* @returns {any}
|
|
3825
|
+
*/
|
|
3826
|
+
export function standardize_info(text, symprec) {
|
|
3827
|
+
const val2 = +symprec;
|
|
3828
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3829
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3830
|
+
const ret = wasm.standardize_info(ptr0, len0, val2);
|
|
3831
|
+
if (ret[2]) {
|
|
3832
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3833
|
+
}
|
|
3834
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
/**
|
|
3838
|
+
* Standardizes a structure and returns it as CIF.
|
|
3839
|
+
*
|
|
3840
|
+
* # Errors
|
|
3841
|
+
*
|
|
3842
|
+
* Returns a JavaScript `Error` for invalid text or a failed search.
|
|
3843
|
+
* @param {string} text
|
|
3844
|
+
* @param {number} symprec
|
|
3845
|
+
* @returns {string}
|
|
3846
|
+
*/
|
|
3847
|
+
export function standardize_text(text, symprec) {
|
|
3848
|
+
let deferred4_0;
|
|
3849
|
+
let deferred4_1;
|
|
3850
|
+
try {
|
|
3851
|
+
const val2 = +symprec;
|
|
3852
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3853
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3854
|
+
const ret = wasm.standardize_text(ptr0, len0, val2);
|
|
3855
|
+
var ptr3 = ret[0];
|
|
3856
|
+
var len3 = ret[1];
|
|
3857
|
+
if (ret[3]) {
|
|
3858
|
+
ptr3 = 0; len3 = 0;
|
|
3859
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3860
|
+
}
|
|
3861
|
+
deferred4_0 = ptr3;
|
|
3862
|
+
deferred4_1 = len3;
|
|
3863
|
+
return getStringFromWasm0(ptr3, len3);
|
|
3864
|
+
} finally {
|
|
3865
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
/**
|
|
3870
|
+
* Structure fingerprint as JSON.
|
|
3871
|
+
*
|
|
3872
|
+
* # Errors
|
|
3873
|
+
*
|
|
3874
|
+
* Returns a JavaScript `Error` for invalid text or range.
|
|
3875
|
+
* @param {string} text
|
|
3876
|
+
* @param {string} format_hint
|
|
3877
|
+
* @param {number} r_max
|
|
3878
|
+
* @param {number} bin_width
|
|
3879
|
+
* @returns {string}
|
|
3880
|
+
*/
|
|
3881
|
+
export function structure_fingerprint(text, format_hint, r_max, bin_width) {
|
|
3882
|
+
let deferred6_0;
|
|
3883
|
+
let deferred6_1;
|
|
3884
|
+
try {
|
|
3885
|
+
const val3 = +r_max;
|
|
3886
|
+
const val4 = +bin_width;
|
|
3887
|
+
let ptr0, len0, ptr1, len1;
|
|
3888
|
+
try {
|
|
3889
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3890
|
+
len0 = WASM_VECTOR_LEN;
|
|
3891
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3892
|
+
len1 = WASM_VECTOR_LEN;
|
|
3893
|
+
} catch (e) {
|
|
3894
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3895
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3896
|
+
throw e;
|
|
3897
|
+
}
|
|
3898
|
+
const ret = wasm.structure_fingerprint(ptr0, len0, ptr1, len1, val3, val4);
|
|
3899
|
+
var ptr5 = ret[0];
|
|
3900
|
+
var len5 = ret[1];
|
|
3901
|
+
if (ret[3]) {
|
|
3902
|
+
ptr5 = 0; len5 = 0;
|
|
1967
3903
|
throw takeFromExternrefTable0(ret[2]);
|
|
1968
3904
|
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
return getStringFromWasm0(
|
|
3905
|
+
deferred6_0 = ptr5;
|
|
3906
|
+
deferred6_1 = len5;
|
|
3907
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1972
3908
|
} finally {
|
|
1973
|
-
wasm.__wbindgen_free(
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
/**
|
|
1978
|
-
* Standardizes a structure to the conventional cell.
|
|
1979
|
-
*
|
|
1980
|
-
* # Errors
|
|
1981
|
-
*
|
|
1982
|
-
* Returns a JavaScript `Error` for invalid text or a failed search.
|
|
1983
|
-
* @param {string} text
|
|
1984
|
-
* @param {number} symprec
|
|
1985
|
-
* @returns {any}
|
|
1986
|
-
*/
|
|
1987
|
-
export function standardize_info(text, symprec) {
|
|
1988
|
-
const val2 = +symprec;
|
|
1989
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1990
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1991
|
-
const ret = wasm.standardize_info(ptr0, len0, val2);
|
|
1992
|
-
if (ret[2]) {
|
|
1993
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
3909
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1994
3910
|
}
|
|
1995
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1996
3911
|
}
|
|
1997
3912
|
|
|
1998
3913
|
/**
|
|
@@ -2033,6 +3948,52 @@ export function subgroups_info(hall_number, epsilon) {
|
|
|
2033
3948
|
return takeFromExternrefTable0(ret[0]);
|
|
2034
3949
|
}
|
|
2035
3950
|
|
|
3951
|
+
/**
|
|
3952
|
+
* Symmetry-unique substitutions as JSON.
|
|
3953
|
+
*
|
|
3954
|
+
* # Errors
|
|
3955
|
+
*
|
|
3956
|
+
* Returns a JavaScript `Error` for invalid text or species.
|
|
3957
|
+
* @param {string} text
|
|
3958
|
+
* @param {string} format_hint
|
|
3959
|
+
* @param {string} species
|
|
3960
|
+
* @param {number} min_image
|
|
3961
|
+
* @returns {string}
|
|
3962
|
+
*/
|
|
3963
|
+
export function substitutions(text, format_hint, species, min_image) {
|
|
3964
|
+
let deferred6_0;
|
|
3965
|
+
let deferred6_1;
|
|
3966
|
+
try {
|
|
3967
|
+
const val4 = +min_image;
|
|
3968
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3969
|
+
try {
|
|
3970
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3971
|
+
len0 = WASM_VECTOR_LEN;
|
|
3972
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3973
|
+
len1 = WASM_VECTOR_LEN;
|
|
3974
|
+
ptr2 = passStringToWasm0(species, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3975
|
+
len2 = WASM_VECTOR_LEN;
|
|
3976
|
+
} catch (e) {
|
|
3977
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
3978
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3979
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
3980
|
+
throw e;
|
|
3981
|
+
}
|
|
3982
|
+
const ret = wasm.substitutions(ptr0, len0, ptr1, len1, ptr2, len2, val4);
|
|
3983
|
+
var ptr5 = ret[0];
|
|
3984
|
+
var len5 = ret[1];
|
|
3985
|
+
if (ret[3]) {
|
|
3986
|
+
ptr5 = 0; len5 = 0;
|
|
3987
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3988
|
+
}
|
|
3989
|
+
deferred6_0 = ptr5;
|
|
3990
|
+
deferred6_1 = len5;
|
|
3991
|
+
return getStringFromWasm0(ptr5, len5);
|
|
3992
|
+
} finally {
|
|
3993
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
|
|
2036
3997
|
/**
|
|
2037
3998
|
* Builds a supercell and returns its summary object.
|
|
2038
3999
|
*
|
|
@@ -2118,6 +4079,36 @@ export function to_p1_info(text) {
|
|
|
2118
4079
|
return takeFromExternrefTable0(ret[0]);
|
|
2119
4080
|
}
|
|
2120
4081
|
|
|
4082
|
+
/**
|
|
4083
|
+
* Expands a structure to P1 and returns it as CIF.
|
|
4084
|
+
*
|
|
4085
|
+
* # Errors
|
|
4086
|
+
*
|
|
4087
|
+
* Returns a JavaScript `Error` for invalid text or an empty structure.
|
|
4088
|
+
* @param {string} text
|
|
4089
|
+
* @returns {string}
|
|
4090
|
+
*/
|
|
4091
|
+
export function to_p1_text(text) {
|
|
4092
|
+
let deferred3_0;
|
|
4093
|
+
let deferred3_1;
|
|
4094
|
+
try {
|
|
4095
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4096
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4097
|
+
const ret = wasm.to_p1_text(ptr0, len0);
|
|
4098
|
+
var ptr2 = ret[0];
|
|
4099
|
+
var len2 = ret[1];
|
|
4100
|
+
if (ret[3]) {
|
|
4101
|
+
ptr2 = 0; len2 = 0;
|
|
4102
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4103
|
+
}
|
|
4104
|
+
deferred3_0 = ptr2;
|
|
4105
|
+
deferred3_1 = len2;
|
|
4106
|
+
return getStringFromWasm0(ptr2, len2);
|
|
4107
|
+
} finally {
|
|
4108
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
|
|
2121
4112
|
/**
|
|
2122
4113
|
* Detects across the default tolerance ladder.
|
|
2123
4114
|
*
|
|
@@ -2185,6 +4176,92 @@ export function twist_info(n, m, theta, layers) {
|
|
|
2185
4176
|
return takeFromExternrefTable0(ret[0]);
|
|
2186
4177
|
}
|
|
2187
4178
|
|
|
4179
|
+
/**
|
|
4180
|
+
* Symmetry-unique Miller indices as JSON.
|
|
4181
|
+
*
|
|
4182
|
+
* # Errors
|
|
4183
|
+
*
|
|
4184
|
+
* Returns a JavaScript `Error` for invalid text or a bad index bound.
|
|
4185
|
+
* @param {string} text
|
|
4186
|
+
* @param {string} format_hint
|
|
4187
|
+
* @param {string} options_json
|
|
4188
|
+
* @returns {string}
|
|
4189
|
+
*/
|
|
4190
|
+
export function unique_miller_indices(text, format_hint, options_json) {
|
|
4191
|
+
let deferred5_0;
|
|
4192
|
+
let deferred5_1;
|
|
4193
|
+
try {
|
|
4194
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4195
|
+
try {
|
|
4196
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4197
|
+
len0 = WASM_VECTOR_LEN;
|
|
4198
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4199
|
+
len1 = WASM_VECTOR_LEN;
|
|
4200
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4201
|
+
len2 = WASM_VECTOR_LEN;
|
|
4202
|
+
} catch (e) {
|
|
4203
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
4204
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
4205
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
4206
|
+
throw e;
|
|
4207
|
+
}
|
|
4208
|
+
const ret = wasm.unique_miller_indices(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4209
|
+
var ptr4 = ret[0];
|
|
4210
|
+
var len4 = ret[1];
|
|
4211
|
+
if (ret[3]) {
|
|
4212
|
+
ptr4 = 0; len4 = 0;
|
|
4213
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4214
|
+
}
|
|
4215
|
+
deferred5_0 = ptr4;
|
|
4216
|
+
deferred5_1 = len4;
|
|
4217
|
+
return getStringFromWasm0(ptr4, len4);
|
|
4218
|
+
} finally {
|
|
4219
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
|
|
4223
|
+
/**
|
|
4224
|
+
* Symmetry-unique vacancies as JSON.
|
|
4225
|
+
*
|
|
4226
|
+
* # Errors
|
|
4227
|
+
*
|
|
4228
|
+
* Returns a JavaScript `Error` for invalid text or distance.
|
|
4229
|
+
* @param {string} text
|
|
4230
|
+
* @param {string} format_hint
|
|
4231
|
+
* @param {number} min_image
|
|
4232
|
+
* @returns {string}
|
|
4233
|
+
*/
|
|
4234
|
+
export function vacancies(text, format_hint, min_image) {
|
|
4235
|
+
let deferred5_0;
|
|
4236
|
+
let deferred5_1;
|
|
4237
|
+
try {
|
|
4238
|
+
const val3 = +min_image;
|
|
4239
|
+
let ptr0, len0, ptr1, len1;
|
|
4240
|
+
try {
|
|
4241
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4242
|
+
len0 = WASM_VECTOR_LEN;
|
|
4243
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4244
|
+
len1 = WASM_VECTOR_LEN;
|
|
4245
|
+
} catch (e) {
|
|
4246
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
4247
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
4248
|
+
throw e;
|
|
4249
|
+
}
|
|
4250
|
+
const ret = wasm.vacancies(ptr0, len0, ptr1, len1, val3);
|
|
4251
|
+
var ptr4 = ret[0];
|
|
4252
|
+
var len4 = ret[1];
|
|
4253
|
+
if (ret[3]) {
|
|
4254
|
+
ptr4 = 0; len4 = 0;
|
|
4255
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4256
|
+
}
|
|
4257
|
+
deferred5_0 = ptr4;
|
|
4258
|
+
deferred5_1 = len4;
|
|
4259
|
+
return getStringFromWasm0(ptr4, len4);
|
|
4260
|
+
} finally {
|
|
4261
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
|
|
2188
4265
|
/**
|
|
2189
4266
|
* Version of the workspace.
|
|
2190
4267
|
* @returns {string}
|
|
@@ -2202,6 +4279,48 @@ export function version() {
|
|
|
2202
4279
|
}
|
|
2203
4280
|
}
|
|
2204
4281
|
|
|
4282
|
+
/**
|
|
4283
|
+
* Periodic Voronoi cells as JSON.
|
|
4284
|
+
*
|
|
4285
|
+
* # Errors
|
|
4286
|
+
*
|
|
4287
|
+
* Returns a JavaScript `Error` for invalid text or cutoff.
|
|
4288
|
+
* @param {string} text
|
|
4289
|
+
* @param {string} format_hint
|
|
4290
|
+
* @param {number} cutoff
|
|
4291
|
+
* @returns {string}
|
|
4292
|
+
*/
|
|
4293
|
+
export function voronoi(text, format_hint, cutoff) {
|
|
4294
|
+
let deferred5_0;
|
|
4295
|
+
let deferred5_1;
|
|
4296
|
+
try {
|
|
4297
|
+
const val3 = +cutoff;
|
|
4298
|
+
let ptr0, len0, ptr1, len1;
|
|
4299
|
+
try {
|
|
4300
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4301
|
+
len0 = WASM_VECTOR_LEN;
|
|
4302
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4303
|
+
len1 = WASM_VECTOR_LEN;
|
|
4304
|
+
} catch (e) {
|
|
4305
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
4306
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
4307
|
+
throw e;
|
|
4308
|
+
}
|
|
4309
|
+
const ret = wasm.voronoi(ptr0, len0, ptr1, len1, val3);
|
|
4310
|
+
var ptr4 = ret[0];
|
|
4311
|
+
var len4 = ret[1];
|
|
4312
|
+
if (ret[3]) {
|
|
4313
|
+
ptr4 = 0; len4 = 0;
|
|
4314
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4315
|
+
}
|
|
4316
|
+
deferred5_0 = ptr4;
|
|
4317
|
+
deferred5_1 = len4;
|
|
4318
|
+
return getStringFromWasm0(ptr4, len4);
|
|
4319
|
+
} finally {
|
|
4320
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
|
|
2205
4324
|
/**
|
|
2206
4325
|
* Archives run records (a JSON array) into an in-memory ZIP.
|
|
2207
4326
|
*
|
|
@@ -2242,6 +4361,50 @@ export function workspace_read_archive(bytes) {
|
|
|
2242
4361
|
return takeFromExternrefTable0(ret[0]);
|
|
2243
4362
|
}
|
|
2244
4363
|
|
|
4364
|
+
/**
|
|
4365
|
+
* Wulff construction as JSON.
|
|
4366
|
+
*
|
|
4367
|
+
* # Errors
|
|
4368
|
+
*
|
|
4369
|
+
* Returns a JavaScript `Error` for invalid text or surface energies.
|
|
4370
|
+
* @param {string} text
|
|
4371
|
+
* @param {string} format_hint
|
|
4372
|
+
* @param {string} options_json
|
|
4373
|
+
* @returns {string}
|
|
4374
|
+
*/
|
|
4375
|
+
export function wulff(text, format_hint, options_json) {
|
|
4376
|
+
let deferred5_0;
|
|
4377
|
+
let deferred5_1;
|
|
4378
|
+
try {
|
|
4379
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4380
|
+
try {
|
|
4381
|
+
ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4382
|
+
len0 = WASM_VECTOR_LEN;
|
|
4383
|
+
ptr1 = passStringToWasm0(format_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4384
|
+
len1 = WASM_VECTOR_LEN;
|
|
4385
|
+
ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4386
|
+
len2 = WASM_VECTOR_LEN;
|
|
4387
|
+
} catch (e) {
|
|
4388
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
4389
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
4390
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
4391
|
+
throw e;
|
|
4392
|
+
}
|
|
4393
|
+
const ret = wasm.wulff(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4394
|
+
var ptr4 = ret[0];
|
|
4395
|
+
var len4 = ret[1];
|
|
4396
|
+
if (ret[3]) {
|
|
4397
|
+
ptr4 = 0; len4 = 0;
|
|
4398
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4399
|
+
}
|
|
4400
|
+
deferred5_0 = ptr4;
|
|
4401
|
+
deferred5_1 = len4;
|
|
4402
|
+
return getStringFromWasm0(ptr4, len4);
|
|
4403
|
+
} finally {
|
|
4404
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
|
|
2245
4408
|
/**
|
|
2246
4409
|
* Returns Wyckoff assignments.
|
|
2247
4410
|
*
|
|
@@ -2307,12 +4470,24 @@ export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
|
|
|
2307
4470
|
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
2308
4471
|
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
2309
4472
|
}
|
|
4473
|
+
export function __wbg___wbindgen_string_get_7ce8eee7fd327545(arg0, arg1) {
|
|
4474
|
+
const obj = arg1;
|
|
4475
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
4476
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4477
|
+
var len1 = WASM_VECTOR_LEN;
|
|
4478
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
4479
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
4480
|
+
}
|
|
2310
4481
|
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
2311
4482
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2312
4483
|
}
|
|
2313
4484
|
export function __wbg_getRandomValues_8b6f1f663e6f188d() { return handleError(function (arg0, arg1) {
|
|
2314
4485
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
2315
4486
|
}, arguments); }
|
|
4487
|
+
export function __wbg_length_b03a0fabb109b1e9(arg0) {
|
|
4488
|
+
const ret = arg0.length;
|
|
4489
|
+
return ret;
|
|
4490
|
+
}
|
|
2316
4491
|
export function __wbg_new_37eb45aaf5eeb820() {
|
|
2317
4492
|
const ret = new Array();
|
|
2318
4493
|
return ret;
|
|
@@ -2502,6 +4677,16 @@ function passArrayF64ToWasm0(arg, malloc) {
|
|
|
2502
4677
|
return ptr;
|
|
2503
4678
|
}
|
|
2504
4679
|
|
|
4680
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
4681
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
4682
|
+
for (let i = 0; i < array.length; i++) {
|
|
4683
|
+
const add = addToExternrefTable0(array[i]);
|
|
4684
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
4685
|
+
}
|
|
4686
|
+
WASM_VECTOR_LEN = array.length;
|
|
4687
|
+
return ptr;
|
|
4688
|
+
}
|
|
4689
|
+
|
|
2505
4690
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
2506
4691
|
if (realloc === undefined) {
|
|
2507
4692
|
const buf = cachedTextEncoder.encode(arg);
|