@mat3ra/made 2024.3.22-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.
Files changed (176) hide show
  1. package/.babelrc +10 -0
  2. package/.eslintrc.json +11 -0
  3. package/.mocharc.json +5 -0
  4. package/.prettierignore +1 -0
  5. package/.prettierrc +6 -0
  6. package/LICENSE.md +15 -0
  7. package/README.md +167 -0
  8. package/dist/abstract/array_with_ids.d.ts +43 -0
  9. package/dist/abstract/array_with_ids.js +88 -0
  10. package/dist/abstract/scalar_with_id.d.ts +25 -0
  11. package/dist/abstract/scalar_with_id.js +44 -0
  12. package/dist/basis/basis.d.ts +269 -0
  13. package/dist/basis/basis.js +499 -0
  14. package/dist/basis/constrained_basis.d.ts +56 -0
  15. package/dist/basis/constrained_basis.js +90 -0
  16. package/dist/basis/types.d.ts +1 -0
  17. package/dist/basis/types.js +2 -0
  18. package/dist/cell/cell.d.ts +45 -0
  19. package/dist/cell/cell.js +88 -0
  20. package/dist/cell/conventional_cell.d.ts +22 -0
  21. package/dist/cell/conventional_cell.js +83 -0
  22. package/dist/cell/primitive_cell.d.ts +9 -0
  23. package/dist/cell/primitive_cell.js +166 -0
  24. package/dist/constants.d.ts +2 -0
  25. package/dist/constants.js +25 -0
  26. package/dist/constraints/constraints.d.ts +45 -0
  27. package/dist/constraints/constraints.js +49 -0
  28. package/dist/lattice/lattice.d.ts +104 -0
  29. package/dist/lattice/lattice.js +208 -0
  30. package/dist/lattice/lattice_bravais.d.ts +59 -0
  31. package/dist/lattice/lattice_bravais.js +120 -0
  32. package/dist/lattice/lattice_vectors.d.ts +46 -0
  33. package/dist/lattice/lattice_vectors.js +98 -0
  34. package/dist/lattice/reciprocal/lattice_reciprocal.d.ts +75 -0
  35. package/dist/lattice/reciprocal/lattice_reciprocal.js +148 -0
  36. package/dist/lattice/reciprocal/paths.d.ts +24 -0
  37. package/dist/lattice/reciprocal/paths.js +136 -0
  38. package/dist/lattice/reciprocal/symmetry_points.d.ts +8 -0
  39. package/dist/lattice/reciprocal/symmetry_points.js +866 -0
  40. package/dist/lattice/types.d.ts +49 -0
  41. package/dist/lattice/types.js +127 -0
  42. package/dist/lattice/unit_cell.d.ts +30 -0
  43. package/dist/lattice/unit_cell.js +31 -0
  44. package/dist/made.d.ts +40 -0
  45. package/dist/made.js +39 -0
  46. package/dist/material.d.ts +1562 -0
  47. package/dist/material.js +317 -0
  48. package/dist/math.d.ts +395 -0
  49. package/dist/math.js +7 -0
  50. package/dist/parsers/cif.d.ts +10 -0
  51. package/dist/parsers/cif.js +21 -0
  52. package/dist/parsers/errors.d.ts +5 -0
  53. package/dist/parsers/errors.js +11 -0
  54. package/dist/parsers/espresso.d.ts +10 -0
  55. package/dist/parsers/espresso.js +24 -0
  56. package/dist/parsers/native_format_parsers.d.ts +26 -0
  57. package/dist/parsers/native_format_parsers.js +52 -0
  58. package/dist/parsers/parsers.d.ts +13 -0
  59. package/dist/parsers/parsers.js +17 -0
  60. package/dist/parsers/poscar.d.ts +31 -0
  61. package/dist/parsers/poscar.js +180 -0
  62. package/dist/parsers/xyz.d.ts +62 -0
  63. package/dist/parsers/xyz.js +167 -0
  64. package/dist/parsers/xyz_combinatorial_basis.d.ts +64 -0
  65. package/dist/parsers/xyz_combinatorial_basis.js +241 -0
  66. package/dist/tools/basis.d.ts +22 -0
  67. package/dist/tools/basis.js +100 -0
  68. package/dist/tools/cell.d.ts +9 -0
  69. package/dist/tools/cell.js +39 -0
  70. package/dist/tools/index.d.ts +11 -0
  71. package/dist/tools/index.js +15 -0
  72. package/dist/tools/material.d.ts +25 -0
  73. package/dist/tools/material.js +54 -0
  74. package/dist/tools/supercell.d.ts +22 -0
  75. package/dist/tools/supercell.js +62 -0
  76. package/dist/tools/surface.d.ts +10 -0
  77. package/dist/tools/surface.js +147 -0
  78. package/dist/types.d.ts +3 -0
  79. package/dist/types.js +2 -0
  80. package/package.json +89 -0
  81. package/pyproject.toml +77 -0
  82. package/src/js/abstract/array_with_ids.ts +100 -0
  83. package/src/js/abstract/scalar_with_id.ts +53 -0
  84. package/src/js/basis/basis.ts +607 -0
  85. package/src/js/basis/constrained_basis.ts +107 -0
  86. package/src/js/basis/types.ts +1 -0
  87. package/src/js/cell/cell.ts +109 -0
  88. package/src/js/cell/conventional_cell.ts +89 -0
  89. package/src/js/cell/primitive_cell.ts +189 -0
  90. package/src/js/constants.js +4 -0
  91. package/src/js/constraints/constraints.ts +63 -0
  92. package/src/js/lattice/lattice.ts +229 -0
  93. package/src/js/lattice/lattice_bravais.ts +170 -0
  94. package/src/js/lattice/lattice_vectors.ts +126 -0
  95. package/src/js/lattice/reciprocal/lattice_reciprocal.js +155 -0
  96. package/src/js/lattice/reciprocal/paths.js +134 -0
  97. package/src/js/lattice/reciprocal/symmetry_points.ts +886 -0
  98. package/src/js/lattice/types.ts +142 -0
  99. package/src/js/lattice/unit_cell.ts +66 -0
  100. package/src/js/made.js +36 -0
  101. package/src/js/material.ts +398 -0
  102. package/src/js/math.js +6 -0
  103. package/src/js/parsers/cif.js +22 -0
  104. package/src/js/parsers/errors.js +7 -0
  105. package/src/js/parsers/espresso.ts +30 -0
  106. package/src/js/parsers/native_format_parsers.js +51 -0
  107. package/src/js/parsers/parsers.js +13 -0
  108. package/src/js/parsers/poscar.ts +201 -0
  109. package/src/js/parsers/xyz.ts +216 -0
  110. package/src/js/parsers/xyz_combinatorial_basis.js +243 -0
  111. package/src/js/tools/basis.js +116 -0
  112. package/src/js/tools/cell.js +36 -0
  113. package/src/js/tools/index.js +11 -0
  114. package/src/js/tools/material.js +60 -0
  115. package/src/js/tools/supercell.ts +80 -0
  116. package/src/js/tools/surface.js +176 -0
  117. package/src/js/types.ts +4 -0
  118. package/src/py/__init__.py +0 -0
  119. package/src/py/mat3ra/__init__.py +0 -0
  120. package/src/py/mat3ra/made/__init__.py +5 -0
  121. package/tests/.gitattributes +1 -0
  122. package/tests/fixtures/AsGe-basis.json +3 -0
  123. package/tests/fixtures/C2H4-translated.json +3 -0
  124. package/tests/fixtures/C2H4.json +3 -0
  125. package/tests/fixtures/FeLiSi-basis.json +3 -0
  126. package/tests/fixtures/FeO.json +3 -0
  127. package/tests/fixtures/Ge2-basis.json +3 -0
  128. package/tests/fixtures/Graphene.json +3 -0
  129. package/tests/fixtures/Graphene.poscar +3 -0
  130. package/tests/fixtures/H2+H-final.json +3 -0
  131. package/tests/fixtures/H2+H-image.json +3 -0
  132. package/tests/fixtures/H2+H-initial.json +3 -0
  133. package/tests/fixtures/H2O.poscar +3 -0
  134. package/tests/fixtures/LiFeSi-basis.json +3 -0
  135. package/tests/fixtures/Na.json +3 -0
  136. package/tests/fixtures/Na4Cl4-cartesian.json +3 -0
  137. package/tests/fixtures/Na4Cl4.json +3 -0
  138. package/tests/fixtures/Na4Cl4.poscar +3 -0
  139. package/tests/fixtures/Ni-hex.json +3 -0
  140. package/tests/fixtures/Ni-hex.poscar +3 -0
  141. package/tests/fixtures/OSi-basis.json +3 -0
  142. package/tests/fixtures/Si-hex.json +3 -0
  143. package/tests/fixtures/Si-hex.poscar +3 -0
  144. package/tests/fixtures/Si-pwscf.in +3 -0
  145. package/tests/fixtures/Si-slab.json +3 -0
  146. package/tests/fixtures/Si-supercell.json +3 -0
  147. package/tests/fixtures/Si.json +3 -0
  148. package/tests/fixtures/Si2-basis-repeated.json +3 -0
  149. package/tests/fixtures/Si2-basis.json +3 -0
  150. package/tests/fixtures/Zr1H23Zr1H1.json +3 -0
  151. package/tests/fixtures/Zr1H23Zr1H1.poscar +3 -0
  152. package/tests/fixtures/atomic-constraints.json +3 -0
  153. package/tests/js/basis/basis.js +221 -0
  154. package/tests/js/cell/cell.js +21 -0
  155. package/tests/js/cell/primitive_cell.js +17 -0
  156. package/tests/js/constraints/constraints.js +27 -0
  157. package/tests/js/enums.js +40 -0
  158. package/tests/js/lattice/lattice.js +31 -0
  159. package/tests/js/lattice/lattice_bravais.js +17 -0
  160. package/tests/js/lattice/lattice_reciprocal.js +99 -0
  161. package/tests/js/lattice/lattice_vectors.js +10 -0
  162. package/tests/js/material.test.js +11 -0
  163. package/tests/js/parsers/espresso.js +12 -0
  164. package/tests/js/parsers/native_formats.js +30 -0
  165. package/tests/js/parsers/poscar.js +21 -0
  166. package/tests/js/parsers/xyz.js +25 -0
  167. package/tests/js/parsers/xyz_combinatorial_basis.js +153 -0
  168. package/tests/js/setup.js +6 -0
  169. package/tests/js/tools/basis.js +18 -0
  170. package/tests/js/tools/supercell.js +23 -0
  171. package/tests/js/tools/surface.js +12 -0
  172. package/tests/js/utils.js +17 -0
  173. package/tests/py/__init__.py +0 -0
  174. package/tests/py/unit/__init__.py +0 -0
  175. package/tests/py/unit/test_sample.py +10 -0
  176. package/tsconfig.json +3 -0
