Skip to content

SOF-7010: add valenceOrbitals getter to MethodDataContextMixin #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
7 changes: 7 additions & 0 deletions dist/js/context/mixins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export declare function MethodDataContextMixin<T extends Constructor>(superclass
_initMethodDataHash(): void;
readonly methodData: any;
readonly isMethodDataUpdated: boolean;
/**
* Returns array of orbital names: [{element: "Si", valenceOrbitals: ["3s", "3p"]}]
*/
readonly valenceOrbitals: {
element: string;
valenceOrbitals?: Array<string>;
}[];
};
} & T;
export declare function WorkflowContextMixin<T extends Constructor>(superclass: T): {
Expand Down
14 changes: 14 additions & 0 deletions dist/js/context/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ function MethodDataContextMixin(superclass) {
get isMethodDataUpdated() {
return Boolean(this.extraData && this.extraData.methodDataHash !== this.methodDataHash);
}
/**
* Returns array of orbital names: [{element: "Si", valenceOrbitals: ["3s", "3p"]}]
*/
get valenceOrbitals() {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should go to PseudopotentialMethod in Mode

var _a;
const pseudoData = ((_a = this.methodData) === null || _a === void 0 ? void 0 : _a.pseudo) || [];
return pseudoData.map((item) => {
const valenceConfiguration = (item === null || item === void 0 ? void 0 : item.valenceConfiguration) || [];
return {
element: item.element,
valenceOrbitals: valenceConfiguration.map((entry) => { var _a; return (_a = entry === null || entry === void 0 ? void 0 : entry.orbitalName) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }),
};
});
}
};
}
function WorkflowContextMixin(superclass) {
Expand Down
10 changes: 6 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@babel/register": "^7.25.7",
"@babel/runtime-corejs3": "^7.25.7",
"@exabyte-io/eslint-config": "^2025.1.15-0",
"@mat3ra/esse": "2025.4.22-0",
"@mat3ra/esse": "2025.4.26-0",
"@mat3ra/tsconfig": "2024.6.3-0",
"@types/chai": "^4.3.20",
"@types/crypto-js": "^4.2.2",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ dependencies = [
"numpy",
"jsonschema>=2.6.0",
"pydantic>=2.7.1",
"mat3ra-esse>=2025.4.15.post0",
"mat3ra-utils>=2024.5.15.post0",
"mat3ra-esse>=2025.4.22.post0",
"mat3ra-utils>=2025.4.15.post0",
]

[project.optional-dependencies]
Expand Down
17 changes: 17 additions & 0 deletions src/js/context/mixins.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
ApplicationSchemaBase,
FileDataItem,
JobSchema,
MaterialSchema,
WorkflowSchema,
Expand Down Expand Up @@ -189,6 +190,22 @@ export function MethodDataContextMixin<T extends Constructor>(superclass: T) {
get isMethodDataUpdated() {
return Boolean(this.extraData && this.extraData.methodDataHash !== this.methodDataHash);
}

/**
* Returns array of orbital names: [{element: "Si", valenceOrbitals: ["3s", "3p"]}]
*/
get valenceOrbitals(): { element: string; valenceOrbitals?: Array<string> }[] {
Copy link
Member

Choose a reason for hiding this comment

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

Should this go to PseudopotentialMethod?

const pseudoData = this.methodData?.pseudo || [];
return pseudoData.map((item: FileDataItem) => {
const valenceConfiguration = item?.valenceConfiguration || [];
return {
element: item.element,
valenceOrbitals: valenceConfiguration.map((entry) =>
entry?.orbitalName?.toLowerCase(),
),
};
});
}
};
}

Expand Down
Loading