iodata.iodata module¶
Module for handling input/output from different file formats.

class
IOData
(atcharges={}, atcoords=None, atcorenums=None, atffparams={}, atfrozen=None, atgradient=None, athessian=None, atmasses=None, atnums=None, basisdef=None, bonds=None, cellvecs=None, charge=None, core_energy=None, cube=None, energy=None, extcharges=None, extra={}, g_rot=None, lot=None, mo=None, moments={}, nelec=None, obasis=None, obasis_name=None, one_ints={}, one_rdms={}, run_type=None, spinpol=None, title=None, two_ints={}, two_rdms={})[source]¶ 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:

atcharges
¶ A dictionary where keys are names of charge definitions and values are arrays with atomic charges (size N).

atcoords
¶ A (N, 3) float array with Cartesian coordinates of the atoms.

atcorenums
¶ A (N,) float array with pseudopotential core charges. The matrix elements corresponding to ghost atoms are zero.

atffparams
¶ A dictionary with arrays of atomic force field parameters (typically nonbonded). Keys include ‘charges’, ‘vdw_radii’, ‘sigmas’, ‘epsilons’, ‘alphas’ (atomic polarizabilities), ‘c6s’, ‘c8s’, ‘c10s’, ‘buck_as’, ‘buck_bs’, ‘lj_as’, ‘core_charges’, ‘valence_charges’, ‘valence_widths’, etc. Not all of them have to be present, depending on the use case.

atfrozen
¶ A (N,) bool array with frozen atoms. (All atoms are free if this attribute is not set.)

atgradient
¶ A (N, 3) float array with the first derivatives of the energy w.r.t. Cartesian atomic displacements.

athessian
¶ A (3*N, 3*N) array containing the energy Hessian w.r.t Cartesian atomic displacements.

atmasses
¶ A (N,) float array with atomic masses

atnums
¶ A (N,) int vector with the atomic numbers.

basisdef
¶ A basis set definition, i.e. a dictionary whose keys are symbols (of chemical elements), atomic numbers (similar to previous, str to make distinction with following) or an atom index (integer referring to a specific atom in a molecule). The format of the values is to be decided when implementing a load function for basis set definitions.

bonds
¶ An (nbond, 3) array with the list of covalent bonds. Each row represents one bond and consists of three integers: first atom index (starting from zero), second atom index & an optional bond type (0: not known, 1: single, 2: double, 3: triple, 4: conjugated).

cellvecs
¶ A (NP, 3) array containing the (realspace) cell vectors describing periodic boundary conditions. A single vector corresponds to a 1D cell, e.g. for a wire. Two vectors describe a 2D cell, e.g. for a membrane. Three vectors describe a 3D cell, e.g. a crystalline solid.

charge
¶ The net charge of the system. When possible, this is derived from atcorenums and nelec.

core_energy
¶ The HartreeFock energy due to the core orbitals

cube
¶ An instance of Cube, describing the volumetric data from a cube (or similar) file.

energy
¶ The total energy (electronic + nn)

extcharges
¶ Array with values of external charges, with shape (nextcharge, 4). First three columns for Cartesian X, Y and Z coordinates, last column for the actual charge.

extra
¶ A dictionary with additional data loaded from a file. Any data which cannot be assigned to the other attributes belongs here. It may be decided in future to move some of the results from this dictionary to IOData attributes, with a more final name.

g_rot
¶ The rotational symmetry number of the molecule.

lot
¶ The level of theory used to compute the orbitals (and other properties).

mo
¶ An instance of MolecularOrbitals.

moments
¶ A dictionary with electrostatic multipole moments. Keys are (angmom, kind) tuples where angmom is an integer for the angular momentum and kind is ‘c’ for Cartesian or ‘p’ for pure functions (only for angmom >= 2). The corresponding values are 1D numpy arrays. The order of the components of the multipole moments follows the HORTON2_CONVENTIONS from iodata/basis.py

nelec
¶ The number of electrons.

obasis
¶ An OrderedDict containing parameters to instantiate a GOBasis class.

obasis_name
¶ A name or DOI describing the basis set used for the orbitals in the mo attribute (if applicable). Should be consistent with www.basissetexchange.org.

one_ints
¶ Dictionary where keys are names and values are numpy arrays with onebody operators, typically integrals of a onebody operator with a pair of (Gaussian) basis functions. Names can start with
olp
(overlap),kin
(kinetic energy),na
(nuclear attraction),core
(core hamiltonian), etc. When relevant, these names must have a suffix_ao
or_mo
to clarify in which basis the integrals are computed._ao
is used to denote integrals in a nonorthogonal (atomic orbital) basis._mo
is used to denote an orthogonal (molecular orbital) basis. For the overlap integrals, this suffix can be omitted because it is only useful to compute them in the atomicorbital basis.

one_rdms
¶ Dictionary where keys are names and values are oneparticle density matrices. Names can be
scf
,post_scf
,scf_spin
,post_scf_spin
. These matrices are always expressed in the AO basis.

run_type
¶ The type of calculation that lead to the results stored in IOData, which must be one of the following: ‘energy’, ‘energy_force’, ‘opt’, ‘scan’, ‘freq’ or None.

spinpol
¶ The spin polarization. By default, its value is derived from the molecular orbitals (mo attribute), as abs(nalpha  nbeta). In this case, spinpol cannot be set. When no molecular orbitals are present, this attribute can be set.

title
¶ A suitable name for the data.

two_ints
¶ Dictionary where keys are names and values are numpy arrays with twobody operators, typically integrals of twobody operator with four of (Gaussian) basis functions. Names can start with
er
(electron repulsion) ortwo
(general pairswise interaction). When relevant, these names must have a suffix_ao
or_mo
to clarify in which basis the integrals are computed, see one_ints for more details. Array indexes are in physicist’s notation.

two_rdms
¶ Dictionary where keys are names and values are twoparticle density matrices. Names can be
post_scf
orpost_scf_spin
. These matrices are always expressed in the AO basis. Array indexes are in physicist’s notation.

__init__
(atcharges={}, atcoords=None, atcorenums=None, atffparams={}, atfrozen=None, atgradient=None, athessian=None, atmasses=None, atnums=None, basisdef=None, bonds=None, cellvecs=None, charge=None, core_energy=None, cube=None, energy=None, extcharges=None, extra={}, g_rot=None, lot=None, mo=None, moments={}, nelec=None, obasis=None, obasis_name=None, one_ints={}, one_rdms={}, run_type=None, spinpol=None, title=None, two_ints={}, two_rdms={})¶ Method generated by attrs for class IOData.
 Return type
None

atcoords
: numpy.ndarray¶

property
atcorenums
¶ Return effective core charges.
 Return type
ndarray

atfrozen
: numpy.ndarray¶

atgradient
: numpy.ndarray¶

athessian
: numpy.ndarray¶

atmasses
: numpy.ndarray¶

atnums
: numpy.ndarray¶

bonds
: numpy.ndarray¶

cellvecs
: numpy.ndarray¶

cube
: iodata.utils.Cube¶

extcharges
: numpy.ndarray¶

obasis
: iodata.basis.MolecularBasis¶

property
spinpol
¶ Return the spin polarization.
Warning: for restricted wavefunctions, it is assumed that an occupation number in ]0, 2[ implies spin polarizaiton, which may not always be a valid assumption.
 Return type
