@mat3ra/wode 2025.11.19-0 → 2025.11.26-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 (29) hide show
  1. package/dist/js/context/providers/BoundaryConditionsFormDataProvider.js +25 -26
  2. package/dist/js/context/providers/CollinearMagnetizationContextProvider.js +23 -40
  3. package/dist/js/context/providers/HubbardContextProviderLegacy.js +14 -27
  4. package/dist/js/context/providers/HubbardJContextProvider.js +28 -35
  5. package/dist/js/context/providers/HubbardUContextProvider.js +22 -28
  6. package/dist/js/context/providers/HubbardVContextProvider.js +39 -51
  7. package/dist/js/context/providers/IonDynamicsContextProvider.js +26 -29
  8. package/dist/js/context/providers/MLSettingsContextProvider.js +15 -15
  9. package/dist/js/context/providers/MLTrainTestSplitContextProvider.js +12 -12
  10. package/dist/js/context/providers/NEBFormDataProvider.js +17 -12
  11. package/dist/js/context/providers/NonCollinearMagnetizationContextProvider.js +57 -123
  12. package/dist/js/context/providers/PlanewaveCutoffsContextProvider.js +17 -16
  13. package/dist/js/context/providers/PointsGridFormDataProvider.js +21 -30
  14. package/dist/js/context/providers/PointsPathFormDataProvider.js +15 -23
  15. package/package.json +2 -2
  16. package/src/js/context/providers/BoundaryConditionsFormDataProvider.js +18 -26
  17. package/src/js/context/providers/CollinearMagnetizationContextProvider.js +28 -40
  18. package/src/js/context/providers/HubbardContextProviderLegacy.js +19 -27
  19. package/src/js/context/providers/HubbardJContextProvider.js +27 -35
  20. package/src/js/context/providers/HubbardUContextProvider.js +23 -28
  21. package/src/js/context/providers/HubbardVContextProvider.js +39 -54
  22. package/src/js/context/providers/IonDynamicsContextProvider.js +16 -28
  23. package/src/js/context/providers/MLSettingsContextProvider.js +13 -16
  24. package/src/js/context/providers/MLTrainTestSplitContextProvider.js +12 -14
  25. package/src/js/context/providers/NEBFormDataProvider.js +13 -12
  26. package/src/js/context/providers/NonCollinearMagnetizationContextProvider.js +37 -127
  27. package/src/js/context/providers/PlanewaveCutoffsContextProvider.js +14 -17
  28. package/src/js/context/providers/PointsGridFormDataProvider.js +22 -36
  29. package/src/js/context/providers/PointsPathFormDataProvider.js +18 -20
@@ -1,9 +1,12 @@
1
1
  import { JSONSchemaFormDataProvider } from "@mat3ra/ade";
2
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
3
  import lodash from "lodash";
3
4
 
4
5
  import { materialContextMixin } from "../mixins/MaterialContextMixin";
5
6
 
6
7
  export class NonCollinearMagnetizationContextProvider extends JSONSchemaFormDataProvider {
8
+ jsonSchemaId = "context-providers-directory/non-collinear-magnetization-context-provider";
9
+
7
10
  constructor(config) {
8
11
  super(config);
9
12
  this.initMaterialContextMixin();
@@ -133,137 +136,44 @@ export class NonCollinearMagnetizationContextProvider extends JSONSchemaFormData
133
136
  };
134
137
  }
135
138
 
136
- get jsonSchema() {
139
+ get jsonSchemaPatchConfig() {
137
140
  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
- },
141
+ isExistingChargeDensity: { default: false },
142
+ isStartingMagnetization: { default: true },
143
+ isArbitrarySpinAngle: { default: false },
144
+ isConstrainedMagnetization: { default: false },
145
+ isFixedMagnetization: { default: true },
146
+ startingMagnetization: {
147
+ minItems: this.uniqueElementsWithLabels.length,
148
+ maxItems: this.uniqueElementsWithLabels.length,
149
+ },
150
+ "startingMagnetization.items.properties.value": {
151
+ default: 0.0,
152
+ minimum: -1.0,
153
+ maximum: 1.0,
154
+ },
155
+ spinAngles: {
156
+ minItems: this.uniqueElementsWithLabels.length,
157
+ maxItems: this.uniqueElementsWithLabels.length,
158
+ },
159
+ "spinAngles.items.properties.angle1": { default: 0.0 },
160
+ "spinAngles.items.properties.angle2": { default: 0.0 },
161
+ "constrainedMagnetization.properties.constrainType": {
162
+ default: "atomic direction",
264
163
  },
164
+ "constrainedMagnetization.properties.lambda": { default: 0.0 },
165
+ "fixedMagnetization.properties.x": { default: 0.0 },
166
+ "fixedMagnetization.properties.y": { default: 0.0 },
167
+ "fixedMagnetization.properties.z": { default: 0.0 },
265
168
  };
