3.5.6. horton.io.iodata – Input/output dispatcher for different file formats

The IOData.from_file and IOData.to_file methods read/write data from/to a file. The format is deduced from the prefix or extension of the filename.

class horton.io.iodata.IOData(**kwargs)

Bases: object

A container class for data loaded from (or to be written to) a file.

In principle, the constructor accepts any keyword argument, which is stored as an attribute. All attributes are optional. Attributes can be set are removed after the IOData instance is constructed. The following attributes are supported by at least one of the io formats:

Type checked array attributes (if present):

cube_data
A (L, M, N) array of data on a uniform grid (defined by ugrid).
coordinates
A (N, 3) float array with Cartesian coordinates of the atoms.
numbers
A (N,) int vector with the atomic numbers.
polar
A (3, 3) matrix containing the dipole polarizability tensor.
pseudo_numbers
A (N,) float array with pseudo-potential core charges.

Unspecified type (duck typing):

cell
A Cell object that describes the (generally triclinic) periodic boundary conditions.
core_energy
The Hartree-Fock energy due to the core orbitals
energy
The total energy (electronic+nn)
er
The electron repulsion four-index operator
exp_alpha
The alpha orbitals (coefficients, occupations and energies).
exp_beta
The beta orbitals (coefficients, occupations and energies).
esp_charges
Charges fitted to the electrostatic potential
dm_full (optionally with a suffix like _mp2, _mp3, _cc, _ci, _scf).
The spin-summed first-order density matrix.
dm_spin (optionally with a suffix like _mp2, _mp3, _cc, _ci, _scf).
The spin-difference first-order density matrix.
grid
An integration grid (usually a UniformGrid instance).
kin
The kinetic energy operator.
lf
A LinalgFactory instance.
links
A mapping between the atoms in the primitive unit and the crystallographic unit.
ms2
The spin multiplicity.
mulliken_charges
Mulliken AIM charges.
na
The nuclear attraction operator.
nelec
The number of electrons.
npa_charges
Natural charges.
obasis
An instance of the GOBasis class.
olp
The overlap operator.
one_mo
One-electron integrals in the (Hartree-Fock) molecular-orbital basis
permutation
The permutation applied to the basis functions.
signs
The sign changes applied to the basis functions.
symmetry
An instance of the Symmetry class, describing the geometric symmetry.
title
A suitable name for the data.
two_mo
Two-electron integrals in the (Hartree-Fock) molecular-orbital basis
copy()

Return a shallow copy

classmethod from_file(*filenames, **kwargs)

Load data from a file.

Arguments:

filename1, filename2, ...
The files to load data from. When multiple files are given, data from the first file is overwritten by data from the second, etc. When one file contains sign and permutation changes for the orbital basis, these changes will be applied to data from all other files.

Optional arguments:

lf
A LinalgFactory instance. DenseLinalgFactory is used as default.

This routine uses the extension or prefix of the filename to determine the file format. It returns a dictionary with data loaded from the file.

For each file format, a specialized function is called that returns a dictionary with data from the file.

get_dm_full()

Return a spin-summed density matrix using availlable attributes

get_dm_spin()

Return a spin-difference density matrix using availlable attributes

to_file(filename)

Write data to a file

Arguments:

filename
The file to write the data to

This routine uses the extension or prefix of the filename to determine the file format. For each file format, a specialized function is called that does the real work.

coordinates

A type-checked attribute

cube_data

A type-checked attribute

natom

The number of atoms

numbers

A type-checked attribute

polar

A type-checked attribute

pseudo_numbers

A type-checked attribute