@mat3ra/wode 2025.10.1-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 +164 -0
- package/assets/subworkflows/deepmd/deepmd.yml +31 -0
- package/assets/subworkflows/deepmd/espresso_cp_md.yml +16 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_find_minima.yml +27 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_via_band_structure.yml +67 -0
- package/assets/subworkflows/espresso/band_gap.yml +21 -0
- package/assets/subworkflows/espresso/band_gap_hse_dos.yml +30 -0
- package/assets/subworkflows/espresso/band_structure.yml +26 -0
- package/assets/subworkflows/espresso/band_structure_dos.yml +34 -0
- package/assets/subworkflows/espresso/band_structure_hse.yml +30 -0
- package/assets/subworkflows/espresso/band_structure_magn.yml +31 -0
- package/assets/subworkflows/espresso/band_structure_soc.yml +30 -0
- package/assets/subworkflows/espresso/dielectric_tensor.yml +35 -0
- package/assets/subworkflows/espresso/dos.yml +24 -0
- package/assets/subworkflows/espresso/electronic_density_mesh.yml +19 -0
- package/assets/subworkflows/espresso/esm.yml +14 -0
- package/assets/subworkflows/espresso/esm_relax.yml +14 -0
- package/assets/subworkflows/espresso/espresso_extract_kpoints.yml +16 -0
- package/assets/subworkflows/espresso/espresso_xml_get_qpt_irr.yml +12 -0
- package/assets/subworkflows/espresso/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_full_frequency.yml +22 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +22 -0
- package/assets/subworkflows/espresso/hubbard_u_hp.yml +21 -0
- package/assets/subworkflows/espresso/kpoint_convergence.yml +86 -0
- package/assets/subworkflows/espresso/neb.yml +16 -0
- package/assets/subworkflows/espresso/ph_init_qpoints.yml +14 -0
- package/assets/subworkflows/espresso/ph_single_irr_qpt.yml +14 -0
- package/assets/subworkflows/espresso/phonon_dispersions.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos_dispersion.yml +34 -0
- package/assets/subworkflows/espresso/phonon_reduce.yml +29 -0
- package/assets/subworkflows/espresso/post_processor.yml +14 -0
- package/assets/subworkflows/espresso/pre_processor.yml +14 -0
- package/assets/subworkflows/espresso/pw_scf.yml +16 -0
- package/assets/subworkflows/espresso/recalculate_bands.yml +19 -0
- package/assets/subworkflows/espresso/surface_energy.yml +16 -0
- package/assets/subworkflows/espresso/total_energy.yml +16 -0
- package/assets/subworkflows/espresso/valence_band_offset_calc_from_previous_esp_vbm.yml +35 -0
- package/assets/subworkflows/espresso/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/espresso/zero_point_energy.yml +19 -0
- package/assets/subworkflows/jupyterLab/jupyter_notebook.yml +17 -0
- package/assets/subworkflows/nwchem/total_energy.yml +16 -0
- package/assets/subworkflows/python/ml/classification_tail.yml +56 -0
- package/assets/subworkflows/python/ml/clustering_tail.yml +62 -0
- package/assets/subworkflows/python/ml/regression_tail.yml +56 -0
- package/assets/subworkflows/python/ml/train_head.yml +61 -0
- package/assets/subworkflows/python/python_script.yml +14 -0
- package/assets/subworkflows/shell/batch_espresso_pwscf.yml +14 -0
- package/assets/subworkflows/shell/hello_world.yml +14 -0
- package/assets/subworkflows/vasp/band_gap.yml +21 -0
- package/assets/subworkflows/vasp/band_structure.yml +21 -0
- package/assets/subworkflows/vasp/band_structure_dos.yml +23 -0
- package/assets/subworkflows/vasp/dos.yml +18 -0
- package/assets/subworkflows/vasp/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/vasp/initial_final_total_energies.yml +25 -0
- package/assets/subworkflows/vasp/kpoint_convergence.yml +89 -0
- package/assets/subworkflows/vasp/neb_subworkflow.yml +16 -0
- package/assets/subworkflows/vasp/prepare_images.yml +16 -0
- package/assets/subworkflows/vasp/recalculate_bands.yml +16 -0
- package/assets/subworkflows/vasp/surface_energy.yml +18 -0
- package/assets/subworkflows/vasp/total_energy.yml +16 -0
- package/assets/subworkflows/vasp/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/vasp/zero_point_energy.yml +16 -0
- package/assets/workflows/deepmd/deepmd_md.yml +6 -0
- package/assets/workflows/espresso/band_gap.yml +4 -0
- package/assets/workflows/espresso/band_gap_dos_hse.yml +4 -0
- package/assets/workflows/espresso/band_structure.yml +4 -0
- package/assets/workflows/espresso/band_structure_dos.yml +4 -0
- package/assets/workflows/espresso/band_structure_hse.yml +14 -0
- package/assets/workflows/espresso/band_structure_magn.yml +7 -0
- package/assets/workflows/espresso/band_structure_soc.yml +7 -0
- package/assets/workflows/espresso/dielectric_tensor.yml +4 -0
- package/assets/workflows/espresso/dos.yml +4 -0
- package/assets/workflows/espresso/electronic_density_mesh.yml +4 -0
- package/assets/workflows/espresso/esm.yml +4 -0
- package/assets/workflows/espresso/esm_relax.yml +4 -0
- package/assets/workflows/espresso/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_full_frequency.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +4 -0
- package/assets/workflows/espresso/hubbard_u_hp.yml +7 -0
- package/assets/workflows/espresso/kpoint_convergence.yml +4 -0
- package/assets/workflows/espresso/neb.yml +4 -0
- package/assets/workflows/espresso/phonon_dispersions.yml +4 -0
- package/assets/workflows/espresso/phonon_dos.yml +4 -0
- package/assets/workflows/espresso/phonon_dos_dispersion.yml +4 -0
- package/assets/workflows/espresso/phonon_map.yml +28 -0
- package/assets/workflows/espresso/recalculate_bands.yml +4 -0
- package/assets/workflows/espresso/surface_energy.yml +4 -0
- package/assets/workflows/espresso/total_energy.yml +4 -0
- package/assets/workflows/espresso/valence_band_offset.yml +171 -0
- package/assets/workflows/espresso/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/zero_point_energy.yml +4 -0
- package/assets/workflows/jupyterLab/jupyter_notebook.yml +4 -0
- package/assets/workflows/nwchem/total_energy.yml +4 -0
- package/assets/workflows/python/ml/classification_workflow.yml +9 -0
- package/assets/workflows/python/ml/clustering_workflow.yml +9 -0
- package/assets/workflows/python/ml/regression_workflow.yml +9 -0
- package/assets/workflows/python/python_script.yml +4 -0
- package/assets/workflows/shell/batch_espresso_pwscf.yml +4 -0
- package/assets/workflows/shell/hello_world.yml +4 -0
- package/assets/workflows/vasp/band_gap.yml +4 -0
- package/assets/workflows/vasp/band_structure.yml +4 -0
- package/assets/workflows/vasp/band_structure_dos.yml +4 -0
- package/assets/workflows/vasp/dos.yml +4 -0
- package/assets/workflows/vasp/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/kpoint_convergence.yml +4 -0
- package/assets/workflows/vasp/neb.yml +8 -0
- package/assets/workflows/vasp/recalculate_bands.yml +4 -0
- package/assets/workflows/vasp/surface_energy.yml +4 -0
- package/assets/workflows/vasp/total_energy.yml +4 -0
- package/assets/workflows/vasp/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/zero_point_energy.yml +4 -0
- package/build_workflows.js +65 -0
- package/dist/context/context.js +49 -0
- package/dist/context/mixins/ApplicationContextMixin.js +19 -0
- package/dist/context/mixins/JobContextMixin.js +39 -0
- package/dist/context/mixins/MaterialContextMixin.js +40 -0
- package/dist/context/mixins/MaterialsContextMixin.js +19 -0
- package/dist/context/mixins/MaterialsSetContextMixin.js +25 -0
- package/dist/context/mixins/MethodDataContextMixin.js +48 -0
- package/dist/context/mixins/WorkflowContextMixin.js +28 -0
- package/dist/context/providers/BoundaryConditionsFormDataProvider.js +86 -0
- package/dist/context/providers/CollinearMagnetizationContextProvider.js +113 -0
- package/dist/context/providers/HubbardContextProviderLegacy.js +81 -0
- package/dist/context/providers/HubbardJContextProvider.js +74 -0
- package/dist/context/providers/HubbardUContextProvider.js +77 -0
- package/dist/context/providers/HubbardVContextProvider.js +104 -0
- package/dist/context/providers/IonDynamicsContextProvider.js +62 -0
- package/dist/context/providers/MLSettingsContextProvider.js +52 -0
- package/dist/context/providers/MLTrainTestSplitContextProvider.js +48 -0
- package/dist/context/providers/NEBFormDataProvider.js +38 -0
- package/dist/context/providers/NonCollinearMagnetizationContextProvider.js +253 -0
- package/dist/context/providers/PlanewaveCutoffsContextProvider.js +67 -0
- package/dist/context/providers/PointsGridFormDataProvider.js +272 -0
- package/dist/context/providers/PointsPathFormDataProvider.js +155 -0
- package/dist/context/providers/by_application/ExecutableContextProvider.js +17 -0
- package/dist/context/providers/by_application/espresso/QENEBContextProvider.js +60 -0
- package/dist/context/providers/by_application/espresso/QEPWXContextProvider.js +149 -0
- package/dist/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +84 -0
- package/dist/context/providers/by_application/vasp/VASPContextProvider.js +64 -0
- package/dist/context/providers/by_application/vasp/VASPNEBContextProvider.js +56 -0
- package/dist/context/providers/settings.js +37 -0
- package/dist/context/providers.js +199 -0
- package/dist/enums.js +65 -0
- package/dist/index.js +64 -0
- package/dist/patch.js +19 -0
- package/dist/subworkflows/convergence/factory.js +35 -0
- package/dist/subworkflows/convergence/non_uniform_kgrid.js +31 -0
- package/dist/subworkflows/convergence/parameter.js +70 -0
- package/dist/subworkflows/convergence/uniform_kgrid.js +26 -0
- package/dist/subworkflows/convergence.js +189 -0
- package/dist/subworkflows/create.js +285 -0
- package/dist/subworkflows/dynamic/espresso/getQpointIrrep.js +34 -0
- package/dist/subworkflows/dynamic/index.js +19 -0
- package/dist/subworkflows/dynamic/surfaceEnergy.js +67 -0
- package/dist/subworkflows/index.js +19 -0
- package/dist/subworkflows/subworkflow.js +279 -0
- package/dist/units/assertion.js +37 -0
- package/dist/units/assignment.js +42 -0
- package/dist/units/base.js +91 -0
- package/dist/units/builders/AssertionUnitConfigBuilder.js +34 -0
- package/dist/units/builders/AssignmentUnitConfigBuilder.js +41 -0
- package/dist/units/builders/ExecutionUnitConfigBuilder.js +67 -0
- package/dist/units/builders/IOUnitConfigBuilder.js +54 -0
- package/dist/units/builders/UnitConfigBuilder.js +79 -0
- package/dist/units/builders/index.js +18 -0
- package/dist/units/condition.js +52 -0
- package/dist/units/execution.js +222 -0
- package/dist/units/factory.js +53 -0
- package/dist/units/index.js +82 -0
- package/dist/units/io.js +148 -0
- package/dist/units/map.js +38 -0
- package/dist/units/processing.js +41 -0
- package/dist/units/reduce.js +24 -0
- package/dist/units/subworkflow.js +23 -0
- package/dist/utils.js +92 -0
- package/dist/workflows/create.js +312 -0
- package/dist/workflows/default.js +41 -0
- package/dist/workflows/index.js +108 -0
- package/dist/workflows/relaxation.js +37 -0
- package/dist/workflows/workflow.js +303 -0
- package/package.json +94 -0
- package/src/context/context.js +47 -0
- package/src/context/mixins/ApplicationContextMixin.js +19 -0
- package/src/context/mixins/JobContextMixin.js +36 -0
- package/src/context/mixins/MaterialContextMixin.js +41 -0
- package/src/context/mixins/MaterialsContextMixin.js +18 -0
- package/src/context/mixins/MaterialsSetContextMixin.js +24 -0
- package/src/context/mixins/MethodDataContextMixin.js +48 -0
- package/src/context/mixins/WorkflowContextMixin.js +25 -0
- package/src/context/providers/BoundaryConditionsFormDataProvider.js +80 -0
- package/src/context/providers/CollinearMagnetizationContextProvider.js +117 -0
- package/src/context/providers/HubbardContextProviderLegacy.js +75 -0
- package/src/context/providers/HubbardJContextProvider.js +73 -0
- package/src/context/providers/HubbardUContextProvider.js +100 -0
- package/src/context/providers/HubbardVContextProvider.js +111 -0
- package/src/context/providers/IonDynamicsContextProvider.js +56 -0
- package/src/context/providers/MLSettingsContextProvider.js +48 -0
- package/src/context/providers/MLTrainTestSplitContextProvider.js +45 -0
- package/src/context/providers/NEBFormDataProvider.js +32 -0
- package/src/context/providers/NonCollinearMagnetizationContextProvider.js +269 -0
- package/src/context/providers/PlanewaveCutoffsContextProvider.js +68 -0
- package/src/context/providers/PointsGridFormDataProvider.js +285 -0
- package/src/context/providers/PointsPathFormDataProvider.js +165 -0
- package/src/context/providers/by_application/ExecutableContextProvider.js +10 -0
- package/src/context/providers/by_application/espresso/QENEBContextProvider.js +56 -0
- package/src/context/providers/by_application/espresso/QEPWXContextProvider.js +166 -0
- package/src/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +86 -0
- package/src/context/providers/by_application/vasp/VASPContextProvider.js +56 -0
- package/src/context/providers/by_application/vasp/VASPNEBContextProvider.js +46 -0
- package/src/context/providers/settings.js +38 -0
- package/src/context/providers.js +140 -0
- package/src/enums.js +65 -0
- package/src/index.js +17 -0
- package/src/patch.js +12 -0
- package/src/subworkflows/convergence/factory.js +14 -0
- package/src/subworkflows/convergence/non_uniform_kgrid.js +28 -0
- package/src/subworkflows/convergence/parameter.js +58 -0
- package/src/subworkflows/convergence/uniform_kgrid.js +22 -0
- package/src/subworkflows/convergence.js +196 -0
- package/src/subworkflows/create.js +201 -0
- package/src/subworkflows/dynamic/espresso/getQpointIrrep.js +35 -0
- package/src/subworkflows/dynamic/index.js +8 -0
- package/src/subworkflows/dynamic/surfaceEnergy.js +124 -0
- package/src/subworkflows/index.js +2 -0
- package/src/subworkflows/subworkflow.js +329 -0
- package/src/units/assertion.js +29 -0
- package/src/units/assignment.js +34 -0
- package/src/units/base.js +97 -0
- package/src/units/builders/AssertionUnitConfigBuilder.js +28 -0
- package/src/units/builders/AssignmentUnitConfigBuilder.js +36 -0
- package/src/units/builders/ExecutionUnitConfigBuilder.js +59 -0
- package/src/units/builders/IOUnitConfigBuilder.js +53 -0
- package/src/units/builders/UnitConfigBuilder.js +86 -0
- package/src/units/builders/index.js +15 -0
- package/src/units/condition.js +47 -0
- package/src/units/execution.js +263 -0
- package/src/units/factory.js +53 -0
- package/src/units/index.js +25 -0
- package/src/units/io.js +163 -0
- package/src/units/map.js +33 -0
- package/src/units/processing.js +39 -0
- package/src/units/reduce.js +17 -0
- package/src/units/subworkflow.js +15 -0
- package/src/utils.js +73 -0
- package/src/workflows/create.js +222 -0
- package/src/workflows/default.js +39 -0
- package/src/workflows/index.js +99 -0
- package/src/workflows/relaxation.js +41 -0
- package/src/workflows/workflow.js +351 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PointsGridFormDataProvider = void 0;
|
|
7
|
+
var _JSONSchemaFormDataProvider = _interopRequireDefault(require("@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider"));
|
|
8
|
+
var _constants = require("@mat3ra/code/dist/js/constants");
|
|
9
|
+
var _math = require("@mat3ra/code/dist/js/math");
|
|
10
|
+
var _made = require("@mat3ra/made");
|
|
11
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
|
+
var _MaterialContextMixin = require("../mixins/MaterialContextMixin");
|
|
13
|
+
var _settings = require("./settings");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
class PointsGridFormDataProvider extends _JSONSchemaFormDataProvider.default {
|
|
16
|
+
constructor(config) {
|
|
17
|
+
super(config);
|
|
18
|
+
this.initMaterialContextMixin();
|
|
19
|
+
this._divisor = config.divisor || 1; // KPPRA will be divided by this number
|
|
20
|
+
this.reciprocalLattice = new _made.Made.ReciprocalLattice(this.material.lattice);
|
|
21
|
+
this.dimensions = _lodash.default.get(this.data, "dimensions") || this._defaultDimensions;
|
|
22
|
+
this.shifts = _lodash.default.get(this.data, "shifts") || this._defaultShifts;
|
|
23
|
+
|
|
24
|
+
// init class fields from data (as constructed from context in parent)
|
|
25
|
+
this.gridMetricType = _lodash.default.get(this.data, "gridMetricType") || "KPPRA";
|
|
26
|
+
this.gridMetricValue = _lodash.default.get(this.data, "gridMetricValue") || this._getDefaultGridMetricValue("KPPRA");
|
|
27
|
+
this.preferGridMetric = _lodash.default.get(this.data, "preferGridMetric", false);
|
|
28
|
+
this._metricDescription = {
|
|
29
|
+
KPPRA: `${this.name[0].toUpperCase()}PPRA (${this.name[0]}pt per reciprocal atom)`,
|
|
30
|
+
// KPPRA or QPPRA
|
|
31
|
+
spacing: "grid spacing"
|
|
32
|
+
};
|
|
33
|
+
this.defaultClassNames = "col-xs-12 col-sm-6 col-md-3 col-lg-2";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line class-methods-use-this
|
|
37
|
+
getDefaultShift() {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
get _defaultDimensions() {
|
|
41
|
+
return this.calculateDimensions({
|
|
42
|
+
gridMetricType: "KPPRA",
|
|
43
|
+
gridMetricValue: this._getDefaultGridMetricValue("KPPRA")
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
get _defaultShifts() {
|
|
47
|
+
return Array(3).fill(this.getDefaultShift());
|
|
48
|
+
}
|
|
49
|
+
_getDefaultGridMetricValue(metric) {
|
|
50
|
+
switch (metric) {
|
|
51
|
+
case "KPPRA":
|
|
52
|
+
return Math.floor(_settings.globalSettings.defaultKPPRA / this._divisor);
|
|
53
|
+
case "spacing":
|
|
54
|
+
return 0.3;
|
|
55
|
+
default:
|
|
56
|
+
console.error("Metric type not recognized!");
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
get _defaultData() {
|
|
61
|
+
return {
|
|
62
|
+
dimensions: this._defaultDimensions,
|
|
63
|
+
shifts: this._defaultShifts,
|
|
64
|
+
gridMetricType: "KPPRA",
|
|
65
|
+
gridMetricValue: this._getDefaultGridMetricValue("KPPRA"),
|
|
66
|
+
preferGridMetric: false,
|
|
67
|
+
reciprocalVectorRatios: this.reciprocalVectorRatios
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
get _defaultDataWithMaterial() {
|
|
71
|
+
const {
|
|
72
|
+
gridMetricType,
|
|
73
|
+
gridMetricValue
|
|
74
|
+
} = this;
|
|
75
|
+
// if `data` is present and material is updated, prioritize `data` when `preferGridMetric` is not set
|
|
76
|
+
return this.preferGridMetric ? {
|
|
77
|
+
dimensions: this.calculateDimensions({
|
|
78
|
+
gridMetricType,
|
|
79
|
+
gridMetricValue
|
|
80
|
+
}),
|
|
81
|
+
shifts: this._defaultShifts
|
|
82
|
+
} : this.data || this._defaultData;
|
|
83
|
+
}
|
|
84
|
+
get defaultData() {
|
|
85
|
+
return this.material ? this._defaultDataWithMaterial : this._defaultData;
|
|
86
|
+
}
|
|
87
|
+
get reciprocalVectorRatios() {
|
|
88
|
+
return this.reciprocalLattice.reciprocalVectorRatios.map(r => Number(_math.math.numberToPrecision(r, 3)));
|
|
89
|
+
}
|
|
90
|
+
get jsonSchema() {
|
|
91
|
+
const vector = {
|
|
92
|
+
type: "array",
|
|
93
|
+
items: {
|
|
94
|
+
type: "number"
|
|
95
|
+
},
|
|
96
|
+
minItems: 3,
|
|
97
|
+
maxItems: 3
|
|
98
|
+
};
|
|
99
|
+
const vector_ = (defaultValue, isStringType = false) => {
|
|
100
|
+
const isArray = Array.isArray(defaultValue);
|
|
101
|
+
return {
|
|
102
|
+
...vector,
|
|
103
|
+
items: {
|
|
104
|
+
type: isStringType ? "string" : "number",
|
|
105
|
+
...(isArray ? {} : {
|
|
106
|
+
default: defaultValue
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
...(isArray ? {
|
|
110
|
+
default: defaultValue
|
|
111
|
+
} : {})
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
116
|
+
description: `3D grid with shifts. Default min value for ${this._metricDescription[this.gridMetricType]} is ${this._getDefaultGridMetricValue(this.gridMetricType)}.`,
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
dimensions: vector_(this._defaultDimensions, this.isUsingJinjaVariables),
|
|
120
|
+
shifts: vector_(this.getDefaultShift()),
|
|
121
|
+
reciprocalVectorRatios: vector_(this.reciprocalVectorRatios),
|
|
122
|
+
gridMetricType: {
|
|
123
|
+
type: "string",
|
|
124
|
+
enum: ["KPPRA", "spacing"],
|
|
125
|
+
default: "KPPRA"
|
|
126
|
+
},
|
|
127
|
+
gridMetricValue: {
|
|
128
|
+
type: "number"
|
|
129
|
+
},
|
|
130
|
+
preferGridMetric: {
|
|
131
|
+
type: "boolean"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
dependencies: {
|
|
135
|
+
gridMetricType: {
|
|
136
|
+
oneOf: [{
|
|
137
|
+
properties: {
|
|
138
|
+
gridMetricType: {
|
|
139
|
+
enum: ["KPPRA"]
|
|
140
|
+
},
|
|
141
|
+
gridMetricValue: {
|
|
142
|
+
type: "integer",
|
|
143
|
+
minimum: 1,
|
|
144
|
+
title: "Value",
|
|
145
|
+
default: this.gridMetricValue
|
|
146
|
+
},
|
|
147
|
+
preferGridMetric: {
|
|
148
|
+
type: "boolean",
|
|
149
|
+
title: "prefer KPPRA",
|
|
150
|
+
default: this.preferGridMetric
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
properties: {
|
|
155
|
+
gridMetricType: {
|
|
156
|
+
enum: ["spacing"]
|
|
157
|
+
},
|
|
158
|
+
gridMetricValue: {
|
|
159
|
+
type: "number",
|
|
160
|
+
minimum: 0,
|
|
161
|
+
title: "Value [1/Å]",
|
|
162
|
+
default: this.gridMetricValue
|
|
163
|
+
},
|
|
164
|
+
preferGridMetric: {
|
|
165
|
+
type: "boolean",
|
|
166
|
+
title: "prefer spacing",
|
|
167
|
+
default: this.preferGridMetric
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
required: ["dimensions", "shifts"]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
get uiSchema() {
|
|
177
|
+
const _arraySubStyle = (emptyValue = 0) => {
|
|
178
|
+
return {
|
|
179
|
+
"ui:options": {
|
|
180
|
+
addable: false,
|
|
181
|
+
orderable: false,
|
|
182
|
+
removable: false
|
|
183
|
+
},
|
|
184
|
+
items: {
|
|
185
|
+
"ui:disabled": this.preferGridMetric,
|
|
186
|
+
// TODO: extract the actual current values from context
|
|
187
|
+
"ui:placeholder": "1",
|
|
188
|
+
"ui:emptyValue": emptyValue,
|
|
189
|
+
"ui:label": false
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
return {
|
|
194
|
+
dimensions: _arraySubStyle(1),
|
|
195
|
+
shifts: _arraySubStyle(0),
|
|
196
|
+
gridMetricType: {
|
|
197
|
+
"ui:title": "Grid Metric"
|
|
198
|
+
},
|
|
199
|
+
gridMetricValue: {
|
|
200
|
+
"ui:disabled": !this.preferGridMetric,
|
|
201
|
+
"ui:emptyValue": this.gridMetricValue,
|
|
202
|
+
"ui:placeholder": this.gridMetricValue.toString() // make string to prevent prop type error
|
|
203
|
+
},
|
|
204
|
+
preferGridMetric: {
|
|
205
|
+
"ui:emptyValue": true,
|
|
206
|
+
"ui:disabled": this.isUsingJinjaVariables
|
|
207
|
+
},
|
|
208
|
+
reciprocalVectorRatios: {
|
|
209
|
+
"ui:title": "reciprocal vector ratios",
|
|
210
|
+
"ui:orderable": false,
|
|
211
|
+
"ui:removable": false,
|
|
212
|
+
"ui:readonly": true,
|
|
213
|
+
items: {
|
|
214
|
+
"ui:label": false
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
_getDimensionsFromKPPRA(KPPRA) {
|
|
220
|
+
const nAtoms = this.material ? this.material.Basis.nAtoms : 1;
|
|
221
|
+
return this.reciprocalLattice.getDimensionsFromPointsCount(KPPRA / nAtoms);
|
|
222
|
+
}
|
|
223
|
+
_getKPPRAFromDimensions(dimensions) {
|
|
224
|
+
const nAtoms = this.material ? this.material.Basis.nAtoms : 1;
|
|
225
|
+
return dimensions.reduce((a, b) => a * b) * nAtoms;
|
|
226
|
+
}
|
|
227
|
+
static _canTransform(data) {
|
|
228
|
+
return data.preferGridMetric && data.gridMetricType && data.gridMetricValue || !data.preferGridMetric && data.dimensions.every(d => typeof d === "number");
|
|
229
|
+
}
|
|
230
|
+
calculateDimensions({
|
|
231
|
+
gridMetricType,
|
|
232
|
+
gridMetricValue,
|
|
233
|
+
units = _constants.units.angstrom
|
|
234
|
+
}) {
|
|
235
|
+
switch (gridMetricType) {
|
|
236
|
+
case "KPPRA":
|
|
237
|
+
return this._getDimensionsFromKPPRA(gridMetricValue);
|
|
238
|
+
case "spacing":
|
|
239
|
+
return this.reciprocalLattice.getDimensionsFromSpacing(gridMetricValue, units);
|
|
240
|
+
default:
|
|
241
|
+
return [1, 1, 1];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
calculateGridMetric({
|
|
245
|
+
gridMetricType,
|
|
246
|
+
dimensions,
|
|
247
|
+
units = _constants.units.angstrom
|
|
248
|
+
}) {
|
|
249
|
+
switch (gridMetricType) {
|
|
250
|
+
case "KPPRA":
|
|
251
|
+
return this._getKPPRAFromDimensions(dimensions);
|
|
252
|
+
case "spacing":
|
|
253
|
+
return _lodash.default.round(this.reciprocalLattice.getSpacingFromDimensions(dimensions, units), 3);
|
|
254
|
+
default:
|
|
255
|
+
return 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
transformData(data) {
|
|
259
|
+
if (!this.constructor._canTransform(data)) {
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
262
|
+
// dimensions are calculated from grid metric or vice versa
|
|
263
|
+
if (data.preferGridMetric) {
|
|
264
|
+
data.dimensions = this.calculateDimensions(data);
|
|
265
|
+
} else {
|
|
266
|
+
data.gridMetricValue = this.calculateGridMetric(data);
|
|
267
|
+
}
|
|
268
|
+
return data;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
exports.PointsGridFormDataProvider = PointsGridFormDataProvider;
|
|
272
|
+
(0, _MaterialContextMixin.materialContextMixin)(PointsGridFormDataProvider.prototype);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PointsPathFormDataProvider = exports.ExplicitPointsPathFormDataProvider = exports.ExplicitPointsPath2PIBAFormDataProvider = void 0;
|
|
7
|
+
var _JSONSchemaFormDataProvider = _interopRequireDefault(require("@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider"));
|
|
8
|
+
var _math = require("@mat3ra/code/dist/js/math");
|
|
9
|
+
var _made = require("@mat3ra/made");
|
|
10
|
+
var _underscore = _interopRequireDefault(require("underscore.string"));
|
|
11
|
+
var _ApplicationContextMixin = require("../mixins/ApplicationContextMixin");
|
|
12
|
+
var _MaterialContextMixin = require("../mixins/MaterialContextMixin");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
/* eslint-disable max-classes-per-file */
|
|
15
|
+
/* eslint react/prop-types: 0 */
|
|
16
|
+
|
|
17
|
+
const defaultPoint = "Г";
|
|
18
|
+
const defaultSteps = 10;
|
|
19
|
+
class PointsPathFormDataProvider extends _JSONSchemaFormDataProvider.default {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
super(config);
|
|
22
|
+
this.initMaterialContextMixin();
|
|
23
|
+
this.initApplicationContextMixin();
|
|
24
|
+
this.reciprocalLattice = new _made.Made.ReciprocalLattice(this.material.lattice);
|
|
25
|
+
this.symmetryPoints = this.symmetryPointsFromMaterial;
|
|
26
|
+
}
|
|
27
|
+
get isEditedIsSetToFalseOnMaterialUpdate() {
|
|
28
|
+
return this.isMaterialUpdated || this.isMaterialCreatedDefault;
|
|
29
|
+
}
|
|
30
|
+
get defaultData() {
|
|
31
|
+
return this.reciprocalLattice.defaultKpointPath;
|
|
32
|
+
}
|
|
33
|
+
get symmetryPointsFromMaterial() {
|
|
34
|
+
return this.reciprocalLattice.symmetryPoints;
|
|
35
|
+
}
|
|
36
|
+
get jsonSchema() {
|
|
37
|
+
// no need to pass context to get symmetry points on client
|
|
38
|
+
const points = [].concat(this.symmetryPoints).map(x => x.point);
|
|
39
|
+
return {
|
|
40
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
41
|
+
title: " ",
|
|
42
|
+
description: "path in reciprocal space",
|
|
43
|
+
type: "array",
|
|
44
|
+
items: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
point: {
|
|
48
|
+
type: "string",
|
|
49
|
+
default: defaultPoint,
|
|
50
|
+
enum: points
|
|
51
|
+
},
|
|
52
|
+
steps: {
|
|
53
|
+
type: "integer",
|
|
54
|
+
default: defaultSteps
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
minItems: 1
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// eslint-disable-next-line class-methods-use-this
|
|
63
|
+
get uiSchema() {
|
|
64
|
+
return {
|
|
65
|
+
items: {}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
get uiSchemaStyled() {
|
|
69
|
+
return {
|
|
70
|
+
items: {
|
|
71
|
+
point: this.defaultFieldStyles,
|
|
72
|
+
steps: this.defaultFieldStyles
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// eslint-disable-next-line class-methods-use-this
|
|
78
|
+
get templates() {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
getBrillouinZoneImageComponent(title) {
|
|
82
|
+
const hasRequiredFn = typeof this.material.getBrillouinZoneImageComponent === "function";
|
|
83
|
+
if (!hasRequiredFn) {
|
|
84
|
+
console.log("PointsPathFormDataProvider: Material class has no function" + " 'getBrillouinZoneImageComponent'! Returning empty Object instead.");
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return this.material.getBrillouinZoneImageComponent(title);
|
|
88
|
+
}
|
|
89
|
+
get useExplicitPath() {
|
|
90
|
+
return this.application.name === "vasp";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// override yieldData to avoid storing explicit path in saved context
|
|
94
|
+
yieldDataForRendering() {
|
|
95
|
+
return this.yieldData(this.useExplicitPath);
|
|
96
|
+
}
|
|
97
|
+
transformData(path = [], useExplicitPath = false) {
|
|
98
|
+
const rawData = path.map(p => {
|
|
99
|
+
const point = this.symmetryPoints.find(sp => sp.point === p.point);
|
|
100
|
+
return {
|
|
101
|
+
...p,
|
|
102
|
+
coordinates: point.coordinates
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
const processedData = useExplicitPath ? this._convertToExplicitPath(rawData) : rawData;
|
|
106
|
+
// make coordinates into string and add formatting
|
|
107
|
+
return processedData.map(p => {
|
|
108
|
+
const coordinates = this.is2PIBA ? this.get2PIBACoordinates(p.coordinates) : p.coordinates;
|
|
109
|
+
p.coordinates = coordinates.map(c => _underscore.default.sprintf("%14.9f", c));
|
|
110
|
+
return p;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
get2PIBACoordinates(point) {
|
|
114
|
+
return this.reciprocalLattice.getCartesianCoordinates(point);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Initially, path contains symmetry points with steps counts.
|
|
118
|
+
// This function explicitly calculates each point between symmetry points by step counts.
|
|
119
|
+
// eslint-disable-next-line class-methods-use-this
|
|
120
|
+
_convertToExplicitPath(path) {
|
|
121
|
+
const points = [];
|
|
122
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
123
|
+
const startPoint = path[i];
|
|
124
|
+
const endPoint = path[i + 1];
|
|
125
|
+
const middlePoints = _math.math.calculateSegmentsBetweenPoints3D(startPoint.coordinates, endPoint.coordinates, startPoint.steps);
|
|
126
|
+
points.push(startPoint.coordinates);
|
|
127
|
+
points.push(...middlePoints);
|
|
128
|
+
// Include endPoint into path for the last section, otherwise it will be included by next loop iteration
|
|
129
|
+
if (path.length - 2 === i) points.push(endPoint.coordinates);
|
|
130
|
+
}
|
|
131
|
+
return points.map(x => {
|
|
132
|
+
return {
|
|
133
|
+
coordinates: x,
|
|
134
|
+
steps: 1
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.PointsPathFormDataProvider = PointsPathFormDataProvider;
|
|
140
|
+
class ExplicitPointsPathFormDataProvider extends PointsPathFormDataProvider {
|
|
141
|
+
// eslint-disable-next-line class-methods-use-this
|
|
142
|
+
get useExplicitPath() {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ExplicitPointsPathFormDataProvider = ExplicitPointsPathFormDataProvider;
|
|
147
|
+
class ExplicitPointsPath2PIBAFormDataProvider extends ExplicitPointsPathFormDataProvider {
|
|
148
|
+
// eslint-disable-next-line class-methods-use-this
|
|
149
|
+
get is2PIBA() {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.ExplicitPointsPath2PIBAFormDataProvider = ExplicitPointsPath2PIBAFormDataProvider;
|
|
154
|
+
(0, _MaterialContextMixin.materialContextMixin)(PointsPathFormDataProvider.prototype);
|
|
155
|
+
(0, _ApplicationContextMixin.applicationContextMixin)(PointsPathFormDataProvider.prototype);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ContextProvider = _interopRequireDefault(require("@exabyte-io/ade.js/dist/js/context/ContextProvider"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
class ExecutableContextProvider extends _ContextProvider.default {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({
|
|
12
|
+
...config,
|
|
13
|
+
domain: "executable"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = ExecutableContextProvider;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
+
var _JobContextMixin = require("../../../mixins/JobContextMixin");
|
|
9
|
+
var _MaterialContextMixin = require("../../../mixins/MaterialContextMixin");
|
|
10
|
+
var _MaterialsContextMixin = require("../../../mixins/MaterialsContextMixin");
|
|
11
|
+
var _MaterialsSetContextMixin = require("../../../mixins/MaterialsSetContextMixin");
|
|
12
|
+
var _MethodDataContextMixin = require("../../../mixins/MethodDataContextMixin");
|
|
13
|
+
var _WorkflowContextMixin = require("../../../mixins/WorkflowContextMixin");
|
|
14
|
+
var _ExecutableContextProvider = _interopRequireDefault(require("../ExecutableContextProvider"));
|
|
15
|
+
var _QEPWXContextProvider = _interopRequireDefault(require("./QEPWXContextProvider"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
class QENEBContextProvider extends _ExecutableContextProvider.default {
|
|
21
|
+
constructor(config) {
|
|
22
|
+
super(config);
|
|
23
|
+
_defineProperty(this, "_material", undefined);
|
|
24
|
+
_defineProperty(this, "_materials", []);
|
|
25
|
+
_defineProperty(this, "_materialsSet", undefined);
|
|
26
|
+
this.initJobContextMixin();
|
|
27
|
+
this.initMaterialsContextMixin();
|
|
28
|
+
this.initMethodDataContextMixin();
|
|
29
|
+
this.initWorkflowContextMixin();
|
|
30
|
+
this.initMaterialContextMixin();
|
|
31
|
+
this.initMaterialsSetContextMixin();
|
|
32
|
+
}
|
|
33
|
+
getData() {
|
|
34
|
+
const sortedMaterials = this.sortMaterialsByIndexInSet(this.materials);
|
|
35
|
+
const PWXContexts = sortedMaterials.map(material => {
|
|
36
|
+
const context = {
|
|
37
|
+
...this.config.context,
|
|
38
|
+
material
|
|
39
|
+
};
|
|
40
|
+
const config = {
|
|
41
|
+
...this.config,
|
|
42
|
+
context
|
|
43
|
+
};
|
|
44
|
+
return new _QEPWXContextProvider.default(config).getData();
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
..._lodash.default.omit(PWXContexts[0], ["ATOMIC_POSITIONS", "ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS"]),
|
|
48
|
+
FIRST_IMAGE: PWXContexts[0].ATOMIC_POSITIONS,
|
|
49
|
+
LAST_IMAGE: PWXContexts[PWXContexts.length - 1].ATOMIC_POSITIONS,
|
|
50
|
+
INTERMEDIATE_IMAGES: PWXContexts.slice(1, PWXContexts.length - 1).map(data => data.ATOMIC_POSITIONS)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = QENEBContextProvider;
|
|
55
|
+
(0, _MaterialContextMixin.materialContextMixin)(QENEBContextProvider.prototype);
|
|
56
|
+
(0, _MaterialsContextMixin.materialsContextMixin)(QENEBContextProvider.prototype);
|
|
57
|
+
(0, _MethodDataContextMixin.methodDataContextMixin)(QENEBContextProvider.prototype);
|
|
58
|
+
(0, _WorkflowContextMixin.workflowContextMixin)(QENEBContextProvider.prototype);
|
|
59
|
+
(0, _JobContextMixin.jobContextMixin)(QENEBContextProvider.prototype);
|
|
60
|
+
(0, _MaterialsSetContextMixin.materialsSetContextMixin)(QENEBContextProvider.prototype);
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _periodicTable = require("@exabyte-io/periodic-table.js");
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _underscore = _interopRequireDefault(require("underscore.string"));
|
|
10
|
+
var _JobContextMixin = require("../../../mixins/JobContextMixin");
|
|
11
|
+
var _MaterialContextMixin = require("../../../mixins/MaterialContextMixin");
|
|
12
|
+
var _MaterialsContextMixin = require("../../../mixins/MaterialsContextMixin");
|
|
13
|
+
var _MethodDataContextMixin = require("../../../mixins/MethodDataContextMixin");
|
|
14
|
+
var _WorkflowContextMixin = require("../../../mixins/WorkflowContextMixin");
|
|
15
|
+
var _ExecutableContextProvider = _interopRequireDefault(require("../ExecutableContextProvider"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
class QEPWXContextProvider extends _ExecutableContextProvider.default {
|
|
21
|
+
constructor(config) {
|
|
22
|
+
super(config);
|
|
23
|
+
_defineProperty(this, "_material", undefined);
|
|
24
|
+
_defineProperty(this, "_materials", []);
|
|
25
|
+
this.initMaterialsContextMixin();
|
|
26
|
+
this.initMethodDataContextMixin();
|
|
27
|
+
this.initWorkflowContextMixin();
|
|
28
|
+
this.initJobContextMixin();
|
|
29
|
+
this.initMaterialContextMixin();
|
|
30
|
+
}
|
|
31
|
+
static atomSymbols(material) {
|
|
32
|
+
return material.Basis.uniqueElements;
|
|
33
|
+
}
|
|
34
|
+
static uniqueElementsWithLabels(material) {
|
|
35
|
+
// return unique items
|
|
36
|
+
return [...new Set(material.Basis.elementsWithLabelsArray)];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Returns the input text block for atomic positions WITH constraints.
|
|
40
|
+
*/
|
|
41
|
+
static atomicPositionsWithConstraints(material) {
|
|
42
|
+
return material.Basis.getAtomicPositionsWithConstraintsAsStrings().join("\n");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Returns the input text block for atomic positions
|
|
46
|
+
* Note: does NOT include constraints
|
|
47
|
+
*/
|
|
48
|
+
static atomicPositions(material) {
|
|
49
|
+
return material.Basis.atomicPositions.join("\n");
|
|
50
|
+
}
|
|
51
|
+
static NAT(material) {
|
|
52
|
+
return material.Basis.atomicPositions.length;
|
|
53
|
+
}
|
|
54
|
+
static NTYP(material) {
|
|
55
|
+
return material.Basis.uniqueElements.length;
|
|
56
|
+
}
|
|
57
|
+
static NTYP_WITH_LABELS(material) {
|
|
58
|
+
return this.uniqueElementsWithLabels(material).length;
|
|
59
|
+
}
|
|
60
|
+
buildQEPWXContext(material) {
|
|
61
|
+
const IBRAV = 0; // use CELL_PARAMETERS to define Bravais lattice
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
IBRAV,
|
|
65
|
+
RESTART_MODE: this.RESTART_MODE,
|
|
66
|
+
ATOMIC_SPECIES: this.ATOMIC_SPECIES(material),
|
|
67
|
+
ATOMIC_SPECIES_WITH_LABELS: this.ATOMIC_SPECIES_WITH_LABELS(material),
|
|
68
|
+
NAT: QEPWXContextProvider.NAT(material),
|
|
69
|
+
NTYP: QEPWXContextProvider.NTYP(material),
|
|
70
|
+
NTYP_WITH_LABELS: QEPWXContextProvider.NTYP_WITH_LABELS(material),
|
|
71
|
+
ATOMIC_POSITIONS: QEPWXContextProvider.atomicPositionsWithConstraints(material),
|
|
72
|
+
ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS: QEPWXContextProvider.atomicPositions(material),
|
|
73
|
+
CELL_PARAMETERS: QEPWXContextProvider.CELL_PARAMETERS(material)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
getDataPerMaterial() {
|
|
77
|
+
if (!this.materials || this.materials.length <= 1) return {};
|
|
78
|
+
return {
|
|
79
|
+
perMaterial: this.materials.map(material => this.buildQEPWXContext(material))
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* @NOTE: Overriding getData makes this provider "stateless", ie. delivering data from scratch each time and not
|
|
85
|
+
* considering the content of `this.data`, and `this.isEdited` field(s).
|
|
86
|
+
*/
|
|
87
|
+
getData() {
|
|
88
|
+
// the below values are read from PlanewaveDataManager instead
|
|
89
|
+
// ECUTWFC = 40;
|
|
90
|
+
// ECUTRHO = 200;
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
...this.buildQEPWXContext(this.material),
|
|
94
|
+
...this.getDataPerMaterial()
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
get RESTART_MODE() {
|
|
98
|
+
return this.job.parentJob || this.workflow.hasRelaxation ? "restart" : "from_scratch";
|
|
99
|
+
}
|
|
100
|
+
getPseudoBySymbol(symbol) {
|
|
101
|
+
return (this.methodData.pseudo || []).find(p => p.element === symbol);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Builds ATOMIC SPECIES block of pw.x input in the format
|
|
105
|
+
* X Mass_X PseudoPot_X
|
|
106
|
+
* where X is the atom label
|
|
107
|
+
* Mass_X is the mass of element X [amu]
|
|
108
|
+
* PseudoPot_X is the pseudopotential filename associated with element X
|
|
109
|
+
*
|
|
110
|
+
* Note: assumes this.methodData is defined
|
|
111
|
+
*/
|
|
112
|
+
ATOMIC_SPECIES(material) {
|
|
113
|
+
return QEPWXContextProvider.atomSymbols(material).map(symbol => {
|
|
114
|
+
const pseudo = this.getPseudoBySymbol(symbol);
|
|
115
|
+
return QEPWXContextProvider.symbolToAtomicSpecie(symbol, pseudo);
|
|
116
|
+
}).join("\n");
|
|
117
|
+
}
|
|
118
|
+
ATOMIC_SPECIES_WITH_LABELS(material) {
|
|
119
|
+
return QEPWXContextProvider.uniqueElementsWithLabels(material).map(symbol => {
|
|
120
|
+
const symbolWithoutLabel = symbol.replace(/\d$/, "");
|
|
121
|
+
const label = symbol.match(/\d$/g) ? symbol.match(/\d$/g)?.[0] : "";
|
|
122
|
+
const pseudo = this.getPseudoBySymbol(symbolWithoutLabel);
|
|
123
|
+
return QEPWXContextProvider.elementAndPseudoToAtomicSpecieWithLabels(symbolWithoutLabel, pseudo, label);
|
|
124
|
+
}).join("\n");
|
|
125
|
+
}
|
|
126
|
+
static CELL_PARAMETERS(material) {
|
|
127
|
+
return material.Lattice.vectorArrays.map(x => {
|
|
128
|
+
return x.map(y => {
|
|
129
|
+
return _underscore.default.sprintf("%14.9f", y).trim();
|
|
130
|
+
}).join(" ");
|
|
131
|
+
}).join("\n");
|
|
132
|
+
}
|
|
133
|
+
static symbolToAtomicSpecie(symbol, pseudo) {
|
|
134
|
+
const el = _periodicTable.PERIODIC_TABLE[symbol];
|
|
135
|
+
const filename = pseudo?.filename || _path.default.basename(pseudo?.path || "");
|
|
136
|
+
return _underscore.default.sprintf("%s %f %s", symbol, el.atomic_mass, filename) || "";
|
|
137
|
+
}
|
|
138
|
+
static elementAndPseudoToAtomicSpecieWithLabels(symbol, pseudo, label = "") {
|
|
139
|
+
const el = _periodicTable.PERIODIC_TABLE[symbol];
|
|
140
|
+
const filename = pseudo?.filename || _path.default.basename(pseudo?.path || "");
|
|
141
|
+
return _underscore.default.sprintf("%s%s %f %s", symbol, label, el.atomic_mass, filename) || "";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.default = QEPWXContextProvider;
|
|
145
|
+
(0, _MaterialContextMixin.materialContextMixin)(QEPWXContextProvider.prototype);
|
|
146
|
+
(0, _MaterialsContextMixin.materialsContextMixin)(QEPWXContextProvider.prototype);
|
|
147
|
+
(0, _MethodDataContextMixin.methodDataContextMixin)(QEPWXContextProvider.prototype);
|
|
148
|
+
(0, _WorkflowContextMixin.workflowContextMixin)(QEPWXContextProvider.prototype);
|
|
149
|
+
(0, _JobContextMixin.jobContextMixin)(QEPWXContextProvider.prototype);
|