266
169
  }
170
+
171
+ get jsonSchema() {
172
+ return JSONSchemasInterface.getPatchedSchemaById(
173
+ this.jsonSchemaId,
174
+ this.jsonSchemaPatchConfig,
175
+ );
176
+ }
267
177
  }
268
178
 
269
179
  materialContextMixin(NonCollinearMagnetizationContextProvider.prototype);
@@ -1,4 +1,5 @@
1
1
  import { ContextProvider } from "@mat3ra/ade";
2
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
3
 
3
4
  import { applicationContextMixin } from "../mixins/ApplicationContextMixin";
4
5
 
@@ -12,6 +13,8 @@ const cutoffConfig = {
12
13
  };
13
14
 
14
15
  export class PlanewaveCutoffsContextProvider extends ContextProvider {
16
+ jsonSchemaId = "context-providers-directory/planewave-cutoffs-context-provider";
17
+
15
18
  constructor(config) {
16
19
  super(config);
17
20
  this.initApplicationContextMixin();
@@ -32,6 +35,13 @@ export class PlanewaveCutoffsContextProvider extends ContextProvider {
32
35
  };
33
36
  }
34
37
 
38
+ get jsonSchemaPatchConfig() {
39
+ return {
40
+ wavefunction: { default: this.defaultData.wavefunction },
41
+ density: { default: this.defaultData.density },
42
+ };
43
+ }
44
+
35
45
  get _cutoffConfigPerApplication() {
36
46
  return cutoffConfig[this.application.name];
37
47
  }
@@ -45,23 +55,10 @@ export class PlanewaveCutoffsContextProvider extends ContextProvider {
45
55
  }
46
56
 
47
57
  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
- };
58
+ return JSONSchemasInterface.getPatchedSchemaById(
59
+ this.jsonSchemaId,
60
+ this.jsonSchemaPatchConfig,
61
+ );
65
62
  }
66
63
  }
67
64
 
@@ -1,6 +1,7 @@
1
1
  import { JSONSchemaFormDataProvider } from "@mat3ra/ade";
2
2
  import { units as UNITS } from "@mat3ra/code/dist/js/constants";
3
3
  import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
4
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
4
5
  import { Made } from "@mat3ra/made";
5
6
  import lodash from "lodash";
6
7
 
@@ -8,6 +9,8 @@ import { materialContextMixin } from "../mixins/MaterialContextMixin";
8
9
  import { globalSettings } from "./settings";
9
10
 
