autostorage.events#

SQLAlchemy ORM event listeners for validation and auto-managed identities.

Module Contents#

Functions#

sort_step_stage_ids

Auto-sort stage_id1 and stage_id2 so stage_id1 < stage_id2.

verify_step_barrierless_consistency

Verify is_barrierless consistency with stage_id_ts.

verify_gradient_shapes_before_flush

Verify gradient shapes match 3 * natoms for all gradients being flushed.

verify_hessian_shapes_before_flush

Verify Hessian shapes match (3 * natoms, 3 * natoms) for all Hessians.

verify_valid_stationary_has_hessian

Verify that stationary points marked as valid have an associated Hessian.

verify_trajectory_geometry_ndim_insert

Ensure linked geometry’s index length matches trajectory ndim.

_find_or_create_identity

Find or create an IdentityRow for the given Identity.

add_inchi_identities_before_flush

Automatically attach InChI identities to newly inserted stationary points.

_find_or_create_identity_extra

Find or create an IdentityExtraRow.

add_smiles_extras_before_flush

Automatically attach SMILES as IdentityExtraRow to stationary points.

add_hill_extras_before_flush

Automatically attach Hill formula as IdentityExtraRow to stationary points.

API#

autostorage.events.sort_step_stage_ids(mapper: sqlalchemy.orm.Mapper[autostorage.models.StepRow], connection: sqlalchemy.engine.Connection, target: autostorage.models.StepRow) None#

Auto-sort stage_id1 and stage_id2 so stage_id1 < stage_id2.

autostorage.events.verify_step_barrierless_consistency(mapper: sqlalchemy.orm.Mapper[autostorage.models.StepRow], connection: sqlalchemy.engine.Connection, target: autostorage.models.StepRow) None#

Verify is_barrierless consistency with stage_id_ts.

autostorage.events.verify_gradient_shapes_before_flush(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Verify gradient shapes match 3 * natoms for all gradients being flushed.

autostorage.events.verify_hessian_shapes_before_flush(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Verify Hessian shapes match (3 * natoms, 3 * natoms) for all Hessians.

autostorage.events.verify_valid_stationary_has_hessian(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Verify that stationary points marked as valid have an associated Hessian.

autostorage.events.verify_trajectory_geometry_ndim_insert(mapper: sqlalchemy.orm.Mapper[autostorage.models.GeometryTrajectoryLink], connection: sqlalchemy.engine.Connection, target: autostorage.models.GeometryTrajectoryLink) None#

Ensure linked geometry’s index length matches trajectory ndim.

autostorage.events._find_or_create_identity(session: sqlalchemy.orm.Session, identity: automol.Identity) autostorage.models.IdentityRow#

Find or create an IdentityRow for the given Identity.

Checks both the database and pending session inserts.

autostorage.events.add_inchi_identities_before_flush(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Automatically attach InChI identities to newly inserted stationary points.

autostorage.events._find_or_create_identity_extra(session: sqlalchemy.orm.Session, identity: autostorage.models.IdentityRow, attribute: str, value: str) autostorage.models.IdentityExtraRow | None#

Find or create an IdentityExtraRow.

Checks both the database and pending session inserts. Returns None if the extra already exists.

autostorage.events.add_smiles_extras_before_flush(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Automatically attach SMILES as IdentityExtraRow to stationary points.

autostorage.events.add_hill_extras_before_flush(session: sqlalchemy.orm.Session, flush_context: Any, instances: Any) None#

Automatically attach Hill formula as IdentityExtraRow to stationary points.