API overview
The supported Python contract begins at quantas.api. Applications,
notebooks, services, the command-line interface, and future graphical
frontends should import from these namespaces rather than from implementation packages. Those packages may change as the
code evolves and are not application contracts.
The API is organized by scientific domain rather than as one flat collection of functions:
from quantas.api import (
common,
elasticity,
eos,
ha,
interop,
profiles,
qha,
registry,
rendering,
seismic,
thermoelasticity,
)
Only names exported through the __all__ attribute of these modules are
part of the supported public surface. A class may be implemented internally
in another package, but users should import and reference it through its
quantas.api alias.
The reference pages use explicit autodoc directives for those aliases rather than expanding every imported module member. Automated tests require every exported name to be documented exactly once and reject undocumented or accidentally promoted symbols.
API lifecycle patterns
Most scientific modules follow a single-shot lifecycle:
input or path
-> normalize_input
-> run
-> ResultData
-> typed module payload
-> report / plots / export / HDF5
HA, QHA, Elasticity, SEISMIC, and Thermoelasticity expose passive Input,
Options, and Result contracts around this pattern. EOS is deliberately
different: one dataset can produce many immutable fit records, so its public
surface is organized around fit requests, batch plans, archives, sessions,
diagnostics, and post-fit calculations.
Result envelopes and typed payloads
Single-shot workflows return quantas.api.common.ResultData. The
envelope contains common metadata, normalized input, resolved options,
warnings, persistent events, and one module-specific payload. The
module-specific get_result function validates the envelope before
returning the typed payload:
from quantas.api import qha
result_data = qha.run("phonons.yaml", options=qha.Options())
result = qha.get_result(result_data)
print(result.equilibrium_volume.shape)
Do not extract a payload by assuming a string key when a typed accessor is available.
Frontend-neutral reporting and plotting
Calculations build quantas.api.common.ReportTable and
quantas.api.common.PlotCollection objects. Concrete plain-text and
Matplotlib output is produced separately by quantas.api.rendering.
This keeps numerical workflows independent from terminals, notebooks, web
applications, and graphical interfaces.
Observers and progress
Long-running public operations accept an quantas.api.common.Observer.
Events contain messages, levels, structured data, and optional normalized
progress. The calculator does not create a Rich progress bar or GUI widget;
the frontend decides how events are presented.
Runtime dependencies and optional features
Importing quantas remains lightweight. The base scientific runtime
includes odrpack for orthogonal-distance EOS regression and spglib for
crystallographic symmetry and structure-normalization operations. These
packages are required dependencies even though their functionality is imported
only when the corresponding workflow is used.
Static plotting remains optional and requires the plot extra. A missing
required runtime backend indicates an incomplete or broken installation rather
than an intentionally unavailable Quantas capability.
Public namespaces
Namespace |
Purpose |
Continue with |
|---|---|---|
|
Shared envelopes, neutral report/plot contracts, and events. |
|
|
Harmonic thermodynamic calculations. |
|
|
Quasi-harmonic inspection, calculation, validation, and comparison. |
|
|
Second-order elastic analysis and directional surfaces. |
|
|
Christoffel phase/group analysis, polarization, and enhancement. |
|
|
EOS datasets, fitting, archives, diagnostics, and calculations. |
|
|
QSA calibration, P–T reconstruction, and geological profiles. |
|
|
Frontend-neutral terrestrial profile specifications. |
|
|
Supported rendering bridge for neutral tables and plots. |
|
|
Capability-based discovery for frontends and services. |
|
|
Explicit transformations between scientific workflows. |