Skip to content

Commit

Permalink
Merge pull request #56 from Exabyte-io/feat/SOF-7123
Browse files Browse the repository at this point in the history
SOF-7123: support DFT+U+V and DFT+U+J0 calculations in QE
  • Loading branch information
pranabdas authored Dec 21, 2023
2 parents 06e045f + 97ae6d5 commit f960053
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 31 deletions.
8 changes: 6 additions & 2 deletions src/context/context.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { BoundaryConditionsFormDataProvider } from "./providers/BoundaryConditionsFormDataProvider";
import { HubbardContextProvider } from "./providers/HubbardContextProvider";
import { HubbardContextProviderLegacy } from "./providers/HubbardContextProviderLegacy";
import { HubbardJContextProvider } from "./providers/HubbardJContextProvider";
import { HubbardUContextProvider } from "./providers/HubbardUContextProvider";
import { HubbardVContextProvider } from "./providers/HubbardVContextProvider";
import { MLSettingsContextProvider } from "./providers/MLSettingsContextProvider";
import { MLTrainTestSplitContextProvider } from "./providers/MLTrainTestSplitContextProvider";
import { NEBFormDataProvider } from "./providers/NEBFormDataProvider";
Expand All @@ -22,6 +24,8 @@ export default {
PointsPathFormDataProvider,
ExplicitPointsPathFormDataProvider,
ExplicitPointsPath2PIBAFormDataProvider,
HubbardContextProvider,
HubbardJContextProvider,
HubbardUContextProvider,
HubbardVContextProvider,
HubbardContextProviderLegacy,
};
18 changes: 14 additions & 4 deletions src/context/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const {
PointsPathFormDataProvider,
ExplicitPointsPathFormDataProvider,
ExplicitPointsPath2PIBAFormDataProvider,
HubbardContextProvider,
HubbardJContextProvider,
HubbardUContextProvider,
HubbardVContextProvider,
HubbardContextProviderLegacy,
} = context;

