Learn more about our quantum error correction milestone

FQE vs OpenFermion vs Cirq: Diagonal Coulomb Operators

View on QuantumAI Run in Google Colab View source on GitHub Download notebook

Special routines are available for evolving under a diagonal Coulomb operator. This notebook describes how to use these built in routines and how they work.

try:
    import fqe
except ImportError:
    !pip install fqe --quiet
from itertools import product
import fqe
from fqe.hamiltonians.diagonal_coulomb import DiagonalCoulomb

import numpy as np

import openfermion as of

from scipy.linalg import expm
#Utility function
def uncompress_tei(tei_mat, notation='chemistry'):
    """
    uncompress chemist notation integrals

    tei_tensor[i, k, j, l] = tei_mat[(i, j), (k, l)]
    [1, 1, 2, 2] = [1, 1, 2, 2] = [1, 1, 2, 2]  = [1, 1, 2, 2]
    [i, j, k, l] = [k, l, i, j] = [j, i, l, k]* = [l, k, j, i]*

    For real we also have swap of i <> j and k <> l
    [j, i, k, l] = [l, k, i, j] = [i, j, l, k] = [k, l, j, i]

    tei_mat[(i, j), (k, l)] = int dr1 int dr2 phi_i(dr1) phi_j(dr1) O(r12) phi_k(dr1) phi_l(dr1)

    Physics notation is the notation that is used in FQE.

    Args:
        tei_mat: compressed two electron integral matrix

    Returns:
        uncompressed 4-electron integral tensor. No antisymmetry.
    """
    if notation not in ['chemistry', 'physics']:
        return ValueError("notation can be [chemistry, physics]")

    norbs = int(0.5 * (np.sqrt(8 * tei_mat.shape[0] + 1) - 1))
    basis = {}
    cnt = 0
    for i, j in product(range(norbs), repeat=2):
        if i >= j:
            basis[(i, j)] = cnt
            cnt += 1

    tei_tensor = np.zeros((norbs, norbs, norbs, norbs))
    for i, j, k, l in product(range(norbs), repeat=4):
        if i >= j and k >= l:
            tei_tensor[i, j, k, l] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[k, l, i, j] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[j, i, l, k] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[l, k, j, i] = tei_mat[basis[(i, j)], basis[(k, l)]]

            tei_tensor[j, i, k, l] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[l, k, i, j] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[i, j, l, k] = tei_mat[basis[(i, j)], basis[(k, l)]]
            tei_tensor[k, l, j, i] = tei_mat[basis[(i, j)], basis[(k, l)]]

    if notation == 'chemistry':
        return tei_tensor
    elif notation == 'physics':
        return np.asarray(tei_tensor.transpose(0, 2, 1, 3), order='C')

    return tei_tensor

The first example we will perform is diagonal Coulomb evolution on the Hartree-Fock state. The diagonal Coulomb operator is defined as

\begin{align} V = \sum{\alpha, \beta \in {\uparrow, \downarrow} }\sum{p,q} V{pq,pq}n{p,\alpha}n_{q,\beta} \end{align}

The number of free parpameters are \(\mathcal{O}(N^{2})\) where \(N\) is the rank of the spatial basis. The DiagonalCoulomb Hamiltonian takes either a generic 4-index tensor or the \(N \times N\) matrix defining \(V\). If the 4-index tensor is given the \(N \times N\) matrix is constructed along with the diagonal correction. If the goal is to just evolve under \(V\) it is recommended the user input the \(N \times N\) matrix directly.

All the terms in \(V\) commute and thus we can evolve under \(V\) exactly by counting the accumulated phase on each bitstring.

To start out let's define a Hartree-Fock wavefunction for 4-orbitals and 2-electrons \(S_{z} =0\).

