Closed jjgoings closed 2 years ago
Thank you for pointing that out in detail. The pyscf interface was added later and not all features are there yet (kind of forgot about this).
I added a hotfix. Hopefully, that solves most of those issues. If not please let me know.
Issues are being fixed in PR#215 will be in devel branch for a while until the next official version update.
If you want to avoid it in the current version you'll unfortunately need to use psi4 as backend.
Hey, thanks. Looks like that fixed part of it! But now I run into another issue:
import tequila as tq
geomstring="H 0.0 0.0 0.0\n Li 0.0 0.0 1.8"
mol = tq.Molecule(geometry=geomstring, backend='pyscf', basis_set='sto3g')
print("orb energies: ", mol.molecule.orbital_energies)
# get the qubit hamiltonian
H = mol.make_hamiltonian()
# get the ansatz (circuit)
U = mol.make_ansatz(name='UCCSD')
# define the expectation value
E = tq.ExpectationValue(H=H, U=U)
# minimize the expectation value
result = tq.minimize(E)
yields
converged SCF energy = -7.85001869716682
orb energies: [-2.3544583 -0.26775989 0.07604109 0.16349906 0.16349906 0.48968509]
Traceback (most recent call last):
File "test.py", line 16, in <module>
result = tq.minimize(E)
File "/X/miniconda3/lib/python3.8/site-packages/tequila/optimizers/__init__.py", line 133, in minimize
return v.minimize(
File "/X/miniconda3/lib/python3.8/site-packages/tequila/optimizers/optimizer_scipy.py", line 426, in minimize
return optimizer(objective=objective,
File "/X/miniconda3/lib/python3.8/site-packages/tequila/optimizers/optimizer_scipy.py", line 149, in __call__
param_keys, param_values = zip(*active_angles.items())
ValueError: not enough values to unpack (expected 2, got 0)
You were faster than me :-) I was still fiddling with the defaults that I changed from mp2 to zero-guess (but had to make things consistent, so that zero-guess would not lead to the elimination of all operators later). It should work now.
FYI: MP2 pre-screening for UCCSD is now deactivated by default. if you want to use MP2-Prescreening call it like this: make_ansatz(name="UCCSD", initial_amplitudes="mp2")
Haha, sorry about that :) LGTM now, I'll open a new issue if I find anything else. Thanks for all your work on this project -- I really like it!
gives
which causes problems downstream, say doing
which then yields the error