Expand Down Expand Up @@ -62,9 +64,17 @@ export const wodeProviders = {
providerCls: ExplicitPointsPath2PIBAFormDataProvider,
config: _makeImportant({ name: "explicitKPath2PIBA" }),
},
HubbardContextManager: {
providerCls: HubbardContextProvider,
config: _makeImportant({ name: "hubbard" }),
HubbardJContextManager: {
providerCls: HubbardJContextProvider,
config: _makeImportant({ name: "hubbard_j" }),
},
HubbardUContextManager: {
providerCls: HubbardUContextProvider,
config: _makeImportant({ name: "hubbard_u" }),
},
HubbardVContextManager: {
providerCls: HubbardVContextProvider,
config: _makeImportant({ name: "hubbard_v" }),
},
HubbardContextManagerLegacy: {
providerCls: HubbardContextProviderLegacy,
Expand Down
4 changes: 2 additions & 2 deletions src/context/providers/HubbardContextProviderLegacy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HubbardContextProvider } from "./HubbardContextProvider";
import { HubbardUContextProvider } from "./HubbardUContextProvider";

const defaultHubbardConfig = {
hubbardUValue: 1.0,
};

export class HubbardContextProviderLegacy extends HubbardContextProvider {
export class HubbardContextProviderLegacy extends HubbardUContextProvider {
get defaultData() {
return [
{
Expand Down
76 changes: 76 additions & 0 deletions src/context/providers/HubbardJContextProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { HubbardUContextProvider } from "./HubbardUContextProvider";

const defaultHubbardConfig = {
paramType: "U",
atomicSpecies: "",
atomicOrbital: "2p",
value: 1.0,
};

export class HubbardJContextProvider extends HubbardUContextProvider {
get defaultData() {
return [
{
...defaultHubbardConfig,
atomicSpecies: this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "",
},
];
}

get uiSchemaStyled() {
return {
"ui:options": {
addable: true,
orderable: true,
removable: true,
},
title: {
"ui:classNames": "col-xs-12",
},
items: {
paramType: this.defaultFieldStyles,
atomicSpecies: this.defaultFieldStyles,
atomicOrbital: this.defaultFieldStyles,
value: this.defaultFieldStyles,
},
};
}

get jsonSchema() {
return {
$schema: "http://json-schema.org/draft-04/schema#",
title: "",
description: "Hubbard parameters for DFT+U+J calculation.",
type: "array",
items: {
type: "object",
properties: {
paramType: {
type: "string",
title: "Species",
enum: ["U", "J", "B", "E2", "E3"],
default: defaultHubbardConfig.paramType,
},
atomicSpecies: {
type: "string",
title: "Species",
enum: this.uniqueElements,
default: this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "",
},
atomicOrbital: {
type: "string",
title: "Orbital",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
value: {
type: "number",
title: "Value (eV)",
default: defaultHubbardConfig.value,
},
},
},
minItems: 1,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,34 @@ const defaultHubbardConfig = {
hubbardUValue: 1.0,
};

export class HubbardContextProvider extends mix(JSONSchemaFormDataProvider).with(
export class HubbardUContextProvider extends mix(JSONSchemaFormDataProvider).with(
MaterialContextMixin,
) {
static Material = Made.Material;

constructor(config) {
super(config);
this.uniqueElements = this.material?.Basis?.uniqueElements || [];
this.orbitalList = [
"2p",
"3s",
"3p",
"3d",
"4s",
"4p",
"4d",
"4f",
"5s",
"5p",
"5d",
"5f",
"6s",
"6p",
"6d",
"7s",
"7p",
"7d",
];
}

get defaultData() {
Expand Down Expand Up @@ -49,7 +69,7 @@ export class HubbardContextProvider extends mix(JSONSchemaFormDataProvider).with
return {
$schema: "http://json-schema.org/draft-04/schema#",
title: "",
description: "Hubbard parameters for DFT+U calculation.",
description: "Hubbard U parameters for DFT+U or DFT+U+V calculation.",
type: "array",
items: {
type: "object",
Expand All @@ -63,26 +83,7 @@ export class HubbardContextProvider extends mix(JSONSchemaFormDataProvider).with
atomicOrbital: {
type: "string",
title: "Atomic orbital",
enum: [
"2p",
"3s",
"3p",
"3d",
"4s",
"4p",
"4d",
"4f",
"5s",
"5p",
"5d",
"5f",
"6s",
"6p",
"6d",
"7s",
"7p",
"7d",
],
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
hubbardUValue: {
Expand All @@ -92,7 +93,6 @@ export class HubbardContextProvider extends mix(JSONSchemaFormDataProvider).with
},
},
},
minItems: 1,
};
}
}
109 changes: 109 additions & 0 deletions src/context/providers/HubbardVContextProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { HubbardUContextProvider } from "./HubbardUContextProvider";

const defaultHubbardConfig = {
atomicSpecies: "",
atomicOrbital: "2p",
atomicSpecies2: "",
atomicOrbital2: "2p",
siteIndex: 1,
siteIndex2: 1,
hubbardVValue: 1.0,
};

export class HubbardVContextProvider extends HubbardUContextProvider {
get defaultData() {
return [
{
...defaultHubbardConfig,
atomicSpecies: this.firstSpecies,
atomicSpecies2: this.secondSpecies,
siteIndex2: this.uniqueElements?.length > 1 ? 2 : defaultHubbardConfig.siteIndex2,
},
];
}

get firstSpecies() {
return this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "";
}

get secondSpecies() {
return this.uniqueElements?.length > 1 ? this.uniqueElements[1] : this.firstSpecies;
}

get uiSchemaStyled() {
return {
"ui:options": {
addable: true,
orderable: true,
removable: true,
},
title: {
"ui:classNames": "col-xs-12",
},
items: {
atomicSpecies: this.defaultFieldStyles,
atomicOrbital: this.defaultFieldStyles,
atomicSpecies2: this.defaultFieldStyles,
atomicOrbital2: this.defaultFieldStyles,
siteIndex: this.defaultFieldStyles,
siteIndex2: this.defaultFieldStyles,
hubbardVValue: this.defaultFieldStyles,
},
};
}

get jsonSchema() {
return {
$schema: "http://json-schema.org/draft-04/schema#",
title: "",
description: "Hubbard V parameters for DFT+U+V calculation.",
type: "array",
items: {
type: "object",
properties: {
atomicSpecies: {
type: "string",
title: "Species 1",
enum: this.uniqueElements,
default: this.firstSpecies,
},
siteIndex: {
type: "integer",
title: "Site no 1",
default: defaultHubbardConfig.siteIndex,
},
atomicOrbital: {
type: "string",
title: "Orbital 1",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
atomicSpecies2: {
type: "string",
title: "Species 2",
enum: this.uniqueElements,
default: this.secondSpecies,
},
siteIndex2: {
type: "integer",
title: "Site no 2",
default:
this.uniqueElements?.length > 1 ? 2 : defaultHubbardConfig.siteIndex2,
},
atomicOrbital2: {
type: "string",
title: "Orbital 2",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
hubbardVValue: {
type: "number",
title: "V (eV)",
default: defaultHubbardConfig.hubbardVValue,
},
},
},
minItems: 1,
};
}
}

0 comments on commit f960053

Please sign in to comment.