We're celebrating World Quantum Day 2022! Join us

fqe.fqe_data.FqeData

This is a basic data structure for use in the FQE.

nalpha (int) - the number of alpha electrons nbeta (int) - the number of beta electrons norb (int) - the number of spatial orbitals fcigraph (optional, ...)

Methods

alpha_map

View source

Access the mapping for a singlet excitation from the current sector for alpha orbitals

apply

View source

API for application of dense operators (1- through 4-body operators) to the wavefunction self.

apply_cos_sin

View source

Utility internal function that performs part of the operations in evolve_inplace_individual_nbody_nontrivial. Isolated because it is also used in the counterpart in FqeDataSet.

apply_diagonal_inplace

View source

Iterate over each element and perform apply operation in place

apply_individual_nbody

View source

Apply function with an individual operator represented in arrays. It is assumed that the operator is spin conserving

apply_inplace

View source

API for application of dense operators (1- through 4-body operators) to the wavefunction self.

apply_inplace_s2

View source

Apply the S squared operator to self.

ax_plus_y

View source

Scale and add the data in the fqedata structure

= sval*coeff + other

beta_inversion

View source

Return the coefficients with an inversion of the beta strings.

beta_map

View source

Access the mapping for a singlet excitation from the current sector for beta orbitals

calculate_coeff_spin_with_dvec

View source

Generate

.. math::

C_I = \sum_J \langle I|a^\dagger_i a_j|J\rangle D^J_{ij}

calculate_dvec_spatial

View source

Generate

.. math:: D^J_{ij} = \sum_I \langle J|a^\dagger_i a_j|I\rangle C_I

using self.coeff as an input

calculate_dvec_spatial_compressed

View source

Generate

.. math::

D^J_{i<j} = \sum_I \langle J|a^\dagger_i a_j|I\rangle C_I

calculate_dvec_spatial_fixed_j

View source

Generate, for a fixed j,

.. math:: D^J_{ij} = \sum_I \langle J|a^\dagger_i a_j|I\rangle C_I

using self.coeff as an input

calculate_dvec_spin

View source

Generate a pair of

.. math:: D^J_{ij} = \sum_I \langle J|a^\dagger_i a_j|I\rangle C_I

using self.coeff as an input. Alpha and beta are seperately packed in the tuple to be returned

calculate_dvec_spin_fixed_j

View source

Generate a pair of the following, for a fixed j

.. math:: D^J_{ij} = \sum_I \langle J|a^\dagger_i a_j|I\rangle C_I

using self.coeff as an input. Alpha and beta are seperately packed in the tuple to be returned

conj

View source

Conjugate the coefficients

diagonal_coulomb

View source

Iterate over each element and return the scaled wavefunction.

evolve_diagonal

View source

Iterate over each element and return the exponential scaled contribution.

evolve_inplace_individual_nbody_nontrivial

View source

This code time-evolves a wave function with an individual n-body generator which is spin-conserving. It is assumed that hat{T}^2 = 0. Using :math:TT = 0 and :math:TT^\dagger is diagonal in the determinant space, one could evaluate as

.. math:: \exp(-i(T+T^\dagger)t) &= 1 + i(T+T^\dagger)t - \frac{1}{2}(TT^\dagger + T^\dagger T)t^2

     - i\frac{1}{6}(TT^\dagger T + T^\dagger TT^\dagger)t^3 + \cdots \\
    &= -1 + \cos(t\sqrt{TT^\dagger}) + \cos(t\sqrt{T^\dagger T})
     - iT\frac{\sin(t\sqrt{T^\dagger T})}{\sqrt{T^\dagger T} }
     - iT^\dagger\frac{\sin(t\sqrt{TT^\dagger})}{\sqrt{TT^\dagger} }

evolve_inplace_individual_nbody_trivial

View source

This is the time evolution code for the cases where individual nbody becomes number operators (hence hat{T}^2 is nonzero) coeff includes parity due to sorting. opa and opb are integer arrays

fill

View source

Fills the wavefunction with the value specified

generator

View source

Iterate over the elements of the sector as alpha string, beta string coefficient

get_aa_tpdm

View source

Get the alpha-alpha block of the 2-RDM

tensor[i, j, k, l] =

get_ab_tpdm

View source

Get the alpha-beta block of the 2-RDM

tensor[i, j, k, l] =

get_bb_tpdm

View source

Get the beta-beta block of the 2-RDM

tensor[i, j, k, l] =

get_fcigraph

View source

Returns the underlying FciGraph object

get_openfermion_rdms

View source

Generate spin-rdms and return in openfermion format

get_spin_opdm

View source

estimate the alpha-alpha and beta-beta block of the 1-RDM

get_three_pdm

View source

get_three_spin_blocks_rdm

View source

Generate 3-RDM in the spin-orbital basis.

3-RDM has Sz spin-blocks (aaa, aab, abb, bbb). The strategy is to use this blocking to generate the minimal number of p^ q r^ s t^ u blocks and then generate the other components of the 3-RDM through symmeterization. For example,

p^ r^ t^ q s u = -p^ q r^ s t^ u - d(q, r) p^ t^ s u + d(q, t)p^ r^ s u

            - d(s, t)p^ r^ q u + d(q,r)d(s,t)p^ u

It is formulated in this way so we can use the dvec calculation.

Given:

~D(p, j, Ia, Ib)(t, u) = \sum{Ka, Kb}\sum{LaLb}C(La,Lb)

then: p^ q r^ s t^ u = \sum_{Ia, Ib}D(p, q, Ia, Ib).conj(), ~D(p, j, Ia, Ib)(t, u)

Example:

p, q, r, s, t, u = 5, 5, 0, 4, 5, 1

.. code-block:: python

tdveca, tdvecb = fqe_data._calculate_dvec_spin_with_coeff(dveca[5, 1, :, :])
test_ccc = np.einsum('liab,ab->il', dveca.conj(), tdveca[0, 4, :, :])[5, 5]

lena

View source

Length of the alpha configuration space

lenb

View source

Length of the beta configuration space

n_electrons

View source

Particle number getter

nalpha

View source

Number of alpha electrons

nbeta

View source

Number of beta electrons

norb

View source

Number of beta electrons

norm

View source

Return the norm of the the sector wavefunction

View source

Iterate over the strings and coefficients and print then using the print format

rdm1

View source

API for calculating 1-particle RDMs given a wave function. When bradata is given, it calculates transition RDMs. Depending on the filling, the code selects an optimal algorithm.

rdm12

View source

API for calculating 1- and 2-particle RDMs given a wave function. When bradata is given, it calculates transition RDMs. Depending on the filling, the code selects an optimal algorithm.

rdm123

View source

Calculates 1- through 3-particle RDMs given a wave function. When bradata is given, it calculates transition RDMs.

rdm1234

View source

Calculates 1- through 4-particle RDMs given a wave function. When bradata is given, it calculates transition RDMs.

scale

View source

Scale the wavefunction by the value sval

Args
sval (complex) - value to scale by

Returns
nothing - Modifies the wavefunction in place

set_wfn

View source

Set the values of the fqedata wavefunction based on a strategy

Args
strategy (string) - the procedure to follow to set the coeffs

raw_data (numpy.array(dim(self.lena(), self.lenb()), dtype=numpy.complex128)) - the values to use if setting from data. If vrange is supplied, the first column in data will correspond to the first index in vrange

Returns
nothing - modifies the wavefunction in place

__getitem__

View source

Get an item from the fqe data structure by using the knowles-handy pointers.