Skip to content

Commit

Permalink
Merge pull request #323 from tequilahub/devel
Browse files Browse the repository at this point in the history
update-to-1.9.2
  • Loading branch information
kottmanj authored Feb 6, 2024
2 parents 87625bd + e8ce693 commit 934e060
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/tequila/apps/adapt/adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ def __call__(self, static_variables = None, mp_pool=None, label=None, variables=
variables = {**variables, **static_variables}

U = QCircuit()
if "U" in kwargs:
U = kwargs["U"]
elif hasattr(self.operator_pool, "initialize_circuit"):
U = self.operator_pool.initialize_circuit()

initial_objective = self.make_objective(U, variables = variables)
for k in initial_objective.extract_variables():
Expand Down
8 changes: 6 additions & 2 deletions src/tequila/quantumchemistry/orbital_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __call__(self, local_data, *args, **kwargs):
self.iterations += 1

def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=None, silent=False,
vqe_solver_arguments=None, initial_guess=None, return_mcscf=False, use_hcb=False, molecule_factory=None, *args, **kwargs):
vqe_solver_arguments=None, initial_guess=None, return_mcscf=False, use_hcb=False, molecule_factory=None, molecule_arguments=None, *args, **kwargs):
"""
Parameters
Expand All @@ -60,6 +60,7 @@ def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=N
initial_guess="random_loc=X_scale=Y" with X and Y being floats
This initialized a random guess using numpy.random.normal(loc=X, scale=Y) with X=0.0 and Y=0.1 as defaults
return_mcscf: return the PySCF MCSCF structure after optimization
molecule_arguments: arguments to pass to molecule_factory or default molecule constructor | only change if you know what you are doing
args: just here for convenience
kwargs: just here for conveniece
Expand Down Expand Up @@ -97,7 +98,10 @@ def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=N
if n_qubits > n_orbitals:
warnings.warn("Potential inconsistency in orbital optimization: use_hcb is switched on but we have\n n_qubits={} in the circuit\n n_orbital={} in the molecule\n".format(n_qubits,n_orbitals), TequilaWarning)

wrapper = PySCFVQEWrapper(molecule_arguments={"parameters":pyscf_molecule.parameters, "transformation":molecule.transformation}, n_electrons=pyscf_molecule.n_electrons,
if molecule_arguments is None:
molecule_arguments = {"parameters": pyscf_molecule.parameters, "transformation": molecule.transformation}

wrapper = PySCFVQEWrapper(molecule_arguments=molecule_arguments, n_electrons=pyscf_molecule.n_electrons,
const_part=c, circuit=circuit, vqe_solver_arguments=vqe_solver_arguments, silent=silent,
vqe_solver=vqe_solver, molecule_factory=molecule_factory, *args, **kwargs)
mc.fcisolver = wrapper
Expand Down
4 changes: 4 additions & 0 deletions src/tequila/quantumchemistry/pyscf_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def __init__(self, parameters: ParametersQC,

# solve restricted HF
mf = pyscf.scf.RHF(mol)
mf.verbose = False
if "verbose" in kwargs:
mf.verbose = kwargs["verbose"]

mf.kernel()

# only works if point_group is not C1
Expand Down
2 changes: 1 addition & 1 deletion src/tequila/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.9.1"
__version__ = "1.9.2"
__author__ = "Tequila Developers "

0 comments on commit 934e060

Please sign in to comment.