@mat3ra/esse 2025.5.13-0 → 2025.5.16-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/esse/JSONSchemasGenerator.js +10 -2
- package/dist/js/esse/utils.js +6 -0
- package/dist/js/example/apse/materials/builders/slab/pymatgen/parameters.json +6 -0
- package/dist/js/example/material/builders/base/selector_parameters.json +3 -0
- package/dist/js/example/material/builders/single_material/two_dimensional/slab/selector_parameters.json +6 -0
- package/dist/js/schema/apse/materials/builders/slab/pymatgen/parameters.json +33 -0
- package/dist/js/schema/material/builders/base/selector_parameters.json +15 -0
- package/dist/js/schema/material/builders/single_material/two_dimensional/slab/builder_parameters.json +33 -0
- package/dist/js/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json +31 -0
- package/dist/js/schemas.json +1 -1
- package/dist/js/types.d.ts +73 -0
- package/example/apse/materials/builders/slab/pymatgen/parameters.json +6 -0
- package/example/material/builders/base/selector_parameters.json +3 -0
- package/example/material/builders/single_material/two_dimensional/slab/selector_parameters.json +6 -0
- package/package.json +1 -1
- package/schema/apse/materials/builders/slab/pymatgen/parameters.json +33 -0
- package/schema/material/builders/base/selector_parameters.json +15 -0
- package/schema/material/builders/single_material/two_dimensional/slab/builder_parameters.json +12 -0
- package/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json +12 -0
- package/src/js/esse/JSONSchemasGenerator.ts +11 -1
- package/src/js/esse/utils.ts +8 -2
package/dist/js/types.d.ts
CHANGED
|
@@ -1545,6 +1545,28 @@ export interface PwxMainSchema {
|
|
|
1545
1545
|
})[];
|
|
1546
1546
|
};
|
|
1547
1547
|
}
|
|
1548
|
+
/** Schema dist/js/schema/apse/materials/builders/slab/pymatgen/parameters.json */
|
|
1549
|
+
/**
|
|
1550
|
+
* Parameters for the Pymatgen slab generator. https://github.com/materialsproject/pymatgen/blob/585bb673c4aa222669c4b0d72ffeec3dbf092630/pymatgen/core/surface.py#L1187
|
|
1551
|
+
*/
|
|
1552
|
+
export interface PymatgenSlabGeneratorParametersSchema {
|
|
1553
|
+
/**
|
|
1554
|
+
* Minimum size of the vacuum in layers or angstroms
|
|
1555
|
+
*/
|
|
1556
|
+
min_vacuum_size?: number;
|
|
1557
|
+
/**
|
|
1558
|
+
* Whether to cleave in unit planes
|
|
1559
|
+
*/
|
|
1560
|
+
in_unit_planes?: boolean;
|
|
1561
|
+
/**
|
|
1562
|
+
* Whether to reorient the lattice
|
|
1563
|
+
*/
|
|
1564
|
+
reorient_lattice?: boolean;
|
|
1565
|
+
/**
|
|
1566
|
+
* Whether to symmetrize the slab
|
|
1567
|
+
*/
|
|
1568
|
+
symmetrize?: boolean;
|
|
1569
|
+
}
|
|
1548
1570
|
/** Schema dist/js/schema/core/abstract/2d_data.json */
|
|
1549
1571
|
export interface DimensionDataSchema {
|
|
1550
1572
|
/**
|
|
@@ -6131,6 +6153,57 @@ export interface JobSchema {
|
|
|
6131
6153
|
isDefault?: boolean;
|
|
6132
6154
|
metadata?: {};
|
|
6133
6155
|
}
|
|
6156
|
+
/** Schema dist/js/schema/material/builders/base/selector_parameters.json */
|
|
6157
|
+
/**
|
|
6158
|
+
* Base parameters for all builder selectors
|
|
6159
|
+
*/
|
|
6160
|
+
export interface BaseSelectorParametersSchema {
|
|
6161
|
+
/**
|
|
6162
|
+
* Default index for the selector
|
|
6163
|
+
*/
|
|
6164
|
+
default_index?: number;
|
|
6165
|
+
}
|
|
6166
|
+
/** Schema dist/js/schema/material/builders/single_material/two_dimensional/slab/builder_parameters.json */
|
|
6167
|
+
/**
|
|
6168
|
+
* Parameters for the slab builder
|
|
6169
|
+
*/
|
|
6170
|
+
export interface SlabBuilderParametersSchema {
|
|
6171
|
+
/**
|
|
6172
|
+
* Minimum size of the vacuum in layers or angstroms
|
|
6173
|
+
*/
|
|
6174
|
+
min_vacuum_size?: number;
|
|
6175
|
+
/**
|
|
6176
|
+
* Whether to cleave in unit planes
|
|
6177
|
+
*/
|
|
6178
|
+
in_unit_planes?: boolean;
|
|
6179
|
+
/**
|
|
6180
|
+
* Whether to reorient the lattice
|
|
6181
|
+
*/
|
|
6182
|
+
reorient_lattice?: boolean;
|
|
6183
|
+
/**
|
|
6184
|
+
* Whether to symmetrize the slab
|
|
6185
|
+
*/
|
|
6186
|
+
symmetrize?: boolean;
|
|
6187
|
+
}
|
|
6188
|
+
/** Schema dist/js/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json */
|
|
6189
|
+
/**
|
|
6190
|
+
* Parameters for slab selection
|
|
6191
|
+
*/
|
|
6192
|
+
export interface SlabSelectorParametersSchema {
|
|
6193
|
+
/**
|
|
6194
|
+
* Defines a specific termination of a slab
|
|
6195
|
+
*/
|
|
6196
|
+
termination?: {
|
|
6197
|
+
/**
|
|
6198
|
+
* Chemical elements at the termination
|
|
6199
|
+
*/
|
|
6200
|
+
chemical_elements: string;
|
|
6201
|
+
/**
|
|
6202
|
+
* Space group symmetry designation for the termination
|
|
6203
|
+
*/
|
|
6204
|
+
space_group_symmetry_label: string;
|
|
6205
|
+
};
|
|
6206
|
+
}
|
|
6134
6207
|
/** Schema dist/js/schema/material/consistency_check.json */
|
|
6135
6208
|
/**
|
|
6136
6209
|
* The output of consistency checks performed on data adhering to JSON schema, but inconsistent with scientific or logical rules, to show problems in UI.
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "apse/materials/builders/slab/pymatgen/parameters",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Pymatgen Slab Generator Parameters Schema",
|
|
5
|
+
"description": "Parameters for the Pymatgen slab generator. https://github.com/materialsproject/pymatgen/blob/585bb673c4aa222669c4b0d72ffeec3dbf092630/pymatgen/core/surface.py#L1187",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"min_vacuum_size": {
|
|
9
|
+
"description": "Minimum size of the vacuum in layers or angstroms",
|
|
10
|
+
"type": [
|
|
11
|
+
"integer",
|
|
12
|
+
"number"
|
|
13
|
+
],
|
|
14
|
+
"minimum": 0,
|
|
15
|
+
"default": 1
|
|
16
|
+
},
|
|
17
|
+
"in_unit_planes": {
|
|
18
|
+
"description": "Whether to cleave in unit planes",
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"default": true
|
|
21
|
+
},
|
|
22
|
+
"reorient_lattice": {
|
|
23
|
+
"description": "Whether to reorient the lattice",
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"default": true
|
|
26
|
+
},
|
|
27
|
+
"symmetrize": {
|
|
28
|
+
"description": "Whether to symmetrize the slab",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "material/builders/base/selector-parameters",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Base Selector Parameters Schema",
|
|
5
|
+
"description": "Base parameters for all builder selectors",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"default_index": {
|
|
9
|
+
"description": "Default index for the selector",
|
|
10
|
+
"type": "integer",
|
|
11
|
+
"minimum": 0,
|
|
12
|
+
"default": 0
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "material/builders/single-material/two-dimensional/slab/builder-parameters",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Slab Builder Parameters Schema",
|
|
5
|
+
"description": "Parameters for the slab builder",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "../../../../../apse/materials/builders/slab/pymatgen/parameters.json"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
package/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "material/builders/single-material/two-dimensional/slab/selector-parameters",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Slab Selector Parameters Schema",
|
|
5
|
+
"description": "Parameters for slab selection",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"termination": {
|
|
9
|
+
"$ref": "../../../../../material/reusable/slab/termination.json"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -69,7 +69,17 @@ export default class JSONSchemasGenerator implements JSONSchemasGeneratorConfig
|
|
|
69
69
|
const schemas = this.schemas.map((schema) => {
|
|
70
70
|
console.log(`Resolving schema: ${schema.$id}`);
|
|
71
71
|
const mergedSchema = skipMergeAllOff ? schema : mergeAllOf(schema, mergeAllOfConfig);
|
|
72
|
-
|
|
72
|
+
let idAsPath = mergedSchema.$id;
|
|
73
|
+
if (!idAsPath) {
|
|
74
|
+
throw new Error(`Schema ID is missing:
|
|
75
|
+
${JSON.stringify(mergedSchema)}`);
|
|
76
|
+
}
|
|
77
|
+
const schemaHasDash = idAsPath.includes("-");
|
|
78
|
+
if (schemaHasDash) {
|
|
79
|
+
// replace dashes with underscores
|
|
80
|
+
idAsPath = idAsPath.replace(/-/g, "_");
|
|
81
|
+
}
|
|
82
|
+
|
|
73
83
|
const fullPath = `${schemasFolder}/${idAsPath}.json`;
|
|
74
84
|
|
|
75
85
|
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
package/src/js/esse/utils.ts
CHANGED
|
@@ -16,12 +16,18 @@ export type JSONSchemaDefinition = JSONSchema7Definition;
|
|
|
16
16
|
*/
|
|
17
17
|
export function parseIncludeReferenceStatements(filePath: string): JSONSchema {
|
|
18
18
|
const jsonResolver = new JSONInclude();
|
|
19
|
-
const parsed = jsonResolver.parseIncludeStatements(filePath);
|
|
19
|
+
const parsed = jsonResolver.parseIncludeStatements(filePath) as JSONSchema;
|
|
20
20
|
const dirPath = path.dirname(filePath);
|
|
21
|
+
// Store the original $id before dereferencing
|
|
22
|
+
const originalId = parsed.$id;
|
|
21
23
|
let dereferenced = deref(parsed, { baseFolder: dirPath, removeIds: true });
|
|
22
24
|
// handle circular references and use non-dereferenced source
|
|
23
25
|
if (dereferenced instanceof Error && dereferenced.message === "Circular self reference") {
|
|
24
|
-
dereferenced = parsed
|
|
26
|
+
dereferenced = parsed;
|
|
27
|
+
}
|
|
28
|
+
// Restore the original $id after dereferencing
|
|
29
|
+
if (originalId) {
|
|
30
|
+
dereferenced.$id = originalId;
|
|
25
31
|
}
|
|
26
32
|
return dereferenced;
|
|
27
33
|
}
|