@mat3ra/wode 2025.11.13-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 (43) hide show
  1. package/dist/js/context/providers/BoundaryConditionsFormDataProvider.js +26 -28
  2. package/dist/js/context/providers/CollinearMagnetizationContextProvider.js +25 -42
  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 +23 -30
  6. package/dist/js/context/providers/HubbardVContextProvider.js +39 -51
  7. package/dist/js/context/providers/IonDynamicsContextProvider.js +27 -31
  8. package/dist/js/context/providers/MLSettingsContextProvider.js +16 -17
  9. package/dist/js/context/providers/MLTrainTestSplitContextProvider.js +13 -14
  10. package/dist/js/context/providers/NEBFormDataProvider.js +18 -14
  11. package/dist/js/context/providers/NonCollinearMagnetizationContextProvider.js +59 -125
  12. package/dist/js/context/providers/PlanewaveCutoffsContextProvider.js +18 -18
  13. package/dist/js/context/providers/PointsGridFormDataProvider.js +23 -32
  14. package/dist/js/context/providers/PointsPathFormDataProvider.js +17 -25
  15. package/dist/js/context/providers/by_application/ExecutableContextProvider.js +2 -3
  16. package/dist/js/index.js +113 -0
  17. package/dist/js/subworkflows/create.js +2 -2
  18. package/dist/js/units/builders/ExecutionUnitConfigBuilder.js +3 -4
  19. package/dist/js/units/execution.js +7 -8
  20. package/dist/js/workflows/index.js +6 -0
  21. package/dist/js/workflows/workflow.js +1 -1
  22. package/package.json +6 -7
  23. package/src/js/context/providers/BoundaryConditionsFormDataProvider.js +19 -27
  24. package/src/js/context/providers/CollinearMagnetizationContextProvider.js +29 -41
  25. package/src/js/context/providers/HubbardContextProviderLegacy.js +19 -27
  26. package/src/js/context/providers/HubbardJContextProvider.js +27 -35
  27. package/src/js/context/providers/HubbardUContextProvider.js +24 -29
  28. package/src/js/context/providers/HubbardVContextProvider.js +39 -54
  29. package/src/js/context/providers/IonDynamicsContextProvider.js +17 -29
  30. package/src/js/context/providers/MLSettingsContextProvider.js +14 -17
  31. package/src/js/context/providers/MLTrainTestSplitContextProvider.js +13 -15
  32. package/src/js/context/providers/NEBFormDataProvider.js +14 -13
  33. package/src/js/context/providers/NonCollinearMagnetizationContextProvider.js +38 -128
  34. package/src/js/context/providers/PlanewaveCutoffsContextProvider.js +15 -18
  35. package/src/js/context/providers/PointsGridFormDataProvider.js +23 -37
  36. package/src/js/context/providers/PointsPathFormDataProvider.js +19 -21
  37. package/src/js/context/providers/by_application/ExecutableContextProvider.js +1 -1
  38. package/src/js/index.js +42 -2
  39. package/src/js/subworkflows/create.js +1 -1
  40. package/src/js/units/builders/ExecutionUnitConfigBuilder.js +1 -1
  41. package/src/js/units/execution.js +1 -2
  42. package/src/js/workflows/index.js +1 -1
  43. package/src/js/workflows/workflow.js +1 -1
package/dist/js/index.js CHANGED
@@ -3,12 +3,90 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "AssertionUnit", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _units.AssertionUnit;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "AssignmentUnit", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _units.AssignmentUnit;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "BaseUnit", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _units.BaseUnit;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ConditionUnit", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _units.ConditionUnit;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "ExecutionUnit", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _units.ExecutionUnit;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "IOUnit", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _units.IOUnit;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "MapUnit", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _units.MapUnit;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "PointsPathFormDataProvider", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _PointsPathFormDataProvider.PointsPathFormDataProvider;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "ProcessingUnit", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _units.ProcessingUnit;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "ReduceUnit", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _units.ReduceUnit;
64
+ }
65
+ });
6
66
  Object.defineProperty(exports, "Subworkflow", {
7
67
  enumerable: true,
8
68
  get: function () {
9
69
  return _subworkflows.Subworkflow;
10
70
  }
11
71
  });