@@ -0,0 +1,49 @@
1
+ import { ArrayOf3NumberElementsSchema, LatticeTypeSchema } from "@mat3ra/esse/lib/js/types";
2
+ export declare const DEFAULT_LATTICE_UNITS: {
3
+ length: {
4
+ angstrom: string;
5
+ };
6
+ angle: {
7
+ degree: string;
8
+ };
9
+ };
10
+ export declare enum LatticeTypeExtended {
11
+ BCC = "BCC",
12
+ BCT_1 = "BCT-1",
13
+ BCT_2 = "BCT-2",
14
+ CUB = "CUB",
15
+ FCC = "FCC",
16
+ HEX = "HEX",
17
+ MCL = "MCL",
18
+ MCLC_1 = "MCLC-1",
19
+ MCLC_2 = "MCLC-2",
20
+ MCLC_3 = "MCLC-3",
21
+ MCLC_4 = "MCLC-4",
22
+ MCLC_5 = "MCLC-5",
23
+ ORC = "ORC",
24
+ ORCC = "ORCC",
25
+ ORCF_1 = "ORCF-1",
26
+ ORCF_2 = "ORCF-2",
27
+ ORCF_3 = "ORCF-3",
28
+ ORCI = "ORCI",
29
+ RHL_1 = "RHL-1",
30
+ RHL_2 = "RHL-2",
31
+ TET = "TET",
32
+ TRI_1a = "TRI_1a",
33
+ TRI_2a = "TRI_2a",
34
+ TRI_1b = "TRI_1b"
35
+ }
36
+ export type Vector = ArrayOf3NumberElementsSchema;
37
+ export interface VectorsAsArray extends Array<Vector> {
38
+ 0: Vector;
39
+ 1: Vector;
40
+ 2: Vector;
41
+ }
42
+ interface LatticeTypeConfig {
43
+ label: string;
44
+ code: LatticeTypeSchema;
45
+ editables: string[];
46
+ editablesConventional: string[];
47
+ }
48
+ export declare const LATTICE_TYPE_CONFIGS: LatticeTypeConfig[];
49
+ export {};
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LATTICE_TYPE_CONFIGS = exports.LatticeTypeExtended = exports.DEFAULT_LATTICE_UNITS = void 0;
4
+ exports.DEFAULT_LATTICE_UNITS = {
5
+ // by default lattice vectors shall be measured in angstrom, angles - in degrees
6
+ length: {
7
+ angstrom: "angstrom",
8
+ },
9
+ angle: {
10
+ degree: "degree",
11
+ },
12
+ };
13
+ var LatticeTypeExtended;
14
+ (function (LatticeTypeExtended) {
15
+ LatticeTypeExtended["BCC"] = "BCC";
16
+ LatticeTypeExtended["BCT_1"] = "BCT-1";
17
+ LatticeTypeExtended["BCT_2"] = "BCT-2";
18
+ LatticeTypeExtended["CUB"] = "CUB";
19
+ LatticeTypeExtended["FCC"] = "FCC";
20
+ LatticeTypeExtended["HEX"] = "HEX";
21
+ LatticeTypeExtended["MCL"] = "MCL";
22
+ LatticeTypeExtended["MCLC_1"] = "MCLC-1";
23
+ LatticeTypeExtended["MCLC_2"] = "MCLC-2";
24
+ LatticeTypeExtended["MCLC_3"] = "MCLC-3";
25
+ LatticeTypeExtended["MCLC_4"] = "MCLC-4";
26
+ LatticeTypeExtended["MCLC_5"] = "MCLC-5";
27
+ LatticeTypeExtended["ORC"] = "ORC";
28
+ LatticeTypeExtended["ORCC"] = "ORCC";
29
+ LatticeTypeExtended["ORCF_1"] = "ORCF-1";
30
+ LatticeTypeExtended["ORCF_2"] = "ORCF-2";
31
+ LatticeTypeExtended["ORCF_3"] = "ORCF-3";
32
+ LatticeTypeExtended["ORCI"] = "ORCI";
33
+ LatticeTypeExtended["RHL_1"] = "RHL-1";
34
+ LatticeTypeExtended["RHL_2"] = "RHL-2";
35
+ LatticeTypeExtended["TET"] = "TET";
36
+ LatticeTypeExtended["TRI_1a"] = "TRI_1a";
37
+ LatticeTypeExtended["TRI_2a"] = "TRI_2a";
38
+ LatticeTypeExtended["TRI_1b"] = "TRI_1b";
39
+ })(LatticeTypeExtended = exports.LatticeTypeExtended || (exports.LatticeTypeExtended = {}));
40
+ exports.LATTICE_TYPE_CONFIGS = [
41
+ {
42
+ label: "Simple Cubic",
43
+ code: "CUB",
44
+ // editables for primitive cell => WARNING: not tested
45
+ editables: ["a"],
46
+ // editables for conventional cell, taken from the publication above
47
+ editablesConventional: ["a"],
48
+ },
49
+ {
50
+ label: "Face-centered Cubic",
51
+ code: "FCC",
52
+ editables: ["a"],
53
+ editablesConventional: ["a"],
54
+ },
55
+ {
56
+ label: "Body-centered Cubic",
57
+ code: "BCC",
58
+ editables: ["a"],
59
+ editablesConventional: ["a"],
60
+ },
61
+ {
62
+ label: "Tetragonal",
63
+ code: "TET",
64
+ editables: ["a", "c"],
65
+ editablesConventional: ["a", "c"],
66
+ },
67
+ {
68
+ label: "Body-centered Tetragonal",
69
+ code: "BCT",
70
+ editables: ["a"],
71
+ editablesConventional: ["a", "c"],
72
+ },
73
+ {
74
+ label: "Orthorombic",
75
+ code: "ORC",
76
+ editables: ["a", "b", "c"],
77
+ editablesConventional: ["a", "b", "c"],
78
+ },
79
+ {
80
+ label: "Orthorombic Face-centered",
81
+ code: "ORCF",
82
+ editables: ["a", "b", "c"],
83
+ editablesConventional: ["a", "b", "c"],
84
+ },
85
+ {
86
+ label: "Orthorombic Body-centered",
87
+ code: "ORCI",
88
+ editables: ["a", "alpha", "gamma"],
89
+ editablesConventional: ["a", "b", "c"],
90
+ },
91
+ {
92
+ label: "Orthorombic Base-centered",
93
+ code: "ORCC",
94
+ editables: ["a", "c", "alpha"],
95
+ editablesConventional: ["a", "b", "c"],
96
+ },
97
+ {
98
+ label: "Hexagonal",
99
+ code: "HEX",
100
+ editables: ["a", "c"],
101
+ editablesConventional: ["a", "c"],
102
+ },
103
+ {
104
+ label: "Rhombohedral",
105
+ code: "RHL",
106
+ editables: ["a", "alpha"],
107
+ editablesConventional: ["a", "alpha"],
108
+ },
109
+ {
110
+ label: "Monoclinic",
111
+ code: "MCL",
112
+ editables: ["a", "b", "c", "alpha"],
113
+ editablesConventional: ["a", "b", "c", "alpha"],
114
+ },
115
+ {
116
+ label: "Monoclinic Base-centered",
117
+ code: "MCLC",
118
+ editables: ["a", "c", "alpha", "gamma"],
119
+ editablesConventional: ["a", "b", "c", "alpha"],
120
+ },
121
+ {
122
+ label: "Triclinic",
123
+ code: "TRI",
124
+ editables: ["a", "b", "c", "alpha", "beta", "gamma"],
125
+ editablesConventional: ["a", "b", "c", "alpha", "beta", "gamma"],
126
+ },
127
+ ];
@@ -0,0 +1,30 @@
1
+ import { Vector } from "./types";
2
+ export type UnitCellProps = [
3
+ number,
4
+ number,
5
+ number,
6
+ number,
7
+ number,
8
+ number,
9
+ number,
10
+ number,
11
+ number,
12
+ string
13
+ ];
14
+ export declare class UnitCell {
15
+ ax: number;
16
+ ay: number;
17
+ az: number;
18
+ bx: number;
19
+ by: number;
20
+ bz: number;
21
+ cx: number;
22
+ cy: number;
23
+ cz: number;
24
+ units: string;
25
+ constructor([ax, ay, az, bx, by, bz, cx, cy, cz, units]: UnitCellProps);
26
+ vectorA(): Vector;
27
+ vectorB(): Vector;
28
+ vectorC(): Vector;
29
+ axes(): [Vector, Vector, Vector];
30
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitCell = void 0;
4
+ // TODO: refactor and remove the need for UnitCell
5
+ class UnitCell {
6
+ constructor([ax, ay, az, bx, by, bz, cx, cy, cz, units]) {
7
+ this.ax = ax;
8
+ this.ay = ay;
9
+ this.az = az;
10
+ this.bx = bx;
11
+ this.by = by;
12
+ this.bz = bz;
13
+ this.cx = cx;
14
+ this.cy = cy;
15
+ this.cz = cz;
16
+ this.units = units;
17
+ }
18
+ vectorA() {
19
+ return [this.ax, this.ay, this.az];
20
+ }
21
+ vectorB() {
22
+ return [this.bx, this.by, this.bz];
23
+ }
24
+ vectorC() {
25
+ return [this.cx, this.cy, this.cz];
26
+ }
27
+ axes() {
28
+ return [this.vectorA(), this.vectorB(), this.vectorC()];
29
+ }
30
+ }
31
+ exports.UnitCell = UnitCell;
package/dist/made.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ export namespace Made {
2
+ export { coefficients };
3
+ export { tolerance };
4
+ export { units };
5
+ export { ATOMIC_COORD_UNITS };
6
+ export { MadeMath as math };
7
+ export { Material };
8
+ export { MaterialMixin };
9
+ export { defaultMaterialConfig };
10
+ export { Lattice };
11
+ export { nonPeriodicLatticeScalingFactor };
12
+ export { ReciprocalLattice };
13
+ export { Basis };
14
+ export { AtomicConstraints };
15
+ export { parsers };
16
+ export { tools };
17
+ export { LATTICE_TYPE_CONFIGS };
18
+ export { DEFAULT_LATTICE_UNITS };
19
+ export namespace primitive {
20
+ export { ArrayWithIds };
21
+ }
22
+ }
23
+ import { coefficients } from "@exabyte-io/code.js/dist/constants";
24
+ import { tolerance } from "@exabyte-io/code.js/dist/constants";
25
+ import { units } from "@exabyte-io/code.js/dist/constants";
26
+ import { ATOMIC_COORD_UNITS } from "@exabyte-io/code.js/dist/constants";
27
+ import MadeMath from "./math";
28
+ import { Material } from "./material";
29
+ import { MaterialMixin } from "./material";
30
+ import { defaultMaterialConfig } from "./material";
31
+ import { Lattice } from "./lattice/lattice";
32
+ import { nonPeriodicLatticeScalingFactor } from "./lattice/lattice";
33
+ import { ReciprocalLattice } from "./lattice/reciprocal/lattice_reciprocal";
34
+ import { Basis } from "./basis/basis";
35
+ import { AtomicConstraints } from "./constraints/constraints";
36
+ import parsers from "./parsers/parsers";
37
+ import tools from "./tools/index";
38
+ import { LATTICE_TYPE_CONFIGS } from "./lattice/types";
39
+ import { DEFAULT_LATTICE_UNITS } from "./lattice/types";
40
+ import { ArrayWithIds } from "./abstract/array_with_ids";
package/dist/made.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Made = void 0;
7
+ const array_with_ids_1 = require("./abstract/array_with_ids");
8
+ const basis_1 = require("./basis/basis");
9
+ const constants_1 = require("./constants");
10
+ const constraints_1 = require("./constraints/constraints");
11
+ const lattice_1 = require("./lattice/lattice");
12
+ const lattice_reciprocal_1 = require("./lattice/reciprocal/lattice_reciprocal");
13
+ const types_1 = require("./lattice/types");
14
+ const material_1 = require("./material");
15
+ const math_1 = __importDefault(require("./math"));
16
+ const parsers_1 = __importDefault(require("./parsers/parsers"));
17
+ const index_1 = __importDefault(require("./tools/index"));
18
+ exports.Made = {
19
+ coefficients: constants_1.coefficients,
20
+ tolerance: constants_1.tolerance,
21
+ units: constants_1.units,
22
+ ATOMIC_COORD_UNITS: constants_1.ATOMIC_COORD_UNITS,
23
+ math: math_1.default,
24
+ Material: material_1.Material,
25
+ MaterialMixin: material_1.MaterialMixin,
26
+ defaultMaterialConfig: material_1.defaultMaterialConfig,
27
+ Lattice: lattice_1.Lattice,
28
+ nonPeriodicLatticeScalingFactor: lattice_1.nonPeriodicLatticeScalingFactor,
29
+ ReciprocalLattice: lattice_reciprocal_1.ReciprocalLattice,
30
+ Basis: basis_1.Basis,
31
+ AtomicConstraints: constraints_1.AtomicConstraints,
32
+ parsers: parsers_1.default,
33
+ tools: index_1.default,
34
+ LATTICE_TYPE_CONFIGS: types_1.LATTICE_TYPE_CONFIGS,
35
+ DEFAULT_LATTICE_UNITS: types_1.DEFAULT_LATTICE_UNITS,
36
+ primitive: {
37
+ ArrayWithIds: array_with_ids_1.ArrayWithIds,
38
+ },
39
+ };