@mat3ra/esse 2025.4.26-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.
Files changed (59) hide show
  1. package/.eslintrc.json +3 -9
  2. package/.prettierrc +2 -1
  3. package/dist/js/esse/JSONSchemasGenerator.js +10 -2
  4. package/dist/js/esse/utils.js +6 -0
  5. package/dist/js/example/apse/materials/builders/slab/pymatgen/parameters.json +6 -0
  6. package/dist/js/example/material/builders/base/selector_parameters.json +3 -0
  7. package/dist/js/example/material/builders/single_material/two_dimensional/slab/selector_parameters.json +6 -0
  8. package/dist/js/example/material/reusable/repetitions.json +5 -0
  9. package/dist/js/example/material/reusable/slab/miller_indices.json +5 -0
  10. package/dist/js/example/material/reusable/slab/number_of_layers.json +1 -0
  11. package/dist/js/example/material/reusable/slab/termination.json +4 -0
  12. package/dist/js/example/material/reusable/slab/vacuum.json +1 -0
  13. package/dist/js/example/material/reusable/supercell_matrix_2d.json +10 -0
  14. package/dist/js/example/material/reusable/supercell_matrix_3d.json +17 -0
  15. package/dist/js/example/materials_category/single_material/two_dimensional/slab/configuration.json +150 -0
  16. package/dist/js/schema/apse/materials/builders/slab/pymatgen/parameters.json +33 -0
  17. package/dist/js/schema/core/abstract/coordinate_2d.json +11 -0
  18. package/dist/js/schema/material/builders/base/selector_parameters.json +15 -0
  19. package/dist/js/schema/material/builders/single_material/two_dimensional/slab/builder_parameters.json +33 -0
  20. package/dist/js/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json +31 -0
  21. package/dist/js/schema/material/reusable/repetitions.json +18 -0
  22. package/dist/js/schema/material/reusable/slab/enums.json +11 -0
  23. package/dist/js/schema/material/reusable/slab/miller_indices.json +17 -0
  24. package/dist/js/schema/material/reusable/slab/number_of_layers.json +9 -0
  25. package/dist/js/schema/material/reusable/slab/termination.json +23 -0
  26. package/dist/js/schema/material/reusable/slab/vacuum.json +9 -0
  27. package/dist/js/schema/material/reusable/supercell_matrix_2d.json +27 -0
  28. package/dist/js/schema/material/reusable/supercell_matrix_3d.json +34 -0
  29. package/dist/js/schema/materials_category/single_material/two_dimensional/slab/configuration.json +709 -0
  30. package/dist/js/schemas.json +1 -1
  31. package/dist/js/types.d.ts +433 -0
  32. package/example/apse/materials/builders/slab/pymatgen/parameters.json +6 -0
  33. package/example/material/builders/base/selector_parameters.json +3 -0
  34. package/example/material/builders/single_material/two_dimensional/slab/selector_parameters.json +6 -0
  35. package/example/material/reusable/repetitions.json +1 -0
  36. package/example/material/reusable/slab/miller_indices.json +5 -0
  37. package/example/material/reusable/slab/number_of_layers.json +1 -0
  38. package/example/material/reusable/slab/termination.json +4 -0
  39. package/example/material/reusable/slab/vacuum.json +1 -0
  40. package/example/material/reusable/supercell_matrix_2d.json +10 -0
  41. package/example/material/reusable/supercell_matrix_3d.json +5 -0
  42. package/example/materials_category/single_material/two_dimensional/slab/configuration.json +25 -0
  43. package/package.json +10 -4
  44. package/schema/apse/materials/builders/slab/pymatgen/parameters.json +33 -0
  45. package/schema/core/abstract/coordinate_2d.json +11 -0
  46. package/schema/material/builders/base/selector_parameters.json +15 -0
  47. package/schema/material/builders/single_material/two_dimensional/slab/builder_parameters.json +12 -0
  48. package/schema/material/builders/single_material/two_dimensional/slab/selector_parameters.json +12 -0
  49. package/schema/material/reusable/repetitions.json +18 -0
  50. package/schema/material/reusable/slab/enums.json +11 -0
  51. package/schema/material/reusable/slab/miller_indices.json +17 -0
  52. package/schema/material/reusable/slab/number_of_layers.json +9 -0
  53. package/schema/material/reusable/slab/termination.json +23 -0
  54. package/schema/material/reusable/slab/vacuum.json +9 -0
  55. package/schema/material/reusable/supercell_matrix_2d.json +27 -0
  56. package/schema/material/reusable/supercell_matrix_3d.json +34 -0
  57. package/schema/materials_category/single_material/two_dimensional/slab/configuration.json +42 -0
  58. package/src/js/esse/JSONSchemasGenerator.ts +11 -1
  59. package/src/js/esse/utils.ts +8 -2