72
+ Object.defineProperty(exports, "SubworkflowUnit", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _units.SubworkflowUnit;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "TAB_NAVIGATION_CONFIG", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _enums.TAB_NAVIGATION_CONFIG;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "UNIT_NAME_INVALID_CHARS", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _enums.UNIT_NAME_INVALID_CHARS;
88
+ }
89
+ });
12
90
  Object.defineProperty(exports, "UNIT_STATUSES", {
13
91
  enumerable: true,
14
92
  get: function () {
@@ -27,6 +105,12 @@ Object.defineProperty(exports, "UnitFactory", {
27
105
  return _factory.UnitFactory;
28
106
  }
29
107
  });
108
+ Object.defineProperty(exports, "WORKFLOW_STATUSES", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _enums.WORKFLOW_STATUSES;
112
+ }
113
+ });
30
114
  Object.defineProperty(exports, "Workflow", {
31
115
  enumerable: true,
32
116
  get: function () {
@@ -45,6 +129,12 @@ Object.defineProperty(exports, "createSubworkflowByName", {
45
129
  return _subworkflows.createSubworkflowByName;
46
130
  }
47
131
  });
132
+ Object.defineProperty(exports, "createWorkflow", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _workflows.createWorkflow;
136
+ }
137
+ });
48
138
  Object.defineProperty(exports, "createWorkflowConfigs", {
49
139
  enumerable: true,
50
140
  get: function () {
@@ -57,8 +147,31 @@ Object.defineProperty(exports, "createWorkflows", {
57
147
  return _workflows.createWorkflows;
58
148
  }
59
149
  });
150
+ Object.defineProperty(exports, "defaultMapConfig", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _map.defaultMapConfig;
154
+ }
155
+ });
156
+ Object.defineProperty(exports, "globalSettings", {
157
+ enumerable: true,
158
+ get: function () {
159
+ return _settings.globalSettings;
160
+ }
161
+ });
162
+ Object.defineProperty(exports, "wodeProviders", {
163
+ enumerable: true,
164
+ get: function () {
165
+ return _providers.wodeProviders;
166
+ }
167
+ });
168
+ var _providers = require("./context/providers");
169
+ var _PointsPathFormDataProvider = require("./context/providers/PointsPathFormDataProvider");
170
+ var _settings = require("./context/providers/settings");
60
171
  var _enums = require("./enums");
61
172
  var _subworkflows = require("./subworkflows");
173
+ var _units = require("./units");
62
174
  var _builders = require("./units/builders");
63
175
  var _factory = require("./units/factory");
176
+ var _map = require("./units/map");
64
177
  var _workflows = require("./workflows");
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createSubworkflow = createSubworkflow;
7
7
  exports.createSubworkflowByName = createSubworkflowByName;
8
8
  exports.createUnit = createUnit;
9
- var _ApplicationRegistry = _interopRequireDefault(require("@mat3ra/ade/dist/js/ApplicationRegistry"));
9
+ var _ade = require("@mat3ra/ade");
10
10
  var _mode = require("@mat3ra/mode");
11
11
  var _standata = require("@mat3ra/standata");
