Skip to content

Commit e8d2fc7

Browse files
authored
Merge pull request #116 from Exabyte-io/feature/SOF-7753-1
Feature/SOF-7753-1 Update: add all CPs
2 parents b4cf2ca + 05d35ec commit e8d2fc7

30 files changed

+1128
-952
lines changed

dist/js/context/providers/BoundaryConditionsFormDataProvider.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
55
});
66
exports.BoundaryConditionsFormDataProvider = void 0;
77
var _ade = require("@mat3ra/ade");
8+
var _JSONSchemasInterface = _interopRequireDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
89
var _made = require("@mat3ra/made");
910
var _utils = require("@mat3ra/utils");
1011
var _MaterialContextMixin = require("../mixins/MaterialContextMixin");
12+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13+
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; }
14+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
15+
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); }
1116
class BoundaryConditionsFormDataProvider extends _ade.JSONSchemaFormDataProvider {
1217
constructor(config) {
1318
super(config);
19+
_defineProperty(this, "jsonSchemaId", "context-providers-directory/boundary-conditions-data-provider");
1420
this.initMaterialContextMixin();
1521
}
1622
get boundaryConditions() {
@@ -26,7 +32,25 @@ class BoundaryConditionsFormDataProvider extends _ade.JSONSchemaFormDataProvider
2632
targetFermiEnergy: 0
2733
};
2834
}
35+
get jsonSchemaPatchConfig() {
36+
const defaults = this.defaultData;
37+
return {
38+
type: {
39+
default: defaults.type
40+
},
41+
offset: {
42+
default: defaults.offset
43+
},
44+
electricField: {
45+
default: defaults.electricField
46+
},
47+
targetFermiEnergy: {
48+
default: defaults.targetFermiEnergy
49+
}
50+
};
51+
}
2952

53+
// TODO: MOVE to WA/wove instantiation
3054
// eslint-disable-next-line class-methods-use-this
3155
get uiSchema() {
3256
return {
@@ -53,32 +77,7 @@ class BoundaryConditionsFormDataProvider extends _ade.JSONSchemaFormDataProvider
5377
return data;
5478
}
5579
get jsonSchema() {
56-
return {
57-
$schema: "http://json-schema.org/draft-07/schema#",
58-
type: "object",
59-
properties: {
60-
type: {
61-
type: "string",
62-
title: "Type",
63-
default: this.defaultData.type
64-
},
65-
offset: {
66-
type: "number",
67-
title: "Offset (A)",
68-
default: this.defaultData.offset
69-
},
70-
electricField: {
71-
type: "number",
72-
title: "Electric Field (eV/A)",
73-
default: this.defaultData.electricField
74-
},
75-
targetFermiEnergy: {
76-
type: "number",
77-
title: "Target Fermi Energy (eV)",
78-
default: this.defaultData.targetFermiEnergy
79-
}
80-
}
81-
};
80+
return _JSONSchemasInterface.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
8281
}
8382
}
8483
exports.BoundaryConditionsFormDataProvider = BoundaryConditionsFormDataProvider;

dist/js/context/providers/CollinearMagnetizationContextProvider.js

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
55
});
66
exports.CollinearMagnetizationContextProvider = void 0;
77
var _ade = require("@mat3ra/ade");
8+
var _JSONSchemasInterface = _interopRequireDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
89
var _lodash = _interopRequireDefault(require("lodash"));
910
var _MaterialContextMixin = require("../mixins/MaterialContextMixin");
1011
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -14,6 +15,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
1415
class CollinearMagnetizationContextProvider extends _ade.JSONSchemaFormDataProvider {
1516
constructor(config) {
1617
super(config);
18+
_defineProperty(this, "jsonSchemaId", "context-providers-directory/collinear-magnetization-context-provider");
1719
_defineProperty(this, "indexOfElement", element => {
1820
return this.uniqueElementsWithLabels.indexOf(element) + 1;
1921
});
@@ -46,6 +48,26 @@ class CollinearMagnetizationContextProvider extends _ade.JSONSchemaFormDataProvi
4648
totalMagnetization: 0.0
4749
};
4850
}
51+
get jsonSchemaPatchConfig() {
52+
return {
53+
"properties.startingMagnetization": {
54+
maxItems: this.uniqueElementsWithLabels.length
55+
},
56+
"properties.startingMagnetization.items.properties.atomicSpecies": {
57+
enum: this.uniqueElementsWithLabels,
58+
default: this.firstElement
59+
},
60+
"properties.startingMagnetization.items.properties.value": {
61+
default: 0.0
62+
},
63+
"properties.isTotalMagnetization": {
64+
default: false
65+
},
66+
"properties.totalMagnetization": {
67+
default: 0.0
68+
}
69+
};
70+
}
4971
get uiSchemaStyled() {
5072
return {
5173
startingMagnetization: {
@@ -67,46 +89,7 @@ class CollinearMagnetizationContextProvider extends _ade.JSONSchemaFormDataProvi
6789
};
6890
}
6991
get jsonSchema() {
70-
return {
71-
$schema: "http://json-schema.org/draft-07/schema#",
72-
title: "",
73-
description: "Set starting magnetization, can have values in the range [-1, +1].",
74-
type: "object",
75-
properties: {
76-
startingMagnetization: {
77-
type: "array",
78-
maxItems: this.uniqueElementsWithLabels.length,
79-
items: {
80-
type: "object",
81-
properties: {
82-
atomicSpecies: {
83-
type: "string",
84-
title: "Atomic species",
85-
enum: this.uniqueElementsWithLabels,
86-
default: this.firstElement
87-
},
88-
value: {
89-
type: "number",
90-
title: "Starting magnetization",
91-
default: 0.0,
92-
minimum: -1.0,
93-
maximum: 1.0
94-
}
95-
}
96-
}
97-
},
98-
isTotalMagnetization: {
99-
type: "boolean",
100-
title: "Set total magnetization instead",
101-
default: false
102-
},
103-
totalMagnetization: {
104-
type: "number",
105-
title: "Total magnetization",
106-
default: 0.0
107-
}
108-
}
109-
};
92+
return _JSONSchemasInterface.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
11093
}
11194
}
11295
exports.CollinearMagnetizationContextProvider = CollinearMagnetizationContextProvider;

