![]() |
![]() |
![]() |
![]() |
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.008704349542203248-0.9999621164319412j)
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')
initial_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.019429161322767043-0.03804936326722763j) a'000011'b'000101' (-0.005689360675342182-0.06955540185193701j) a'000011'b'001001' (-0.034072889239070335+0.07199768245028099j) a'000011'b'010001' (-0.03102872133355383-0.04595714475024226j) a'000011'b'100001' (0.05774045864528427-0.0017288265899140143j) a'000011'b'000110' (0.1133108121700768+0.022846067656375604j) a'000011'b'001010' (-0.03447837146238173-0.014724005568552918j) a'000011'b'010010' (4.388745455487042e-06+0.00676462088599196j) a'000011'b'100010' (-0.09273532649871193+0.04816115991708516j) a'000011'b'001100' (0.06108445608571976-0.08066905133150648j) a'000011'b'010100' (-0.07324829949510708-0.04272101501117571j) a'000011'b'100100' (-0.008887385947970486-0.003584535942239737j) a'000011'b'011000' (-0.0008772332666239603+0.03723205763085412j) a'000011'b'101000' (-0.09455136613039405-0.02681612178466961j) a'000011'b'110000' (0.07072232004846839+0.03758097638646211j) a'000101'b'000011' (0.0014677364192753595+0.05322230255645316j) a'000101'b'000101' (0.04877196734125964-0.05171355401252719j) a'000101'b'001001' (0.01919235762832143+0.013466358920231167j) a'000101'b'010001' (-0.002917582001880113-0.029928172765233997j) a'000101'b'100001' (0.03176230408515037+0.003956644236392997j) a'000101'b'000110' (0.004065397439386023-0.025327518020197975j) a'000101'b'001010' (0.020498209700131175+0.011891026159523827j) a'000101'b'010010' (0.032354541086649126+0.02111130236501781j) a'000101'b'100010' (0.028946569192628367-0.09654728233645159j) a'000101'b'001100' (0.01848428892404932+0.024087254968771704j) a'000101'b'010100' (-0.018634137942940388-0.02048030370458915j) a'000101'b'100100' (-0.048288105416325035+0.0257225460012587j) a'000101'b'011000' (-0.05461328178079441-0.0042851203951264575j) a'000101'b'101000' (-0.020653090000593954-0.026399155816856153j) a'000101'b'110000' (-0.02260534176991853-0.023759791696313582j) a'001001'b'000011' (-0.018899701361145445+0.11861881527603722j) a'001001'b'000101' (-0.05675815107355828-0.0018313485655984056j) a'001001'b'001001' (0.04135483182557254+0.045690710784760204j) a'001001'b'010001' (-0.09759248694105949+0.030940988817088615j) a'001001'b'100001' (0.016544316221751138-0.005651380519365913j) a'001001'b'000110' (-0.00955393628333119-0.06200127920951125j) a'001001'b'001010' (0.048971686184086+0.02230391900672059j) a'001001'b'010010' (-0.011167719695112226+0.04951675636540868j) a'001001'b'100010' (0.09413345237379916+0.026139244519570434j) a'001001'b'001100' (0.02531802415706393+0.043326011337687764j) a'001001'b'010100' (-0.02627615030926288-0.0077905378429427305j) a'001001'b'100100' (-0.0428014023197552+0.001735992790791113j) a'001001'b'011000' (-0.010924769656562168-0.01635999169121694j) a'001001'b'101000' (0.06548956708841903+0.03913185654873627j) a'001001'b'110000' (0.05956954336430526+0.08904187179000891j) a'010001'b'000011' (-0.03906566122473376-0.03086681103142231j) a'010001'b'000101' (-0.08115698435889704+0.04344506186881077j) a'010001'b'001001' (-0.06663402783845986+0.0002034269994401446j) a'010001'b'010001' (0.01424228935025258+0.11319911621380935j) a'010001'b'100001' (0.06683133204303507-0.05511208694202739j) a'010001'b'000110' (0.0030131006736458616-0.06946381466890299j) a'010001'b'001010' (-0.0587779437045912-0.010018846137014469j) a'010001'b'010010' (-0.06648071521546611-0.018924843874026636j) a'010001'b'100010' (-0.014436701402061242-0.0490023133254809j) a'010001'b'001100' (-0.020100200588402832-0.009597168137160831j) a'010001'b'010100' (-0.07172266461594183-0.031258768609846485j) a'010001'b'100100' (0.015574973530404372+0.030363252042544153j) a'010001'b'011000' (0.02859454449973237+0.05522756322993469j) a'010001'b'101000' (0.03373754888854838-0.07277577477117964j) a'010001'b'110000' (-0.00804428013738437+0.021159323909542012j) a'100001'b'000011' (0.01742572456533048-0.055050833418883734j) a'100001'b'000101' (0.0575045510658287+0.00945260229083204j) a'100001'b'001001' (-0.008079304458555241-0.09532497332245224j) a'100001'b'010001' (-0.027890858489215607-0.05992742453451447j) a'100001'b'100001' (0.0817584813344774+0.005943506014713702j) a'100001'b'000110' (-0.07259763502990271+0.01778943411279308j) a'100001'b'001010' (-0.04482921282024669+0.03605938656153954j) a'100001'b'010010' (-0.007709977991366992-0.06942711354255648j) a'100001'b'100010' (0.06979646285269361-0.010403428332701149j) a'100001'b'001100' (0.07331956506146077+0.13934681090262904j) a'100001'b'010100' (0.03664668191276988+0.06722894026015053j) a'100001'b'100100' (-0.02741777138029397-0.007352501143118555j) a'100001'b'011000' (0.051471849687067-0.0846977641665355j) a'100001'b'101000' (0.03245447051797162-0.006408485708939374j) a'100001'b'110000' (-0.0303051554264101-0.019939576498931952j) a'000110'b'000011' (0.012665596774754985-0.03250325270682738j) a'000110'b'000101' (-0.05135556026982567+0.033716600553043284j) a'000110'b'001001' (0.021575773760839127+0.05746208180012662j) a'000110'b'010001' (-0.0019538404542192227-0.1204332808689012j) a'000110'b'100001' (0.004318916987454158-0.04274814127828635j) a'000110'b'000110' (-0.01570168306357056+0.03557469099335455j) a'000110'b'001010' (-0.04385378486914058-0.021118012817459862j) a'000110'b'010010' (-0.0837605989662535+0.059930567709333034j) a'000110'b'100010' (-0.051919255206171945-0.010053668208832241j) a'000110'b'001100' (0.07182575798062353-0.0838551101010865j) a'000110'b'010100' (0.09950284980555911+0.061226579344488205j) a'000110'b'100100' (-0.053735515269227915-0.06982853526502457j) a'000110'b'011000' (0.05303603635994308-0.011005392542874108j) a'000110'b'101000' (-0.01345308409475521-0.038054233096529645j) a'000110'b'110000' (0.06568568043232177-0.0013905823046843975j) a'001010'b'000011' (-0.13356671548727958-0.019931501039832038j) a'001010'b'000101' (0.02363212648643219+0.0003209466325156913j) a'001010'b'001001' (0.030598285135269417+0.07656141079835527j) a'001010'b'010001' (-0.07084968334400611-0.03864238860961274j) a'001010'b'100001' (0.02932410147295585-0.0299837879638265j) a'001010'b'000110' (0.021574452247893113-0.009170260310899158j) a'001010'b'001010' (-0.0613163431488588-0.037585815979617j) a'001010'b'010010' (0.11075972538945053-0.022011865327106393j) a'001010'b'100010' (-0.04189572943106812-0.017449169205428248j) a'001010'b'001100' (-0.011220034587659898-0.04104047827359933j) a'001010'b'010100' (0.05982266208707751+0.04763697284415933j) a'001010'b'100100' (0.05026416474037043-0.0031058397113008186j) a'001010'b'011000' (0.0357851156882128+0.010534535552781554j) a'001010'b'101000' (-0.0308554697934751-0.0072569494733038375j) a'001010'b'110000' (-0.09909167065821123+0.025662752983518205j) a'010010'b'000011' (0.056959546110146475-0.015253947530659066j) a'010010'b'000101' (0.048641119289508435+0.022871576279711918j) a'010010'b'001001' (0.006880656454895492-0.012211371804442591j) a'010010'b'010001' (0.001019309387259264+0.020378783131450973j) a'010010'b'100001' (0.009366846011947146-0.06431333681375638j) a'010010'b'000110' (-0.04773998655310664+0.00043267030943778254j) a'010010'b'001010' (0.07765100520267133+0.013254740680463957j) a'010010'b'010010' (0.10140391121526547+0.04618716507543993j) a'010010'b'100010' (-0.06058046002252023-0.009889770026154049j) a'010010'b'001100' (0.060813407486917916-0.033066581381932095j) a'010010'b'010100' (-0.02777178132008428-0.01926674841809349j) a'010010'b'100100' (0.05007107613123439+0.01411113291305248j) a'010010'b'011000' (-0.011566789232176194+0.0050037403569355605j) a'010010'b'101000' (-0.09031456605436365+0.08110741382107454j) a'010010'b'110000' (-0.041937423975916516-0.013293907459607734j) a'100010'b'000011' (-0.06793620072592646+0.03362507926428732j) a'100010'b'000101' (0.07393630096625356-0.02016378402337955j) a'100010'b'001001' (0.015042252920232575+0.02512097962152611j) a'100010'b'010001' (-0.03963542333830429-0.00399349725960955j) a'100010'b'100001' (0.016014678502712442-0.00343228912653415j) a'100010'b'000110' (0.01248146065012179+0.0026397234386885027j) a'100010'b'001010' (0.007703474093789106+0.029184826816674145j) a'100010'b'010010' (-0.051980855235673834+0.03976413663952125j) a'100010'b'100010' (-0.015096286486027552+0.05120649183010782j) a'100010'b'001100' (-0.05623432571779164+0.03715743991824137j) a'100010'b'010100' (0.13680974683843614+0.02548942008168033j) a'100010'b'100100' (0.03666006220605186+0.028963642494569706j) a'100010'b'011000' (0.022141656647275847-0.015023735594240325j) a'100010'b'101000' (0.011336258990430137-0.03133425994623675j) a'100010'b'110000' (0.046805772923743896-0.04480632341795642j) a'001100'b'000011' (-0.015408087207110937-0.02775377595177852j) a'001100'b'000101' (0.03409342463539585+0.012129684937968628j) a'001100'b'001001' (-0.06499525205283026+0.020823864696130765j) a'001100'b'010001' (-0.07195980850515232-0.01224113124716242j) a'001100'b'100001' (0.03913361829558841+0.006012517310790527j) a'001100'b'000110' (-0.010792445538752046+0.0028842591661248146j) a'001100'b'001010' (-0.04483252574359759+0.0210649435452126j) a'001100'b'010010' (0.007102705776886087+0.03399773486981391j) a'001100'b'100010' (0.036478349532642396+0.005537066109838006j) a'001100'b'001100' (0.014438929648016957-0.075278607962088j) a'001100'b'010100' (-0.08422958079019642-0.03735441027327863j) a'001100'b'100100' (-0.01238280917097511+0.04069294472071607j) a'001100'b'011000' (-0.08043490166130632-0.019404788440189516j) a'001100'b'101000' (-0.03209486405133089+0.0168504949351127j) a'001100'b'110000' (-0.00827040590477336+0.0447547076607768j) a'010100'b'000011' (0.014718364478974932-0.021475142825657493j) a'010100'b'000101' (0.09857638305195034+0.021169606500984168j) a'010100'b'001001' (-0.042123931633912017-0.030740556624013923j) a'010100'b'010001' (-0.017503368143586637+0.005074022891689731j) a'010100'b'100001' (0.030864906029727465+0.035219575207974765j) a'010100'b'000110' (-0.05875624697891782+0.031026358481678985j) a'010100'b'001010' (0.015298676785684891+0.02053296265304866j) a'010100'b'010010' (-0.038917394089486294-0.037657339435609526j) a'010100'b'100010' (0.023206113989892353-0.005162841746878299j) a'010100'b'001100' (0.02870301463322581-0.0032545942208901182j) a'010100'b'010100' (0.07376572462103186+0.02076249706171677j) a'010100'b'100100' (-0.004347978004724792+0.03585814866350416j) a'010100'b'011000' (-0.05076561086119591+0.04252916115768553j) a'010100'b'101000' (0.027207480925241723+0.13025874229240142j) a'010100'b'110000' (0.004046644973364799+0.03202800099058561j) a'100100'b'000011' (0.019494105126223103-0.02656286226629728j) a'100100'b'000101' (0.04564814137301562+0.056640386727639956j) a'100100'b'001001' (-0.05176106064288638+0.037497954518415824j) a'100100'b'010001' (-0.06134067512630651-0.11779772305162324j) a'100100'b'100001' (-0.030380971705778238-0.1282374909468295j) a'100100'b'000110' (0.024634693691158508-0.054963220840884425j) a'100100'b'001010' (0.07135709811568333+0.050375833250329384j) a'100100'b'010010' (-0.032991868020939126-0.01885855715390168j) a'100100'b'100010' (-0.03695188467821456-0.008112436708140542j) a'100100'b'001100' (0.020325943766038794+0.03714749166018085j) a'100100'b'010100' (-0.031226557064061255+0.046848725066639896j) a'100100'b'100100' (0.03665645229423063+0.005079262510613118j) a'100100'b'011000' (-0.04237494160313511-0.02640099291094228j) a'100100'b'101000' (0.0591965208644741-0.05121989536876779j) a'100100'b'110000' (0.10348501510171434+0.026031723887941664j) a'011000'b'000011' (-0.020130738137129813-0.031849454897288985j) a'011000'b'000101' (0.04943708924148902+0.010585274071657765j) a'011000'b'001001' (-0.035194831283389134+0.007763885127463088j) a'011000'b'010001' (0.0237310076809193-0.014025985886240188j) a'011000'b'100001' (-0.0009053667807024599+0.029361018258998776j) a'011000'b'000110' (-0.0036548558481633176-0.056023388902208995j) a'011000'b'001010' (0.04173450339421935+0.019206409053933452j) a'011000'b'010010' (0.030912334861556423+0.09781340933328282j) a'011000'b'100010' (0.025505665553520063-0.05528356778391594j) a'011000'b'001100' (0.029300532073786755+0.06488507326315225j) a'011000'b'010100' (0.045895199094251146+0.046286442077093766j) a'011000'b'100100' (0.09175027469069909+0.0849005703215895j) a'011000'b'011000' (-0.03204784481915275+0.038730864703001j) a'011000'b'101000' (0.06903439148659185+0.06575636253679444j) a'011000'b'110000' (-0.044981016434207786-0.090658451383069j) a'101000'b'000011' (0.00742846783765389-0.006194080936744155j) a'101000'b'000101' (0.023489926368221684-0.002323039460537622j) a'101000'b'001001' (0.014857587766579087+0.017051386572375996j) a'101000'b'010001' (-0.015894474927628216+0.024348766611932214j) a'101000'b'100001' (0.018780261421367125-0.03966370813270422j) a'101000'b'000110' (0.005795348714935821+0.04997421893728095j) a'101000'b'001010' (-0.02544910813798249+0.044261703586566996j) a'101000'b'010010' (0.042602852923662594+0.012213510107961012j) a'101000'b'100010' (0.007792149216449524-0.008595074877798575j) a'101000'b'001100' (-0.021122718184020943+0.03379085556771626j) a'101000'b'010100' (0.03680360888151386+0.09392884370369853j) a'101000'b'100100' (-0.048655039524644166-0.05067013907281734j) a'101000'b'011000' (0.04981138924917531+0.00532446620359916j) a'101000'b'101000' (0.01337090975519591-0.03204558857099676j) a'101000'b'110000' (-0.053219595976438556-0.038160044378012264j) a'110000'b'000011' (-0.03929938872455545+0.033299689367980743j) a'110000'b'000101' (-0.06337094228515154+0.032063905647317315j) a'110000'b'001001' (-0.02207504570892372-0.009112272516168642j) a'110000'b'010001' (-0.04713328831615989+0.009059560623210044j) a'110000'b'100001' (-0.019294316643854368+0.0399237610788673j) a'110000'b'000110' (0.08289076348544368+0.018664489072240983j) a'110000'b'001010' (-0.06799140693028252+0.0033434209741361296j) a'110000'b'010010' (0.1898868841589496+0.014927302020593705j) a'110000'b'100010' (0.03469708573455553-0.004800714538522185j) a'110000'b'001100' (0.032780903780116125+0.06349439459618232j) a'110000'b'010100' (0.007739105913899105+0.0015160977632131991j) a'110000'b'100100' (0.053498747349109324-0.04093652534719691j) a'110000'b'011000' (-0.04778376340507833-0.02171229912792349j) a'110000'b'101000' (0.02703099394214411+0.01954835490890407j) a'110000'b'110000' (-0.0537565589119271+0.009226010395285816j)
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.029090312813434403+0.03128897657585008j) a'000011'b'000101' (0.0675222279058948-0.017637218893662883j) a'000011'b'001001' (-0.00861448317528831-0.0791859756455152j) a'000011'b'010001' (0.03384382911097604-0.04392534498779845j) a'000011'b'100001' (-0.031292100880823404+0.04855670734728779j) a'000011'b'000110' (-0.1031448977133635+0.05217674805602499j) a'000011'b'001010' (-0.014024742868245404+0.03476867880953138j) a'000011'b'010010' (-0.005073007332126265-0.004474897943023782j) a'000011'b'100010' (0.05308504706097115-0.09000731016932037j) a'000011'b'001100' (-0.060047743022520146+0.08144369328508398j) a'000011'b'010100' (0.06984114975284346-0.04808962781838616j) a'000011'b'100100' (0.0016839027229455547-0.009433928054053013j) a'000011'b'011000' (0.006665395640052891+0.036641071962933584j) a'000011'b'101000' (0.013409539650234895-0.09736143728942603j) a'000011'b'110000' (0.04996386442775223-0.06259064299592243j) a'000101'b'000011' (-0.05216580075077179+0.01065349574730691j) a'000101'b'000101' (0.02853998303295081+0.06510350094597331j) a'000101'b'001001' (-0.009470779148343938-0.02144746503028204j) a'000101'b'010001' (-0.011287059907568587+0.027871313001836606j) a'000101'b'100001' (-0.026528379876570304-0.01790932872933327j) a'000101'b'000110' (0.01345074101425427-0.02184234858185076j) a'000101'b'001010' (-0.020648613478915584-0.011627891702083299j) a'000101'b'010010' (-0.032877300554037446+0.020287595341842803j) a'000101'b'100010' (0.10043319655492698+0.008512028215268282j) a'000101'b'001100' (-0.027482664362646222-0.012906120582440141j) a'000101'b'010100' (0.024072531960782385+0.013681635198537113j) a'000101'b'100100' (-0.03984691912069933-0.037491512827217806j) a'000101'b'011000' (-0.019431840767303483-0.05121890635364387j) a'000101'b'101000' (0.03080787179075872-0.013203809682794491j) a'000101'b'110000' (-0.014791134104965452-0.029270318240086888j) a'001001'b'000011' (-0.0459303942852381-0.11098657995376603j) a'001001'b'000101' (0.047643838380614194+0.030901556841355062j) a'001001'b'001001' (0.01037514149147002+0.060747177764649815j) a'001001'b'010001' (-0.10206161442644916-0.008066297600937892j) a'001001'b'100001' (-0.0119832323474928+0.012730068480804367j) a'001001'b'000110' (0.010346120384748357+0.06187401809407578j) a'001001'b'001010' (0.005869686196599235+0.05349053780552597j) a'001001'b'010010' (-0.0009300354961538687+0.0507519670369113j) a'001001'b'100010' (-0.01279734215826095+0.09685347176817466j) a'001001'b'001100' (-0.026611854365475772+0.042543563706885536j) a'001001'b'010100' (-0.00416832662455217-0.027087886741278797j) a'001001'b'100100' (0.009282909573538051-0.041818671683313186j) a'001001'b'011000' (0.005769517570335237-0.018807248262072297j) a'001001'b'101000' (-0.022992207693749704-0.07274299952398779j) a'001001'b'110000' (-0.10699327896081233-0.005424360396767565j) a'010001'b'000011' (0.016990104792326155-0.046799810355609116j) a'010001'b'000101' (0.09204975929311293-0.0008782511571456045j) a'010001'b'001001' (-0.06181063871928922-0.024891363756014844j) a'010001'b'010001' (-0.07482382948783525+0.08612942156022642j) a'010001'b'100001' (0.08479735869696099+0.017696808406346323j) a'010001'b'000110' (0.061570890431275525+0.03230055379595051j) a'010001'b'001010' (-0.05958986728901986+0.0020667995873484882j) a'010001'b'010010' (-0.05968515482779152+0.034864272606763905j) a'010001'b'100010' (-0.05082297317598355+0.005164344699392071j) a'010001'b'001100' (0.00010121131476673822-0.022273604472934503j) a'010001'b'010100' (0.047179376636477366-0.062412800408315414j) a'010001'b'100100' (0.0061548451231524534+0.03356523136493871j) a'010001'b'011000' (-0.05117547997481206+0.03533839222165066j) a'010001'b'101000' (0.038205824811319754+0.07053262046060252j) a'010001'b'110000' (-0.022633241539593025+0.00040473281072107023j) a'100001'b'000011' (0.035487242639190945+0.0455511333185865j) a'100001'b'000101' (-0.04699218045538675-0.034465345775133556j) a'100001'b'001001' (0.051705261280291584+0.0804903202590041j) a'100001'b'010001' (0.029329255359819784-0.05923673673189521j) a'100001'b'100001' (-0.03834113243137444-0.07245503500618053j) a'100001'b'000110' (-0.032312647071695025-0.06740009953411381j) a'100001'b'001010' (-0.04194206121736674-0.03938021307860296j) a'100001'b'010010' (-0.06965940124130614-0.005209191317384494j) a'100001'b'100010' (0.032648597514392204+0.0625607435071253j) a'100001'b'001100' (-0.1534764130868465+0.03518924488434627j) a'100001'b'010100' (0.015697197201167072+0.07494202895402755j) a'100001'b'100100' (0.017676895531086177-0.02221082674968885j) a'100001'b'011000' (0.03717168565484484+0.0918767018922397j) a'100001'b'101000' (0.0316296797238481-0.009691475958302876j) a'100001'b'110000' (0.0336161837370485+0.013636031216326495j) a'000110'b'000011' (0.010165743203600107+0.033369693485302256j) a'000110'b'000101' (-0.06035038885304824+0.011490573909385399j) a'000110'b'001001' (-0.022308920531711525-0.057181438622101295j) a'000110'b'010001' (0.10980483168478702+0.049506480101536014j) a'000110'b'100001' (0.042724385775877706-0.004547910153777239j) a'000110'b'000110' (-0.038885541043140404-0.0001272324004441404j) a'000110'b'001010' (-0.029626186076640464+0.03861882975000065j) a'000110'b'010010' (0.05390996769285818-0.08775663090902862j) a'000110'b'100010' (0.004343284700622409-0.05270503945189907j) a'000110'b'001100' (0.06564033351760504+0.08878043486745268j) a'000110'b'010100' (0.013765357003847787+0.11601735251336834j) a'000110'b'100100' (-0.08115891799533735+0.03430393517272206j) a'000110'b'011000' (0.05415013317118389+0.001304950320510414j) a'000110'b'101000' (-0.0018428962805032909-0.04032014213175438j) a'000110'b'110000' (-0.04480560922061707-0.04805205214527841j) a'001010'b'000011' (-0.017230175132896493+0.13394197730603516j) a'001010'b'000101' (-0.023634298385443845-1.867724443451669e-05j) a'001010'b'001001' (-0.050153981513411876+0.06544068165144751j) a'001010'b'010001' (-0.07719727308818192-0.023526428865234275j) a'001010'b'100001' (0.03376969201136688+0.024870431627001244j) a'001010'b'000110' (-0.0045726016409792965-0.02299221560005008j) a'001010'b'001010' (0.022321646642484143+0.0683676209266515j) a'001010'b'010010' (0.024065347463169146+0.11033176349085559j) a'001010'b'100010' (0.04452954739119795-0.008766131396231093j) a'001010'b'001100' (0.03525901665720882-0.02381200910130712j) a'001010'b'010100' (0.047465253131000196+0.059959001210409674j) a'001010'b'100100' (0.049005892767046214+0.011599783250740488j) a'001010'b'011000' (0.010153934746027217+0.03589496557046703j) a'001010'b'101000' (0.02861040759845257+0.013644336146714764j) a'001010'b'110000' (-0.0947304522832332-0.03877985939560052j) a'010010'b'000011' (-0.026274413687450367+0.05278946858723548j) a'010010'b'000101' (-0.04140406944075479+0.03427492554331848j) a'010010'b'001001' (0.004270781257943418-0.013349961125165481j) a'010010'b'010001' (0.015409585613318016+0.013374545404292726j) a'010010'b'100001' (-0.06148785669467919-0.021051996946270912j) a'010010'b'000110' (0.04382442501045948-0.018939727880571123j) a'010010'b'001010' (-0.011810144336515765+0.0778838060847202j) a'010010'b'010010' (0.10576818401921532+0.03505850362945876j) a'010010'b'100010' (-0.02453987556072043+0.05626361342088457j) a'010010'b'001100' (0.06672648726007344-0.018418611033113055j) a'010010'b'010100' (-0.030356366164027582-0.014865075365169565j) a'010010'b'100100' (-0.022842157608948536-0.04673834157089506j) a'010010'b'011000' (-0.012538130350970799-0.0012740949741983556j) a'010010'b'101000' (-0.12089958734225649+0.010882242360981783j) a'010010'b'110000' (-0.018788001976709344+0.03978047871762677j) a'100010'b'000011' (0.03976774247103106-0.06453293719768792j) a'100010'b'000101' (0.03491122303721897+0.06822287954022081j) a'100010'b'001001' (-0.022785557571113776+0.018388892197052958j) a'100010'b'010001' (-0.011225332588073372+0.03822180937444281j) a'100010'b'100001' (0.00847897682818214+0.01401276161720149j) a'100010'b'000110' (-0.001265615827253235+0.012694613675536023j) a'100010'b'001010' (-0.022618781643844427-0.019987204566447713j) a'100010'b'010010' (0.02570010847272932+0.06018887188017849j) a'100010'b'100010' (-0.043555492472431255+0.03086943061831728j) a'100010'b'001100' (-0.06459165589590064+0.019258575202697664j) a'100010'b'010100' (-0.07215499678312293-0.11899694872275032j) a'100010'b'100100' (0.03914496239896979-0.02550538504488962j) a'100010'b'011000' (0.02672947300596333+0.0012250971859310382j) a'100010'b'101000' (-0.03084508094781507+0.012606648864753118j) a'100010'b'110000' (0.030586746227479995-0.05712125657265715j) a'001100'b'000011' (0.015761783978450863+0.02755444422920021j) a'001100'b'000101' (-0.035855659223998276+0.0048849321055984525j) a'001100'b'001001' (-0.04862715597082714-0.04788962134411319j) a'001100'b'010001' (-0.01963965242129029-0.0703018021609642j) a'001100'b'100001' (-0.015833746723738728+0.03628888135511841j) a'001100'b'000110' (-0.0003940915472975014-0.011164252034805222j) a'001100'b'001010' (-0.034353307912595235-0.035686656421914265j) a'001100'b'010010' (-0.0007898510910055621+0.03472276689558608j) a'001100'b'100010' (0.033306446007925615+0.015874814646208737j) a'001100'b'001100' (-0.0054431731854678155-0.0764573303991391j) a'001100'b'010100' (-0.084074290794995-0.03770262423592373j) a'001100'b'100100' (0.02295146062363076+0.035811732271002567j) a'001100'b'011000' (-0.002621914647537882-0.08270093580639551j) a'001100'b'101000' (0.02222437886784419-0.028637326376081115j) a'001100'b'110000' (-0.04524845302635028+0.004894994418124991j) a'010100'b'000011' (0.013165257758361382+0.02246081032541447j) a'010100'b'000101' (-0.10027703214308858+0.010486770693847213j) a'010100'b'001001' (0.00982348271616169-0.051214320508798816j) a'010100'b'010001' (-0.0008358008913719255-0.018204808198530875j) a'010100'b'100001' (0.019394116955522626+0.04262545166411272j) a'010100'b'000110' (-0.06079813138520684-0.026805199117864588j) a'010100'b'001010' (0.010245311763851317+0.023466692429182145j) a'010100'b'010010' (-0.04414421267170364-0.03136761488670273j) a'010100'b'100010' (-0.019312746352257295-0.013863494860552286j) a'010100'b'001100' (0.028716236094581134-0.0031357960931957017j) a'010100'b'010100' (0.02930840072369774+0.07080593944100208j) a'010100'b'100100' (0.03189770896520065-0.016948389335712515j) a'010100'b'011000' (-0.012203710261192527-0.06509182937011083j) a'010100'b'101000' (-0.11700831025642663+0.06337698551391857j) a'010100'b'110000' (-0.011245707572873274+0.03026057243640365j) a'100100'b'000011' (0.029998754188831914+0.01362646445592392j) a'100100'b'000101' (-0.03901420734072556+0.06139851663552071j) a'100100'b'001001' (-0.022992016648899036-0.05963783331374886j) a'100100'b'010001' (-0.02475528139537782-0.130484320989664j) a'100100'b'100001' (0.12971440051906918+0.02328157692477033j) a'100100'b'000110' (-0.04693469773180888-0.0377486149055137j) a'100100'b'001010' (0.05368791379440316+0.06889969477117432j) a'100100'b'010010' (0.007921744672801153+0.03716657765758085j) a'100100'b'100010' (-0.01947621805505745+0.0324334756214549j) a'100100'b'001100' (0.04145994775234141+0.008611205432255j) a'100100'b'010100' (0.05628927906102284-0.0011907851338435616j) a'100100'b'100100' (-0.012770816684044325-0.034733278619696446j) a'100100'b'011000' (0.01315759220506171-0.04816145626865985j) a'100100'b'101000' (-0.07709497673653763+0.013567251970769998j) a'100100'b'110000' (0.06515915945925717+0.08450492848197186j) a'011000'b'000011' (-0.026152059889587034-0.027123866957563223j) a'011000'b'000101' (0.011525195745179795+0.04922645308041548j) a'011000'b'001001' (-0.028265255489135426-0.022361337023366203j) a'011000'b'010001' (0.016909867688926553+0.02177028663972657j) a'011000'b'100001' (-0.02300464219656126-0.018266787337160636j) a'011000'b'000110' (0.009141358419120449-0.05539326350389712j) a'011000'b'001010' (0.005985912918511944+0.04555023346637329j) a'011000'b'010010' (-0.02072714856595294+0.10046601815697805j) a'011000'b'100010' (0.05353034268862251-0.02900541766438619j) a'011000'b'001100' (-0.0547909585823857+0.04545926495000698j) a'011000'b'010100' (-0.06283618349802962+0.017332572326664467j) a'011000'b'100100' (-0.055063827811459985+0.11222385937713862j) a'011000'b'011000' (0.038674344077367695+0.032116029461626165j) a'011000'b'101000' (0.07467706856705839+0.05927041295811283j) a'011000'b'110000' (-0.10067999657327499-0.010285180437702416j) a'101000'b'000011' (0.007166749792862856+0.006495111274835549j) a'101000'b'000101' (-0.0037699628663244917+0.023301513536811848j) a'101000'b'001001' (0.00021041790089215934-0.02261533600433982j) a'101000'b'010001' (-0.010030425483483308-0.027292624156860325j) a'101000'b'100001' (0.014628688308770503-0.04137522737407107j) a'101000'b'000110' (-0.008941721539221618+0.04950812298031524j) a'101000'b'001010' (0.03426864860125684-0.03784726188837737j) a'101000'b'010010' (0.026808221761548602+0.03529153088739739j) a'101000'b'100010' (-0.011601408062583002-1.5248993845284095e-05j) a'101000'b'001100' (0.00521778514906532-0.03950652935424753j) a'101000'b'010100' (-0.07945196727397924+0.06216524915506898j) a'101000'b'100100' (0.01574317160853553+0.06846114527604352j) a'101000'b'011000' (0.05008851060876736+0.0008158089736742326j) a'101000'b'101000' (-0.033424097064898975-0.009409075934405197j) a'101000'b'110000' (0.03198041131094148-0.05714689558681406j) a'110000'b'000011' (0.025491735467178676+0.04476028026050675j) a'110000'b'000101' (-0.06992612977417775+0.012422026657229843j) a'110000'b'001001' (0.020495405491429818-0.012258854236912288j) a'110000'b'010001' (-0.02594372829624718-0.040380013227714236j) a'110000'b'100001' (0.011124410937191001-0.04292347649872156j) a'110000'b'000110' (-0.041315871240528455-0.07424446516181285j) a'110000'b'001010' (-0.056457455329269865-0.038033743148854826j) a'110000'b'010010' (0.04021118447431611-0.18617978881817676j) a'110000'b'100010' (0.03149332643293533-0.015333134341681534j) a'110000'b'001100' (-0.051444850750659625+0.04959388197166352j) a'110000'b'010100' (0.0061570941222131035+0.004927728152442771j) a'110000'b'100100' (0.06735710421035272+0.0009672578876472079j) a'110000'b'011000' (-0.04384654446793889+0.028847747170168917j) a'110000'b'101000' (-0.016408591277623015+0.029044292820253347j) a'110000'b'110000' (-0.019331251619556265+0.05100185883560341j)
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.029090312813434372+0.031288976575850065j) a'000011'b'000101' (0.06752222790589477-0.017637218893662862j) a'000011'b'001001' (-0.00861448317528838-0.0791859756455152j) a'000011'b'010001' (0.033843829110975956-0.0439253449877985j) a'000011'b'100001' (-0.031292100880823355+0.04855670734728778j) a'000011'b'000110' (-0.10314489771336335+0.05217674805602518j) a'000011'b'001010' (-0.014024742868245343+0.034768678809531404j) a'000011'b'010010' (-0.005073007332126272-0.004474897943023776j) a'000011'b'100010' (0.05308504706097084-0.09000731016932048j) a'000011'b'001100' (-0.06004774302252015+0.08144369328508398j) a'000011'b'010100' (0.0698411497528435-0.04808962781838609j) a'000011'b'100100' (0.0016839027229455714-0.009433928054053003j) a'000011'b'011000' (0.006665395640052897+0.036641071962933584j) a'000011'b'101000' (0.013409539650234972-0.09736143728942602j) a'000011'b'110000' (0.049963864427752185-0.06259064299592246j) a'000101'b'000011' (-0.05216580075077178+0.010653495747306892j) a'000101'b'000101' (0.02853998303295048+0.06510350094597342j) a'000101'b'001001' (-0.009470779148343909-0.021447465030282054j) a'000101'b'010001' (-0.011287059907568602+0.027871313001836602j) a'000101'b'100001' (-0.02652837987657025-0.017909328729333342j) a'000101'b'000110' (0.013450741014254253-0.021842348581850763j) a'000101'b'001010' (-0.02064861347891558-0.011627891702083296j) a'000101'b'010010' (-0.03287730055403747+0.020287595341842782j) a'000101'b'100010' (0.10043319655492695+0.008512028215268433j) a'000101'b'001100' (-0.027482664362646216-0.012906120582440152j) a'000101'b'010100' (0.02407253196078237+0.01368163519853712j) a'000101'b'100100' (-0.039846919120699265-0.037491512827217854j) a'000101'b'011000' (-0.019431840767303452-0.051218906353643893j) a'000101'b'101000' (0.03080787179075872-0.013203809682794478j) a'000101'b'110000' (-0.01479113410496545-0.029270318240086888j) a'001001'b'000011' (-0.04593039428523821-0.11098657995376594j) a'001001'b'000101' (0.04764383838061415+0.03090155684135513j) a'001001'b'001001' (0.010375141491469918+0.06074717776464985j) a'001001'b'010001' (-0.10206161442644913-0.008066297600937918j) a'001001'b'100001' (-0.011983232347492791+0.012730068480804366j) a'001001'b'000110' (0.010346120384748348+0.06187401809407579j) a'001001'b'001010' (0.0058696861965992116+0.05349053780552598j) a'001001'b'010010' (-0.0009300354961538464+0.05075196703691131j) a'001001'b'100010' (-0.012797342158261008+0.09685347176817465j) a'001001'b'001100' (-0.0266118543654758+0.04254356370688554j) a'001001'b'010100' (-0.004168326624552153-0.027087886741278808j) a'001001'b'100100' (0.009282909573538072-0.04181867168331318j) a'001001'b'011000' (0.005769517570335242-0.018807248262072303j) a'001001'b'101000' (-0.02299220769374972-0.07274299952398779j) a'001001'b'110000' (-0.10699327896081234-0.005424360396767532j) a'010001'b'000011' (0.016990104792326058-0.04679981035560914j) a'010001'b'000101' (0.09204975929311292-0.0008782511571455848j) a'010001'b'001001' (-0.061810638719289206-0.02489136375601486j) a'010001'b'010001' (-0.07482382948783514+0.08612942156022646j) a'010001'b'100001' (0.08479735869696099+0.017696808406346236j) a'010001'b'000110' (0.0615708904312755+0.032300553795950544j) a'010001'b'001010' (-0.05958986728901985+0.00206679958734852j) a'010001'b'010010' (-0.05968515482779146+0.03486427260676397j) a'010001'b'100010' (-0.05082297317598353+0.005164344699392115j) a'010001'b'001100' (0.00010121131476674948-0.022273604472934503j) a'010001'b'010100' (0.04717937663647726-0.062412800408315455j) a'010001'b'100100' (0.006154845123152454+0.033565231364938705j) a'010001'b'011000' (-0.05117547997481201+0.035338392221650715j) a'010001'b'101000' (0.03820582481131979+0.07053262046060248j) a'010001'b'110000' (-0.022633241539593018+0.00040473281072106546j) a'100001'b'000011' (0.03548724263919095+0.04555113331858644j) a'100001'b'000101' (-0.046992180455386626-0.034465345775133646j) a'100001'b'001001' (0.051705261280291584+0.08049032025900407j) a'100001'b'010001' (0.029329255359819704-0.05923673673189522j) a'100001'b'100001' (-0.03834113243137446-0.07245503500618043j) a'100001'b'000110' (-0.0323126470716949-0.06740009953411383j) a'100001'b'001010' (-0.0419420612173667-0.039380213078602976j) a'100001'b'010010' (-0.06965940124130612-0.005209191317384434j) a'100001'b'100010' (0.032648597514392017+0.06256074350712533j) a'100001'b'001100' (-0.1534764130868465+0.03518924488434619j) a'100001'b'010100' (0.015697197201167065+0.07494202895402749j) a'100001'b'100100' (0.017676895531086152-0.02221082674968884j) a'100001'b'011000' (0.037171685654844876+0.09187670189223972j) a'100001'b'101000' (0.031629679723848086-0.009691475958302888j) a'100001'b'110000' (0.03361618373704848+0.013636031216326481j) a'000110'b'000011' (0.010165743203600171+0.03336969348530223j) a'000110'b'000101' (-0.06035038885304821+0.011490573909385435j) a'000110'b'001001' (-0.022308920531711518-0.057181438622101295j) a'000110'b'010001' (0.10980483168478697+0.049506480101536104j) a'000110'b'100001' (0.042724385775877685-0.004547910153777172j) a'000110'b'000110' (-0.038885541043140404-0.00012723240044413588j) a'000110'b'001010' (-0.02962618607664052+0.038618829750000624j) a'000110'b'010010' (0.05390996769285823-0.08775663090902863j) a'000110'b'100010' (0.004343284700622569-0.05270503945189904j) a'000110'b'001100' (0.06564033351760505+0.08878043486745274j) a'000110'b'010100' (0.01376535700384783+0.11601735251336837j) a'000110'b'100100' (-0.08115891799533731+0.03430393517272208j) a'000110'b'011000' (0.05415013317118392+0.0013049503205104646j) a'000110'b'101000' (-0.0018428962805032752-0.04032014213175439j) a'000110'b'110000' (-0.04480560922061701-0.04805205214527846j) a'001010'b'000011' (-0.01723017513289626+0.1339419773060352j) a'001010'b'000101' (-0.02363429838544384-1.867724443451737e-05j) a'001010'b'001001' (-0.05015398151341191+0.0654406816514475j) a'001010'b'010001' (-0.07719727308818193-0.023526428865234247j) a'001010'b'100001' (0.03376969201136684+0.02487043162700126j) a'001010'b'000110' (-0.004572601640979266-0.02299221560005008j) a'001010'b'001010' (0.022321646642484164+0.06836762092665147j) a'001010'b'010010' (0.02406534746316918+0.11033176349085559j) a'001010'b'100010' (0.04452954739119792-0.008766131396231246j) a'001010'b'001100' (0.03525901665720881-0.023812009101307145j) a'001010'b'010100' (0.04746525313100014+0.059959001210409736j) a'001010'b'100100' (0.0490058927670462+0.011599783250740518j) a'001010'b'011000' (0.010153934746027231+0.03589496557046702j) a'001010'b'101000' (0.028610407598452577+0.013644336146714743j) a'001010'b'110000' (-0.09473045228323322-0.03877985939560052j) a'010010'b'000011' (-0.026274413687450288+0.05278946858723554j) a'010010'b'000101' (-0.041404069440754816+0.03427492554331846j) a'010010'b'001001' (0.004270781257943416-0.013349961125165486j) a'010010'b'010001' (0.015409585613318039+0.01337454540429271j) a'010010'b'100001' (-0.0614878566946792-0.02105199694627085j) a'010010'b'000110' (0.043824425010459515-0.01893972788057112j) a'010010'b'001010' (-0.011810144336515751+0.0778838060847202j) a'010010'b'010010' (0.10576818401921541+0.035058503629458684j) a'010010'b'100010' (-0.024539875560720393+0.05626361342088459j) a'010010'b'001100' (0.06672648726007349-0.018418611033112993j) a'010010'b'010100' (-0.030356366164027627-0.014865075365169494j) a'010010'b'100100' (-0.02284215760894848-0.046738341570895084j) a'010010'b'011000' (-0.012538130350970804-0.0012740949741983452j) a'010010'b'101000' (-0.12089958734225648+0.010882242360981793j) a'010010'b'110000' (-0.018788001976709313+0.0397804787176268j) a'100010'b'000011' (0.03976774247103085-0.06453293719768802j) a'100010'b'000101' (0.034911223037218816+0.06822287954022085j) a'100010'b'001001' (-0.022785557571113793+0.018388892197052933j) a'100010'b'010001' (-0.011225332588073348+0.038221809374442806j) a'100010'b'100001' (0.008478976828182095+0.014012761617201504j) a'100010'b'000110' (-0.0012656158272532755+0.012694613675536018j) a'100010'b'001010' (-0.0226187816438445-0.01998720456644764j) a'100010'b'010010' (0.02570010847272937+0.060188871880178484j) a'100010'b'100010' (-0.04355549247243139+0.030869430618317054j) a'100010'b'001100' (-0.06459165589590067+0.019258575202697623j) a'100010'b'010100' (-0.07215499678312279-0.11899694872275042j) a'100010'b'100100' (0.03914496239896978-0.02550538504488962j) a'100010'b'011000' (0.026729473005963327+0.0012250971859310393j) a'100010'b'101000' (-0.03084508094781505+0.012606648864753147j) a'100010'b'110000' (0.03058674622747997-0.057121256572657146j) a'001100'b'000011' (0.015761783978450853+0.02755444422920022j) a'001100'b'000101' (-0.03585565922399829+0.0048849321055984395j) a'001100'b'001001' (-0.04862715597082715-0.04788962134411324j) a'001100'b'010001' (-0.01963965242129025-0.07030180216096425j) a'001100'b'100001' (-0.01583374672373875+0.0362888813551184j) a'001100'b'000110' (-0.0003940915472974982-0.011164252034805226j) a'001100'b'001010' (-0.03435330791259526-0.03568665642191426j) a'001100'b'010010' (-0.0007898510910055974+0.03472276689558609j) a'001100'b'100010' (0.03330644600792562+0.01587481464620876j) a'001100'b'001100' (-0.005443173185467876-0.07645733039913914j) a'001100'b'010100' (-0.08407429079499512-0.03770262423592355j) a'001100'b'100100' (0.022951460623630737+0.035811732271002567j) a'001100'b'011000' (-0.002621914647537759-0.08270093580639555j) a'001100'b'101000' (0.022224378867844213-0.0286373263760811j) a'001100'b'110000' (-0.0452484530263503+0.004894994418124923j) a'010100'b'000011' (0.013165257758361354+0.022460810325414478j) a'010100'b'000101' (-0.10027703214308858+0.010486770693847167j) a'010100'b'001001' (0.009823482716161739-0.051214320508798816j) a'010100'b'010001' (-0.0008358008913719513-0.01820480819853087j) a'010100'b'100001' (0.01939411695552262+0.04262545166411269j) a'010100'b'000110' (-0.06079813138520686-0.02680519911786457j) a'010100'b'001010' (0.010245311763851296+0.023466692429182156j) a'010100'b'010010' (-0.04414421267170372-0.03136761488670262j) a'010100'b'100010' (-0.01931274635225728-0.0138634948605523j) a'010100'b'001100' (0.028716236094581137-0.003135796093195766j) a'010100'b'010100' (0.029308400723697964+0.07080593944100201j) a'010100'b'100100' (0.031897708965200666-0.016948389335712497j) a'010100'b'011000' (-0.012203710261192536-0.06509182937011083j) a'010100'b'101000' (-0.11700831025642672+0.0633769855139184j) a'010100'b'110000' (-0.011245707572873284+0.03026057243640364j) a'100100'b'000011' (0.02999875418883188+0.01362646445592397j) a'100100'b'000101' (-0.03901420734072562+0.061398516635520636j) a'100100'b'001001' (-0.022992016648899022-0.05963783331374887j) a'100100'b'010001' (-0.024755281395377825-0.130484320989664j) a'100100'b'100001' (0.12971440051906913+0.023281576924770262j) a'100100'b'000110' (-0.046934697731808896-0.03774861490551368j) a'100100'b'001010' (0.05368791379440313+0.06889969477117433j) a'100100'b'010010' (0.007921744672801115+0.037166577657580864j) a'100100'b'100010' (-0.019476218055057434+0.03243347562145489j) a'100100'b'001100' (0.0414599477523414+0.008611205432255017j) a'100100'b'010100' (0.05628927906102284-0.0011907851338435506j) a'100100'b'100100' (-0.012770816684044343-0.034733278619696425j) a'100100'b'011000' (0.013157592205061765-0.048161456268659836j) a'100100'b'101000' (-0.07709497673653762+0.013567251970769956j) a'100100'b'110000' (0.06515915945925715+0.08450492848197186j) a'011000'b'000011' (-0.026152059889587048-0.027123866957563223j) a'011000'b'000101' (0.011525195745179765+0.04922645308041551j) a'011000'b'001001' (-0.02826525548913543-0.02236133702336621j) a'011000'b'010001' (0.016909867688926588+0.021770286639726553j) a'011000'b'100001' (-0.023004642196561266-0.01826678733716063j) a'011000'b'000110' (0.00914135841912049-0.05539326350389714j) a'011000'b'001010' (0.00598591291851195+0.04555023346637331j) a'011000'b'010010' (-0.02072714856595286+0.1004660181569781j) a'011000'b'100010' (0.0535303426886225-0.0290054176643862j) a'011000'b'001100' (-0.054790958582385786+0.045459264950006906j) a'011000'b'010100' (-0.06283618349802965+0.017332572326664474j) a'011000'b'100100' (-0.05506382781146016+0.11222385937713855j) a'011000'b'011000' (0.03867434407736772+0.032116029461626124j) a'011000'b'101000' (0.07467706856705839+0.05927041295811283j) a'011000'b'110000' (-0.10067999657327498-0.010285180437702414j) a'101000'b'000011' (0.007166749792862849+0.006495111274835553j) a'101000'b'000101' (-0.0037699628663245034+0.023301513536811844j) a'101000'b'001001' (0.00021041790089215175-0.022615336004339823j) a'101000'b'010001' (-0.010030425483483324-0.027292624156860318j) a'101000'b'100001' (0.014628688308770486-0.04137522737407105j) a'101000'b'000110' (-0.008941721539221638+0.04950812298031524j) a'101000'b'001010' (0.034268648601256814-0.03784726188837739j) a'101000'b'010010' (0.026808221761548616+0.03529153088739738j) a'101000'b'100010' (-0.011601408062582998-1.5248993845271529e-05j) a'101000'b'001100' (0.005217785149065346-0.039506529354247547j) a'101000'b'010100' (-0.07945196727397932+0.06216524915506888j) a'101000'b'100100' (0.015743171608535497+0.06846114527604354j) a'101000'b'011000' (0.05008851060876736+0.0008158089736742275j) a'101000'b'101000' (-0.03342409706489897-0.00940907593440522j) a'101000'b'110000' (0.03198041131094145-0.05714689558681406j) a'110000'b'000011' (0.025491735467178714+0.044760280260506734j) a'110000'b'000101' (-0.06992612977417773+0.012422026657229832j) a'110000'b'001001' (0.020495405491429815-0.012258854236912298j) a'110000'b'010001' (-0.025943728296247165-0.04038001322771424j) a'110000'b'100001' (0.011124410937191-0.04292347649872154j) a'110000'b'000110' (-0.041315871240528386-0.07424446516181288j) a'110000'b'001010' (-0.05645745532926988-0.0380337431488548j) a'110000'b'010010' (0.040211184474315965-0.18617978881817676j) a'110000'b'100010' (0.03149332643293531-0.015333134341681529j) a'110000'b'001100' (-0.0514448507506597+0.049593881971663464j) a'110000'b'010100' (0.0061570941222131+0.004927728152442773j) a'110000'b'100100' (0.06735710421035268+0.0009672578876472188j) a'110000'b'011000' (-0.043846544467938876+0.02884774717016892j) a'110000'b'101000' (-0.016408591277623+0.029044292820253337j) a'110000'b'110000' (-0.01933125161955628+0.05100185883560337j) 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): initial_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