@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.
Files changed (252) hide show
  1. package/.babelrc +17 -0
  2. package/LICENSE.md +15 -0
  3. package/README.md +164 -0
  4. package/assets/subworkflows/deepmd/deepmd.yml +31 -0
  5. package/assets/subworkflows/deepmd/espresso_cp_md.yml +16 -0
  6. package/assets/subworkflows/espresso/average_electrostatic_potential_find_minima.yml +27 -0
  7. package/assets/subworkflows/espresso/average_electrostatic_potential_via_band_structure.yml +67 -0
  8. package/assets/subworkflows/espresso/band_gap.yml +21 -0
  9. package/assets/subworkflows/espresso/band_gap_hse_dos.yml +30 -0
  10. package/assets/subworkflows/espresso/band_structure.yml +26 -0
  11. package/assets/subworkflows/espresso/band_structure_dos.yml +34 -0
  12. package/assets/subworkflows/espresso/band_structure_hse.yml +30 -0
  13. package/assets/subworkflows/espresso/band_structure_magn.yml +31 -0
  14. package/assets/subworkflows/espresso/band_structure_soc.yml +30 -0
  15. package/assets/subworkflows/espresso/dielectric_tensor.yml +35 -0
  16. package/assets/subworkflows/espresso/dos.yml +24 -0
  17. package/assets/subworkflows/espresso/electronic_density_mesh.yml +19 -0
  18. package/assets/subworkflows/espresso/esm.yml +14 -0
  19. package/assets/subworkflows/espresso/esm_relax.yml +14 -0
  20. package/assets/subworkflows/espresso/espresso_extract_kpoints.yml +16 -0
  21. package/assets/subworkflows/espresso/espresso_xml_get_qpt_irr.yml +12 -0
  22. package/assets/subworkflows/espresso/fixed_cell_relaxation.yml +16 -0
  23. package/assets/subworkflows/espresso/gw_band_structure_band_gap_full_frequency.yml +22 -0
  24. package/assets/subworkflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +22 -0
  25. package/assets/subworkflows/espresso/hubbard_u_hp.yml +21 -0
  26. package/assets/subworkflows/espresso/kpoint_convergence.yml +86 -0
  27. package/assets/subworkflows/espresso/neb.yml +16 -0
  28. package/assets/subworkflows/espresso/ph_init_qpoints.yml +14 -0
  29. package/assets/subworkflows/espresso/ph_single_irr_qpt.yml +14 -0
  30. package/assets/subworkflows/espresso/phonon_dispersions.yml +29 -0
  31. package/assets/subworkflows/espresso/phonon_dos.yml +29 -0
  32. package/assets/subworkflows/espresso/phonon_dos_dispersion.yml +34 -0
  33. package/assets/subworkflows/espresso/phonon_reduce.yml +29 -0
  34. package/assets/subworkflows/espresso/post_processor.yml +14 -0
  35. package/assets/subworkflows/espresso/pre_processor.yml +14 -0
  36. package/assets/subworkflows/espresso/pw_scf.yml +16 -0
  37. package/assets/subworkflows/espresso/recalculate_bands.yml +19 -0
  38. package/assets/subworkflows/espresso/surface_energy.yml +16 -0
  39. package/assets/subworkflows/espresso/total_energy.yml +16 -0
  40. package/assets/subworkflows/espresso/valence_band_offset_calc_from_previous_esp_vbm.yml +35 -0
  41. package/assets/subworkflows/espresso/variable_cell_relaxation.yml +18 -0
  42. package/assets/subworkflows/espresso/zero_point_energy.yml +19 -0
  43. package/assets/subworkflows/jupyterLab/jupyter_notebook.yml +17 -0
  44. package/assets/subworkflows/nwchem/total_energy.yml +16 -0
  45. package/assets/subworkflows/python/ml/classification_tail.yml +56 -0
  46. package/assets/subworkflows/python/ml/clustering_tail.yml +62 -0
  47. package/assets/subworkflows/python/ml/regression_tail.yml +56 -0
  48. package/assets/subworkflows/python/ml/train_head.yml +61 -0
  49. package/assets/subworkflows/python/python_script.yml +14 -0
  50. package/assets/subworkflows/shell/batch_espresso_pwscf.yml +14 -0
  51. package/assets/subworkflows/shell/hello_world.yml +14 -0
  52. package/assets/subworkflows/vasp/band_gap.yml +21 -0
  53. package/assets/subworkflows/vasp/band_structure.yml +21 -0
  54. package/assets/subworkflows/vasp/band_structure_dos.yml +23 -0
  55. package/assets/subworkflows/vasp/dos.yml +18 -0
  56. package/assets/subworkflows/vasp/fixed_cell_relaxation.yml +16 -0
  57. package/assets/subworkflows/vasp/initial_final_total_energies.yml +25 -0
  58. package/assets/subworkflows/vasp/kpoint_convergence.yml +89 -0
  59. package/assets/subworkflows/vasp/neb_subworkflow.yml +16 -0
  60. package/assets/subworkflows/vasp/prepare_images.yml +16 -0
  61. package/assets/subworkflows/vasp/recalculate_bands.yml +16 -0
  62. package/assets/subworkflows/vasp/surface_energy.yml +18 -0
  63. package/assets/subworkflows/vasp/total_energy.yml +16 -0
  64. package/assets/subworkflows/vasp/variable_cell_relaxation.yml +18 -0
  65. package/assets/subworkflows/vasp/zero_point_energy.yml +16 -0
  66. package/assets/workflows/deepmd/deepmd_md.yml +6 -0
  67. package/assets/workflows/espresso/band_gap.yml +4 -0
  68. package/assets/workflows/espresso/band_gap_dos_hse.yml +4 -0
  69. package/assets/workflows/espresso/band_structure.yml +4 -0
  70. package/assets/workflows/espresso/band_structure_dos.yml +4 -0
  71. package/assets/workflows/espresso/band_structure_hse.yml +14 -0
  72. package/assets/workflows/espresso/band_structure_magn.yml +7 -0
  73. package/assets/workflows/espresso/band_structure_soc.yml +7 -0
  74. package/assets/workflows/espresso/dielectric_tensor.yml +4 -0
  75. package/assets/workflows/espresso/dos.yml +4 -0
  76. package/assets/workflows/espresso/electronic_density_mesh.yml +4 -0
  77. package/assets/workflows/espresso/esm.yml +4 -0
  78. package/assets/workflows/espresso/esm_relax.yml +4 -0
  79. package/assets/workflows/espresso/fixed_cell_relaxation.yml +4 -0
  80. package/assets/workflows/espresso/gw_band_structure_band_gap_full_frequency.yml +4 -0
  81. package/assets/workflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +4 -0
  82. package/assets/workflows/espresso/hubbard_u_hp.yml +7 -0
  83. package/assets/workflows/espresso/kpoint_convergence.yml +4 -0
  84. package/assets/workflows/espresso/neb.yml +4 -0
  85. package/assets/workflows/espresso/phonon_dispersions.yml +4 -0
  86. package/assets/workflows/espresso/phonon_dos.yml +4 -0
  87. package/assets/workflows/espresso/phonon_dos_dispersion.yml +4 -0
  88. package/assets/workflows/espresso/phonon_map.yml +28 -0
  89. package/assets/workflows/espresso/recalculate_bands.yml +4 -0
  90. package/assets/workflows/espresso/surface_energy.yml +4 -0
  91. package/assets/workflows/espresso/total_energy.yml +4 -0
  92. package/assets/workflows/espresso/valence_band_offset.yml +171 -0
  93. package/assets/workflows/espresso/variable_cell_relaxation.yml +4 -0
  94. package/assets/workflows/espresso/zero_point_energy.yml +4 -0
  95. package/assets/workflows/jupyterLab/jupyter_notebook.yml +4 -0
  96. package/assets/workflows/nwchem/total_energy.yml +4 -0
  97. package/assets/workflows/python/ml/classification_workflow.yml +9 -0
  98. package/assets/workflows/python/ml/clustering_workflow.yml +9 -0
  99. package/assets/workflows/python/ml/regression_workflow.yml +9 -0
  100. package/assets/workflows/python/python_script.yml +4 -0
  101. package/assets/workflows/shell/batch_espresso_pwscf.yml +4 -0
  102. package/assets/workflows/shell/hello_world.yml +4 -0
  103. package/assets/workflows/vasp/band_gap.yml +4 -0
  104. package/assets/workflows/vasp/band_structure.yml +4 -0
  105. package/assets/workflows/vasp/band_structure_dos.yml +4 -0
  106. package/assets/workflows/vasp/dos.yml +4 -0
  107. package/assets/workflows/vasp/fixed_cell_relaxation.yml +4 -0
  108. package/assets/workflows/vasp/kpoint_convergence.yml +4 -0
  109. package/assets/workflows/vasp/neb.yml +8 -0
  110. package/assets/workflows/vasp/recalculate_bands.yml +4 -0
  111. package/assets/workflows/vasp/surface_energy.yml +4 -0
  112. package/assets/workflows/vasp/total_energy.yml +4 -0
  113. package/assets/workflows/vasp/variable_cell_relaxation.yml +4 -0
  114. package/assets/workflows/vasp/zero_point_energy.yml +4 -0
  115. package/build_workflows.js +65 -0
  116. package/dist/context/context.js +49 -0
  117. package/dist/context/mixins/ApplicationContextMixin.js +19 -0
  118. package/dist/context/mixins/JobContextMixin.js +39 -0
  119. package/dist/context/mixins/MaterialContextMixin.js +40 -0
  120. package/dist/context/mixins/MaterialsContextMixin.js +19 -0
  121. package/dist/context/mixins/MaterialsSetContextMixin.js +25 -0
  122. package/dist/context/mixins/MethodDataContextMixin.js +48 -0
  123. package/dist/context/mixins/WorkflowContextMixin.js +28 -0
  124. package/dist/context/providers/BoundaryConditionsFormDataProvider.js +86 -0
  125. package/dist/context/providers/CollinearMagnetizationContextProvider.js +113 -0
  126. package/dist/context/providers/HubbardContextProviderLegacy.js +81 -0
  127. package/dist/context/providers/HubbardJContextProvider.js +74 -0
  128. package/dist/context/providers/HubbardUContextProvider.js +77 -0
  129. package/dist/context/providers/HubbardVContextProvider.js +104 -0
  130. package/dist/context/providers/IonDynamicsContextProvider.js +62 -0
  131. package/dist/context/providers/MLSettingsContextProvider.js +52 -0
  132. package/dist/context/providers/MLTrainTestSplitContextProvider.js +48 -0
  133. package/dist/context/providers/NEBFormDataProvider.js +38 -0
  134. package/dist/context/providers/NonCollinearMagnetizationContextProvider.js +253 -0
  135. package/dist/context/providers/PlanewaveCutoffsContextProvider.js +67 -0
  136. package/dist/context/providers/PointsGridFormDataProvider.js +272 -0
  137. package/dist/context/providers/PointsPathFormDataProvider.js +155 -0
  138. package/dist/context/providers/by_application/ExecutableContextProvider.js +17 -0
  139. package/dist/context/providers/by_application/espresso/QENEBContextProvider.js +60 -0
  140. package/dist/context/providers/by_application/espresso/QEPWXContextProvider.js +149 -0
  141. package/dist/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +84 -0
  142. package/dist/context/providers/by_application/vasp/VASPContextProvider.js +64 -0
  143. package/dist/context/providers/by_application/vasp/VASPNEBContextProvider.js +56 -0
  144. package/dist/context/providers/settings.js +37 -0
  145. package/dist/context/providers.js +199 -0
  146. package/dist/enums.js +65 -0
  147. package/dist/index.js +64 -0
  148. package/dist/patch.js +19 -0
  149. package/dist/subworkflows/convergence/factory.js +35 -0
  150. package/dist/subworkflows/convergence/non_uniform_kgrid.js +31 -0
  151. package/dist/subworkflows/convergence/parameter.js +70 -0
  152. package/dist/subworkflows/convergence/uniform_kgrid.js +26 -0
  153. package/dist/subworkflows/convergence.js +189 -0
  154. package/dist/subworkflows/create.js +285 -0
  155. package/dist/subworkflows/dynamic/espresso/getQpointIrrep.js +34 -0
  156. package/dist/subworkflows/dynamic/index.js +19 -0
  157. package/dist/subworkflows/dynamic/surfaceEnergy.js +67 -0
  158. package/dist/subworkflows/index.js +19 -0
  159. package/dist/subworkflows/subworkflow.js +279 -0
  160. package/dist/units/assertion.js +37 -0
  161. package/dist/units/assignment.js +42 -0
  162. package/dist/units/base.js +91 -0
  163. package/dist/units/builders/AssertionUnitConfigBuilder.js +34 -0
  164. package/dist/units/builders/AssignmentUnitConfigBuilder.js +41 -0
  165. package/dist/units/builders/ExecutionUnitConfigBuilder.js +67 -0
  166. package/dist/units/builders/IOUnitConfigBuilder.js +54 -0
  167. package/dist/units/builders/UnitConfigBuilder.js +79 -0
  168. package/dist/units/builders/index.js +18 -0
  169. package/dist/units/condition.js +52 -0
  170. package/dist/units/execution.js +222 -0
  171. package/dist/units/factory.js +53 -0
  172. package/dist/units/index.js +82 -0
  173. package/dist/units/io.js +148 -0
  174. package/dist/units/map.js +38 -0
  175. package/dist/units/processing.js +41 -0
  176. package/dist/units/reduce.js +24 -0
  177. package/dist/units/subworkflow.js +23 -0
  178. package/dist/utils.js +92 -0
  179. package/dist/workflows/create.js +312 -0
  180. package/dist/workflows/default.js +41 -0
  181. package/dist/workflows/index.js +108 -0
  182. package/dist/workflows/relaxation.js +37 -0
  183. package/dist/workflows/workflow.js +303 -0
  184. package/package.json +94 -0
  185. package/src/context/context.js +47 -0
  186. package/src/context/mixins/ApplicationContextMixin.js +19 -0
  187. package/src/context/mixins/JobContextMixin.js +36 -0
  188. package/src/context/mixins/MaterialContextMixin.js +41 -0
  189. package/src/context/mixins/MaterialsContextMixin.js +18 -0
  190. package/src/context/mixins/MaterialsSetContextMixin.js +24 -0
  191. package/src/context/mixins/MethodDataContextMixin.js +48 -0
  192. package/src/context/mixins/WorkflowContextMixin.js +25 -0
  193. package/src/context/providers/BoundaryConditionsFormDataProvider.js +80 -0
  194. package/src/context/providers/CollinearMagnetizationContextProvider.js +117 -0
  195. package/src/context/providers/HubbardContextProviderLegacy.js +75 -0
  196. package/src/context/providers/HubbardJContextProvider.js +73 -0
  197. package/src/context/providers/HubbardUContextProvider.js +100 -0
  198. package/src/context/providers/HubbardVContextProvider.js +111 -0
  199. package/src/context/providers/IonDynamicsContextProvider.js +56 -0
  200. package/src/context/providers/MLSettingsContextProvider.js +48 -0
  201. package/src/context/providers/MLTrainTestSplitContextProvider.js +45 -0
  202. package/src/context/providers/NEBFormDataProvider.js +32 -0
  203. package/src/context/providers/NonCollinearMagnetizationContextProvider.js +269 -0
  204. package/src/context/providers/PlanewaveCutoffsContextProvider.js +68 -0
  205. package/src/context/providers/PointsGridFormDataProvider.js +285 -0
  206. package/src/context/providers/PointsPathFormDataProvider.js +165 -0
  207. package/src/context/providers/by_application/ExecutableContextProvider.js +10 -0
  208. package/src/context/providers/by_application/espresso/QENEBContextProvider.js +56 -0
  209. package/src/context/providers/by_application/espresso/QEPWXContextProvider.js +166 -0
  210. package/src/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +86 -0
  211. package/src/context/providers/by_application/vasp/VASPContextProvider.js +56 -0
  212. package/src/context/providers/by_application/vasp/VASPNEBContextProvider.js +46 -0
  213. package/src/context/providers/settings.js +38 -0
  214. package/src/context/providers.js +140 -0
  215. package/src/enums.js +65 -0
  216. package/src/index.js +17 -0
  217. package/src/patch.js +12 -0
  218. package/src/subworkflows/convergence/factory.js +14 -0
  219. package/src/subworkflows/convergence/non_uniform_kgrid.js +28 -0
  220. package/src/subworkflows/convergence/parameter.js +58 -0
  221. package/src/subworkflows/convergence/uniform_kgrid.js +22 -0
  222. package/src/subworkflows/convergence.js +196 -0
  223. package/src/subworkflows/create.js +201 -0
  224. package/src/subworkflows/dynamic/espresso/getQpointIrrep.js +35 -0
  225. package/src/subworkflows/dynamic/index.js +8 -0
  226. package/src/subworkflows/dynamic/surfaceEnergy.js +124 -0
  227. package/src/subworkflows/index.js +2 -0
  228. package/src/subworkflows/subworkflow.js +329 -0
  229. package/src/units/assertion.js +29 -0
  230. package/src/units/assignment.js +34 -0
  231. package/src/units/base.js +97 -0
  232. package/src/units/builders/AssertionUnitConfigBuilder.js +28 -0
  233. package/src/units/builders/AssignmentUnitConfigBuilder.js +36 -0
  234. package/src/units/builders/ExecutionUnitConfigBuilder.js +59 -0
  235. package/src/units/builders/IOUnitConfigBuilder.js +53 -0
  236. package/src/units/builders/UnitConfigBuilder.js +86 -0
  237. package/src/units/builders/index.js +15 -0
  238. package/src/units/condition.js +47 -0
  239. package/src/units/execution.js +263 -0
  240. package/src/units/factory.js +53 -0
  241. package/src/units/index.js +25 -0
  242. package/src/units/io.js +163 -0
  243. package/src/units/map.js +33 -0
  244. package/src/units/processing.js +39 -0
  245. package/src/units/reduce.js +17 -0
  246. package/src/units/subworkflow.js +15 -0
  247. package/src/utils.js +73 -0
  248. package/src/workflows/create.js +222 -0
  249. package/src/workflows/default.js +39 -0
  250. package/src/workflows/index.js +99 -0
  251. package/src/workflows/relaxation.js +41 -0
  252. package/src/workflows/workflow.js +351 -0
