Data¶
Data is the union of file-only FileData and structured result types. All result types inherit from FileData and require provenance, which identifies the producing program and its optional version. When contained in a ProgramOutput, the concrete type depends on the requested CalcType.
Standalone data objects hold scientific values and producer identity. They do not duplicate the calculation input; retain a ProgramOutput when you need that context.
Empty data is valid for every scientific type. For an empty OptimizationData, final_structure and final_energy return None; structures and energies are empty collections. With frames, a failed final step still contributes its evaluated structure, and any available energy is retained. An unavailable energy is nan, independently of execution success.
Frames: structures inside a calculation¶
A Frame is one structure inside a larger calculation, with what was computed there: an optimizer step, an IRC point, an image of a path. It is a ProgramOutput without input_data (both build on OutputBase: success, logs, traceback, execution). The parent's input already holds the program, model, and keywords, so a frame keeps only its structure and results, a SinglePointData that is never None (empty, with the producing program's provenance, when nothing was computed). ProgramInput.from_spec(parent_spec, frame.structure) rebuilds a step's exact input; Frame.from_output(child_output) records a child calculation as a frame. Passing ProgramOutputs where frames are expected, or loading trajectories saved before frames existed, converts them, taking each step's structure from its input.
Results that hold structures read the same way: structures, energies (nan where none was computed), to_xyz(), and save("x.xyz"). That holds for OptimizationData (one frame per step), PathData, PathOptimizationData (its final path), and ConformerSearchData (its conformers).
PathData is a path of frames in order, with ts_index marking the transition state if there is one. For an IRC the frames run from the end of the reverse branch, through the transition state, to the end of the forward branch; for a chain (NEB, string) they are the images, endpoints included. forward_barrier and reverse_barrier are the transition state's energy above the first and last frames, in Hartree. PathOptimizationData.paths holds the path at every iteration, like an optimization's steps; final_path is the result.
Fields are named after what they hold: frames (OptimizationData, PathData), paths (PathOptimizationData), points (ScanData, one constrained optimization per point), and conformers/rotamers (ConformerSearchData, frames sorted by energy). The former names OptimizationData.trajectory and ScanData.trajectory are still accepted when constructing or loading and readable as properties, with a FutureWarning. ConformerSearchData still accepts lists of structures with conformer_energies/rotamer_energies arrays, turning each into a frame, and keeps those arrays as properties.
ScanData defaults to no points. Its structures preserves one entry per scan point, using None when a point has no optimization steps. XYZ export raises ValueError if a point lacks a final structure rather than silently omitting it.
Array schemas describe the canonical nested JSON representation: vectors are one-dimensional, geometry/gradients/Hessians are matrices, and normal modes have three dimensions. Constructors continue to accept flat arrays where scientific shape validators can reshape them.
qcdata.FileData
¶
File-only results and the common base for structured calculation data.
Attributes:
| Name | Type | Description |
|---|---|---|
provenance |
Provenance
|
Required identity of the program that produced the data. |
files |
dict[str, str | bytes]
|
Output files, with binary content encoded as base64 during serialization. |
extras |
dict[str, Any]
|
Additional result information. |
qcdata.SinglePointData
¶
The computed data from a single point calculation.
Attributes:
| Name | Type | Description |
|---|---|---|
energy |
float | None
|
The electronic energy of the structure in |
gradient |
SerializableMatrix | None
|
The gradient of the structure in |
hessian |
SerializableMatrix | None
|
The hessian of the structure in |
nuclear_repulsion_energy |
float | None
|
The nuclear repulsion energy of the structure in Hartrees. |
wavefunction |
Wavefunction | None
|
Wavefunction data from the calculation. |
freqs_wavenumber |
list[float]
|
Harmonic vibrational frequencies in wavenumbers (cm^-1), negative for imaginary modes. |
normal_modes_cartesian |
SerializableTensor3D | None
|
n_vibmodes x n_atoms x 3 array of normal modes, one per
entry of |
gibbs_free_energy |
float | None
|
Gibbs free energy (i.e. thermochemical analysis) in Hartrees of a system where translation / rotation / vibration degrees of freedom are approximated using ideal gas / rigid rotor / harmonic oscillator respectively. |
scf_dipole_moment |
list[float] | None
|
The x, y, z component of the dipole moment of the structure in units of e a0 (NOT Debye!). |
atomic_charges |
SerializableVector | None
|
Partial charge on each atom in units of e, ordered like the
structure's atoms. The partitioning scheme (Mulliken, Lowdin, CM5, ...)
is the program's; parsers record it in |
point_charge_gradient |
SerializableMatrix | None
|
n_charges x 3 gradient of the energy with respect
to the positions of external point charges, in |
return_result
¶
return_result(
calctype: CalcType,
) -> float | SerializableNDArray | None
Return the primary result of the calculation.
Source code in src/qcdata/models/data.py
218 219 220 | |
options: members: false
qcdata.OptimizationData
¶
Computed data for an optimization (may be for a minimum or transition state).
Attributes:
| Name | Type | Description |
|---|---|---|
frames |
list[Frame]
|
One |
energies |
ndarray
|
|
structures |
list[Structure]
|
|
final_structure |
Structure | None
|
|
final_energy
property
¶
final_energy: float | None
The final step's energy, None for no steps, or np.nan if unavailable.
final_structure
property
¶
final_structure: Structure | None
The last evaluated structure, or None when there are no steps.
return_result
¶
Return the primary result of the optimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calctype
|
CalcType
|
The calculation type. Unused; an optimization's primary result is always its final structure. |
required |
Returns:
| Type | Description |
|---|---|
Structure | None
|
The final structure, or None if there are no frames. |
Source code in src/qcdata/models/data.py
407 408 409 410 411 412 413 414 415 416 417 | |
options: members: - structures - final_structure - energies - final_energy - to_xyz - save
qcdata.Frame
¶
One structure inside a larger calculation, with what was computed there.
A step of an optimization, a point of an IRC, an image of a path. It is a
ProgramOutput without input_data: the parent calculation's input already
holds the program, model, and keywords, so a frame keeps only its structure.
ProgramInput.from_spec(parent_spec, frame.structure) rebuilds a step's input.
Attributes:
| Name | Type | Description |
|---|---|---|
structure |
Structure
|
The structure of this step. |
results |
SinglePointData
|
What was computed at it; an empty |
from_output
classmethod
¶
from_output(output: ProgramOutput[Any, Any]) -> Self
Record a child calculation's output as a step, at its input's structure.
Raises:
| Type | Description |
|---|---|
ValidationError
|
The output's results are not |
Source code in src/qcdata/models/data.py
278 279 280 281 282 283 284 285 286 | |
options: members: - from_output
qcdata.PathData
¶
A path of structures through a reaction: an IRC, or a chain of images.
For an IRC the frames run from the end of the reverse branch, through the transition state, to the end of the forward branch. For a chain (NEB, string, growing string) they are the images in order, endpoints included.
Attributes:
| Name | Type | Description |
|---|---|---|
frames |
list[Frame]
|
The structures along the path, in order, with what was computed at each. |
ts_index |
int | None
|
The position of the transition state in |
energies |
ndarray
|
|
structures |
list[Structure]
|
|
forward_barrier
property
¶
forward_barrier: float | None
The transition state's energy above the first frame, in Hartree.
reverse_barrier
property
¶
reverse_barrier: float | None
The transition state's energy above the last frame, in Hartree.
return_result
¶
Return the primary result: the structures along the path.
Source code in src/qcdata/models/data.py
484 485 486 | |
options: members: - structures - energies - transition_state - forward_barrier - reverse_barrier - to_xyz - save
qcdata.PathOptimizationData
¶
Computed data for a path optimization (NEB, string, growing string, ...).
Like an optimization's frames, but each step is a whole path.
Attributes:
| Name | Type | Description |
|---|---|---|
paths |
list[PathData]
|
The path at each iteration, the optimized one last. |
final_path |
PathData | None
|
|
energies |
ndarray
|
|
structures |
list[Structure]
|
|
final_path
property
¶
final_path: PathData | None
The optimized (last) path, or None when there are no iterations.
return_result
¶
Return the primary result: the final path.
Source code in src/qcdata/models/data.py
529 530 531 | |
to_xyz
¶
to_xyz() -> str
Return the final path as a multi-structure xyz string.
Source code in src/qcdata/models/data.py
525 526 527 | |
options: members: - final_path - structures - energies - to_xyz
qcdata.ConformerSearchData
¶
Data from a conformer search calculation.
Conformers and rotamers are Frames, sorted by energy (lowest first; frames
without an energy last). Constructing or loading with lists of structures and
separate energy arrays (conformer_energies, rotamer_energies), the form
before frames, still works: each structure becomes a frame with its energy.
Attributes:
| Name | Type | Description |
|---|---|---|
conformers |
list[Frame]
|
The conformers found, each with what was computed for it. |
rotamers |
list[Frame]
|
The rotamers found, each with what was computed for it. |
structures |
list[Structure]
|
|
energies |
ndarray
|
|
conformer_energies |
ndarray
|
|
rotamer_energies |
ndarray
|
|
conformer_energies
property
¶
conformer_energies: ndarray
The conformers' energies in Hartree, lowest first; empty if unknown.
conformer_energies_relative
property
¶
conformer_energies_relative: ndarray
The relative energies for each conformer in the search.
energies
property
¶
energies: ndarray
The conformers' energies in Hartree, lowest first (shared interface).
rotamer_energies
property
¶
rotamer_energies: ndarray
The rotamers' energies in Hartree, lowest first; empty if unknown.
rotamer_energies_relative
property
¶
rotamer_energies_relative: ndarray
The relative energies for each rotamer in the search.
to_xyz
¶
to_xyz() -> str
Return the conformers as a multi-structure xyz string.
Source code in src/qcdata/models/data.py
629 630 631 | |
qcdata.Wavefunction
¶
The wavefunction for a single point calculation.
Attributes:
| Name | Type | Description |
|---|---|---|
scf_eigenvalues_a |
SerializableVector | None
|
The SCF alpha-spin orbital eigenvalues. |
scf_eigenvalues_b |
SerializableVector | None
|
The SCF beta-spin orbital eigenvalues. |
scf_occupations_a |
SerializableVector | None
|
The SCF alpha-spin orbital occupations. |
scf_occupations_b |
SerializableVector | None
|
The SCF beta-spin orbital occupations. |
to_numpy
classmethod
¶
to_numpy(
val: ndarray | None, _info: ValidationInfo
) -> ndarray | None
Ensure orbital eigenvalues and occupations are stored as numpy arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
ndarray | None
|
The eigenvalue or occupation vector, or None if not provided. |
required |
_info
|
ValidationInfo
|
Pydantic validation context (unused). |
required |
Returns:
| Type | Description |
|---|---|
ndarray | None
|
The value as a numpy array, or None if it was not provided. |
Source code in src/qcdata/models/data.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
Selecting a scientific data type¶
Use the shared get_data_type(calctype) lookup rather than maintaining a mapping in
parsers or execution packages. It accepts either CalcType or its string value:
from qcdata import get_data_type
results = get_data_type("optimization")(provenance={"program": "geometric"})
File-only execution uses FileData directly. Unknown calculation types raise ValueError.