diff --git a/example/job.json b/example/job.json index e1dc6167a..e36e537fa 100644 --- a/example/job.json +++ b/example/job.json @@ -1,9 +1,11 @@ { "status": "pre-submission", "mode": "normal", - "_material": { - "...": "include(job/_material.json)" - }, + "_materials": [ + { + "...": "include(job/_material.json)" + } + ], "compute": { "...": "include(job/compute.json)" }, @@ -24,5 +26,8 @@ }, "_project": { "...": "include(job/_project.json)" + }, + "api": { + "...": "include(job/_api.json)" } } diff --git a/example/job/_api.json b/example/job/_api.json new file mode 100644 index 000000000..5224a0d3f --- /dev/null +++ b/example/job/_api.json @@ -0,0 +1,4 @@ +{ + "userId": "jnLJpf9vJKYtFoQxc", + "authToken": "BvsTQ3xv-c4laO4Po3PQWsQty4GVwtDL_f2KXv6uFxz" +} diff --git a/example/job/input.json b/example/job/input.json new file mode 100644 index 000000000..c7402411c --- /dev/null +++ b/example/job/input.json @@ -0,0 +1,3 @@ +{ + "...": "include(theory/ml/input.json)" +} diff --git a/example/job/software/ml/linear/workflow/fit_predict_band_gap.json b/example/job/software/ml/linear/workflow/fit_predict_band_gap.json new file mode 100644 index 000000000..ba001749e --- /dev/null +++ b/example/job/software/ml/linear/workflow/fit_predict_band_gap.json @@ -0,0 +1,119 @@ +{ + "_id": "ML bandgap prediction", + "title": "SiGe alloy bandgap prediction", + "titleSlug": "Template for ML POC SiGe alloy bandgap prediction", + "compute": { + "ppn": 1, + "queue": "OR", + "timeLimit": "1:00:00", + "notify": "n", + "nodes": 1, + "arguments": {} + }, + "model": { + "method": { + "workflow": { + "name": "sige alloy bandgap prediciton using least squares regression", + "app": "machine_learning", + "units": [ + { + "flowchartId": "1", + "head": true, + "type": "execution", + "name": "fit_MLmethod", + "next": "2", + "execution": { + "app": { + "name": "ml", + "exec": "rupy", + "version": "0.1.0" + }, + "preProcessors": [], + "input": [ + { + "fit": { + "type": "linear", + "subtype": "least_squares", + "arguments": { + "sampleWeight": true, + "trainDataSize": 0.75 + } + }, + "targetProperties": [ + "band_gaps" + ], + "features": [ + "elemental_composition", + "density" + ], + "exabyteIds": [ + "3qp8j2CqCgsSa6ZKj", + "NdRNhkKWv4Xj8sxd8", + "AWLTt3qa5x6xRG353", + "cR2uFML56FL6rMf2v" + ] + } + ] + }, + "results": [ + { + "name": "predict" + } + ] + }, + { + "flowchartId": "2", + "type": "execution", + "name": "predict_property", + "head": false, + "execution": { + "app": { + "name": "ml", + "exec": "rupy", + "version": "0.1.0" + }, + "preProcessors": [], + "input": [ + { + "predict": { + "scope": "1", + "name": "predict" + }, + "exabyteIds": [ + "3qp8j2CqCgsSa6ZKj" + ] + } + ] + }, + "results": [ + { + "name": "band_gaps" + } + ] + } + ] + } + } + }, + "_project": { + "_id": "56c569d7fe45004bec30b5e7", + "name": "Project 1", + "owner": { + "_id": "sdkucJLKbsaa2ajksh", + "name": "demo", + "type": 10 + }, + "slug": "project-1", + "goldName": "exabyte-project-1" + }, + "version": "0.1.0", + "owner": { + "_id": "paxJukXpDBiSRjfRZ", + "name": "demo", + "type": 10 + }, + "creator": { + "username": "demo", + "_id": "paxJukXpDBiSRjfRZ" + } +} diff --git a/example/job/theory/ml/_input_fit.json b/example/job/theory/ml/_input_fit.json new file mode 100644 index 000000000..6ca48974d --- /dev/null +++ b/example/job/theory/ml/_input_fit.json @@ -0,0 +1,9 @@ +{ + "arguments": { + "...": "include(linear/input_fit.json)" + }, + "method": { + "type": "linear", + "subtype": "least_squares" + } +} diff --git a/example/job/theory/ml/input.json b/example/job/theory/ml/input.json new file mode 100644 index 000000000..91bd0a8c5 --- /dev/null +++ b/example/job/theory/ml/input.json @@ -0,0 +1,8 @@ +{ + "...": "include(input/predict.json)", + "materials": { + "exabyteIds": [ + "LCthJ6E2QabYCZqf3" + ] + } +} diff --git a/example/job/theory/ml/input/fit.json b/example/job/theory/ml/input/fit.json new file mode 100644 index 000000000..aa9da396e --- /dev/null +++ b/example/job/theory/ml/input/fit.json @@ -0,0 +1,11 @@ +{ + "...": "include(../_input_fit.json)", + "type": "fit", + "features": [ + "elemental_composition", + "electronegativity" + ], + "properties": [ + "band_gaps" + ] +} diff --git a/example/job/theory/ml/input/predict.json b/example/job/theory/ml/input/predict.json new file mode 100644 index 000000000..f7888fa3c --- /dev/null +++ b/example/job/theory/ml/input/predict.json @@ -0,0 +1,4 @@ +{ + "type": "predict", + "method": "include(../linear.json)" +} diff --git a/example/job/theory/ml/linear.json b/example/job/theory/ml/linear.json new file mode 100644 index 000000000..3276c7292 --- /dev/null +++ b/example/job/theory/ml/linear.json @@ -0,0 +1,21 @@ +{ + "type": "linear", + "subtype": "least_squares", + "dataFrame": { + "...": "include(linear/data_frame.json)" + }, + "data": { + "perProperty": [ + { + "...": "include(linear/data.json)" + } + ] + }, + "precision": { + "perProperty": [ + { + "...": "include(linear/precision.json)" + } + ] + } +} diff --git a/example/job/theory/ml/linear/data.json b/example/job/theory/ml/linear/data.json new file mode 100644 index 000000000..3659cb6af --- /dev/null +++ b/example/job/theory/ml/linear/data.json @@ -0,0 +1,27 @@ +{ + "name": "band_gaps:indirect", + "coefficients": [ + -3.339e-01, + 2.555e-01 + ], + "features": [ + "elemental_composition", + "electronegativity" + ], + "intercept": [ + 0.5 + ], + "scores": [ + 0.018, + 0.513 + ], + "scaler": [ + { + "name": "mean", + "values": [ + 0.5, + 1.95 + ] + } + ] +} diff --git a/example/job/theory/ml/linear/data_frame.json b/example/job/theory/ml/linear/data_frame.json new file mode 100644 index 000000000..9eb425587 --- /dev/null +++ b/example/job/theory/ml/linear/data_frame.json @@ -0,0 +1,16 @@ +{ + "c8zG3XcnnTybfP3QQ": { + "electronegativity": 1.90, + "elemental_composition": { + "Ge": 0.3125, + "Si": 0.6875 + } + }, + "wWK2XCyivQrG8j34Z": { + "electronegativity": 2.00, + "elemental_composition": { + "Ge": 0.1875, + "Si": 0.8125 + } + } +} diff --git a/example/job/theory/ml/linear/input_fit.json b/example/job/theory/ml/linear/input_fit.json new file mode 100644 index 000000000..b8cff7ac4 --- /dev/null +++ b/example/job/theory/ml/linear/input_fit.json @@ -0,0 +1,6 @@ +{ + "sampleWeight": true, + "numFeatures": 2, + "scaler": "StandardScaler", + "numSplits":3 +} diff --git a/example/job/theory/ml/linear/precision.json b/example/job/theory/ml/linear/precision.json new file mode 100644 index 000000000..49be13ab6 --- /dev/null +++ b/example/job/theory/ml/linear/precision.json @@ -0,0 +1,6 @@ +{ + "name": "band_gaps:indirect", + "trainingError": 0.1, + "cvError": 0.3, + "score": 0.8 +} diff --git a/example/job/workflow/unit/execution.json b/example/job/workflow/unit/execution.json index 11921868c..0fbce745d 100644 --- a/example/job/workflow/unit/execution.json +++ b/example/job/workflow/unit/execution.json @@ -5,8 +5,7 @@ "compute": null, "input": [ { - "content": "K_POINTS automatic\n2 2 2 0 0 0", - "name": "pw_scf.in" + "...": "include(execution/input.json)" } ] } diff --git a/example/job/workflow/unit/execution/input.json b/example/job/workflow/unit/execution/input.json new file mode 100644 index 000000000..af6b3904f --- /dev/null +++ b/example/job/workflow/unit/execution/input.json @@ -0,0 +1,4 @@ +{ + "content": "K_POINTS automatic\n2 2 2 0 0 0", + "name": "pw_scf.in" +} diff --git a/example/material/elements/_elemental_data.json b/example/material/elements/_elemental_data.json new file mode 100644 index 000000000..7ae6fc43b --- /dev/null +++ b/example/material/elements/_elemental_data.json @@ -0,0 +1,4 @@ +{ + "name": "valence_electrons", + "value": 4 +} diff --git a/example/material/elements/element.json b/example/material/elements/element.json new file mode 100644 index 000000000..3eee65175 --- /dev/null +++ b/example/material/elements/element.json @@ -0,0 +1,41 @@ +{ + "element": "Si", + "properties": [ + { + "name": "valence_electrons", + "value": 4 + }, + { + "name": "unpaired_electrons", + "value": 4 + }, + { + "name": "atomic_radius", + "value": 111.0, + "units": "pm" + }, + { + "name": "electron_configuration", + "value": "[Ne]3s23p2" + }, + { + "name": "electronegativity", + "value": 1.90 + }, + { + "name": "ionization_potential", + "value": 8.15, + "units": "eV" + }, + { + "name": "density", + "value": 2.32, + "units": "g/cm^3" + }, + { + "name": "cohesive_energy", + "value": 4.63, + "units": "eV/atom" + } + ] +} diff --git a/example/material/fingerprint.json b/example/material/fingerprint.json new file mode 100644 index 000000000..49169cf12 --- /dev/null +++ b/example/material/fingerprint.json @@ -0,0 +1,17 @@ +{ + "elemental":[ + { + "...": "include(fingerprint/elemental.json)" + } + ], + "primary": [ + { + "...": "include(fingerprint/primary.json)" + } + ], + "secondary": [ + { + "...": "include(characteristic.json)" + } + ] +} diff --git a/example/material/fingerprint/elemental.json b/example/material/fingerprint/elemental.json new file mode 100644 index 000000000..16789cc76 --- /dev/null +++ b/example/material/fingerprint/elemental.json @@ -0,0 +1,6 @@ +{ + "type": "element-specific", + "subtype": "numeric", + "name": "ionization_potential", + "...": "include(elemental/ionization_potential.json)" +} diff --git a/example/material/fingerprint/elemental/ionization_potential.json b/example/material/fingerprint/elemental/ionization_potential.json new file mode 100644 index 000000000..ae23a2a3f --- /dev/null +++ b/example/material/fingerprint/elemental/ionization_potential.json @@ -0,0 +1,5 @@ +{ + "...": "include(../schemas/element_specific.json)", + "name": "ionization_potential", + "units": "eV" +} diff --git a/example/material/fingerprint/primary.json b/example/material/fingerprint/primary.json new file mode 100644 index 000000000..f7824b54e --- /dev/null +++ b/example/material/fingerprint/primary.json @@ -0,0 +1,7 @@ +{ + "type": "compound-specific-array", + "subtype": "numeric", + "category": "stoichiometric", + "name": "p_norms", + "...": "include(primary/p_norms.json)" +} diff --git a/example/material/fingerprint/primary/p_norms.json b/example/material/fingerprint/primary/p_norms.json new file mode 100644 index 000000000..66b674d9e --- /dev/null +++ b/example/material/fingerprint/primary/p_norms.json @@ -0,0 +1,3 @@ +{ + "...": "include(../schemas/compound_specific_array.json)" +} diff --git a/example/material/fingerprint/schemas/compound_specific_array.json b/example/material/fingerprint/schemas/compound_specific_array.json new file mode 100644 index 000000000..3bd024b7b --- /dev/null +++ b/example/material/fingerprint/schemas/compound_specific_array.json @@ -0,0 +1,21 @@ +{ + "name": "p_norms", + "data": [ + { + "name": "p03", + "value": 0.693 + }, + { + "name": "p05", + "value": 0.671 + }, + { + "name": "p07", + "value": 0.667 + }, + { + "name": "p09", + "value": 0.667 + } + ] +} diff --git a/example/material/fingerprint/schemas/element_specific.json b/example/material/fingerprint/schemas/element_specific.json new file mode 100644 index 000000000..02bd8ecee --- /dev/null +++ b/example/material/fingerprint/schemas/element_specific.json @@ -0,0 +1,12 @@ +{ + "elements": [ + { + "name": "Si", + "value": 8.15 + }, + { + "name": "Ge", + "value": 7.90 + } + ] +} diff --git a/example/material/structure/atomic_data.json b/example/material/structure/atomic_data.json index a917f223a..bc00ffbd2 100644 --- a/example/material/structure/atomic_data.json +++ b/example/material/structure/atomic_data.json @@ -1,18 +1,5 @@ { "name": "atomic_data", - "valenceElectrons": { - "value": [ - { - "id": 1, - "value": 4 - }, - { - "id": 2, - "value": 4 - } - ], - "name": "valence_electrons" - }, "charges": { "value": [ { diff --git a/example/material/structure/lattice_bravais.json b/example/material/structure/lattice_bravais.json index 1ec9365c1..854f8798d 100644 --- a/example/material/structure/lattice_bravais.json +++ b/example/material/structure/lattice_bravais.json @@ -1,6 +1,6 @@ { - "name": "lattice_bravais", "type": "CUB", + "name": "lattice_bravais", "a": 5.14, "b": 5.14, "c": 5.14, diff --git a/schema/job.json b/schema/job.json index 689cef77f..4c7b21960 100644 --- a/schema/job.json +++ b/schema/job.json @@ -74,9 +74,12 @@ "description": "Subset of the full information about the project that this job belongs to. Included for quick access in search.", "$ref": "file:job/_project.json" }, - "_material": { + "_materials": { "description": "Subset of the full information about the materials used inside this job.", - "$ref": "file:job/_material.json" + "type": "array", + "items": { + "$ref": "file:job/_material.json" + } }, "version": { "description": "Job's schema version. Used to distinct between different schemas.", @@ -108,6 +111,24 @@ "_id", "title" ] + }, + "api": { + "description": "REST API configuration", + "type": "object", + "properties": { + "userId": { + "description": "user ID", + "type": "string" + }, + "authToken": { + "description": "authentication token", + "type": "string" + } + }, + "required": [ + "userId", + "authToken" + ] } }, "required": [ diff --git a/schema/job/app.json b/schema/job/app.json index 89d8e1c93..a9b585929 100644 --- a/schema/job/app.json +++ b/schema/job/app.json @@ -32,6 +32,9 @@ "$ref": "file:software/vasp.json" }, { + "$ref": "file:software/ml.json" + }, + { "$ref": "file:software/shell.json" }, { @@ -40,7 +43,6 @@ ], "required": [ "name", - "flavor", "version", "exec" ] diff --git a/schema/job/input.json b/schema/job/input.json new file mode 100644 index 000000000..a3f2e27ce --- /dev/null +++ b/schema/job/input.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Execution unit object input schema", + "type": "object", + "oneOf": [ + { + "description": "input schema for ml methods.", + "$ref": "file:theory/ml/input.json" + } + ] +} diff --git a/schema/job/software/ml.json b/schema/job/software/ml.json new file mode 100644 index 000000000..2429ab9e3 --- /dev/null +++ b/schema/job/software/ml.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "default machine learning app schema", + "type": "object", + "properties": { + "name": { + "enum": [ + "ml" + ] + }, + "summary": { + "enum": [ + "Default Machine Learning Engine" + ] + }, + "version": { + "enum": [ + "0.1.1" + ] + }, + "exec": { + "enum": [ + "rupy" + ] + } + } +} diff --git a/schema/job/theory/_methods.json b/schema/job/theory/_methods.json new file mode 100644 index 000000000..4e1b2d1e0 --- /dev/null +++ b/schema/job/theory/_methods.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "List of all supported methods", + "oneOf": [ + { + "$ref": "file:dft/_methods.json" + }, + { + "$ref": "file:ml/_methods.json" + } + ] +} diff --git a/schema/job/theory/_models.json b/schema/job/theory/_models.json new file mode 100644 index 000000000..a470cd277 --- /dev/null +++ b/schema/job/theory/_models.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "List of supported models", + "oneOf": [ + { + "$ref": "file:dft.json" + }, + { + "$ref": "file:ml.json" + } + ] +} diff --git a/schema/job/theory/dft/_methods.json b/schema/job/theory/dft/_methods.json new file mode 100644 index 000000000..357181208 --- /dev/null +++ b/schema/job/theory/dft/_methods.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "List of methods", + "oneOf": [ + { + "$ref": "file:local-orbital.json" + }, + { + "$ref": "file:pseudopotential.json" + } + ] +} diff --git a/schema/job/theory/ml.json b/schema/job/theory/ml.json new file mode 100644 index 000000000..b7fcd319a --- /dev/null +++ b/schema/job/theory/ml.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "machine learning schema", + "description": "machine learning schema", + "properties": { + "type": { + "enum": [ + "machine_learning" + ] + }, + "subtype": { + "enum": [ + "supervised", + "unsupervised" + ] + } + } +} diff --git a/schema/job/theory/ml/_input_fit.json b/schema/job/theory/ml/_input_fit.json new file mode 100644 index 000000000..71c36c507 --- /dev/null +++ b/schema/job/theory/ml/_input_fit.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "List of input fit arguments", + "type": "object", + "properties": { + "method": { + "properties": { + "type": { + "enum": [ + "linear" + ] + }, + "subtype": { + "enum": [ + "least_squares", + "ridge" + ] + } + } + }, + "arguments": { + "oneOf": [ + { + "$ref": "file:linear/input_fit.json" + } + ] + } + }, + "required": [ + "method" + ] +} diff --git a/schema/job/theory/ml/_methods.json b/schema/job/theory/ml/_methods.json new file mode 100644 index 000000000..de59940eb --- /dev/null +++ b/schema/job/theory/ml/_methods.json @@ -0,0 +1,43 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "List of methods for ML", + "properties": { + "dataFrame": { + "description": "data frame used to train ml method", + "type": "object" + }, + "precision": { + "perProperty": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "characteristic property name in a flat format: eg. `band_gaps:indirect`", + "type": "string" + } + } + } + } + }, + "data": { + "perProperty": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "characteristic property name in a flat format: eg. `band_gaps:indirect`", + "type": "string" + } + } + } + } + } + }, + "oneOf": [ + { + "$ref": "file:linear.json" + } + ] +} diff --git a/schema/job/theory/ml/input.json b/schema/job/theory/ml/input.json new file mode 100644 index 000000000..54d9ed884 --- /dev/null +++ b/schema/job/theory/ml/input.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "ML methods input schema", + "type": "object", + "oneOf": [ + { + "$ref": "file:input/fit.json" + }, + { + "$ref": "file:input/predict.json" + } + ], + "properties": { + "materials": { + "type": "object", + "properties": { + "exabyteIds": { + "description": "List of material ids corresponding to materials used for model fitting or property prediction", + "type": "array" + } + } + } + }, + "required": [ + "materials" + ] +} diff --git a/schema/job/theory/ml/input/fit.json b/schema/job/theory/ml/input/fit.json new file mode 100644 index 000000000..161f7ffc4 --- /dev/null +++ b/schema/job/theory/ml/input/fit.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "ML methods input schema", + "type": "object", + "allOf": [ + { + "$ref": "file:../_input_fit.json" + } + ], + "properties": { + "type": { + "enum": [ + "fit" + ] + }, + "features": { + "description": "material features used for model fitting", + "type": "array" + }, + "properties": { + "description": "target properties to predict", + "type": "array" + }, + "method": { + "properties": { + "type": { + "type": "string" + }, + "subtype": { + "type": "string" + } + } + } + }, + "required": [ + "type", + "features", + "properties" + ] +} diff --git a/schema/job/theory/ml/input/predict.json b/schema/job/theory/ml/input/predict.json new file mode 100644 index 000000000..8aae1faf5 --- /dev/null +++ b/schema/job/theory/ml/input/predict.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "predict schema", + "type": "object", + "properties": { + "type": { + "enum": [ + "predict" + ] + }, + "method": { + "oneOf": [ + { + "description": "pre-trained ml method (when predicting) or an object describing a new one to be fit", + "$ref": "file:../_methods.json" + }, + { + "description": "method read from workflow scope", + "$ref": "file:../../../workflow/unit/_input.json" + } + ] + } + }, + "required": [ + "type", + "method" + ] +} diff --git a/schema/job/theory/ml/linear.json b/schema/job/theory/ml/linear.json new file mode 100644 index 000000000..0b7e5aa17 --- /dev/null +++ b/schema/job/theory/ml/linear.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "linear methods schema", + "properties": { + "type": { + "enum": [ + "linear" + ] + }, + "subtype": { + "enum": [ + "least_squares", + "ridge" + ] + }, + "dataFrame": { + "$ref": "file:linear/data_frame.json" + }, + "precision": { + "perProperty": { + "items": { + "$ref": "file:linear/precision.json" + } + } + }, + "data": { + "perProperty": { + "items": { + "$ref": "file:linear/data.json" + } + } + } + }, + "required": [ + "type", + "subtype", + "dataFrame", + "precision", + "data" + ] +} diff --git a/schema/job/theory/ml/linear/data.json b/schema/job/theory/ml/linear/data.json new file mode 100644 index 000000000..4ce4693ae --- /dev/null +++ b/schema/job/theory/ml/linear/data.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "regression parameters schema", + "properties": { + "coefficients": { + "type": "array", + "description": "Array with weights/coefficients of the function for each target in property vector from the linear or non-linear fit", + "items": { + "type": "number" + } + }, + "intercept": { + "type": "array", + "description": "list of intercepts (shift) from the linear or non-linear fit of data points", + "items": { + "type": "number" + } + }, + "features": { + "type": "array", + "description": "Array with subset of features used in linear or non-linear fit", + "items": { + "type": "string" + } + }, + "scores": { + "type": "array", + "description": "Array of pvalues of features used in linear or non-linear fit, https://en.wikipedia.org/wiki/P-value", + "items": { + "type": "number" + } + }, + "scaler": { + "type": "array", + "description": "feature scaling parameters from linear/non-linear fit", + "items": { + "properties": { + "name": { + "description": "name of variable", + "enum": [ + "mean", + "variance" + ] + }, + "values": { + "type": "array", + "description": "array of values corresponding to the variable. Example: variance in training data", + "items": { + "type": "number" + } + } + } + } + } + }, + "required": [ + "coefficients", + "intercept", + "features", + "scaler", + "scores" + ] +} + diff --git a/schema/job/theory/ml/linear/data_frame.json b/schema/job/theory/ml/linear/data_frame.json new file mode 100644 index 000000000..4b5394091 --- /dev/null +++ b/schema/job/theory/ml/linear/data_frame.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "data frame for linear method (TODO: define)", + "type": "object" +} + diff --git a/schema/job/theory/ml/linear/input_fit.json b/schema/job/theory/ml/linear/input_fit.json new file mode 100644 index 000000000..11fc64496 --- /dev/null +++ b/schema/job/theory/ml/linear/input_fit.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "linear methods fit arguments schema", + "properties": { + "sampleWeight": { + "type": "boolean", + "description": "specify whether to scale the response variables" + }, + "numSplits":{ + "type": "number", + "description": "number of groups to split the training data set for cross-validation" + }, + "scaler":{ + "type":"string", + "description": "name of the feature scaling method for scaling input features. Eg: StandardScaler" + }, + "numFeatures": { + "type": "number", + "description": "number of features to select for model training" + } + }, + "required": [ + "sampleWeight" + ] +} diff --git a/schema/job/theory/ml/linear/precision.json b/schema/job/theory/ml/linear/precision.json new file mode 100644 index 000000000..5543f0398 --- /dev/null +++ b/schema/job/theory/ml/linear/precision.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "precision schema for regression", + "properties": { + "trainingError": { + "description": "training error of the estimator", + "type": "number" + }, + "cvError": { + "description": "cross validation error of the estimator", + "type": "number" + }, + "score": { + "description": "prediction score of the estimator. Eg: r2_score", + "type": "number" + } + }, + "required": [ + "trainingError" + ] +} diff --git a/schema/job/workflow/subworkflow/model.json b/schema/job/workflow/subworkflow/model.json index f83729ea8..03ef34fd5 100644 --- a/schema/job/workflow/subworkflow/model.json +++ b/schema/job/workflow/subworkflow/model.json @@ -24,9 +24,9 @@ } } }, - "oneOf": [ + "allOf": [ { - "$ref": "file:../../theory/dft.json" + "$ref": "file:../../theory/_models.json" } ], "required": [ diff --git a/schema/job/workflow/subworkflow/model/method.json b/schema/job/workflow/subworkflow/model/method.json index b0b1ab6bb..6b6e06cfd 100644 --- a/schema/job/workflow/subworkflow/model/method.json +++ b/schema/job/workflow/subworkflow/model/method.json @@ -18,12 +18,9 @@ "type": "object" } }, - "oneOf": [ + "allOf": [ { - "$ref": "file:../../../theory/dft/pseudopotential.json" - }, - { - "$ref": "file:../../../theory/dft/local-orbital.json" + "$ref": "file:../../../theory/_methods.json" } ], "required": [ diff --git a/schema/job/workflow/unit/execution.json b/schema/job/workflow/unit/execution.json index e87696f3a..caea449f8 100644 --- a/schema/job/workflow/unit/execution.json +++ b/schema/job/workflow/unit/execution.json @@ -15,20 +15,15 @@ "description": "Unit's input.", "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "description": "Input file name. e.g. pw_scf.in", - "type": "string" + "oneOf": [ + { + "description": "textual input (eg. for simulation engines)", + "$ref": "file:execution/input.json" }, - "content": { - "description": "Content of the input file. e.g. &CONTROL calculation='scf' ...", - "type": "string" + { + "description": "object input (eg. for machine learning)", + "$ref": "file:../../input.json" } - }, - "required": [ - "name", - "content" ] } } diff --git a/schema/job/workflow/unit/execution/input.json b/schema/job/workflow/unit/execution/input.json new file mode 100644 index 000000000..6dec40166 --- /dev/null +++ b/schema/job/workflow/unit/execution/input.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "execution unit text input schema", + "type": "object", + "properties": { + "name": { + "description": "Input file name. e.g. pw_scf.in", + "type": "string" + }, + "content": { + "description": "Content of the input file. e.g. &CONTROL calculation='scf' ...", + "type": "string" + } + }, + "required": [ + "name", + "content" + ] +} diff --git a/schema/material/elements/_elemental_data.json b/schema/material/elements/_elemental_data.json new file mode 100644 index 000000000..54f60acc3 --- /dev/null +++ b/schema/material/elements/_elemental_data.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "standard elemental data", + "description": "properties of elements", + "type": "object", + "properties": { + "name": { + "description": "name of the property", + "enum": [ + "valence_electrons", + "unpaired_electrons", + "atomic_radius", + "electronegativity", + "ionization_potential", + "electron_configuration", + "cohesive_energy", + "density" + ] + }, + "value": { + "description": "value of the property", + "type": ["number", "string"] + }, + "units": { + "oneOf":[ + { + "$ref": "file:../units.json#/definitions/length" + }, + { + "$ref": "file:../units.json#/definitions/energy" + }, + { + "$ref": "file:../units.json#/definitions/density" + } + ] + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/elements/element.json b/schema/material/elements/element.json new file mode 100644 index 000000000..e56f921dd --- /dev/null +++ b/schema/material/elements/element.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Element symbol and elemental properties schema", + "description": "element symbols", + "properties":{ + "element":{ + "description": "element symbol", + "type": "string" + }, + "properties":{ + "description": "elemental properties. standard data", + "type": "array", + "items":{ + "$ref": "file:_elemental_data.json" + } + } + }, + "required":[ + "element", + "properties" + ] +} diff --git a/schema/material/fingerprint.json b/schema/material/fingerprint.json new file mode 100644 index 000000000..b0532631c --- /dev/null +++ b/schema/material/fingerprint.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "material fingerprint schema", + + "description": "collection of elemental and material descriptors. Required for performing advanced ML tasks", + "properties": { + "elemental": { + "type": "array", + "description": "elemental descriptors. Properties of constituent elements Example: atomic_radius or ionization_potential ", + "items": { + "$ref": "file:fingerprint/elemental.json" + } + }, + "primary": { + "type": "array", + "description": "descriptors related to structure, stoichiometry and physical reference data of materials. Calculated on-the-fly ", + "items": { + "$ref": "file:fingerprint/primary.json" + } + }, + "secondary": { + "type": "array", + "description": "characteristic properties", + "items": { + "$ref": "file:characteristic.json" + } + } + }, + "required": [ + "elemental", + "primary", + "secondary" + ] +} diff --git a/schema/material/fingerprint/_primary.json b/schema/material/fingerprint/_primary.json new file mode 100644 index 000000000..8a1dc017e --- /dev/null +++ b/schema/material/fingerprint/_primary.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "descriptor category schema", + "description": "type/subtype each primary descriptor belongs to", + "properties": { + "type": { + "type": "string", + "enum": [ + "element-specific", + "compound-specific", + "compound-specific-array" + ] + }, + "subtype": { + "description": "type of descriptor, whether it is a number or category", + "type": "string", + "enum": [ + "numeric", + "nominal", + "ordinal" + ] + }, + "category": { + "type": "string", + "enum": [ + "chemical", + "stoichiometric", + "structural", + "electronic" + ] + } + }, + "required": [ + "type", + "subtype" + ] +} diff --git a/schema/material/fingerprint/elemental.json b/schema/material/fingerprint/elemental.json new file mode 100644 index 000000000..94cbd22ee --- /dev/null +++ b/schema/material/fingerprint/elemental.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "elemental descriptors schema", + "description": "collection of standard data for elements from databases. Eg: NIST physical reference data ", + "properties": { + "name": { + "description": "Name of the descriptor", + "type": "string", + "enum": [ + "valence_electrons", + "ionization_potential", + "atomic_radius", + "electronegativity", + "unpaired_electrons" + ] + }, + "type": { + "type": "string", + "enum": [ + "element-specific" + ] + }, + "subtype": { + "description": "type of descriptor, whether it is a number or category", + "type": "string", + "enum": [ + "numeric", + "nominal" + ] + } + }, + "oneOf": [ + { + "$ref": "file:elemental/valence_electrons.json" + }, + { + "$ref": "file:elemental/unpaired_electrons.json" + }, + { + "$ref": "file:elemental/electronegativity.json" + }, + { + "$ref": "file:elemental/ionization_potential.json" + }, + { + "$ref": "file:elemental/atomic_radius.json" + } + ], + "required": [ + "name", + "type", + "subtype" + ] +} diff --git a/schema/material/fingerprint/elemental/atomic_radius.json b/schema/material/fingerprint/elemental/atomic_radius.json new file mode 100644 index 000000000..55dd88904 --- /dev/null +++ b/schema/material/fingerprint/elemental/atomic_radius.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "atomic radius schema", + "description": "atomic radius of each element in the material", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "atomic_radius" + ] + }, + "units": { + "$ref":"file:../../units.json#/definitions/length" + } + }, + "required": [ + "name", + "units" + ] +} diff --git a/schema/material/fingerprint/elemental/electronegativity.json b/schema/material/fingerprint/elemental/electronegativity.json new file mode 100644 index 000000000..44c7f233c --- /dev/null +++ b/schema/material/fingerprint/elemental/electronegativity.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "pauling electronegativity schema", + "description": "electronegativity of each element in the material on pauling scale", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "electronegativity" + ] + }, + "value": { + "type": "number" + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/elemental/ionization_potential.json b/schema/material/fingerprint/elemental/ionization_potential.json new file mode 100644 index 000000000..132292c01 --- /dev/null +++ b/schema/material/fingerprint/elemental/ionization_potential.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "ionization potential schema", + "description": "first ionization potential of each element in the material in eV", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "ionization_potential" + ] + }, + "units": { + "$ref": "file:../../units.json#/definitions/energy" + } + }, + "required":[ + "name", + "units" + ] +} diff --git a/schema/material/fingerprint/elemental/unpaired_electrons.json b/schema/material/fingerprint/elemental/unpaired_electrons.json new file mode 100644 index 000000000..8f1fd3810 --- /dev/null +++ b/schema/material/fingerprint/elemental/unpaired_electrons.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "unpaired electrons schema", + "description": "number of unpaired electrons in each element in the material", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "unpaired_electrons" + ] + }, + "value": { + "type": "number" + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/elemental/valence_electrons.json b/schema/material/fingerprint/elemental/valence_electrons.json new file mode 100644 index 000000000..e4599ce50 --- /dev/null +++ b/schema/material/fingerprint/elemental/valence_electrons.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "valence electrons schema", + "description": "valence electrons in each element in the material", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "valence_electrons" + ] + }, + "value": { + "type": "number" + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/primary.json b/schema/material/fingerprint/primary.json new file mode 100644 index 000000000..ee7675b9d --- /dev/null +++ b/schema/material/fingerprint/primary.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "primary descriptors schema", + "description": "collection of stoichiometric, structural, physical, electronic and chemical", + "allOf": [ + { + "$ref": "file:_primary.json" + } + ], + "properties": { + "name": { + "description": "Name of the descriptor", + "type": "string", + "enum": [ + "local_environment", + "element_spin_state", + "valence_orbital_occupancy", + "p_norms", + "elemental_composition", + "crystal_cell_type", + "material_type", + "is_relaxed", + "avg_atom_volume" + ] + } + }, + "oneOf": [ + { + "$ref": "file:primary/local_environment.json" + }, + { + "$ref": "file:primary/element_spin_state.json" + }, + { + "$ref": "file:primary/valence_orbital_occupancy.json" + }, + { + "$ref": "file:primary/p_norms.json" + }, + { + "$ref": "file:primary/elemental_composition.json" + }, + { + "$ref": "file:primary/crystal_cell_type.json" + }, + { + "$ref": "file:primary/material_type.json" + }, + { + "$ref": "file:primary/is_relaxed.json" + }, + { + "$ref": "file:primary/avg_atom_volume.json" + } + ] +} diff --git a/schema/material/fingerprint/primary/avg_atom_volume.json b/schema/material/fingerprint/primary/avg_atom_volume.json new file mode 100644 index 000000000..c849a86cb --- /dev/null +++ b/schema/material/fingerprint/primary/avg_atom_volume.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Structural descriptor - average volume per atom schema", + "description": "Total volume divided by number of atoms. Units: ang**3 ", + "allOf": [ + { + "ref": "file:../schemas/compound_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "avg_atom_volume" + ] + }, + "units": { + "$ref": "file:../../units.json#/definitions/volume" + } + }, + "required": [ + "name", + "units" + ] +} diff --git a/schema/material/fingerprint/primary/crystal_cell_type.json b/schema/material/fingerprint/primary/crystal_cell_type.json new file mode 100644 index 000000000..4732657fb --- /dev/null +++ b/schema/material/fingerprint/primary/crystal_cell_type.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Structural descriptor - representation of crsytal lattice", + "description": "primitive or conventional or supercell. Representation differentiates between two materials with similiar composition.", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "crystal_cell_type" + ] + }, + "value": { + "description": "cell representation", + "enum": [ + "primitive", + "supercell", + "conventional" + ] + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/primary/element_spin_state.json b/schema/material/fingerprint/primary/element_spin_state.json new file mode 100644 index 000000000..fba470586 --- /dev/null +++ b/schema/material/fingerprint/primary/element_spin_state.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "element spin state schema schema", + "description": "spin state of each element in the material", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "element_spin_state" + ] + }, + "elements": { + "items": { + "value": { + "description": "high and low spin states correspond to states with max number of unpaired electrons with same spin and maximum number of paired spins respectively.", + "enum": [ + "high", + "intermediate", + "low" + ] + } + } + } + }, + "required": [ + "name", + "elements" + ] +} diff --git a/schema/material/fingerprint/primary/elemental_composition.json b/schema/material/fingerprint/primary/elemental_composition.json new file mode 100644 index 000000000..5dcf7eab8 --- /dev/null +++ b/schema/material/fingerprint/primary/elemental_composition.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "stocihiometric descriptor, elemental composition schema", + "description": "composition of each element in the material", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific_array.json" + } + ], + "properties": { + "name": { + "enum": [ + "elemental_composition" + ] + }, + "value":{ + "type": "number" + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/primary/is_relaxed.json b/schema/material/fingerprint/primary/is_relaxed.json new file mode 100644 index 000000000..0ee37aa95 --- /dev/null +++ b/schema/material/fingerprint/primary/is_relaxed.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Structural descriptor - identifies whether a structure is at equilibrium", + "description": "Differentiates structures with similar composition but different characteristics", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "is_relaxed" + ] + }, + "value": { + "description": "Identifies a equilibrium structure.", + "type": "boolean" + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/primary/local_environment.json b/schema/material/fingerprint/primary/local_environment.json new file mode 100644 index 000000000..c13fbab72 --- /dev/null +++ b/schema/material/fingerprint/primary/local_environment.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "local environment around an atom schema", + "description": "local environment around each element defined by atom type each element is bonded to", + "allOf": [ + { + "$ref": "file:../schemas/element_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "local_environment" + ] + }, + "elements": { + "items": { + "value": { + "description": "atom symbol to which element is bonded to. X means non-bonded or bonded to any atom other than the ones in the list", + "type": "array", + "items":{ + "enum": [ + "H", + "O", + "S", + "F", + "Cl", + "X" + ] + } + } + } + } + }, + "required": [ + "name", + "elements" + ] +} diff --git a/schema/material/fingerprint/primary/material_type.json b/schema/material/fingerprint/primary/material_type.json new file mode 100644 index 000000000..17455d27c --- /dev/null +++ b/schema/material/fingerprint/primary/material_type.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Structural descriptor - type of material", + "description": "crystal or molecule or amorphous or polymer.", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific.json" + } + ], + "properties": { + "name": { + "enum": [ + "material_type" + ] + }, + "value": { + "description": "material type", + "type": "string", + "enum": [ + "crystal", + "polymer", + "molecule", + "amorphous" + ] + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/primary/p_norms.json b/schema/material/fingerprint/primary/p_norms.json new file mode 100644 index 000000000..25cadf602 --- /dev/null +++ b/schema/material/fingerprint/primary/p_norms.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "stoichiometric descriptor - p-norms schema", + "description": "values calculated using L-p norm upto p-dimensions", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific_array.json" + } + ], + "properties": { + "name": { + "enum": [ + "p_norms" + ] + }, + "data": { + "items": { + "name": { + "description": "p-norms. Upto p99 allowed. Eg: p03", + "type": "string", + "pattern": "p[0-9]{2}" + } + } + } + }, + "required": [ + "name", + "data" + ] +} diff --git a/schema/material/fingerprint/primary/valence_orbital_occupancy.json b/schema/material/fingerprint/primary/valence_orbital_occupancy.json new file mode 100644 index 000000000..cdb37bb49 --- /dev/null +++ b/schema/material/fingerprint/primary/valence_orbital_occupancy.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "electronic descriptor - valence orbital occupancy schema", + "description": "fraction-weighted average of the number of valance electrons in each orbital divided by total valence electrons", + "allOf": [ + { + "$ref": "file:../schemas/compound_specific_array.json" + } + ], + "properties": { + "name": { + "enum": [ + "valence_orbital_occupancy" + ] + }, + "data": { + "items": { + "name": { + "description": "valence orbital occupancy - https://www.nature.com/article-assets/npg/npjcompumats/2016/npjcompumats201628/extref/npjcompumats201628-s1.pdf", + "type": "string", + "enum": [ + "s", + "p", + "d", + "f" + ] + } + } + } + }, + "required": [ + "name", + "data" + ] +} diff --git a/schema/material/fingerprint/schemas/compound_specific.json b/schema/material/fingerprint/schemas/compound_specific.json new file mode 100644 index 000000000..31447c516 --- /dev/null +++ b/schema/material/fingerprint/schemas/compound_specific.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "compound specific descriptors schema", + "description": "applicable for nominal/ordinal/numeric value types", + "properties": { + "name": { + "description": "name of the descriptor", + "type": "string" + }, + "value": { + "description": "value of the descriptor", + "type": [ + "string", + "number", + "boolean" + ] + } + }, + "required": [ + "name", + "value" + ] +} diff --git a/schema/material/fingerprint/schemas/compound_specific_array.json b/schema/material/fingerprint/schemas/compound_specific_array.json new file mode 100644 index 000000000..eed9df8c0 --- /dev/null +++ b/schema/material/fingerprint/schemas/compound_specific_array.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "compound-specific descriptor array schema", + "description": "multiple elements related to compound-specific descriptor. Example: p-norms", + "properties": { + "name": { + "description": "name of the descriptor", + "type": "string" + }, + "data": { + "description": "compound-specific descriptor data in an array", + "type": "array", + "items": { + "properties": { + "name": { + "description": "variable name", + "type": "string" + }, + "value": { + "description": "the value for the corresponding elemental property", + "type": "number" + } + } + } + } + }, + "required": [ + "name", + "data" + ] +} diff --git a/schema/material/fingerprint/schemas/element_specific.json b/schema/material/fingerprint/schemas/element_specific.json new file mode 100644 index 000000000..11e737b43 --- /dev/null +++ b/schema/material/fingerprint/schemas/element_specific.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "element specific descriptors schema", + "description": "applicable for nominal/ordinal/numeric value types", + "properties": { + "elements": { + "description": "elements in a material and corresponding descriptor value", + "type": "array", + "items": { + "properties": { + "name": { + "description": "element symbol. Eg: Si", + "type": "string" + }, + "value": { + "description": "elemental property value", + "type": ["string", "number", "array"] + } + } + } + } + }, + "required": [ + "elements" + ] +} diff --git a/schema/material/structure/atomic_data.json b/schema/material/structure/atomic_data.json index 4273721aa..7d6f0b9c1 100644 --- a/schema/material/structure/atomic_data.json +++ b/schema/material/structure/atomic_data.json @@ -4,46 +4,46 @@ "description": "properties of atoms in arrays indexed by ids", "type": "object", "properties": { - "valenceElectrons": { - "description": "number of valence electrons", + "occurrence": { + "description": "occurrence of the element for fractional occupancy", "properties": { "value": { "$ref": "file:atomic_masses.json" }, "name": { "enum": [ - "valence_electrons" + "occurrence" ] } } }, - "charges": { - "description": "difference between total and valence electrons on atom", + "oxidationState": { + "description": "oxidation state of the element", "properties": { "value": { "$ref": "file:atomic_masses.json" }, "name": { "enum": [ - "charges" - ] - }, - "units": { - "enum": [ - "electron charge" + "oxidation_state" ] } } }, - "radicals": { - "description": "number of unpaired electrons", + "charges": { + "description": "difference between total and valence electrons on atom", "properties": { "value": { "$ref": "file:atomic_masses.json" }, "name": { "enum": [ - "radicals" + "charges" + ] + }, + "units": { + "enum": [ + "electron charge" ] } } diff --git a/schema/material/structure/atomic_elements.json b/schema/material/structure/atomic_elements.json index e21e4c2e7..559381554 100644 --- a/schema/material/structure/atomic_elements.json +++ b/schema/material/structure/atomic_elements.json @@ -11,14 +11,6 @@ "value": { "description": "atomic elements (eg Si, Ge)", "type": "string" - }, - "occurrence": { - "description": "occurrence of the element for fractional occupancy", - "type": "number" - }, - "oxidationState": { - "description": "oxidation state of the element", - "type": "integer" } } } diff --git a/schema/material/units.json b/schema/material/units.json new file mode 100644 index 000000000..339f0e8cb --- /dev/null +++ b/schema/material/units.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "units schema", + "definitions": { + "length":{ + "enum":[ + "km", + "m", + "pm", + "nm", + "angstrom", + "a.u." + ] + }, + "energy":{ + "enum":[ + "kJ/mol", + "eV", + "J/mol", + "hartree", + "cm-1", + "eV/atom" + ] + }, + "volume": { + "enum": [ + "cm^3", + "angstrom^3" + ] + }, + "numberDensity":{ + "enum": [ + "1/angstrom^3" + ] + }, + "density":{ + "enum": [ + "g/cm^3" + ] + } + } +} diff --git a/tests/validate.spec.js b/tests/validate.spec.js index fd56d6f12..25410c7b8 100644 --- a/tests/validate.spec.js +++ b/tests/validate.spec.js @@ -42,7 +42,7 @@ function parseJSONInclude(dirpath, filename, isInclude) { json = fs.readFileSync(filepath, 'utf8'), d = JSON.parse(json); if (isInclude) { - if (! isInstance(d, "Object")) { + if (!isInstance(d, "Object")) { throw "The JSON file being included should always be a dict rather than a list"; } } @@ -103,7 +103,7 @@ function walkThoughToInclude(obj, dirpath) { * see walkSync docs for more info. */ walkSync(schemasDir, function (dirPath, dirs, files) { - files.forEach(f=> { + files.forEach(f => { const filePath = path.join(dirPath, f); const dir = _.trimStart(dirPath.replace(schemasDir, ''), '/'); @@ -125,7 +125,7 @@ walkSync(schemasDir, function (dirPath, dirs, files) { }); // generate id for each schema and replace $refs values by appropriate id -schemas.forEach(schema=> { +schemas.forEach(schema => { addIdProp(schema); replaceRefs(schema); }); @@ -159,9 +159,10 @@ function addIdProp(schema) { schema.id = schema.content.id; } + var ajv = Ajv({ allErrors: true, - schemas: schemas.map(schema=> schema.content) + schemas: schemas.map(schema => schema.content) }); describe('ajv', function () { @@ -182,7 +183,7 @@ describe('example', function () { const validator = ajv.getSchema(schema.id); const valid = validator(schema.example); if (!valid) { - console.log(JSON.stringify(schema.example)) + console.log(JSON.stringify(schema.example)); console.log(prettyjson.render(validator.errors)); } chai.expect(valid).to.be.ok;