Fermi-Hubbard dataset hamiltonian vs qml.spin.fermi_hubbard() hamiltonian

Hi folks,

I’m wondering if I’m doing something wrong because I’m getting different results from the Fermi-Hubbard Dataset and the qml.spin.fermi_hubbard() function for what I thought was the same model. I am trying to compare the 1D Fermi-Hubbard model with 4 sites (1x4) and open boundary conditions (and standard first nearest-neighbour and JW transform). The Hamiltonians I end up with seem different. I am comparing the plots of the gs energies vs repulsions values.

Code/plot from from the Dataset (same result if you diagonalize data.hamiltonians or use data.ground_energies directly)

FH_datasets= qml.data.load("qspin", sysname = "FermiHubbard", periodicity = "open", lattice = "chain", layout = "1x4")
data = FH_datasets[0]
hopping = data.parameters['t'] 
repulsion_values = data.parameters['U']

plt.plot(repulsion_values, data.ground_energies, '-o')
plt.xlabel('U/t')
plt.ylabel('GS energy')

Code/plot from from the qml.spin.fermi_hubbard() hamiltonian (using the same repulsion values U as above )


gs_arr = []
n_sites = 4

for u in repulsion_values:
    spin_ham = qml.spin.fermi_hubbard("chain", [n_sites], hopping = 1.0, coulomb = u) 
    
    spectrum = spin_ham.eigvals()
    gs_energy = spectrum[0]
    
    gs_arr.append(gs_energy)

plt.plot(repulsion_values, gs_arr, '-o')
plt.xlabel('U/t')
plt.ylabel('GS energy')

Any subtleties I’m missing in how the models are defined?

Thanks!

Hi @Juliette ,

Thanks for your question.

I’m not sure so I’m checking with a colleague who worked on the Dataset.
We’ll get back to you soon!

Hey @Juliette! Thank you for the query.

The different results are expected, as both implementations differ in how up-down spins are allocated to qubit indices, i.e., in an interleaved manner or blocked manner.

For example, in qml.spin.fermi_hubbard - the ordering is interleaved. This means the opposite spins appear on adjacent qubits. However, when we were building the datasets, we had used blocked ordering, which means that the first n-qubits have up-spins and the next n-qubits have down-spins. This is also the reason you see different Hamiltonians as well!

I’ll try to have this documented better on the datasets side. Hope this helps until then!
Please let me know if you have any further questions! :grinning_face_with_smiling_eyes:

1 Like