package/.eslintrc.json CHANGED
@@ -1,11 +1,5 @@
1
1
  {
2
- "extends": ["@exabyte-io/eslint-config"],
3
- "ignorePatterns": ["dist/js/**/*.js", "dist/js/**/*.ts", "src/js/types.ts"],
4
- "settings": {
5
- "import/resolver": {
6
- "node": {
7
- "extensions": [".js", ".jsx", ".ts", ".tsx"]
8
- }
9
- }
10
- }
2
+ "extends": [
3
+ "@exabyte-io/eslint-config/json"
4
+ ]
11
5
  }
package/.prettierrc CHANGED
@@ -2,5 +2,6 @@
2
2
  "singleQuote": false,
3
3
  "printWidth": 100,
4
4
  "trailingComma": "all",
5
- "tabWidth": 4
5
+ "tabWidth": 4,
6
+ "bracketSpacing": true
6
7
  }
@@ -39,10 +39,18 @@ class JSONSchemasGenerator {
39
39
  resolvers: { defaultResolver: json_schema_merge_allof_1.default.options.resolvers.title },
40
40
  };
41
41
  const schemas = this.schemas.map((schema) => {
42
- var _a;
43
42
  console.log(`Resolving schema: ${schema.$id}`);
44
43
  const mergedSchema = skipMergeAllOff ? schema : (0, json_schema_merge_allof_1.default)(schema, mergeAllOfConfig);
45
- const idAsPath = (_a = mergedSchema.$id) === null || _a === void 0 ? void 0 : _a.replace(/-/g, "_");
44
+ let idAsPath = mergedSchema.$id;
45
+ if (!idAsPath) {
46
+ throw new Error(`Schema ID is missing:
47
+ ${JSON.stringify(mergedSchema)}`);
48
+ }
49
+ const schemaHasDash = idAsPath.includes("-");
50
+ if (schemaHasDash) {
51
+ // replace dashes with underscores
52
+ idAsPath = idAsPath.replace(/-/g, "_");
53
+ }
46
54
  const fullPath = `${schemasFolder}/${idAsPath}.json`;
47
55
  fs_1.default.mkdirSync(path_1.default.dirname(fullPath), { recursive: true });
48
56
  fs_1.default.writeFileSync(fullPath, JSON.stringify(mergedSchema, null, 4), "utf8");
@@ -17,11 +17,17 @@ function parseIncludeReferenceStatements(filePath) {
17
17
  const jsonResolver = new json_include_1.JSONInclude();
18
18
  const parsed = jsonResolver.parseIncludeStatements(filePath);
19
19
  const dirPath = path_1.default.dirname(filePath);
20
+ // Store the original $id before dereferencing
21
+ const originalId = parsed.$id;
20
22
  let dereferenced = (0, json_schema_deref_sync_1.default)(parsed, { baseFolder: dirPath, removeIds: true });
21
23
  // handle circular references and use non-dereferenced source
22
24
  if (dereferenced instanceof Error && dereferenced.message === "Circular self reference") {
23
25
  dereferenced = parsed;
24
26
  }
27
+ // Restore the original $id after dereferencing
28
+ if (originalId) {
29
+ dereferenced.$id = originalId;
30
+ }
25
31
  return dereferenced;
26
32
  }
27
33
  exports.parseIncludeReferenceStatements = parseIncludeReferenceStatements;
@@ -0,0 +1,6 @@
1
+ {
2
+ "min_vacuum_size": 1,
3
+ "in_unit_planes": true,
4
+ "reorient_lattice": true,
5
+ "symmetrize": false
6
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "default_index": 0
3
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "termination": {
3
+ "chemical_elements": "C",
4
+ "space_group_symmetry_label": "P6/mmm"
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "chemical_elements": "Si",
3
+ "space_group_symmetry_label": "P4/mmm_2"
4
+ }
@@ -0,0 +1,10 @@
1
+ [
2
+ [
3
+ 2,
4
+ 0
5
+ ],
6
+ [
7
+ 0,
8
+ 2
9
+ ]
10
+ ]
@@ -0,0 +1,17 @@
1
+ [
2
+ [
3
+ 1,
4
+ 0,
5
+ 0
6
+ ],
7
+ [
8
+ 0,
9
+ 2,
10
+ 0
11
+ ],
12
+ [
13
+ 0,
14
+ 0,
15
+ 3
16
+ ]
17
+ ]
@@ -0,0 +1,150 @@
1
+ {
2
+ "bulk": {
3
+ "_id": "LCthJ6E2QabYCZqf3",
4
+ "basis": {
5
+ "coordinates": [
6
+ {
7
+ "id": 1,
8
+ "value": [
9
+ 0,
10
+ 0,
11
+ 0
12
+ ]
13
+ },
14
+ {
15
+ "id": 2,
16
+ "value": [
17
+ 0.25,
18
+ 0.25,
19
+ 0.25
20
+ ]
21
+ }
22
+ ],
23
+ "elements": [
24
+ {
25
+ "id": 1,
26
+ "value": "Si"
27
+ },
28
+ {
29
+ "id": 2,
30
+ "value": "Si"
31
+ }
32
+ ],
33
+ "name": "basis",
34
+ "units": "crystal"
35
+ },
36
+ "createdAt": "2016-04-03T05:25:37.430Z",
37
+ "creator": {
38
+ "_id": "HtxACY2wX4b2hS8Rv",
39
+ "cls": "User",
40
+ "slug": "exadmin"
41
+ },
42
+ "derivedProperties": [
43
+ {
44
+ "name": "volume",
45
+ "units": "angstrom^3",
46
+ "value": 131.1
47
+ },
48
+ {
49
+ "name": "density",
50
+ "units": "g/cm^3",
51
+ "value": 2.33
52
+ },
53
+ {
54
+ "name": "symmetry",
55
+ "spaceGroupSymbol": "Fd-3m",
56
+ "tolerance": {
57
+ "units": "angstrom",
58
+ "value": 0.3
59
+ }
60
+ },
61
+ {
62
+ "degree": 10,
63
+ "name": "p-norm",
64
+ "value": 0.71
65
+ },
66
+ {
67
+ "element": "Si",
68
+ "name": "elemental_ratio",
69
+ "value": 0.71
70
+ },
71
+ {
72
+ "name": "inchi",
73
+ "value": ""
74
+ },
75
+ {
76
+ "name": "inchi_key",
77
+ "value": ""
78
+ }
79
+ ],
80
+ "exabyteId": "RKiswuxHKkF3uvLyA",
81
+ "formula": "Si",
82
+ "hash": "4ac3fa057e3530628eb1295c77110eaa",
83
+ "isDefault": false,
84
+ "isNonPeriodic": false,
85
+ "lattice": {
86
+ "name": "lattice",
87
+ "a": 5.14,
88
+ "alpha": 90,
89
+ "b": 5.14,
90
+ "beta": 90,
91
+ "c": 5.14,
92
+ "gamma": 90,
93
+ "type": "CUB",
94
+ "units": {
95
+ "angle": "degree",
96
+ "length": "angstrom"
97
+ },
98
+ "vectors": {
99
+ "a": [
100
+ 5,
101
+ 0.000121312,
102
+ 0.000131415
103
+ ],
104
+ "alat": 1,
105
+ "b": [
106
+ 0.000121312,
107
+ 5,
108
+ 0.000121314
109
+ ],
110
+ "c": [
111
+ 0.000121313,
112
+ 0.000121312,
113
+ 5
114
+ ],
115
+ "units": "angstrom"
116
+ }
117
+ },
118
+ "name": "Silicon FCC",
119
+ "owner": {
120
+ "_id": "HtxACY2wX4b2hS8Rv",
121
+ "cls": "Account",
122
+ "slug": "exabyte"
123
+ },
124
+ "scaledHash": "5bd4eb168e3530628eb1295d88221cbb",
125
+ "schemaVersion": "0.2.0",
126
+ "slug": "silicon-fcc",
127
+ "unitCellFormula": "Si2",
128
+ "updatedAt": "2016-04-04T17:58:42.867Z"
129
+ },
130
+ "miller_indices": [
131
+ 0,
132
+ 0,
133
+ 1
134
+ ],
135
+ "number_of_layers": 3,
136
+ "vacuum": 15,
137
+ "xy_supercell_matrix": [
138
+ [
139
+ 1,
140
+ 0
141
+ ],
142
+ [
143
+ 0,
144
+ 1
145
+ ]
146
+ ],
147
+ "use_conventional_cell": true,
148
+ "use_orthogonal_z": true,
149
+ "make_primitive": true
150
+ }
@@ -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,11 @@
1
+ {
2
+ "$id": "core/abstract/coordinate-2d",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "coordinate 2d schema",
5
+ "type": "array",
6
+ "minItems": 2,
7
+ "maxItems": 2,
8
+ "items": {
9
+ "type": "number"
10
+ }
11
+ }
@@ -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,33 @@
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
+ "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,31 @@
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
+ "$schema": "http://json-schema.org/draft-07/schema#",
10
+ "title": "Termination Schema",
11
+ "description": "Defines a specific termination of a slab",
12
+ "type": "object",
13
+ "required": [
14
+ "chemical_elements",
15
+ "space_group_symmetry_label"
16
+ ],
17
+ "properties": {
18
+ "chemical_elements": {
19
+ "title": "Chemical Elements",
20
+ "description": "Chemical elements at the termination",
21
+ "type": "string"
22
+ },
23
+ "space_group_symmetry_label": {
24
+ "title": "Space Group Symmetry Label",
25
+ "description": "Space group symmetry designation for the termination",
26
+ "type": "string"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$id": "material/reusable/repetitions",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Crystal Repetitions Schema",
5
+ "description": "Number of unit cells to repeat in each direction for a crystal structure.",
6
+ "type": "array",
7
+ "minItems": 3,
8
+ "maxItems": 3,
9
+ "default": [
10
+ 1,
11
+ 1,
12
+ 1
13
+ ],
14
+ "items": {
15
+ "type": "integer",
16
+ "minimum": 1
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$id": "material/reusable/slab/enums",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Surface Types Enum",
5
+ "$comment": "The surface types used by passivation and surface analysis",
6
+ "enum": [
7
+ "top",
8
+ "bottom",
9
+ "both"
10
+ ]
11
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$id": "material/reusable/slab/miller-indices",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Miller Indices Schema",
5
+ "description": "Miller indices for crystallographic plane designation",
6
+ "type": "array",
7
+ "minItems": 3,
8
+ "maxItems": 3,
9
+ "default": [
10
+ 0,
11
+ 0,
12
+ 1
13
+ ],
14
+ "items": {
15
+ "type": "integer"
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$id": "material/reusable/slab/number-of-layers",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "number_of_layers Schema",
5
+ "description": "Number of atomic layers in a structural component",
6
+ "type": "integer",
7
+ "minimum": 1,
8
+ "default": 1
9
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$id": "material/reusable/slab/termination",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Termination Schema",
5
+ "description": "Defines a specific termination of a slab",
6
+ "type": "object",
7
+ "required": [
8
+ "chemical_elements",
9
+ "space_group_symmetry_label"
10
+ ],
11
+ "properties": {
12
+ "chemical_elements": {
13
+ "title": "Chemical Elements",
14
+ "description": "Chemical elements at the termination",
15
+ "type": "string"
16
+ },
17
+ "space_group_symmetry_label": {
18
+ "title": "Space Group Symmetry Label",
19
+ "description": "Space group symmetry designation for the termination",
20
+ "type": "string"
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$id": "material/reusable/slab/vacuum",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Vacuum Schema",
5
+ "description": "Vacuum thickness in Angstroms",
6
+ "type": "number",
7
+ "minimum": 0,
8
+ "default": 5
9
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$id": "material/reusable/supercell-matrix-2d",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Supercell Matrix 2D Schema",
5
+ "description": "Supercell matrix for xy plane transformations",
6
+ "type": "array",
7
+ "minItems": 2,
8
+ "maxItems": 2,
9
+ "default": [
10
+ [
11
+ 1,
12
+ 0
13
+ ],
14
+ [
15
+ 0,
16
+ 1
17
+ ]
18
+ ],
19
+ "items": {
20
+ "type": "array",
21
+ "minItems": 2,
22
+ "maxItems": 2,
23
+ "items": {
24
+ "type": "integer"
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$id": "material/reusable/supercell-matrix-3d",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Supercell Matrix 3D Schema",
5
+ "description": "3x3 matrix of integers for transforming a unit cell into a supercell",
6
+ "type": "array",
7
+ "minItems": 3,
8
+ "maxItems": 3,
9
+ "default": [
10
+ [
11
+ 1,
12
+ 0,
13
+ 0
14
+ ],
15
+ [
16
+ 0,
17
+ 1,
18
+ 0
19
+ ],
20
+ [
21
+ 0,
22
+ 0,
23
+ 1
24
+ ]
25
+ ],
26
+ "items": {
27
+ "type": "array",
28
+ "minItems": 3,
29
+ "maxItems": 3,
30
+ "items": {
31
+ "type": "integer"
32
+ }
33
+ }
34
+ }