qscat.units and qscat.exceptions¶
qscat.units¶
Atomic units are used throughout qscat: energies in Hartree, lengths in Bohr. These conversions exist so unit handling is never scattered through method code — there is exactly one place that knows the Hartree/eV factor.
Convert a string or number to a floating point number, if possible. |
|
Convert a string or number to a floating point number, if possible. |
|
Convert energy in Hartree to electron-volts. |
|
Convert energy in electron-volts to Hartree. |
- qscat.units.HARTREE_TO_EV: float = 27.211386245988¶
Convert a string or number to a floating point number, if possible.
- qscat.units.EV_TO_HARTREE: float = 0.03674932217565499¶
Convert a string or number to a floating point number, if possible.
qscat.exceptions¶
Every recoverable error qscat raises is a subclass of QscatError. Each also
subclasses the built-in it replaces, so catching the built-in remains valid.
Generic argument validation may still raise a plain ValueError/TypeError.
Base class for all errors raised by qscat. |
|
Invalid FEM-DVR-ECS grid / discretisation specification. |
|
Invalid model specification, parameters, or registry lookup. |
|
A linear-algebra backend is unavailable or failed at runtime. |
|
A numerical procedure failed to reach its convergence target. |
- exception qscat.exceptions.GridError[source]¶
Invalid FEM-DVR-ECS grid / discretisation specification.
Raised when a grid, element, or quadrature specification is malformed or out of range (e.g. a non-increasing segment endpoint, a quadrature order below 2, an r_max inside the fixed inner segments).
Examples
Each qscat error subclasses the built-in it replaces, so existing
except/pytest.raisescode keeps working:>>> from qscat.exceptions import GridError, QscatError >>> issubclass(GridError, ValueError) True >>> issubclass(GridError, QscatError) True
- exception qscat.exceptions.ModelError[source]¶
Invalid model specification, parameters, or registry lookup.
- exception qscat.exceptions.BackendError[source]¶
A linear-algebra backend is unavailable or failed at runtime.
Raised when a requested sparse backend (e.g. MUMPS) is not installed, or a backend operation fails in a way that is about the backend rather than the input (e.g. an optional dependency missing on the chosen code path).