@@ -0,0 +1,45 @@
1
+ import ContextProvider from "@exabyte-io/ade.js/dist/js/context/ContextProvider";
2
+
3
+ import { applicationContextMixin } from "../mixins/ApplicationContextMixin";
4
+
5
+ export class MLTrainTestSplitContextProvider extends ContextProvider {
6
+ constructor(config) {
7
+ super(config);
8
+ this.initApplicationContextMixin();
9
+ }
10
+
11
+ // eslint-disable-next-line class-methods-use-this
12
+ get uiSchema() {
13
+ return {
14
+ target_column_name: {},
15
+ problem_category: {},
16
+ };
17
+ }
18
+
19
+ // eslint-disable-next-line class-methods-use-this
20
+ get defaultData() {
21
+ return {
22
+ fraction_held_as_test_set: 0.2,
23
+ };
24
+ }
25
+
26
+ get jsonSchema() {
27
+ return {
28
+ $schema: "http://json-schema.org/draft-07/schema#",
29
+ title: " ",
30
+ description:
31
+ "Fraction held as the test set. For example, a value of 0.2 corresponds to an 80/20 train/test split.",
32
+ type: "object",
33
+ properties: {
34
+ fraction_held_as_test_set: {
35
+ type: "number",
36
+ default: this.defaultData.fraction_held_as_test_set,
37
+ minimum: 0,
38
+ maximum: 1,
39
+ },
40
+ },
41
+ };
42
+ }
43
+ }
44
+
45
+ applicationContextMixin(MLTrainTestSplitContextProvider.prototype);
@@ -0,0 +1,32 @@
1
+ import JSONSchemaFormDataProvider from "@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider";
2
+
3
+ export class NEBFormDataProvider extends JSONSchemaFormDataProvider {
4
+ // eslint-disable-next-line class-methods-use-this
5
+ get defaultData() {
6
+ return {
7
+ nImages: 1,
8
+ };
9
+ }
10
+
11
+ // eslint-disable-next-line class-methods-use-this
12
+ get uiSchema() {
13
+ return {
14
+ nImages: {},
15
+ };
16
+ }
17
+
18
+ get jsonSchema() {
19
+ return {
20
+ $schema: "http://json-schema.org/draft-07/schema#",
21
+ title: " ",
22
+ description: "Number of intermediate NEB images.",
23
+ type: "object",
24
+ properties: {
25
+ nImages: {
26
+ type: "number",
27
+ default: this.defaultData.nImages,
28
+ },
29
+ },
30
+ };
31
+ }
32
+ }
@@ -0,0 +1,269 @@
1
+ import JSONSchemaFormDataProvider from "@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider";
2
+ import lodash from "lodash";
3
+
4
+ import { materialContextMixin } from "../mixins/MaterialContextMixin";
5
+
6
+ export class NonCollinearMagnetizationContextProvider extends JSONSchemaFormDataProvider {
7
+ constructor(config) {
8
+ super(config);
9
+ this.initMaterialContextMixin();
10
+ this.isStartingMagnetization = lodash.get(this.data, "isStartingMagnetization", true);
11
+ this.isConstrainedMagnetization = lodash.get(
12
+ this.data,
13
+ "isConstrainedMagnetization",
14
+ false,
15
+ );
16
+ this.isExistingChargeDensity = lodash.get(this.data, "isExistingChargeDensity", false);
17
+ this.isArbitrarySpinDirection = lodash.get(this.data, "isArbitrarySpinDirection", false);
18
+ this.isFixedMagnetization = lodash.get(this.data, "isFixedMagnetization", false);
19
+ this.constrainedMagnetization = lodash.get(this.data, "constrainedMagnetization", {});
20
+ }
21
+
22
+ get uniqueElementsWithLabels() {
23
+ const elementsWithLabelsArray = this.material?.Basis?.elementsWithLabelsArray || [];
24
+ return [...new Set(elementsWithLabelsArray)];
25
+ }
26
+
27
+ get defaultData() {
28
+ const startingMagnetization = this.uniqueElementsWithLabels.map((element, index) => {
29
+ return {
30
+ index: index + 1,
31
+ atomicSpecies: element,
32
+ value: 0.0,
33
+ };
34
+ });
35
+
36
+ const spinAngles = this.uniqueElementsWithLabels.map((element, index) => {
37
+ return {
38
+ index: index + 1,
39
+ atomicSpecies: element,
40
+ angle1: 0.0,
41
+ angle2: 0.0,
42
+ };
43
+ });
44
+
45
+ return {
46
+ isExistingChargeDensity: false,
47
+ isStartingMagnetization: true,
48
+ isConstrainedMagnetization: false,
49
+ isArbitrarySpinAngle: false,
50
+ isFixedMagnetization: false,
51
+ lforcet: true,
52
+ spinAngles,
53
+ startingMagnetization,
54
+ constrainedMagnetization: {
55
+ lambda: 0.0,
56
+ constrainType: "atomic direction",
57
+ },
58
+ fixedMagnetization: {
59
+ x: 0.0,
60
+ y: 0.0,
61
+ z: 0.0,
62
+ },
63
+ };
64
+ }
65
+
66
+ get uiSchemaStyled() {
67
+ return {
68
+ isExistingChargeDensity: {},
69
+ lforcet: {
70
+ "ui:readonly": !this.isExistingChargeDensity,
71
+ "ui:widget": "radio",
72
+ "ui:options": {
73
+ inline: true,
74
+ },
75
+ },
76
+ isArbitrarySpinDirection: {},
77
+ spinAngles: {
78
+ items: {
79
+ atomicSpecies: {
80
+ ...this.defaultFieldStyles,
81
+ "ui:readonly": true,
82
+ },
83
+ angle1: this.defaultFieldStyles,
84
+ angle2: this.defaultFieldStyles,
85
+ },
86
+ "ui:readonly": !this.isArbitrarySpinDirection,
87
+ "ui:options": {
88
+ addable: false,
89
+ orderable: false,
90
+ removable: false,
91
+ },
92
+ },
93
+ isStartingMagnetization: {},
94
+ startingMagnetization: {
95
+ items: {
96
+ atomicSpecies: {
97
+ ...this.defaultFieldStyles,
98
+ "ui:readonly": true,
99
+ },
100
+ value: {
101
+ "ui:classNames": "col-xs-6",
102
+ },
103
+ },
104
+ "ui:readonly": !this.isStartingMagnetization,
105
+ "ui:options": {
106
+ addable: false,
107
+ orderable: false,
108
+ removable: false,
109
+ },
110
+ },
111
+ isConstrainedMagnetization: {},
112
+ constrainedMagnetization: {
113
+ constrainType: this.defaultFieldStyles,
114
+ lambda: this.defaultFieldStyles,
115
+ "ui:readonly": !this.isConstrainedMagnetization,
116
+ },
117
+ isFixedMagnetization: {
118
+ "ui:readonly": !(
119
+ this.isConstrainedMagnetization &&
120
+ this.constrainedMagnetization?.constrainType === "total"
121
+ ),
122
+ },
123
+ fixedMagnetization: {
124
+ x: this.defaultFieldStyles,
125
+ y: this.defaultFieldStyles,
126
+ z: this.defaultFieldStyles,
127
+ "ui:readonly": !(
128
+ this.isFixedMagnetization &&
129
+ this.isConstrainedMagnetization &&
130
+ this.constrainedMagnetization?.constrainType === "total"
131
+ ),
132
+ },
133
+ };
134
+ }
135
+
136
+ get jsonSchema() {
137
+ return {
138
+ $schema: "http://json-schema.org/draft-07/schema#",
139
+ title: "",
140
+ description:
141
+ "Set initial parameters for non-collinear spin magnetic (SOC) calculation.",
142
+ type: "object",
143
+ properties: {
144
+ isStartingMagnetization: {
145
+ type: "boolean",
146
+ title: "Set starting magnetization",
147
+ default: true,
148
+ },
149
+ startingMagnetization: {
150
+ type: "array",
151
+ minItems: this.uniqueElementsWithLabels.length,
152
+ maxItems: this.uniqueElementsWithLabels.length,
153
+ items: {
154
+ type: "object",
155
+ properties: {
156
+ atomicSpecies: {
157
+ type: "string",
158
+ title: "Atomic species",
159
+ },
160
+ value: {
161
+ type: "number",
162
+ title: "Starting magnetization",
163
+ default: 0.0,
164
+ minimum: -1.0,
165
+ maximum: 1.0,
166
+ },
167
+ },
168
+ },
169
+ },
170
+ isExistingChargeDensity: {
171
+ type: "boolean",
172
+ title: "Start calculation from existing charge density",
173
+ default: false,
174
+ },
175
+ lforcet: {
176
+ title: "Set lforcet to",
177
+ type: "boolean",
178
+ oneOf: [
179
+ { const: true, title: "True" },
180
+ { const: false, title: "False" },
181
+ ],
182
+ },
183
+ isArbitrarySpinDirection: {
184
+ type: "boolean",
185
+ title: "Set spin directions",
186
+ default: false,
187
+ },
188
+ spinAngles: {
189
+ type: "array",
190
+ minItems: this.uniqueElementsWithLabels.length,
191
+ maxItems: this.uniqueElementsWithLabels.length,
192
+ items: {
193
+ type: "object",
194
+ properties: {
195
+ atomicSpecies: {
196
+ type: "string",
197
+ title: "Atomic species",
198
+ },
199
+ angle1: {
200
+ type: "number",
201
+ title: "Angle1 (deg)",
202
+ default: 0.0,
203
+ },
204
+ angle2: {
205
+ type: "number",
206
+ title: "Angle2 (deg)",
207
+ default: 0.0,
208
+ },
209
+ },
210
+ },
211
+ },
212
+ isConstrainedMagnetization: {
213
+ type: "boolean",
214
+ title: "Set constrained magnetization",
215
+ default: false,
216
+ },
217
+ constrainedMagnetization: {
218
+ type: "object",
219
+ properties: {
220
+ constrainType: {
221
+ type: "string",
222
+ title: "Constrain type",
223
+ enum: [
224
+ "none",
225
+ "total",
226
+ "atomic",
227
+ "total direction",
228
+ "atomic direction",
229
+ ],
230
+ default: "atomic direction",
231
+ },
232
+ lambda: {
233
+ type: "number",
234
+ title: "lambda",
235
+ default: 0.0,
236
+ },
237
+ },
238
+ },
239
+ isFixedMagnetization: {
240
+ type: "boolean",
241
+ title: "Set Fixed magnetization (only applicable to constrained magnetization of 'total' type)",
242
+ default: true,
243
+ },
244
+ fixedMagnetization: {
245
+ type: "object",
246
+ properties: {
247
+ x: {
248
+ type: "number",
249
+ title: "X-component",
250
+ default: 0.0,
251
+ },
252
+ y: {
253
+ type: "number",
254
+ title: "Y-component",
255
+ default: 0.0,
256
+ },
257
+ z: {
258
+ type: "number",
259
+ title: "Z-component",
260
+ default: 0.0,
261
+ },
262
+ },
263
+ },
264
+ },
265
+ };
266
+ }
267
+ }
268
+
269
+ materialContextMixin(NonCollinearMagnetizationContextProvider.prototype);
@@ -0,0 +1,68 @@
1
+ import ContextProvider from "@exabyte-io/ade.js/dist/js/context/ContextProvider";
2
+
3
+ import { applicationContextMixin } from "../mixins/ApplicationContextMixin";
4
+
5
+ const cutoffConfig = {
6
+ vasp: {}, // assuming default cutoffs for VASP
7
+ espresso: {
8
+ // assuming the default GBRV set of pseudopotentials is used
9
+ wavefunction: 40,
10
+ density: 200,
11
+ },
12
+ };
13
+
14
+ export class PlanewaveCutoffsContextProvider extends ContextProvider {
15
+ constructor(config) {
16
+ super(config);
17
+ this.initApplicationContextMixin();
18
+ }
19
+
20
+ // eslint-disable-next-line class-methods-use-this
21
+ get uiSchema() {
22
+ return {
23
+ wavefunction: {},
24
+ density: {},
25
+ };
26
+ }
27
+
28
+ get defaultData() {
29
+ return {
30
+ wavefunction: this.defaultECUTWFC,
31
+ density: this.defaultECUTRHO,
32
+ };
33
+ }
34
+
35
+ get _cutoffConfigPerApplication() {
36
+ return cutoffConfig[this.application.name];
37
+ }
38
+
39
+ get defaultECUTWFC() {
40
+ return this._cutoffConfigPerApplication.wavefunction || null;
41
+ }
42
+
43
+ get defaultECUTRHO() {
44
+ return this._cutoffConfigPerApplication.density || null;
45
+ }
46
+
47
+ get jsonSchema() {
48
+ return {
49
+ $schema: "http://json-schema.org/draft-07/schema#",
50
+ title: " ",
51
+ description:
52
+ "Planewave cutoff parameters for electronic wavefunctions and density. Units are specific to simulation engine.",
53
+ type: "object",
54
+ properties: {
55
+ wavefunction: {
56
+ type: "number",
57
+ default: this.defaultECUTWFC,
58
+ },
59
+ density: {
60
+ type: "number",
61
+ default: this.defaultECUTRHO,
62
+ },
63
+ },
64
+ };
65
+ }
66
+ }
67
+
68
+ applicationContextMixin(PlanewaveCutoffsContextProvider.prototype);
@@ -0,0 +1,285 @@
1
+ import JSONSchemaFormDataProvider from "@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider";
2
+ import { units as UNITS } from "@mat3ra/code/dist/js/constants";
3
+ import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
4
+ import { Made } from "@mat3ra/made";
5
+ import lodash from "lodash";
6
+
7
+ import { materialContextMixin } from "../mixins/MaterialContextMixin";
8
+ import { globalSettings } from "./settings";
9
+
10
+ export class PointsGridFormDataProvider extends JSONSchemaFormDataProvider {
11
+ constructor(config) {
12
+ super(config);
13
+ this.initMaterialContextMixin();
14
+
15
+ this._divisor = config.divisor || 1; // KPPRA will be divided by this number
16
+ this.reciprocalLattice = new Made.ReciprocalLattice(this.material.lattice);
17
+
18
+ this.dimensions = lodash.get(this.data, "dimensions") || this._defaultDimensions;
19
+ this.shifts = lodash.get(this.data, "shifts") || this._defaultShifts;
20
+
21
+ // init class fields from data (as constructed from context in parent)
22
+ this.gridMetricType = lodash.get(this.data, "gridMetricType") || "KPPRA";
23
+ this.gridMetricValue =
24
+ lodash.get(this.data, "gridMetricValue") || this._getDefaultGridMetricValue("KPPRA");
25
+ this.preferGridMetric = lodash.get(this.data, "preferGridMetric", false);
26
+
27
+ this._metricDescription = {
28
+ KPPRA: `${this.name[0].toUpperCase()}PPRA (${this.name[0]}pt per reciprocal atom)`, // KPPRA or QPPRA
29
+ spacing: "grid spacing",
30
+ };
31
+ this.defaultClassNames = "col-xs-12 col-sm-6 col-md-3 col-lg-2";
32
+ }
33
+
34
+ // eslint-disable-next-line class-methods-use-this
35
+ getDefaultShift() {
36
+ return 0;
37
+ }
38
+
39
+ get _defaultDimensions() {
40
+ return this.calculateDimensions({
41
+ gridMetricType: "KPPRA",
42
+ gridMetricValue: this._getDefaultGridMetricValue("KPPRA"),
43
+ });
44
+ }
45
+
46
+ get _defaultShifts() {
47
+ return Array(3).fill(this.getDefaultShift());
48
+ }
49
+
50
+ _getDefaultGridMetricValue(metric) {
51
+ switch (metric) {
52
+ case "KPPRA":
53
+ return Math.floor(globalSettings.defaultKPPRA / this._divisor);
54
+ case "spacing":
55
+ return 0.3;
56
+ default:
57
+ console.error("Metric type not recognized!");
58
+ return 1;
59
+ }
60
+ }
61
+
62
+ get _defaultData() {
63
+ return {
64
+ dimensions: this._defaultDimensions,
65
+ shifts: this._defaultShifts,
66
+ gridMetricType: "KPPRA",
67
+ gridMetricValue: this._getDefaultGridMetricValue("KPPRA"),
68
+ preferGridMetric: false,
69
+ reciprocalVectorRatios: this.reciprocalVectorRatios,
70
+ };
71
+ }
72
+
73
+ get _defaultDataWithMaterial() {
74
+ const { gridMetricType, gridMetricValue } = this;
75
+ // if `data` is present and material is updated, prioritize `data` when `preferGridMetric` is not set
76
+ return this.preferGridMetric
77
+ ? {
78
+ dimensions: this.calculateDimensions({ gridMetricType, gridMetricValue }),
79
+ shifts: this._defaultShifts,
80
+ }
81
+ : this.data || this._defaultData;
82
+ }
83
+
84
+ get defaultData() {
85
+ return this.material ? this._defaultDataWithMaterial : this._defaultData;
86
+ }
87
+
88
+ get reciprocalVectorRatios() {
89
+ return this.reciprocalLattice.reciprocalVectorRatios.map((r) =>
90
+ Number(codeJSMath.numberToPrecision(r, 3)),
91
+ );
92
+ }
93
+
94
+ get jsonSchema() {
95
+ const vector = {
96
+ type: "array",
97
+ items: {
98
+ type: "number",
99
+ },
100
+ minItems: 3,
101
+ maxItems: 3,
102
+ };
103
+
104
+ const vector_ = (defaultValue, isStringType = false) => {
105
+ const isArray = Array.isArray(defaultValue);
106
+ return {
107
+ ...vector,
108
+ items: {
109
+ type: isStringType ? "string" : "number",
110
+ ...(isArray ? {} : { default: defaultValue }),
111
+ },
112
+ ...(isArray ? { default: defaultValue } : {}),
113
+ };
114
+ };
115
+
116
+ return {
117
+ $schema: "http://json-schema.org/draft-07/schema#",
118
+ description: `3D grid with shifts. Default min value for ${
119
+ this._metricDescription[this.gridMetricType]
120
+ } is ${this._getDefaultGridMetricValue(this.gridMetricType)}.`,
121
+ type: "object",
122
+ properties: {
123
+ dimensions: vector_(this._defaultDimensions, this.isUsingJinjaVariables),
124
+ shifts: vector_(this.getDefaultShift()),
125
+ reciprocalVectorRatios: vector_(this.reciprocalVectorRatios),
126
+ gridMetricType: {
127
+ type: "string",
128
+ enum: ["KPPRA", "spacing"],
129
+ default: "KPPRA",
130
+ },
131
+ gridMetricValue: {
132
+ type: "number",
133
+ },
134
+ preferGridMetric: {
135
+ type: "boolean",
136
+ },
137
+ },
138
+ dependencies: {
139
+ gridMetricType: {
140
+ oneOf: [
141
+ {
142
+ properties: {
143
+ gridMetricType: {
144
+ enum: ["KPPRA"],
145
+ },
146
+ gridMetricValue: {
147
+ type: "integer",
148
+ minimum: 1,
149
+ title: "Value",
150
+ default: this.gridMetricValue,
151
+ },
152
+ preferGridMetric: {
153
+ type: "boolean",
154
+ title: "prefer KPPRA",
155
+ default: this.preferGridMetric,
156
+ },
157
+ },
158
+ },
159
+ {
160
+ properties: {
161
+ gridMetricType: {
162
+ enum: ["spacing"],
163
+ },
164
+ gridMetricValue: {
165
+ type: "number",
166
+ minimum: 0,
167
+ title: "Value [1/Å]",
168
+ default: this.gridMetricValue,
169
+ },
170
+ preferGridMetric: {
171
+ type: "boolean",
172
+ title: "prefer spacing",
173
+ default: this.preferGridMetric,
174
+ },
175
+ },
176
+ },
177
+ ],
178
+ },
179
+ },
180
+ required: ["dimensions", "shifts"],
181
+ };
182
+ }
183
+
184
+ get uiSchema() {
185
+ const _arraySubStyle = (emptyValue = 0) => {
186
+ return {
187
+ "ui:options": {
188
+ addable: false,
189
+ orderable: false,
190
+ removable: false,
191
+ },
192
+ items: {
193
+ "ui:disabled": this.preferGridMetric,
194
+ // TODO: extract the actual current values from context
195
+ "ui:placeholder": "1",
196
+ "ui:emptyValue": emptyValue,
197
+ "ui:label": false,
198
+ },
199
+ };
200
+ };
201
+
202
+ return {
203
+ dimensions: _arraySubStyle(1),
204
+ shifts: _arraySubStyle(0),
205
+ gridMetricType: {
206
+ "ui:title": "Grid Metric",
207
+ },
208
+ gridMetricValue: {
209
+ "ui:disabled": !this.preferGridMetric,
210
+ "ui:emptyValue": this.gridMetricValue,
211
+ "ui:placeholder": this.gridMetricValue.toString(), // make string to prevent prop type error
212
+ },
213
+ preferGridMetric: {
214
+ "ui:emptyValue": true,
215
+ "ui:disabled": this.isUsingJinjaVariables,
216
+ },
217
+ reciprocalVectorRatios: {
218
+ "ui:title": "reciprocal vector ratios",
219
+ "ui:orderable": false,
220
+ "ui:removable": false,
221
+ "ui:readonly": true,
222
+ items: {
223
+ "ui:label": false,
224
+ },
225
+ },
226
+ };
227
+ }
228
+
229
+ _getDimensionsFromKPPRA(KPPRA) {
230
+ const nAtoms = this.material ? this.material.Basis.nAtoms : 1;
231
+ return this.reciprocalLattice.getDimensionsFromPointsCount(KPPRA / nAtoms);
232
+ }
233
+
234
+ _getKPPRAFromDimensions(dimensions) {
235
+ const nAtoms = this.material ? this.material.Basis.nAtoms : 1;
236
+ return dimensions.reduce((a, b) => a * b) * nAtoms;
237
+ }
238
+
239
+ static _canTransform(data) {
240
+ return (
241
+ (data.preferGridMetric && data.gridMetricType && data.gridMetricValue) ||
242
+ (!data.preferGridMetric && data.dimensions.every((d) => typeof d === "number"))
243
+ );
244
+ }
245
+
246
+ calculateDimensions({ gridMetricType, gridMetricValue, units = UNITS.angstrom }) {
247
+ switch (gridMetricType) {
248
+ case "KPPRA":
249
+ return this._getDimensionsFromKPPRA(gridMetricValue);
250
+ case "spacing":
251
+ return this.reciprocalLattice.getDimensionsFromSpacing(gridMetricValue, units);
252
+ default:
253
+ return [1, 1, 1];
254
+ }
255
+ }
256
+
257
+ calculateGridMetric({ gridMetricType, dimensions, units = UNITS.angstrom }) {
258
+ switch (gridMetricType) {
259
+ case "KPPRA":
260
+ return this._getKPPRAFromDimensions(dimensions);
261
+ case "spacing":
262
+ return lodash.round(
263
+ this.reciprocalLattice.getSpacingFromDimensions(dimensions, units),
264
+ 3,
265
+ );
266
+ default:
267
+ return 1;
268
+ }
269
+ }
270
+
271
+ transformData(data) {
272
+ if (!this.constructor._canTransform(data)) {
273
+ return data;
274
+ }
275
+ // dimensions are calculated from grid metric or vice versa
276
+ if (data.preferGridMetric) {
277
+ data.dimensions = this.calculateDimensions(data);
278
+ } else {
279
+ data.gridMetricValue = this.calculateGridMetric(data);
280
+ }
281
+ return data;
282
+ }
283
+ }
284
+
285
+ materialContextMixin(PointsGridFormDataProvider.prototype);