@mat3ra/made 2024.3.23-2 → 2024.3.25-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/dist/basis/basis.d.ts +6 -1
- package/dist/basis/basis.js +12 -2
- package/package.json +1 -1
- package/src/js/basis/basis.ts +14 -3
package/dist/basis/basis.d.ts
CHANGED
|
@@ -178,7 +178,12 @@ export declare class Basis {
|
|
|
178
178
|
* Returns a nested array with elements and their corresponding coordinates
|
|
179
179
|
* @example Output: [ ["Si", [0,0,0]], ["Si", [0.5,0.5,0.5]] ]
|
|
180
180
|
*/
|
|
181
|
-
get elementsAndCoordinatesArray(): [string, Coordinate
|
|
181
|
+
get elementsAndCoordinatesArray(): [string, Coordinate][];
|
|
182
|
+
/**
|
|
183
|
+
* Returns a nested array with elements and their corresponding coordinates with labels
|
|
184
|
+
* @example Output: [ ["Si", [0,0,0], ['1']], ["Si", [0.5,0.5,0.5]] , ['2']]
|
|
185
|
+
*/
|
|
186
|
+
get elementsAndCoordinatesAndLabelsArray(): [string, Coordinate, string][];
|
|
182
187
|
/**
|
|
183
188
|
* @summary Concatenates elements and sorts them in alphanumeric order.
|
|
184
189
|
* E.g.,
|
package/dist/basis/basis.js
CHANGED
|
@@ -276,6 +276,16 @@ class Basis {
|
|
|
276
276
|
* @example Output: [ ["Si", [0,0,0]], ["Si", [0.5,0.5,0.5]] ]
|
|
277
277
|
*/
|
|
278
278
|
get elementsAndCoordinatesArray() {
|
|
279
|
+
return this._elements.array.map((element, idx) => {
|
|
280
|
+
const coordinates = this.getCoordinateByIndex(idx);
|
|
281
|
+
return [element, coordinates];
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Returns a nested array with elements and their corresponding coordinates with labels
|
|
286
|
+
* @example Output: [ ["Si", [0,0,0], ['1']], ["Si", [0.5,0.5,0.5]] , ['2']]
|
|
287
|
+
*/
|
|
288
|
+
get elementsAndCoordinatesAndLabelsArray() {
|
|
279
289
|
return this._elements.array.map((element, idx) => {
|
|
280
290
|
const coordinates = this.getCoordinateByIndex(idx);
|
|
281
291
|
const atomicLabel = this.atomicLabelsArray[idx];
|
|
@@ -297,7 +307,7 @@ class Basis {
|
|
|
297
307
|
// make a copy to prevent modifying class values
|
|
298
308
|
const clsInstance = new Basis(this.toJSON());
|
|
299
309
|
clsInstance.toStandardRepresentation();
|
|
300
|
-
const standardRep = clsInstance.
|
|
310
|
+
const standardRep = clsInstance.elementsAndCoordinatesAndLabelsArray.map((entry) => {
|
|
301
311
|
const element = entry[0];
|
|
302
312
|
const coordinate = entry[1];
|
|
303
313
|
const atomicLabel = entry[2];
|
|
@@ -342,7 +352,7 @@ class Basis {
|
|
|
342
352
|
* E.g., ``` ['Si 0 0 0', 'Li 0.5 0.5 0.5']```
|
|
343
353
|
*/
|
|
344
354
|
get atomicPositions() {
|
|
345
|
-
return this.
|
|
355
|
+
return this.elementsAndCoordinatesAndLabelsArray.map((entry, idx) => {
|
|
346
356
|
const element = entry[0];
|
|
347
357
|
const coordinate = entry[1];
|
|
348
358
|
const atomicLabel = this.atomicLabelsArray[idx];
|
package/package.json
CHANGED
package/src/js/basis/basis.ts
CHANGED
|
@@ -362,7 +362,18 @@ export class Basis {
|
|
|
362
362
|
* Returns a nested array with elements and their corresponding coordinates
|
|
363
363
|
* @example Output: [ ["Si", [0,0,0]], ["Si", [0.5,0.5,0.5]] ]
|
|
364
364
|
*/
|
|
365
|
-
get elementsAndCoordinatesArray(): [string, Coordinate
|
|
365
|
+
get elementsAndCoordinatesArray(): [string, Coordinate][] {
|
|
366
|
+
return this._elements.array.map((element, idx) => {
|
|
367
|
+
const coordinates = this.getCoordinateByIndex(idx);
|
|
368
|
+
return [element, coordinates];
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Returns a nested array with elements and their corresponding coordinates with labels
|
|
374
|
+
* @example Output: [ ["Si", [0,0,0], ['1']], ["Si", [0.5,0.5,0.5]] , ['2']]
|
|
375
|
+
*/
|
|
376
|
+
get elementsAndCoordinatesAndLabelsArray(): [string, Coordinate, string][] {
|
|
366
377
|
return this._elements.array.map((element, idx) => {
|
|
367
378
|
const coordinates = this.getCoordinateByIndex(idx);
|
|
368
379
|
const atomicLabel = this.atomicLabelsArray[idx];
|
|
@@ -385,7 +396,7 @@ export class Basis {
|
|
|
385
396
|
// make a copy to prevent modifying class values
|
|
386
397
|
const clsInstance = new Basis(this.toJSON());
|
|
387
398
|
clsInstance.toStandardRepresentation();
|
|
388
|
-
const standardRep = clsInstance.
|
|
399
|
+
const standardRep = clsInstance.elementsAndCoordinatesAndLabelsArray.map((entry) => {
|
|
389
400
|
const element = entry[0];
|
|
390
401
|
const coordinate = entry[1];
|
|
391
402
|
const atomicLabel = entry[2];
|
|
@@ -435,7 +446,7 @@ export class Basis {
|
|
|
435
446
|
* E.g., ``` ['Si 0 0 0', 'Li 0.5 0.5 0.5']```
|
|
436
447
|
*/
|
|
437
448
|
get atomicPositions(): string[] {
|
|
438
|
-
return this.
|
|
449
|
+
return this.elementsAndCoordinatesAndLabelsArray.map((entry, idx) => {
|
|
439
450
|
const element = entry[0];
|
|
440
451
|
const coordinate = entry[1];
|
|
441
452
|
const atomicLabel = this.atomicLabelsArray[idx];
|