Skip to content

Commit 934e060

Browse files
authored
Merge pull request #323 from tequilahub/devel
update-to-1.9.2
2 parents 87625bd + e8ce693 commit 934e060

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

Diff for: src/tequila/apps/adapt/adapt.py

+4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def __call__(self, static_variables = None, mp_pool=None, label=None, variables=
150150
variables = {**variables, **static_variables}
151151

152152
U = QCircuit()
153+
if "U" in kwargs:
154+
U = kwargs["U"]
155+
elif hasattr(self.operator_pool, "initialize_circuit"):
156+
U = self.operator_pool.initialize_circuit()
153157

154158
initial_objective = self.make_objective(U, variables = variables)
155159
for k in initial_objective.extract_variables():

Diff for: src/tequila/quantumchemistry/orbital_optimizer.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __call__(self, local_data, *args, **kwargs):
3737
self.iterations += 1
3838

3939
def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=None, silent=False,
40-
vqe_solver_arguments=None, initial_guess=None, return_mcscf=False, use_hcb=False, molecule_factory=None, *args, **kwargs):
40+
vqe_solver_arguments=None, initial_guess=None, return_mcscf=False, use_hcb=False, molecule_factory=None, molecule_arguments=None, *args, **kwargs):
4141
"""
4242
4343
Parameters
@@ -60,6 +60,7 @@ def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=N
6060
initial_guess="random_loc=X_scale=Y" with X and Y being floats
6161
This initialized a random guess using numpy.random.normal(loc=X, scale=Y) with X=0.0 and Y=0.1 as defaults
6262
return_mcscf: return the PySCF MCSCF structure after optimization
63+
molecule_arguments: arguments to pass to molecule_factory or default molecule constructor | only change if you know what you are doing
6364
args: just here for convenience
6465
kwargs: just here for conveniece
6566
@@ -97,7 +98,10 @@ def optimize_orbitals(molecule, circuit=None, vqe_solver=None, pyscf_arguments=N
9798
if n_qubits > n_orbitals:
9899
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)
99100

100-
wrapper = PySCFVQEWrapper(molecule_arguments={"parameters":pyscf_molecule.parameters, "transformation":molecule.transformation}, n_electrons=pyscf_molecule.n_electrons,
101+
if molecule_arguments is None:
102+
molecule_arguments = {"parameters": pyscf_molecule.parameters, "transformation": molecule.transformation}
103+
104+
wrapper = PySCFVQEWrapper(molecule_arguments=molecule_arguments, n_electrons=pyscf_molecule.n_electrons,
101105
const_part=c, circuit=circuit, vqe_solver_arguments=vqe_solver_arguments, silent=silent,
102106
vqe_solver=vqe_solver, molecule_factory=molecule_factory, *args, **kwargs)
103107
mc.fcisolver = wrapper

Diff for: src/tequila/quantumchemistry/pyscf_interface.py

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def __init__(self, parameters: ParametersQC,
4545

4646
# solve restricted HF
4747
mf = pyscf.scf.RHF(mol)
48+
mf.verbose = False
49+
if "verbose" in kwargs:
50+
mf.verbose = kwargs["verbose"]
51+
4852
mf.kernel()
4953

5054
# only works if point_group is not C1

Diff for: src/tequila/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "1.9.1"
1+
__version__ = "1.9.2"
22
__author__ = "Tequila Developers "

0 commit comments

Comments
 (0)