on branch 'master' make_hubbard_model not working
Closed this issue · 2 comments
Hello,
I've tried to switch to branch 'master' in order to use the ldca ansatz which does not work on branch 'alpha'. But now I have a bug when calling make_hubbard_model, which I didn't have on branch 'alpha'.
Here is the code:
import numpy as np
from qat.fermion import hamiltonians #, ElectronicStructureHamiltonian
nsites=2
u=2.
t=1.
t = 1.
t_mat = np.zeros((nsites,nsites))
for i in range(nsites):
if i > 0:
t_mat[i,i-1] = - t
else:
t_mat[i,nsites-1] = - t
if i < nsites - 1:
t_mat[i,i+1] = - t
else:
t_mat[i,0] = - t
hamiltonian = hamiltonians.make_hubbard_model(t_mat = t_mat, U = u, mu = u/2.)
And the Traceback:
Traceback (most recent call last):
File "test_make_hubbard.py", line 27, in
hamiltonian = hamiltonians.make_hubbard_model(t_mat = t_mat, U = u, mu = u/2.)
File "/home/tlouvet/anaconda3/envs/optimizedmps/lib/python3.8/site-packages/qat/fermion/hamiltonians.py", line 922, in make_hubbard_model
return ElectronicStructureHamiltonian(hpq=hpq, hpqrs=hpqrs)
File "/home/tlouvet/anaconda3/envs/optimizedmps/lib/python3.8/site-packages/qat/fermion/hamiltonians.py", line 562, in init
terms = self._get_fermionic_terms()
File "/home/tlouvet/anaconda3/envs/optimizedmps/lib/python3.8/site-packages/qat/fermion/hamiltonians.py", line 653, in _get_fermionic_terms
terms.append(FermionicTerm(0.5 * self._hpqrs[i, j, k, l], "CCcc", [i, j, k, l]))
File "/home/tlouvet/anaconda3/envs/optimizedmps/lib/python3.8/site-packages/qat/fermion/fermion_algebra.py", line 33, in init
super(FermionicTerm, self).init(coefficient, op, qbits, do_validity_check)
File "observable.py", line 67, in qat.core.wrappers.observable.Term.init
TypeError: init() takes exactly 4 positional arguments (5 given)
Hi thiblouvet,
The new version of MyQLM is out ! Please install/upgrade your myqlm package, and see if let me know if the issue is now resolved.
Best regards,
Maxime