Skip to content

Commit

Permalink
SOF-7298: implement fixed magnetization and set constrained magnetiza…
Browse files Browse the repository at this point in the history
…tion independently
  • Loading branch information
pranabdas committed Apr 21, 2024
1 parent 4832d18 commit 222fe60
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 22 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -46,8 +46,8 @@
"underscore.string": "^3.3.4"
},
"devDependencies": {
"@exabyte-io/ade.js": "git+https://github.com/Exabyte-io/ade.js.git#b06b8ec779e63bb273074ad9137e01ee87a36686",
"@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#a57b279e32fe09401a929c67e8939cdb383328a9",
"@exabyte-io/ade.js": "git+https://github.com/Exabyte-io/ade.js.git#6cef4220aad232681b530e9d8088c5e65e98b0d8",
"@exabyte-io/application-flavors.js": "git+https://github.com/Exabyte-io/application-flavors.git#bcbd691f03369e7cb57bc0b21801e7d76e9a1e53",
"@exabyte-io/eslint-config": "^2022.11.17-0",
"@exabyte-io/ide.js": "2024.3.26-0",
"@exabyte-io/mode.js": "2024.4.19-0",
Expand Down
86 changes: 70 additions & 16 deletions src/context/providers/NonCollinearMagnetizationContextProvider.js
Expand Up @@ -17,6 +17,8 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
false,
);
this.isExistingChargeDensity = lodash.get(this.data, "isExistingChargeDensity", false);
this.isArbitrarySpinDirection = lodash.get(this.data, "isArbitrarySpinDirection", false);
this.isFixedMagnetization = lodash.get(this.data, "isFixedMagnetization", false);
}

get uniqueElementsWithLabels() {
Expand Down Expand Up @@ -46,18 +48,26 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
isExistingChargeDensity: false,
isStartingMagnetization: true,
isConstrainedMagnetization: false,
isArbitrarySpinAngle: false,
isFixedMagnetization: false,
spinAngles,
startingMagnetization,
constrainedMagnetization: {
lambda: 0.0,
constrainType: "atomic direction",
},
fixedMagnetization: {
x: 0.0,
y: 0.0,
z: 0.0,
},
};
}

get uiSchemaStyled() {
return {
isExistingChargeDensity: {},
isArbitrarySpinDirection: {},
spinAngles: {
items: {
atomicSpecies: {
Expand Down Expand Up @@ -98,6 +108,20 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
lambda: this.defaultFieldStyles,
"ui:readonly": !this.isConstrainedMagnetization,
},
isFixedMagnetization: {
"ui:readonly":
!this.isConstrainedMagnetization &&
!(this.data.constrainedMagnetization.constrainType === "total"),
},
fixedMagnetization: {
x: this.defaultFieldStyles,
y: this.defaultFieldStyles,
z: this.defaultFieldStyles,
"ui:readonly":
this.isFixedMagnetization &&
!this.isConstrainedMagnetization &&
!(this.data.constrainedMagnetization.constrainType === "total"),
},
};
}

Expand All @@ -114,7 +138,12 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
title: "Start calculation from existing charge density",
default: false,
},
spinAngles: {
isStartingMagnetization: {
type: "boolean",
title: "Set starting magnetization",
default: true,
},
startingMagnetization: {
type: "array",
minItems: this.uniqueElementsWithLabels.length,
maxItems: this.uniqueElementsWithLabels.length,
Expand All @@ -125,25 +154,22 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
type: "string",
title: "Atomic species",
},
angle1: {
type: "number",
title: "Angle1 (deg)",
default: 0.0,
},
angle2: {
value: {
type: "number",
title: "Angle2 (deg)",
title: "Starting magnetization",
default: 0.0,
minimum: -1.0,
maximum: 1.0,
},
},
},
},
isStartingMagnetization: {
isArbitrarySpinDirection: {
type: "boolean",
title: "Set starting magnetization",
default: true,
title: "Set arbitrary spin direction",
default: false,
},
startingMagnetization: {
spinAngles: {
type: "array",
minItems: this.uniqueElementsWithLabels.length,
maxItems: this.uniqueElementsWithLabels.length,
Expand All @@ -154,12 +180,15 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
type: "string",
title: "Atomic species",
},
value: {
angle1: {
type: "number",
title: "Starting magnetization",
title: "Angle1 (deg)",
default: 0.0,
},
angle2: {
type: "number",
title: "Angle2 (deg)",
default: 0.0,
minimum: -1.0,
maximum: 1.0,
},
},
},
Expand Down Expand Up @@ -191,6 +220,31 @@ export class NonCollinearMagnetizationContextProvider extends mix(JSONSchemaForm
},
},
},
isFixedMagnetization: {
type: "boolean",
title: "Set Fixed magnetization (only applicable to constrained magnetization of 'total' type)",
default: true,
},
fixedMagnetization: {
type: "object",
properties: {
x: {
type: "number",
title: "x-component",
default: 0.0,
},
y: {
type: "number",
title: "y-component",
default: 0.0,
},
z: {
type: "number",
title: "z-component",
default: 0.0,
},
},
},
},
};
}
Expand Down

0 comments on commit 222fe60

Please sign in to comment.