Skip to content

Data

Data objects contains the structured calculation data. When contained in a ProgramOutput, the concrete type depends on the requested CalcType.

qcdata.Data module-attribute

Data = Union[Files, StructuredData]

qcdata.SinglePointData

The computed data from a single point calculation.

Attributes:

Name Type Description
energy float | None

The electronic energy of the structure in Hartrees.

gradient SerializableNDArray | None

The gradient of the structure in Hartrees/Bohr.

hessian SerializableNDArray | None

The hessian of the structure in Hartrees/Bohr^2.

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]

The frequencies of the structure in wavenumbers.

normal_modes_cartesian SerializableNDArray | None

3D n_vibmodes x n_atoms x 3 array containing un-mass-weighted Cartesian displacements of each normal mode in Bohr.

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!).

return_result

return_result(
    calctype: CalcType,
) -> float | SerializableNDArray

Return the primary result of the calculation.

Source code in src/qcdata/models/data.py
146
147
148
def return_result(self, calctype: CalcType) -> float | SerializableNDArray:
    """Return the primary result of the calculation."""
    return getattr(self, calctype.value)

options: members: false

qcdata.OptimizationData

Computed data for an optimization (may be for a minimum or transition state).

Attributes:

Name Type Description
energies ndarray

The energies for each step of the optimization.

structures list[Structure]

The Structure objects for each step of the optimization.

final_structure Structure

The final, optimized Structure.

trajectory list['ProgramOutput[ProgramInput, SinglePointData] | ProgramOutput[ProgramInput, Files]']

The ProgramOutput objects for each step of the optimization.

energies property

energies: ndarray

The energies for each step of the optimization.

final_energy property

final_energy: float | None

The final energy in the optimization. Is np.nan if final calculation failed.

final_structure property

final_structure: Structure

The final Structure in the optimization.

structures property

structures: list[Structure]

The Structure objects for each step of the optimization.

save

save(
    filepath: Path | str,
    exclude_none: bool = True,
    exclude_unset: bool = True,
    indent: int = 4,
    **kwargs: dict[str, Any],
) -> None

Save an OptimizationOutput to a file.

Parameters:

Name Type Description Default
filepath Path | str

The path to save the molecule to.

required
exclude_none bool

If True, attributes with a value of None will not be written to the file.

True
exclude_unset bool

If True, attributes that have not been set will not be written to the file.

True
**kwargs dict[str, Any]

Additional keyword arguments to pass to the json serializer.

{}
Note

If the filepath has a .xyz extension, the trajectory will be saved to a multi-structure xyz file.

Source code in src/qcdata/models/data.py
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
def save(
    self,
    filepath: Path | str,
    exclude_none: bool = True,
    exclude_unset: bool = True,
    indent: int = 4,
    **kwargs: dict[str, Any],
) -> None:
    """Save an OptimizationOutput to a file.

    Args:
        filepath: The path to save the molecule to.
        exclude_none: If True, attributes with a value of None will not be written
            to the file.
        exclude_unset: If True, attributes that have not been set will not be
            written to the file.
        **kwargs: Additional keyword arguments to pass to the json serializer.

    Note:
        If the filepath has a `.xyz` extension, the trajectory will be saved to a
        multi-structure `xyz` file.
    """
    filepath = Path(filepath)
    if filepath.suffix == ".xyz":
        filepath.write_text(self.to_xyz())
        return
    super().save(filepath, exclude_none, exclude_unset, indent, **kwargs)

to_xyz

to_xyz() -> str

Return the trajectory as an xyz string.

Source code in src/qcdata/models/data.py
228
229
230
231
232
def to_xyz(self) -> str:
    """Return the trajectory as an `xyz` string."""
    return to_multi_xyz(
        prog_output.input_data.structure for prog_output in self.trajectory
    )

options: members: - structures - final_structure - energies - final_energy - to_xyz - save

qcdata.ConformerSearchData

Data from a conformer search calculation.

Conformers and rotamers are sorted by energy.

Attributes:

Name Type Description
conformers list[Structure]

The conformers found in the search.

conformer_energies SerializableNDArray

The energies for each conformer.

rotamers list[Structure]

The rotamers found in the search.

rotamer_energies SerializableNDArray

The energies for each rotamer.

conformer_energies_relative property

conformer_energies_relative: ndarray

The relative energies for each conformer in the search.

rotamer_energies_relative property

rotamer_energies_relative: ndarray

The relative energies for each rotamer in the search.

conformers_filtered

conformers_filtered(
    threshold: float = 1.0, **rmsd_kwargs
) -> tuple[list[Structure], SerializableNDArray]

Moved since qcdata 0.15.0

This convenience method has moved to [qcinf.filter_conformers][] and this stub will be removed from qcdata in a future release.

from qcinf import filter_conformers

filtered_csr = filter_conformers(
    conformers=csr
    threshold=1.0,          # Bohr
    backend="qcinf",      # or "rdkit",
    **rmsd_kwargs,
)
Source code in src/qcdata/models/data.py
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
def conformers_filtered(
    self,
    threshold: float = 1.0,
    **rmsd_kwargs,
) -> tuple[list[Structure], SerializableNDArray]:
    """
    !!! warning "Moved since *qcdata* 0.15.0"
        This convenience method has moved to
        [`qcinf.filter_conformers`][qcinf.filter_conformers]
        and this stub will be **removed** from *qcdata* in a future release.

        ```python
        from qcinf import filter_conformers

        filtered_csr = filter_conformers(
            conformers=csr
            threshold=1.0,          # Bohr
            backend="qcinf",      # or "rdkit",
            **rmsd_kwargs,
        )
        ```
    """
    warnings.warn(
        "`ConformerSearchResults.conformers_filtered()` is deprecated. "
        "Install *qcinf* and use `qcinf.filter_conformers` instead.",
        DeprecationWarning,
        stacklevel=2,
    )
    raise NotImplementedError(
        "Method removed.  Replace with:\n\n"
        "    from qcinf import filter_conformers\n\n"
        "    filtered_csr = filter_conformers(\n"
        "        prog_output.results,\n"
        "        threshold=1.0,\n"
        "        backend='qcinf',\n"
        "        **rmsd_kwargs\n"
        "    )"
    )

qcdata.Wavefunction

The wavefunction for a single point calculation.

Attributes:

Name Type Description
scf_eigenvalues_a SerializableNDArray | None

The SCF alpha-spin orbital eigenvalues.

scf_eigenvalues_b SerializableNDArray | None

The SCF beta-spin orbital eigenvalues.

scf_occupations_a SerializableNDArray | None

The SCF alpha-spin orbital occupations.

scf_occupations_b SerializableNDArray | None

The SCF beta-spin orbital occupations.