import datetime
from collections import namedtuple
from dataclasses import dataclass, field
import numpy as np
# namedtuple for storing NEB iteration data
"""
A namedtuple representing an iteration of a Nudged Elastic Band (NEB) calculation.
.. versionadded:: 1.0.0
Parameters
----------
iteration : int
The iteration number of the NEB calculation.
nebpath : nebpath namedtuple
The data for the NEB path at this iteration.
See Also
--------
nebpath : Stores the normalized arclength, actual arclength, and energy data for
the NEB path.
"""
# namedtuple for storing the NEB path data
"""
A namedtuple representing the NEB path data.
.. versionadded:: 1.0.0
Parameters
----------
norm_dist : float
Normalized Arclength (0 to 1), representing the progression along the reaction path.
Calculated as xcoord2 = arcS[img] / arcS[nim-1].
arc_dist : float
Actual Arclength at each point along the reaction path. Calculated as
xcoord = arcS[img] + dx(ii).
energy : float
Interpolated Energy at each point, calculated using cubic polynomial
interpolation. The energy is calculated using the formula:
p = a*pow(dx(ii), 3.0) + b*pow(dx(ii), 2.0) + c*dx(ii) + d,
where a, b, c, and d are coefficients of the cubic polynomial.
Notes
-----
The `nebpath` namedtuple is used within the `nebiter` namedtuple to store
detailed path information for each NEB iteration.
"""
@dataclass
[docs]
class DimerOpt:
"""Configuration for a dimer-based saddle point search.
.. versionadded:: 1.0.0
"""
@dataclass
[docs]
class SpinID:
"""Identifier combining molecule ID and spin state.
.. versionadded:: 1.0.0
"""
@dataclass
[docs]
class MolGeom:
"""Container for molecular geometry with energy and forces.
.. versionadded:: 1.0.0
"""
@dataclass
[docs]
class SaddleMeasure:
"""Aggregated measurements from a saddle point search.
.. versionadded:: 1.0.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]
method: str = "not run"
[docs]
dimer_trans: str = "n/a"
[docs]
init_energy: float = np.nan
[docs]
barrier: float = np.nan
[docs]
termination_status: str = "not set"