iodata.utils module¶
Utility functions module.
- class Cube(origin, axes, data)[source]¶
Bases:
object
The volumetric data from a cube (or similar) file.
- origin¶
A 3D vector with the origin of the axes frame.
- axes¶
A (3, 3) array where each row represents the spacing between two neighboring grid points along the first, second and third axis, respectively.
- data¶
A (K, L, M) array of data on a uniform grid
- __init__(origin, axes, data)¶
Method generated by attrs for class Cube.
-
axes:
ndarray
¶
-
data:
ndarray
¶
-
origin:
ndarray
¶
- property shape¶
Shape of the rectangular grid.
- exception FileFormatError[source]¶
Bases:
OSError
Raised when incorrect content is encountered when loading files.
- __init__(*args, **kwargs)¶
- args¶
- characters_written¶
- errno¶
POSIX exception code
- filename¶
exception filename
- filename2¶
second exception filename
- strerror¶
exception strerror
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception FileFormatWarning[source]¶
Bases:
Warning
Raised when incorrect content is encountered and fixed when loading files.
- __init__(*args, **kwargs)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class LineIterator(filename)[source]¶
Bases:
object
Iterator class for looping over lines and keeping track of the line number.
- __init__(filename)[source]¶
Initialize a LineIterator.
- Parameters:
filename (
str
) – The file that will be read.
- check_dm(dm, overlap, eps=0.0001, occ_max=1.0)[source]¶
Check if the density matrix has eigenvalues in the proper range.
- Parameters:
- Raises:
ValueError – When the density matrix has wrong eigenvalues.
- derive_naturals(dm, overlap)[source]¶
Derive natural orbitals from a given density matrix.
- Parameters:
dm (
ndarray
) – The density matrix. shape=(nbasis, nbasis)overlap (
ndarray
) – The overlap matrix shape=(nbasis, nbasis)
- Return type:
Tuple
[ndarray
,ndarray
]- Returns:
coeffs – Orbital coefficients shape=(nbasis, nfn)
occs – Orbital occupations shape=(nfn, )
- set_four_index_element(four_index_object, i, j, k, l, value)[source]¶
Assign values to a four index object, account for 8-fold index symmetry.
This function assumes physicists’ notation.
- Parameters:
four_index_object (
ndarray
) – The four-index object. It will be written to. shape=(nbasis, nbasis, nbasis, nbasis), dtype=floati (
int
) – The indices to assign to.j (
int
) – The indices to assign to.k (
int
) – The indices to assign to.l (
int
) – The indices to assign to.value (
float
) – The value of the matrix element to store.
- volume(cellvecs)[source]¶
Calculate the (generalized) cell volume.
- Parameters:
cellvecs (
ndarray
) – A numpy matrix of shape (x,3) where x is in {1,2,3}. Each row is one cellvector.- Returns:
In case of 3D, the cell volume. In case of 2D, the cell area. In case of 1D, the cell length.
- Return type:
volume