Skip to main content

Data Models

autostorage uses SQLModel/SQLAlchemy to define a relational schema for computational chemistry workflow data. The models form a graph structure where molecular geometries, calculations, stationary points, and chemical identities are linked through explicit relationship tables.

Model Overview

The schema is organized into five functional groups:

Core Data Models

The fundamental entities representing molecular structures, calculations, and their results.

Model Description
GeometryRow Molecular geometry with atomic symbols, coordinates, charge, and spin; extends autogeom.Geometry
TrajectoryRow Ordered sequence of geometries from a dynamic calculation; view(axis, at) animates the geometries along one dimension, and values_along(axis, at) gives their physical values
TrajectoryAxisRow The physical coordinate (distance, angle, dihedral, or other) that one dimension of a trajectory runs along, such as a scanned dihedral
ModelRow Calculation model specification (program, method, basis set, keywords)
CalculationRow Quantum chemistry calculation with provenance metadata
PropertyKindRow A kind of property (energy, gradient, hessian, …), mirroring PropertyKindRegistry by name
PropertyValueRow A property value for a geometry/calculation pair, validated against its kind’s expected shape
ValidationRow Validation result (e.g., IRC) for a reaction step

Stationary Points

Models representing critical points on potential energy surfaces.

Model Description
StationaryPointRow A stationary point with Hessian index and validation status

Reaction Network

Models defining elementary reaction steps and their constituent chemical states.

Model Description
StageRow A chemical state in a reaction (reactant, product, or transition state)
StepRow An elementary reaction step connecting two stages via a transition state (or barrierless)

Chemical Identities

Models for chemical identification and classification.

Model Description
IdentityAlgorithmRow An identity algorithm (name, kind, parent), mirroring an IdentityAlgorithm
IdentityRow A chemical identifier value (InChI, SMILES, Hill formula, …) generated by an algorithm; attached to stationary points automatically

Scans and Other Trajectories

A trajectory’s geometries are placed on a grid by their integer index. To record what a dimension means physically, such as the dihedral angle of a relaxed scan, give the trajectory a TrajectoryAxisRow for that dimension:

from autostorage import AxisKind, GeometryTrajectoryLink, TrajectoryAxisRow, TrajectoryRow

scan = TrajectoryRow()
scan.axes.append(
    TrajectoryAxisRow(
        axis=0, kind=AxisKind.DIHEDRAL, keys=[0, 1, 2, 3], label="H-O-O-H torsion"
    )
)
for i, geo in enumerate(scan_geometries):
    scan.geometry_links.append(GeometryTrajectoryLink(geometry=geo, index=[i]))
session.add(scan)
session.commit()

scan.values_along(0)                  # dihedrals in degrees, in index order
scan.values_along(0, units="radian")

On flush, each link’s values (one per dimension, aligned with index) are filled in:

  • Missing values of distance, angle, and dihedral axes are measured from the geometry with autogeom. Distances default to Angstrom and angles to degrees; set units on the axis to store them in other units. Measured dihedrals lie between -180° and 180°.
  • Given values are kept, so you can store a scan’s nominal (constrained) values instead. A pint.Quantity is converted to the axis’s units.
  • AxisKind.OTHER axes (e.g. an IRC arc length) are never measured, so their values must be given.
  • Adding an axis to a stored trajectory fills in the values of its existing geometries.

Design Principles

  • autogeom integration: GeometryRow extends autogeom.Geometry directly rather than wrapping it, delegating validation and format conversions to autogeom
  • Identities from a registry: identities are generated by the algorithms in IdentityAlgorithmRegistry (see Identities)
  • Registries mirrored by name: IdentityAlgorithmRow and PropertyKindRow rows are seeded from their in-memory registries when a Database is opened, and looked up by name
  • Explicit relationships: Many-to-many relationships use dedicated link tables rather than implicit joins
  • Cascading deletes: deleting a row deletes its link rows and the data that depends on it: a model’s calculations, a geometry’s or calculation’s property values and stationary points, and a calculation’s validations. Geometries, stages, steps, and identities are kept
  • Provenance tracking: Calculations record both input and output provenance metadata
  • Native units: each property kind declares its native units (energy in Hartree, gradient in Hartree/Bohr, hessian in Hartree/Bohr²). Values are always stored in them: a pint.Quantity (e.g. autogeom.ureg.Quantity(-1.2, "kcal/mol")) is converted on flush, and a value without units is assumed to be in the native units already. molar units such as kcal/mol are converted with Avogadro’s constant. PropertyKind.from_native(value, "kcal/mol") converts a stored value back out, and PropertyKind.quantity attaches the native units to it
  • Validated stationary points: on flush, a stationary point is marked is_validated if every Hessian of its geometry has order negative eigenvalues after translations and rotations are projected out (autogeom.vibrational_analysis and autogeom.stationary_point_order). Otherwise, is_validated is reset to False and a StationaryOrderWarning is issued. This check runs again when the point or one of its Hessians is added, changed, or deleted. Pseudo stationary points are skipped
  • Compressed storage: NumPy arrays (coordinates and property values) are stored as zlib-compressed binary data via CompressedArrayTypeDecorator; property values are stored as float64, except Hessians (float32). Identity caches are stored as zlib-compressed JSON via CompressedJSONTypeDecorator
  • Graph structure: The schema forms a directed graph where calculations consume and produce geometries/trajectories, geometries carry results, stationary points reference geometries, and reaction steps connect stages