Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
16bbfa7
SOF-7010: obtain valence configuration from pseudo data
pranabdas Mar 2, 2025
7cb0a61
SOF-7010: fix schema dependency
pranabdas Mar 2, 2025
28587f6
SOF-7010: fix schema dependency x2
pranabdas Mar 2, 2025
1321800
SOF-7010: remove dependent schema from properties
pranabdas Mar 2, 2025
0cef3bf
SOF-7010: include U value in the dependencies
pranabdas Mar 2, 2025
2c2fc6c
SOF-7010: fix schema
pranabdas Mar 2, 2025
681a4fc
SOF-7010: try fix for default data
pranabdas Mar 3, 2025
776c372
SOF-7010: remove hubbard u from the dependency of atomic species
pranabdas Mar 3, 2025
b688f8a
SOF-7010: combine orbital list and orbitals by stability and other im…
pranabdas Mar 4, 2025
6407fb4
SOF-7010: extend valence config implementation for DFT+U+J case
pranabdas Mar 4, 2025
c892bdc
SOF-7010: extend valence config implementation for DFT+U+V case
pranabdas Mar 4, 2025
f793e08
SOF-7010: use every instead of forEach and break when first match is …
pranabdas Mar 6, 2025
44196fb
SOF-7010: refactor getElementSymbol into a separate method
pranabdas Mar 23, 2025
7383509
SOF-7010: chore ==> rename orbitalList to orbitalListByStability
pranabdas Mar 23, 2025
88d682c
SOF-7010: refactor jsonschema dependency array into separate method
pranabdas Mar 23, 2025
c6f200c
SOF-7010: refactor get outermost orbital into separate method
pranabdas Mar 23, 2025
9929d74
SOF-7010: getElementSymbol method is now moved to made material
pranabdas Apr 5, 2025
5b459bd
SOF-7010: update made
pranabdas Apr 5, 2025
85557f5
SOF-7010: update ade.js
pranabdas Apr 5, 2025
ff5f287
SOF-7010: fix made Material class ref
pranabdas Apr 5, 2025
769c0ce
SOF-7010: use Basis from Made + revert to previous ade.js
pranabdas Apr 5, 2025
f05099e
SOF-7010: use sortArrayByOrder from @mat3ra/utils
pranabdas Apr 6, 2025
4ca59f1
SOF-7010: remove sortArrayByOrder from wode.js/utils
pranabdas Apr 6, 2025
8c92ddc
SOF-7010: use get valenceOrbitals getter from MethodDataContextMixin
pranabdas Apr 6, 2025
6cf6ab2
SOF-7010: fix typo
pranabdas Apr 7, 2025
f97626b
SOF-7010: fix typo
pranabdas Apr 7, 2025
548585a
SOF-7010: fix valence orbitals
pranabdas Apr 7, 2025
4ddb776
SOF-7010: fix valence orbitals x2
pranabdas Apr 7, 2025
18a8a42
SOF-7010: update code.js
pranabdas Apr 9, 2025
c8e1adf
merge main and resolve conflicts
pranabdas Aug 1, 2025
2800b06
move valenceOrbitals getter to wode
pranabdas Aug 1, 2025
6bc9d06
move getValenceOrbitalsByElement to method data context mixin
pranabdas Aug 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,114 changes: 2,999 additions & 2,115 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@babel/preset-react": "7.16.7",
"@babel/register": "^7.16.0",
"@babel/runtime-corejs3": "7.16.8",
"@mat3ra/utils": "2025.4.15-0",
"@exabyte-io/periodic-table.js": "2022.6.8-0",
"crypto-js": "^4.2.0",
"js-yaml": "^4.1.0",
Expand All @@ -56,7 +57,7 @@
"@exabyte-io/mode.js": "2024.4.28-0",
"@mat3ra/code": "2025.7.15-0",
"@mat3ra/esse": "2025.7.15-0",
"@mat3ra/made": "2025.7.15-0",
"@mat3ra/made": "git+https://github.com/Exabyte-io/made.git#c3d3cd3f40985126410c36090e78d28ae5300bca",
"chai": "^4.3.4",
"eslint": "7.32.0",
"eslint-config-airbnb": "19.0.2",
Expand Down
29 changes: 29 additions & 0 deletions src/context/mixins/MethodDataContextMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@ export function methodDataContextMixin(item) {
get isMethodDataUpdated() {
return Boolean(this.extraData && this.extraData.methodDataHash !== this.methodDataHash);
},

/**
* Returns array of orbital names: [{element: "Si", valenceOrbitals: ["3s", "3p"]}]
*/
get valenceOrbitals() {
const pseudoData = this.methodData?.pseudo || [];
return pseudoData.map((data) => {
const valenceConfiguration = data?.valenceConfiguration || [];
return {
element: data.element,
valenceOrbitals: valenceConfiguration.map((entry) =>
entry?.orbitalName?.toLowerCase(),
),
};
});
},

getValenceOrbitalsByElement(element) {
const valenceOrbitals = this.valenceOrbitals || [];
let orbitals = [];
valenceOrbitals.every((entry) => {
if (entry.element === element) {
orbitals = entry?.valenceOrbitals || [];
}
return entry.element !== element; // break when first match is found
});

return orbitals;
},
};

Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
Expand Down
14 changes: 11 additions & 3 deletions src/context/providers/HubbardJContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HubbardUContextProvider } from "./HubbardUContextProvider";
const defaultHubbardConfig = {
paramType: "U",
atomicSpecies: "",
atomicOrbital: "2p",
atomicOrbital: "3d",
value: 1.0,
};

