Wavefun

Wavefun is a class that defines single-particle wavefunctions associated with valence electron pairs in a molecule.

Class Function List

class Wavefun
Wavefun()

Constructor that returns an empty Wavefun object.

Wavefun(n1, n2, n3)

Constructor that returns a zero wave function of size n1 by n2 by n3 in real space

Wavefun(n1, n2, n3, ncols)

Constructor that returns ncols zero wave functions, each of size n1 by n2 by n3 in real space

Wavefun(psi)

Constructor that returns a Wavefun object that with planewave coefficients specified by the cell array psi.

Wavefun(psi, n1, n2, n3)

Constructor that returns a Wavefun object that with planewave coefficients specified by the cell array psi, and of size n1 by n2 by n3 in reals space.

abs, fft3, ifft3, qr, svd, conj

These functions are overloaded, and can be applied directly to a Wavefun object. They typically returns another Wavefun object, or an Wavefun object as well as other matrices.

We can also add and subtract two Wavefun objects X and Y by simply writing X+Y or X-Y. We can transpose X by using X.' and conjugate transpose by using X'. The inner product of X and Y can be simply written as X'*Y. The Hadamard product of X and Y can be written as X*.Y. The pointwise power of each element of X can be written as X.^p, where p is an integer or floating point number.

A subset of wavefunctions in X can be extracted by using MATLAB’s subreference notation X(:,i:j), where i <= j are indices that are less than or equal to the number of wavefunctions in X.

Wavefun objects can also be concatnated if their dimensions match, e.g., Z = [X Y].

Class Attribute List

n1

An integer that specifies the number of real space grid points in the x direction.

n2

An integer that specifies the number of real space grid points in the y direction.

n3

An integer that specifies the number of real space grid points in the z direction.

nrows

An integer that specifies the number of planewave coefficients for each of the wavefunctions.

ncols

An integer that specifies the number of wavefunctions contained in the object.

idxnz

An array of integers that gives the indices of the nonzero planewave coefficients (stored in psi) for each of the wavefunctions when it is reshaped from a 3D array to a 1D vector.

iscompact

An integer that indicates whether only the nonzero planewave coefficients for each wavefunction are stored (in a compact format). It should be set to 1 if a compact is used, and 0 otherwise.

trans

An integer that indicates whether the wavefunction itself (0) or the transpose of it is stored (1).

occ

An integer array that gives the occupation number for each of the stored wavefunction.