Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple schema examples #40

Merged
merged 4 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions qc_schema/dev/dev_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,33 @@
"type": "object",
"properties": {
"molecule": molecule.molecule,
"schema_name": {
"type": "string",
"pattern": "\W*(QC_JSON)\W*"
},
"schema_version": {
"type": "string"
},
"driver": {
"definition": "The type of computation requested",
"enum": ["energy", "gradient", "hessian", "property"]
"enum": ["energy", "gradient", "hessian"]
},
"model": {
"definition": "The method and basis specification requested",
"properties": {
"method": {
"type": "string"
},
"basis": {
"type": "string"
}
},
"required": ["method", "basis"],
"description": "The quantum chemistry model to be run."
},
"keywords": {
"type": "object"
"type": "object",
"description": "Program specific parameters to be used."
},
"provenance": {
"anyOf": [{
Expand All @@ -38,7 +59,7 @@
}]
}
},
"required": ["molecule", "driver", "keywords"],
"required": ["schema_name", "schema_version", "molecule", "driver", "keywords", "model"],
"definitions": definitions.definitions
}

Expand All @@ -49,17 +70,27 @@
"type": "boolean"
},
"error": {
"definition": "The type and description of error raised.",
"type": "object",
"$ref": "#/definitions/error"
},
"return_result": {
"definition": "The primary specified return of the requested computation.",
"anyOf": [{
"type": "number"
}, {
"type": "array",
"items": {"type": "number"}
}]
}
}

# Snapshot the input dev schema
input_dev_schema = copy.deepcopy(base_schema)

# Add additional output pieces
base_schema["properties"].update(output_properties)
base_schema["required"].extend(["provenance", "properties", "success"])
base_schema["required"].extend(["provenance", "properties", "success", "return_result"])

