diff --git a/src/tequila/apps/adapt/adapt.py b/src/tequila/apps/adapt/adapt.py index 7152afc4..6b8dd9e9 100644 --- a/src/tequila/apps/adapt/adapt.py +++ b/src/tequila/apps/adapt/adapt.py @@ -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(): diff --git a/src/tequila/quantumchemistry/orbital_optimizer.py b/src/tequila/quantumchemistry/orbital_optimizer.py index c8c9877e..06b36553 100644 --- a/src/tequila/quantumchemistry/orbital_optimizer.py +++ b/src/tequila/quantumchemistry/orbital_optimizer.py @@ -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 @@ -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 @@ -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 diff --git a/src/tequila/quantumchemistry/pyscf_interface.py b/src/tequila/quantumchemistry/pyscf_interface.py index 61c448d2..bed3cc5d 100644 --- a/src/tequila/quantumchemistry/pyscf_interface.py +++ b/src/tequila/quantumchemistry/pyscf_interface.py @@ -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 diff --git a/src/tequila/version.py b/src/tequila/version.py index be5769f1..27d47a90 100644 --- a/src/tequila/version.py +++ b/src/tequila/version.py @@ -1,2 +1,2 @@ -__version__ = "1.9.1" +__version__ = "1.9.2" __author__ = "Tequila Developers "