diff --git a/chemicaljson.py b/chemicaljson.py index 01746fa..82404ca 100644 --- a/chemicaljson.py +++ b/chemicaljson.py @@ -1,202 +1,373 @@ from __future__ import annotations - -from typing import List, Optional - -from pydantic.v1 import BaseModel, Field +import json +from pydantic import BaseModel, Field class Elements(BaseModel): - """List of elements for the atoms in the molecule. + """List of elements for the atoms in the molecule. (required) Length must match the number of atoms. + + Attributes + ---------- + number : list of int + Required list of atomic numbers for the atoms in this file. """ - number: List[int] = Field(..., description="Required list of atomic numbers for the atoms in this file.") + number: list[int] = Field(..., description="Required list of atomic numbers for the atoms in this file.") class Coords(BaseModel): - """Coordinates for the atoms in the molecule. + """Coordinates for the atoms in the molecule. (required) Length must match the number of atoms*3 (x, y, z). + + Attributes + ---------- + field3d : list of float + List of 3d Cartesian coordinates (in Angstrom) for the atoms + [ x, y, z, x, y, z, ... ]. + Alias ``"3d"`` + field3dFractional : list of float + List of 3d fractional coordinates for the atoms + [ x, y, z, x, y, z, ... ]. + Alias ``"3dFractional"`` + field3dSets : list of list of float + List of lists of 3d Cartesian coordinates (in Angstrom) for the + atoms [ [x, y, z], [x, y, z], ... ]. + Alias ``"3dSets"`` """ - field3d: List[float] = Field(..., alias="3d", description="List of 3d Cartesian coordinates (in Angstrom) for the atoms [ x, y, z, x, y, z, ... ]") - field3dFractional: Optional[List[float]] = Field(None, alias="3dFractional", description="Optional list of 3d fractional coordinates for the atoms [ x, y, z, x, y, z, ... ]") - field3dSets: Optional[List[List[float]]] = Field(None, alias="3dSets", description="Optional list of lists of 3d Cartesian coordinates (in Angstrom) for the atoms [ [x, y, z], [x, y, z], ... ]") + field3d: list[float] = Field(..., alias="3d", description="list of 3d Cartesian coordinates (in Angstrom) for the atoms [ x, y, z, x, y, z, ... ]") + field3dFractional: list[float] | None = Field(None, alias="3dFractional", description="Optional list of 3d fractional coordinates for the atoms [ x, y, z, x, y, z, ... ]") + field3dSets: list[list[float]] | None = Field(None, alias="3dSets", description="Optional list of lists of 3d Cartesian coordinates (in Angstrom) for the atoms [ [x, y, z], [x, y, z], ... ]") class Atoms(BaseModel): - """Atoms in the molecule.""" + """Atoms in the molecule. (required) + + Attributes + ---------- + elements : Elements + List of atomic numbers for the atoms. + coords : Coords + List of coordinates. + formalCharges : list of int, optional + List of formal charges for the atoms. + labels : list of str, optional + List of custom labels for atoms. + (e.g., 'R' / 'S' or '0.12', etc.) + layer : list of int, optional + List of layer numbers for the atoms. + (generally just 1 for most molecules) + """ - elements: Elements = Field(..., description="List of atomic numbers for the atoms.") - coords: Coords = Field(..., description="List of coordinates.") - formalCharges: Optional[List[int]] = Field(None, description="Optional list of formal charges for the atoms.") - labels: Optional[List[str]] = Field(None, description="Optional list of custom labels for atoms (e.g., 'R' / 'S' or '0.12', etc.)") - layer: Optional[List[int]] = Field(None, description="Optional list of layer numbers for the atoms (generally just 1 for most molecules).") + elements: Elements = Field(..., description="list of atomic numbers for the atoms.") + coords: Coords = Field(..., description="list of coordinates.") + formalCharges: list[int] | None = Field(None, description="Optional list of formal charges for the atoms.") + labels: list[str] | None = Field(None, description="Optional list of custom labels for atoms (e.g., 'R' / 'S' or '0.12', etc.)") + layer: list[int] | None = Field(None, description="Optional list of layer numbers for the atoms (generally just 1 for most molecules).") class Connections(BaseModel): - """Connections - list of connections between atom indices. + """Connections - list of connections between atom indices. (optional) - Length must be the number of bonds * 2 + Length must be the number of bonds * 2. + + See `Bonds` for examples. + + Attributes + ---------- + index : list of int + List of integers where sequential integers are the indices of + connected atoms. """ - index: List[int] + index: list[int] class Bonds(BaseModel): - """ - Optional bonds between atoms, including connections and bond orders for the atoms in the molecule. (Optional) + """Bonds between atoms, including connections and bond + orders for the atoms in the molecule. (optional) + + Attributes + ---------- + connections : Connections + List of connections between atoms. See `Connections`. + order : list of int + Bond order for each connection. """ connections: Connections - order: List[int] + order: list[int] class BasisSet(BaseModel): """Basis Set information (optional) At the moment, implied to be Gaussian basis sets. + + Attributes + ---------- + coefficients : list of float + List of coefficients for the basis functions. + exponents : list of float + List of exponents for the basis functions. + primitivesPerShell : list of int + List of number of primitives per shell. + shellToAtomMap : list of int + List of atom indices for the basis functions. + shellTypes : list of int + List of shell types for the basis functions. + (l-value, so s=0, p=1, d=2, etc.) """ - coefficients: List[float] = Field(..., description="List of coefficients for the basis functions.") - exponents: List[float] = Field(..., description="List of exponents for the basis functions.") - primitivesPerShell: List[int] = Field(..., description="List of number of primitives per shell.") - shellToAtomMap: List[int] = Field(..., description="List of atom indices for the basis functions.") - shellTypes: List[int] = Field(..., description="List of shell types for the basis functions (l-value, so s=0, p=1, d=2, etc.).") + coefficients: list[float] = Field(..., description="List of coefficients for the basis functions.") + exponents: list[float] = Field(..., description="List of exponents for the basis functions.") + primitivesPerShell: list[int] = Field(..., description="List of number of primitives per shell.") + shellToAtomMap: list[int] = Field(..., description="List of atom indices for the basis functions.") + shellTypes: list[int] = Field(..., description="List of shell types for the basis functions (l-value, so s=0, p=1, d=2, etc.).") class Orbitals(BaseModel): - """Information about molecular orbital energies and coefficients. (Optional) + """Information about molecular orbital energies and coefficients. (optional) - To be useful, this should include basis set information, electronCount, energies, + To be useful, this should include basis set information, + electronCount, energies, + + Attributes + ---------- + electronCount : int + Number of electrons in the species + energies : list of float, optional + List of energies for the molecular orbitals (in eV) + moCoefficients : list of float, optional + List of coefficients (flattened) for restricted molecular + orbitals, i.e., alpha=beta (requires `BasisSet` to be present). + alphaCoefficients : list of float, optional + List of coefficients (flattened) for alpha open-shell orbitals + (requires `BasisSet` to be present). + betaCoefficients : list of float, optional + List of coefficients (flattened) for beta open-shell orbitals + (requires `BasisSet` to be present). + occupations : list of int, optional + List of occupations for the molecular orbitals. + symmetries : list of list of str, optional + Symmetry of the orbital (e.g., a1, eg, t1g, etc.) """ - electronCount: int = Field(..., description="Number of electrons in the species") - energies: Optional[List[float]] = Field(None, description="List of energies for the molecular orbitals (in eV)") - moCoefficients: Optional[List[float]] = Field(None, description="List of coefficients (flattened) for restricted molecular orbitals, i.e., alpha=beta (requires BasisSet to be present).") - alphaCoefficients: Optional[List[float]] = Field(None, description="List of coefficients (flattened) for alpha open-shell orbitals, (requires BasisSet to be present).") - betaCoefficients: Optional[List[float]] = Field(None, description="List of coefficients (flattened) for beta open-shell orbitals, (requires BasisSet to be present).") - occupations: Optional[List[int]] = Field(None, description="List of occupations for the molecular orbitals") - symmetries: Optional[List[List[str]]] = Field(None, description="Symmetry of the orbital (e.g., a1, eg, t1g, etc.)") + electronCount: int = Field(..., description="Number of electrons in the species") + energies: list[float] | None = Field(None, description="List of energies for the molecular orbitals (in eV)") + moCoefficients: list[float] | None = Field(None, description="List of coefficients (flattened) for restricted molecular orbitals, i.e., alpha=beta (requires BasisSet to be present).") + alphaCoefficients: list[float] | None = Field(None, description="List of coefficients (flattened) for alpha open-shell orbitals, (requires BasisSet to be present).") + betaCoefficients: list[float] | None = Field(None, description="List of coefficients (flattened) for beta open-shell orbitals, (requires BasisSet to be present).") + occupations: list[int] | None = Field(None, description="List of occupations for the molecular orbitals") + symmetries: list[list[str]] | None = Field(None, description="Symmetry of the orbital (e.g., a1, eg, t1g, etc.)") class Electronic(BaseModel): - """Electronic spectra (optional)""" + """Electronic spectra (optional). + + Attributes + ---------- + energies : list of float + List of excitation energies for the electronic spectra (in eV). + intensities : list of float + List of intensities for the electronic spectra. + rotation : list of float, optional + List of rotation angles for the CD spectra (in degrees). + """ - energies: List[float] = Field(..., description="List of excitation energies for the electronic spectra (in eV)") - intensities: List[float] = Field(..., description="List of intensities for the electronic spectra") - rotation: Optional[List[float]] = Field(None, description="Optional list of rotation angles for the CD spectra (in degrees)") + energies: list[float] = Field(..., description="List of excitation energies for the electronic spectra (in eV)") + intensities: list[float] = Field(..., description="List of intensities for the electronic spectra") + rotation: list[float] | None = Field(None, description="Optional list of rotation angles for the CD spectra (in degrees)") class Nmr(BaseModel): - """NMR spectra (optional)""" + """NMR spectra (optional). + + Attributes + ---------- + shifts : list of float + List of absolute chemical shifts for the NMR spectra (in ppm) + """ - shifts: List[float] = Field(..., description="List of absolute chemical shifts for the NMR spectra (in ppm)") + shifts: list[float] = Field(..., description="List of absolute chemical shifts for the NMR spectra (in ppm)") class Spectra(BaseModel): - """Spectra (optional) + """Spectra (optional). - Objects for non-vibrational spectra, including electronic, NMR, and other spectra. + Objects for non-vibrational spectra, including electronic, NMR, and + other spectra. + + Attributes + ---------- + electronic : Electronic, optional + Optional electronic spectra + nmr : Nmr, optional + Optional NMR spectra """ - electronic: Optional[Electronic] = Field(None, description="Optional electronic spectra") - nmr: Optional[Nmr] = Field(None, description="Optional NMR spectra") + electronic: Electronic | None = Field(None, description="Optional electronic spectra") + nmr: Nmr | None = Field(None, description="Optional NMR spectra") class Properties(BaseModel): - """Properties of the molecule / system. (Optional) + """Properties of the molecule / system. (optional) A set of key-value properties. + + Attributes + ---------- + molecularMass : float, optional + Molecular mass, in amu. + meltingPoint : float, optional + Melting point in Celsius. + boilingPoint : float, optional + Boiling point in Celsius. + totalCharge : int, default=0 + Total charge of the system. If omitted, assume 0 (charge neutral) + totalSpinMultiplicity : int, default=1 + Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.). + If omitted, assume to be 1 (singlet) + totalEnergy : float, optional + Optional total energy of the system in eV """ - molecularMass: Optional[float] = None - meltingPoint: Optional[float] = None - boilingPoint: Optional[float] = None - totalCharge: Optional[int] = Field(0, description="Total charge of the system. If omitted, assume 0 (charge neutral)") - totalSpinMultiplicity: Optional[int] = Field(1, description="Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.). If omitted, assume to be 1 (singlet)") - totalEnergy: Optional[float] = Field(None, description="Optional total energy of the system in eV") + molecularMass: float | None = None + meltingPoint: float | None = None + boilingPoint: float | None = None + totalCharge: int | None = Field(0, description="Total charge of the system. If omitted, assume 0 (charge neutral)") + totalSpinMultiplicity: int | None = Field(1, description="Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.). If omitted, assume to be 1 (singlet)") + totalEnergy: float | None = Field(None, description="Optional total energy of the system in eV") class Metadata(BaseModel): - """Metadata for the calculation. (Optional) + """Metadata for the calculation. (optional) - Attributes: - runDate: date calculation was done + Attributes + ---------- + runDate : str, optional + Date calculation was done """ - runDate: Optional[str] = None + + runDate: str | None = None + class InputParameters(BaseModel): - """Input parameters for the calculation. (Optional) - - Attributes: - basis: Basis set used for the calculation (e.g. "6-31G(d)" or "Custom"). - dispersion: Dispersion correction used for the calculation (e.g. "D3" or "D3BJ") - functional: Functional used for the calculation if DFT (e.g. "B3LYP" or "Custom"). - grid: Keyword describing the DFT grid keyword usedf if DFT. - memory: The amount of memory requested for the calculation. - processors: The number of processors requested for the calculation. - task: "Energy" or "Optimize" or "Frequencies" or "Transition State" or "Custom". - theory: Method used for the calculation (e.g. "DFT" or "HF" or "MP2"). + """Input parameters for the calculation. (optional) + + Attributes + ---------- + basis : str, optional + Basis set used for the calculation + (e.g. "def2-TZVPPD" or "Custom"). + dispersion : str, optional + Dispersion correction used for the calculation + (e.g. "D3" or "D3BJ") + functional : str, optional + Functional used for the calculation if DFT. + (e.g. "wB97M-V" or "Custom"). + grid : str, optional + Keyword describing the grid keyword used. + memory : str, optional + The amount of memory requested for the calculation. + processors : str, optional + The number of processors requested for the calculation. + task : {"Energy", "Optimize", "Frequencies", "Transition State", "Custom"}, optional + Type of calculation ran. + theory : str, optional + Method used for the calculation. + (e.g. "DFT" or "HF" or "MP2"). """ - basis: Optional[str] = None - dispersion: Optional[str] = None - functional: Optional[str] = None - grid: Optional[str] = None - memory: Optional[str] = None - processors: Optional[str] = None - task: Optional[str] = None - theory: Optional[str] = None + basis: str | None = None + dispersion: str | None = None + functional: str | None = None + grid: str | None = None + memory: str | None = None + processors: str | None = None + task: str | None = None + theory: str | None = None class PartialCharges(BaseModel): - """Partial charges for the atoms in the molecule. (Optional) + """Partial charges for the atoms in the molecule. (optional) + + Keys represent the partial charge method, followed by the computed + partial charges. - Keys represent the partial charge method, followed by the computed partial charges. e.g. - "Mulliken": [ 0.01, 0.02, 0.03, ... ] - "Gasteiger": [ 0.01, 0.02, 0.03, ... ] """ - mulliken: List[float] + mulliken: list[float] class UnitCell(BaseModel): - """Unit cell for the system. (Optional) - - Current versions of Avogadro will output and preferentially use cellVectors, - since they fully specify the unit cell, but will also output a, b, c, - alpha, beta, gamma parameters and use them if no cellVectors field is found. + """Unit cell for the system. (optional) + + Current versions of Avogadro will output and preferentially use + cellVectors, since they fully specify the unit cell, but will also + output a, b, c, alpha, beta, gamma parameters and use them if no + cellVectors field is found. + + Attributes + ---------- + a : float + Unit cell a-axis length. (in Angstrom) + b : float + Unit cell b-axis length. (in Angstrom) + c : float + Unit cell c-axis length. (in Angstrom) + alpha : float + Unit cell alpha angle. (in degrees) + beta : float + Unit cell beta angle. (in degrees) + gamma : float + Unit cell gamma angle. (in degrees) + cellVectors : list of lists of float, optional + List of cell vectors (in Angstrom):[ x1, y1, z1, x2, y2, z2, ... ] """ - a: float = Field(..., description="Unit cell a-axis length (in Angstrom).") - b: float = Field(..., description="Unit cell b-axis length (in Angstrom).") - c: float = Field(..., description="Unit cell c-axis length (in Angstrom).") + a: float = Field(..., description="Unit cell a-axis length (in Angstrom).") + b: float = Field(..., description="Unit cell b-axis length (in Angstrom).") + c: float = Field(..., description="Unit cell c-axis length (in Angstrom).") alpha: float = Field(..., description="Unit cell alpha angle (in degrees).") - beta: float = Field(..., description="Unit cell beta angle (in degrees).") + beta: float = Field(..., description="Unit cell beta angle (in degrees).") gamma: float = Field(..., description="Unit cell gamma angle (in degrees).") - cellVectors: Optional[List[float]] = Field( - min_items=9, max_items=9, default_factory=lambda: [0.0 for _ in range(9)], description="Optional list of cell vectors (in Angstrom): [ x1, y1, z1, x2, y2, z2, ... ]" + cellVectors: list[float] | None = Field( + min_length=9, max_length=9, default_factory=lambda: [0.0 for _ in range(9)], description="Optional list of cell vectors (in Angstrom): [ x1, y1, z1, x2, y2, z2, ... ]" ) class Vibrations(BaseModel): """Vibrations for the molecule. (Optional) - Attributes: - ramanIntensities: Optional list of Raman intensities for the vibrations. - modes: Optional list of mode numbers (e.g, [ 1, 2, 3, 4, 5, 6, ... ]) - symmetries: Optional list of symmetries for the vibrations (e.g., 'a1g', 'eg' ...) + Attributes + ---------- + frequencies : list of float + List of frequencies (in cm-1). + intensities : list of float + List of IR intensities. + eigenVectors : list of list of float + List of eigenvectors. (displacements in Angstroms) + ramanIntensities : list of float, optional + List of Raman intensities. + modes : list of float, optional + List of mode numbers. (e.g, [ 1, 2, 3, 4, 5, 6, ... ]) + symmetries : list of float, optional + List of symmetries.(e.g., 'a1g', 'eg' ...) """ - frequencies: List[float] = Field(... , description="List of frequencies (in cm-1) for the vibrations.") - intensities: List[float] = Field(... , description="List of IR intensities for the vibrations.") - eigenVectors: List[List[float]] = Field(..., description="List of eigenvectors (displacements in Angstroms) for the vibrations.") - ramanIntensities: Optional[List[float]] - symmetries: Optional[List[str]] - modes: Optional[List[int]] + frequencies: list[float] = Field(..., description="list of frequencies (in cm-1) for the vibrations.") + intensities: list[float] = Field(..., description="list of IR intensities for the vibrations.") + eigenVectors: list[list[float]] = Field(..., description="list of eigenvectors (displacements in Angstroms) for the vibrations.") + ramanIntensities: list[float] | None = Field(None, description="List of Raman intensities.") + modes: list[int] | None = Field(None, description="List of mode numbers. (e.g, [ 1, 2, 3, 4, 5, 6, ... ])") + symmetries: list[str] | None = Field(None, description="List of symmetries.(e.g., 'a1g', 'eg' ...)") class Enable(BaseModel): @@ -205,73 +376,110 @@ class Enable(BaseModel): Length of each much match the number of layers. """ - ballAndStick: Optional[List[bool]] = Field(alias="Ball and Stick") - cartoons: Optional[List[bool]] - closeContacts: Optional[List[bool]] = Field(alias="Close Contacts") - labels: Optional[List[bool]] - licorice: Optional[List[bool]] - vanDerWaals: Optional[List[bool]] = Field(alias="Van der Waals") - wireframe: Optional[List[bool]] + ballAndStick: list[bool] | None = Field(alias="Ball and Stick") + cartoons: list[bool] | None + closeContacts: list[bool] | None = Field(alias="Close Contacts") + labels: list[bool] | None + licorice: list[bool] | None + vanDerWaals: list[bool] | None = Field(alias="Van der Waals") + wireframe: list[bool] | None class Settings(BaseModel): """Settings for the render types. (Optional)""" - ballAndStick: Optional[List[str]] = Field(alias="Ball and Stick", description="Settings for the Ball and Stick rendering type") - cartoons: Optional[List[str]] - wireframe: Optional[List[str]] + ballAndStick: list[str] | None = Field(alias="Ball and Stick", description="Settings for the Ball and Stick rendering type") + cartoons: list[str] | None + wireframe: list[str] | None class Layer(BaseModel): """Layer settings for the molecule. (Optional) - Attributes: - enable: Enable flags for different render types for each layer. - settings: Settings for the render types. - locked: List of locked layers (e.g., atoms in this layer should not change) - visible: List of visible layers (e.g., atoms in this layer should be visible / invisible) + Attributes + ---------- + enable : Enable + Enable flags for different render types for each layer. + settings : list of bool + Settings for the render types. + locked : Settings + List of locked layers. + (e.g., atoms in this layer should not change) + visible : list of bool + List of visible layers. + (e.g., atoms in this layer should be visible / invisible) """ - enable: Enable - locked: List[bool] + enable: Enable + locked: list[bool] settings: Settings - visible: List[bool] + visible: list[bool] class CJSONModel(BaseModel): """Full Chemical JSON model. - A Chemical JSON (CJSON) model is intended to represent one molecular or periodic system. - Catenating multiple systems will result in invalid JSON - store separate systems as - separate files / JSON entries. - - Attributes: - vibrations: Vibrations object. Optional. - unitCell: UnitCell object. Optional. - layer: Layer object. Optional (used by the GUI for rendering / settings) - basisSet: BasisSet object. Optional. - orbitals: Orbitals object. Optional. Requires BasisSet to be present. + A Chemical JSON (CJSON) model is intended to represent one molecular + or periodic system. Catenating multiple systems will result in + invalid JSON - store separate systems as separate files / JSON + entries. + + Attributes + ---------- + chemicalJson : int, default=1 + Version number of the Chemical JSON format. Currently 1. + Only changed for backwards-incompatible changes to the schema. + atoms : Atoms + Atoms object, describing the atoms in this system. + name : str, optional + Name / title for the molecule + inchi : str, optional + InChI descriptor for the molecule + formula : str, optional + Chemical formula in Hill order + bonds : Bonds, optional + Bonds object, describing covalent bonds + properties : Properties, optional + Free-form ``Properties``, including total charge and total spin + multiplicity. + inputParameters : InputParameters, optional + ``InputParameters`` object, including calculation metadata such + as basis set, job type, etc. + metadata : Metadata, optional + ``Metadata`` object, including calculation details which do not + directly impact results + partialCharges : PartialCharges, optional + ``PartialCharges`` object. Includes atomic partial charges and + population analysis. + vibrations : Vibrations, optional + unitCell : UnitCell, optional + layer : Layer, optional + Used by the GUI for rendering / settings. + basisSet : BasisSet, optional + orbitals : Orbitals, optional + Requires `BasisSet` to be present. """ - chemicalJson: int = Field(1, description="Version number of the Chemical JSON format. Currently 1. Only changed for backwards-incompatible changes to the schema.") - atoms: Atoms = Field(..., description="Atoms object, describing the atoms in this system.") - name: Optional[str] = Field(None, description="Optional name / title for the molecule") - inchi: Optional[str] = Field(None, description="Optional InChI descriptor for the molecule") - formula: Optional[str] = Field(None, description="Optional chemical formula in Hill order") - bonds: Optional[Bonds] = Field(None, description="Optional Bonds object, describing covalent bonds") - properties: Optional[Properties] = Field(None, description="Optional free-form Properties, including total charge and total spin multiplicity.") - inputParameters: Optional[InputParameters] = Field(None, description="Optional InputParameters object, including calculation metadata such as basis set, job type, etc.") - metadata: Optional[Metadata] = Field(None, description="Optional metadata object, including calculation details which do not directly impact results") - partialCharges: Optional[PartialCharges] = Field(None, description="Optional PartialCharges object. Includes atomic partial charges and population analysis.") - vibrations: Optional[Vibrations] = None - unitCell: Optional[UnitCell] = None - layer: Optional[Layer] = None - basisSet: Optional[BasisSet] = None - orbitals: Optional[Orbitals] = None - spectra: Optional[Spectra] = None + chemicalJson: int = Field(1, description="Version number of the Chemical JSON format. Currently 1. Only changed for backwards-incompatible changes to the schema.") + atoms: Atoms = Field(..., description="Atoms object, describing the atoms in this system.") + name: str | None = Field(None, description="Optional name / title for the molecule") + inchi: str | None = Field(None, description="Optional InChI descriptor for the molecule") + formula: str | None = Field(None, description="Optional chemical formula in Hill order") + bonds: Bonds | None = Field(None, description="Optional Bonds object, describing covalent bonds") + properties: Properties | None = Field(None, description="Optional free-form Properties, including total charge and total spin multiplicity.") + inputParameters: InputParameters | None = Field(None, description="Optional InputParameters object, including calculation metadata such as basis set, job type, etc.") + metadata: Metadata | None = Field(None, description="Optional metadata object, including calculation details which do not directly impact results") + partialCharges: PartialCharges | None = Field(None, description="Optional PartialCharges object. Includes atomic partial charges and population analysis.") + vibrations: Vibrations | None = None + unitCell: UnitCell | None = None + layer: Layer | None = None + basisSet: BasisSet | None = None + orbitals: Orbitals | None = None + spectra: Spectra | None = None if __name__ == "__main__": + cjson_schema = CJSONModel.model_json_schema() with open("cjson.schema", "w") as handle: - handle.write(CJSONModel.schema_json(indent=2)) + handle.write(json.dumps(cjson_schema, indent=2)) handle.write("\n") diff --git a/cjson.schema b/cjson.schema index 381cad6..9d73bfb 100644 --- a/cjson.schema +++ b/cjson.schema @@ -1,579 +1,517 @@ { - "title": "CJSONModel", - "description": "Full Chemical JSON model.\n\nA Chemical JSON (CJSON) model is intended to represent one molecular or periodic system.\nCatenating multiple systems will result in invalid JSON - store separate systems as\nseparate files / JSON entries.\n\nAttributes:\n vibrations: Vibrations object. Optional.\n unitCell: UnitCell object. Optional.\n layer: Layer object. Optional (used by the GUI for rendering / settings)\n basisSet: BasisSet object. Optional.\n orbitals: Orbitals object. Optional. Requires BasisSet to be present.", - "type": "object", - "properties": { - "chemicalJson": { - "title": "Chemicaljson", - "description": "Version number of the Chemical JSON format. Currently 1. Only changed for backwards-incompatible changes to the schema.", - "default": 1, - "type": "integer" - }, - "atoms": { - "title": "Atoms", - "description": "Atoms object, describing the atoms in this system.", - "allOf": [ - { - "$ref": "#/definitions/Atoms" - } - ] - }, - "name": { - "title": "Name", - "description": "Optional name / title for the molecule", - "type": "string" - }, - "inchi": { - "title": "Inchi", - "description": "Optional InChI descriptor for the molecule", - "type": "string" - }, - "formula": { - "title": "Formula", - "description": "Optional chemical formula in Hill order", - "type": "string" - }, - "bonds": { - "title": "Bonds", - "description": "Optional Bonds object, describing covalent bonds", - "allOf": [ - { - "$ref": "#/definitions/Bonds" - } - ] - }, - "properties": { - "title": "Properties", - "description": "Optional free-form Properties, including total charge and total spin multiplicity.", - "allOf": [ - { - "$ref": "#/definitions/Properties" - } - ] - }, - "inputParameters": { - "title": "Inputparameters", - "description": "Optional InputParameters object, including calculation metadata such as basis set, job type, etc.", - "allOf": [ - { - "$ref": "#/definitions/InputParameters" - } - ] - }, - "metadata": { - "title": "Metadata", - "description": "Optional metadata object, including calculation details which do not directly impact results", - "allOf": [ - { - "$ref": "#/definitions/Metadata" - } - ] - }, - "partialCharges": { - "title": "Partialcharges", - "description": "Optional PartialCharges object. Includes atomic partial charges and population analysis.", - "allOf": [ - { - "$ref": "#/definitions/PartialCharges" - } - ] - }, - "vibrations": { - "$ref": "#/definitions/Vibrations" - }, - "unitCell": { - "$ref": "#/definitions/UnitCell" - }, - "layer": { - "$ref": "#/definitions/Layer" - }, - "basisSet": { - "$ref": "#/definitions/BasisSet" - }, - "orbitals": { - "$ref": "#/definitions/Orbitals" - }, - "spectra": { - "$ref": "#/definitions/Spectra" - } - }, - "required": [ - "atoms" - ], - "definitions": { - "Elements": { - "title": "Elements", - "description": "List of elements for the atoms in the molecule.\n\nLength must match the number of atoms.", - "type": "object", - "properties": { - "number": { - "title": "Number", - "description": "Required list of atomic numbers for the atoms in this file.", - "type": "array", - "items": { - "type": "integer" - } - } - }, - "required": [ - "number" - ] - }, - "Coords": { - "title": "Coords", - "description": "Coordinates for the atoms in the molecule.\n\nLength must match the number of atoms*3 (x, y, z).", - "type": "object", - "properties": { - "3d": { - "title": "3D", - "description": "List of 3d Cartesian coordinates (in Angstrom) for the atoms [ x, y, z, x, y, z, ... ]", - "type": "array", - "items": { - "type": "number" - } - }, - "3dFractional": { - "title": "3Dfractional", - "description": "Optional list of 3d fractional coordinates for the atoms [ x, y, z, x, y, z, ... ]", - "type": "array", - "items": { - "type": "number" - } - }, - "3dSets": { - "title": "3Dsets", - "description": "Optional list of lists of 3d Cartesian coordinates (in Angstrom) for the atoms [ [x, y, z], [x, y, z], ... ]", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "number" - } - } - } - }, - "required": [ - "3d" - ] - }, + "$defs": { "Atoms": { - "title": "Atoms", - "description": "Atoms in the molecule.", - "type": "object", + "description": "Atoms in the molecule. (required)\n\nAttributes\n----------\nelements : Elements\n List of atomic numbers for the atoms.\ncoords : Coords\n List of coordinates.\nformalCharges : list of int, optional\n List of formal charges for the atoms.\nlabels : list of str, optional\n List of custom labels for atoms.\n (e.g., 'R' / 'S' or '0.12', etc.)\nlayer : list of int, optional\n List of layer numbers for the atoms.\n (generally just 1 for most molecules)", "properties": { "elements": { - "title": "Elements", - "description": "List of atomic numbers for the atoms.", - "allOf": [ - { - "$ref": "#/definitions/Elements" - } - ] + "$ref": "#/$defs/Elements", + "description": "list of atomic numbers for the atoms." }, "coords": { - "title": "Coords", - "description": "List of coordinates.", - "allOf": [ - { - "$ref": "#/definitions/Coords" - } - ] + "$ref": "#/$defs/Coords", + "description": "list of coordinates." }, "formalCharges": { - "title": "Formalcharges", + "anyOf": [ + { + "items": { + "type": "integer" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "Optional list of formal charges for the atoms.", - "type": "array", - "items": { - "type": "integer" - } + "title": "Formalcharges" }, "labels": { - "title": "Labels", + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "Optional list of custom labels for atoms (e.g., 'R' / 'S' or '0.12', etc.)", - "type": "array", - "items": { - "type": "string" - } + "title": "Labels" }, "layer": { - "title": "Layer", + "anyOf": [ + { + "items": { + "type": "integer" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "Optional list of layer numbers for the atoms (generally just 1 for most molecules).", - "type": "array", - "items": { - "type": "integer" - } + "title": "Layer" } }, "required": [ "elements", "coords" - ] + ], + "title": "Atoms", + "type": "object" }, - "Connections": { - "title": "Connections", - "description": "Connections - list of connections between atom indices.\n\nLength must be the number of bonds * 2", - "type": "object", + "BasisSet": { + "description": "Basis Set information (optional)\n\nAt the moment, implied to be Gaussian basis sets.\n\nAttributes\n----------\ncoefficients : list of float\n List of coefficients for the basis functions.\nexponents : list of float\n List of exponents for the basis functions.\nprimitivesPerShell : list of int\n List of number of primitives per shell.\nshellToAtomMap : list of int\n List of atom indices for the basis functions.\nshellTypes : list of int\n List of shell types for the basis functions.\n (l-value, so s=0, p=1, d=2, etc.)", "properties": { - "index": { - "title": "Index", - "type": "array", + "coefficients": { + "description": "List of coefficients for the basis functions.", + "items": { + "type": "number" + }, + "title": "Coefficients", + "type": "array" + }, + "exponents": { + "description": "List of exponents for the basis functions.", + "items": { + "type": "number" + }, + "title": "Exponents", + "type": "array" + }, + "primitivesPerShell": { + "description": "List of number of primitives per shell.", + "items": { + "type": "integer" + }, + "title": "Primitivespershell", + "type": "array" + }, + "shellToAtomMap": { + "description": "List of atom indices for the basis functions.", + "items": { + "type": "integer" + }, + "title": "Shelltoatommap", + "type": "array" + }, + "shellTypes": { + "description": "List of shell types for the basis functions (l-value, so s=0, p=1, d=2, etc.).", "items": { "type": "integer" - } + }, + "title": "Shelltypes", + "type": "array" } }, "required": [ - "index" - ] + "coefficients", + "exponents", + "primitivesPerShell", + "shellToAtomMap", + "shellTypes" + ], + "title": "BasisSet", + "type": "object" }, "Bonds": { - "title": "Bonds", - "description": "Optional bonds between atoms, including connections and bond orders for the atoms in the molecule. (Optional)", - "type": "object", + "description": "Bonds between atoms, including connections and bond\norders for the atoms in the molecule. (optional)\n\nAttributes\n----------\nconnections : Connections\n List of connections between atoms. See `Connections`.\norder : list of int\n Bond order for each connection.", "properties": { "connections": { - "$ref": "#/definitions/Connections" + "$ref": "#/$defs/Connections" }, "order": { - "title": "Order", - "type": "array", "items": { "type": "integer" - } + }, + "title": "Order", + "type": "array" } }, "required": [ "connections", "order" - ] - }, - "Properties": { - "title": "Properties", - "description": "Properties of the molecule / system. (Optional)\n\nA set of key-value properties.", - "type": "object", - "properties": { - "molecularMass": { - "title": "Molecularmass", - "type": "number" - }, - "meltingPoint": { - "title": "Meltingpoint", - "type": "number" - }, - "boilingPoint": { - "title": "Boilingpoint", - "type": "number" - }, - "totalCharge": { - "title": "Totalcharge", - "description": "Total charge of the system. If omitted, assume 0 (charge neutral)", - "default": 0, - "type": "integer" - }, - "totalSpinMultiplicity": { - "title": "Totalspinmultiplicity", - "description": "Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.). If omitted, assume to be 1 (singlet)", - "default": 1, - "type": "integer" - }, - "totalEnergy": { - "title": "Totalenergy", - "description": "Optional total energy of the system in eV", - "type": "number" - } - } - }, - "InputParameters": { - "title": "InputParameters", - "description": "Input parameters for the calculation. (Optional)\n\nAttributes:\n basis: Basis set used for the calculation (e.g. \"6-31G(d)\" or \"Custom\").\n dispersion: Dispersion correction used for the calculation (e.g. \"D3\" or \"D3BJ\")\n functional: Functional used for the calculation if DFT (e.g. \"B3LYP\" or \"Custom\").\n grid: Keyword describing the DFT grid keyword usedf if DFT.\n memory: The amount of memory requested for the calculation.\n processors: The number of processors requested for the calculation.\n task: \"Energy\" or \"Optimize\" or \"Frequencies\" or \"Transition State\" or \"Custom\".\n theory: Method used for the calculation (e.g. \"DFT\" or \"HF\" or \"MP2\").", - "type": "object", - "properties": { - "basis": { - "title": "Basis", - "type": "string" - }, - "dispersion": { - "title": "Dispersion", - "type": "string" - }, - "functional": { - "title": "Functional", - "type": "string" - }, - "grid": { - "title": "Grid", - "type": "string" - }, - "memory": { - "title": "Memory", - "type": "string" - }, - "processors": { - "title": "Processors", - "type": "string" - }, - "task": { - "title": "Task", - "type": "string" - }, - "theory": { - "title": "Theory", - "type": "string" - } - } - }, - "Metadata": { - "title": "Metadata", - "description": "Metadata for the calculation. (Optional)\n\nAttributes:\n runDate: date calculation was done", - "type": "object", - "properties": { - "runDate": { - "title": "Rundate", - "type": "string" - } - } + ], + "title": "Bonds", + "type": "object" }, - "PartialCharges": { - "title": "PartialCharges", - "description": "Partial charges for the atoms in the molecule. (Optional)\n\nKeys represent the partial charge method, followed by the computed partial charges.\ne.g.\n- \"Mulliken\": [ 0.01, 0.02, 0.03, ... ]\n- \"Gasteiger\": [ 0.01, 0.02, 0.03, ... ]", - "type": "object", + "Connections": { + "description": "Connections - list of connections between atom indices. (optional)\n\nLength must be the number of bonds * 2.\n\nSee `Bonds` for examples.\n\nAttributes\n----------\nindex : list of int\n List of integers where sequential integers are the indices of\n connected atoms.", "properties": { - "mulliken": { - "title": "Mulliken", - "type": "array", + "index": { "items": { - "type": "number" - } + "type": "integer" + }, + "title": "Index", + "type": "array" } }, "required": [ - "mulliken" - ] + "index" + ], + "title": "Connections", + "type": "object" }, - "Vibrations": { - "title": "Vibrations", - "description": "Vibrations for the molecule. (Optional)\n\nAttributes:\n ramanIntensities: Optional list of Raman intensities for the vibrations.\n modes: Optional list of mode numbers (e.g, [ 1, 2, 3, 4, 5, 6, ... ])\n symmetries: Optional list of symmetries for the vibrations (e.g., 'a1g', 'eg' ...)", - "type": "object", + "Coords": { + "description": "Coordinates for the atoms in the molecule. (required)\n\nLength must match the number of atoms*3 (x, y, z).\n\nAttributes\n----------\nfield3d : list of float\n List of 3d Cartesian coordinates (in Angstrom) for the atoms\n [ x, y, z, x, y, z, ... ].\n Alias ``\"3d\"``\nfield3dFractional : list of float\n List of 3d fractional coordinates for the atoms\n [ x, y, z, x, y, z, ... ].\n Alias ``\"3dFractional\"``\nfield3dSets : list of list of float\n List of lists of 3d Cartesian coordinates (in Angstrom) for the\n atoms [ [x, y, z], [x, y, z], ... ].\n Alias ``\"3dSets\"``", "properties": { - "frequencies": { - "title": "Frequencies", - "description": "List of frequencies (in cm-1) for the vibrations.", - "type": "array", - "items": { - "type": "number" - } - }, - "intensities": { - "title": "Intensities", - "description": "List of IR intensities for the vibrations.", - "type": "array", + "3d": { + "description": "list of 3d Cartesian coordinates (in Angstrom) for the atoms [ x, y, z, x, y, z, ... ]", "items": { "type": "number" - } + }, + "title": "3D", + "type": "array" }, - "eigenVectors": { - "title": "Eigenvectors", - "description": "List of eigenvectors (displacements in Angstroms) for the vibrations.", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "number" + "3dFractional": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" } - } + ], + "default": null, + "description": "Optional list of 3d fractional coordinates for the atoms [ x, y, z, x, y, z, ... ]", + "title": "3Dfractional" }, - "ramanIntensities": { - "title": "Ramanintensities", - "type": "array", + "3dSets": { + "anyOf": [ + { + "items": { + "items": { + "type": "number" + }, + "type": "array" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional list of lists of 3d Cartesian coordinates (in Angstrom) for the atoms [ [x, y, z], [x, y, z], ... ]", + "title": "3Dsets" + } + }, + "required": [ + "3d" + ], + "title": "Coords", + "type": "object" + }, + "Electronic": { + "description": "Electronic spectra (optional).\n\nAttributes\n----------\nenergies : list of float\n List of excitation energies for the electronic spectra (in eV).\nintensities : list of float \n List of intensities for the electronic spectra.\nrotation : list of float, optional \n List of rotation angles for the CD spectra (in degrees).", + "properties": { + "energies": { + "description": "List of excitation energies for the electronic spectra (in eV)", "items": { "type": "number" - } + }, + "title": "Energies", + "type": "array" }, - "symmetries": { - "title": "Symmetries", - "type": "array", + "intensities": { + "description": "List of intensities for the electronic spectra", "items": { - "type": "string" - } + "type": "number" + }, + "title": "Intensities", + "type": "array" }, - "modes": { - "title": "Modes", - "type": "array", - "items": { - "type": "integer" - } + "rotation": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional list of rotation angles for the CD spectra (in degrees)", + "title": "Rotation" } }, "required": [ - "frequencies", - "intensities", - "eigenVectors" - ] + "energies", + "intensities" + ], + "title": "Electronic", + "type": "object" }, - "UnitCell": { - "title": "UnitCell", - "description": "Unit cell for the system. (Optional)\n\nCurrent versions of Avogadro will output and preferentially use cellVectors,\nsince they fully specify the unit cell, but will also output a, b, c,\nalpha, beta, gamma parameters and use them if no cellVectors field is found.", - "type": "object", + "Elements": { + "description": "List of elements for the atoms in the molecule. (required)\n\nLength must match the number of atoms.\n\nAttributes\n----------\nnumber : list of int\n Required list of atomic numbers for the atoms in this file.", "properties": { - "a": { - "title": "A", - "description": "Unit cell a-axis length (in Angstrom).", - "type": "number" - }, - "b": { - "title": "B", - "description": "Unit cell b-axis length (in Angstrom).", - "type": "number" - }, - "c": { - "title": "C", - "description": "Unit cell c-axis length (in Angstrom).", - "type": "number" - }, - "alpha": { - "title": "Alpha", - "description": "Unit cell alpha angle (in degrees).", - "type": "number" - }, - "beta": { - "title": "Beta", - "description": "Unit cell beta angle (in degrees).", - "type": "number" - }, - "gamma": { - "title": "Gamma", - "description": "Unit cell gamma angle (in degrees).", - "type": "number" - }, - "cellVectors": { - "title": "Cellvectors", - "description": "Optional list of cell vectors (in Angstrom): [ x1, y1, z1, x2, y2, z2, ... ]", - "minItems": 9, - "maxItems": 9, - "type": "array", + "number": { + "description": "Required list of atomic numbers for the atoms in this file.", "items": { - "type": "number" - } + "type": "integer" + }, + "title": "Number", + "type": "array" } }, "required": [ - "a", - "b", - "c", - "alpha", - "beta", - "gamma" - ] + "number" + ], + "title": "Elements", + "type": "object" }, "Enable": { - "title": "Enable", "description": "Optional enable flags for different render types for each layer\n\nLength of each much match the number of layers.", - "type": "object", "properties": { "Ball and Stick": { - "title": "Ball And Stick", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Ball And Stick" }, "cartoons": { - "title": "Cartoons", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Cartoons" }, "Close Contacts": { - "title": "Close Contacts", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Close Contacts" }, "labels": { - "title": "Labels", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Labels" }, "licorice": { - "title": "Licorice", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Licorice" }, "Van der Waals": { - "title": "Van Der Waals", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Van Der Waals" }, "wireframe": { - "title": "Wireframe", - "type": "array", - "items": { - "type": "boolean" - } + "anyOf": [ + { + "items": { + "type": "boolean" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Wireframe" } - } + }, + "required": [ + "Ball and Stick", + "cartoons", + "Close Contacts", + "labels", + "licorice", + "Van der Waals", + "wireframe" + ], + "title": "Enable", + "type": "object" }, - "Settings": { - "title": "Settings", - "description": "Settings for the render types. (Optional)", - "type": "object", + "InputParameters": { + "description": "Input parameters for the calculation. (optional)\n\nAttributes\n----------\nbasis : str, optional\n Basis set used for the calculation \n (e.g. \"def2-TZVPPD\" or \"Custom\").\ndispersion : str, optional\n Dispersion correction used for the calculation \n (e.g. \"D3\" or \"D3BJ\")\nfunctional : str, optional\n Functional used for the calculation if DFT.\n (e.g. \"wB97M-V\" or \"Custom\").\ngrid : str, optional\n Keyword describing the grid keyword used.\nmemory : str, optional\n The amount of memory requested for the calculation.\nprocessors : str, optional\n The number of processors requested for the calculation.\ntask : {\"Energy\", \"Optimize\", \"Frequencies\", \"Transition State\", \"Custom\"}, optional\n Type of calculation ran.\ntheory : str, optional\n Method used for the calculation.\n (e.g. \"DFT\" or \"HF\" or \"MP2\").", "properties": { - "Ball and Stick": { - "title": "Ball And Stick", - "description": "Settings for the Ball and Stick rendering type", - "type": "array", - "items": { - "type": "string" - } + "basis": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Basis" }, - "cartoons": { - "title": "Cartoons", - "type": "array", - "items": { - "type": "string" - } + "dispersion": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Dispersion" }, - "wireframe": { - "title": "Wireframe", - "type": "array", - "items": { - "type": "string" - } + "functional": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Functional" + }, + "grid": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Grid" + }, + "memory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Memory" + }, + "processors": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Processors" + }, + "task": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Task" + }, + "theory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Theory" } - } + }, + "title": "InputParameters", + "type": "object" }, "Layer": { - "title": "Layer", - "description": "Layer settings for the molecule. (Optional)\n\nAttributes:\n enable: Enable flags for different render types for each layer.\n settings: Settings for the render types.\n locked: List of locked layers (e.g., atoms in this layer should not change)\n visible: List of visible layers (e.g., atoms in this layer should be visible / invisible)", - "type": "object", + "description": "Layer settings for the molecule. (Optional)\n\nAttributes\n----------\nenable : Enable\n Enable flags for different render types for each layer.\nsettings : list of bool\n Settings for the render types.\nlocked : Settings\n List of locked layers.\n (e.g., atoms in this layer should not change)\nvisible : list of bool\n List of visible layers.\n (e.g., atoms in this layer should be visible / invisible)", "properties": { "enable": { - "$ref": "#/definitions/Enable" + "$ref": "#/$defs/Enable" }, "locked": { - "title": "Locked", - "type": "array", "items": { "type": "boolean" - } + }, + "title": "Locked", + "type": "array" }, "settings": { - "$ref": "#/definitions/Settings" + "$ref": "#/$defs/Settings" }, "visible": { - "title": "Visible", - "type": "array", "items": { "type": "boolean" - } + }, + "title": "Visible", + "type": "array" } }, "required": [ @@ -581,205 +519,677 @@ "locked", "settings", "visible" - ] + ], + "title": "Layer", + "type": "object" }, - "BasisSet": { - "title": "BasisSet", - "description": "Basis Set information (optional)\n\nAt the moment, implied to be Gaussian basis sets.", - "type": "object", + "Metadata": { + "description": "Metadata for the calculation. (optional)\n\nAttributes\n----------\nrunDate : str, optional\n Date calculation was done", "properties": { - "coefficients": { - "title": "Coefficients", - "description": "List of coefficients for the basis functions.", - "type": "array", - "items": { - "type": "number" - } - }, - "exponents": { - "title": "Exponents", - "description": "List of exponents for the basis functions.", - "type": "array", + "runDate": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rundate" + } + }, + "title": "Metadata", + "type": "object" + }, + "Nmr": { + "description": "NMR spectra (optional).\n\nAttributes\n----------\nshifts : list of float\n List of absolute chemical shifts for the NMR spectra (in ppm)", + "properties": { + "shifts": { + "description": "List of absolute chemical shifts for the NMR spectra (in ppm)", "items": { "type": "number" - } - }, - "primitivesPerShell": { - "title": "Primitivespershell", - "description": "List of number of primitives per shell.", - "type": "array", - "items": { - "type": "integer" - } - }, - "shellToAtomMap": { - "title": "Shelltoatommap", - "description": "List of atom indices for the basis functions.", - "type": "array", - "items": { - "type": "integer" - } - }, - "shellTypes": { - "title": "Shelltypes", - "description": "List of shell types for the basis functions (l-value, so s=0, p=1, d=2, etc.).", - "type": "array", - "items": { - "type": "integer" - } + }, + "title": "Shifts", + "type": "array" } }, "required": [ - "coefficients", - "exponents", - "primitivesPerShell", - "shellToAtomMap", - "shellTypes" - ] + "shifts" + ], + "title": "Nmr", + "type": "object" }, "Orbitals": { - "title": "Orbitals", - "description": "Information about molecular orbital energies and coefficients. (Optional)\n\nTo be useful, this should include basis set information, electronCount, energies, ", - "type": "object", + "description": "Information about molecular orbital energies and coefficients. (optional)\n\nTo be useful, this should include basis set information,\nelectronCount, energies,\n\nAttributes\n----------\nelectronCount : int\n Number of electrons in the species\nenergies : list of float, optional\n List of energies for the molecular orbitals (in eV)\nmoCoefficients : list of float, optional\n List of coefficients (flattened) for restricted molecular\n orbitals, i.e., alpha=beta (requires `BasisSet` to be present).\nalphaCoefficients : list of float, optional\n List of coefficients (flattened) for alpha open-shell orbitals\n (requires `BasisSet` to be present).\nbetaCoefficients : list of float, optional\n List of coefficients (flattened) for beta open-shell orbitals\n (requires `BasisSet` to be present).\noccupations : list of int, optional\n List of occupations for the molecular orbitals.\nsymmetries : list of list of str, optional\n Symmetry of the orbital (e.g., a1, eg, t1g, etc.)", "properties": { "electronCount": { - "title": "Electroncount", "description": "Number of electrons in the species", + "title": "Electroncount", "type": "integer" }, "energies": { - "title": "Energies", + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "List of energies for the molecular orbitals (in eV)", - "type": "array", - "items": { - "type": "number" - } + "title": "Energies" }, "moCoefficients": { - "title": "Mocoefficients", + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "List of coefficients (flattened) for restricted molecular orbitals, i.e., alpha=beta (requires BasisSet to be present).", - "type": "array", - "items": { - "type": "number" - } + "title": "Mocoefficients" }, "alphaCoefficients": { - "title": "Alphacoefficients", + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "List of coefficients (flattened) for alpha open-shell orbitals, (requires BasisSet to be present).", - "type": "array", - "items": { - "type": "number" - } + "title": "Alphacoefficients" }, "betaCoefficients": { - "title": "Betacoefficients", + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "List of coefficients (flattened) for beta open-shell orbitals, (requires BasisSet to be present).", - "type": "array", - "items": { - "type": "number" - } + "title": "Betacoefficients" }, "occupations": { - "title": "Occupations", + "anyOf": [ + { + "items": { + "type": "integer" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "List of occupations for the molecular orbitals", - "type": "array", - "items": { - "type": "integer" - } + "title": "Occupations" }, "symmetries": { - "title": "Symmetries", - "description": "Symmetry of the orbital (e.g., a1, eg, t1g, etc.)", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" + "anyOf": [ + { + "items": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": "array" + }, + { + "type": "null" } - } + ], + "default": null, + "description": "Symmetry of the orbital (e.g., a1, eg, t1g, etc.)", + "title": "Symmetries" } }, "required": [ "electronCount" - ] + ], + "title": "Orbitals", + "type": "object" }, - "Electronic": { - "title": "Electronic", - "description": "Electronic spectra (optional)", - "type": "object", + "PartialCharges": { + "description": "Partial charges for the atoms in the molecule. (optional)\n\nKeys represent the partial charge method, followed by the computed\npartial charges.\n\ne.g.\n- \"Mulliken\": [ 0.01, 0.02, 0.03, ... ]\n- \"Gasteiger\": [ 0.01, 0.02, 0.03, ... ]", "properties": { - "energies": { - "title": "Energies", - "description": "List of excitation energies for the electronic spectra (in eV)", - "type": "array", + "mulliken": { "items": { "type": "number" - } + }, + "title": "Mulliken", + "type": "array" + } + }, + "required": [ + "mulliken" + ], + "title": "PartialCharges", + "type": "object" + }, + "Properties": { + "description": "Properties of the molecule / system. (optional)\n\nA set of key-value properties.\n\nAttributes\n----------\nmolecularMass : float, optional\n Molecular mass, in amu.\nmeltingPoint : float, optional\n Melting point in Celsius.\nboilingPoint : float, optional\n Boiling point in Celsius.\ntotalCharge : int, default=0\n Total charge of the system. If omitted, assume 0 (charge neutral)\ntotalSpinMultiplicity : int, default=1\n Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.).\n If omitted, assume to be 1 (singlet)\ntotalEnergy : float, optional\n Optional total energy of the system in eV", + "properties": { + "molecularMass": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Molecularmass" }, - "intensities": { - "title": "Intensities", - "description": "List of intensities for the electronic spectra", - "type": "array", - "items": { - "type": "number" - } + "meltingPoint": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meltingpoint" }, - "rotation": { - "title": "Rotation", - "description": "Optional list of rotation angles for the CD spectra (in degrees)", - "type": "array", - "items": { - "type": "number" - } + "boilingPoint": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Boilingpoint" + }, + "totalCharge": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": 0, + "description": "Total charge of the system. If omitted, assume 0 (charge neutral)", + "title": "Totalcharge" + }, + "totalSpinMultiplicity": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": 1, + "description": "Total spin multiplicity of the system (2S+1, e.g., 1, 2, 3, etc.). If omitted, assume to be 1 (singlet)", + "title": "Totalspinmultiplicity" + }, + "totalEnergy": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional total energy of the system in eV", + "title": "Totalenergy" } }, - "required": [ - "energies", - "intensities" - ] + "title": "Properties", + "type": "object" }, - "Nmr": { - "title": "Nmr", - "description": "NMR spectra (optional)", - "type": "object", + "Settings": { + "description": "Settings for the render types. (Optional)", "properties": { - "shifts": { - "title": "Shifts", - "description": "List of absolute chemical shifts for the NMR spectra (in ppm)", - "type": "array", - "items": { - "type": "number" - } + "Ball and Stick": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Settings for the Ball and Stick rendering type", + "title": "Ball And Stick" + }, + "cartoons": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Cartoons" + }, + "wireframe": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Wireframe" } }, "required": [ - "shifts" - ] + "Ball and Stick", + "cartoons", + "wireframe" + ], + "title": "Settings", + "type": "object" }, "Spectra": { - "title": "Spectra", - "description": "Spectra (optional)\n\nObjects for non-vibrational spectra, including electronic, NMR, and other spectra.", - "type": "object", + "description": "Spectra (optional).\n\nObjects for non-vibrational spectra, including electronic, NMR, and\nother spectra.\n\nAttributes\n----------\nelectronic : Electronic, optional\n Optional electronic spectra\nnmr : Nmr, optional\n Optional NMR spectra", "properties": { "electronic": { - "title": "Electronic", - "description": "Optional electronic spectra", - "allOf": [ + "anyOf": [ + { + "$ref": "#/$defs/Electronic" + }, { - "$ref": "#/definitions/Electronic" + "type": "null" } - ] + ], + "default": null, + "description": "Optional electronic spectra" }, "nmr": { - "title": "Nmr", - "description": "Optional NMR spectra", - "allOf": [ + "anyOf": [ + { + "$ref": "#/$defs/Nmr" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional NMR spectra" + } + }, + "title": "Spectra", + "type": "object" + }, + "UnitCell": { + "description": "Unit cell for the system. (optional)\n\nCurrent versions of Avogadro will output and preferentially use\ncellVectors, since they fully specify the unit cell, but will also\noutput a, b, c, alpha, beta, gamma parameters and use them if no\ncellVectors field is found.\n\nAttributes\n----------\na : float\n Unit cell a-axis length. (in Angstrom)\nb : float\n Unit cell b-axis length. (in Angstrom)\nc : float\n Unit cell c-axis length. (in Angstrom)\nalpha : float\n Unit cell alpha angle. (in degrees)\nbeta : float\n Unit cell beta angle. (in degrees)\ngamma : float\n Unit cell gamma angle. (in degrees)\ncellVectors : list of lists of float, optional\n List of cell vectors (in Angstrom):[ x1, y1, z1, x2, y2, z2, ... ]", + "properties": { + "a": { + "description": "Unit cell a-axis length (in Angstrom).", + "title": "A", + "type": "number" + }, + "b": { + "description": "Unit cell b-axis length (in Angstrom).", + "title": "B", + "type": "number" + }, + "c": { + "description": "Unit cell c-axis length (in Angstrom).", + "title": "C", + "type": "number" + }, + "alpha": { + "description": "Unit cell alpha angle (in degrees).", + "title": "Alpha", + "type": "number" + }, + "beta": { + "description": "Unit cell beta angle (in degrees).", + "title": "Beta", + "type": "number" + }, + "gamma": { + "description": "Unit cell gamma angle (in degrees).", + "title": "Gamma", + "type": "number" + }, + "cellVectors": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "maxItems": 9, + "minItems": 9, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Optional list of cell vectors (in Angstrom): [ x1, y1, z1, x2, y2, z2, ... ]", + "title": "Cellvectors" + } + }, + "required": [ + "a", + "b", + "c", + "alpha", + "beta", + "gamma" + ], + "title": "UnitCell", + "type": "object" + }, + "Vibrations": { + "description": "Vibrations for the molecule. (Optional)\n\nAttributes\n----------\nfrequencies : list of float\n List of frequencies (in cm-1).\nintensities : list of float\n List of IR intensities.\neigenVectors : list of list of float\n List of eigenvectors. (displacements in Angstroms)\nramanIntensities : list of float, optional\n List of Raman intensities.\nmodes : list of float, optional\n List of mode numbers. (e.g, [ 1, 2, 3, 4, 5, 6, ... ])\nsymmetries : list of float, optional\n List of symmetries.(e.g., 'a1g', 'eg' ...)", + "properties": { + "frequencies": { + "description": "list of frequencies (in cm-1) for the vibrations.", + "items": { + "type": "number" + }, + "title": "Frequencies", + "type": "array" + }, + "intensities": { + "description": "list of IR intensities for the vibrations.", + "items": { + "type": "number" + }, + "title": "Intensities", + "type": "array" + }, + "eigenVectors": { + "description": "list of eigenvectors (displacements in Angstroms) for the vibrations.", + "items": { + "items": { + "type": "number" + }, + "type": "array" + }, + "title": "Eigenvectors", + "type": "array" + }, + "ramanIntensities": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, { - "$ref": "#/definitions/Nmr" + "type": "null" } - ] + ], + "default": null, + "description": "List of Raman intensities.", + "title": "Ramanintensities" + }, + "modes": { + "anyOf": [ + { + "items": { + "type": "integer" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "List of mode numbers. (e.g, [ 1, 2, 3, 4, 5, 6, ... ])", + "title": "Modes" + }, + "symmetries": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "List of symmetries.(e.g., 'a1g', 'eg' ...)", + "title": "Symmetries" + } + }, + "required": [ + "frequencies", + "intensities", + "eigenVectors" + ], + "title": "Vibrations", + "type": "object" + } + }, + "description": "Full Chemical JSON model.\n\nA Chemical JSON (CJSON) model is intended to represent one molecular\nor periodic system. Catenating multiple systems will result in\ninvalid JSON - store separate systems as separate files / JSON\nentries.\n\nAttributes\n----------\nchemicalJson : int, default=1\n Version number of the Chemical JSON format. Currently 1.\n Only changed for backwards-incompatible changes to the schema.\natoms : Atoms\n Atoms object, describing the atoms in this system.\nname : str, optional\n Name / title for the molecule\ninchi : str, optional\n InChI descriptor for the molecule\nformula : str, optional\n Chemical formula in Hill order\nbonds : Bonds, optional\n Bonds object, describing covalent bonds\nproperties : Properties, optional\n Free-form ``Properties``, including total charge and total spin\n multiplicity.\ninputParameters : InputParameters, optional\n ``InputParameters`` object, including calculation metadata such\n as basis set, job type, etc.\nmetadata : Metadata, optional\n ``Metadata`` object, including calculation details which do not\n directly impact results\npartialCharges : PartialCharges, optional\n ``PartialCharges`` object. Includes atomic partial charges and\n population analysis.\nvibrations : Vibrations, optional\nunitCell : UnitCell, optional\nlayer : Layer, optional\n Used by the GUI for rendering / settings.\nbasisSet : BasisSet, optional\norbitals : Orbitals, optional\n Requires `BasisSet` to be present.", + "properties": { + "chemicalJson": { + "default": 1, + "description": "Version number of the Chemical JSON format. Currently 1. Only changed for backwards-incompatible changes to the schema.", + "title": "Chemicaljson", + "type": "integer" + }, + "atoms": { + "$ref": "#/$defs/Atoms", + "description": "Atoms object, describing the atoms in this system." + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional name / title for the molecule", + "title": "Name" + }, + "inchi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional InChI descriptor for the molecule", + "title": "Inchi" + }, + "formula": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional chemical formula in Hill order", + "title": "Formula" + }, + "bonds": { + "anyOf": [ + { + "$ref": "#/$defs/Bonds" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional Bonds object, describing covalent bonds" + }, + "properties": { + "anyOf": [ + { + "$ref": "#/$defs/Properties" + }, + { + "type": "null" } - } + ], + "default": null, + "description": "Optional free-form Properties, including total charge and total spin multiplicity." + }, + "inputParameters": { + "anyOf": [ + { + "$ref": "#/$defs/InputParameters" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional InputParameters object, including calculation metadata such as basis set, job type, etc." + }, + "metadata": { + "anyOf": [ + { + "$ref": "#/$defs/Metadata" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional metadata object, including calculation details which do not directly impact results" + }, + "partialCharges": { + "anyOf": [ + { + "$ref": "#/$defs/PartialCharges" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional PartialCharges object. Includes atomic partial charges and population analysis." + }, + "vibrations": { + "anyOf": [ + { + "$ref": "#/$defs/Vibrations" + }, + { + "type": "null" + } + ], + "default": null + }, + "unitCell": { + "anyOf": [ + { + "$ref": "#/$defs/UnitCell" + }, + { + "type": "null" + } + ], + "default": null + }, + "layer": { + "anyOf": [ + { + "$ref": "#/$defs/Layer" + }, + { + "type": "null" + } + ], + "default": null + }, + "basisSet": { + "anyOf": [ + { + "$ref": "#/$defs/BasisSet" + }, + { + "type": "null" + } + ], + "default": null + }, + "orbitals": { + "anyOf": [ + { + "$ref": "#/$defs/Orbitals" + }, + { + "type": "null" + } + ], + "default": null + }, + "spectra": { + "anyOf": [ + { + "$ref": "#/$defs/Spectra" + }, + { + "type": "null" + } + ], + "default": null } - } + }, + "required": [ + "atoms" + ], + "title": "CJSONModel", + "type": "object" }