@exabyte-io/wode.js
Advanced tools
Comparing version 2024.3.29-0 to 2024.4.5-0
@@ -154,5 +154,5 @@ "use strict"; | ||
config: _makeImportant({ | ||
name: "starting_magnetization" | ||
name: "collinearMagnetization" | ||
}) | ||
} | ||
}; |
@@ -9,3 +9,5 @@ "use strict"; | ||
var _made = require("@mat3ra/made"); | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var _mixwith = require("mixwith"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -15,4 +17,5 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); } | ||
class CollinearMagnetizationContextProvider extends (0, _mixwith.mix)(_context.JSONSchemaFormDataProvider).with(_context.MaterialContextMixin) { | ||
constructor(...args) { | ||
super(...args); | ||
constructor(config) { | ||
var _this$uniqueElementsW; | ||
super(config); | ||
_defineProperty(this, "indexOfElement", element => { | ||
@@ -22,7 +25,13 @@ return this.uniqueElementsWithLabels.indexOf(element) + 1; | ||
_defineProperty(this, "transformData", data => { | ||
return data.map(row => ({ | ||
const startingMagnetizationWithIndex = data.startingMagnetization.map(row => ({ | ||
...row, | ||
index: this.indexOfElement(row.atomicSpecies) | ||
})); | ||
return { | ||
...data, | ||
startingMagnetization: startingMagnetizationWithIndex | ||
}; | ||
}); | ||
this.firstElement = ((_this$uniqueElementsW = this.uniqueElementsWithLabels) === null || _this$uniqueElementsW === void 0 ? void 0 : _this$uniqueElementsW.length) > 0 ? this.uniqueElementsWithLabels[0] : ""; | ||
this.isTotalMagnetization = _lodash.default.get(this.data, "isTotalMagnetization", false); | ||
} | ||
@@ -34,23 +43,31 @@ get uniqueElementsWithLabels() { | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
get defaultData() { | ||
var _this$uniqueElementsW; | ||
return [{ | ||
index: 1, | ||
atomicSpecies: ((_this$uniqueElementsW = this.uniqueElementsWithLabels) === null || _this$uniqueElementsW === void 0 ? void 0 : _this$uniqueElementsW.length) > 0 ? this.uniqueElementsWithLabels[0] : "", | ||
value: 0.0 | ||
}]; | ||
return { | ||
startingMagnetization: [{ | ||
index: 1, | ||
atomicSpecies: this.firstElement, | ||
value: 0.0 | ||
}], | ||
isTotalMagnetization: false, | ||
totalMagnetization: 0.0 | ||
}; | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
get uiSchemaStyled() { | ||
return { | ||
"ui:options": { | ||
addable: true, | ||
orderable: false, | ||
removable: true | ||
startingMagnetization: { | ||
items: { | ||
atomicSpecies: { | ||
"ui:classNames": "col-xs-3" | ||
}, | ||
value: { | ||
"ui:classNames": "col-xs-6" | ||
} | ||
}, | ||
"ui:readonly": this.isTotalMagnetization | ||
}, | ||
items: { | ||
atomicSpecies: this.defaultFieldStyles, | ||
value: { | ||
"ui:classNames": "col-xs-6 " | ||
} | ||
isTotalMagnetization: {}, | ||
totalMagnetization: { | ||
"ui:classNames": "col-xs-6", | ||
"ui:readonly": !this.isTotalMagnetization | ||
} | ||
@@ -60,24 +77,39 @@ }; | ||
get jsonSchema() { | ||
var _this$uniqueElementsW2; | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
description: "Set starting magnetization, can have values in the range [-1, +1].", | ||
type: "array", | ||
items: { | ||
type: "object", | ||
properties: { | ||
atomicSpecies: { | ||
type: "string", | ||
title: "Atomic species", | ||
enum: this.uniqueElementsWithLabels, | ||
default: ((_this$uniqueElementsW2 = this.uniqueElementsWithLabels) === null || _this$uniqueElementsW2 === void 0 ? void 0 : _this$uniqueElementsW2.length) > 0 ? this.uniqueElementsWithLabels[0] : "" | ||
}, | ||
value: { | ||
type: "number", | ||
title: "Starting magnetization", | ||
default: 0.0, | ||
minimum: -1.0, | ||
maximum: 1.0 | ||
type: "object", | ||
properties: { | ||
startingMagnetization: { | ||
type: "array", | ||
maxItems: this.uniqueElementsWithLabels.length, | ||
items: { | ||
type: "object", | ||
properties: { | ||
atomicSpecies: { | ||
type: "string", | ||
title: "Atomic species", | ||
enum: this.uniqueElementsWithLabels, | ||
default: this.firstElement | ||
}, | ||
value: { | ||
type: "number", | ||
title: "Starting magnetization", | ||
default: 0.0, | ||
minimum: -1.0, | ||
maximum: 1.0 | ||
} | ||
} | ||
} | ||
}, | ||
isTotalMagnetization: { | ||
type: "boolean", | ||
title: "Set total magnetization instead", | ||
default: false | ||
}, | ||
totalMagnetization: { | ||
type: "number", | ||
title: "Total magnetization", | ||
default: 0.0 | ||
} | ||
@@ -84,0 +116,0 @@ } |
@@ -43,5 +43,2 @@ "use strict"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12" | ||
}, | ||
items: { | ||
@@ -48,0 +45,0 @@ atomicSpecies: this.defaultFieldStyles, |
@@ -28,5 +28,2 @@ "use strict"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12" | ||
}, | ||
items: { | ||
@@ -42,3 +39,3 @@ paramType: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -45,0 +42,0 @@ description: "Hubbard parameters for DFT+U+J calculation.", |
@@ -41,5 +41,2 @@ "use strict"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12" | ||
}, | ||
items: { | ||
@@ -54,3 +51,3 @@ atomicSpecies: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -57,0 +54,0 @@ description: "Hubbard U parameters for DFT+U or DFT+U+V calculation.", |
@@ -41,5 +41,2 @@ "use strict"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12" | ||
}, | ||
items: { | ||
@@ -59,3 +56,3 @@ atomicSpecies: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -62,0 +59,0 @@ description: "Hubbard V parameters for DFT+U+V calculation.", |
@@ -33,3 +33,3 @@ "use strict"; | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
type: "object", | ||
@@ -36,0 +36,0 @@ description: "Important parameters for molecular dynamics calculation", |
{ | ||
"name": "@exabyte-io/wode.js", | ||
"version": "2024.3.29-0", | ||
"version": "2024.4.5-0", | ||
"description": "WOrkflow DEfinitions", | ||
@@ -49,4 +49,4 @@ "scripts": { | ||
"devDependencies": { | ||
"@exabyte-io/ade.js": "2024.3.29-0", | ||
"@exabyte-io/application-flavors.js": "2024.3.29-0", | ||
"@exabyte-io/ade.js": "2024.4.5-0", | ||
"@exabyte-io/application-flavors.js": "2024.4.5-0", | ||
"@exabyte-io/eslint-config": "^2022.11.17-0", | ||
@@ -53,0 +53,0 @@ "@exabyte-io/ide.js": "2024.3.26-0", |
@@ -108,4 +108,4 @@ import context from "./context"; | ||
providerCls: CollinearMagnetizationContextProvider, | ||
config: _makeImportant({ name: "starting_magnetization" }), | ||
config: _makeImportant({ name: "collinearMagnetization" }), | ||
}, | ||
}; |
import { JSONSchemaFormDataProvider, MaterialContextMixin } from "@mat3ra/code/dist/js/context"; | ||
import { Made } from "@mat3ra/made"; | ||
import lodash from "lodash"; | ||
import { mix } from "mixwith"; | ||
@@ -10,2 +11,9 @@ | ||
constructor(config) { | ||
super(config); | ||
this.firstElement = | ||
this.uniqueElementsWithLabels?.length > 0 ? this.uniqueElementsWithLabels[0] : ""; | ||
this.isTotalMagnetization = lodash.get(this.data, "isTotalMagnetization", false); | ||
} | ||
get uniqueElementsWithLabels() { | ||
@@ -20,36 +28,47 @@ const elementsWithLabelsArray = this.material?.Basis?.elementsWithLabelsArray || []; | ||
// eslint-disable-next-line class-methods-use-this | ||
get defaultData() { | ||
return [ | ||
{ | ||
index: 1, | ||
atomicSpecies: | ||
this.uniqueElementsWithLabels?.length > 0 | ||
? this.uniqueElementsWithLabels[0] | ||
: "", | ||
value: 0.0, | ||
}, | ||
]; | ||
return { | ||
startingMagnetization: [ | ||
{ | ||
index: 1, | ||
atomicSpecies: this.firstElement, | ||
value: 0.0, | ||
}, | ||
], | ||
isTotalMagnetization: false, | ||
totalMagnetization: 0.0, | ||
}; | ||
} | ||
transformData = (data) => { | ||
return data.map((row) => ({ | ||
const startingMagnetizationWithIndex = data.startingMagnetization.map((row) => ({ | ||
...row, | ||
index: this.indexOfElement(row.atomicSpecies), | ||
})); | ||
return { | ||
...data, | ||
startingMagnetization: startingMagnetizationWithIndex, | ||
}; | ||
}; | ||
// eslint-disable-next-line class-methods-use-this | ||
get uiSchemaStyled() { | ||
return { | ||
"ui:options": { | ||
addable: true, | ||
orderable: false, | ||
removable: true, | ||
}, | ||
items: { | ||
atomicSpecies: this.defaultFieldStyles, | ||
value: { | ||
"ui:classNames": "col-xs-6 ", | ||
startingMagnetization: { | ||
items: { | ||
atomicSpecies: { | ||
"ui:classNames": "col-xs-3", | ||
}, | ||
value: { | ||
"ui:classNames": "col-xs-6", | ||
}, | ||
}, | ||
"ui:readonly": this.isTotalMagnetization, | ||
}, | ||
isTotalMagnetization: {}, | ||
totalMagnetization: { | ||
"ui:classNames": "col-xs-6", | ||
"ui:readonly": !this.isTotalMagnetization, | ||
}, | ||
}; | ||
@@ -60,26 +79,39 @@ } | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
description: "Set starting magnetization, can have values in the range [-1, +1].", | ||
type: "array", | ||
items: { | ||
type: "object", | ||
properties: { | ||
atomicSpecies: { | ||
type: "string", | ||
title: "Atomic species", | ||
enum: this.uniqueElementsWithLabels, | ||
default: | ||
this.uniqueElementsWithLabels?.length > 0 | ||
? this.uniqueElementsWithLabels[0] | ||
: "", | ||
type: "object", | ||
properties: { | ||
startingMagnetization: { | ||
type: "array", | ||
maxItems: this.uniqueElementsWithLabels.length, | ||
items: { | ||
type: "object", | ||
properties: { | ||
atomicSpecies: { | ||
type: "string", | ||
title: "Atomic species", | ||
enum: this.uniqueElementsWithLabels, | ||
default: this.firstElement, | ||
}, | ||
value: { | ||
type: "number", | ||
title: "Starting magnetization", | ||
default: 0.0, | ||
minimum: -1.0, | ||
maximum: 1.0, | ||
}, | ||
}, | ||
}, | ||
value: { | ||
type: "number", | ||
title: "Starting magnetization", | ||
default: 0.0, | ||
minimum: -1.0, | ||
maximum: 1.0, | ||
}, | ||
}, | ||
isTotalMagnetization: { | ||
type: "boolean", | ||
title: "Set total magnetization instead", | ||
default: false, | ||
}, | ||
totalMagnetization: { | ||
type: "number", | ||
title: "Total magnetization", | ||
default: 0.0, | ||
}, | ||
}, | ||
@@ -86,0 +118,0 @@ }; |
@@ -38,5 +38,2 @@ import { HubbardUContextProvider } from "./HubbardUContextProvider"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12", | ||
}, | ||
items: { | ||
@@ -43,0 +40,0 @@ atomicSpecies: this.defaultFieldStyles, |
@@ -27,5 +27,2 @@ import { HubbardUContextProvider } from "./HubbardUContextProvider"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12", | ||
}, | ||
items: { | ||
@@ -42,3 +39,3 @@ paramType: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -45,0 +42,0 @@ description: "Hubbard parameters for DFT+U+J calculation.", |
@@ -61,5 +61,2 @@ import { JSONSchemaFormDataProvider, MaterialContextMixin } from "@mat3ra/code/dist/js/context"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12", | ||
}, | ||
items: { | ||
@@ -75,3 +72,3 @@ atomicSpecies: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -78,0 +75,0 @@ description: "Hubbard U parameters for DFT+U or DFT+U+V calculation.", |
@@ -43,5 +43,2 @@ import { HubbardUContextProvider } from "./HubbardUContextProvider"; | ||
}, | ||
title: { | ||
"ui:classNames": "col-xs-12", | ||
}, | ||
items: { | ||
@@ -61,3 +58,3 @@ atomicSpecies: this.defaultFieldStyles, | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
title: "", | ||
@@ -64,0 +61,0 @@ description: "Hubbard V parameters for DFT+U+V calculation.", |
@@ -29,3 +29,3 @@ import { JSONSchemaFormDataProvider } from "@mat3ra/code/dist/js/context"; | ||
return { | ||
$schema: "http://json-schema.org/draft-04/schema#", | ||
$schema: "http://json-schema.org/draft-07/schema#", | ||
type: "object", | ||
@@ -32,0 +32,0 @@ description: "Important parameters for molecular dynamics calculation", |
435247
8277