10
11
  export class PointsGridFormDataProvider extends JSONSchemaFormDataProvider {
12
+ jsonSchemaId = "context-providers-directory/points-grid-data-provider";
13
+
11
14
  constructor(config) {
12
15
  super(config);
13
16
  this.initMaterialContextMixin();
@@ -91,58 +94,37 @@ export class PointsGridFormDataProvider extends JSONSchemaFormDataProvider {
91
94
  );
92
95
  }
93
96
 
94
- get jsonSchema() {
95
- const vector = {
96
- type: "array",
97
- items: {
98
- type: "number",
99
- },
100
- minItems: 3,
101
- maxItems: 3,
102
- };
103
-
97
+ get jsonSchemaPatchConfig() {
98
+ // Helper function to create vector schema with defaults
104
99
  const vector_ = (defaultValue, isStringType = false) => {
105
100
  const isArray = Array.isArray(defaultValue);
106
101
  return {
107
- ...vector,
102
+ type: "array",
108
103
  items: {
109
104
  type: isStringType ? "string" : "number",
110
105
  ...(isArray ? {} : { default: defaultValue }),
111
106
  },
107
+ minItems: 3,
108
+ maxItems: 3,
112
109
  ...(isArray ? { default: defaultValue } : {}),
113
110
  };
114
111
  };
115
112
 
116
113
  return {
117
- $schema: "http://json-schema.org/draft-07/schema#",
114
+ dimensions: vector_(this._defaultDimensions, this.isUsingJinjaVariables),
115
+ shifts: vector_(this.getDefaultShift()),
116
+ reciprocalVectorRatios: vector_(this.reciprocalVectorRatios),
117
+ gridMetricType: { default: "KPPRA" },
118
118
  description: `3D grid with shifts. Default min value for ${
119
119
  this._metricDescription[this.gridMetricType]
120
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
- },
121
+ required: ["dimensions", "shifts"],
138
122
  dependencies: {
139
123
  gridMetricType: {
140
124
  oneOf: [
141
125
  {
142
126
  properties: {
143
- gridMetricType: {
144
- enum: ["KPPRA"],
145
- },
127
+ gridMetricType: { enum: ["KPPRA"] },
146
128
  gridMetricValue: {
147
129
  type: "integer",
148
130
  minimum: 1,
@@ -158,9 +140,7 @@ export class PointsGridFormDataProvider extends JSONSchemaFormDataProvider {
158
140
  },
159
141
  {
160
142
  properties: {
161
- gridMetricType: {
162
- enum: ["spacing"],
163
- },
143
+ gridMetricType: { enum: ["spacing"] },
164
144
  gridMetricValue: {
165
145
  type: "number",
166
146
  minimum: 0,
@@ -177,10 +157,16 @@ export class PointsGridFormDataProvider extends JSONSchemaFormDataProvider {
177
157
  ],
178
158
  },
179
159
  },
180
- required: ["dimensions", "shifts"],
181
160
  };
182
161
  }
183
162
 
163
+ get jsonSchema() {
164
+ return JSONSchemasInterface.getPatchedSchemaById(
165
+ this.jsonSchemaId,
166
+ this.jsonSchemaPatchConfig,
167
+ );
168
+ }
169
+
184
170
  get uiSchema() {
185
171
  const _arraySubStyle = (emptyValue = 0) => {
186
172
  return {
@@ -2,6 +2,7 @@
2
2
  /* eslint react/prop-types: 0 */
3
3
  import { JSONSchemaFormDataProvider } from "@mat3ra/ade";
4
4
  import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
5
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
5
6
  import { Made } from "@mat3ra/made";
6
7
  import s from "underscore.string";
7
8
 
@@ -12,6 +13,8 @@ const defaultPoint = "Г";
12
13
  const defaultSteps = 10;
13
14
 
14
15
  export class PointsPathFormDataProvider extends JSONSchemaFormDataProvider {
16
+ jsonSchemaId = "context-providers-directory/points-path-data-provider";
17
+
15
18
  constructor(config) {
16
19
  super(config);
17
20
  this.initMaterialContextMixin();
@@ -32,32 +35,27 @@ export class PointsPathFormDataProvider extends JSONSchemaFormDataProvider {
32
35
  return this.reciprocalLattice.symmetryPoints;
33
36
  }
34
37
 
35
- get jsonSchema() {
36
- // no need to pass context to get symmetry points on client
38
+ get jsonSchemaPatchConfig() {
37
39
  const points = [].concat(this.symmetryPoints).map((x) => x.point);
40
+
38
41
  return {
39
- $schema: "http://json-schema.org/draft-07/schema#",
40
- title: " ",
41
- description: "path in reciprocal space",
42
- type: "array",
43
- items: {
44
- type: "object",
45
- properties: {
46
- point: {
47
- type: "string",
48
- default: defaultPoint,
49
- enum: points,
50
- },
51
- steps: {
52
- type: "integer",
53
- default: defaultSteps,
54
- },
55
- },
42
+ "items.properties.point": {
43
+ default: defaultPoint,
44
+ enum: points,
45
+ },
46
+ "items.properties.steps": {
47
+ default: defaultSteps,
56
48
  },
57
- minItems: 1,
58
49
  };
59
50
  }
60
51
 
52
+ get jsonSchema() {
53
+ return JSONSchemasInterface.getPatchedSchemaById(
54
+ this.jsonSchemaId,
55
+ this.jsonSchemaPatchConfig,
56
+ );
57
+ }
58
+
61
59
  // eslint-disable-next-line class-methods-use-this
62
60
  get uiSchema() {
63
61
  return {