Expand All @@ -13,6 +13,9 @@ export class HubbardJContextProvider extends HubbardUContextProvider {
{
...defaultHubbardConfig,
atomicSpecies: this.firstElement,
atomicOrbital: this.getOutermostOrbital(
this.getValenceOrbitalsByElement(this.firstElement),
),
},
];
}
Expand Down Expand Up @@ -57,15 +60,20 @@ export class HubbardJContextProvider extends HubbardUContextProvider {
atomicOrbital: {
type: "string",
title: "Orbital",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
value: {
type: "number",
title: "Value (eV)",
default: defaultHubbardConfig.value,
},
},
dependencies: {
atomicSpecies: this.orbitalDependencyArray(
this.uniqueElementsWithLabels,
"atomicSpecies",
"atomicOrbital",
),
},
},
minItems: 1,
};
Expand Down
70 changes: 59 additions & 11 deletions src/context/providers/HubbardUContextProvider.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import JSONSchemaFormDataProvider from "@exabyte-io/ade.js/dist/js/context/JSONSchemaFormDataProvider";
import { Made } from "@mat3ra/made";
import { Utils } from "@mat3ra/utils";

import { materialContextMixin } from "../mixins/MaterialContextMixin";
import { methodDataContextMixin } from "../mixins/MethodDataContextMixin";

const defaultHubbardConfig = {
atomicSpecies: "",
atomicOrbital: "2p",
atomicOrbital: "3d",
hubbardUValue: 1.0,
};

Expand All @@ -13,27 +16,31 @@ export class HubbardUContextProvider extends JSONSchemaFormDataProvider {
super(config);

this.initMaterialContextMixin();
this.initMethodDataContextMixin();

this.uniqueElements = this.material?.Basis?.uniqueElements || [];
this.orbitalList = [
// orbitals are sorted according to stability (Madelung's rule)
this.orbitalListByStability = [
"1s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.orbitalListByStability

"2s",
"2p",
"3s",
"3p",
"3d",
"4s",
"3d",
"4p",
"4d",
"4f",
"5s",
"4d",
"5p",
"5d",
"5f",
"6s",
"4f",
"5d",
"6p",
"6d",
"7s",
"5f",
"6d",
"7p",
"7d",
"8s",
];
const _elementsWithLabels = this.material?.Basis?.elementsWithLabelsArray || [];
this.uniqueElementsWithLabels = [...new Set(_elementsWithLabels)];
Expand All @@ -46,6 +53,9 @@ export class HubbardUContextProvider extends JSONSchemaFormDataProvider {
{
...defaultHubbardConfig,
atomicSpecies: this.firstElement,
atomicOrbital: this.getOutermostOrbital(
this.getValenceOrbitalsByElement(this.firstElement),
),
},
];
}
Expand All @@ -65,6 +75,38 @@ export class HubbardUContextProvider extends JSONSchemaFormDataProvider {
};
}

