Source code for rgpycrumbs.basetypes

# SPDX-FileCopyrightText: 2023-present Rohit Goswami <rog32@hi.is>
#
# SPDX-License-Identifier: MIT
"""Typed records for NEB / saddle data.

This module holds the canonical definitions. chemparseplot imports its
parsers' records from here.

.. versionchanged:: 1.14.0
   The module no longer tries ``chemparseplot.basetypes`` first. Only the
   0.x chemparseplot releases have it, so the import loaded chemparseplot
   and then failed.
"""

from __future__ import annotations

import datetime
from dataclasses import dataclass, field

import numpy as np


@dataclass(frozen=True, slots=True)
[docs] class nebpath:
[docs] norm_dist: float
[docs] arc_dist: float
[docs] energy: float
@dataclass(frozen=True, slots=True)
[docs] class nebiter:
[docs] iteration: int
[docs] nebpath: nebpath
@dataclass
[docs] class DimerOpt:
[docs] saddle: str = "dimer"
[docs] rot: str = "lbfgs"
[docs] trans: str = "lbfgs"
@dataclass
[docs] class SpinID:
[docs] mol_id: int
[docs] spin: str
@dataclass
[docs] class MolGeom:
[docs] pos: np.ndarray
[docs] energy: float
[docs] forces: np.ndarray
@dataclass
[docs] class SaddleMeasure:
[docs] pes_calls: int = 0
[docs] iter_steps: int = 0
[docs] tot_time: float = field(default_factory=lambda: datetime.timedelta(0).total_seconds())
[docs] saddle_energy: float = np.nan
[docs] saddle_fmax: float = np.nan
[docs] success: bool = False
[docs] method: str = "not run"
[docs] dimer_rot: str = "n/a"
[docs] dimer_trans: str = "n/a"
[docs] init_energy: float = np.nan
[docs] barrier: float = np.nan
[docs] mol_id: int = np.nan
[docs] spin: str = "unknown"
[docs] scf: float = np.nan
[docs] termination_status: str = "not set"
__all__ = [ "DimerOpt", "MolGeom", "SaddleMeasure", "SpinID", "nebiter", "nebpath", ]