@mat3ra/made 2026.5.21-1 → 2026.5.28-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 (61) hide show
  1. package/dist/js/basis/basis.js +7 -10
  2. package/dist/js/basis/coordinates.js +2 -5
  3. package/dist/js/cell/primitive_cell.js +17 -20
  4. package/dist/js/lattice/lattice.js +22 -25
  5. package/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts +5 -8
  6. package/dist/js/lattice/reciprocal/lattice_reciprocal.js +17 -20
  7. package/dist/js/made.d.ts +0 -459
  8. package/dist/js/made.js +0 -2
  9. package/dist/js/material.d.ts +165 -9
  10. package/dist/js/material.js +355 -8
  11. package/dist/js/parsers/poscar.js +2 -2
  12. package/dist/js/parsers/xyz_combinatorial_basis.js +2 -5
  13. package/dist/js/tools/basis.js +3 -6
  14. package/dist/js/tools/cell.js +3 -6
  15. package/dist/js/tools/supercell.js +3 -3
  16. package/dist/js/tools/surface.js +13 -12
  17. package/package.json +3 -3
  18. package/src/js/basis/basis.ts +1 -1
  19. package/src/js/basis/coordinates.ts +1 -2
  20. package/src/js/cell/primitive_cell.ts +1 -2
  21. package/src/js/lattice/lattice.ts +1 -1
  22. package/src/js/lattice/reciprocal/lattice_reciprocal.ts +11 -17
  23. package/src/js/made.ts +0 -4
  24. package/src/js/material.ts +446 -20
  25. package/src/js/parsers/poscar.ts +1 -1
  26. package/src/js/parsers/xyz_combinatorial_basis.ts +1 -1
  27. package/src/js/tools/basis.ts +1 -1
  28. package/src/js/tools/cell.ts +1 -1
  29. package/src/js/tools/supercell.ts +1 -1
  30. package/src/js/tools/surface.ts +2 -1
  31. package/src/py/mat3ra/made/basis/__init__.py +4 -0
  32. package/src/py/mat3ra/made/tools/build/defective_structures/zero_dimensional/point_defect/substitutional/configuration.py +12 -0
  33. package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/point_defect_site/builder.py +1 -0
  34. package/src/py/mat3ra/made/tools/build_components/entities/auxiliary/zero_dimensional/point_defect_site/configuration.py +2 -1
  35. package/src/py/mat3ra/made/tools/operations/core/unary.py +2 -2
  36. package/tests/py/unit/test_tools_build_defect/test_point_defect.py +33 -0
  37. package/tests/py/unit/test_tools_calculate.py +2 -1
  38. package/dist/js/abstract/array_with_ids.d.ts +0 -43
  39. package/dist/js/abstract/array_with_ids.js +0 -88
  40. package/dist/js/abstract/scalar_with_id.d.ts +0 -25
  41. package/dist/js/abstract/scalar_with_id.js +0 -44
  42. package/dist/js/basis/types.d.ts +0 -1
  43. package/dist/js/basis/types.js +0 -2
  44. package/dist/js/lattice/lattice_bravais.d.ts +0 -59
  45. package/dist/js/lattice/lattice_bravais.js +0 -118
  46. package/dist/js/lattice/lattice_vectors.d.ts +0 -46
  47. package/dist/js/lattice/lattice_vectors.js +0 -98
  48. package/dist/js/lattice/types.d.ts +0 -49
  49. package/dist/js/lattice/types.js +0 -127
  50. package/dist/js/materialMixin.d.ts +0 -171
  51. package/dist/js/materialMixin.js +0 -363
  52. package/dist/js/math.d.ts +0 -459
  53. package/dist/js/math.js +0 -7
  54. package/dist/js/types/index.d.ts +0 -1
  55. package/dist/js/types/index.js +0 -17
  56. package/dist/js/types/material.d.ts +0 -18
  57. package/dist/js/types/material.js +0 -2
  58. package/dist/js/types.d.ts +0 -1
  59. package/dist/js/types.js +0 -2
  60. package/src/js/materialMixin.ts +0 -453
  61. package/src/js/math.ts +0 -6
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Basis = void 0;
7
4
  // @ts-ignore
8
5
  const periodic_table_js_1 = require("@exabyte-io/periodic-table.js");
