Skip to content

Commit

Permalink
Merge pull request #62 from bennybp/master
Browse files Browse the repository at this point in the history
Clean up basis set schema
  • Loading branch information
dgasmith committed Jun 5, 2019
2 parents a4329e6 + a00a967 commit 9524643
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 182 deletions.
2 changes: 1 addition & 1 deletion qcschema/dev/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .dev_schema import input_dev_schema, output_dev_schema, molecule_dev_schema
from .dev_schema import input_dev_schema, output_dev_schema, molecule_dev_schema, basis_dev_schema
43 changes: 43 additions & 0 deletions qcschema/dev/basis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
The json-schema for the Basis Set definition
"""

basis = {
"$schema": "http://json-schema.org/draft-04/schema#",
"name": "qcschema_basis",
"version": "1.dev",
"description": "The MolSSI Quantum Chemistry Basis Set Schema",
"type": "object",
"required": [
"basis_data",
"basis_atom_map"
],
"additionalProperties": False,
"properties": {
"schema_name": {
"type": "string",
"pattern": "^(qcschema_basis)$"
},
"schema_version": {
"type": "integer"
},
"description": {
"description": "Brief description of the basis set",
"type": "string"
},
"basis_data": {
"description": "Shared basis data for all atoms/centers in the molecule",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/center_basis"
}
},
"basis_atom_map": {
"description": "Mapping of all atoms/centers in the molecule to data in basis_data",
"type": "array",
"items": {
"type": "string"
}
}
}
}
104 changes: 31 additions & 73 deletions qcschema/dev/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,17 @@
"additionalProperties": True
}

definitions["basis_electron_shell"] = {
definitions["electron_shell"] = {
"description": "Information for a single electronic shell",
"additionalProperties": False,
"required": [
"shell_angular_momentum",
"shell_exponents",
"shell_coefficients"
"angular_momentum",
"harmonic_type",
"exponents",
"coefficients"
],
"properties": {
"shell_region": {
"description": "The region this shell describes",
"type": "string",
"enum": [ "valence", "polarization", "core", "tight", "diffuse" ]
},
"shell_angular_momentum": {
"angular_momentum": {
"description": "Angular momentum (as an array of integers)",
"type": "array",
"minItems": 1,
Expand All @@ -64,15 +60,20 @@
"minimum": 0
}
},
"shell_exponents": {
"harmonic_type": {
"description": "Whether this shell is spherical or cartesian",
"type": "string",
"enum": ["spherical", "cartesian"]
},
"exponents": {
"description": "Exponents for this contracted shell",
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"shell_coefficients": {
"coefficients": {
"description": "General contraction coefficients for this contracted shell",
"type": "array",
"minItems": 1,
Expand All @@ -86,23 +87,23 @@
}
}

definitions["basis_ecp_potential"] = {
definitions["ecp_potential"] = {
"description": "ECP potential",
"additionalProperties": False,
"required": [
"potential_ecp_type",
"potential_angular_momentum",
"potential_r_exponents",
"potential_gaussian_exponents",
"potential_coefficients"
"ecp_type",
"angular_momentum",
"r_exponents",
"gaussian_exponents",
"coefficients"
],
"properties": {
"potential_ecp_type": {
"ecp_type": {
"description": "Type of the ECP Potential",
"type": "string",
"enum": [ "scalar", "spinorbit" ]
},
"potential_angular_momentum": {
"angular_momentum": {
"description": "Angular momentum (as an array of integers)",
"type": "array",
"minItems": 1,
Expand All @@ -112,24 +113,24 @@
"minimum": 0
}
},
"potential_r_exponents": {
"r_exponents": {
"description": "Exponents of the r term",
"type": "array",
"minItems": 1,
"items": {
"type": "integer"
}
},
"potential_gaussian_exponents": {
"gaussian_exponents": {
"description": "Exponents of the gaussian term",
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"potential_coefficients": {
"description": "General contraction coefficients for this contracted shell",
"coefficients": {
"description": "General contraction coefficients for this potential",
"type": "array",
"minItems": 1,
"items": {
Expand All @@ -142,77 +143,34 @@
}
}

definitions["basis_single_data"] = {
definitions["center_basis"] = {
"description": "Data for a single atom/center in the basis set",
"type": "object",
"additionalProperties": False,
"properties": {
"element_electron_shells": {
"electron_shells": {
"description": "(Electronic) shells for this element",
"type": "array",
"minItems": 1,
"uniqueItems": True,
"items": {
"$ref": "#/definitions/basis_electron_shell"
"$ref": "#/definitions/electron_shell"
}
},
"element_ecp_electrons":
"ecp_electrons":
{
"description": "Number of electrons replaced by ECP",
"type": "integer",
"minimum": 1
},
"element_ecp": {
"ecp_potentials": {
"description": "Effective Core Potential for this element",
"type": "array",
"minItems": 1,
"uniqueItems": True,
"items": {
"$ref": "#/definitions/basis_ecp_potential"
"$ref": "#/definitions/ecp_potential"
}
}
}
}

definitions["basis_spec"] = {
"description": "Specification for a basis applied to a molecule",
"type": "object",
"additionalProperties": False,
"properties":
{
"basis_set_description": {
"description": "Brief description of the basis set",
"type": "string"
},
"basis_function_type": {
"description": "Type of function for this basis",
"type": "string",
"enum": [ "gto", "sto" ]
},
"basis_harmonic_type": {
"description": "Harmonic type (spherical, cartesian)",
"type": "string",
"enum": [ "spherical", "cartesian" ]
},
"basis_set_elements": {
"description": "Per-element basis data",
"type": "object",
"additionalProperties": False,
"patternProperties": {
"^\\d+$" : {
"$ref" : "#/definitions/basis_single_data"
}
}
},
"basis_set_atoms": {
"description": "Basis set overrides for particular atoms or centers",
"type": "object",
"additionalProperties": False,
"patternProperties": {
"^\\d+$" : {
"$ref" : "#/definitions/basis_single_data"
}
}
}
}
}
25 changes: 12 additions & 13 deletions qcschema/dev/dev_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from . import molecule
from . import definitions
from . import properties
from . import basis

# The base schema definition
base_schema = {
Expand Down Expand Up @@ -35,21 +36,16 @@
"type": "string"
},
"basis": {
"type": "string"
},
"basis_spec": {
"$ref": "#/definitions/basis_spec"
"anyOf": [
basis.basis,
{
"description": "Name of the basis set to apply to the whole molecule",
"type": "string"
},
]
}
},
"required": [ "method" ],
"oneOf": [
{
"required": ["basis"]
},
{
"required": ["basis_spec"]
}
],
"required": [ "method", "basis" ],
"description": "The quantum chemistry model to be run."
},
"keywords": {
Expand Down Expand Up @@ -110,6 +106,9 @@
# Build out the molecule schema
molecule_dev_schema = copy.deepcopy(molecule.molecule)

# Build out the basis schema
basis_dev_schema = copy.deepcopy(basis.basis)

#import json
#print(json.dumps(input_dev_schema, indent=2))
#print(json.dumps(output_dev_schema, indent=2))

0 comments on commit 9524643

Please sign in to comment.