12
12
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -202,7 +202,7 @@ function createDynamicUnits({
202
202
  }
203
203
  function createSubworkflow({
204
204
  subworkflowData,
205
- AppRegistry = _ApplicationRegistry.default,
205
+ AppRegistry = _ade.ApplicationRegistry,
206
206
  modelFactoryCls = _mode.ModelFactory,
207
207
  methodFactoryCls = _mode.MethodFactory,
208
208
  subworkflowCls = _subworkflow.Subworkflow,
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionUnitConfigBuilder = void 0;
7
- var _ApplicationRegistry = _interopRequireDefault(require("@mat3ra/ade/dist/js/ApplicationRegistry"));
7
+ var _ade = require("@mat3ra/ade");
8
8
  var _enums = require("../../enums");
9
9
  var _UnitConfigBuilder = require("./UnitConfigBuilder");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
10
  /* eslint-disable class-methods-use-this */
12
11
 
13
12
  class ExecutionUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
@@ -51,7 +50,7 @@ class ExecutionUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
51
50
  * @returns {Executable} The created executable instance
52
51
  */
53
52
  _createExecutable(application, execName) {
54
- return _ApplicationRegistry.default.getExecutableByName(application.name, execName);
53
+ return _ade.ApplicationRegistry.getExecutableByName(application.name, execName);
55
54
  }
56
55
 
57
56
  /**
@@ -61,7 +60,7 @@ class ExecutionUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
61
60
  * @returns {Flavor} The created flavor instance
62
61
  */
63
62
  _createFlavor(executable, flavorName) {
64
- return _ApplicationRegistry.default.getFlavorByName(executable, flavorName);
63
+ return _ade.ApplicationRegistry.getFlavorByName(executable, flavorName);
65
64
  }
66
65
  }
67
66
  exports.ExecutionUnitConfigBuilder = ExecutionUnitConfigBuilder;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ExecutionUnit = void 0;
7
7
  var _ade = require("@mat3ra/ade");
8
- var _ApplicationRegistry = _interopRequireDefault(require("@mat3ra/ade/dist/js/ApplicationRegistry"));
9
8
  var _utils = require("@mat3ra/utils");
10
9
  var _underscore = _interopRequireDefault(require("underscore"));
11
10
  var _base = require("./base");
@@ -18,9 +17,9 @@ class ExecutionUnit extends _base.BaseUnit {
18
17
  * @override this method to provide entities from other sources
19
18
  */
20
19
  _initApplication(config) {
21
- this._application = _ApplicationRegistry.default.createApplication(config.application);
22
- this._executable = _ApplicationRegistry.default.getExecutableByConfig(this._application.name, config.executable);
23
- this._flavor = _ApplicationRegistry.default.getFlavorByConfig(this._executable, config.flavor);
20
+ this._application = _ade.ApplicationRegistry.createApplication(config.application);
21
+ this._executable = _ade.ApplicationRegistry.getExecutableByConfig(this._application.name, config.executable);
22
+ this._flavor = _ade.ApplicationRegistry.getFlavorByConfig(this._executable, config.flavor);
24
23
  this._templates = this._flavor ? this._flavor.inputAsTemplates : [];
25
24
  }
26
25
 
@@ -28,14 +27,14 @@ class ExecutionUnit extends _base.BaseUnit {
28
27
  * @override this method to provide default executable from other source
29
28
  */
30
29
  _getDefaultExecutable() {
31
- return _ApplicationRegistry.default.getExecutableByName(this.application.name);
30
+ return _ade.ApplicationRegistry.getExecutableByName(this.application.name);
32
31
  }
33
32
 
34
33
  /**
35
34
  * @override this method to provide default flavor from other source
36
35
  */
37
36
  _getDefaultFlavor() {
38
- return _ApplicationRegistry.default.getFlavorByName(this.executable.name);
37
+ return _ade.ApplicationRegistry.getFlavorByName(this.executable.name);
39
38
  }
40
39
 
41
40
  /**
@@ -49,14 +48,14 @@ class ExecutionUnit extends _base.BaseUnit {
49
48
  * @override this method to provide custom input from other sources
50
49
  */
51
50
  _getInput() {
52
- return this.input || _ApplicationRegistry.default.getInputAsRenderedTemplates(this.flavor, this.getCombinedContext()) || [];
51
+ return this.input || _ade.ApplicationRegistry.getInputAsRenderedTemplates(this.flavor, this.getCombinedContext()) || [];
53
52
  }
54
53
 
55
54
  /**
56
55
  * @override this method to provide custom input as templates
57
56
  */
58
57
  _getInputAsTemplates() {
59
- return _ApplicationRegistry.default.getInputAsTemplates(this.flavor);
58
+ return _ade.ApplicationRegistry.getInputAsTemplates(this.flavor);
60
59
  }
61
60
  _initRuntimeItems(keys, config) {
62
61
  this._initApplication(config);
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "Workflow", {
9
9
  return _workflow.Workflow;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "createWorkflow", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _create.createWorkflow;
16
+ }
17
+ });
12
18
  exports.createWorkflowConfigs = createWorkflowConfigs;
13
19
  exports.createWorkflows = createWorkflows;
14
20
  var _ade = require("@mat3ra/ade");
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Workflow = void 0;
7
- var _ide = require("@exabyte-io/ide.js");
8
7
  var _entity = require("@mat3ra/code/dist/js/entity");
9
8
  var _workflow = _interopRequireDefault(require("@mat3ra/esse/dist/js/schema/workflow.json"));
9
+ var _ide = require("@mat3ra/ide");
10
10
  var _mode = require("@mat3ra/mode");
11
11
  var _utils = require("@mat3ra/utils");
12
12
  var _lodash = _interopRequireDefault(require("lodash"));
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@mat3ra/wode",
3
- "version": "2025.11.13-0",
3
+ "version": "2025.11.26-0",
4
4
  "description": "WOrkflow DEfinitions",
5
5
  "scripts": {
6
6
  "test": "nyc --reporter=text mocha --recursive --bail --require @babel/register/lib --require tests/js/setup.js tests/js",
7
7
  "lint": "eslint src/js tests/js && prettier --write src/js tests/js",
8
8
  "lint:fix": "eslint --fix --cache src/js tests/js && prettier --write src/js tests/js",
9
9
  "transpile": "babel --out-dir dist/js src/js",
10
- "postinstall": "npm run transpile",
11
10
  "prettier": "prettier --check src/js tests/js",
12
11
  "prepare": "husky install || exit 0"
13
12
  },
@@ -48,13 +47,13 @@
48
47
  "v20": "^0.1.0"
49
48
  },
50
49
  "devDependencies": {
51
- "@mat3ra/ade": "^2025.10.2-2",
50
+ "@mat3ra/ade": "2025.11.19-0",
52
51
  "@exabyte-io/eslint-config": "2025.5.13-0",
53
- "@exabyte-io/ide.js": "2024.3.26-0",
54
- "@mat3ra/mode": "2025.11.6-1",
52
+ "@mat3ra/ide": "2025.11.19-0",
53
+ "@mat3ra/mode": "2025.11.13-0",
55
54
  "@mat3ra/utils": "2025.9.20-0",
56
55
  "@mat3ra/code": "2025.10.24-0",
57
- "@mat3ra/esse": "2025.10.8-0",
56
+ "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse.git#d4e2616f9ae405288d182bbcc136fad5d4eeb4b3",
58
57
  "@mat3ra/made": "2025.7.15-0",
59
58
  "@mat3ra/standata": "2025.11.12-0",
60
59
  "chai": "^4.3.4",
@@ -76,7 +75,7 @@
76
75
  },
77
76
  "peerDependencies": {
78
77
  "@mat3ra/ade": "*",
79
- "@exabyte-io/ide.js": "*",
78
+ "@mat3ra/ide": "*",
80
79
  "@mat3ra/mode": "*",
81
80
  "@mat3ra/standata": "*",
82
81
  "@mat3ra/utils": "*",
@@ -1,10 +1,13 @@
1
- import JSONSchemaFormDataProvider from "@mat3ra/ade/dist/js/context/JSONSchemaFormDataProvider";
1
+ import { JSONSchemaFormDataProvider } from "@mat3ra/ade";
2
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
3
  import { Made } from "@mat3ra/made";
3
4
  import { Utils } from "@mat3ra/utils";
4
5
 
5
6
  import { materialContextMixin } from "../mixins/MaterialContextMixin";
6
7
 
7
8
  export class BoundaryConditionsFormDataProvider extends JSONSchemaFormDataProvider {
9
+ jsonSchemaId = "context-providers-directory/boundary-conditions-data-provider";
10
+
8
11
  constructor(config) {
9
12
  super(config);
10
13
  this.initMaterialContextMixin();
@@ -24,6 +27,17 @@ export class BoundaryConditionsFormDataProvider extends JSONSchemaFormDataProvid
24
27
  };
25
28
  }
26
29
 
30
+ get jsonSchemaPatchConfig() {
31
+ const defaults = this.defaultData;
32
+ return {
33
+ type: { default: defaults.type },
34
+ offset: { default: defaults.offset },
35
+ electricField: { default: defaults.electricField },
36
+ targetFermiEnergy: { default: defaults.targetFermiEnergy },
37
+ };
38
+ }
39
+
40
+ // TODO: MOVE to WA/wove instantiation
27
41
  // eslint-disable-next-line class-methods-use-this
28
42
  get uiSchema() {
29
43
  return {
@@ -48,32 +62,10 @@ export class BoundaryConditionsFormDataProvider extends JSONSchemaFormDataProvid
48
62
  }
49
63
 
50
64
  get jsonSchema() {
51
- return {
52
- $schema: "http://json-schema.org/draft-07/schema#",
53
- type: "object",
54
- properties: {
55
- type: {
56
- type: "string",
57
- title: "Type",
58
- default: this.defaultData.type,
59
- },
60
- offset: {
61
- type: "number",
62
- title: "Offset (A)",
63
- default: this.defaultData.offset,
64
- },
65
- electricField: {
66
- type: "number",
67
- title: "Electric Field (eV/A)",
68
- default: this.defaultData.electricField,
69
- },
70
- targetFermiEnergy: {
71
- type: "number",
72
- title: "Target Fermi Energy (eV)",
73
- default: this.defaultData.targetFermiEnergy,
74
- },
75
- },
76
- };
65
+ return JSONSchemasInterface.getPatchedSchemaById(
66
+ this.jsonSchemaId,
67
+ this.jsonSchemaPatchConfig,
68
+ );
77
69
  }
78
70
  }
79
71
 
@@ -1,9 +1,12 @@
1
- import JSONSchemaFormDataProvider from "@mat3ra/ade/dist/js/context/JSONSchemaFormDataProvider";
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 CollinearMagnetizationContextProvider extends JSONSchemaFormDataProvider {
8
+ jsonSchemaId = "context-providers-directory/collinear-magnetization-context-provider";
9
+
7
10
  constructor(config) {
8
11
  super(config);
9
12
 
@@ -37,6 +40,27 @@ export class CollinearMagnetizationContextProvider extends JSONSchemaFormDataPro
37
40
  };
38
41
  }
39
42
 
43
+ get jsonSchemaPatchConfig() {
44
+ return {
45
+ "properties.startingMagnetization": {
46
+ maxItems: this.uniqueElementsWithLabels.length,
47
+ },
48
+ "properties.startingMagnetization.items.properties.atomicSpecies": {
49
+ enum: this.uniqueElementsWithLabels,
50
+ default: this.firstElement,
51
+ },
52
+ "properties.startingMagnetization.items.properties.value": {
53
+ default: 0.0,
54
+ },
55
+ "properties.isTotalMagnetization": {
56
+ default: false,
57
+ },
58
+ "properties.totalMagnetization": {
59
+ default: 0.0,
60
+ },
61
+ };
62
+ }
63
+
40
64
  transformData = (data) => {
41
65
  const startingMagnetizationWithIndex = data.startingMagnetization.map((row) => ({
42
66
  ...row,
@@ -71,46 +95,10 @@ export class CollinearMagnetizationContextProvider extends JSONSchemaFormDataPro
71
95
  }
72
96
 
73
97
  get jsonSchema() {
74
- return {
75
- $schema: "http://json-schema.org/draft-07/schema#",
76
- title: "",
77
- description: "Set starting magnetization, can have values in the range [-1, +1].",
78
- type: "object",
79
- properties: {
80
- startingMagnetization: {
81
- type: "array",
82
- maxItems: this.uniqueElementsWithLabels.length,
83
- items: {
84
- type: "object",
85
- properties: {
86
- atomicSpecies: {
87
- type: "string",
88
- title: "Atomic species",
89
- enum: this.uniqueElementsWithLabels,
90
- default: this.firstElement,
91
- },
92
- value: {
93
- type: "number",
94
- title: "Starting magnetization",
95
- default: 0.0,
96
- minimum: -1.0,
97
- maximum: 1.0,
98
- },
99
- },
100
- },
101
- },
102
- isTotalMagnetization: {
103
- type: "boolean",
104
- title: "Set total magnetization instead",
105
- default: false,
106
- },
107
- totalMagnetization: {
108
- type: "number",
109
- title: "Total magnetization",
110
- default: 0.0,
111
- },
112
- },
113
- };
98
+ return JSONSchemasInterface.getPatchedSchemaById(
99
+ this.jsonSchemaId,
100
+ this.jsonSchemaPatchConfig,
101
+ );
114
102
  }
115
103
  }
116
104
 
@@ -1,3 +1,5 @@
1
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
+
1
3
  import { HubbardUContextProvider } from "./HubbardUContextProvider";
2
4
 
3
5
  const defaultHubbardConfig = {
@@ -5,6 +7,8 @@ const defaultHubbardConfig = {
5
7
  };
6
8
 
7
9
  export class HubbardContextProviderLegacy extends HubbardUContextProvider {
10
+ jsonSchemaId = "context-providers-directory/hubbard-legacy-context-provider";
11
+
8
12
  get defaultData() {
9
13
  return [
10
14
  {
@@ -15,6 +19,17 @@ export class HubbardContextProviderLegacy extends HubbardUContextProvider {
15
19
  ];
16
20
  }
17
21
 
22
+ get jsonSchemaPatchConfig() {
23
+ return {
24
+ "items.properties.atomicSpecies": {
25
+ enum: this.uniqueElementsWithLabels,
26
+ },
27
+ "items.properties.hubbardUValue": {
28
+ default: defaultHubbardConfig.hubbardUValue,
29
+ },
30
+ };
31
+ }
32
+
18
33
  speciesIndexFromSpecies = (species) => {
19
34
  return this.uniqueElementsWithLabels?.length > 0
20
35
  ? this.uniqueElementsWithLabels.indexOf(species) + 1
@@ -44,32 +59,9 @@ export class HubbardContextProviderLegacy extends HubbardUContextProvider {
44
59
  }
45
60
 
46
61
  get jsonSchema() {
47
- return {
48
- $schema: "http://json-schema.org/draft-07/schema#",
49
- title: "",
50
- description: "Hubbard parameters for DFT+U calculation.",
51
- type: "array",
52
- uniqueItems: true,
53
- minItems: 1,
54
- items: {
55
- type: "object",
56
- properties: {
57
- atomicSpecies: {
58
- type: "string",
59
- title: "Atomic species",
60
- enum: this.uniqueElementsWithLabels,
61
- },
62
- atomicSpeciesIndex: {
63
- type: "integer",
64
- title: "Species index",
65
- },
66
- hubbardUValue: {
67
- type: "number",
68
- title: "Hubbard U (eV)",
69
- default: defaultHubbardConfig.hubbardUValue,
70
- },
71
- },
72
- },
73
- };
62
+ return JSONSchemasInterface.getPatchedSchemaById(
63
+ this.jsonSchemaId,
64
+ this.jsonSchemaPatchConfig,
65
+ );
74
66
  }
75
67
  }
@@ -1,3 +1,5 @@
1
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
+
1
3
  import { HubbardUContextProvider } from "./HubbardUContextProvider";
2
4
 
3
5
  const defaultHubbardConfig = {
@@ -8,6 +10,8 @@ const defaultHubbardConfig = {
8
10
  };
9
11
 
10
12
  export class HubbardJContextProvider extends HubbardUContextProvider {
13
+ jsonSchemaId = "context-providers-directory/hubbard-j-context-provider";
14
+
11
15
  get defaultData() {
12
16
  return [
13
17
  {
@@ -17,6 +21,25 @@ export class HubbardJContextProvider extends HubbardUContextProvider {
17
21
  ];
18
22
  }
19
23
 
24
+ get jsonSchemaPatchConfig() {
25
+ return {
26
+ "items.properties.paramType": {
27
+ default: defaultHubbardConfig.paramType,
28
+ },
29
+ "items.properties.atomicSpecies": {
30
+ enum: this.uniqueElementsWithLabels,
31
+ default: this.firstElement,
32
+ },
33
+ "items.properties.atomicOrbital": {
34
+ enum: this.orbitalList,
35
+ default: defaultHubbardConfig.atomicOrbital,
36
+ },
37
+ "items.properties.value": {
38
+ default: defaultHubbardConfig.value,
39
+ },
40
+ };
41
+ }
42
+
20
43
  get uiSchemaStyled() {
21
44
  return {
22
45
  "ui:options": {
@@ -34,40 +57,9 @@ export class HubbardJContextProvider extends HubbardUContextProvider {
34
57
  }
35
58
 
36
59
  get jsonSchema() {
37
- return {
38
- $schema: "http://json-schema.org/draft-07/schema#",
39
- title: "",
40
- description: "Hubbard parameters for DFT+U+J calculation.",
41
- type: "array",
42
- items: {
43
- type: "object",
44
- properties: {
45
- paramType: {
46
- type: "string",
47
- title: "Species",
48
- enum: ["U", "J", "B", "E2", "E3"],
49
- default: defaultHubbardConfig.paramType,
50
- },
51
- atomicSpecies: {
52
- type: "string",
53
- title: "Species",
54
- enum: this.uniqueElementsWithLabels,
55
- default: this.firstElement,
56
- },
57
- atomicOrbital: {
58
- type: "string",
59
- title: "Orbital",
60
- enum: this.orbitalList,
61
- default: defaultHubbardConfig.atomicOrbital,
62
- },
63
- value: {
64
- type: "number",
65
- title: "Value (eV)",
66
- default: defaultHubbardConfig.value,
67
- },
68
- },
69
- },
70
- minItems: 1,
71
- };
60
+ return JSONSchemasInterface.getPatchedSchemaById(
61
+ this.jsonSchemaId,
62
+ this.jsonSchemaPatchConfig,
63
+ );
72
64
  }
73
65
  }