Ansatz#
This section covers the API reference for various chemistry ansatzes.
Hardware-efficient#
- qibochem.ansatz.hardware_efficient.hea(n_layers, n_qubits, parameter_gates=['RY', 'RZ'], coupling_gates='CZ')#
Builds the generalized hardware-efficient ansatz, in which the rotation and entangling gates used can be chosen by the user
- Parameters:
n_layers – Number of layers of rotation and entangling gates
n_qubits – Number of qubits in the quantum circuit
parameter_gates – List of single-qubit rotation gates to be used in the ansatz. The gates should be given as strings representing valid
Qibo
one-qubit gates. Default:["RY", "RZ"]
coupling_gates – String representing the two-qubit entangling gate to be used in the ansatz; should be a valid two-qubit
Qibo
gate. Default:"CZ"
- Returns:
List of gates corresponding to the hardware-efficient ansatz
Hartree-Fock#
- qibochem.ansatz.hf_reference.hf_circuit(n_qubits, n_electrons, ferm_qubit_map=None)#
Circuit to prepare a Hartree-Fock state
- Parameters:
n_qubits – Number of qubits in the quantum circuit
n_electrons – Number of electrons in the molecular system
ferm_qubit_map – Fermion to qubit map. Must be either Jordan-Wigner (
jw
) or Brayvi-Kitaev (bk
). Default value isjw
.
- Returns:
Qibo
Circuit
initialized in a HF reference state
Unitary Coupled Cluster#
- qibochem.ansatz.ucc.ucc_circuit(n_qubits, excitation, theta=0.0, trotter_steps=1, ferm_qubit_map=None, coeffs=None)#
Circuit corresponding to the unitary coupled-cluster ansatz for a single excitation
- Parameters:
n_qubits – Number of qubits in the quantum circuit
excitation – Iterable of orbitals involved in the excitation; must have an even number of elements E.g.
[0, 1, 2, 3]
represents the excitation of electrons in orbitals(0, 1)
to(2, 3)
theta – UCC parameter. Defaults to 0.0
trotter_steps – Number of Trotter steps; i.e. number of times the UCC ansatz is applied with theta = theta / trotter_steps
ferm_qubit_map – Fermion-to-qubit transformation. Default is Jordan-Wigner (
jw
).coeffs – List to hold the coefficients for the rotation parameter in each Pauli string. May be useful in running the VQE. WARNING: Will be modified in this function
- Returns:
Qibo
Circuit
corresponding to a single UCC excitation
Basis rotation#
- qibochem.ansatz.basis_rotation.br_circuit(n_qubits, parameters, n_occ)#
Google’s basis rotation circuit, applied between the occupied/virtual orbitals. Forms the exp(kappa) matrix, decomposes it into Givens rotations, and sets the circuit parameters based on the Givens rotation decomposition. Note: Supposed to be used with the JW fermion-to-qubit mapping
- Parameters:
n_qubits – Number of qubits in the quantum circuit
parameters – Rotation parameters for exp(kappa); Must have (n_occ * n_virt) parameters
n_occ – Number of occupied orbitals
- Returns:
Qibo
Circuit
corresponding to the basis rotation ansatz between the occupied and virtual orbitals