tequila-basic 1.9.9__py3-none-any.whl → 1.9.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tequila/__init__.py +29 -14
- tequila/apps/__init__.py +14 -5
- tequila/apps/_unary_state_prep_impl.py +145 -112
- tequila/apps/adapt/__init__.py +9 -1
- tequila/apps/adapt/adapt.py +154 -113
- tequila/apps/krylov/__init__.py +1 -1
- tequila/apps/krylov/krylov.py +23 -21
- tequila/apps/robustness/helpers.py +10 -6
- tequila/apps/robustness/interval.py +238 -156
- tequila/apps/unary_state_prep.py +29 -23
- tequila/autograd_imports.py +8 -5
- tequila/circuit/__init__.py +2 -1
- tequila/circuit/_gates_impl.py +135 -67
- tequila/circuit/circuit.py +163 -79
- tequila/circuit/compiler.py +114 -105
- tequila/circuit/gates.py +288 -120
- tequila/circuit/gradient.py +35 -23
- tequila/circuit/noise.py +83 -74
- tequila/circuit/postselection.py +120 -0
- tequila/circuit/pyzx.py +10 -6
- tequila/circuit/qasm.py +201 -83
- tequila/circuit/qpic.py +63 -61
- tequila/grouping/binary_rep.py +148 -146
- tequila/grouping/binary_utils.py +84 -75
- tequila/grouping/compile_groups.py +334 -230
- tequila/grouping/ev_utils.py +77 -41
- tequila/grouping/fermionic_functions.py +383 -308
- tequila/grouping/fermionic_methods.py +170 -123
- tequila/grouping/overlapping_methods.py +69 -52
- tequila/hamiltonian/paulis.py +12 -13
- tequila/hamiltonian/paulistring.py +1 -1
- tequila/hamiltonian/qubit_hamiltonian.py +45 -35
- tequila/ml/__init__.py +1 -0
- tequila/ml/interface_torch.py +19 -16
- tequila/ml/ml_api.py +11 -10
- tequila/ml/utils_ml.py +12 -11
- tequila/objective/__init__.py +8 -3
- tequila/objective/braket.py +55 -47
- tequila/objective/objective.py +87 -55
- tequila/objective/qtensor.py +36 -27
- tequila/optimizers/__init__.py +31 -23
- tequila/optimizers/_containers.py +11 -7
- tequila/optimizers/optimizer_base.py +111 -83
- tequila/optimizers/optimizer_gd.py +258 -231
- tequila/optimizers/optimizer_gpyopt.py +56 -42
- tequila/optimizers/optimizer_scipy.py +157 -112
- tequila/quantumchemistry/__init__.py +66 -38
- tequila/quantumchemistry/chemistry_tools.py +393 -209
- tequila/quantumchemistry/encodings.py +121 -13
- tequila/quantumchemistry/madness_interface.py +170 -96
- tequila/quantumchemistry/orbital_optimizer.py +86 -41
- tequila/quantumchemistry/psi4_interface.py +166 -97
- tequila/quantumchemistry/pyscf_interface.py +70 -23
- tequila/quantumchemistry/qc_base.py +866 -414
- tequila/simulators/__init__.py +0 -3
- tequila/simulators/simulator_api.py +247 -105
- tequila/simulators/simulator_aqt.py +102 -0
- tequila/simulators/simulator_base.py +147 -53
- tequila/simulators/simulator_cirq.py +58 -42
- tequila/simulators/simulator_cudaq.py +600 -0
- tequila/simulators/simulator_ddsim.py +390 -0
- tequila/simulators/simulator_mqp.py +30 -0
- tequila/simulators/simulator_pyquil.py +190 -171
- tequila/simulators/simulator_qibo.py +95 -87
- tequila/simulators/simulator_qiskit.py +119 -107
- tequila/simulators/simulator_qlm.py +52 -26
- tequila/simulators/simulator_qulacs.py +74 -52
- tequila/simulators/simulator_spex.py +95 -60
- tequila/simulators/simulator_symbolic.py +6 -5
- tequila/simulators/test_spex_simulator.py +8 -11
- tequila/tools/convenience.py +4 -4
- tequila/tools/qng.py +72 -64
- tequila/tools/random_generators.py +38 -34
- tequila/utils/bitstrings.py +7 -7
- tequila/utils/exceptions.py +19 -5
- tequila/utils/joined_transformation.py +8 -10
- tequila/utils/keymap.py +0 -5
- tequila/utils/misc.py +6 -4
- tequila/version.py +1 -1
- tequila/wavefunction/qubit_wavefunction.py +47 -28
- {tequila_basic-1.9.9.dist-info → tequila_basic-1.9.10.dist-info}/METADATA +13 -16
- tequila_basic-1.9.10.dist-info/RECORD +93 -0
- {tequila_basic-1.9.9.dist-info → tequila_basic-1.9.10.dist-info}/WHEEL +1 -1
- tequila_basic-1.9.9.dist-info/RECORD +0 -88
- {tequila_basic-1.9.9.dist-info → tequila_basic-1.9.10.dist-info}/licenses/LICENSE +0 -0
- {tequila_basic-1.9.9.dist-info → tequila_basic-1.9.10.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,9 @@ from .qc_base import QuantumChemistryBase
|
|
6
6
|
from .chemistry_tools import ParametersQC, NBodyTensor
|
7
7
|
from .madness_interface import QuantumChemistryMadness
|
8
8
|
|
9
|
+
# needs pyscf (handeled in call)
|
10
|
+
from .orbital_optimizer import optimize_orbitals
|
11
|
+
|
9
12
|
|
10
13
|
SUPPORTED_QCHEMISTRY_BACKENDS = ["base", "psi4", "madness", "pyscf"]
|
11
14
|
INSTALLED_QCHEMISTRY_BACKENDS = {"base": QuantumChemistryBase, "madness": QuantumChemistryMadness}
|
@@ -35,15 +38,17 @@ def show_supported_modules():
|
|
35
38
|
print(SUPPORTED_QCHEMISTRY_BACKENDS)
|
36
39
|
|
37
40
|
|
38
|
-
def Molecule(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
def Molecule(
|
42
|
+
geometry: str = None,
|
43
|
+
basis_set: str = None,
|
44
|
+
transformation: typing.Union[str, typing.Callable] = None,
|
45
|
+
orbital_type: str = None,
|
46
|
+
backend: str = None,
|
47
|
+
guess_wfn=None,
|
48
|
+
name: str = None,
|
49
|
+
*args,
|
50
|
+
**kwargs,
|
51
|
+
) -> QuantumChemistryBase:
|
47
52
|
"""
|
48
53
|
|
49
54
|
Parameters
|
@@ -72,11 +77,14 @@ def Molecule(geometry: str = None,
|
|
72
77
|
|
73
78
|
# failsafe for common mistake
|
74
79
|
if "basis" in kwargs:
|
75
|
-
warnings.warn(
|
80
|
+
warnings.warn(
|
81
|
+
'called molecule with keyword "basis={0}" converting it to "basis_set={0}"'.format(kwargs["basis"]),
|
82
|
+
TequilaWarning,
|
83
|
+
)
|
76
84
|
if basis_set is not None:
|
77
|
-
warnings.warn(
|
78
|
-
basis_set=kwargs["basis"]
|
79
|
-
|
85
|
+
warnings.warn('did not convert as "basis_set={}" was already given'.format(basis_set), TequilaWarning)
|
86
|
+
basis_set = kwargs["basis"]
|
87
|
+
|
80
88
|
keyvals = {}
|
81
89
|
for k, v in kwargs.items():
|
82
90
|
if k in ParametersQC.__dict__.keys():
|
@@ -98,11 +106,21 @@ def Molecule(geometry: str = None,
|
|
98
106
|
basis_set = "mra"
|
99
107
|
parameters.basis_set = basis_set
|
100
108
|
if orbital_type is not None and orbital_type.lower() not in ["pno", "mra-pno"]:
|
101
|
-
warnings.warn(
|
109
|
+
warnings.warn(
|
110
|
+
"only PNOs supported as orbital_type without basis set. Setting to pno - You gave={}".format(
|
111
|
+
orbital_type
|
112
|
+
),
|
113
|
+
TequilaWarning,
|
114
|
+
)
|
102
115
|
orbital_type = "pno"
|
103
116
|
else:
|
104
117
|
if orbital_type is not None and orbital_type.lower() not in ["hf", "native"]:
|
105
|
-
warnings.warn(
|
118
|
+
warnings.warn(
|
119
|
+
"only hf and native supported as orbital_type with basis-set. Setting to hf - You gave={}".format(
|
120
|
+
orbital_type
|
121
|
+
),
|
122
|
+
TequilaWarning,
|
123
|
+
)
|
106
124
|
orbital_type = "hf"
|
107
125
|
if orbital_type is None:
|
108
126
|
orbital_type = "hf"
|
@@ -113,12 +131,14 @@ def Molecule(geometry: str = None,
|
|
113
131
|
backend = "pyscf"
|
114
132
|
else:
|
115
133
|
raise Exception("No quantum chemistry backends installed on your system")
|
116
|
-
|
134
|
+
|
117
135
|
elif backend == "base":
|
118
136
|
if not integrals_provided:
|
119
|
-
raise Exception(
|
120
|
-
|
121
|
-
|
137
|
+
raise Exception(
|
138
|
+
"No quantum chemistry backends installed on your system\n"
|
139
|
+
"To use the base functionality you need to pass the following tensors via keyword\n"
|
140
|
+
"one_body_integrals, two_body_integrals\n"
|
141
|
+
)
|
122
142
|
else:
|
123
143
|
backend = "base"
|
124
144
|
|
@@ -128,7 +148,7 @@ def Molecule(geometry: str = None,
|
|
128
148
|
if backend not in INSTALLED_QCHEMISTRY_BACKENDS:
|
129
149
|
raise Exception(str(backend) + " was not found on your system")
|
130
150
|
|
131
|
-
if guess_wfn is not None and backend !=
|
151
|
+
if guess_wfn is not None and backend != "psi4":
|
132
152
|
raise Exception("guess_wfn only works for psi4")
|
133
153
|
|
134
154
|
if basis_set is None and backend.lower() not in ["base", "madness"] and not integrals_provided:
|
@@ -137,8 +157,14 @@ def Molecule(geometry: str = None,
|
|
137
157
|
basis_set = "custom"
|
138
158
|
parameters.basis_set = basis_set
|
139
159
|
|
140
|
-
return INSTALLED_QCHEMISTRY_BACKENDS[backend.lower()](
|
141
|
-
|
160
|
+
return INSTALLED_QCHEMISTRY_BACKENDS[backend.lower()](
|
161
|
+
parameters=parameters,
|
162
|
+
transformation=transformation,
|
163
|
+
orbital_type=orbital_type,
|
164
|
+
guess_wfn=guess_wfn,
|
165
|
+
*args,
|
166
|
+
**kwargs,
|
167
|
+
)
|
142
168
|
|
143
169
|
|
144
170
|
def MoleculeFromTequila(mol, transformation=None, backend=None, *args, **kwargs):
|
@@ -151,16 +177,21 @@ def MoleculeFromTequila(mol, transformation=None, backend=None, *args, **kwargs)
|
|
151
177
|
backend = "base"
|
152
178
|
if transformation is None:
|
153
179
|
transformation = mol.transformation
|
154
|
-
return INSTALLED_QCHEMISTRY_BACKENDS[backend.lower()](
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
180
|
+
return INSTALLED_QCHEMISTRY_BACKENDS[backend.lower()](
|
181
|
+
parameters=parameters,
|
182
|
+
transformation=transformation,
|
183
|
+
n_electrons=mol.n_electrons,
|
184
|
+
one_body_integrals=h,
|
185
|
+
two_body_integrals=g,
|
186
|
+
nuclear_repulsion=c,
|
187
|
+
*args,
|
188
|
+
**kwargs,
|
189
|
+
)
|
190
|
+
|
191
|
+
|
192
|
+
def MoleculeFromOpenFermion(
|
193
|
+
molecule, transformation: typing.Union[str, typing.Callable] = None, backend: str = None, *args, **kwargs
|
194
|
+
) -> QuantumChemistryBase:
|
164
195
|
"""
|
165
196
|
Initialize a tequila Molecule directly from an openfermion molecule object
|
166
197
|
Parameters
|
@@ -178,9 +209,6 @@ def MoleculeFromOpenFermion(molecule,
|
|
178
209
|
if backend is None:
|
179
210
|
return QuantumChemistryBase.from_openfermion(molecule=molecule, transformation=transformation, *args, **kwargs)
|
180
211
|
else:
|
181
|
-
INSTALLED_QCHEMISTRY_BACKENDS[backend].from_openfermion(
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
# needs pyscf (handeled in call)
|
186
|
-
from .orbital_optimizer import optimize_orbitals
|
212
|
+
INSTALLED_QCHEMISTRY_BACKENDS[backend].from_openfermion(
|
213
|
+
molecule=molecule, transformation=transformation, *args, **kwargs
|
214
|
+
)
|