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 pseudo-potential core charges. The matrix elements corresponding to ghost atoms are zero.

atffparams

A dictionary with arrays of atomic force field parameters (typically non-bonded). 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. Numerical values of bond types are defined in iodata.periodic.

cellvecs

A (NP, 3) array containing the (real-space) 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 Hartree-Fock 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 one-body operators, typically integrals of a one-body operator with a pair of (Gaussian) basis functions. Names can start with olp (overlap), kin (kinetic energy), na (nuclear attraction), core (core hamiltonian), etc., or one (general one-electron integral). 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 non-orthogonal (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 atomic-orbital basis.

one_rdms

Dictionary where keys are names and values are one-particle density matrices. Names can be scf, post_scf, scf_spin, post_scf_spin. When relevant, these names must have a suffix _ao or _mo to clarify in which basis the RDMs are computed. _ao is used to denote a non-orthogonal (atomic orbital) basis. _mo is used to denote an orthogonal (molecular orbital) basis. For the SCF RDMs, this suffix can be omitted because it is only useful to compute them in the atomic-orbital 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 two-body operators, typically integrals of two-body operator with four of (Gaussian) basis functions. Names can start with er (electron repulsion) or two (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 two-particle density matrices. Names can be post_scf or post_scf_spin. When relevant, these names must have a suffix _ao or _mo to clarify in which basis the RDMs are computed. See one_rdms for more details. 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.

atcharges: dict
atcoords: ndarray
property atcorenums: ndarray

Return effective core charges.

atffparams: dict
atfrozen: ndarray
atgradient: ndarray
athessian: ndarray
atmasses: ndarray
atnums: ndarray
basisdef: str
bonds: ndarray
cellvecs: ndarray
property charge: float

Return the net charge of the system.

core_energy: float
cube: Cube
energy: float
extcharges: ndarray
extra: dict
g_rot: float
lot: str
mo: MolecularOrbitals
moments: dict
property natom: int

Return the number of atoms.

property nelec: float

Return the number of electrons.

obasis: MolecularBasis
obasis_name: str
one_ints: dict
one_rdms: dict
run_type: str
property spinpol: float

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.

title: str
two_ints: dict
two_rdms: dict