norbs = 4
tedim = norbs * (norbs + 1) // 2
if (norbs // 2) % 2 == 0:
    n_elec = norbs // 2
else:
    n_elec = (norbs // 2) + 1
sz = 0
fqe_wfn = fqe.Wavefunction([[n_elec, sz, norbs]])
fci_data = fqe_wfn.sector((n_elec, sz))
fci_graph = fci_data.get_fcigraph()
hf_wf = np.zeros((fci_data.lena(), fci_data.lenb()), dtype=np.complex128)
hf_wf[0, 0] = 1  # right most bit is zero orbital.
fqe_wfn.set_wfn(strategy='from_data',
                raw_data={(n_elec, sz): hf_wf})
fqe_wfn.print_wfn()
Sector N = 2 : S_z = 0
a'0001'b'0001' (1+0j)

Now we can define a random 2-electron operator \(V\). To define \(V\) we need a \(4 \times 4\) matrix. We will generate this matrix by making a full random two-electron integral matrix and then just take the diagonal elements

tei_compressed = np.random.randn(tedim**2).reshape((tedim, tedim))
tei_compressed = 0.5 * (tei_compressed + tei_compressed.T)
tei_tensor = uncompress_tei(tei_compressed, notation='physics')

diagonal_coulomb = of.FermionOperator()
diagonal_coulomb_mat = np.zeros((norbs, norbs))
for i, j in product(range(norbs), repeat=2):
    diagonal_coulomb_mat[i, j] = tei_tensor[i, j, i, j]
    for sigma, tau in product(range(2), repeat=2):
        diagonal_coulomb += of.FermionOperator(
            ((2 * i + sigma, 1), (2 * i + sigma, 0), (2 * j + tau, 1),
             (2 * j + tau, 0)), coefficient=diagonal_coulomb_mat[i, j])

dc_ham = DiagonalCoulomb(diagonal_coulomb_mat)

Evolution under \(V\) can be computed by looking at each bitstring, seeing if \(n_{p\alpha}n_{q\beta}\) is non-zero and then phasing that string by \(V_{pq}\). For the Hartree-Fock state we can easily calculate this phase accumulation. The alpha and beta bitstrings are "0001" and "0001".

alpha_occs = [list(range(fci_graph.nalpha()))]
beta_occs = [list(range(fci_graph.nbeta()))]
occs = alpha_occs[0] + beta_occs[0]
diag_ele = 0.
for ind in occs:
    for jnd in occs:
        diag_ele += diagonal_coulomb_mat[ind, jnd]
evolved_phase = np.exp(-1j * diag_ele)
print(evolved_phase)

# evolve FQE wavefunction
evolved_hf_wfn = fqe_wfn.time_evolve(1, dc_ham)

# check they the accumulated phase is equivalent!
assert np.isclose(evolved_hf_wfn.get_coeff((n_elec, sz))[0, 0], evolved_phase)
(0.9327182556781989+0.3606059560304267j)

We can now try this out for more than 2 electrons. Let's reinitialize a wavefunction on 6-orbitals with 4-electrons \(S_{z} = 0\) to a random state.

norbs = 6
tedim = norbs * (norbs + 1) // 2
if (norbs // 2) % 2 == 0:
    n_elec = norbs // 2
else:
    n_elec = (norbs // 2) + 1
sz = 0
fqe_wfn = fqe.Wavefunction([[n_elec, sz, norbs]])
fqe_wfn.set_wfn(strategy='random')
inital_coeffs = fqe_wfn.get_coeff((n_elec, sz)).copy()
print("Random initial wavefunction")
fqe_wfn.print_wfn()
Random initial wavefunction
Sector N = 4 : S_z = 0
a'000011'b'000011' (0.010793225780667489+0.032019433629848625j)
a'000011'b'000101' (-0.006361415508615077-0.014596981086115617j)
a'000011'b'001001' (0.024350635334629698+0.04599611367061183j)
a'000011'b'010001' (0.05468715115600692-0.11755542174192879j)
a'000011'b'100001' (0.03819577179509838-0.053928227981542724j)
a'000011'b'000110' (0.07120767208642843-0.045054657893665286j)
a'000011'b'001010' (-0.03942207729505471-0.03827384679304037j)
a'000011'b'010010' (-0.1162273050513434-0.039204303124916164j)
a'000011'b'100010' (-0.01099658716126745-0.03573455817332818j)
a'000011'b'001100' (-0.03316887386102844-0.009150102766792453j)
a'000011'b'010100' (0.012744409404000005-0.05575285416448128j)
a'000011'b'100100' (0.01018018777278294-0.031631229885064095j)
a'000011'b'011000' (-0.014486634714981454+0.03817176712098652j)
a'000011'b'101000' (0.02477894118457207+0.04745368462254813j)
a'000011'b'110000' (-0.048297119522903255-0.01341076761444312j)
a'000101'b'000011' (0.011356767998181815-0.03969059262466654j)
a'000101'b'000101' (0.012524711544841888+0.03826962121367017j)
a'000101'b'001001' (0.03329156276683918+0.031913445031879754j)
a'000101'b'010001' (0.0317077107193562+0.02340892660603146j)
a'000101'b'100001' (0.06416346261635271+0.037968612635073104j)
a'000101'b'000110' (-0.05454814021708799+0.015723640767059833j)
a'000101'b'001010' (0.031110225428980908-0.015881892242060897j)
a'000101'b'010010' (-0.01897978740535046-0.03685833428569572j)
a'000101'b'100010' (-0.08400835554659347+0.028838271018769894j)
a'000101'b'001100' (0.032530526136668805+0.04342737905783069j)
a'000101'b'010100' (-0.02781238443249023+0.0016750643760382153j)
a'000101'b'100100' (0.01573082511050637-0.010210097111942073j)
a'000101'b'011000' (-0.04688351430173426-0.0054318523038126496j)
a'000101'b'101000' (-0.034253785977639506+0.04271776032530612j)
a'000101'b'110000' (-0.032319760007957346-0.03005426085174193j)
a'001001'b'000011' (-0.020745915014055243-0.04692086272014932j)
a'001001'b'000101' (0.057440472630304225-0.04431616637279267j)
a'001001'b'001001' (-0.0730583045725845+0.02435544040675446j)
a'001001'b'010001' (-0.017822004865652778-0.08777088193513119j)
a'001001'b'100001' (0.029657665654354695-0.02233430230854885j)
a'001001'b'000110' (0.012396818180060692-0.009238045967804474j)
a'001001'b'001010' (0.017970781387834086+0.00886089570895293j)
a'001001'b'010010' (-0.01866065552982913-0.05304558820791882j)
a'001001'b'100010' (0.029030597731719385+0.03778907070212844j)
a'001001'b'001100' (0.10118805051000253-0.025034768235419586j)
a'001001'b'010100' (-0.008707697925660765-0.04387098496072111j)
a'001001'b'100100' (0.08637444744276937-0.04099796980492965j)
a'001001'b'011000' (0.035728680893231966-0.05285925667886906j)
a'001001'b'101000' (-0.04881868165801078-0.03746221686281765j)
a'001001'b'110000' (-0.0208395586211118+0.01804860021699191j)
a'010001'b'000011' (0.009578202215584817-0.07457277734161986j)
a'010001'b'000101' (0.057775012505224786+0.03263120606187376j)
a'010001'b'001001' (-0.10458170478996731+0.09399653292770638j)
a'010001'b'010001' (0.021267039266367017-0.007466746690648189j)
a'010001'b'100001' (-0.050812892004380994-0.01879354002528289j)
a'010001'b'000110' (0.022607917369990196+0.06403158762720325j)
a'010001'b'001010' (0.07204333030079807-0.03782113151278126j)
a'010001'b'010010' (0.07243413803358571-0.002352495203752554j)
a'010001'b'100010' (0.01640720391756304-0.07924114179847815j)
a'010001'b'001100' (0.008164998192489904+0.002645548321965311j)
a'010001'b'010100' (0.0858409662750047+0.08517573888221941j)
a'010001'b'100100' (0.05537939733996344+0.05146251875885491j)
a'010001'b'011000' (0.017442599027395016+0.049369314388073945j)
a'010001'b'101000' (0.023210607408700838+0.07106428841061019j)
a'010001'b'110000' (0.010768939793437227-0.008621714133875483j)
a'100001'b'000011' (-0.015438579322284271-0.057132078418939775j)
a'100001'b'000101' (0.00949619451414964+0.02603236632465475j)
a'100001'b'001001' (0.05794625182759069-0.005333456759088146j)
a'100001'b'010001' (-0.005712185449588656-0.03629016644609624j)
a'100001'b'100001' (-0.0804412722746606-0.021722342917155038j)
a'100001'b'000110' (0.005811463602395642-0.026041158337965043j)
a'100001'b'001010' (-0.06371121715721993-0.061264277200134956j)
a'100001'b'010010' (-0.10008954994704697-0.033551373496281206j)
a'100001'b'100010' (-0.0031240842094261913+0.12030778495704027j)
a'100001'b'001100' (-0.04465297134718767-0.0010979230466260641j)
a'100001'b'010100' (0.036086436925234645+0.05778224231711688j)
a'100001'b'100100' (0.016695353520089395-0.0011527428895570678j)
a'100001'b'011000' (0.010138024785374043+0.009604964407364077j)
a'100001'b'101000' (0.020987412534628595-0.009251287942700786j)
a'100001'b'110000' (0.056785643842598696-0.012869982416890233j)
a'000110'b'000011' (-0.02671657843864906+0.11167755179551274j)
a'000110'b'000101' (0.0024629803791852804+0.014163543450088788j)
a'000110'b'001001' (0.06002372203848594-0.07481105381142529j)
a'000110'b'010001' (-0.08385212811795248-0.04672466998955815j)
a'000110'b'100001' (-0.011727456065955771+0.06153157598428309j)
a'000110'b'000110' (-0.028282881639867946+0.10007591473093815j)
a'000110'b'001010' (-0.05869824262875921+0.013836377421180598j)
a'000110'b'010010' (-0.04559516622346149+0.025273045160830423j)
a'000110'b'100010' (0.04979148908403643+0.05414214970928062j)
a'000110'b'001100' (0.0068793376244847375-0.09031730352804303j)
a'000110'b'010100' (-0.009745524736072472+0.003372620826820161j)
a'000110'b'100100' (-0.012650808309803538+0.01025888266659859j)
a'000110'b'011000' (-0.07032830329582833-0.03750931672604967j)
a'000110'b'101000' (-0.03745806932142707-0.00015771017145576927j)
a'000110'b'110000' (0.02498923869635719+0.12284261896110558j)
a'001010'b'000011' (-0.10548372096692764-0.06160841104025576j)
a'001010'b'000101' (-0.005021634195898057+0.11145029201002128j)
a'001010'b'001001' (-0.036377515994667535-0.01444044788355455j)
a'001010'b'010001' (0.06618033274500298-0.08283812883185597j)
a'001010'b'100001' (0.04151453266069107+0.045454851620691586j)
a'001010'b'000110' (-0.021201499590361588+0.034318903776183955j)
a'001010'b'001010' (-0.0007415598669861614+0.013486662007660064j)
a'001010'b'010010' (0.04773510304202133+0.021807141572587594j)
a'001010'b'100010' (-0.06961150805080428-0.0025726412690827848j)
a'001010'b'001100' (0.055160364237691786-0.025123132873672346j)
a'001010'b'010100' (-0.052709895713057925+0.017585402091937225j)
a'001010'b'100100' (0.07056668344178006+0.014373624654570639j)
a'001010'b'011000' (0.011923965132505848-0.005290760579208874j)
a'001010'b'101000' (0.038374112268463906+0.014981405833699071j)
a'001010'b'110000' (0.046352345279562154-0.037722492898623255j)
a'010010'b'000011' (-0.029104435760413022+0.11471015464755993j)
a'010010'b'000101' (0.009216615286113363+0.051031853678164055j)
a'010010'b'001001' (0.006268009781402644+0.01456094991952855j)
a'010010'b'010001' (-0.02708325033835118+0.06729087294936524j)
a'010010'b'100001' (0.023418859079476877+0.014078842534087966j)
a'010010'b'000110' (-0.0037704466196300437-0.07086070706489915j)
a'010010'b'001010' (0.023166597150100627-0.03702466417702622j)
a'010010'b'010010' (0.02720682935698571+0.04383862850479087j)
a'010010'b'100010' (-0.006819553801388122+0.11348293635147744j)
a'010010'b'001100' (-0.06851171280169602-0.04783065829547817j)
a'010010'b'010100' (0.0035387705702460684+0.030795978681561847j)
a'010010'b'100100' (0.01799584002279927-0.05457905946806566j)
a'010010'b'011000' (-0.09754546605494246+0.061372548424862235j)
a'010010'b'101000' (-0.019750933886692617-0.0896292182656407j)
a'010010'b'110000' (-0.05392244201124269-0.04197152524817283j)
a'100010'b'000011' (-0.011383867123194544+0.03396468187877185j)
a'100010'b'000101' (0.004012882670734914+0.113849033955126j)
a'100010'b'001001' (-0.02405573858289612+0.03338637465520266j)
a'100010'b'010001' (0.0828844875802064+0.008426239005052981j)
a'100010'b'100001' (-0.04251942443984154-0.05618264699291224j)
a'100010'b'000110' (-0.0560797429210736-0.01449107565659723j)
a'100010'b'001010' (0.0037868112033747946-0.07875770894261959j)
a'100010'b'010010' (0.011884613003439667-0.03441123950565067j)
a'100010'b'100010' (0.09830388877900367+0.01430520543808199j)
a'100010'b'001100' (-0.06690709112232299+0.06926104556108963j)
a'100010'b'010100' (-0.05067517766896307+0.06986028629818793j)
a'100010'b'100100' (0.0035860834037043233-0.04202046799239218j)
a'100010'b'011000' (0.04204951035435904-0.00413336571495318j)
a'100010'b'101000' (-0.02679765883756308+0.08787872782772699j)
a'100010'b'110000' (0.043524412521607436-0.009565148161141429j)
a'001100'b'000011' (0.0039011057989536474-0.02890437671618724j)
a'001100'b'000101' (-0.04488128092372077+0.0030147410801343727j)
a'001100'b'001001' (0.03847254853175033+0.006166655021344993j)
a'001100'b'010001' (-0.05618176816321716-0.02928554105659367j)
a'001100'b'100001' (-0.05323398613227708+0.03999598802539204j)
a'001100'b'000110' (-0.01913559591865252-0.10496211401210102j)
a'001100'b'001010' (0.01960874292367164+0.015036909642622373j)
a'001100'b'010010' (0.005942611446317671+0.05788778323389127j)
a'001100'b'100010' (-0.04098447545225655+0.0021649174851938193j)
a'001100'b'001100' (-0.015955381967321682+0.001270928562913352j)
a'001100'b'010100' (0.0408092311068789+0.04725421484090949j)
a'001100'b'100100' (-0.10059491261913187+0.007385195810218046j)
a'001100'b'011000' (-0.06850329961812966+0.011309277562042823j)
a'001100'b'101000' (-0.05828695486501263+0.03162495002713818j)
a'001100'b'110000' (0.027928554880212886+0.020092650138182254j)
a'010100'b'000011' (-0.04520032412150907+0.04731825398655161j)
a'010100'b'000101' (0.013789737464923187+0.00127455574651124j)
a'010100'b'001001' (-0.012723563514076533-0.07579103889710169j)
a'010100'b'010001' (-0.016835373492867463-0.010801888630835574j)
a'010100'b'100001' (-0.042215639194735054-0.01669476052196695j)
a'010100'b'000110' (0.09458056613316973-0.051239902480215344j)
a'010100'b'001010' (-0.07386172398500208-0.1022395602261389j)
a'010100'b'010010' (0.026519308557056327-0.0092149303180684j)
a'010100'b'100010' (-0.005884751421902839+0.03652411927493717j)
a'010100'b'001100' (0.017777831771622073+0.017630387411604272j)
a'010100'b'010100' (0.011850860502150338+0.030743912039748925j)
a'010100'b'100100' (-0.06250199414692205+0.05331309618398853j)
a'010100'b'011000' (0.006561177093002419+0.01975847126288553j)
a'010100'b'101000' (0.009461155811307333-0.06525784687891514j)
a'010100'b'110000' (0.054838077100774325+0.014713236036276073j)
a'100100'b'000011' (0.02378045679487017-0.08026608575305834j)
a'100100'b'000101' (-0.014601806438831267+0.017947502921563985j)
a'100100'b'001001' (-0.00560196365537063+0.07213394051540807j)
a'100100'b'010001' (-0.06735116530160438-0.05440551382625226j)
a'100100'b'100001' (0.01897152804877961+0.010749885011327122j)
a'100100'b'000110' (-0.04521045694918691+0.02210084033272396j)
a'100100'b'001010' (-0.06712021204280375-0.09907293938283447j)
a'100100'b'010010' (-0.027543318796173003+0.12122839053392521j)
a'100100'b'100010' (0.05059729335628954-0.05799343256277944j)
a'100100'b'001100' (0.02051118568986492-0.03925776671707063j)
a'100100'b'010100' (-0.010892249018915494-0.01246660081507172j)
a'100100'b'100100' (0.009076837565270009+0.05911544573144777j)
a'100100'b'011000' (-0.014411711919904932-0.061252185475752056j)
a'100100'b'101000' (0.0008743927737775225-0.07623676019160687j)
a'100100'b'110000' (0.03551466057473928+0.0490469743535828j)
a'011000'b'000011' (0.020549117062039428-0.009780996328999949j)
a'011000'b'000101' (0.008446520278972993-0.03475063411104269j)
a'011000'b'001001' (-0.05642938567406569+0.027793107261416133j)
a'011000'b'010001' (0.021556369402148688-0.026476147756514135j)
a'011000'b'100001' (0.040604366029429274-0.04403576804437087j)
a'011000'b'000110' (0.06143145737723956-0.0060913121913594845j)
a'011000'b'001010' (-0.07054711536849555+0.023634746851279673j)
a'011000'b'010010' (-0.0117265780936922+0.06371442725149629j)
a'011000'b'100010' (-0.0024455168921925794+0.015111278001110446j)
a'011000'b'001100' (0.021254955294300396-0.011980204539349483j)
a'011000'b'010100' (0.05142031227094283-0.09422850354655404j)
a'011000'b'100100' (-0.04957588462458641+0.026918688839738105j)
a'011000'b'011000' (0.05153359420276647+0.025071297619919577j)
a'011000'b'101000' (-0.01045113919652118+0.03522616995425843j)
a'011000'b'110000' (0.05339461621433737-0.11304315100572962j)
a'101000'b'000011' (0.029145827140539007+0.02837650917603729j)
a'101000'b'000101' (-0.022968196070963592-0.042365824772852806j)
a'101000'b'001001' (-0.006976730916465183+0.026553878733813364j)
a'101000'b'010001' (0.061680755725609535+0.02671985394505079j)
a'101000'b'100001' (0.037256228556421384-0.06538788691862288j)
a'101000'b'000110' (0.06774883427065674+0.038010189324928216j)
a'101000'b'001010' (-0.0305355779990353+0.028835933761177497j)
a'101000'b'010010' (-0.03183557817706154+0.02159083123998545j)
a'101000'b'100010' (-0.026800045881634958-0.061954217130185146j)
a'101000'b'001100' (-0.02190799923522981-0.00914919122182115j)
a'101000'b'010100' (-0.06868451606537296+0.0536888834249631j)
a'101000'b'100100' (-0.007704934804811461-0.11151311425380553j)
a'101000'b'011000' (-0.030356475860717037+0.04077758669700633j)
a'101000'b'101000' (-0.004756859748345244-0.018435508546326775j)
a'101000'b'110000' (0.016217890448344548-0.03983032748602594j)
a'110000'b'000011' (0.055745153965752324+0.1054744671342652j)
a'110000'b'000101' (-0.036076640100522264-0.04985979015423401j)
a'110000'b'001001' (-0.03444153366767931+0.006495446113412319j)
a'110000'b'010001' (0.009043356940090203-0.016139606914447525j)
a'110000'b'100001' (0.06838893982486181+0.02973183634640685j)
a'110000'b'000110' (0.011649474948245616+0.0038574366118233113j)
a'110000'b'001010' (-0.008030639569140052+0.06776807646746741j)
a'110000'b'010010' (0.03891633402118346+0.06996081025314674j)
a'110000'b'100010' (-0.019447659075236226-0.08622365390489099j)
a'110000'b'001100' (-0.027904773549545216+0.010074826495397869j)
a'110000'b'010100' (0.031156546949133335+0.004669370886176053j)
a'110000'b'100100' (0.05039820634267395-0.07904972103545009j)
a'110000'b'011000' (0.023069207261102866+0.030152128470770753j)
a'110000'b'101000' (0.013376792189270369+0.03241119501923294j)
a'110000'b'110000' (-0.06701115593279829-0.0005670889594984321j)

We need to build our Diagoanl Coulomb operator For this bigger system.

tei_compressed = np.random.randn(tedim**2).reshape((tedim, tedim))
tei_compressed = 0.5 * (tei_compressed + tei_compressed.T)
tei_tensor = uncompress_tei(tei_compressed, notation='physics')

diagonal_coulomb = of.FermionOperator()
diagonal_coulomb_mat = np.zeros((norbs, norbs))
for i, j in product(range(norbs), repeat=2):
    diagonal_coulomb_mat[i, j] = tei_tensor[i, j, i, j]
    for sigma, tau in product(range(2), repeat=2):
        diagonal_coulomb += of.FermionOperator(
            ((2 * i + sigma, 1), (2 * i + sigma, 0), (2 * j + tau, 1),
             (2 * j + tau, 0)), coefficient=diagonal_coulomb_mat[i, j])

dc_ham = DiagonalCoulomb(diagonal_coulomb_mat)

Now we can convert our wavefunction to a cirq wavefunction, evolve under the diagonal_coulomb operator we constructed and then compare the outputs.

cirq_wfn = fqe.to_cirq(fqe_wfn).reshape((-1, 1))
final_cirq_wfn = expm(-1j * of.get_sparse_operator(diagonal_coulomb).todense()) @ cirq_wfn
# recover a fqe wavefunction
from_cirq_wfn = fqe.from_cirq(final_cirq_wfn.flatten(), 1.0E-8)
fqe_wfn = fqe_wfn.time_evolve(1, dc_ham)
print("Evolved wavefunction")
fqe_wfn.print_wfn()
Evolved wavefunction
Sector N = 4 : S_z = 0
a'000011'b'000011' (0.026390871602307606+0.021101178848568176j)
a'000011'b'000101' (0.009231897641457633-0.01297349336298109j)
a'000011'b'001001' (0.04776570653546294-0.020664781469156523j)
a'000011'b'010001' (0.129346351060951+0.008915332282081327j)
a'000011'b'100001' (-0.06074868162406122+0.02601477344108399j)
a'000011'b'000110' (0.08250252662210045+0.017140241038361825j)
a'000011'b'001010' (0.007754349541253132+0.05439538206306177j)
a'000011'b'010010' (-0.12010195494380721-0.02492557404923801j)
a'000011'b'100010' (0.03487901337060991+0.013466179982873474j)
a'000011'b'001100' (0.009572403519986004-0.03304947298675484j)
a'000011'b'010100' (-0.03534119238267469-0.04496443972200095j)
a'000011'b'100100' (-0.01221307675976601-0.030903263309737274j)
a'000011'b'011000' (-0.001490565975737354+0.04080103679535739j)
a'000011'b'101000' (-0.010755088271436614+0.05244212225642999j)
a'000011'b'110000' (-0.03875844979550795-0.03178432021716507j)
a'000101'b'000011' (0.03986751928750623-0.010719152397558239j)
a'000101'b'000101' (-0.01993929569175395-0.034983664679905824j)
a'000101'b'001001' (-0.030592912804352394+0.03450898160488793j)
a'000101'b'010001' (0.03939778217868905+0.0010823693036638975j)
a'000101'b'100001' (0.0720913353657038+0.01901065084477505j)
a'000101'b'000110' (0.05423977026267599+0.016756485370350373j)
a'000101'b'001010' (0.015483811981786808+0.031310257008576585j)
a'000101'b'010010' (-0.040594934023706244-0.008415489758732303j)
a'000101'b'100010' (-0.04660581420931172+0.07561050032159555j)
a'000101'b'001100' (0.044642774469172954+0.030841450521263768j)
a'000101'b'010100' (-0.004421164432301213+0.027509777780764626j)
a'000101'b'100100' (-0.01387904527712663+0.012612574831813458j)
a'000101'b'011000' (-0.042653684471673156-0.020204755225498337j)
a'000101'b'101000' (0.007788304609564352+0.054198442895722274j)
a'000101'b'110000' (-0.019646919105202745-0.03951991968602826j)
a'001001'b'000011' (-0.04840463016823608+0.01699859189608929j)
a'001001'b'000101' (0.046519212660820146+0.055671297374779764j)
a'001001'b'001001' (0.07615584372463492-0.011445121712610877j)
a'001001'b'010001' (0.04184686318224251-0.07918454151479797j)
a'001001'b'100001' (0.01415603735824961+0.03432207450004999j)
a'001001'b'000110' (0.009079182096958962+0.012513634433809057j)
a'001001'b'001010' (-0.02001358066756494+0.0009597110591920305j)
a'001001'b'010010' (-0.03467503044525604-0.04426846232644189j)
a'001001'b'100010' (-0.001355153657745597+0.047633528399177734j)
a'001001'b'001100' (-0.0030273824600457193+0.10419499096432906j)
a'001001'b'010100' (0.005846884857322985-0.04434299563689379j)
a'001001'b'100100' (0.029078659197845313-0.09108133880452798j)
a'001001'b'011000' (-0.030200061724339266-0.05620138723251464j)
a'001001'b'101000' (-0.04409218474489997+0.04292505813070715j)
a'001001'b'110000' (-0.003357682253143008+0.02736357329009651j)
a'010001'b'000011' (0.0730506348100201-0.017788924418821114j)
a'010001'b'000101' (0.06605806371702064-0.006251391604226058j)
a'010001'b'001001' (-0.14046887291237187+0.006416924647616133j)
a'010001'b'010001' (-0.02130206912512668+0.00736621451546357j)
a'010001'b'100001' (0.033859418673188396-0.0422928706479536j)
a'010001'b'000110' (0.06400637402203828+0.022679202508453747j)
a'010001'b'001010' (0.05612440431513873-0.0589129074991875j)
a'010001'b'010010' (-0.014133660299314068+0.07108078666486337j)
a'010001'b'100010' (0.04702998238010801-0.06585237771899921j)
a'010001'b'001100' (0.006882386382248656+0.0051282432754945545j)
a'010001'b'010100' (-0.0038268584022605424-0.12086741967928147j)
a'010001'b'100100' (0.03367701946565506+0.06768402209275784j)
a'010001'b'011000' (-0.0521623084604246-0.004546101633100792j)
a'010001'b'101000' (0.0648712183986955+0.03715629700408764j)
a'010001'b'110000' (-0.004643979971712457-0.012989898725674402j)
a'100001'b'000011' (-0.016696628268598107+0.05677716724545702j)
a'100001'b'000101' (0.016242016284478272+0.02245125194117973j)
a'100001'b'001001' (-0.009413928874337512+0.05742466199305431j)
a'100001'b'010001' (0.03623967670165873+0.0060242074877210885j)
a'100001'b'100001' (-0.011560365657993822-0.08251676443505301j)
a'100001'b'000110' (-0.012040209917542843-0.023810677897246828j)
a'100001'b'001010' (-0.010709943489965517-0.08773669678618606j)
a'100001'b'010010' (-0.0779945013396552-0.07113698358004708j)
a'100001'b'100010' (0.048047687468074335+0.11034102932448689j)
a'100001'b'001100' (-0.03131061959575992+0.031854958572861004j)
a'100001'b'010100' (0.013394830253459082+0.06679518679990323j)
a'100001'b'100100' (-0.01524630573741379-0.006900275841695674j)
a'100001'b'011000' (0.013961647392076285+0.00032755139278988036j)
a'100001'b'101000' (-0.022432315865483582+0.0047800646866564085j)
a'100001'b'110000' (0.05673710526187271+0.013082304098770382j)
a'000110'b'000011' (-0.09685951496753381+0.06167564753419302j)
a'000110'b'000101' (0.005705428025087685-0.013195466132780175j)
a'000110'b'001001' (0.07403940955310041+0.06097300068684221j)
a'000110'b'010001' (-0.08905515966087144+0.03582670391369165j)
a'000110'b'100001' (0.029997938655190234+0.054989014769569834j)
a'000110'b'000110' (0.03178544071835409+0.09901916916147488j)
a'000110'b'001010' (0.051582987003028595-0.03124299088902061j)
a'000110'b'010010' (-0.046091734949606146+0.024355655687780448j)
a'000110'b'100010' (0.04447393964941003+0.05858868024122499j)
a'000110'b'001100' (0.08078381983857084+0.04096968458528372j)
a'000110'b'010100' (-0.009941960536410487-0.002739935093274655j)
a'000110'b'100100' (0.009056033443356223+0.013537942337417628j)
a'000110'b'011000' (0.03604520520770614-0.07108981830937172j)
a'000110'b'101000' (-0.03600166551649007-0.01034465609992842j)
a'000110'b'110000' (-0.09971818655499494+0.07596745588757142j)
a'001010'b'000011' (0.04571970461603916+0.1132789491024519j)
a'001010'b'000101' (-0.11137717942835343-0.006442693668085587j)
a'001010'b'001001' (0.03881805612483182-0.00500087229484565j)
a'001010'b'010001' (0.036144913063911224-0.0996771653399352j)
a'001010'b'100001' (0.0034833630018253434+0.061461094524033553j)
a'001010'b'000110' (0.009600449671467602-0.03918063434127494j)
a'001010'b'001010' (0.0008577529776963251-0.01347977087989403j)
a'001010'b'010010' (0.050394761764022855+0.01464784874125381j)
a'001010'b'100010' (-0.049905580582029464-0.048598493422915265j)
a'001010'b'001100' (-0.059743945633643034+0.010222453147230753j)
a'001010'b'010100' (-0.018672934040306573-0.0523345106707124j)
a'001010'b'100100' (0.06399255723682605+0.03303347568716337j)
a'001010'b'011000' (0.00691222846522704-0.011063190752772492j)
a'001010'b'101000' (0.03175972965860959-0.026236131291764393j)
a'001010'b'110000' (0.010847626404211566-0.05876951067345277j)
a'010010'b'000011' (-0.015081838225482489+0.11737983607050871j)
a'010010'b'000101' (0.04547792211966806+0.024918962394914656j)
a'010010'b'001001' (0.010603519479766246+0.011784506091516753j)
a'010010'b'010001' (-0.0593967629716446-0.04163638528580121j)
a'010010'b'100001' (0.015732071243450465+0.02234185986159254j)
a'010010'b'000110' (-0.002351815074331147-0.07092196443489898j)
a'010010'b'001010' (0.017547444384805-0.039995051900188774j)
a'010010'b'010010' (-0.04575915031239528+0.02383562618285528j)
a'010010'b'100010' (-0.02187632918759114+0.1115630287249304j)
a'010010'b'001100' (0.04640194494780293-0.06948730941015012j)
a'010010'b'010100' (0.03097555290114863-0.001195960940914939j)
a'010010'b'100100' (0.05697057928570065-0.007554937881711913j)
a'010010'b'011000' (0.002721218237812917-0.11521415980399365j)
a'010010'b'101000' (-0.07313417881819406-0.05545167305767043j)
a'010010'b'110000' (-0.04343713156965778+0.05274897425651116j)
a'100010'b'000011' (-0.01964345159607747-0.02995541445544167j)
a'100010'b'000101' (0.07537082111544141+0.08542215804010479j)
a'100010'b'001001' (-0.03973595518073957+0.01069497252265997j)
a'100010'b'010001' (0.07241017211669429+0.04120202372741383j)
a'100010'b'100001' (-0.062289886715159073-0.03292964152307508j)
a'100010'b'000110' (-0.05446667542822235-0.019705585694812677j)
a'100010'b'001010' (0.05563365673408646-0.05587497557381317j)
a'100010'b'010010' (0.016362759543725663-0.03252133961987105j)
a'100010'b'100010' (0.0757607905465375-0.06425415214181976j)
a'100010'b'001100' (-0.083229296723098+0.048441051202927764j)
a'100010'b'010100' (-0.08495258850007222-0.015214826340880571j)
a'100010'b'100100' (-0.03946271535210484+0.014875275510615843j)
a'100010'b'011000' (0.029341967678899374-0.030402219752927943j)
a'100010'b'101000' (0.035957930421563186-0.08454473705436762j)
a'100010'b'110000' (0.04367488813650843-0.008852722234381874j)
a'001100'b'000011' (0.02885226987506194+0.0042694429217979436j)
a'001100'b'000101' (-0.041597848286232066+0.01711832524196835j)
a'001100'b'001001' (-0.0162612151526959+0.0354081559310549j)
a'001100'b'010001' (-0.043796385873984114-0.045781115902738756j)
a'001100'b'100001' (-0.007167234240115262+0.06619793872173131j)
a'001100'b'000110' (0.10428098923336442+0.02255419458908214j)
a'001100'b'001010' (-0.015124698951446292-0.01954110877803897j)
a'001100'b'010010' (-0.05775233969992455+0.007139841575301626j)
a'001100'b'100010' (-0.040027023424016775-0.009069260809323396j)
a'001100'b'001100' (0.011847125085451798+0.010762671617438753j)
a'001100'b'010100' (-0.018353396128211328-0.05967836303323374j)
a'001100'b'100100' (-0.10072695446839658-0.005287551940888587j)
a'001100'b'011000' (0.04932080745693254-0.04886777843674454j)
a'001100'b'101000' (-0.054881820248451396+0.037222202754158364j)
a'001100'b'110000' (-0.02365130879615523+0.024986683643520358j)
a'010100'b'000011' (0.008375905695445256+0.0648993887860763j)
a'010100'b'000101' (0.004246634019109703-0.013181329645002092j)
a'010100'b'001001' (0.01229782479664326-0.07586128229123065j)
a'010100'b'010001' (0.0048071281639445644+0.01941654236605297j)
a'010100'b'100001' (-0.03361777400965793-0.03050771201092346j)
a'010100'b'000110' (0.10696952151911546+0.011337220215924123j)
a'010100'b'001010' (0.10068841818682424-0.0759626512722279j)
a'010100'b'010010' (-0.007179750977373798-0.027141109833868558j)
a'010100'b'100010' (-0.0354441256059372+0.010599790004427935j)
a'010100'b'001100' (-0.009184052729452549-0.023292381549467726j)
a'010100'b'010100' (-0.032943434989191125-0.0006009270023751922j)
a'010100'b'100100' (0.011465661526835213-0.0813469366529382j)
a'010100'b'011000' (-0.002447047286506844+0.02067506205721309j)
a'010100'b'101000' (0.06340336850032036+0.018113887251784283j)
a'010100'b'110000' (-0.04792091651356021+0.030451268861412552j)
a'100100'b'000011' (-0.03257722281911867-0.07711601131336794j)
a'100100'b'000101' (0.011517415587168449-0.020066757351129037j)
a'100100'b'001001' (0.048843896299121024+0.053375660795883684j)
a'100100'b'010001' (-0.04384220012816351-0.0746592317808362j)
a'100100'b'100001' (-0.011607401734632285-0.018459337182933796j)
a'100100'b'000110' (0.017863500723898435+0.047046018990496104j)
a'100100'b'001010' (-0.03762819732828486-0.11359880698515004j)
a'100100'b'010010' (-0.12113071341138658+0.02796975777875155j)
a'100100'b'100010' (-0.07413810914872768-0.020660713619025994j)
a'100100'b'001100' (0.025272145203216582-0.03637581150769828j)
a'100100'b'010100' (0.01641893265183017+0.0021156264195451597j)
a'100100'b'100100' (0.006807605669802315-0.05941953726897001j)
a'100100'b'011000' (0.06263031937797699-0.00608035859393677j)
a'100100'b'101000' (-0.027750229984407956+0.07101220249399302j)
a'100100'b'110000' (-0.053717118148920814+0.02795296096578735j)
a'011000'b'000011' (0.016331155915676427-0.015850156077312855j)
a'011000'b'000101' (0.019162089479090906-0.03019544009843173j)
a'011000'b'001001' (-0.0016150726597163828+0.06288182502997881j)
a'011000'b'010001' (0.015185199611619083+0.030578966211792437j)
a'011000'b'100001' (0.0005948470381235756-0.05989582259983361j)
a'011000'b'000110' (0.007361878385665519+0.06129217557191846j)
a'011000'b'001010' (-0.045191670620682606+0.059103381054315576j)
a'011000'b'010010' (-0.04663482659831601-0.04496925418459452j)
a'011000'b'100010' (0.007932180483001018+0.013092432489111462j)
a'011000'b'001100' (-0.01040055165256178+0.02207095264572313j)
a'011000'b'010100' (0.08655815251996087-0.06348815343822355j)
a'011000'b'100100' (-0.020038150130840753-0.052733828653861545j)
a'011000'b'011000' (-0.04798183643272235+0.03133727282878119j)
a'011000'b'101000' (0.03568658570275033-0.008750826305647705j)
a'011000'b'110000' (-0.12494964457134765-0.0041623732983057105j)
a'101000'b'000011' (0.004678373806406178+0.04040814684257918j)
a'101000'b'000101' (-0.046627969585617005-0.012175121837627355j)
a'101000'b'001001' (0.02527484538522395+0.010722193844724615j)
a'101000'b'010001' (0.06367578714577511-0.021537417512160057j)
a'101000'b'100001' (-0.049799932740126084+0.0564231248781015j)
a'101000'b'000110' (0.05484917982446596+0.055011330743158705j)
a'101000'b'001010' (0.010335104708606631+0.04070771683939449j)
a'101000'b'010010' (-0.010248822577466808+0.037075998533781046j)
a'101000'b'100010' (0.020084883011263162+0.06444505375818795j)
a'101000'b'001100' (-0.02270389434162912-0.006942716487688407j)
a'101000'b'010100' (-0.04400866309716513-0.0752548770708847j)
a'101000'b'100100' (-0.032186191652595765+0.10704480247929393j)
a'101000'b'011000' (0.05052313875856291+0.005633795656319176j)
a'101000'b'101000' (0.0047463081482233965-0.01843822792432133j)
a'101000'b'110000' (-0.04223485346895895-0.00810506697653654j)
a'110000'b'000011' (0.008367376646916693+0.11900576631395324j)
a'110000'b'000101' (-0.01617910878448217-0.059378102648255354j)
a'110000'b'001001' (-0.021195470883857828+0.027913474803500635j)
a'110000'b'010001' (-0.012313957152409013-0.013807087866287907j)
a'110000'b'100001' (0.04867693882482085+0.05649411305209361j)
a'110000'b'000110' (0.0015978093986164738+0.012167049309907887j)
a'110000'b'001010' (0.03780886917109867+0.05681102685212343j)
a'110000'b'010010' (0.07100357791970842-0.036979561213256934j)
a'110000'b'100010' (-0.018036247397445675-0.08652990070510408j)
a'110000'b'001100' (-0.006247695488364035-0.029002496734737246j)
a'110000'b'010100' (-0.024508003043562696+0.01979624280218193j)
a'110000'b'100100' (0.07082133684320246+0.06142618208942231j)
a'110000'b'011000' (0.01852470927186729-0.03313871333299436j)
a'110000'b'101000' (0.02916460350115369-0.019464070346928153j)
a'110000'b'110000' (-0.03300702770696913-0.05832111737003298j)
print("From Cirq Evolution")
from_cirq_wfn.print_wfn()
assert np.allclose(from_cirq_wfn.get_coeff((n_elec, sz)),
                   fqe_wfn.get_coeff((n_elec, sz)))
print("Wavefunctions are equivalent")
From Cirq Evolution
Sector N = 4 : S_z = 0
a'000011'b'000011' (0.02639087160230765+0.021101178848568103j)
a'000011'b'000101' (0.009231897641457648-0.012973493362981082j)
a'000011'b'001001' (0.047765706535462894-0.020664781469156596j)
a'000011'b'010001' (0.12934635106095096+0.008915332282081335j)
a'000011'b'100001' (-0.060748681624061156+0.02601477344108411j)
a'000011'b'000110' (0.08250252662210045+0.017140241038361828j)
a'000011'b'001010' (0.007754349541253168+0.05439538206306176j)
a'000011'b'010010' (-0.12010195494380724-0.02492557404923796j)
a'000011'b'100010' (0.034879013370609925+0.013466179982873463j)
a'000011'b'001100' (0.009572403519985985-0.03304947298675485j)
a'000011'b'010100' (-0.03534119238267472-0.04496443972200093j)
a'000011'b'100100' (-0.012213076759766024-0.030903263309737274j)
a'000011'b'011000' (-0.001490565975737346+0.04080103679535739j)
a'000011'b'101000' (-0.010755088271436612+0.05244212225642998j)
a'000011'b'110000' (-0.038758449795507965-0.03178432021716507j)
a'000101'b'000011' (0.039867519287506245-0.010719152397558199j)
a'000101'b'000101' (-0.019939295691753893-0.03498366467990588j)
a'000101'b'001001' (-0.03059291280435255+0.034508981604887815j)
a'000101'b'010001' (0.03939778217868907+0.0010823693036637778j)
a'000101'b'100001' (0.07209133536570383+0.019010650844774973j)
a'000101'b'000110' (0.054239770262675985+0.016756485370350443j)
a'000101'b'001010' (0.015483811981786829+0.031310257008576585j)
a'000101'b'010010' (-0.04059493402370626-0.008415489758732277j)
a'000101'b'100010' (-0.046605814209311716+0.07561050032159557j)
a'000101'b'001100' (0.04464277446917297+0.030841450521263778j)
a'000101'b'010100' (-0.004421164432301209+0.02750977778076464j)
a'000101'b'100100' (-0.013879045277126642+0.012612574831813455j)
a'000101'b'011000' (-0.04265368447167318-0.02020475522549832j)
a'000101'b'101000' (0.007788304609564308+0.054198442895722294j)
a'000101'b'110000' (-0.019646919105202755-0.039519919686028276j)
a'001001'b'000011' (-0.04840463016823604+0.016998591896089366j)
a'001001'b'000101' (0.0465192126608199+0.05567129737477996j)
a'001001'b'001001' (0.07615584372463488-0.011445121712610952j)
a'001001'b'010001' (0.041846863182242636-0.07918454151479791j)
a'001001'b'100001' (0.01415603735824969+0.03432207450004996j)
a'001001'b'000110' (0.00907918209695897+0.012513634433809049j)
a'001001'b'001010' (-0.020013580667564937+0.0009597110591920465j)
a'001001'b'010010' (-0.03467503044525605-0.04426846232644189j)
a'001001'b'100010' (-0.001355153657745592+0.047633528399177734j)
a'001001'b'001100' (-0.00302738246004566+0.104194990964329j)
a'001001'b'010100' (0.00584688485732297-0.04434299563689379j)
a'001001'b'100100' (0.029078659197845354-0.091081338804528j)
a'001001'b'011000' (-0.030200061724339332-0.05620138723251461j)
a'001001'b'101000' (-0.0440921847449+0.042925058130707114j)
a'001001'b'110000' (-0.0033576822531430073+0.027363573290096525j)
a'010001'b'000011' (0.0730506348100201-0.0177889244188211j)
a'010001'b'000101' (0.06605806371702062-0.006251391604226268j)
a'010001'b'001001' (-0.14046887291237187+0.006416924647615924j)
a'010001'b'010001' (-0.02130206912512671+0.007366214515463529j)
a'010001'b'100001' (0.033859418673188424-0.042292870647953604j)
a'010001'b'000110' (0.06400637402203829+0.02267920250845371j)
a'010001'b'001010' (0.05612440431513872-0.058912907499187504j)
a'010001'b'010010' (-0.01413366029931407+0.07108078666486338j)
a'010001'b'100010' (0.04702998238010801-0.06585237771899922j)
a'010001'b'001100' (0.006882386382248659+0.005128243275494552j)
a'010001'b'010100' (-0.003826858402260637-0.1208674196792815j)
a'010001'b'100100' (0.033677019465655086+0.06768402209275784j)
a'010001'b'011000' (-0.05216230846042461-0.004546101633100746j)
a'010001'b'101000' (0.06487121839869553+0.03715629700408763j)
a'010001'b'110000' (-0.004643979971712469-0.012989898725674406j)
a'100001'b'000011' (-0.016696628268598003+0.056777167245457054j)
a'100001'b'000101' (0.016242016284478297+0.02245125194117972j)
a'100001'b'001001' (-0.00941392887433739+0.057424661993054314j)
a'100001'b'010001' (0.03623967670165873+0.006024207487721107j)
a'100001'b'100001' (-0.011560365657993898-0.08251676443505301j)
a'100001'b'000110' (-0.012040209917542847-0.023810677897246828j)
a'100001'b'001010' (-0.010709943489965519-0.08773669678618609j)
a'100001'b'010010' (-0.07799450133965524-0.07113698358004708j)
a'100001'b'100010' (0.04804768746807426+0.11034102932448696j)
a'100001'b'001100' (-0.03131061959575994+0.03185495857286098j)
a'100001'b'010100' (0.01339483025345909+0.06679518679990323j)
a'100001'b'100100' (-0.015246305737413791-0.006900275841695686j)
a'100001'b'011000' (0.013961647392076287+0.00032755139278987846j)
a'100001'b'101000' (-0.022432315865483592+0.004780064686656404j)
a'100001'b'110000' (0.056737105261872735+0.013082304098770372j)
a'000110'b'000011' (-0.0968595149675338+0.06167564753419306j)
a'000110'b'000101' (0.005705428025087698-0.013195466132780175j)
a'000110'b'001001' (0.07403940955310045+0.06097300068684213j)
a'000110'b'010001' (-0.08905515966087141+0.03582670391369171j)
a'000110'b'100001' (0.029997938655190258+0.05498901476956982j)
a'000110'b'000110' (0.0317854407183539+0.09901916916147495j)
a'000110'b'001010' (0.051582987003028574-0.031242990889020633j)
a'000110'b'010010' (-0.04609173494960615+0.024355655687780458j)
a'000110'b'100010' (0.044473939649410064+0.05858868024122498j)
a'000110'b'001100' (0.08078381983857087+0.04096968458528365j)
a'000110'b'010100' (-0.00994196053641049-0.0027399350932746512j)
a'000110'b'100100' (0.009056033443356228+0.013537942337417633j)
a'000110'b'011000' (0.03604520520770612-0.07108981830937174j)
a'000110'b'101000' (-0.036001665516490075-0.010344656099928412j)
a'000110'b'110000' (-0.09971818655499498+0.07596745588757144j)
a'001010'b'000011' (0.045719704616039226+0.11327894910245184j)
a'001010'b'000101' (-0.11137717942835346-0.006442693668085501j)
a'001010'b'001001' (0.03881805612483181-0.005000872294845677j)
a'001010'b'010001' (0.03614491306391121-0.09967716533993523j)
a'001010'b'100001' (0.0034833630018253556+0.06146109452403357j)
a'001010'b'000110' (0.00960044967146759-0.039180634341274945j)
a'001010'b'001010' (0.0008577529776963262-0.013479770879894028j)
a'001010'b'010010' (0.050394761764022876+0.014647848741253796j)
a'001010'b'100010' (-0.049905580582029464-0.048598493422915286j)
a'001010'b'001100' (-0.05974394563364304+0.010222453147230769j)
a'001010'b'010100' (-0.01867293404030659-0.05233451067071242j)
a'001010'b'100100' (0.06399255723682608+0.03303347568716338j)
a'001010'b'011000' (0.006912228465227036-0.011063190752772498j)
a'001010'b'101000' (0.0317597296586096-0.026236131291764386j)
a'001010'b'110000' (0.010847626404211573-0.05876951067345279j)
a'010010'b'000011' (-0.015081838225482432+0.11737983607050873j)
a'010010'b'000101' (0.04547792211966807+0.02491896239491463j)
a'010010'b'001001' (0.010603519479766253+0.01178450609151675j)
a'010010'b'010001' (-0.059396762971644604-0.0416363852858012j)
a'010010'b'100001' (0.015732071243450472+0.02234185986159254j)
a'010010'b'000110' (-0.002351815074331146-0.070921964434899j)
a'010010'b'001010' (0.017547444384804996-0.03999505190018879j)
a'010010'b'010010' (-0.04575915031239529+0.023835626182855296j)
a'010010'b'100010' (-0.021876329187591123+0.11156302872493043j)
a'010010'b'001100' (0.04640194494780292-0.06948730941015015j)
a'010010'b'010100' (0.03097555290114863-0.0011959609409149382j)
a'010010'b'100100' (0.05697057928570067-0.007554937881711899j)
a'010010'b'011000' (0.002721218237812878-0.11521415980399366j)
a'010010'b'101000' (-0.0731341788181941-0.05545167305767044j)
a'010010'b'110000' (-0.04343713156965776+0.0527489742565112j)
a'100010'b'000011' (-0.019643451596077482-0.029955414455441663j)
a'100010'b'000101' (0.07537082111544145+0.08542215804010479j)
a'100010'b'001001' (-0.039735955180739566+0.010694972522659978j)
a'100010'b'010001' (0.0724101721166943+0.04120202372741384j)
a'100010'b'100001' (-0.06228988671515906-0.03292964152307515j)
a'100010'b'000110' (-0.05446667542822239-0.01970558569481267j)
a'100010'b'001010' (0.05563365673408648-0.05587497557381319j)
a'100010'b'010010' (0.016362759543725666-0.03252133961987106j)
a'100010'b'100010' (0.07576079054653762-0.06425415214181969j)
a'100010'b'001100' (-0.08322929672309802+0.04844105120292777j)
a'100010'b'010100' (-0.08495258850007223-0.015214826340880588j)
a'100010'b'100100' (-0.039462715352104855+0.01487527551061582j)
a'100010'b'011000' (0.029341967678899378-0.030402219752927957j)
a'100010'b'101000' (0.03595793042156321-0.0845447370543676j)
a'100010'b'110000' (0.043674888136508445-0.008852722234381863j)
a'001100'b'000011' (0.028852269875061936+0.004269442921797929j)
a'001100'b'000101' (-0.04159784828623208+0.01711832524196835j)
a'001100'b'001001' (-0.016261215152695876+0.03540815593105489j)
a'001100'b'010001' (-0.043796385873984135-0.045781115902738735j)
a'001100'b'100001' (-0.007167234240115318+0.0661979387217313j)
a'001100'b'000110' (0.10428098923336442+0.022554194589082078j)
a'001100'b'001010' (-0.0151246989514463-0.019541108778038968j)
a'001100'b'010010' (-0.05775233969992457+0.007139841575301637j)
a'001100'b'100010' (-0.04002702342401679-0.009069260809323396j)
a'001100'b'001100' (0.011847125085451809+0.010762671617438737j)
a'001100'b'010100' (-0.01835339612821129-0.05967836303323376j)
a'001100'b'100100' (-0.1007269544683966-0.005287551940888363j)
a'001100'b'011000' (0.04932080745693251-0.048867778436744586j)
a'001100'b'101000' (-0.05488182024845141+0.03722220275415838j)
a'001100'b'110000' (-0.023651308796155245+0.024986683643520365j)
a'010100'b'000011' (0.008375905695445295+0.06489938878607632j)
a'010100'b'000101' (0.0042466340191097025-0.013181329645002099j)
a'010100'b'001001' (0.012297824796643228-0.07586128229123067j)
a'010100'b'010001' (0.004807128163944579+0.019416542366052975j)
a'010100'b'100001' (-0.033617774009657944-0.030507712010923456j)
a'010100'b'000110' (0.1069695215191155+0.011337220215924093j)
a'010100'b'001010' (0.10068841818682427-0.07596265127222795j)
a'010100'b'010010' (-0.007179750977373805-0.027141109833868568j)
a'010100'b'100010' (-0.03544412560593721+0.010599790004427937j)
a'010100'b'001100' (-0.009184052729452535-0.023292381549467736j)
a'010100'b'010100' (-0.032943434989191125-0.0006009270023752747j)
a'010100'b'100100' (0.011465661526835341-0.08134693665293818j)
a'010100'b'011000' (-0.0024470472865068425+0.020675062057213093j)
a'010100'b'101000' (0.06340336850032036+0.018113887251784283j)
a'010100'b'110000' (-0.04792091651356019+0.030451268861412598j)
a'100100'b'000011' (-0.03257722281911869-0.07711601131336795j)
a'100100'b'000101' (0.011517415587168456-0.020066757351129033j)
a'100100'b'001001' (0.048843896299121004+0.05337566079588371j)
a'100100'b'010001' (-0.04384220012816352-0.0746592317808362j)
a'100100'b'100001' (-0.011607401734632282-0.018459337182933806j)
a'100100'b'000110' (0.01786350072389844+0.04704601899049612j)
a'100100'b'001010' (-0.03762819732828488-0.11359880698515008j)
a'100100'b'010010' (-0.1211307134113866+0.027969757778751523j)
a'100100'b'100010' (-0.07413810914872768-0.020660713619026053j)
a'100100'b'001100' (0.025272145203216502-0.036375811507698336j)
a'100100'b'010100' (0.01641893265183017+0.002115626419545184j)
a'100100'b'100100' (0.0068076056698021005-0.05941953726897006j)
a'100100'b'011000' (0.062630319377977-0.0060803585939367705j)
a'100100'b'101000' (-0.02775022998440798+0.07101220249399304j)
a'100100'b'110000' (-0.05371711814892082+0.027952960965787352j)
a'011000'b'000011' (0.016331155915676417-0.015850156077312855j)
a'011000'b'000101' (0.019162089479090896-0.030195440098431746j)
a'011000'b'001001' (-0.001615072659716308+0.06288182502997881j)
a'011000'b'010001' (0.015185199611619116+0.03057896621179243j)
a'011000'b'100001' (0.0005948470381235589-0.05989582259983363j)
a'011000'b'000110' (0.007361878385665528+0.06129217557191845j)
a'011000'b'001010' (-0.04519167062068257+0.05910338105431558j)
a'011000'b'010010' (-0.04663482659831604-0.0449692541845945j)
a'011000'b'100010' (0.007932180483001022+0.013092432489111466j)
a'011000'b'001100' (-0.010400551652561766+0.022070952645723136j)
a'011000'b'010100' (0.08655815251996087-0.06348815343822353j)
a'011000'b'100100' (-0.020038150130840756-0.052733828653861566j)
a'011000'b'011000' (-0.04798183643272234+0.031337272828781224j)
a'011000'b'101000' (0.03568658570275034-0.008750826305647715j)
a'011000'b'110000' (-0.1249496445713477-0.004162373298305662j)
a'101000'b'000011' (0.004678373806406174+0.04040814684257918j)
a'101000'b'000101' (-0.046627969585617005-0.012175121837627402j)
a'101000'b'001001' (0.025274845385223944+0.010722193844724632j)
a'101000'b'010001' (0.06367578714577513-0.021537417512160074j)
a'101000'b'100001' (-0.04979993274012612+0.05642312487810149j)
a'101000'b'000110' (0.05484917982446595+0.0550113307431587j)
a'101000'b'001010' (0.010335104708606623+0.04070771683939449j)
a'101000'b'010010' (-0.010248822577466813+0.03707599853378106j)
a'101000'b'100010' (0.020084883011263155+0.06444505375818797j)
a'101000'b'001100' (-0.022703894341629116-0.006942716487688406j)
a'101000'b'010100' (-0.04400866309716513-0.07525487707088471j)
a'101000'b'100100' (-0.03218619165259579+0.10704480247929393j)
a'101000'b'011000' (0.05052313875856293+0.005633795656319159j)
a'101000'b'101000' (0.004746308148223414-0.018438227924321326j)
a'101000'b'110000' (-0.042234853468958965-0.008105066976536582j)
a'110000'b'000011' (0.008367376646916704+0.11900576631395327j)
a'110000'b'000101' (-0.016179108784482178-0.05937810264825538j)
a'110000'b'001001' (-0.021195470883857835+0.02791347480350065j)
a'110000'b'010001' (-0.012313957152409023-0.013807087866287903j)
a'110000'b'100001' (0.048676938824820874+0.056494113052093634j)
a'110000'b'000110' (0.0015978093986164705+0.012167049309907887j)
a'110000'b'001010' (0.03780886917109869+0.05681102685212344j)
a'110000'b'010010' (0.07100357791970842-0.03697956121325698j)
a'110000'b'100010' (-0.01803624739744567-0.0865299007051041j)
a'110000'b'001100' (-0.006247695488364034-0.029002496734737253j)
a'110000'b'010100' (-0.02450800304356268+0.019796242802181948j)
a'110000'b'100100' (0.07082133684320248+0.06142618208942237j)
a'110000'b'011000' (0.018524709271867282-0.03313871333299438j)
a'110000'b'101000' (0.029164603501153723-0.01946407034692813j)
a'110000'b'110000' (-0.03300702770696914-0.05832111737003298j)
Wavefunctions are equivalent

Finally, we can compare against evolving each term of \(V\) individually.

fqe_wfn = fqe.Wavefunction([[n_elec, sz, norbs]])
fqe_wfn.set_wfn(strategy='from_data',
                raw_data={(n_elec, sz): inital_coeffs})
for term, coeff in diagonal_coulomb.terms.items():
    op = of.FermionOperator(term, coefficient=coeff)
    fqe_wfn = fqe_wfn.time_evolve(1, op)

assert np.allclose(from_cirq_wfn.get_coeff((n_elec, sz)),
               fqe_wfn.get_coeff((n_elec, sz)))
print("Individual term evolution is equivalent")
Individual term evolution is equivalent