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.1086131845568788-0.9940840890691357j)

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.001269099360246098-0.037210100818327284j)
a'000011'b'000101' (0.05262151194210649-0.0077530588420149146j)
a'000011'b'001001' (0.00739691968415157+0.022761435918676944j)
a'000011'b'010001' (0.03886805332437993+0.05990405005005927j)
a'000011'b'100001' (0.02405932937102322+0.017912446558130807j)
a'000011'b'000110' (0.04986880032331895-0.026394193759126425j)
a'000011'b'001010' (-0.010567426325291169+0.08548907106236397j)
a'000011'b'010010' (0.003253797675968265+0.03054779859266784j)
a'000011'b'100010' (-0.0584334616333552+0.003616217629533197j)
a'000011'b'001100' (-0.04799683675594519-0.04449151554608105j)
a'000011'b'010100' (-0.09768736517092952+0.10087769092185352j)
a'000011'b'100100' (0.02793800026112806+0.014420626997531383j)
a'000011'b'011000' (0.013980406522200733-0.028483823397294727j)
a'000011'b'101000' (-0.07717740212516595+0.09244291278148445j)
a'000011'b'110000' (0.04047486358508395-0.011825920056021665j)
a'000101'b'000011' (-0.025036724851177996-0.022084634040295828j)
a'000101'b'000101' (0.051548066606664486+0.0315149133533918j)
a'000101'b'001001' (0.017140931062254235-0.09447265976044132j)
a'000101'b'010001' (-0.0306065240175206+0.03437189439212266j)
a'000101'b'100001' (-0.10223215988757135+0.038715281104969336j)
a'000101'b'000110' (0.01737673067653452-0.08647936998115528j)
a'000101'b'001010' (0.010655492963387183+0.027436209668874677j)
a'000101'b'010010' (-0.04674678703177098+0.025596361782352084j)
a'000101'b'100010' (-0.05993172377037215-0.06791842615446228j)
a'000101'b'001100' (-0.038244151961558503-0.06216829898603575j)
a'000101'b'010100' (-0.01972429113862861-0.03756552153130182j)
a'000101'b'100100' (-0.010573477255029374+0.026613454503763526j)
a'000101'b'011000' (0.039565615586884754-0.07414383990128397j)
a'000101'b'101000' (-0.004311668928196008-0.020769063657334306j)
a'000101'b'110000' (-0.0382686167863889+0.009739957980216363j)
a'001001'b'000011' (-0.0141407766571151+0.01913899954757946j)
a'001001'b'000101' (-0.03779424818885225+0.026974170667815895j)
a'001001'b'001001' (0.008941194548622095-0.03346340832064453j)
a'001001'b'010001' (-0.0568582486670901+0.0863814596714707j)
a'001001'b'100001' (-0.04692921722403906+0.007682189362164458j)
a'001001'b'000110' (0.07287709082796832-0.06902547274964227j)
a'001001'b'001010' (-0.0004924201197963932-0.0861726838000926j)
a'001001'b'010010' (0.0383887760201924+0.06956219717712565j)
a'001001'b'100010' (-0.030048206102841982+0.027575643389139818j)
a'001001'b'001100' (-0.021947688146842257+0.02098321264477923j)
a'001001'b'010100' (-0.013642018815665628+0.038055761548000396j)
a'001001'b'100100' (0.04958414083354115-0.0051887799855563094j)
a'001001'b'011000' (-0.011441815999004436-0.026392011499727495j)
a'001001'b'101000' (-0.011493122662345782-0.009151700721875287j)
a'001001'b'110000' (0.08416386209358333+0.0048801666255161675j)
a'010001'b'000011' (0.03282795856120293-0.014747953933834134j)
a'010001'b'000101' (-0.006663923370538545+0.06234700512157998j)
a'010001'b'001001' (0.0810211261645128-0.004468529235238272j)
a'010001'b'010001' (-0.007907949997433853+0.05457699446230998j)
a'010001'b'100001' (-0.009866606430441972-0.08533696764343383j)
a'010001'b'000110' (0.003942379375671772-0.05625260229058744j)
a'010001'b'001010' (0.06369021317024558-0.18069992831075876j)
a'010001'b'010010' (0.06928147737170143-0.004092126975820565j)
a'010001'b'100010' (-0.016536929358897376+0.05737550578565261j)
a'010001'b'001100' (0.0004655364856937728+0.05337155915438384j)
a'010001'b'010100' (0.003849150086886506+0.008688895183987124j)
a'010001'b'100100' (0.037988571183212125-0.06450779890414785j)
a'010001'b'011000' (-0.03758627192735708+0.06771937923028254j)
a'010001'b'101000' (0.04852056767709531-0.031227614186778843j)
a'010001'b'110000' (0.03153964214185588+0.04869078059019424j)
a'100001'b'000011' (-0.03625288283670586+0.04794508500925059j)
a'100001'b'000101' (-0.05563499166121044-0.04090228978861284j)
a'100001'b'001001' (-0.0483622604671587-0.09198354881960233j)
a'100001'b'010001' (-0.005589103996901727-0.006098128809455972j)
a'100001'b'100001' (-0.04444399965488162-0.004519934637269015j)
a'100001'b'000110' (0.004406907718263724+0.019607165621175177j)
a'100001'b'001010' (-0.0026484677197794707-0.00771417547271062j)
a'100001'b'010010' (-0.011034055044778411+0.03330586712475551j)
a'100001'b'100010' (0.026224351875749348-0.007263196431165307j)
a'100001'b'001100' (0.008725701409187233-0.04148768166305482j)
a'100001'b'010100' (0.06440976999007873+0.02667236744753064j)
a'100001'b'100100' (0.0235385037321869-0.01837405581583325j)
a'100001'b'011000' (-0.037556066232605795+0.013338258495500245j)
a'100001'b'101000' (0.04398398492934034-0.00473796109704498j)
a'100001'b'110000' (-0.04295273339323299+0.012067750495269003j)
a'000110'b'000011' (0.07344461170687042-0.017589689853329836j)
a'000110'b'000101' (-0.04275965919739005+0.05339940157140823j)
a'000110'b'001001' (-0.0870698387998486-0.013973026719545936j)
a'000110'b'010001' (-0.01587724803368381-0.034861097365191204j)
a'000110'b'100001' (-0.0704657734452986-0.06413827497843518j)
a'000110'b'000110' (0.07648663196548332+0.06752850267493991j)
a'000110'b'001010' (-0.023869252508251913-0.012334302475863002j)
a'000110'b'010010' (0.006638860243049093+0.10174343659149153j)
a'000110'b'100010' (0.011094421697271258-0.03607106689975059j)
a'000110'b'001100' (0.08653358978576157+0.019349083266587717j)
a'000110'b'010100' (0.05136511840743002-0.014989323250753942j)
a'000110'b'100100' (0.01515542948355185+0.07770760784607757j)
a'000110'b'011000' (-0.033860789659295586+0.03863291777867457j)
a'000110'b'101000' (-0.07555307388753855-0.021223908545410355j)
a'000110'b'110000' (-0.0008832741762796184-0.003063950187520174j)
a'001010'b'000011' (-0.09929306912837912+0.03194413893716358j)
a'001010'b'000101' (-0.0014077011814181604-0.010121432363640648j)
a'001010'b'001001' (-0.08663367101176093+0.012768686674433418j)
a'001010'b'010001' (0.02649816401236472+0.013508987597107811j)
a'001010'b'100001' (0.060145690499520336+0.06689866278950657j)
a'001010'b'000110' (0.024176770893550317-0.004681855833534705j)
a'001010'b'001010' (0.004449961141789996+0.045463894515014196j)
a'001010'b'010010' (-0.020097633629578483+0.020109000218747574j)
a'001010'b'100010' (-0.029046780636355237+0.0022664664055025863j)
a'001010'b'001100' (-0.07080902701598271+0.015386888123393207j)
a'001010'b'010100' (0.007250931889951695+0.01430812480500615j)
a'001010'b'100100' (0.01721867687574935-0.008708402573517439j)
a'001010'b'011000' (0.06697561543727899+0.08945854920940613j)
a'001010'b'101000' (0.03094042581757507-0.06748933696586577j)
a'001010'b'110000' (-0.0026508885557740168-0.0071189752772586315j)
a'010010'b'000011' (-0.06639338471194045-0.07562695481730605j)
a'010010'b'000101' (0.0012429975715675767+0.03988495592099847j)
a'010010'b'001001' (0.014351640289159674-0.048965868261771316j)
a'010010'b'010001' (0.03206583377862665-0.06515988895074136j)
a'010010'b'100001' (0.01658265669490842-0.08600696565950562j)
a'010010'b'000110' (-0.015585254776169035-0.035880962088553014j)
a'010010'b'001010' (-0.12732011682843236+0.048127036484993634j)
a'010010'b'010010' (0.07084309122476715+0.009618479238969543j)
a'010010'b'100010' (0.05933667487674782-0.0030391057038539854j)
a'010010'b'001100' (0.09665041030056697+0.02864757784079295j)
a'010010'b'010100' (-0.021839032092615746+0.05003790792881884j)
a'010010'b'100100' (0.04711558604044319-0.05562845897695551j)
a'010010'b'011000' (0.016482144623070936+0.040137012936379286j)
a'010010'b'101000' (0.009269591403193528-0.013031530135218902j)
a'010010'b'110000' (-0.07588252809025661+0.023822523828597987j)
a'100010'b'000011' (0.006337519880299134-0.007493830235293847j)
a'100010'b'000101' (0.07371664351309597+0.05176756386510369j)
a'100010'b'001001' (0.09357732970101515+0.056222931641773964j)
a'100010'b'010001' (-0.02961188029507719-0.011584519499048604j)
a'100010'b'100001' (0.0013562629967688367+0.0422630061224369j)
a'100010'b'000110' (0.06976497845186334-0.037854085297438576j)
a'100010'b'001010' (-0.024909132582260653+0.049952555516713903j)
a'100010'b'010010' (0.03514880736509953+0.005989546822412818j)
a'100010'b'100010' (-0.09065334577687457-0.04188159693170727j)
a'100010'b'001100' (0.010779266351281472+0.052921557010066005j)
a'100010'b'010100' (-0.07077869595190459+0.052084187190034j)
a'100010'b'100100' (0.03211213713986079+0.01657959951425103j)
a'100010'b'011000' (-0.05960303537917973+0.03978848531076636j)
a'100010'b'101000' (0.12680743615342882+0.06050833152257962j)
a'100010'b'110000' (0.09296736717458651+0.05890325682760969j)
a'001100'b'000011' (-0.09285927906713128-0.002335481300091979j)
a'001100'b'000101' (0.010134281064649359-0.023907148070132878j)
a'001100'b'001001' (0.024503133446528637+0.03317088284457556j)
a'001100'b'010001' (0.12268271714004252-0.02396014926530931j)
a'001100'b'100001' (0.042741966015192145+0.03861313051230559j)
a'001100'b'000110' (-0.029768970141412495+0.009242290753245485j)
a'001100'b'001010' (-0.039518786553113465-0.08413698325734092j)
a'001100'b'010010' (0.012318964357754167-0.04867721893047969j)
a'001100'b'100010' (0.04747455934235957+0.07920040502546788j)
a'001100'b'001100' (0.0037842929403928494-0.03446800932111331j)
a'001100'b'010100' (-0.0005493395875658212+0.01259191861157392j)
a'001100'b'100100' (-0.011243191231834117+0.07100167679628504j)
a'001100'b'011000' (-0.07352423700185255-0.03888467719879054j)
a'001100'b'101000' (-0.041728130076913124-0.004307271028351782j)
a'001100'b'110000' (-0.027823891501501892-0.03126952790915323j)
a'010100'b'000011' (0.09243991098151219+0.013203589641165626j)
a'010100'b'000101' (-0.020074089690841505+0.043710674117072454j)
a'010100'b'001001' (0.022721628545267658-0.012176083439685879j)
a'010100'b'010001' (0.002212187741202068+0.0276279528609529j)
a'010100'b'100001' (-0.05662471530397453+0.019142093523359518j)
a'010100'b'000110' (-0.08887478862478393-0.14283024427409566j)
a'010100'b'001010' (-0.05783145074168637+0.010831522379492762j)
a'010100'b'010010' (-0.03940914823011109-0.04863425263637839j)
a'010100'b'100010' (0.05145151074180999+0.009155291396125335j)
a'010100'b'001100' (0.04780926474875346+0.007777670629438371j)
a'010100'b'010100' (0.06819925402547143+0.09476024631065925j)
a'010100'b'100100' (0.025284786336621727+0.013053924996583166j)
a'010100'b'011000' (0.009845296820625396-0.06559095608156185j)
a'010100'b'101000' (0.02445388540194549-0.01859874768306263j)
a'010100'b'110000' (0.006156822274412414+0.030851093130273885j)
a'100100'b'000011' (-0.0991303986289533-0.010807573843416714j)
a'100100'b'000101' (-0.04798632385596511+0.00444942807068261j)
a'100100'b'001001' (0.0016111390132912539+0.01670016020391133j)
a'100100'b'010001' (-0.02516063479851652+0.005531522158827896j)
a'100100'b'100001' (0.0658983656992506+0.047219399244260746j)
a'100100'b'000110' (-0.11435947989271626-0.017464807114335155j)
a'100100'b'001010' (-0.03746981550982627-0.04455805062938098j)
a'100100'b'010010' (0.029060560667731047-0.02679223333735117j)
a'100100'b'100010' (-0.0781585303208439-0.04056751810222527j)
a'100100'b'001100' (-0.011472198277324014+0.0342626538548499j)
a'100100'b'010100' (-0.0664465422225771+0.05460903605414621j)
a'100100'b'100100' (0.08923503598715936-0.07112952552966427j)
a'100100'b'011000' (0.014209068976843339-0.03132367339985883j)
a'100100'b'101000' (0.02138890400761374+0.06312110200834894j)
a'100100'b'110000' (0.01787489033544889-0.008886790610367127j)
a'011000'b'000011' (-0.018204505855432176+0.020582972742925844j)
a'011000'b'000101' (-0.012010185044956495+0.04632595166416851j)
a'011000'b'001001' (0.013356230588291182+0.0007478533744554352j)
a'011000'b'010001' (-0.009043448322273693+0.062250319232071166j)
a'011000'b'100001' (-0.05572559658105173+0.017824614658145072j)
a'011000'b'000110' (-0.008851517285355706-0.017790518601463565j)
a'011000'b'001010' (-0.0018402530672236455+0.07372005660444922j)
a'011000'b'010010' (-0.07347797506514817-0.073297764100451j)
a'011000'b'100010' (0.015777196863896642-0.01122387604675919j)
a'011000'b'001100' (0.005834141157974904+0.020503633219762982j)
a'011000'b'010100' (0.034088203498651215-0.00495225632805145j)
a'011000'b'100100' (0.030295269896470956-0.018216733967518686j)
a'011000'b'011000' (0.0554702594676195+0.030045702632012897j)
a'011000'b'101000' (-0.04330614327527314-0.04393504012543499j)
a'011000'b'110000' (0.008089302171462271+0.04515457313859626j)
a'101000'b'000011' (-0.04732311259028025+0.04933614972429775j)
a'101000'b'000101' (0.017913392296540067-0.06799792901428943j)
a'101000'b'001001' (-0.06520982332786557+0.07500982204907057j)
a'101000'b'010001' (-0.006621883136394839-0.022185265237310316j)
a'101000'b'100001' (0.07844924266845414-0.000745391745276888j)
a'101000'b'000110' (-0.02777319338541305-0.03667355524182681j)
a'101000'b'001010' (0.06750876722345853-0.024411211426328273j)
a'101000'b'010010' (-0.01398989475808668+0.01488691255645398j)
a'101000'b'100010' (-0.05078233205439255+0.014412439815917211j)
a'101000'b'001100' (0.04379442565815401-0.02431571570840617j)
a'101000'b'010100' (0.04627724033291412+0.014708649562604969j)
a'101000'b'100100' (-0.03303135819214325-0.03361156658023255j)
a'101000'b'011000' (-0.005213046710155377+0.0061319607907801945j)
a'101000'b'101000' (0.0019661555260181334-0.019321747470669674j)
a'101000'b'110000' (-0.009550163261296582-0.026676408936738612j)
a'110000'b'000011' (-0.06849225983275621+0.0058273125336597235j)
a'110000'b'000101' (0.015431104419980794-0.05271571927376008j)
a'110000'b'001001' (0.0018087429826116285-0.0713362873765286j)
a'110000'b'010001' (0.012491135734367316+0.015901479741674676j)
a'110000'b'100001' (0.046937656449241846+0.07013578745613651j)
a'110000'b'000110' (-0.09312849600852924-0.004928835463317097j)
a'110000'b'001010' (0.01849674923240162-0.02490338107928327j)
a'110000'b'010010' (-0.030610888355780456-0.08391349079301781j)
a'110000'b'100010' (-0.03888099584540719-0.033057284138937236j)
a'110000'b'001100' (-0.006301883054745549-0.023404786687086628j)
a'110000'b'010100' (-0.058258447311861784-0.000242923426552397j)
a'110000'b'100100' (-0.1019647861672978+0.0013960255790158266j)
a'110000'b'011000' (0.04192990398053041-0.047199964152071845j)
a'110000'b'101000' (0.023712675517740676+0.08769864564128048j)
a'110000'b'110000' (-0.01708152991123998-0.05209916866687125j)

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)) @ cirq_wfn
# recover a fqe wavefunction
from_cirq_wfn = fqe.from_cirq(final_cirq_wfn.flatten(), 1.0E-8)
/tmpfs/src/tf_docs_env/lib/python3.7/site-packages/scipy/sparse/_index.py:82: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil_matrix is more efficient.
  self._set_intXint(row, col, x.flat[0])
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.022112232002943266-0.029954155169930458j)
a'000011'b'000101' (0.052094204353744226+0.010739055509277336j)
a'000011'b'001001' (0.01258078685247764+0.020359793419049046j)
a'000011'b'010001' (0.07074785902184148+0.009693359863973596j)
a'000011'b'100001' (0.004001366485983721-0.029727027058320504j)
a'000011'b'000110' (-0.03605146054413515+0.0434032591232045j)
a'000011'b'001010' (0.08528440548983716+0.01210875511732781j)
a'000011'b'010010' (0.021850629864306234+0.02159410041440543j)
a'000011'b'100010' (-0.02015007562437925-0.05496836290751923j)
a'000011'b'001100' (0.028229697826768867-0.059044690318210226j)
a'000011'b'010100' (-0.10518379476231329+0.09303493515429079j)
a'000011'b'100100' (0.030487980194222282-0.007679153942292858j)
a'000011'b'011000' (0.00961254921369865+0.030238698045195155j)
a'000011'b'101000' (-0.10804488073116707+0.05318220821010168j)
a'000011'b'110000' (-0.028632970464827198-0.030955128327353185j)
a'000101'b'000011' (-0.015958279443737206-0.02932408513769836j)
a'000101'b'000101' (0.04226572130808633-0.04317408640450988j)
a'000101'b'001001' (-0.055674236828334084-0.07822579059028825j)
a'000101'b'010001' (0.017572182187310666-0.04253709968620639j)
a'000101'b'100001' (-0.003253561395176019+0.1092689427264791j)
a'000101'b'000110' (-0.08794670888950137+0.006782963721534464j)
a'000101'b'001010' (-0.023033789340155063+0.018322927711493193j)
a'000101'b'010010' (-0.04858336514920034+0.021911012415364833j)
a'000101'b'100010' (-0.08987829432859695-0.011252392366489464j)
a'000101'b'001100' (0.05365576735571126-0.04948303939276264j)
a'000101'b'010100' (-0.029957075735507776+0.030046458730058914j)
a'000101'b'100100' (-0.02689008950205295+0.009848729281389336j)
a'000101'b'011000' (0.07450189744049363+0.038887198534254624j)
a'000101'b'101000' (0.004797794570868456+0.020662179493086418j)
a'000101'b'110000' (0.0027842044014078056+0.039390379765255466j)
a'001001'b'000011' (-0.009201798901970055+0.021945153567846393j)
a'001001'b'000101' (-0.007071900293668099+0.04589116805675618j)
a'001001'b'001001' (0.02185652710101749-0.026870743932258016j)
a'001001'b'010001' (-0.0022714806248683855-0.10338983215110384j)
a'001001'b'100001' (0.044288900218969765+0.017316488675575566j)
a'001001'b'000110' (0.08755469018902093+0.049089331649189494j)
a'001001'b'001010' (-0.0812543975681155-0.028700118235431563j)
a'001001'b'010010' (-0.07584523553401082-0.023666382216727393j)
a'001001'b'100010' (-0.03865172713512291+0.013013638530245262j)
a'001001'b'001100' (-0.022324492120643413+0.02058186773454718j)
a'001001'b'010100' (-0.03817869755034662-0.013294085817550544j)
a'001001'b'100100' (-0.049448743785237725+0.0063507635762061025j)
a'001001'b'011000' (-0.024536644501018723-0.015013543918324247j)
a'001001'b'101000' (-0.013183694642110833-0.0064834936737901755j)
a'001001'b'110000' (0.08362306985571259+0.010702985410955447j)
a'010001'b'000011' (0.010273536095149874-0.034491034554391155j)
a'010001'b'000101' (-0.014250982010317399-0.061061169609337974j)
a'010001'b'001001' (-0.06414324238211681+0.04969944763476854j)
a'010001'b'010001' (0.053414979119008735+0.013712184487410916j)
a'010001'b'100001' (-0.03159384612240038-0.07988477236760329j)
a'010001'b'000110' (0.008273439096859028-0.05578035339718896j)
a'010001'b'001010' (0.07903285982052755+0.17453571099856194j)
a'010001'b'010010' (0.06808664841080185-0.01344904896919013j)
a'010001'b'100010' (0.05872962636201983-0.010781914679599434j)
a'010001'b'001100' (-0.05336508642959143+0.0009526810335270929j)
a'010001'b'010100' (-0.002688736968952316-0.009115017796004689j)
a'010001'b'100100' (-0.05673006568378795-0.048847592648082985j)
a'010001'b'011000' (-0.00896848211368436+0.07692989334003122j)
a'010001'b'101000' (0.05056865456189104-0.02778885660307085j)
a'010001'b'110000' (0.0031348808789952477+0.05792852201457654j)
a'100001'b'000011' (0.05950975234279227+0.008461209524395413j)
a'100001'b'000101' (-0.059046396323938065+0.03580185313990112j)
a'100001'b'001001' (-0.005289627135184112+0.10378777064621916j)
a'100001'b'010001' (-0.006975669923005744-0.004445816864218855j)
a'100001'b'100001' (-0.0030124132194990173-0.044571563592085126j)
a'100001'b'000110' (0.01628004489139348+0.011782271328894901j)
a'100001'b'001010' (0.0007089491902587805-0.008125286181551726j)
a'100001'b'010010' (0.03473158515829097-0.004974751054620847j)
a'100001'b'100010' (-0.022505252534758022+0.015296544121061396j)
a'100001'b'001100' (-0.007749857502954114+0.041680994512381456j)
a'100001'b'010100' (0.03769408961261937-0.058644601317655455j)
a'100001'b'100100' (0.029850764857427443+0.0007739008335096061j)
a'100001'b'011000' (-0.038390373131912126+0.010702639924486765j)
a'100001'b'101000' (0.02806151584091425+0.03419927681006822j)
a'100001'b'110000' (-0.014859589087091734-0.04206852172502619j)
a'000110'b'000011' (-0.061203587114588516+0.04424510257888753j)
a'000110'b'000101' (0.0630113214315204+0.02663565118999485j)
a'000110'b'001001' (-0.012516012939648208-0.08729118927149133j)
a'000110'b'010001' (-0.013138507463418169-0.035982811678107685j)
a'000110'b'100001' (-0.09527355306635224-0.0014469383423194246j)
a'000110'b'000110' (0.10180476781182352+0.006789167380714847j)
a'000110'b'001010' (-0.019119415476732494+0.018876551186507887j)
a'000110'b'010010' (0.08718631870619802+0.05286158515628205j)
a'000110'b'100010' (0.03731033777407902+0.005669810866977662j)
a'000110'b'001100' (-0.06845752885493431+0.056356152526087465j)
a'000110'b'010100' (0.052596887144602124+0.009829682763084744j)
a'000110'b'100100' (0.00845957992057842+0.07871845315780814j)
a'000110'b'011000' (-0.040545953010024685+0.03154490619662321j)
a'000110'b'101000' (-0.03708599760932474+0.06916176724983944j)
a'000110'b'110000' (0.003183662812371405+0.00017959710245642419j)
a'001010'b'000011' (0.0301467269015323+0.09985347488442416j)
a'001010'b'000101' (0.009246700403994817-0.004350120383010169j)
a'001010'b'001001' (-0.01730427018699618+0.08584284795869325j)
a'001010'b'010001' (-0.028478834114974608+0.008579128707319448j)
a'001010'b'100001' (0.027832495719430493+0.08554698913881241j)
a'001010'b'000110' (0.0030348796171830944-0.02443819818633181j)
a'001010'b'001010' (0.043759987872827935+0.013108444606654529j)
a'001010'b'010010' (0.028425236581613826-0.0005410107075068758j)
a'001010'b'100010' (-0.009785663269037782+0.027442542332823647j)
a'001010'b'001100' (0.0721894892219523+0.0062731394808042025j)
a'001010'b'010100' (0.004419038706065824+0.01541981016817791j)
a'001010'b'100100' (-0.004771795429836263-0.018696231628585056j)
a'001010'b'011000' (0.006522367744194471+0.11156174886072517j)
a'001010'b'101000' (-0.07373823337126542+0.00864832314092413j)
a'001010'b'110000' (-0.0049038285194725134-0.0058016794969182215j)
a'010010'b'000011' (-0.09926654617146144-0.016542993672116993j)
a'010010'b'000101' (-0.00183991946168403+0.03986187963653282j)
a'010010'b'001001' (0.023515227919329196+0.04528421236502382j)
a'010010'b'010001' (0.022933830334297557-0.06890622794921451j)
a'010010'b'100001' (-0.0843775218827211+0.023507795429335655j)
a'010010'b'000110' (-0.038336472576922936-0.007788355230542183j)
a'010010'b'001010' (0.12508784508737075+0.05366241516584499j)
a'010010'b'010010' (-0.0709387495941985+0.00888552323517132j)
a'010010'b'100010' (-0.03326048065043859-0.04923228184646606j)
a'010010'b'001100' (0.08950319737859656+0.046380633743193025j)
a'010010'b'010100' (0.03335831436483695-0.04321988449049769j)
a'010010'b'100100' (0.036918905421323825+0.06286014889082407j)
a'010010'b'011000' (-0.04100408415106373-0.014188233919814943j)
a'010010'b'101000' (0.0043121079158908076-0.015399734665538548j)
a'010010'b'110000' (-0.022098689640718636-0.0764023469999181j)
a'100010'b'000011' (0.008991404954984334+0.003933991200304609j)
a'100010'b'000101' (0.08952348755753843-0.009978445515195132j)
a'100010'b'001001' (0.06272035716243667+0.08935262432511124j)
a'100010'b'010001' (0.002834885993758793+0.03167061679279719j)
a'100010'b'100001' (-0.014850394371090552-0.03959124805868873j)
a'100010'b'000110' (0.04770109701489056+0.06344043927709443j)
a'100010'b'001010' (0.03543685209178601+0.043127163162859486j)
a'100010'b'010010' (-0.013032827103592104-0.03318823207124213j)
a'100010'b'100010' (-0.09962990272297678-0.006780836637299552j)
a'100010'b'001100' (0.053999995955532266+0.0009403277322468581j)
a'100010'b'010100' (-0.02574914781427095-0.08402004369635546j)
a'100010'b'100100' (0.0073347206897608+0.03538748852554209j)
a'100010'b'011000' (-0.042619443717904576+0.05761274517772247j)
a'100010'b'101000' (-0.06816356520601603-0.12286216840776304j)
a'100010'b'110000' (0.10995161843525052+0.004813172315926678j)
a'001100'b'000011' (-0.025347878232731606-0.08936322090697638j)
a'001100'b'000101' (0.025409543014846474+0.005348878884517337j)
a'001100'b'001001' (0.023897741319679096+0.033609656011400244j)
a'001100'b'010001' (0.02507897216986441+0.12245890328017299j)
a'001100'b'100001' (-0.043636193987901424-0.03759962873559288j)
a'001100'b'000110' (0.011010853496067566-0.02916114927323634j)
a'001100'b'001010' (0.012829245002763681+0.09206615510020866j)
a'001100'b'010010' (0.021288013571570917-0.04547580679691215j)
a'001100'b'100010' (0.08760369253628109-0.029191282859067833j)
a'001100'b'001100' (-0.025378306652749934-0.02362850166764812j)
a'001100'b'010100' (-0.0010637945384039576+0.01255892230579641j)
a'001100'b'100100' (-0.05928980192792928-0.04064931542236137j)
a'001100'b'011000' (0.038886258477902995-0.0735234006908579j)
a'001100'b'101000' (0.03331067520040692-0.025498790973700246j)
a'001100'b'110000' (0.04102238293582289-0.008313628101819948j)
a'010100'b'000011' (0.09114467340645609+0.02030074952588325j)
a'010100'b'000101' (0.04771165411183561+0.006098374422533848j)
a'010100'b'001001' (0.01238297426093451+0.02260954135165833j)
a'010100'b'010001' (0.0013927307778460918-0.027681362951809292j)
a'010100'b'100001' (0.008774620041436696+0.05912515683566198j)
a'010100'b'000110' (-0.014771542847165767-0.16757388893981126j)
a'010100'b'001010' (-0.05883637379988962-0.00028229421745918845j)
a'010100'b'010010' (0.02639052719886026+0.05676188481620536j)
a'010100'b'100010' (-0.025654138854163375+0.045529578054423696j)
a'010100'b'001100' (0.04745122683838378+0.009726203152755738j)
a'010100'b'010100' (-0.06151870791115345+0.0992274715360105j)
a'010100'b'100100' (-0.024252210131233562-0.01488474661039024j)
a'010100'b'011000' (0.06498760566293212-0.013255734584655229j)
a'010100'b'101000' (0.003770170231067854+0.030490846873422205j)
a'010100'b'110000' (-0.03077233808080158-0.006539083796097332j)
a'100100'b'000011' (-0.08146735214830858+0.05750400089262985j)
a'100100'b'000101' (-0.035291953466800426-0.03281710998645274j)
a'100100'b'001001' (-0.002002537848383145-0.016657759811038394j)
a'100100'b'010001' (0.0009721761631653414+0.025743157428056437j)
a'100100'b'100001' (0.02086751725223357+0.07833781328674418j)
a'100100'b'000110' (-0.11244873319379302-0.027173379105011067j)
a'100100'b'001010' (-0.051616667701712235+0.02692817419733303j)
a'100100'b'010010' (0.015675305272806826+0.036285324280351444j)
a'100100'b'100010' (-0.01768587678233373-0.08626522560875124j)
a'100100'b'001100' (-0.026013844241231605-0.02507629737988519j)
a'100100'b'010100' (0.07029631413801353-0.04955520165138542j)
a'100100'b'100100' (0.036800556309553666-0.10801860999389014j)
a'100100'b'011000' (0.019921628734439062+0.0280392379535694j)
a'100100'b'101000' (-0.00208773741905232-0.06661381302601134j)
a'100100'b'110000' (-0.019463361532052637+0.004434445819879529j)
a'011000'b'000011' (-0.0010963306305003077-0.02745652671998263j)
a'011000'b'000101' (-0.046433648115657485-0.011586831537407962j)
a'011000'b'001001' (0.011357424962092303-0.0070680321467670336j)
a'011000'b'010001' (0.015341564151717764+0.061004283549855216j)
a'011000'b'100001' (-0.056827202716541306+0.013918621822529894j)
a'011000'b'000110' (-0.0053333346970689905-0.019141772419789448j)
a'011000'b'001010' (-0.04219746084767298+0.06047650432294951j)
a'011000'b'010010' (0.1035747105364467-0.006622263894709254j)
a'011000'b'100010' (0.011047466396766082-0.015901220726959577j)
a'011000'b'001100' (-0.020503758690080573+0.0058337001843332915j)
a'011000'b'010100' (0.016346916681712596+0.030320105136778935j)
a'011000'b'100100' (0.0005011203623199595+0.03534687614098078j)
a'011000'b'011000' (-0.04785157534655611+0.04110864469803451j)
a'011000'b'101000' (0.04736531176303559-0.039525144374088154j)
a'011000'b'110000' (0.006067696956388559+0.045470378694216926j)
a'101000'b'000011' (-0.06326937649345571+0.02589437492931673j)
a'101000'b'000101' (-0.016312998692755938+0.06839951788903365j)
a'101000'b'001001' (-0.047669095076687824+0.08721497484293843j)
a'101000'b'010001' (-0.005067985208856809-0.022590946324682577j)
a'101000'b'100001' (0.043604326010367324+0.06521887792111684j)
a'101000'b'000110' (-0.0418189306025667+0.01916968878611714j)
a'101000'b'001010' (-0.05594489565238017-0.04498343634913083j)
a'101000'b'010010' (-0.008125904682474032+0.018743185265509037j)
a'101000'b'100010' (0.04972142086809178+0.01772974836787336j)
a'101000'b'001100' (-0.01517389183605428+0.047738441068884266j)
a'101000'b'010100' (-0.035994396066765466+0.03259341646060801j)
a'101000'b'100100' (0.02181633138851006+0.04177147012904606j)
a'101000'b'011000' (-0.0056799299787846525-0.005702209622421021j)
a'101000'b'101000' (0.018149741010938313+0.0069124955051476245j)
a'101000'b'110000' (-0.0016040323910740707-0.0282889287914179j)
a'110000'b'000011' (0.035756723165583634+0.05870778463562182j)
a'110000'b'000101' (-0.049134372757148354-0.02455360372596713j)
a'110000'b'001001' (0.006749694635624675-0.07103927836183055j)
a'110000'b'010001' (0.002924292809775384+0.02000834929403159j)
a'110000'b'100001' (-0.06690544183488814+0.051437672263797175j)
a'110000'b'000110' (0.03544711736458227-0.08625956212720197j)
a'110000'b'001010' (0.008976773562954619-0.029693865658512578j)
a'110000'b'010010' (0.0845849179802793-0.02870352022434463j)
a'110000'b'100010' (-0.050176577517144424-0.009318097511777673j)
a'110000'b'001100' (0.023397420816939272+0.006329176014203835j)
a'110000'b'010100' (0.02325098095985461-0.05341813904831035j)
a'110000'b'100100' (0.0994340267670289+0.022619478916496013j)
a'110000'b'011000' (0.0439929621621326-0.045283250148090495j)
a'110000'b'101000' (-0.0020956302039044153+0.09082374007699215j)
a'110000'b'110000' (-0.054114171280124065-0.008818078393453022j)
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.022112232002943284-0.029954155169930413j)
a'000011'b'000101' (0.05209420435374421+0.010739055509277316j)
a'000011'b'001001' (0.012580786852477627+0.020359793419049026j)
a'000011'b'010001' (0.07074785902184146+0.009693359863973634j)
a'000011'b'100001' (0.004001366485983732-0.029727027058320494j)
a'000011'b'000110' (-0.03605146054413508+0.04340325912320452j)
a'000011'b'001010' (0.08528440548983712+0.012108755117327875j)
a'000011'b'010010' (0.02185062986430625+0.0215941004144054j)
a'000011'b'100010' (-0.02015007562437938-0.0549683629075192j)
a'000011'b'001100' (0.02822969782676886-0.05904469031821019j)
a'000011'b'010100' (-0.10518379476231329+0.0930349351542908j)
a'000011'b'100100' (0.03048798019422229-0.007679153942292858j)
a'000011'b'011000' (0.009612549213698661+0.03023869804519514j)
a'000011'b'101000' (-0.10804488073116704+0.05318220821010164j)
a'000011'b'110000' (-0.02863297046482719-0.030955128327353195j)
a'000101'b'000011' (-0.015958279443737206-0.029324085137698356j)
a'000101'b'000101' (0.042265721308086354-0.0431740864045099j)
a'000101'b'001001' (-0.05567423682833453-0.07822579059028793j)
a'000101'b'010001' (0.0175721821873107-0.04253709968620638j)
a'000101'b'100001' (-0.003253561395175908+0.10926894272647909j)
a'000101'b'000110' (-0.08794670888950139+0.0067829637215344706j)
a'000101'b'001010' (-0.023033789340155066+0.018322927711493187j)
a'000101'b'010010' (-0.04858336514920033+0.021911012415364844j)
a'000101'b'100010' (-0.08987829432859695-0.011252392366489464j)
a'000101'b'001100' (0.05365576735571128-0.04948303939276265j)
a'000101'b'010100' (-0.029957075735507786+0.03004645873005892j)
a'000101'b'100100' (-0.02689008950205296+0.009848729281389341j)
a'000101'b'011000' (0.07450189744049364+0.0388871985342546j)
a'000101'b'101000' (0.004797794570868481+0.020662179493086408j)
a'000101'b'110000' (0.002784204401407823+0.039390379765255466j)
a'001001'b'000011' (-0.00920179890197005+0.021945153567846386j)
a'001001'b'000101' (-0.007071900293667839+0.04589116805675621j)
a'001001'b'001001' (0.021856527101017473-0.026870743932257996j)
a'001001'b'010001' (-0.002271480624868545-0.10338983215110381j)
a'001001'b'100001' (0.04428890021896976+0.017316488675575593j)
a'001001'b'000110' (0.08755469018902091+0.049089331649189494j)
a'001001'b'001010' (-0.08125439756811549-0.028700118235431542j)
a'001001'b'010010' (-0.07584523553401083-0.02366638221672735j)
a'001001'b'100010' (-0.03865172713512291+0.013013638530245262j)
a'001001'b'001100' (-0.022324492120643403+0.02058186773454717j)
a'001001'b'010100' (-0.03817869755034661-0.013294085817550526j)
a'001001'b'100100' (-0.04944874378523772+0.0063507635762061546j)
a'001001'b'011000' (-0.024536644501018695-0.01501354391832425j)
a'001001'b'101000' (-0.013183694642110846-0.0064834936737901295j)
a'001001'b'110000' (0.08362306985571259+0.010702985410955445j)
a'010001'b'000011' (0.010273536095149895-0.03449103455439113j)
a'010001'b'000101' (-0.01425098201031733-0.06106116960933799j)
a'010001'b'001001' (-0.06414324238211674+0.04969944763476858j)
a'010001'b'010001' (0.05341497911900869+0.013712184487410963j)
a'010001'b'100001' (-0.03159384612240037-0.07988477236760332j)
a'010001'b'000110' (0.008273439096859028-0.05578035339718897j)
a'010001'b'001010' (0.0790328598205276+0.17453571099856185j)
a'010001'b'010010' (0.06808664841080182-0.013449048969190094j)
a'010001'b'100010' (0.05872962636201985-0.010781914679599418j)
a'010001'b'001100' (-0.05336508642959143+0.0009526810335270875j)
a'010001'b'010100' (-0.002688736968952315-0.009115017796004689j)
a'010001'b'100100' (-0.056730065683787995-0.048847592648083j)
a'010001'b'011000' (-0.008968482113684364+0.0769298933400312j)
a'010001'b'101000' (0.05056865456189104-0.02778885660307086j)
a'010001'b'110000' (0.0031348808789952616+0.05792852201457653j)
a'100001'b'000011' (0.05950975234279225+0.008461209524395424j)
a'100001'b'000101' (-0.059046396323938044+0.035801853139901196j)
a'100001'b'001001' (-0.005289627135184195+0.10378777064621916j)
a'100001'b'010001' (-0.006975669923005743-0.004445816864218859j)
a'100001'b'100001' (-0.0030124132194990407-0.044571563592085126j)
a'100001'b'000110' (0.01628004489139349+0.011782271328894901j)
a'100001'b'001010' (0.0007089491902587805-0.008125286181551726j)
a'100001'b'010010' (0.03473158515829098-0.004974751054620839j)
a'100001'b'100010' (-0.02250525253475804+0.015296544121061385j)
a'100001'b'001100' (-0.007749857502954067+0.04168099451238146j)
a'100001'b'010100' (0.03769408961261936-0.0586446013176555j)
a'100001'b'100100' (0.029850764857427443+0.0007739008335096217j)
a'100001'b'011000' (-0.03839037313191212+0.010702639924486763j)
a'100001'b'101000' (0.028061515840914274+0.03419927681006817j)
a'100001'b'110000' (-0.014859589087091772-0.04206852172502619j)
a'000110'b'000011' (-0.06120358711458844+0.0442451025788876j)
a'000110'b'000101' (0.06301132143152043+0.026635651189994836j)
a'000110'b'001001' (-0.012516012939648208-0.08729118927149133j)
a'000110'b'010001' (-0.013138507463418176-0.03598281167810768j)
a'000110'b'100001' (-0.09527355306635225-0.0014469383423194246j)
a'000110'b'000110' (0.10180476781182352+0.0067891673807148264j)
a'000110'b'001010' (-0.019119415476732498+0.018876551186507887j)
a'000110'b'010010' (0.08718631870619804+0.052861585156282025j)
a'000110'b'100010' (0.03731033777407902+0.005669810866977668j)
a'000110'b'001100' (-0.06845752885493434+0.05635615252608747j)
a'000110'b'010100' (0.05259688714460214+0.009829682763084758j)
a'000110'b'100100' (0.008459579920578426+0.07871845315780815j)
a'000110'b'011000' (-0.0405459530100247+0.03154490619662321j)
a'000110'b'101000' (-0.03708599760932477+0.06916176724983941j)
a'000110'b'110000' (0.0031836628123714053+0.00017959710245642419j)
a'001010'b'000011' (0.030146726901532205+0.09985347488442414j)
a'001010'b'000101' (0.009246700403994815-0.004350120383010167j)
a'001010'b'001001' (-0.017304270186996155+0.0858428479586932j)
a'001010'b'010001' (-0.028478834114974594+0.008579128707319457j)
a'001010'b'100001' (0.02783249571943048+0.0855469891388124j)
a'001010'b'000110' (0.003034879617183091-0.024438198186331812j)
a'001010'b'001010' (0.04375998787282794+0.013108444606654533j)
a'001010'b'010010' (0.028425236581613826-0.0005410107075068914j)
a'001010'b'100010' (-0.009785663269037787+0.027442542332823647j)
a'001010'b'001100' (0.07218948922195229+0.0062731394808041505j)
a'001010'b'010100' (0.004419038706065822+0.01541981016817791j)
a'001010'b'100100' (-0.004771795429836257-0.01869623162858506j)
a'001010'b'011000' (0.006522367744194471+0.11156174886072517j)
a'001010'b'101000' (-0.07373823337126541+0.008648323140924119j)
a'001010'b'110000' (-0.004903828519472514-0.005801679496918222j)
a'010010'b'000011' (-0.09926654617146141-0.016542993672116868j)
a'010010'b'000101' (-0.0018399194616840217+0.03986187963653282j)
a'010010'b'001001' (0.023515227919329203+0.04528421236502381j)
a'010010'b'010001' (0.022933830334297592-0.06890622794921451j)
a'010010'b'100001' (-0.0843775218827211+0.023507795429335634j)
a'010010'b'000110' (-0.038336472576922936-0.007788355230542174j)
a'010010'b'001010' (0.1250878450873708+0.05366241516584491j)
a'010010'b'010010' (-0.07093874959419852+0.008885523235171252j)
a'010010'b'100010' (-0.033260480650438684-0.04923228184646602j)
a'010010'b'001100' (0.08950319737859656+0.04638063374319306j)
a'010010'b'010100' (0.03335831436483692-0.04321988449049773j)
a'010010'b'100100' (0.036918905421323846+0.06286014889082409j)
a'010010'b'011000' (-0.04100408415106375-0.014188233919814953j)
a'010010'b'101000' (0.004312107915890806-0.015399734665538544j)
a'010010'b'110000' (-0.022098689640718563-0.07640234699991814j)
a'100010'b'000011' (0.008991404954984345+0.003933991200304589j)
a'100010'b'000101' (0.08952348755753847-0.009978445515195118j)
a'100010'b'001001' (0.06272035716243667+0.08935262432511124j)
a'100010'b'010001' (0.002834885993758772+0.03167061679279721j)
a'100010'b'100001' (-0.01485039437109052-0.03959124805868875j)
a'100010'b'000110' (0.04770109701489056+0.06344043927709447j)
a'100010'b'001010' (0.035436852091786014+0.04312716316285949j)
a'100010'b'010010' (-0.013032827103592161-0.03318823207124212j)
a'100010'b'100010' (-0.09962990272297687-0.006780836637299552j)
a'100010'b'001100' (0.05399999595553228+0.0009403277322468911j)
a'100010'b'010100' (-0.02574914781427094-0.08402004369635548j)
a'100010'b'100100' (0.007334720689760798+0.03538748852554211j)
a'100010'b'011000' (-0.042619443717904576+0.05761274517772248j)
a'100010'b'101000' (-0.06816356520601596-0.1228621684077631j)
a'100010'b'110000' (0.10995161843525056+0.004813172315926713j)
a'001100'b'000011' (-0.02534787823273156-0.08936322090697636j)
a'001100'b'000101' (0.025409543014846478+0.005348878884517339j)
a'001100'b'001001' (0.023897741319679075+0.03360965601140022j)
a'001100'b'010001' (0.025078972169864412+0.12245890328017293j)
a'001100'b'100001' (-0.04363619398790145-0.03759962873559283j)
a'001100'b'000110' (0.01101085349606758-0.029161149273236334j)
a'001100'b'001010' (0.01282924500276372+0.09206615510020863j)
a'001100'b'010010' (0.021288013571570924-0.045475806796912134j)
a'001100'b'100010' (0.0876036925362811-0.029191282859067774j)
a'001100'b'001100' (-0.025378306652749937-0.02362850166764811j)
a'001100'b'010100' (-0.0010637945384039515+0.012558922305796407j)
a'001100'b'100100' (-0.059289801927929334-0.04064931542236129j)
a'001100'b'011000' (0.038886258477902946-0.07352340069085792j)
a'001100'b'101000' (0.033310675200406877-0.025498790973700267j)
a'001100'b'110000' (0.041022382935822874-0.008313628101819955j)
a'010100'b'000011' (0.0911446734064561+0.020300749525883233j)
a'010100'b'000101' (0.04771165411183563+0.0060983744225338535j)
a'010100'b'001001' (0.012382974260934515+0.02260954135165833j)
a'010100'b'010001' (0.0013927307778460844-0.0276813629518093j)
a'010100'b'100001' (0.00877462004143671+0.05912515683566198j)
a'010100'b'000110' (-0.014771542847165753-0.1675738889398113j)
a'010100'b'001010' (-0.05883637379988963-0.00028229421745921447j)
a'010100'b'010010' (0.026390527198860314+0.056761884816205324j)
a'010100'b'100010' (-0.02565413885416338+0.0455295780544237j)
a'010100'b'001100' (0.04745122683838378+0.009726203152755719j)
a'010100'b'010100' (-0.061518707911153436+0.09922747153601053j)
a'010100'b'100100' (-0.024252210131233562-0.01488474661039024j)
a'010100'b'011000' (0.06498760566293212-0.013255734584655236j)
a'010100'b'101000' (0.0037701702310678556+0.030490846873422198j)
a'010100'b'110000' (-0.030772338080801577-0.00653908379609732j)
a'100100'b'000011' (-0.08146735214830858+0.05750400089262984j)
a'100100'b'000101' (-0.03529195346680044-0.03281710998645275j)
a'100100'b'001001' (-0.0020025378483831645-0.016657759811038394j)
a'100100'b'010001' (0.0009721761631653492+0.02574315742805644j)
a'100100'b'100001' (0.02086751725223354+0.0783378132867442j)
a'100100'b'000110' (-0.11244873319379305-0.02717337910501107j)
a'100100'b'001010' (-0.05161666770171225+0.02692817419733301j)
a'100100'b'010010' (0.01567530527280683+0.03628532428035146j)
a'100100'b'100010' (-0.017685876782333722-0.08626522560875129j)
a'100100'b'001100' (-0.02601384424123166-0.02507629737988516j)
a'100100'b'010100' (0.07029631413801357-0.04955520165138545j)
a'100100'b'100100' (0.03680055630955366-0.10801860999389021j)
a'100100'b'011000' (0.019921628734439072+0.028039237953569406j)
a'100100'b'101000' (-0.002087737419052306-0.06661381302601134j)
a'100100'b'110000' (-0.019463361532052637+0.004434445819879518j)
a'011000'b'000011' (-0.0010963306305003216-0.027456526719982617j)
a'011000'b'000101' (-0.04643364811565749-0.011586831537407943j)
a'011000'b'001001' (0.011357424962092303-0.00706803214676702j)
a'011000'b'010001' (0.015341564151717748+0.061004283549855196j)
a'011000'b'100001' (-0.056827202716541306+0.013918621822529896j)
a'011000'b'000110' (-0.0053333346970689905-0.019141772419789448j)
a'011000'b'001010' (-0.042197460847672966+0.06047650432294951j)
a'011000'b'010010' (0.10357471053644673-0.00662226389470922j)
a'011000'b'100010' (0.011047466396766082-0.01590122072695958j)
a'011000'b'001100' (-0.02050375869008057+0.005833700184333309j)
a'011000'b'010100' (0.0163469166817126+0.030320105136778942j)
a'011000'b'100100' (0.0005011203623199664+0.03534687614098078j)
a'011000'b'011000' (-0.04785157534655611+0.041108644698034505j)
a'011000'b'101000' (0.04736531176303554-0.03952514437408819j)
a'011000'b'110000' (0.006067696956388607+0.04547037869421692j)
a'101000'b'000011' (-0.06326937649345567+0.025894374929316715j)
a'101000'b'000101' (-0.01631299869275584+0.06839951788903363j)
a'101000'b'001001' (-0.04766909507668751+0.08721497484293854j)
a'101000'b'010001' (-0.005067985208856809-0.022590946324682563j)
a'101000'b'100001' (0.04360432601036736+0.06521887792111677j)
a'101000'b'000110' (-0.041818930602566695+0.01916968878611712j)
a'101000'b'001010' (-0.05594489565238015-0.04498343634913083j)
a'101000'b'010010' (-0.008125904682474032+0.018743185265509034j)
a'101000'b'100010' (0.049721420868091774+0.017729748367873402j)
a'101000'b'001100' (-0.015173891836054217+0.047738441068884266j)
a'101000'b'010100' (-0.03599439606676544+0.03259341646060801j)
a'101000'b'100100' (0.021816331388510034+0.04177147012904605j)
a'101000'b'011000' (-0.0056799299787846595-0.00570220962242101j)
a'101000'b'101000' (0.018149741010938306+0.006912495505147599j)
a'101000'b'110000' (-0.0016040323910740985-0.028288928791417884j)
a'110000'b'000011' (0.03575672316558361+0.058707784635621825j)
a'110000'b'000101' (-0.04913437275714837-0.024553603725967123j)
a'110000'b'001001' (0.00674969463562468-0.07103927836183051j)
a'110000'b'010001' (0.0029242928097753893+0.020008349294031585j)
a'110000'b'100001' (-0.06690544183488809+0.051437672263797245j)
a'110000'b'000110' (0.03544711736458228-0.08625956212720204j)
a'110000'b'001010' (0.008976773562954633-0.029693865658512578j)
a'110000'b'010010' (0.08458491798027933-0.02870352022434458j)
a'110000'b'100010' (-0.05017657751714444-0.009318097511777687j)
a'110000'b'001100' (0.023397420816939275+0.006329176014203839j)
a'110000'b'010100' (0.023250980959854593-0.05341813904831039j)
a'110000'b'100100' (0.09943402676702891+0.022619478916496058j)
a'110000'b'011000' (0.04399296216213253-0.04528325014809055j)
a'110000'b'101000' (-0.002095630203904325+0.09082374007699212j)
a'110000'b'110000' (-0.054114171280124065-0.008818078393452859j)
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