# Snapshot the input dev schema
output_dev_schema = copy.deepcopy(base_schema)
Expand Down
35 changes: 35 additions & 0 deletions qc_schema/dev/properties/calcinfo_properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
The complete list of the general computation properties.
"""

calcinfo_properties = {}

calcinfo_properties["calcinfo_nbasis"] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to duplicate calcinfo in the key name if it's already in the filename and the struct name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind the structure is flattened. The python is just there to help build out a structure instead of writing a single 5k line schema.

"type": "number",
"multipleOf": 1.0,
"description": "The number of basis functions for the computation."
}

calcinfo_properties["calcinfo_nmo"] = {
"type": "number",
"multipleOf": 1.0,
"description": "The number of molecular orbitals for the computation."
}

calcinfo_properties["calcinfo_nalapha"] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nalapha -> nalpha

"type": "number",
"multipleOf": 1.0,
"description": "The number of alpha electrons in the computation."
}

calcinfo_properties["calcinfo_nbeta"] = {
"type": "number",
"multipleOf": 1.0,
"description": "The number of beta electrons in the computation."
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does something like reference (RHF/UHF/ROHF) go in calcinfo_properties or scf_properties? I guess I am not clear on the border where different steps in a computation get news instances of the schema. For example, you may run the SCF step with ROHF but then CCSD with UHF, and if both SCF/CCSD steps are part of the same instance, something (like the reference) needs to be present in multiple places.

This is related to the discussion about properties (HF vs. CCSD dipole moment); I think the same thing applies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure there is a clear line yet. To me, I think thats a single computation. I kind of feel those specification might come in method as the choice to use ROHF SCF/UHF CCSD is a user setting. properties seems to be purely as the result.


calcinfo_properties["calcinfo_natom"] = {
"type": "number",
"multipleOf": 1.0,
"description": "The number of atoms in the computation."
}
2 changes: 2 additions & 0 deletions qc_schema/dev/properties/properties_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .scf_properties import scf_properties
from .mp_properties import mp_properties
from .calcinfo_properties import calcinfo_properties

properties = {
"type": "object",
Expand All @@ -15,3 +16,4 @@
# Update new keys
properties["properties"].update(scf_properties)
properties["properties"].update(mp_properties)
properties["properties"].update(calcinfo_properties)
2 changes: 2 additions & 0 deletions tests/input_failures/missing_molecule_symbols.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0,
Expand Down
2 changes: 2 additions & 0 deletions tests/input_failures/multiplicity_float.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0,
Expand Down
2 changes: 2 additions & 0 deletions tests/output_failures/dipole_wrong_type.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"provenance": {
"creator": "My QM Program",
"version": "1.1rc1",
Expand Down
2 changes: 2 additions & 0 deletions tests/output_failures/unknown_property.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"provenance": {
"creator": "My QM Program",
"version": "1.1rc1",
Expand Down
24 changes: 24 additions & 0 deletions tests/simple/he2_energy_VV10_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0,
0,
0,
0,
0,
6
],
"symbols": [
"He",
"He"
]
},
"driver": "energy",
"model": {
"method": "VV10",
"basis": "cc-pVDZ"
},
"keywords": {}
}
50 changes: 50 additions & 0 deletions tests/simple/he2_energy_VV10_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0,
0,
0,
0,
0,
6
],
"symbols": [
"He",
"He"
]
},
"driver": "energy",
"model": {
"method": "VV10",
"basis": "cc-pVDZ"
},
"keywords": {},
"provenance": {
"creator": "QM Program",
"version": "1.1",
"routine": "module.json.run_json"
},
"return_result": -5.815121364568496,
"success": true,
"properties": {
"calcinfo_nbasis": 10,
"calcinfo_nmo": 10,
"calcinfo_nalapha": 2,
"calcinfo_nbeta": 2,
"calcinfo_natom": 2,
"scf_one_electron_energy": -9.10156722786234,
"scf_two_electron_energy": 4.782528510470115,
"nuclear_repulsion_energy": 0.6666666666666666,
"scf_dipole_moment": [
0.0,
0.0,
9.030096599360606e-14
],
"scf_iterations": 3,
"scf_total_energy": -5.815121364568496,
"scf_vv10_energy": 0.018799951240226136,
"scf_xc_energy": -2.181549265083163
}
}
38 changes: 0 additions & 38 deletions tests/simple/helium_dimer_hf.json

This file was deleted.

28 changes: 28 additions & 0 deletions tests/simple/water_energy_B3LYP_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0.0,
0.0,
-0.1294769411935893,
0.0,
-1.494187339479985,
1.0274465079245698,
0.0,
1.494187339479985,
1.0274465079245698
],
"symbols": [
"O",
"H",
"H"
]
},
"driver": "energy",
"model": {
"method": "B3LYP",
"basis": "cc-pVDZ"
},
"keywords": {}
}
53 changes: 53 additions & 0 deletions tests/simple/water_energy_B3LYP_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0.0,
0.0,
-0.1294769411935893,
0.0,
-1.494187339479985,
1.0274465079245698,
0.0,
1.494187339479985,
1.0274465079245698
],
"symbols": [
"O",
"H",
"H"
]
},
"driver": "energy",
"model": {
"method": "B3LYP",
"basis": "cc-pVDZ"
},
"keywords": {},
"provenance": {
"creator": "QM Program",
"version": "1.1",
"routine": "module.json.run_json"
},
"return_result": -76.4187620271478,
"success": true,
"properties": {
"calcinfo_nbasis": 24,
"calcinfo_nmo": 24,
"calcinfo_nalapha": 5,
"calcinfo_nbeta": 5,
"calcinfo_natom": 3,
"scf_one_electron_energy": -122.5182981454265,
"scf_two_electron_energy": 44.844942513688004,
"nuclear_repulsion_energy": 8.80146205625184,
"scf_dipole_moment": [
0.0,
0.0,
1.925357619589245
],
"scf_iterations": 6,
"scf_total_energy": -76.4187620271478,
"scf_xc_energy": -7.546868451661161
}
}
28 changes: 28 additions & 0 deletions tests/simple/water_energy_MP2_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"schema_name": "QC_JSON",
"schema_version": "v0.1",
"molecule": {
"geometry": [
0.0,
0.0,
-0.1294769411935893,
0.0,
-1.494187339479985,
1.0274465079245698,
0.0,
1.494187339479985,
1.0274465079245698
],
"symbols": [
"O",
"H",
"H"
]
},
"driver": "energy",
"model": {
"method": "MP2",
"basis": "cc-pVDZ"
},
"keywords": {}
}
Loading