diff --git a/example/3pse/file/applications/espresso/7.2/pw.x.json b/example/3pse/file/applications/espresso/7.2/pw.x.json index 528c80090..5bcfc544f 100644 --- a/example/3pse/file/applications/espresso/7.2/pw.x.json +++ b/example/3pse/file/applications/espresso/7.2/pw.x.json @@ -26,13 +26,13 @@ ], "Hubbard_occ": [ [ - 1.1, - 0.00, + 1, + 1, 0.00 ], [ - 0.02, - 0.02, + 1, + 2, 0.02 ] ] @@ -49,12 +49,12 @@ "ATOMIC_SPECIES": { "values": [ { - "x": "Cs", + "X": "Cs", "Mass_X": 132.90543, "PseudoPot_X": "Cs.upf" }, { - "x": "Cl", + "X": "Cl", "Mass_X": 35.4527, "PseudoPot_X": "Cl.upf" } diff --git a/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_positions.json b/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_positions.json index 8a4404c55..d8f87531a 100644 --- a/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_positions.json +++ b/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_positions.json @@ -25,7 +25,7 @@ "properties": { "X": { "type": "string", - "description": "label of the atom as specified in ATOMIC_SPECIE" + "description": "label of the atom as specified in ATOMIC_SPECIES" }, "x": { "type": "number", @@ -40,24 +40,18 @@ "description": "atomic positions" }, "if_pos(1)": { - "type": "number", + "$ref": "../../../../../../core/primitive/integer_one_or_zero.json", "default": 1, - "minimum": 0, - "maximum": 1, "description": "component i of the force for this atom is multiplied by if_pos(i), which must be either 0 or 1. Used to keep selected atoms and/or selected components fixed in MD dynamics or structural optimization run." }, "if_pos(2)": { - "type": "number", + "$ref": "../../../../../../core/primitive/integer_one_or_zero.json", "default": 1, - "minimum": 0, - "maximum": 1, "description": "component i of the force for this atom is multiplied by if_pos(i), which must be either 0 or 1. Used to keep selected atoms and/or selected components fixed in MD dynamics or structural optimization run." }, "if_pos(3)": { - "type": "number", + "$ref": "../../../../../../core/primitive/integer_one_or_zero.json", "default": 1, - "minimum": 0, - "maximum": 1, "description": "component i of the force for this atom is multiplied by if_pos(i), which must be either 0 or 1. Used to keep selected atoms and/or selected components fixed in MD dynamics or structural optimization run." } }, diff --git a/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_species.json b/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_species.json index d57f67305..c367d9114 100644 --- a/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_species.json +++ b/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_species.json @@ -11,7 +11,7 @@ "type": "object", "additionalProperties": false, "properties": { - "x": { + "X": { "type": "string", "description": "label of the atom. Acceptable syntax: chemical symbol X (1 or 2 characters, case-insensitive) or chemical symbol plus a number or a letter, as in \"Xn\" (e.g. Fe1) or \"X_*\" or \"X-*\" (e.g. C1, C_h; max total length cannot exceed 3 characters)" }, diff --git a/schema/3pse/file/applications/espresso/7.2/pw.x/control.json b/schema/3pse/file/applications/espresso/7.2/pw.x/control.json index 5900c5be2..32af1815c 100644 --- a/schema/3pse/file/applications/espresso/7.2/pw.x/control.json +++ b/schema/3pse/file/applications/espresso/7.2/pw.x/control.json @@ -159,7 +159,8 @@ }, "gate": { "type": "boolean", - "default": false + "default": false, + "description": "In the case of charged cells (tot_charge .ne. 0) setting gate = .TRUE. represents the counter charge (i.e. -tot_charge) not by a homogeneous background charge but with a charged plate, which is placed at zgate (see below). Details of the gate potential can be found in T. Brumme, M. Calandra, F. Mauri; PRB 89, 245406 (2014). Note, that in systems which are not symmetric with respect to the plate, one needs to enable the dipole correction! (dipfield=.true.). Currently, symmetry can be used with gate=.true. but carefully check that no symmetry is included which maps z to -z even if in principle one could still use them for symmetric systems (i.e. no dipole correction). For nosym=.false. verbosity is set to 'high'. Note: this option was called \"monopole\" in v6.0 and 6.1 of pw.x" }, "twochem": { "type": "boolean", @@ -173,7 +174,8 @@ }, "trism": { "type": "boolean", - "default": false + "default": false, + "description": "If .TRUE. perform a 3D-RISM-SCF calculation [for details see H.Sato et al., JCP 112, 9463 (2000), doi:10.1063/1.481564]. The solvent's distributions are calculated by 3D-RISM, though solute is treated as SCF. The charge density and the atomic positions are optimized, simultaneously with the solvents. To perform the calculation, you must set a namelist RISM and a card SOLVENTS. If assume_isolated = 'esm' and esm_bc = 'bc1', Laue-RISM is calculated instead of 3D-RISM and coupled with ESM method (i.e. ESM-RISM). [for details see S.Nishihara and M.Otani, PRB 96, 115429 (2017)]. The default of mixing_beta is 0.2 for both 3D-RISM and Laue-RISM. For structural relaxation with BFGS, ignore_wolfe is always .TRUE. ." } } } diff --git a/schema/3pse/file/applications/espresso/7.2/pw.x/system.json b/schema/3pse/file/applications/espresso/7.2/pw.x/system.json index ff4fee1da..14851b8c2 100644 --- a/schema/3pse/file/applications/espresso/7.2/pw.x/system.json +++ b/schema/3pse/file/applications/espresso/7.2/pw.x/system.json @@ -78,7 +78,9 @@ "type": "array", "items": { "type": "number", - "default": 0 + "default": 0, + "minimum": -1, + "maximum": 1 } }, "ecutwfc": { @@ -304,11 +306,20 @@ "type": "array", "items": { "type": "array", - "items": { - "type": "number" - }, - "maxItems": 3, - "minItems": 3 + "items": [ + { + "type": "integer", + "minimum": 1 + }, + { + "type": "integer", + "minimum": 1, + "maximum": 3 + }, + { + "type": "number" + } + ] } }, "Hubbard_alpha": { diff --git a/schema/core/primitive/integer_one_or_zero.json b/schema/core/primitive/integer_one_or_zero.json new file mode 100644 index 000000000..8c879fd78 --- /dev/null +++ b/schema/core/primitive/integer_one_or_zero.json @@ -0,0 +1,8 @@ +{ + "$id": "core/primitive/integer-one-or-zero", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "integer one or zero", + "type": "number", + "minimum": 0, + "maximum": 1 +} diff --git a/src/js/esse/index.js b/src/js/esse/index.js index 923807f70..1a4a47c9c 100644 --- a/src/js/esse/index.js +++ b/src/js/esse/index.js @@ -25,7 +25,13 @@ export class ESSE { */ validate = (example, schema) => { const ajv = new Ajv({ allErrors: true }); - return ajv.validate(schema, example); + const isValid = ajv.validate(schema, example); + + if (!isValid) { + console.error(ajv.errors); + } + + return isValid; }; buildGlobalSchema() { diff --git a/src/js/scripts/createEnumsFromYaml.mjs b/src/js/scripts/createEnumsFromYaml.mjs index 80ff24ffb..fc09712a4 100644 --- a/src/js/scripts/createEnumsFromYaml.mjs +++ b/src/js/scripts/createEnumsFromYaml.mjs @@ -39,8 +39,5 @@ walkDir(SCHEMA_DIR, (filePath) => { const obj = yaml.load(fileContents); const enumObj = lodash.mapValues(obj, (value) => ({ enum: value })); - fs.writeFileSync( - `${path.join(dirname, outFilename)}`, - `${JSON.stringify(enumObj, null, 4)}\n`, - ); + fs.writeFileSync(`${path.join(dirname, outFilename)}`, `${JSON.stringify(enumObj, null, 4)}\n`); });