9
6
  const entity_1 = require("@mat3ra/code/dist/js/entity");
7
+ const math_1 = require("@mat3ra/code/dist/js/math");
10
8
  const lodash_1 = require("lodash");
11
9
  const cell_1 = require("../cell/cell");
12
10
  const constants_1 = require("../constants");
13
11
  const lattice_1 = require("../lattice/lattice");
14
- const math_1 = __importDefault(require("../math"));
15
12
  const coordinates_1 = require("./coordinates");
16
13
  const elements_1 = require("./elements");
17
14
  const labels_1 = require("./labels");
@@ -166,7 +163,7 @@ class Basis extends entity_1.InMemoryEntity {
166
163
  }
167
164
  toStandardRepresentation() {
168
165
  this.toCrystal();
169
- this._coordinates.mapArrayInPlace((point) => point.map((x) => math_1.default.mod(x)));
166
+ this._coordinates.mapArrayInPlace((point) => point.map((x) => math_1.math.mod(x)));
170
167
  }
171
168
  /** A representation where all coordinates are within 0 and 1 in crystal units */
172
169
  get standardRepresentation() {
@@ -240,7 +237,7 @@ class Basis extends entity_1.InMemoryEntity {
240
237
  get formula() {
241
238
  const counts = this.uniqueElementCountsSortedByElectronegativity;
242
239
  const countsValues = (0, lodash_1.values)(counts);
243
- const gcd = countsValues.length > 1 ? math_1.default.gcd(...countsValues) : countsValues[0];
240
+ const gcd = countsValues.length > 1 ? math_1.math.gcd(...countsValues) : countsValues[0];
244
241
  return (0, lodash_1.toPairs)(counts)
245
242
  .map(([element, count]) => element + (count / gcd === 1 ? "" : count / gcd))
246
243
  .reduce((acc, part) => acc + part, "");
@@ -293,7 +290,7 @@ class Basis extends entity_1.InMemoryEntity {
293
290
  const element = entry[0];
294
291
  const coordinate = entry[1];
295
292
  const atomicLabel = entry[2];
296
- const toleratedCoordinate = coordinate.map((x) => math_1.default.round(x, constants_1.HASH_TOLERANCE));
293
+ const toleratedCoordinate = coordinate.map((x) => math_1.math.round(x, constants_1.HASH_TOLERANCE));
297
294
  return `${element}${atomicLabel} ${toleratedCoordinate.join()}`;
298
295
  });
299
296
  return `${standardRep.sort().join(";")};`;
@@ -364,7 +361,7 @@ class Basis extends entity_1.InMemoryEntity {
364
361
  hasEquivalentCellTo(anotherBasisClsInstance) {
365
362
  return !this.cell.vectorArrays
366
363
  .map((vector, idx) => {
367
- return math_1.default.vEqualWithTolerance(vector, anotherBasisClsInstance.cell.vectorArrays[idx]);
364
+ return math_1.math.vEqualWithTolerance(vector, anotherBasisClsInstance.cell.vectorArrays[idx]);
368
365
  })
369
366
  .some((x) => !x);
370
367
  }
@@ -401,7 +398,7 @@ class Basis extends entity_1.InMemoryEntity {
401
398
  const tolerance = overlapCoefficient *
402
399
  ((0, periodic_table_js_1.getElementAtomicRadius)(el1) + (0, periodic_table_js_1.getElementAtomicRadius)(el2)); // in angstroms
403
400
  // @ts-ignore
404
- const distance = math_1.default.vDist(entry1.value, entry2.value);
401
+ const distance = math_1.math.vDist(entry1.value, entry2.value);
405
402
  if (distance < tolerance) {
406
403
  overlaps.push({
407
404
  id1: i,
@@ -437,7 +434,7 @@ class Basis extends entity_1.InMemoryEntity {
437
434
  if (this._elements.values.length >= 2) {
438
435
  for (let i = 0; i < this._elements.values.length; i++) {
439
436
  for (let j = i + 1; j < this._elements.values.length; j++) {
440
- const distance = math_1.default.vDist(this._coordinates.getElementValueByIndex(i), this._coordinates.getElementValueByIndex(j));
437
+ const distance = math_1.math.vDist(this._coordinates.getElementValueByIndex(i), this._coordinates.getElementValueByIndex(j));
441
438
  if (distance && distance > maxDistance) {
442
439
  maxDistance = distance;
443
440
  }
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Coordinates = exports.Coordinate = void 0;
7
4
  const code_1 = require("@mat3ra/code");
5
+ const math_1 = require("@mat3ra/code/dist/js/math");
8
6
  const underscore_string_1 = require("underscore.string");
9
- const math_1 = __importDefault(require("../math"));
10
7
  class Coordinate extends code_1.RoundedValueWithId {
11
8
  constructor({ value, id }) {
12
9
  super(id, value);
@@ -61,7 +58,7 @@ class Coordinates extends code_1.RoundedArrayWithIds {
61
58
  });
62
59
  }
63
60
  getCenterPoint() {
64
- const transposed = math_1.default.transpose(this.values);
61
+ const transposed = math_1.math.transpose(this.values);
65
62
  const center = [0, 0, 0];
66
63
  for (let i = 0; i < 3; i++) {
67
64
  const axisCoords = transposed[i];
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getPrimitiveLatticeVectorsFromConfig = void 0;
7
- const math_1 = __importDefault(require("../math"));
4
+ const math_1 = require("@mat3ra/code/dist/js/math");
8
5
  /**
9
6
  * Routines for calculating primitive cell vectors from conventional cell Bravais parameters.
10
7
  * Following Setyawan, W., & Curtarolo, S. (2010). doi:10.1016/j.commatsci.2010.05.010
@@ -75,39 +72,39 @@ const PRIMITIVE_CELLS = {
75
72
  },
76
73
  HEX: ({ a, c }) => {
77
74
  return [
78
- [a / 2, (-a * math_1.default.sqrt(3)) / 2, 0],
79
- [a / 2, (a * math_1.default.sqrt(3)) / 2, 0],
75
+ [a / 2, (-a * math_1.math.sqrt(3)) / 2, 0],
76
+ [a / 2, (a * math_1.math.sqrt(3)) / 2, 0],
80
77
  [0, 0, c],
81
78
  ];
82
79
  },
83
80
  RHL: ({ a, alpha }) => {
84
- const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI);
85
- const cosHalfAlpha = math_1.default.sqrt((1 / 2) * (1 + cosAlpha));
86
- const sinHalfAlpha = math_1.default.sqrt((1 / 2) * (1 - cosAlpha));
81
+ const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI);
82
+ const cosHalfAlpha = math_1.math.sqrt((1 / 2) * (1 + cosAlpha));
83
+ const sinHalfAlpha = math_1.math.sqrt((1 / 2) * (1 - cosAlpha));
87
84
  return [
88
85
  [a * cosHalfAlpha, -a * sinHalfAlpha, 0.0],
89
86
  [a * cosHalfAlpha, a * sinHalfAlpha, 0.0],
90
87
  [
91
88
  (a * cosAlpha) / cosHalfAlpha,
92
89
  0.0,
93
- a * math_1.default.sqrt(1 - (cosAlpha * cosAlpha) / (cosHalfAlpha * cosHalfAlpha)),
90
+ a * math_1.math.sqrt(1 - (cosAlpha * cosAlpha) / (cosHalfAlpha * cosHalfAlpha)),
94
91
  ],
95
92
  ];
96
93
  },
97
94
  MCL: ({ a, b, c, alpha }) => {
98
- const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI);
95
+ const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI);
99
96
  return [
100
97
  [a, 0, 0],
101
98
  [0, b, 0],
102
- [0, c * cosAlpha, c * math_1.default.sqrt(1 - cosAlpha * cosAlpha)],
99
+ [0, c * cosAlpha, c * math_1.math.sqrt(1 - cosAlpha * cosAlpha)],
103
100
  ];
104
101
  },
105
102
  MCLC: ({ a, b, c, alpha }) => {
106
- const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI);
103
+ const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI);
107
104
  return [
108
105
  [a / 2, b / 2, 0],
109
106
  [-a / 2, b / 2, 0],
110
- [0, c * cosAlpha, c * math_1.default.sqrt(1 - cosAlpha * cosAlpha)],
107
+ [0, c * cosAlpha, c * math_1.math.sqrt(1 - cosAlpha * cosAlpha)],
111
108
  ];
112
109
  },
113
110
  // Algorithm from http://pymatgen.org/_modules/pymatgen/core/lattice.html (from_params)
@@ -116,9 +113,9 @@ const PRIMITIVE_CELLS = {
116
113
  // eslint-disable-next-line no-param-reassign
117
114
  [alpha, beta, gamma] = [alpha, beta, gamma].map(
118
115
  // @ts-ignore
119
- (x) => math_1.default.unit(x, "degree").to("rad").value);
120
- const [cosAlpha, cosBeta, cosGamma] = [alpha, beta, gamma].map((x) => math_1.default.cos(x));
121
- const [sinAlpha, sinBeta] = [alpha, beta].map((x) => math_1.default.sin(x));
116
+ (x) => math_1.math.unit(x, "degree").to("rad").value);
117
+ const [cosAlpha, cosBeta, cosGamma] = [alpha, beta, gamma].map((x) => math_1.math.cos(x));
118
+ const [sinAlpha, sinBeta] = [alpha, beta].map((x) => math_1.math.sin(x));
122
119
  let acosArg = (cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta);
123
120
  if (acosArg < -1) {
124
121
  acosArg = -1;
@@ -126,9 +123,9 @@ const PRIMITIVE_CELLS = {
126
123
  else if (acosArg > 1) {
127
124
  acosArg = 1;
128
125
  }
129
- const gammaStar = math_1.default.acos(acosArg);
130
- const cosGammaStar = math_1.default.cos(gammaStar);
131
- const sinGammaStar = math_1.default.sin(gammaStar);
126
+ const gammaStar = math_1.math.acos(acosArg);
127
+ const cosGammaStar = math_1.math.cos(gammaStar);
128
+ const sinGammaStar = math_1.math.sin(gammaStar);
132
129
  return [
133
130
  [a * sinBeta, 0.0, a * cosBeta],
134
131
  [-b * sinAlpha * cosGammaStar, b * sinAlpha * sinGammaStar, b * cosAlpha],
@@ -22,17 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.Lattice = exports.LatticeVectors = exports.nonPeriodicLatticeScalingFactor = void 0;
30
27
  const constants_1 = require("@mat3ra/code/dist/js/constants");
31
28
  const entity_1 = require("@mat3ra/code/dist/js/entity");
29
+ const math_1 = require("@mat3ra/code/dist/js/math");
32
30
  const lodash = __importStar(require("lodash"));
33
31
  const cell_1 = require("../cell/cell");
34
32
  const primitive_cell_1 = require("../cell/primitive_cell");
35
- const math_1 = __importDefault(require("../math"));
36
33
  const lattice_types_1 = require("./lattice_types");
37
34
  const unit_cell_1 = require("./unit_cell");
38
35
  /**
@@ -69,17 +66,17 @@ class Lattice extends entity_1.InMemoryEntity {
69
66
  const { a } = this;
70
67
  const { b } = this;
71
68
  const { c } = this;
72
- const alphaRad = math_1.default.unit(this.alpha, "deg").toNumber("rad");
73
- const betaRad = math_1.default.unit(this.beta, "deg").toNumber("rad");
74
- const gammaRad = math_1.default.unit(this.gamma, "deg").toNumber("rad");
75
- const cosAlpha = math_1.default.cos(alphaRad);
76
- const cosBeta = math_1.default.cos(betaRad);
77
- const cosGamma = math_1.default.cos(gammaRad);
78
- const sinAlpha = math_1.default.sin(alphaRad);
79
- const sinBeta = math_1.default.sin(betaRad);
80
- const gammaStar = math_1.default.acos((cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta));
81
- const cosGammaStar = math_1.default.cos(gammaStar);
82
- const sinGammaStar = math_1.default.sin(gammaStar);
69
+ const alphaRad = math_1.math.unit(this.alpha, "deg").toNumber("rad");
70
+ const betaRad = math_1.math.unit(this.beta, "deg").toNumber("rad");
71
+ const gammaRad = math_1.math.unit(this.gamma, "deg").toNumber("rad");
72
+ const cosAlpha = math_1.math.cos(alphaRad);
73
+ const cosBeta = math_1.math.cos(betaRad);
74
+ const cosGamma = math_1.math.cos(gammaRad);
75
+ const sinAlpha = math_1.math.sin(alphaRad);
76
+ const sinBeta = math_1.math.sin(betaRad);
77
+ const gammaStar = math_1.math.acos((cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta));
78
+ const cosGammaStar = math_1.math.cos(gammaStar);
79
+ const sinGammaStar = math_1.math.sin(gammaStar);
83
80
  const vectorA = [a * sinBeta, 0.0, a * cosBeta];
84
81
  const vectorB = [
85
82
  -b * sinAlpha * cosGammaStar,
@@ -94,12 +91,12 @@ class Lattice extends entity_1.InMemoryEntity {
94
91
  }
95
92
  static fromVectorsArray(vectors, units = Lattice.defaultConfig.units, type = "TRI") {
96
93
  const [aVec, bVec, cVec] = vectors;
97
- const a = math_1.default.vlen(aVec);
98
- const b = math_1.default.vlen(bVec);
99
- const c = math_1.default.vlen(cVec);
100
- const alpha = math_1.default.angle(bVec, cVec, "deg");
101
- const beta = math_1.default.angle(aVec, cVec, "deg");
102
- const gamma = math_1.default.angle(aVec, bVec, "deg");
94
+ const a = math_1.math.vlen(aVec);
95
+ const b = math_1.math.vlen(bVec);
96
+ const c = math_1.math.vlen(cVec);
97
+ const alpha = math_1.math.angle(bVec, cVec, "deg");
98
+ const beta = math_1.math.angle(aVec, cVec, "deg");
99
+ const gamma = math_1.math.angle(aVec, bVec, "deg");
103
100
  return new Lattice({
104
101
  a,
105
102
  b,
@@ -144,7 +141,7 @@ class Lattice extends entity_1.InMemoryEntity {
144
141
  */
145
142
  get typeExtended() {
146
143
  const { a, b, c, alpha, beta, gamma, type } = this;
147
- const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI);
144
+ const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI);
148
145
  switch (type) {
149
146
  case "BCT":
150
147
  return c < a ? "BCT-1" : "BCT-2";
@@ -179,14 +176,14 @@ class Lattice extends entity_1.InMemoryEntity {
179
176
  * Calculate the volume of the lattice cell.
180
177
  */
181
178
  get volume() {
182
- return math_1.default.abs(math_1.default.det(this.vectorArrays));
179
+ return math_1.math.abs(math_1.math.det(this.vectorArrays));
183
180
  }
184
181
  /*
185
182
  * Returns a "default" primitive lattice by type, with lattice parameters scaled by the length of "a",
186
183
  * @param latticeConfig {Object} LatticeBravais config (see constructor)
187
184
  */
188
185
  static getDefaultPrimitiveLatticeConfigByType(latticeConfig) {
189
- const f_ = math_1.default.roundArrayOrNumber;
186
+ const f_ = math_1.math.roundArrayOrNumber;
190
187
  // construct new primitive cell using lattice parameters and skip rounding the vectors
191
188
  const vectors = (0, primitive_cell_1.getPrimitiveLatticeVectorsFromConfig)(latticeConfig);
192
189
  // create new lattice from primitive cell
@@ -224,7 +221,7 @@ class Lattice extends entity_1.InMemoryEntity {
224
221
  scaledLattice.beta,
225
222
  scaledLattice.gamma,
226
223
  ]
227
- .map((x) => math_1.default.round(x, constants_1.HASH_TOLERANCE))
224
+ .map((x) => math_1.math.round(x, constants_1.HASH_TOLERANCE))
228
225
  .join(";")};`;
229
226
  }
230
227
  /**
@@ -23,14 +23,12 @@ export declare class ReciprocalLattice extends Lattice {
23
23
  get reciprocalVectors(): Vector3DSchema[];
24
24
  /**
25
25
  * Norms of reciprocal vectors.
26
- * @return {number[]}
27
26
  */
28
- get reciprocalVectorNorms(): number[];
27
+ get reciprocalVectorNorms(): Vector3DSchema;
29
28
  /**
30
29
  * Ratio of reciprocal vector norms scaled by the inverse of the largest component.
31
- * @return {number[]}
32
30
  */
33
- get reciprocalVectorRatios(): number[];
31
+ get reciprocalVectorRatios(): Vector3DSchema;
34
32
  /**
35
33
  * Get point (in crystal coordinates) in cartesian coordinates.
36
34
  * @param {KPointCoordinates} point - point in 3D space
@@ -67,9 +65,9 @@ export declare class ReciprocalLattice extends Lattice {
67
65
  /**
68
66
  * Calculate grid dimensions from total number of k-points.
69
67
  * @param {number} nKpoints - Total number of k-points.
70
- * @return {number[]} - Grid dimensions
68
+ * @return Grid dimensions
71
69
  */
72
- getDimensionsFromPointsCount(nKpoints: number): number[];
70
+ getDimensionsFromPointsCount(nKpoints: number): Vector3DSchema;
73
71
  get conversionTable(): ConversionTable;
74
72
  /**
75
73
  * Calculate grid dimensions from k-point spacing, i.e.
@@ -77,9 +75,8 @@ export declare class ReciprocalLattice extends Lattice {
77
75
  * Note: just as the lattice vectors spacing is in cartesian (2pi / a) units by default
78
76
  * @param {number} spacing - maximum Spacing between k-points
79
77
  * @param {string} units - units of spacing parameter (default: 2pi / a)
80
- * @return {number[]}
81
78
  */
82
- getDimensionsFromSpacing(spacing: number, units?: string): number[];
79
+ getDimensionsFromSpacing(spacing: number, units?: string): Vector3DSchema;
83
80
  /**
84
81
  * Calculate grid spacing as average of spacing along individual reciprocal axes.
85
82
  * @param {number[]} dimensions - Array of dimensions
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ReciprocalLattice = void 0;
7
7
  const constants_1 = require("@mat3ra/code/dist/js/constants");
8
+ const math_1 = require("@mat3ra/code/dist/js/math");
8
9
  const lodash_1 = __importDefault(require("lodash"));
9
- const math_1 = __importDefault(require("../../math"));
10
10
  const lattice_1 = require("../lattice");
11
11
  const paths_1 = require("./paths");
12
12
  const symmetry_points_1 = require("./symmetry_points");
@@ -17,28 +17,26 @@ class ReciprocalLattice extends lattice_1.Lattice {
17
17
  */
18
18
  get reciprocalVectors() {
19
19
  const vectors_ = this.vectors.vectorArrays;
20
- const a = math_1.default.vlen(vectors_[0]);
21
- const divider = math_1.default.multiply(vectors_[0], math_1.default.cross(vectors_[1], vectors_[2])) / a;
20
+ const a = math_1.math.vlen(vectors_[0]);
21
+ const divider = math_1.math.multiply(vectors_[0], math_1.math.cross(vectors_[1], vectors_[2])) / a;
22
22
  return [
23
- math_1.default.multiply(math_1.default.cross(vectors_[1], vectors_[2]), 1 / divider),
24
- math_1.default.multiply(math_1.default.cross(vectors_[2], vectors_[0]), 1 / divider),
25
- math_1.default.multiply(math_1.default.cross(vectors_[0], vectors_[1]), 1 / divider),
23
+ math_1.math.multiply(math_1.math.cross(vectors_[1], vectors_[2]), 1 / divider),
24
+ math_1.math.multiply(math_1.math.cross(vectors_[2], vectors_[0]), 1 / divider),
25
+ math_1.math.multiply(math_1.math.cross(vectors_[0], vectors_[1]), 1 / divider),
26
26
  ];
27
27
  }
28
28
  /**
29
29
  * Norms of reciprocal vectors.
30
- * @return {number[]}
31
30
  */
32
31
  get reciprocalVectorNorms() {
33
- return this.reciprocalVectors.map((vec) => math_1.default.norm(vec));
32
+ return this.reciprocalVectors.map((vec) => math_1.math.norm(vec));
34
33
  }
35
34
  /**
36
35
  * Ratio of reciprocal vector norms scaled by the inverse of the largest component.
37
- * @return {number[]}
38
36
  */
39
37
  get reciprocalVectorRatios() {
40
38
  const norms = this.reciprocalVectorNorms;
41
- const maxNorm = math_1.default.max(...norms);
39
+ const maxNorm = math_1.math.max(...norms);
42
40
  return norms.map((n) => n / maxNorm);
43
41
  }
44
42
  /**
@@ -47,7 +45,7 @@ class ReciprocalLattice extends lattice_1.Lattice {
47
45
  * @return {KPointCoordinates}
48
46
  */
49
47
  getCartesianCoordinates(point) {
50
- return math_1.default.multiply(point, this.reciprocalVectors);
48
+ return math_1.math.multiply(point, this.reciprocalVectors);
51
49
  }
52
50
  /**
53
51
  * Get the list of high-symmetry points for the current lattice.
@@ -74,7 +72,7 @@ class ReciprocalLattice extends lattice_1.Lattice {
74
72
  const symmPoints = this.symmetryPoints;
75
73
  dataPoints.forEach((point, index) => {
76
74
  const symmPoint = symmPoints.find((x) => {
77
- return math_1.default.vEqualWithTolerance(x.coordinates, point, 1e-4);
75
+ return math_1.math.vEqualWithTolerance(x.coordinates, point, 1e-4);
78
76
  });
79
77
  if (symmPoint) {
80
78
  kpointPath.push({
@@ -96,13 +94,13 @@ class ReciprocalLattice extends lattice_1.Lattice {
96
94
  calculateDimension(nPoints, index) {
97
95
  const norms = this.reciprocalVectorNorms;
98
96
  const [j, k] = [0, 1, 2].filter((i) => i !== index); // get indices of other two dimensions
99
- const N = math_1.default.cbrt((nPoints * norms[index] ** 2) / (norms[j] * norms[k]));
100
- return math_1.default.max(1, math_1.default.ceil(N));
97
+ const N = math_1.math.cbrt((nPoints * norms[index] ** 2) / (norms[j] * norms[k]));
98
+ return math_1.math.max(1, math_1.math.ceil(N));
101
99
  }
102
100
  /**
103
101
  * Calculate grid dimensions from total number of k-points.
104
102
  * @param {number} nKpoints - Total number of k-points.
105
- * @return {number[]} - Grid dimensions
103
+ * @return Grid dimensions
106
104
  */
107
105
  getDimensionsFromPointsCount(nKpoints) {
108
106
  const indices = [0, 1, 2];
@@ -112,10 +110,10 @@ class ReciprocalLattice extends lattice_1.Lattice {
112
110
  const { a } = this;
113
111
  return {
114
112
  [constants_1.ATOMIC_COORD_UNITS.cartesian]: {
115
- [constants_1.units.angstrom]: (2 * math_1.default.PI) / a,
113
+ [constants_1.units.angstrom]: (2 * math_1.math.PI) / a,
116
114
  },
117
115
  [constants_1.units.angstrom]: {
118
- [constants_1.ATOMIC_COORD_UNITS.cartesian]: a / (2 * math_1.default.PI),
116
+ [constants_1.ATOMIC_COORD_UNITS.cartesian]: a / (2 * math_1.math.PI),
119
117
  },
120
118
  };
121
119
  }
@@ -125,12 +123,11 @@ class ReciprocalLattice extends lattice_1.Lattice {
125
123
  * Note: just as the lattice vectors spacing is in cartesian (2pi / a) units by default
126
124
  * @param {number} spacing - maximum Spacing between k-points
127
125
  * @param {string} units - units of spacing parameter (default: 2pi / a)
128
- * @return {number[]}
129
126
  */
130
127
  getDimensionsFromSpacing(spacing, units = constants_1.ATOMIC_COORD_UNITS.cartesian) {
131
128
  const factor = this.conversionTable[units][constants_1.ATOMIC_COORD_UNITS.cartesian] || 1;
132
129
  return this.reciprocalVectorNorms.map((norm) => {
133
- return math_1.default.max(1, math_1.default.ceil(lodash_1.default.round(norm / (spacing * factor), 4)));
130
+ return math_1.math.max(1, math_1.math.ceil(lodash_1.default.round(norm / (spacing * factor), 4)));
134
131
  });
135
132
  }
136
133
  /**
@@ -143,7 +140,7 @@ class ReciprocalLattice extends lattice_1.Lattice {
143
140
  const factor = this.conversionTable[constants_1.ATOMIC_COORD_UNITS.cartesian][units] || 1;
144
141
  const norms = this.reciprocalVectorNorms;
145
142
  return (factor *
146
- math_1.default.mean(dimensions.map((dim, i) => norms[i] / math_1.default.max(1, dim))));
143
+ math_1.math.mean(dimensions.map((dim, i) => norms[i] / math_1.math.max(1, dim))));
147
144
  }
148
145
  }
149
146
  exports.ReciprocalLattice = ReciprocalLattice;