@mat3ra/prode 2025.11.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/.babelrc +17 -0
- package/LICENSE.md +15 -0
- package/README.md +93 -0
- package/dist/js/MetaProperty.d.ts +3 -0
- package/dist/js/MetaProperty.js +9 -0
- package/dist/js/Property.d.ts +25 -0
- package/dist/js/Property.js +25 -0
- package/dist/js/PropertyFactory.d.ts +54 -0
- package/dist/js/PropertyFactory.js +137 -0
- package/dist/js/ProtoProperty.d.ts +5 -0
- package/dist/js/ProtoProperty.js +11 -0
- package/dist/js/charts/highcharts.d.ts +57 -0
- package/dist/js/charts/highcharts.js +96 -0
- package/dist/js/generated/AtomicConstraintsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/AtomicConstraintsPropertySchemaMixin.js +15 -0
- package/dist/js/generated/AtomicForcesPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/AtomicForcesPropertySchemaMixin.js +18 -0
- package/dist/js/generated/AveragePotentialProfilePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/AveragePotentialProfilePropertySchemaMixin.js +24 -0
- package/dist/js/generated/BandGapsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/BandGapsPropertySchemaMixin.js +18 -0
- package/dist/js/generated/BandStructurePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/BandStructurePropertySchemaMixin.js +27 -0
- package/dist/js/generated/BoundaryConditionsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/BoundaryConditionsPropertySchemaMixin.js +18 -0
- package/dist/js/generated/ChargeDensityProfilePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ChargeDensityProfilePropertySchemaMixin.js +24 -0
- package/dist/js/generated/ConvergenceElectronicPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ConvergenceElectronicPropertySchemaMixin.js +18 -0
- package/dist/js/generated/ConvergenceIonicPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ConvergenceIonicPropertySchemaMixin.js +21 -0
- package/dist/js/generated/DensityOfStatesPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/DensityOfStatesPropertySchemaMixin.js +27 -0
- package/dist/js/generated/DielectricTensorPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/DielectricTensorPropertySchemaMixin.js +15 -0
- package/dist/js/generated/FermiEnergyPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/FermiEnergyPropertySchemaMixin.js +18 -0
- package/dist/js/generated/FileContentPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/FileContentPropertySchemaMixin.js +24 -0
- package/dist/js/generated/FinalStructurePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/FinalStructurePropertySchemaMixin.js +18 -0
- package/dist/js/generated/HubbardUPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/HubbardUPropertySchemaMixin.js +18 -0
- package/dist/js/generated/HubbardVNNPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/HubbardVNNPropertySchemaMixin.js +18 -0
- package/dist/js/generated/HubbardVPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/HubbardVPropertySchemaMixin.js +18 -0
- package/dist/js/generated/IonizationPotentialElementalPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/IonizationPotentialElementalPropertySchemaMixin.js +18 -0
- package/dist/js/generated/IsRelaxedPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/IsRelaxedPropertySchemaMixin.js +18 -0
- package/dist/js/generated/JupyterNotebookEndpointPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/JupyterNotebookEndpointPropertySchemaMixin.js +21 -0
- package/dist/js/generated/MagneticMomentsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/MagneticMomentsPropertySchemaMixin.js +18 -0
- package/dist/js/generated/MetaPropertyHolderSchemaMixin.d.ts +5 -0
- package/dist/js/generated/MetaPropertyHolderSchemaMixin.js +15 -0
- package/dist/js/generated/PhononDOSPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/PhononDOSPropertySchemaMixin.js +24 -0
- package/dist/js/generated/PhononDispersionsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/PhononDispersionsPropertySchemaMixin.js +24 -0
- package/dist/js/generated/PotentialProfilePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/PotentialProfilePropertySchemaMixin.js +24 -0
- package/dist/js/generated/PressurePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/PressurePropertySchemaMixin.js +18 -0
- package/dist/js/generated/PropertyHolderSchemaMixin.d.ts +5 -0
- package/dist/js/generated/PropertyHolderSchemaMixin.js +30 -0
- package/dist/js/generated/ProtoPropertyHolderSchemaMixin.d.ts +5 -0
- package/dist/js/generated/ProtoPropertyHolderSchemaMixin.js +15 -0
- package/dist/js/generated/PseudopotentialMetaPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/PseudopotentialMetaPropertySchemaMixin.js +45 -0
- package/dist/js/generated/ReactionEnergyBarrierPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ReactionEnergyBarrierPropertySchemaMixin.js +18 -0
- package/dist/js/generated/ReactionEnergyProfilePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ReactionEnergyProfilePropertySchemaMixin.js +24 -0
- package/dist/js/generated/StressTensorPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/StressTensorPropertySchemaMixin.js +18 -0
- package/dist/js/generated/SurfaceEnergyPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/SurfaceEnergyPropertySchemaMixin.js +18 -0
- package/dist/js/generated/TotalEnergyContributionsPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/TotalEnergyContributionsPropertySchemaMixin.js +57 -0
- package/dist/js/generated/TotalEnergyPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/TotalEnergyPropertySchemaMixin.js +18 -0
- package/dist/js/generated/TotalForcePropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/TotalForcePropertySchemaMixin.js +18 -0
- package/dist/js/generated/ValenceBandOffsetPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ValenceBandOffsetPropertySchemaMixin.js +18 -0
- package/dist/js/generated/WorkflowPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/WorkflowPropertySchemaMixin.js +33 -0
- package/dist/js/generated/ZeroPointEnergyPropertySchemaMixin.d.ts +5 -0
- package/dist/js/generated/ZeroPointEnergyPropertySchemaMixin.js +18 -0
- package/dist/js/holders/MetaPropertyHolder.d.ts +10 -0
- package/dist/js/holders/MetaPropertyHolder.js +12 -0
- package/dist/js/holders/PropertyHolder.d.ts +10 -0
- package/dist/js/holders/PropertyHolder.js +12 -0
- package/dist/js/holders/ProtoPropertyHolder.d.ts +10 -0
- package/dist/js/holders/ProtoPropertyHolder.js +12 -0
- package/dist/js/holders/mixins/MetaPropertyHolderMixin.d.ts +12 -0
- package/dist/js/holders/mixins/MetaPropertyHolderMixin.js +18 -0
- package/dist/js/holders/mixins/PropertyHolderMixin.d.ts +16 -0
- package/dist/js/holders/mixins/PropertyHolderMixin.js +37 -0
- package/dist/js/holders/mixins/ProtoPropertyHolderMixin.d.ts +12 -0
- package/dist/js/holders/mixins/ProtoPropertyHolderMixin.js +18 -0
- package/dist/js/index.d.ts +20 -0
- package/dist/js/index.js +60 -0
- package/dist/js/meta_properties/PseudopotentialMetaProperty.d.ts +78 -0
- package/dist/js/meta_properties/PseudopotentialMetaProperty.js +157 -0
- package/dist/js/properties/include/mixins/2d_plot.d.ts +27 -0
- package/dist/js/properties/include/mixins/2d_plot.js +79 -0
- package/dist/js/properties/non-scalar/AveragePotentialProfileProperty.d.ts +38 -0
- package/dist/js/properties/non-scalar/AveragePotentialProfileProperty.js +54 -0
- package/dist/js/properties/non-scalar/BandGapsProperty.d.ts +59 -0
- package/dist/js/properties/non-scalar/BandGapsProperty.js +52 -0
- package/dist/js/properties/non-scalar/BandStructureProperty.d.ts +186 -0
- package/dist/js/properties/non-scalar/BandStructureProperty.js +218 -0
- package/dist/js/properties/non-scalar/ChargeDensityProfileProperty.d.ts +25 -0
- package/dist/js/properties/non-scalar/ChargeDensityProfileProperty.js +34 -0
- package/dist/js/properties/non-scalar/DensityOfStatesProperty.d.ts +145 -0
- package/dist/js/properties/non-scalar/DensityOfStatesProperty.js +126 -0
- package/dist/js/properties/non-scalar/DielectricTensorProperty.d.ts +49 -0
- package/dist/js/properties/non-scalar/DielectricTensorProperty.js +119 -0
- package/dist/js/properties/non-scalar/FileContentProperty.d.ts +15 -0
- package/dist/js/properties/non-scalar/FileContentProperty.js +18 -0
- package/dist/js/properties/non-scalar/FinalStructureProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/FinalStructureProperty.js +17 -0
- package/dist/js/properties/non-scalar/HubbardUProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/HubbardUProperty.js +17 -0
- package/dist/js/properties/non-scalar/HubbardVNNProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/HubbardVNNProperty.js +17 -0
- package/dist/js/properties/non-scalar/HubbardVProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/HubbardVProperty.js +17 -0
- package/dist/js/properties/non-scalar/IsRelaxedProperty.d.ts +15 -0
- package/dist/js/properties/non-scalar/IsRelaxedProperty.js +18 -0
- package/dist/js/properties/non-scalar/JupyterNotebookEndpointProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/JupyterNotebookEndpointProperty.js +17 -0
- package/dist/js/properties/non-scalar/PhononDOSProperty.d.ts +19 -0
- package/dist/js/properties/non-scalar/PhononDOSProperty.js +37 -0
- package/dist/js/properties/non-scalar/PhononDispersionsProperty.d.ts +21 -0
- package/dist/js/properties/non-scalar/PhononDispersionsProperty.js +28 -0
- package/dist/js/properties/non-scalar/PotentialProfileProperty.d.ts +38 -0
- package/dist/js/properties/non-scalar/PotentialProfileProperty.js +58 -0
- package/dist/js/properties/non-scalar/ReactionEnergyProfileProperty.d.ts +25 -0
- package/dist/js/properties/non-scalar/ReactionEnergyProfileProperty.js +34 -0
- package/dist/js/properties/non-scalar/WorkflowProperty.d.ts +14 -0
- package/dist/js/properties/non-scalar/WorkflowProperty.js +17 -0
- package/dist/js/properties/non-scalar/convergence/ConvergenceElectronicProperty.d.ts +17 -0
- package/dist/js/properties/non-scalar/convergence/ConvergenceElectronicProperty.js +63 -0
- package/dist/js/properties/non-scalar/convergence/ConvergenceIonicProperty.d.ts +17 -0
- package/dist/js/properties/non-scalar/convergence/ConvergenceIonicProperty.js +45 -0
- package/dist/js/properties/object/TotalEnergyContributionsProperty.d.ts +18 -0
- package/dist/js/properties/object/TotalEnergyContributionsProperty.js +20 -0
- package/dist/js/properties/scalar/FermiEnergyProperty.d.ts +14 -0
- package/dist/js/properties/scalar/FermiEnergyProperty.js +17 -0
- package/dist/js/properties/scalar/IonizationPotentialElementalProperty.d.ts +14 -0
- package/dist/js/properties/scalar/IonizationPotentialElementalProperty.js +17 -0
- package/dist/js/properties/scalar/PressureProperty.d.ts +15 -0
- package/dist/js/properties/scalar/PressureProperty.js +18 -0
- package/dist/js/properties/scalar/ReactionEnergyBarrierProperty.d.ts +15 -0
- package/dist/js/properties/scalar/ReactionEnergyBarrierProperty.js +18 -0
- package/dist/js/properties/scalar/SurfaceEnergyProperty.d.ts +15 -0
- package/dist/js/properties/scalar/SurfaceEnergyProperty.js +18 -0
- package/dist/js/properties/scalar/TotalEnergyProperty.d.ts +15 -0
- package/dist/js/properties/scalar/TotalEnergyProperty.js +18 -0
- package/dist/js/properties/scalar/TotalForceProperty.d.ts +14 -0
- package/dist/js/properties/scalar/TotalForceProperty.js +17 -0
- package/dist/js/properties/scalar/ValenceBandOffsetProperty.d.ts +15 -0
- package/dist/js/properties/scalar/ValenceBandOffsetProperty.js +18 -0
- package/dist/js/properties/scalar/ZeroPointEnergyProperty.d.ts +14 -0
- package/dist/js/properties/scalar/ZeroPointEnergyProperty.js +17 -0
- package/dist/js/properties/tensor/AtomicForcesProperty.d.ts +14 -0
- package/dist/js/properties/tensor/AtomicForcesProperty.js +17 -0
- package/dist/js/properties/tensor/MagneticMomentsProperty.d.ts +14 -0
- package/dist/js/properties/tensor/MagneticMomentsProperty.js +17 -0
- package/dist/js/properties/tensor/StressTensorProperty.d.ts +14 -0
- package/dist/js/properties/tensor/StressTensorProperty.js +17 -0
- package/dist/js/proto_properties/AtomicConstraintsProperty.d.ts +13 -0
- package/dist/js/proto_properties/AtomicConstraintsProperty.js +16 -0
- package/dist/js/proto_properties/BoundaryConditionsProperty.d.ts +13 -0
- package/dist/js/proto_properties/BoundaryConditionsProperty.js +16 -0
- package/dist/js/settings.d.ts +48 -0
- package/dist/js/settings.js +56 -0
- package/dist/js/types.d.ts +14 -0
- package/dist/js/types.js +2 -0
- package/package.json +101 -0
- package/src/js/MetaProperty.ts +3 -0
- package/src/js/Property.ts +49 -0
- package/src/js/PropertyFactory.ts +208 -0
- package/src/js/ProtoProperty.ts +6 -0
- package/src/js/charts/highcharts.ts +172 -0
- package/src/js/generated/AtomicConstraintsPropertySchemaMixin.ts +24 -0
- package/src/js/generated/AtomicForcesPropertySchemaMixin.ts +26 -0
- package/src/js/generated/AveragePotentialProfilePropertySchemaMixin.ts +37 -0
- package/src/js/generated/BandGapsPropertySchemaMixin.ts +26 -0
- package/src/js/generated/BandStructurePropertySchemaMixin.ts +35 -0
- package/src/js/generated/BoundaryConditionsPropertySchemaMixin.ts +27 -0
- package/src/js/generated/ChargeDensityProfilePropertySchemaMixin.ts +37 -0
- package/src/js/generated/ConvergenceElectronicPropertySchemaMixin.ts +27 -0
- package/src/js/generated/ConvergenceIonicPropertySchemaMixin.ts +30 -0
- package/src/js/generated/DensityOfStatesPropertySchemaMixin.ts +36 -0
- package/src/js/generated/DielectricTensorPropertySchemaMixin.ts +24 -0
- package/src/js/generated/FermiEnergyPropertySchemaMixin.ts +26 -0
- package/src/js/generated/FileContentPropertySchemaMixin.ts +32 -0
- package/src/js/generated/FinalStructurePropertySchemaMixin.ts +27 -0
- package/src/js/generated/HubbardUPropertySchemaMixin.ts +26 -0
- package/src/js/generated/HubbardVNNPropertySchemaMixin.ts +26 -0
- package/src/js/generated/HubbardVPropertySchemaMixin.ts +26 -0
- package/src/js/generated/IonizationPotentialElementalPropertySchemaMixin.ts +27 -0
- package/src/js/generated/IsRelaxedPropertySchemaMixin.ts +26 -0
- package/src/js/generated/JupyterNotebookEndpointPropertySchemaMixin.ts +30 -0
- package/src/js/generated/MagneticMomentsPropertySchemaMixin.ts +27 -0
- package/src/js/generated/MetaPropertyHolderSchemaMixin.ts +23 -0
- package/src/js/generated/PhononDOSPropertySchemaMixin.ts +36 -0
- package/src/js/generated/PhononDispersionsPropertySchemaMixin.ts +35 -0
- package/src/js/generated/PotentialProfilePropertySchemaMixin.ts +33 -0
- package/src/js/generated/PressurePropertySchemaMixin.ts +26 -0
- package/src/js/generated/PropertyHolderSchemaMixin.ts +38 -0
- package/src/js/generated/ProtoPropertyHolderSchemaMixin.ts +23 -0
- package/src/js/generated/PseudopotentialMetaPropertySchemaMixin.ts +54 -0
- package/src/js/generated/README.md +27 -0
- package/src/js/generated/ReactionEnergyBarrierPropertySchemaMixin.ts +27 -0
- package/src/js/generated/ReactionEnergyProfilePropertySchemaMixin.ts +37 -0
- package/src/js/generated/StressTensorPropertySchemaMixin.ts +26 -0
- package/src/js/generated/SurfaceEnergyPropertySchemaMixin.ts +26 -0
- package/src/js/generated/TotalEnergyContributionsPropertySchemaMixin.ts +80 -0
- package/src/js/generated/TotalEnergyPropertySchemaMixin.ts +26 -0
- package/src/js/generated/TotalForcePropertySchemaMixin.ts +26 -0
- package/src/js/generated/ValenceBandOffsetPropertySchemaMixin.ts +27 -0
- package/src/js/generated/WorkflowPropertySchemaMixin.ts +41 -0
- package/src/js/generated/ZeroPointEnergyPropertySchemaMixin.ts +27 -0
- package/src/js/holders/MetaPropertyHolder.ts +19 -0
- package/src/js/holders/PropertyHolder.ts +17 -0
- package/src/js/holders/ProtoPropertyHolder.ts +17 -0
- package/src/js/holders/mixins/MetaPropertyHolderMixin.ts +31 -0
- package/src/js/holders/mixins/PropertyHolderMixin.ts +55 -0
- package/src/js/holders/mixins/ProtoPropertyHolderMixin.ts +31 -0
- package/src/js/index.ts +21 -0
- package/src/js/meta_properties/PseudopotentialMetaProperty.ts +206 -0
- package/src/js/properties/include/mixins/2d_plot.ts +105 -0
- package/src/js/properties/non-scalar/AveragePotentialProfileProperty.ts +69 -0
- package/src/js/properties/non-scalar/BandGapsProperty.ts +65 -0
- package/src/js/properties/non-scalar/BandStructureProperty.ts +284 -0
- package/src/js/properties/non-scalar/ChargeDensityProfileProperty.ts +48 -0
- package/src/js/properties/non-scalar/DensityOfStatesProperty.ts +174 -0
- package/src/js/properties/non-scalar/DielectricTensorProperty.ts +153 -0
- package/src/js/properties/non-scalar/FileContentProperty.ts +27 -0
- package/src/js/properties/non-scalar/FinalStructureProperty.ts +25 -0
- package/src/js/properties/non-scalar/HubbardUProperty.ts +25 -0
- package/src/js/properties/non-scalar/HubbardVNNProperty.ts +25 -0
- package/src/js/properties/non-scalar/HubbardVProperty.ts +25 -0
- package/src/js/properties/non-scalar/IsRelaxedProperty.ts +27 -0
- package/src/js/properties/non-scalar/JupyterNotebookEndpointProperty.ts +26 -0
- package/src/js/properties/non-scalar/PhononDOSProperty.ts +57 -0
- package/src/js/properties/non-scalar/PhononDispersionsProperty.ts +46 -0
- package/src/js/properties/non-scalar/PotentialProfileProperty.ts +76 -0
- package/src/js/properties/non-scalar/ReactionEnergyProfileProperty.ts +48 -0
- package/src/js/properties/non-scalar/WorkflowProperty.ts +25 -0
- package/src/js/properties/non-scalar/convergence/ConvergenceElectronicProperty.ts +82 -0
- package/src/js/properties/non-scalar/convergence/ConvergenceIonicProperty.ts +62 -0
- package/src/js/properties/object/TotalEnergyContributionsProperty.ts +29 -0
- package/src/js/properties/scalar/FermiEnergyProperty.ts +25 -0
- package/src/js/properties/scalar/IonizationPotentialElementalProperty.ts +27 -0
- package/src/js/properties/scalar/PressureProperty.ts +27 -0
- package/src/js/properties/scalar/ReactionEnergyBarrierProperty.ts +29 -0
- package/src/js/properties/scalar/SurfaceEnergyProperty.ts +27 -0
- package/src/js/properties/scalar/TotalEnergyProperty.ts +27 -0
- package/src/js/properties/scalar/TotalForceProperty.ts +25 -0
- package/src/js/properties/scalar/ValenceBandOffsetProperty.ts +27 -0
- package/src/js/properties/scalar/ZeroPointEnergyProperty.ts +25 -0
- package/src/js/properties/tensor/AtomicForcesProperty.ts +27 -0
- package/src/js/properties/tensor/MagneticMomentsProperty.ts +27 -0
- package/src/js/properties/tensor/StressTensorProperty.ts +25 -0
- package/src/js/proto_properties/AtomicConstraintsProperty.ts +25 -0
- package/src/js/proto_properties/BoundaryConditionsProperty.ts +25 -0
- package/src/js/settings.ts +52 -0
- package/src/js/types.ts +24 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
// eslint-disable-next-line max-classes-per-file
|
|
3
|
+
import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
|
|
4
|
+
import { deepClone } from "@mat3ra/code/dist/js/utils";
|
|
5
|
+
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
6
|
+
import type { BandStructurePropertySchema } from "@mat3ra/esse/dist/js/types";
|
|
7
|
+
import type { KPointPath } from "@mat3ra/made/dist/js/lattice/reciprocal/lattice_reciprocal";
|
|
8
|
+
import type { Options, PlotLines } from "highcharts";
|
|
9
|
+
import zip from "lodash/zip";
|
|
10
|
+
|
|
11
|
+
import { type FormatterScope, HighChartsConfig } from "../../charts/highcharts";
|
|
12
|
+
import {
|
|
13
|
+
type BandStructurePropertySchemaMixin,
|
|
14
|
+
bandStructurePropertySchemaMixin,
|
|
15
|
+
} from "../../generated/BandStructurePropertySchemaMixin";
|
|
16
|
+
import Property from "../../Property";
|
|
17
|
+
import { PropertyName, PropertyType } from "../../settings";
|
|
18
|
+
import {
|
|
19
|
+
type XDataArray,
|
|
20
|
+
type XDataArrayNested,
|
|
21
|
+
type YDataSeries,
|
|
22
|
+
} from "../include/mixins/2d_plot";
|
|
23
|
+
|
|
24
|
+
export const _POINT_COORDINATES_PRECISION_ = 4; // number of decimals to keep for point coordinates
|
|
25
|
+
|
|
26
|
+
export class BandStructureConfig extends HighChartsConfig {
|
|
27
|
+
readonly yDataSeries: YDataSeries;
|
|
28
|
+
|
|
29
|
+
readonly spin?: number[];
|
|
30
|
+
|
|
31
|
+
readonly xDataArray: XDataArrayNested;
|
|
32
|
+
|
|
33
|
+
readonly pointsDistanceArray: number[];
|
|
34
|
+
|
|
35
|
+
readonly fermiEnergy: number | null;
|
|
36
|
+
|
|
37
|
+
readonly pointsPath: KPointPath | undefined;
|
|
38
|
+
|
|
39
|
+
constructor(
|
|
40
|
+
property: {
|
|
41
|
+
spin?: number[];
|
|
42
|
+
subtitle: string;
|
|
43
|
+
yAxisTitle: string;
|
|
44
|
+
yDataSeries: [number, ...number[]][];
|
|
45
|
+
xDataArray: (number | number[])[];
|
|
46
|
+
},
|
|
47
|
+
chartConfig?: {
|
|
48
|
+
fermiEnergy?: number | null;
|
|
49
|
+
pointsPath?: KPointPath;
|
|
50
|
+
},
|
|
51
|
+
) {
|
|
52
|
+
super({
|
|
53
|
+
subtitle: property.subtitle,
|
|
54
|
+
yAxisTitle: property.yAxisTitle,
|
|
55
|
+
yAxisType: "linear",
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
this.yDataSeries = property.yDataSeries;
|
|
59
|
+
this.spin = property.spin;
|
|
60
|
+
this.xDataArray = this.cleanXDataArray(property.xDataArray);
|
|
61
|
+
|
|
62
|
+
this.pointsPath = chartConfig?.pointsPath;
|
|
63
|
+
this.pointsDistanceArray = this.calculatePointsDistance(this.xDataArray);
|
|
64
|
+
|
|
65
|
+
this.fermiEnergy = chartConfig?.fermiEnergy ?? null;
|
|
66
|
+
|
|
67
|
+
this.plotXLineAtPoint = this.plotXLineAtPoint.bind(this);
|
|
68
|
+
this.plotXLines = this.plotXLines.bind(this);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// round each value in array to certain precision
|
|
72
|
+
cleanXDataArray(rawData: XDataArray = []): XDataArrayNested {
|
|
73
|
+
return rawData.map((p) => {
|
|
74
|
+
if (!p || !Array.isArray(p)) return [];
|
|
75
|
+
|
|
76
|
+
return p.map((c) => {
|
|
77
|
+
return codeJSMath.roundValueToNDecimals(c, _POINT_COORDINATES_PRECISION_);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// returns the array of distances calculated from an array of points
|
|
83
|
+
calculatePointsDistance(listOfPoints: XDataArrayNested = []) {
|
|
84
|
+
let pointsDistanceSum = 0;
|
|
85
|
+
return listOfPoints.map((el, idx, arr) => {
|
|
86
|
+
if (idx !== 0) {
|
|
87
|
+
const distance = codeJSMath.vDist(el, arr[idx - 1]);
|
|
88
|
+
pointsDistanceSum += Number(distance);
|
|
89
|
+
}
|
|
90
|
+
return pointsDistanceSum;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// find index of a point inside an array of points
|
|
95
|
+
findSymmetryPointIndex(xDataArray: XDataArrayNested, point: number[]) {
|
|
96
|
+
return xDataArray.findIndex((p) => codeJSMath.vDist(p, point) === 0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// create config for vertical lines at high symmetry points
|
|
100
|
+
plotXLines(): PlotLines[] {
|
|
101
|
+
const copiedXDataArray = deepClone(this.xDataArray);
|
|
102
|
+
return this.pointsPath
|
|
103
|
+
? this.pointsPath
|
|
104
|
+
.map((p) => {
|
|
105
|
+
const idx = this.findSymmetryPointIndex(copiedXDataArray, p.coordinates);
|
|
106
|
+
// "reset" element at index if found to avoid duplicate matches
|
|
107
|
+
if (idx > -1) copiedXDataArray[idx] = [-1, -1, -1];
|
|
108
|
+
return {
|
|
109
|
+
point: p.point,
|
|
110
|
+
distance: idx > -1 ? this.pointsDistanceArray[idx] : null,
|
|
111
|
+
};
|
|
112
|
+
})
|
|
113
|
+
.map(this.plotXLineAtPoint)
|
|
114
|
+
: [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
plotXLineAtPoint({ point, distance }: { point: string; distance: number | null }): PlotLines {
|
|
118
|
+
return {
|
|
119
|
+
label: {
|
|
120
|
+
verticalAlign: "bottom",
|
|
121
|
+
rotation: 0,
|
|
122
|
+
align: "center",
|
|
123
|
+
y: 20,
|
|
124
|
+
x: 0,
|
|
125
|
+
text: point,
|
|
126
|
+
},
|
|
127
|
+
value: distance ?? undefined,
|
|
128
|
+
width: 1,
|
|
129
|
+
dashStyle: "solid",
|
|
130
|
+
color: "#E0E0E0",
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get series() {
|
|
135
|
+
const { fermiEnergy } = this;
|
|
136
|
+
|
|
137
|
+
const series_ = this.yDataSeries.map((item, index) => {
|
|
138
|
+
// shift values by fermiEnergy
|
|
139
|
+
const itemUpdated = item.map((x) => {
|
|
140
|
+
return fermiEnergy ? Number(x) - fermiEnergy : Number(x);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const spin = this.spin?.[index];
|
|
144
|
+
const spinText = spin && spin > 0 ? "up" : "down";
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
data: zip(this.pointsDistanceArray, itemUpdated) as [number, number][],
|
|
148
|
+
name: spinText,
|
|
149
|
+
color: spinText === "up" ? "#3677d9" : "#ff7f0e",
|
|
150
|
+
animation: false,
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
return series_;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
xAxis() {
|
|
158
|
+
return {
|
|
159
|
+
minorGridLineColor: "#E0E0E0",
|
|
160
|
+
minorGridLineWidth: 2,
|
|
161
|
+
minorTickLength: 0,
|
|
162
|
+
title: {
|
|
163
|
+
text: "Path in reciprocal space",
|
|
164
|
+
offset: 40,
|
|
165
|
+
},
|
|
166
|
+
type: "linear",
|
|
167
|
+
tickPositioner: () => [], // disable ticks
|
|
168
|
+
plotLines: this.pointsPath ? this.plotXLines() : undefined,
|
|
169
|
+
labels: {
|
|
170
|
+
enabled: false,
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
tooltipFormatter(xDataArray: XDataArrayNested, yAxisName = "energy") {
|
|
176
|
+
// note 'this' below refers to Highcharts tooltip scope
|
|
177
|
+
// eslint-disable-next-line func-names
|
|
178
|
+
return function (this: FormatterScope) {
|
|
179
|
+
return (
|
|
180
|
+
"<b>spin:</b> " +
|
|
181
|
+
this.series.name +
|
|
182
|
+
"<br>" +
|
|
183
|
+
"<b>point:</b> " +
|
|
184
|
+
xDataArray.map((p) => {
|
|
185
|
+
if (!Array.isArray(p)) {
|
|
186
|
+
console.error("xDataArray is not a nested array", xDataArray);
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
return p.map((c) => c.toFixed(_POINT_COORDINATES_PRECISION_));
|
|
190
|
+
})[this.point.index] +
|
|
191
|
+
"<br>" +
|
|
192
|
+
"<b>" +
|
|
193
|
+
yAxisName +
|
|
194
|
+
": </b> " +
|
|
195
|
+
this.y.toFixed(_POINT_COORDINATES_PRECISION_)
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
yAxis() {
|
|
201
|
+
return {
|
|
202
|
+
...super.yAxis(),
|
|
203
|
+
gridZIndex: 1,
|
|
204
|
+
plotLines: this.fermiEnergy
|
|
205
|
+
? this.plotSingleLine({
|
|
206
|
+
value: 0.0,
|
|
207
|
+
width: 2, // to be shown above above grid/tickLine at zero
|
|
208
|
+
label: {
|
|
209
|
+
text: "E_F",
|
|
210
|
+
style: {
|
|
211
|
+
color: "red",
|
|
212
|
+
},
|
|
213
|
+
y: -5,
|
|
214
|
+
x: -10,
|
|
215
|
+
},
|
|
216
|
+
})
|
|
217
|
+
: [],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
get overrideConfig() {
|
|
222
|
+
const { xDataArray } = this;
|
|
223
|
+
return {
|
|
224
|
+
chart: {
|
|
225
|
+
animation: false,
|
|
226
|
+
type: "spline",
|
|
227
|
+
zoomType: "xy",
|
|
228
|
+
},
|
|
229
|
+
plotOptions: {
|
|
230
|
+
spline: {
|
|
231
|
+
lineWidth: 2,
|
|
232
|
+
states: {
|
|
233
|
+
hover: {
|
|
234
|
+
lineWidth: 6,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
marker: {
|
|
238
|
+
enabled: false,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
tooltip: {
|
|
243
|
+
valueSuffix: "",
|
|
244
|
+
formatter: this.tooltipFormatter(xDataArray),
|
|
245
|
+
},
|
|
246
|
+
legend: {
|
|
247
|
+
enabled: false,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
type Schema = BandStructurePropertySchema;
|
|
254
|
+
|
|
255
|
+
type Base = typeof Property<Schema> & Constructor<BandStructurePropertySchemaMixin>;
|
|
256
|
+
|
|
257
|
+
export default class BandStructureProperty extends (Property as Base) implements Schema {
|
|
258
|
+
readonly subtitle: string = "Electronic Bandstructure";
|
|
259
|
+
|
|
260
|
+
readonly yAxisTitle: string = `Energy (${this.yAxis.units})`;
|
|
261
|
+
|
|
262
|
+
readonly chartConfig: Options;
|
|
263
|
+
|
|
264
|
+
static readonly isRefined = true;
|
|
265
|
+
|
|
266
|
+
static readonly propertyName = PropertyName.band_structure;
|
|
267
|
+
|
|
268
|
+
static readonly propertyType = PropertyType.non_scalar;
|
|
269
|
+
|
|
270
|
+
constructor(
|
|
271
|
+
config: Omit<Schema, "name"> & {
|
|
272
|
+
fermiEnergy?: number | null;
|
|
273
|
+
pointsPath?: KPointPath;
|
|
274
|
+
},
|
|
275
|
+
) {
|
|
276
|
+
super({ ...config, name: BandStructureProperty.propertyName });
|
|
277
|
+
this.chartConfig = new BandStructureConfig(this, {
|
|
278
|
+
fermiEnergy: config.fermiEnergy,
|
|
279
|
+
pointsPath: config.pointsPath,
|
|
280
|
+
}).config;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
bandStructurePropertySchemaMixin(BandStructureProperty.prototype);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
/* eslint-disable max-classes-per-file */
|
|
3
|
+
|
|
4
|
+
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
5
|
+
import type { ChargeDensityProfilePropertySchema } from "@mat3ra/esse/dist/js/types";
|
|
6
|
+
import type { Options } from "highcharts";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type ChargeDensityProfilePropertySchemaMixin,
|
|
10
|
+
chargeDensityProfilePropertySchemaMixin,
|
|
11
|
+
} from "../../generated/ChargeDensityProfilePropertySchemaMixin";
|
|
12
|
+
import Property from "../../Property";
|
|
13
|
+
import { PropertyName, PropertyType } from "../../settings";
|
|
14
|
+
import { TwoDimensionalHighChartConfigMixin } from "../include/mixins/2d_plot";
|
|
15
|
+
|
|
16
|
+
export class ChargeDensityProfileConfig extends TwoDimensionalHighChartConfigMixin {
|
|
17
|
+
readonly tooltipXAxisName = "z coordinate";
|
|
18
|
+
|
|
19
|
+
readonly tooltipYAxisName = "charge density";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type Schema = ChargeDensityProfilePropertySchema;
|
|
23
|
+
|
|
24
|
+
type Base = typeof Property<Schema> & Constructor<ChargeDensityProfilePropertySchemaMixin>;
|
|
25
|
+
|
|
26
|
+
class ChargeDensityProfileProperty extends (Property as Base) implements Schema {
|
|
27
|
+
readonly subtitle: string = "Charge Density Profile";
|
|
28
|
+
|
|
29
|
+
readonly yAxisTitle: string = `Charge Density (${this.yAxis.units})`;
|
|
30
|
+
|
|
31
|
+
readonly xAxisTitle: string = "Z Coordinate";
|
|
32
|
+
|
|
33
|
+
readonly chartConfig: Options = new ChargeDensityProfileConfig(this).config;
|
|
34
|
+
|
|
35
|
+
static readonly isRefined = true;
|
|
36
|
+
|
|
37
|
+
static readonly propertyName = PropertyName.charge_density_profile;
|
|
38
|
+
|
|
39
|
+
static readonly propertyType = PropertyType.non_scalar;
|
|
40
|
+
|
|
41
|
+
constructor(config: Omit<Schema, "name">) {
|
|
42
|
+
super({ ...config, name: ChargeDensityProfileProperty.propertyName });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
chargeDensityProfilePropertySchemaMixin(ChargeDensityProfileProperty.prototype);
|
|
47
|
+
|
|
48
|
+
export default ChargeDensityProfileProperty;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
/* eslint-disable max-classes-per-file */
|
|
3
|
+
import type { Constructor } from "@mat3ra/code/dist/js/utils/types.js";
|
|
4
|
+
import type { DensityOfStatesPropertySchema } from "@mat3ra/esse/dist/js/types";
|
|
5
|
+
import type { IndividualSeriesOptions, Options } from "highcharts";
|
|
6
|
+
import zip from "lodash/zip";
|
|
7
|
+
|
|
8
|
+
import { type FormatterScope, HighChartsConfig } from "../../charts/highcharts";
|
|
9
|
+
import {
|
|
10
|
+
type DensityOfStatesPropertySchemaMixin,
|
|
11
|
+
densityOfStatesPropertySchemaMixin,
|
|
12
|
+
} from "../../generated/DensityOfStatesPropertySchemaMixin";
|
|
13
|
+
import Property from "../../Property";
|
|
14
|
+
import { PropertyName, PropertyType } from "../../settings";
|
|
15
|
+
import { type YDataSeries } from "../include/mixins/2d_plot";
|
|
16
|
+
|
|
17
|
+
type Schema = DensityOfStatesPropertySchema;
|
|
18
|
+
|
|
19
|
+
export class DensityOfStatesConfig extends HighChartsConfig {
|
|
20
|
+
readonly yDataSeries: YDataSeries;
|
|
21
|
+
|
|
22
|
+
readonly fermiEnergy: number | null;
|
|
23
|
+
|
|
24
|
+
readonly xDataArray: Schema["xDataArray"];
|
|
25
|
+
|
|
26
|
+
readonly legends: Schema["legend"];
|
|
27
|
+
|
|
28
|
+
get overrideConfig() {
|
|
29
|
+
return {
|
|
30
|
+
colors: [
|
|
31
|
+
"#7cb5ec",
|
|
32
|
+
"#90ed7d",
|
|
33
|
+
"#f7a35c",
|
|
34
|
+
"#8085e9",
|
|
35
|
+
"#f15c80",
|
|
36
|
+
"#e4d354",
|
|
37
|
+
"#2b908f",
|
|
38
|
+
"#f45b5b",
|
|
39
|
+
"#91e8e1",
|
|
40
|
+
],
|
|
41
|
+
credits: {
|
|
42
|
+
enabled: false,
|
|
43
|
+
},
|
|
44
|
+
chart: {
|
|
45
|
+
type: "spline",
|
|
46
|
+
zoomType: "xy",
|
|
47
|
+
animation: false,
|
|
48
|
+
},
|
|
49
|
+
legend: {
|
|
50
|
+
layout: "horizontal",
|
|
51
|
+
align: "center",
|
|
52
|
+
verticalAlign: "bottom",
|
|
53
|
+
borderWidth: 0,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
constructor(
|
|
59
|
+
property: {
|
|
60
|
+
subtitle: string;
|
|
61
|
+
yAxisTitle: string;
|
|
62
|
+
xAxisTitle: string;
|
|
63
|
+
yDataSeries: YDataSeries;
|
|
64
|
+
legend?: Schema["legend"];
|
|
65
|
+
xDataArray: Schema["xDataArray"];
|
|
66
|
+
},
|
|
67
|
+
chartConfig?: {
|
|
68
|
+
fermiEnergy?: number | null;
|
|
69
|
+
},
|
|
70
|
+
) {
|
|
71
|
+
super({
|
|
72
|
+
subtitle: property.subtitle,
|
|
73
|
+
yAxisTitle: property.yAxisTitle,
|
|
74
|
+
xAxisTitle: property.xAxisTitle,
|
|
75
|
+
yAxisType: "linear",
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
this.yDataSeries = property.yDataSeries;
|
|
79
|
+
this.legends = property.legend || [];
|
|
80
|
+
this.fermiEnergy = chartConfig?.fermiEnergy ?? 0;
|
|
81
|
+
this.xDataArray = this.cleanXDataArray(property.xDataArray);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// shifting values wrt fermi energy here
|
|
85
|
+
cleanXDataArray(rawData: Schema["xDataArray"]) {
|
|
86
|
+
return rawData.flat().map((x) => {
|
|
87
|
+
const value = this.fermiEnergy ? x - this.fermiEnergy : x;
|
|
88
|
+
return Number(value.toPrecision(4));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get series(): IndividualSeriesOptions[] {
|
|
93
|
+
return this.yDataSeries.map((item, index) => {
|
|
94
|
+
const legend = this.legends[index];
|
|
95
|
+
const spinText = legend?.spin ? ` ${legend.spin > 0 ? "↑" : "↓"}` : "";
|
|
96
|
+
const name = legend?.element
|
|
97
|
+
? `${legend.element} ${legend.electronicState}${spinText}`
|
|
98
|
+
: "Total";
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
data: zip(
|
|
102
|
+
this.xDataArray,
|
|
103
|
+
item.map((x) => Number(Number(x).toPrecision(4))),
|
|
104
|
+
) as IndividualSeriesOptions["data"],
|
|
105
|
+
name,
|
|
106
|
+
color: name === "Total" ? "#000000" : undefined,
|
|
107
|
+
animation: false,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
tooltipFormatter() {
|
|
113
|
+
// eslint-disable-next-line func-names
|
|
114
|
+
return function (this: FormatterScope) {
|
|
115
|
+
return (
|
|
116
|
+
"<b>state:</b> " +
|
|
117
|
+
this.series.name +
|
|
118
|
+
"<br>" +
|
|
119
|
+
"<b>energy:</b> " +
|
|
120
|
+
this.key.toFixed(4) +
|
|
121
|
+
"<br>" +
|
|
122
|
+
"<b>value: </b> " +
|
|
123
|
+
this.y.toFixed(4)
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
xAxis() {
|
|
129
|
+
return {
|
|
130
|
+
...super.xAxis(),
|
|
131
|
+
plotLines: this.fermiEnergy
|
|
132
|
+
? this.plotSingleLine({
|
|
133
|
+
value: 0.0,
|
|
134
|
+
label: {
|
|
135
|
+
text: "E_F",
|
|
136
|
+
style: {
|
|
137
|
+
color: "red",
|
|
138
|
+
},
|
|
139
|
+
y: 15,
|
|
140
|
+
x: 5,
|
|
141
|
+
rotation: 0,
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
: [],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type Base = typeof Property<Schema> & Constructor<DensityOfStatesPropertySchemaMixin>;
|
|
150
|
+
|
|
151
|
+
export default class DensityOfStatesProperty extends (Property as Base) implements Schema {
|
|
152
|
+
readonly subtitle: string = "Density Of States";
|
|
153
|
+
|
|
154
|
+
readonly yAxisTitle: string = `Density Of States (${this.yAxis.units})`;
|
|
155
|
+
|
|
156
|
+
readonly xAxisTitle: string = `Energy (${this.xAxis.units})`;
|
|
157
|
+
|
|
158
|
+
readonly chartConfig: Options;
|
|
159
|
+
|
|
160
|
+
static readonly isRefined = true;
|
|
161
|
+
|
|
162
|
+
static readonly propertyName = PropertyName.density_of_states;
|
|
163
|
+
|
|
164
|
+
static readonly propertyType = PropertyType.non_scalar;
|
|
165
|
+
|
|
166
|
+
constructor(config: Omit<Schema, "name"> & { fermiEnergy?: number | null }) {
|
|
167
|
+
super({ ...config, name: DensityOfStatesProperty.propertyName });
|
|
168
|
+
this.chartConfig = new DensityOfStatesConfig(this, {
|
|
169
|
+
fermiEnergy: config.fermiEnergy,
|
|
170
|
+
}).config;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
densityOfStatesPropertySchemaMixin(DensityOfStatesProperty.prototype);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
/* eslint-disable max-classes-per-file */
|
|
3
|
+
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
4
|
+
import type { DielectricTensorPropertySchema } from "@mat3ra/esse/dist/js/types";
|
|
5
|
+
import type { Options } from "highcharts";
|
|
6
|
+
import zip from "lodash/zip";
|
|
7
|
+
import type { FormatterScope } from "src/js/charts/highcharts";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type DielectricTensorPropertySchemaMixin,
|
|
11
|
+
dielectricTensorPropertySchemaMixin,
|
|
12
|
+
} from "../../generated/DielectricTensorPropertySchemaMixin";
|
|
13
|
+
import Property from "../../Property";
|
|
14
|
+
import { PropertyName, PropertyType } from "../../settings";
|
|
15
|
+
import { TwoDimensionalHighChartConfigMixin } from "../include/mixins/2d_plot";
|
|
16
|
+
|
|
17
|
+
type Schema = DielectricTensorPropertySchema;
|
|
18
|
+
|
|
19
|
+
export class DielectricTensorConfig extends TwoDimensionalHighChartConfigMixin {
|
|
20
|
+
get series() {
|
|
21
|
+
return this.yDataSeries.map((item, index) => {
|
|
22
|
+
return {
|
|
23
|
+
animation: false,
|
|
24
|
+
name: Array.isArray(this.legend) ? this.legend[index] : "",
|
|
25
|
+
data: zip(this.xDataArray, item) as [number, number][],
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
tooltipFormatter() {
|
|
31
|
+
// eslint-disable-next-line func-names
|
|
32
|
+
return function (this: FormatterScope) {
|
|
33
|
+
return (
|
|
34
|
+
"<b>part:</b> " +
|
|
35
|
+
this.series.name +
|
|
36
|
+
"<br>" +
|
|
37
|
+
"<b>frequency:</b> " +
|
|
38
|
+
this.key.toFixed(4) +
|
|
39
|
+
"<br>" +
|
|
40
|
+
"<b>epsilon: </b> " +
|
|
41
|
+
this.y.toFixed(4)
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get overrideConfig() {
|
|
47
|
+
return {
|
|
48
|
+
...super.overrideConfig,
|
|
49
|
+
colors: [
|
|
50
|
+
"#7cb5ec",
|
|
51
|
+
"#90ed7d",
|
|
52
|
+
"#f7a35c",
|
|
53
|
+
"#8085e9",
|
|
54
|
+
"#f15c80",
|
|
55
|
+
"#e4d354",
|
|
56
|
+
"#2b908f",
|
|
57
|
+
"#f45b5b",
|
|
58
|
+
"#91e8e1",
|
|
59
|
+
],
|
|
60
|
+
credits: {
|
|
61
|
+
enabled: false,
|
|
62
|
+
},
|
|
63
|
+
chart: {
|
|
64
|
+
type: "spline",
|
|
65
|
+
zoomType: "xy",
|
|
66
|
+
animation: false,
|
|
67
|
+
},
|
|
68
|
+
legend: {
|
|
69
|
+
layout: "horizontal",
|
|
70
|
+
align: "center",
|
|
71
|
+
verticalAlign: "bottom",
|
|
72
|
+
borderWidth: 0,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type Base = typeof Property<Schema> & Constructor<DielectricTensorPropertySchemaMixin>;
|
|
79
|
+
|
|
80
|
+
export default class DielectricTensorProperty extends (Property as Base) implements Schema {
|
|
81
|
+
readonly subtitle = "Dielectric Tensor";
|
|
82
|
+
|
|
83
|
+
readonly yAxisTitle = "Dielectric Tensor Component";
|
|
84
|
+
|
|
85
|
+
readonly xAxisTitle = "Frequency (eV)";
|
|
86
|
+
|
|
87
|
+
readonly chartConfig: Options[] = this.getAllChartConfigs().map((chartConfig) => {
|
|
88
|
+
const cfg = new DielectricTensorConfig(chartConfig);
|
|
89
|
+
return cfg.config;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
static readonly propertyName = PropertyName.dielectric_tensor;
|
|
93
|
+
|
|
94
|
+
static readonly propertyType = PropertyType.non_scalar;
|
|
95
|
+
|
|
96
|
+
constructor(config: Omit<Schema, "name">) {
|
|
97
|
+
super({ ...config, name: DielectricTensorProperty.propertyName });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private rowMajorToColumnMajor(matrix: number[][]) {
|
|
101
|
+
return matrix.reduce<[number[], number[], number[]]>(
|
|
102
|
+
(accumulator, item) => {
|
|
103
|
+
const [x, y, z] = item;
|
|
104
|
+
accumulator[0].push(x);
|
|
105
|
+
accumulator[1].push(y);
|
|
106
|
+
accumulator[2].push(z);
|
|
107
|
+
return accumulator;
|
|
108
|
+
},
|
|
109
|
+
[[], [], []],
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private getComplementaryPairs(precision = 3) {
|
|
114
|
+
const groupedBySpin: Record<string, Schema["values"]> = {};
|
|
115
|
+
|
|
116
|
+
this.values.forEach((item) => {
|
|
117
|
+
// Round the spin value to mitigate floating-point precision issues
|
|
118
|
+
const spinValue = item.spin !== undefined ? item.spin.toFixed(precision) : "undefined";
|
|
119
|
+
groupedBySpin[spinValue] = groupedBySpin[spinValue] || [];
|
|
120
|
+
groupedBySpin[spinValue].push(item);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return Object.values(groupedBySpin).filter(
|
|
124
|
+
(group) =>
|
|
125
|
+
group.length === 2 &&
|
|
126
|
+
group.find((item) => item.part === "real") &&
|
|
127
|
+
group.find((item) => item.part === "imaginary"),
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private getAllChartConfigs() {
|
|
132
|
+
const complementaryPairs = this.getComplementaryPairs();
|
|
133
|
+
|
|
134
|
+
return complementaryPairs.map((pair) => {
|
|
135
|
+
const xDataArray = pair[0].frequencies;
|
|
136
|
+
const spinChannel = pair[0].spin ? ` - spin(${pair[0].spin})` : "";
|
|
137
|
+
return {
|
|
138
|
+
subtitle: `${this.subtitle}${spinChannel}`,
|
|
139
|
+
xAxisTitle: this.xAxisTitle,
|
|
140
|
+
yAxisTitle: this.yAxisTitle,
|
|
141
|
+
yAxisType: "linear",
|
|
142
|
+
xDataArray,
|
|
143
|
+
yDataSeries: pair.flatMap((p) => this.rowMajorToColumnMajor(p.components)) as [
|
|
144
|
+
number,
|
|
145
|
+
...number[],
|
|
146
|
+
][],
|
|
147
|
+
legend: pair.flatMap((p) => [..."xyz"].map((char) => `eps_${char} (${p.part})`)),
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
dielectricTensorPropertySchemaMixin(DielectricTensorProperty.prototype);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
|
|
2
|
+
import type { FileContentPropertySchema } from "@mat3ra/esse/dist/js/types";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type FileContentPropertySchemaMixin,
|
|
6
|
+
fileContentPropertySchemaMixin,
|
|
7
|
+
} from "../../generated/FileContentPropertySchemaMixin";
|
|
8
|
+
import Property from "../../Property";
|
|
9
|
+
import { PropertyName, PropertyType } from "../../settings";
|
|
10
|
+
|
|
11
|
+
type Schema = FileContentPropertySchema;
|
|
12
|
+
|
|
13
|
+
type Base = typeof Property<Schema> & Constructor<FileContentPropertySchemaMixin>;
|
|
14
|
+
|
|
15
|
+
export default class FileContentProperty extends (Property as Base) implements Schema {
|
|
16
|
+
static readonly isAbleToReturnMultipleResults = true;
|
|
17
|
+
|
|
18
|
+
static readonly propertyName = PropertyName.file_content;
|
|
19
|
+
|
|
20
|
+
static readonly propertyType = PropertyType.non_scalar;
|
|
21
|
+
|
|
22
|
+
constructor(config: Omit<Schema, "name">) {
|
|
23
|
+
super({ ...config, name: FileContentProperty.propertyName });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fileContentPropertySchemaMixin(FileContentProperty.prototype);
|