dist/js/context/providers/HubbardContextProviderLegacy.js

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
44
value: true
55
});
66
exports.HubbardContextProviderLegacy = void 0;
7+
var _JSONSchemasInterface = _interopRequireDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
78
var _HubbardUContextProvider = require("./HubbardUContextProvider");
9+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
810
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; }
911
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
1012
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); }
@@ -14,6 +16,7 @@ const defaultHubbardConfig = {
1416
class HubbardContextProviderLegacy extends _HubbardUContextProvider.HubbardUContextProvider {
1517
constructor(...args) {
1618
super(...args);
19+
_defineProperty(this, "jsonSchemaId", "context-providers-directory/hubbard-legacy-context-provider");
1720
_defineProperty(this, "speciesIndexFromSpecies", species => {
1821
return this.uniqueElementsWithLabels?.length > 0 ? this.uniqueElementsWithLabels.indexOf(species) + 1 : null;
1922
});
@@ -31,6 +34,16 @@ class HubbardContextProviderLegacy extends _HubbardUContextProvider.HubbardUCont
3134
atomicSpeciesIndex: this.uniqueElementsWithLabels?.length > 0 ? 1 : null
3235
}];
3336
}
37+
get jsonSchemaPatchConfig() {
38+
return {
39+
"items.properties.atomicSpecies": {
40+
enum: this.uniqueElementsWithLabels
41+
},
42+
"items.properties.hubbardUValue": {
43+
default: defaultHubbardConfig.hubbardUValue
44+
}
45+
};
46+
}
3447
get uiSchemaStyled() {
3548
return {
3649
"ui:options": {
@@ -49,33 +62,7 @@ class HubbardContextProviderLegacy extends _HubbardUContextProvider.HubbardUCont
4962
};
5063
}
5164
get jsonSchema() {
52-
return {
53-
$schema: "http://json-schema.org/draft-07/schema#",
54-
title: "",
55-
description: "Hubbard parameters for DFT+U calculation.",
56-
type: "array",
57-
uniqueItems: true,
58-
minItems: 1,
59-
items: {
60-
type: "object",
61-
properties: {
62-
atomicSpecies: {
63-
type: "string",
64-
title: "Atomic species",
65-
enum: this.uniqueElementsWithLabels
66-
},
67-
atomicSpeciesIndex: {
68-
type: "integer",
69-
title: "Species index"
70-
},
71-
hubbardUValue: {
72-
type: "number",
73-
title: "Hubbard U (eV)",
74-
default: defaultHubbardConfig.hubbardUValue
75-
}
76-
}
77-
}
78-
};
65+
return _JSONSchemasInterface.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
7966
}
8067
}
8168
exports.HubbardContextProviderLegacy = HubbardContextProviderLegacy;

dist/js/context/providers/HubbardJContextProvider.js

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,47 @@ Object.defineProperty(exports, "__esModule", {
44
value: true
55
});
66
exports.HubbardJContextProvider = void 0;
7+
var _JSONSchemasInterface = _interopRequireDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
78
var _HubbardUContextProvider = require("./HubbardUContextProvider");
9+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10+
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; }
11+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
12+
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); }
813
const defaultHubbardConfig = {
914
paramType: "U",
1015
atomicSpecies: "",
1116
atomicOrbital: "2p",
1217
value: 1.0
1318
};
1419
class HubbardJContextProvider extends _HubbardUContextProvider.HubbardUContextProvider {
20+
constructor(...args) {
21+
super(...args);
22+
_defineProperty(this, "jsonSchemaId", "context-providers-directory/hubbard-j-context-provider");
23+
}
1524
get defaultData() {
1625
return [{
1726
...defaultHubbardConfig,
1827
atomicSpecies: this.firstElement
1928
}];
2029
}
30+
get jsonSchemaPatchConfig() {
31+
return {
32+
"items.properties.paramType": {
33+
default: defaultHubbardConfig.paramType
34+
},
35+
"items.properties.atomicSpecies": {
36+
enum: this.uniqueElementsWithLabels,
37+
default: this.firstElement
38+
},
39+
"items.properties.atomicOrbital": {
40+
enum: this.orbitalList,
41+
default: defaultHubbardConfig.atomicOrbital
42+
},
43+
"items.properties.value": {
44+
default: defaultHubbardConfig.value
45+
}
46+
};
47+
}
2148
get uiSchemaStyled() {
2249
return {
2350
"ui:options": {
@@ -34,41 +61,7 @@ class HubbardJContextProvider extends _HubbardUContextProvider.HubbardUContextPr
3461
};
3562
}
3663
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-
};
64+
return _JSONSchemasInterface.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
7265
}
7366
}
7467
exports.HubbardJContextProvider = HubbardJContextProvider;

0 commit comments

Comments
 (0)