fqe.wavefunction.Wavefunction

Wavefunction is the central object for manipulaion in the

OpenFermion-FQE.

Methods

apply

View source

Returns a wavefunction subject to application of the Hamiltonian (or more generally, the operator).

Args
hamil (Hamiltonian) - Hamiltonian to be applied

Returns
(Wavefunction) - resulting wave function

apply_generated_unitary

View source

Perform the exponentiation of fermionic algebras to the wavefunction according the method and accuracy.

Args
time (float) - the final time value to evolve to

algo (string) - polynomial expansion algorithm to be used

hamil (Hamiltonian) - the Hamiltonian used to generate the unitary

accuracy (double) - the accuracy to which the system should be evolved

expansion (int) - the maximum number of terms in the polynomial expansion

spec_lim (List[float]) - spectral range of the Hamiltonian, the length of the list should be 2. Optional.

Returns
newwfn (Wavefunction) - a new intialized wavefunction object

ax_plus_y

View source

Perform scale and add of the wavefunction. The result will be stored in self.

Args
sval (complex) - a factor to be multiplied to wfn

wfn (Wavefunction) - a wavefunction to be added to self

conserve_number

View source

Returns if this wave function conserves the number symmetry

conserve_spin

View source

Returns if this wave function conserves the spin (Sz) symmetry

expectationValue

View source

Calculates expectation values given operators

Args
ops (FqeOperator or Hamiltonian) - operator for which the expectation value is computed

brawfn (Wavefunction) - bra-side wave function for transition quantity (optional)

Returns
(complex or numpy.ndarray) - resulting expectation value or RDM

get_coeff

View source

Retrieve a vector from a configuration in the wavefunction

key indicates wavefunction sector by [num_alpha, num_beta]

Args
key (int, int) - a key identifying the configuration to access

vec (int) - an integer indicating which state should be returned

Returns
numpy.array(dtype=numpy.complex128)

max_element

View source

Return the largest magnitude value in the wavefunction

norb

View source

Return the number of orbitals

norm

View source

Calculate the norm of the wavefuntion

normalize

View source

Generte the wavefunction norm and then scale each element by that value.

View source

Print occupations and coefficients to the screen.

Args
threshhold (float) - only print CI vector values such that :math:|c| > threshold.

fmt (string) - formats print according to argument

states (int of list[int]) - an index or indexes indicating which states to print.

rdm

View source

Returns rank-1 RDM. The operator order is specified by string. Note that, if the entire RDM is requested for N-broken wave function, this returns a packed format.

Args
string (str) - character strings that specify the quantity to be computed

brawfn (Wavefunction) - bra-side wave function for transition RDM (optional)

Returns
Resulting RDM in numpy.ndarray or element in complex

read

View source

Initialize a wavefunction from a binary file.

Args
filename (str) - the name of the file to write the wavefunction to.

path (str) - the path to save the file. If no path is given then it is saved in the current working directory.

save

View source

Save the wavefunction into path/filename.

Args
filename (str) - the name of the file to write the wavefunction to.

path (str) - the path to save the file. If no path is given, then it is saved in the current working directory.

scale

View source

Scale each configuration space by the value sval

Args
sval (complex) - value to scale by

sector

View source

Return a list of the configuration keys in the wavefunction

sectors

View source

Return a list of the configuration keys in the wavefunction

set_wfn

View source

Set the values of the ciwfn based on an argument or data to initalize from.

Args
strategy (string) - an option controlling how the values are set

raw_data (numpy.array(dtype=numpy.complex128)) - data to inject into the configuration

time_evolve

View source

Perform time evolution of the wavefunction given Fermion Operators either as raw operations or wrapped up in a Hamiltonian.

Args
ops (FermionOperators) - FermionOperators which are to be time evolved.

time (float) - the duration by which to evolve the operators

Returns
Wavefunction - a wavefunction object that has been time evolved.

transform

View source

Transform the wavefunction using the orbtial rotation matrix and return the new wavefunction and the permutation matrix for the unitary transformation. This is an internal code, so performs minimal checking

Args
rotation (numpy.ndarray) - MO rotation matrix, which is unitary

low (numpy.ndarray) - L in the LU decomposition (optional)

upp (numpy.ndarray) - U in the LU decomposition (optional)

Returns
(numpy.ndarray, numpy.ndarray, numpy.ndarray, 'Wavefunction') - permutation, L, U, and transformed wavefunction

__add__

View source

Intrinsic addition function to combine two wavefunctions. This acts to iterate through the wavefunctions, combine coefficients of configurations they have in common and add configurations that are unique to each one. The values are all combined into a new wavefunction object

Args
other (wavefunction.Wavefunction) - the second wavefunction to add with the local wavefunction

Returns
wfn (wavefunction.Wavefunction) - a new wavefunction with the values set by adding together values

__getitem__

View source

Element read access to the wave function.

Args
key (Tuple[int, int]) - a pair of strings for alpha and beta

Returns
(complex) - the value of the wave function

__sub__

View source

Intrinsic subtraction function to combine two wavefunctions. This acts to iterate through the wavefunctions, combine coefficients of configurations they have in common and include configurations that are unique to each one. The values are all combined into a new wavefunction object

Args
other (wavefunction.Wavefunction) - the second wavefunction that will be subtracted from the first wavefunction

Returns
wfn (wavefunction.Wavefunction) - a new wavefunction with the values set by subtracting the wfn from the first