Skip to content

Commit

Permalink
SOF-7323: add norm-conserving full-relativistic pseudo type
Browse files Browse the repository at this point in the history
  • Loading branch information
pranabdas committed Apr 10, 2024
1 parent 92e2896 commit 1d895aa
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
]
Expand Down
1 change: 1 addition & 0 deletions dist/js/schema/methods_category/physical/qm/wf/psp.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
],
Expand Down
2 changes: 2 additions & 0 deletions dist/js/schema/methods_directory/physical/psp.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
],
Expand Down Expand Up @@ -218,6 +219,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
]
Expand Down
1 change: 1 addition & 0 deletions dist/js/schema/methods_directory/physical/psp/file.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
]
Expand Down
2 changes: 1 addition & 1 deletion dist/js/schemas.json

Large diffs are not rendered by default.

33 changes: 12 additions & 21 deletions dist/js/scripts/compileTs.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const json_schema_to_typescript_1 = require("json-schema-to-typescript");
Expand Down Expand Up @@ -49,11 +47,7 @@ const filesystem_1 = require("../utils/filesystem");
function cleanSchema(schema) {
let firstRun = true;
return (0, schemaUtils_1.mapObjectDeep)(schema, (object) => {
if (
typeof object === "object" &&
(object === null || object === void 0 ? void 0 : object.title) &&
!firstRun
) {
if (typeof object === "object" && (object === null || object === void 0 ? void 0 : object.title) && !firstRun) {
firstRun = false;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { title, $schema, ...restObject } = object;
Expand All @@ -65,24 +59,21 @@ function cleanSchema(schema) {
async function compileTS(schemaPath, savePath) {
try {
await fs_1.default.promises.unlink(savePath);
} catch (err) {
}
catch (err) {
console.log("File with types not exists");
}
await (0, filesystem_1.walkDir)(schemaPath, async (filePath) => {
const data = await fs_1.default.promises.readFile(filePath, "utf8");
const schema = cleanSchema(JSON.parse(data));
console.log(`Compiling Typescript: ${filePath}`);
// @ts-ignore
const compiledSchema = await (0, json_schema_to_typescript_1.compile)(
schema,
schema.title || "",
{
unreachableDefinitions: true,
additionalProperties: false,
enableConstEnums: false,
bannerComment: `/** Schema ${filePath} */`,
},
);
const compiledSchema = await (0, json_schema_to_typescript_1.compile)(schema, schema.title || "", {
unreachableDefinitions: true,
additionalProperties: false,
enableConstEnums: false,
bannerComment: `/** Schema ${filePath} */`,
});
await fs_1.default.promises.appendFile(savePath, `${compiledSchema} \n`, { flag: "a+" });
});
}
Expand Down
10 changes: 5 additions & 5 deletions dist/js/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10839,7 +10839,7 @@ export interface PseudopotentialCategorySchema {
* machine-readable identifier
*/
slug: string;
} | string) & ("us" | "nc" | "paw" | "coulomb");
} | string) & ("us" | "nc" | "nc-fr" | "paw" | "coulomb");
/**
* contains either object with slugified entry or slug only as a string
*/
Expand Down Expand Up @@ -12270,7 +12270,7 @@ export interface PseudopotentialFile {
* MD5 hash of the pseudopotential file
*/
hash?: string;
type: "us" | "nc" | "paw" | "coulomb";
type: "us" | "nc" | "nc-fr" | "paw" | "coulomb";
/**
* explains where this came from
*/
Expand Down Expand Up @@ -12341,7 +12341,7 @@ export interface FileDataItem {
* MD5 hash of the pseudopotential file
*/
hash?: string;
type: "us" | "nc" | "paw" | "coulomb";
type: "us" | "nc" | "nc-fr" | "paw" | "coulomb";
/**
* explains where this came from
*/
Expand Down Expand Up @@ -12428,7 +12428,7 @@ export interface UnitMethodPseudopotential {
* machine-readable identifier
*/
slug: string;
} | string) & ("us" | "nc" | "paw" | "coulomb");
} | string) & ("us" | "nc" | "nc-fr" | "paw" | "coulomb");
/**
* contains either object with slugified entry or slug only as a string
*/
Expand Down Expand Up @@ -12480,7 +12480,7 @@ export interface UnitMethodPseudopotential {
* MD5 hash of the pseudopotential file
*/
hash?: string;
type: "us" | "nc" | "paw" | "coulomb";
type: "us" | "nc" | "nc-fr" | "paw" | "coulomb";
/**
* explains where this came from
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/js/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Type;
(function (Type) {
Type["fromIframeToHost"] = "from-iframe-to-host";
Type["fromHostToIframe"] = "from-host-to-iframe";
})((Type = exports.Type || (exports.Type = {})));
})(Type = exports.Type || (exports.Type = {}));
/**
* The action to be performed upon receiving the message.
*/
Expand All @@ -18,4 +18,4 @@ var Action;
Action["setData"] = "set-data";
Action["getData"] = "get-data";
Action["info"] = "info";
})((Action = exports.Action || (exports.Action = {})));
})(Action = exports.Action || (exports.Action = {}));
1 change: 1 addition & 0 deletions schema/methods_category/physical/qm/wf/enum_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"enum": [
"us",
"nc",
"nc-fr",
"paw",
"coulomb"
]
Expand Down
1 change: 1 addition & 0 deletions schema/methods_category/physical/qm/wf/enum_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pseudization:
pseudoSubtypes:
- us # ultra-soft
- nc # norm-conserving
- nc-fr # norm-conserving full-relativistic
- paw # projector augmented wave
- coulomb # Coulomb potential
#
Expand Down
2 changes: 1 addition & 1 deletion src/py/mat3ra/esse/data/examples.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/py/mat3ra/esse/data/properties.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import json
PROPERTIES_MANIFEST = json.loads(r'''{"convergence_ionic":{"defaults":{"units":"eV"},"schemaId":"properties-directory/workflow/convergence/ionic","isMonitor":true},"convergence_electronic":{"defaults":{"units":"eV"},"schemaId":"properties-directory/workflow/convergence/electronic","isMonitor":true},"pressure":{"defaults":{"units":"kbar"},"schemaId":"properties-directory/scalar/pressure","isResult":true},"total_energy":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/total-energy","isResult":true},"surface_energy":{"defaults":{"units":"eV/A^2"},"schemaId":"properties-directory/scalar/surface-energy","isResult":true},"fermi_energy":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/fermi-energy","isResult":true},"total_force":{"defaults":{"units":"eV/angstrom"},"schemaId":"properties-directory/scalar/total-force","isResult":true},"zero_point_energy":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/zero-point-energy","isResult":true},"reaction_energy_barrier":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/reaction-energy-barrier","isResult":true},"electron_affinity":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/electron-affinity","isResult":true},"ionization_potential":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/ionization-potential","isResult":true},"valence_band_offset":{"defaults":{"units":"eV"},"schemaId":"properties-directory/scalar/valence-band-offset"},"phonon_dos":{"defaults":{"xAxis":{"label":"frequency","units":"cm-1"},"yAxis":{"label":"Phonon DOS","units":"states/cm-1"}},"schemaId":"properties-directory/non-scalar/phonon-dos","isResult":true},"phonon_dispersions":{"defaults":{"xAxis":{"label":"qpoints","units":"crystal"},"yAxis":{"label":"frequency","units":"cm-1"}},"schemaId":"properties-directory/non-scalar/phonon-dispersions","isResult":true},"total_energy_contributions":{"defaults":{"units":"eV"},"schemaId":"properties-directory/non-scalar/total-energy-contributions","isResult":true},"band_gaps":{"types":["direct","indirect"],"defaults":{"units":"eV"},"schemaId":"properties-directory/non-scalar/band-gaps","isResult":true},"stress_tensor":{"defaults":{"units":"kbar"},"schemaId":"properties-directory/non-scalar/stress-tensor","isResult":true},"band_structure":{"defaults":{"xAxis":{"label":"kpoints","units":"crystal"},"yAxis":{"label":"energy","units":"eV"}},"schemaId":"properties-directory/non-scalar/band-structure","isResult":true},"density_of_states":{"defaults":{"xAxis":{"label":"energy","units":"eV"},"yAxis":{"label":"density of states","units":"states/unitcell"}},"schemaId":"properties-directory/non-scalar/density-of-states","isResult":true},"reaction_energy_profile":{"defaults":{"xAxis":{"label":"reaction coordinate"},"yAxis":{"label":"energy","units":"eV"}},"schemaId":"properties-directory/non-scalar/reaction-energy-profile","isResult":true},"potential_profile":{"defaults":{"xAxis":{"label":"z coordinate"},"yAxis":{"label":"energy","units":"eV"}},"schemaId":"properties-directory/non-scalar/potential-profile","isResult":true},"charge_density_profile":{"defaults":{"xAxis":{"label":"z coordinate"},"yAxis":{"label":"charge density","units":"e/A"}},"schemaId":"properties-directory/non-scalar/charge-density-profile","isResult":true},"vibrational_spectrum":{"defaults":{"xAxis":{"label":"wavenumber","units":"cm-1"},"yAxis":{"label":"Absorption coefficient","units":"km/mol"}},"schemaId":"properties-directory/non-scalar/vibrational-spectrum","isResult":true},"file_content":{"schemaId":"properties-directory/non-scalar/file-content","isResult":true},"average_potential_profile":{"defaults":{"xAxis":{"label":"z coordinate","units":"angstrom"},"yAxis":{"label":"energy","units":"eV"}},"schemaId":"properties-directory/non-scalar/average-potential-profile","isResult":true},"dielectric_tensor":{"schemaId":"properties-directory/non-scalar/dielectric-tensor","isResult":true},"basis":{"defaults":{"units":"angstrom"},"schemaId":"properties-directory/structural/basis"},"lattice":{"defaults":{"units":"angstrom"},"schemaId":"properties-directory/structural/lattice"},"atomic_forces":{"defaults":{"units":"eV/angstrom"},"schemaId":"properties-directory/structural/atomic-forces","isResult":true},"atomic_constraints":{"schemaId":"properties-directory/structural/basis/atomic-constraints"},"p-norm":{"schemaId":"properties-directory/structural/p-norm"},"volume":{"defaults":{"units":"angstrom^3"},"schemaId":"properties-directory/structural/volume"},"symmetry":{"defaults":{"units":"angstrom"},"schemaId":"properties-directory/structural/symmetry"},"elemental_ratio":{"schemaId":"properties-directory/structural/elemental-ratio"},"density":{"defaults":{"units":"g/cm^3"},"schemaId":"properties-directory/structural/density"},"magnetic_moments":{"defaults":{"units":"uB"},"schemaId":"properties-directory/structural/magnetic-moments","isResult":true},"bonds":{"defaults":{"units":"angstrom"},"schemaId":"properties-directory/structural/basis/bonds"},"inchi":{"schemaId":"properties-directory/structural/inchi"},"inchi_key":{"schemaId":"properties-directory/structural/inchi-key"},"material":{"schemaId":"material"},"hubbard_u":{"defaults":{"units":"eV"},"schemaId":"properties-directory/non-scalar/hubbard-u","isResult":true},"hubbard_v":{"defaults":{"units":"eV"},"schemaId":"properties-directory/non-scalar/hubbard-v","isResult":true},"hubbard_v_nn":{"defaults":{"units":"eV"},"schemaId":"properties-directory/non-scalar/hubbard-v-nn","isResult":true}}''')
RESULTS = json.loads(r'''["pressure","total_energy","surface_energy","fermi_energy","total_force","zero_point_energy","reaction_energy_barrier","electron_affinity","ionization_potential","phonon_dos","phonon_dispersions","total_energy_contributions","band_gaps","stress_tensor","band_structure","density_of_states","reaction_energy_profile","potential_profile","charge_density_profile","vibrational_spectrum","file_content","average_potential_profile","dielectric_tensor","atomic_forces","magnetic_moments","hubbard_u","hubbard_v","hubbard_v_nn"]''')
PROPERTIES_MANIFEST = json.loads(json.dumps({'convergence_ionic': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/workflow/convergence/ionic', 'isMonitor': True}, 'convergence_electronic': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/workflow/convergence/electronic', 'isMonitor': True}, 'pressure': {'defaults': {'units': 'kbar'}, 'schemaId': 'properties-directory/scalar/pressure', 'isResult': True}, 'total_energy': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/total-energy', 'isResult': True}, 'surface_energy': {'defaults': {'units': 'eV/A^2'}, 'schemaId': 'properties-directory/scalar/surface-energy', 'isResult': True}, 'fermi_energy': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/fermi-energy', 'isResult': True}, 'total_force': {'defaults': {'units': 'eV/angstrom'}, 'schemaId': 'properties-directory/scalar/total-force', 'isResult': True}, 'zero_point_energy': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/zero-point-energy', 'isResult': True}, 'reaction_energy_barrier': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/reaction-energy-barrier', 'isResult': True}, 'electron_affinity': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/electron-affinity', 'isResult': True}, 'ionization_potential': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/ionization-potential', 'isResult': True}, 'valence_band_offset': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/scalar/valence-band-offset'}, 'phonon_dos': {'defaults': {'xAxis': {'label': 'frequency', 'units': 'cm-1'}, 'yAxis': {'label': 'Phonon DOS', 'units': 'states/cm-1'}}, 'schemaId': 'properties-directory/non-scalar/phonon-dos', 'isResult': True}, 'phonon_dispersions': {'defaults': {'xAxis': {'label': 'qpoints', 'units': 'crystal'}, 'yAxis': {'label': 'frequency', 'units': 'cm-1'}}, 'schemaId': 'properties-directory/non-scalar/phonon-dispersions', 'isResult': True}, 'total_energy_contributions': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/non-scalar/total-energy-contributions', 'isResult': True}, 'band_gaps': {'types': ['direct', 'indirect'], 'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/non-scalar/band-gaps', 'isResult': True}, 'stress_tensor': {'defaults': {'units': 'kbar'}, 'schemaId': 'properties-directory/non-scalar/stress-tensor', 'isResult': True}, 'band_structure': {'defaults': {'xAxis': {'label': 'kpoints', 'units': 'crystal'}, 'yAxis': {'label': 'energy', 'units': 'eV'}}, 'schemaId': 'properties-directory/non-scalar/band-structure', 'isResult': True}, 'density_of_states': {'defaults': {'xAxis': {'label': 'energy', 'units': 'eV'}, 'yAxis': {'label': 'density of states', 'units': 'states/unitcell'}}, 'schemaId': 'properties-directory/non-scalar/density-of-states', 'isResult': True}, 'reaction_energy_profile': {'defaults': {'xAxis': {'label': 'reaction coordinate'}, 'yAxis': {'label': 'energy', 'units': 'eV'}}, 'schemaId': 'properties-directory/non-scalar/reaction-energy-profile', 'isResult': True}, 'potential_profile': {'defaults': {'xAxis': {'label': 'z coordinate'}, 'yAxis': {'label': 'energy', 'units': 'eV'}}, 'schemaId': 'properties-directory/non-scalar/potential-profile', 'isResult': True}, 'charge_density_profile': {'defaults': {'xAxis': {'label': 'z coordinate'}, 'yAxis': {'label': 'charge density', 'units': 'e/A'}}, 'schemaId': 'properties-directory/non-scalar/charge-density-profile', 'isResult': True}, 'vibrational_spectrum': {'defaults': {'xAxis': {'label': 'wavenumber', 'units': 'cm-1'}, 'yAxis': {'label': 'Absorption coefficient', 'units': 'km/mol'}}, 'schemaId': 'properties-directory/non-scalar/vibrational-spectrum', 'isResult': True}, 'file_content': {'schemaId': 'properties-directory/non-scalar/file-content', 'isResult': True}, 'average_potential_profile': {'defaults': {'xAxis': {'label': 'z coordinate', 'units': 'angstrom'}, 'yAxis': {'label': 'energy', 'units': 'eV'}}, 'schemaId': 'properties-directory/non-scalar/average-potential-profile', 'isResult': True}, 'dielectric_tensor': {'schemaId': 'properties-directory/non-scalar/dielectric-tensor', 'isResult': True}, 'basis': {'defaults': {'units': 'angstrom'}, 'schemaId': 'properties-directory/structural/basis'}, 'lattice': {'defaults': {'units': 'angstrom'}, 'schemaId': 'properties-directory/structural/lattice'}, 'atomic_forces': {'defaults': {'units': 'eV/angstrom'}, 'schemaId': 'properties-directory/structural/atomic-forces', 'isResult': True}, 'atomic_constraints': {'schemaId': 'properties-directory/structural/basis/atomic-constraints'}, 'p-norm': {'schemaId': 'properties-directory/structural/p-norm'}, 'volume': {'defaults': {'units': 'angstrom^3'}, 'schemaId': 'properties-directory/structural/volume'}, 'symmetry': {'defaults': {'units': 'angstrom'}, 'schemaId': 'properties-directory/structural/symmetry'}, 'elemental_ratio': {'schemaId': 'properties-directory/structural/elemental-ratio'}, 'density': {'defaults': {'units': 'g/cm^3'}, 'schemaId': 'properties-directory/structural/density'}, 'magnetic_moments': {'defaults': {'units': 'uB'}, 'schemaId': 'properties-directory/structural/magnetic-moments', 'isResult': True}, 'bonds': {'defaults': {'units': 'angstrom'}, 'schemaId': 'properties-directory/structural/basis/bonds'}, 'inchi': {'schemaId': 'properties-directory/structural/inchi'}, 'inchi_key': {'schemaId': 'properties-directory/structural/inchi-key'}, 'material': {'schemaId': 'material'}, 'hubbard_u': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/non-scalar/hubbard-u', 'isResult': True}, 'hubbard_v': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/non-scalar/hubbard-v', 'isResult': True}, 'hubbard_v_nn': {'defaults': {'units': 'eV'}, 'schemaId': 'properties-directory/non-scalar/hubbard-v-nn', 'isResult': True}}))
RESULTS = json.loads(json.dumps(['pressure', 'total_energy', 'surface_energy', 'fermi_energy', 'total_force', 'zero_point_energy', 'reaction_energy_barrier', 'electron_affinity', 'ionization_potential', 'phonon_dos', 'phonon_dispersions', 'total_energy_contributions', 'band_gaps', 'stress_tensor', 'band_structure', 'density_of_states', 'reaction_energy_profile', 'potential_profile', 'charge_density_profile', 'vibrational_spectrum', 'file_content', 'average_potential_profile', 'dielectric_tensor', 'atomic_forces', 'magnetic_moments', 'hubbard_u', 'hubbard_v', 'hubbard_v_nn']))
2 changes: 1 addition & 1 deletion src/py/mat3ra/esse/data/schemas.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SlugifiedEntryOrSlug(Enum):
class SlugifiedEntryOrSlug213(Enum):
us = "us"
nc = "nc"
nc_fr = "nc-fr"
paw = "paw"
coulomb = "coulomb"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SlugifiedEntryOrSlug(Enum):
class SlugifiedEntryOrSlug209(Enum):
us = "us"
nc = "nc"
nc_fr = "nc-fr"
paw = "paw"
coulomb = "coulomb"

Expand Down Expand Up @@ -70,6 +71,7 @@ class Slug(Enum):
class Type(Enum):
us = "us"
nc = "nc"
nc_fr = "nc-fr"
paw = "paw"
coulomb = "coulomb"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Slug(Enum):
class Type(Enum):
us = "us"
nc = "nc"
nc_fr = "nc-fr"
paw = "paw"
coulomb = "coulomb"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class Type(Enum):
us = "us"
nc = "nc"
nc_fr = "nc-fr"
paw = "paw"
coulomb = "coulomb"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NISTJARVISAtomsSchema(BaseModel):
"""


class NISTJARVISAtomsSchema1(BaseModel):
class NISTJARVISDbEntrySchema(BaseModel):
model_config = ConfigDict(
extra="allow",
)
Expand Down

0 comments on commit 1d895aa

Please sign in to comment.