sortedValanceOrbitalsByElement = (element) => {
return Utils.array.sortArrayByOrder(
this.getValenceOrbitalsByElement(element),
this.orbitalListByStability,
);
};

orbitalDependencyArray = (elementList, atomicSpecies, atomicOrbital) => {
return {
oneOf: elementList.map((elementWithLabel) => {
const orbitals = this.sortedValanceOrbitalsByElement(
Made.Basis.stripLabelToGetElementSymbol(elementWithLabel),
);
return {
properties: {
[atomicSpecies]: {
enum: [elementWithLabel],
},
[atomicOrbital]: {
enum: orbitals.length > 0 ? orbitals : this.orbitalListByStability,
default: this.getOutermostOrbital(orbitals),
},
},
};
}),
};
};

getOutermostOrbital = (orbitals, defaultOrbital = defaultHubbardConfig.atomicOrbital) => {
return orbitals.length > 0 ? orbitals[orbitals.length - 1] : defaultOrbital;
};

get jsonSchema() {
return {
$schema: "http://json-schema.org/draft-07/schema#",
Expand All @@ -83,18 +125,24 @@ export class HubbardUContextProvider extends JSONSchemaFormDataProvider {
atomicOrbital: {
type: "string",
title: "Atomic orbital",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
hubbardUValue: {
type: "number",
title: "Hubbard U (eV)",
default: defaultHubbardConfig.hubbardUValue,
},
},
dependencies: {
atomicSpecies: this.orbitalDependencyArray(
this.uniqueElementsWithLabels,
"atomicSpecies",
"atomicOrbital",
),
},
},
};
}
}

materialContextMixin(HubbardUContextProvider.prototype);
methodDataContextMixin(HubbardUContextProvider.prototype);
27 changes: 21 additions & 6 deletions src/context/providers/HubbardVContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { HubbardUContextProvider } from "./HubbardUContextProvider";

const defaultHubbardConfig = {
atomicSpecies: "",
atomicOrbital: "2p",
atomicOrbital: "3d",
atomicSpecies2: "",
atomicOrbital2: "2p",
atomicOrbital2: "3d",
siteIndex: 1,
siteIndex2: 1,
hubbardVValue: 1.0,
Expand All @@ -19,6 +19,13 @@ export class HubbardVContextProvider extends HubbardUContextProvider {
atomicSpecies2: this.secondSpecies,
siteIndex2:
this.uniqueElementsWithLabels?.length > 1 ? 2 : defaultHubbardConfig.siteIndex2,
atomicOrbital: this.getOutermostOrbital(
this.getValenceOrbitalsByElement(this.firstSpecies),
),
atomicOrbital2: this.getOutermostOrbital(
this.getValenceOrbitalsByElement(this.secondSpecies),
defaultHubbardConfig.atomicOrbital2,
),
},
];
}
Expand Down Expand Up @@ -75,8 +82,6 @@ export class HubbardVContextProvider extends HubbardUContextProvider {
atomicOrbital: {
type: "string",
title: "Orbital 1",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
atomicSpecies2: {
type: "string",
Expand All @@ -95,15 +100,25 @@ export class HubbardVContextProvider extends HubbardUContextProvider {
atomicOrbital2: {
type: "string",
title: "Orbital 2",
enum: this.orbitalList,
default: defaultHubbardConfig.atomicOrbital,
},
hubbardVValue: {
type: "number",
title: "V (eV)",
default: defaultHubbardConfig.hubbardVValue,
},
},
dependencies: {
atomicSpecies: this.orbitalDependencyArray(
this.uniqueElementsWithLabels,
"atomicSpecies",
"atomicOrbital",
),
atomicSpecies2: this.orbitalDependencyArray(
this.uniqueElementsWithLabels,
"atomicSpecies2",
"atomicOrbital2",
),
},
},
minItems: 1,
};
Expand Down