ucc_family

get_energy_ucc

class openvqe.ucc_family.get_energy_ucc.EnergyUCC[source]
get_energies(hamiltonian_sp, cluster_ops_sp, pool_generator, hf_init_sp, theta_current1, theta_current2, fci)[source]

It calls internally the functions “ucc_action” and “prepare_state_ansatz”, and uses scipy.optimize to return the properties of the ucc energy and wave function.

Parameters
  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops_sp (list[Hamiltonian]) – list of spin cluster operators

  • pool_generator – the pool containing the operators made of Pauli strings that doesn’t contain Z-Pauli term.

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

  • theta_current1 (List<float>) – the Parameters of the cluster operators of “cluster_ops_sp”

  • theta_current2 (List<float>) – the Parameters of the cluster operators of “pool_generator”

  • fci (float) – the full configuration interaction energy (for any basis set)

Returns

  • iterations (Dict) – the minimum energy and the optimized parameters

  • result (Dict) – the number of CNOT gates, the number of operators/parameters, and the substraction of the optimized energy from fci.

prepare_state_ansatz(hamiltonian_sp, cluster_ops_sp, hf_init_sp, parameters)[source]

It constructs the trial wave function (ansatz)

Parameters
  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops_sp (list[Hamiltonian]) – list of spin cluster operators

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

  • parameters (List<float>) – the Parameters for the trial wave function to be constructed

Returns

curr_state – the circuit that represent the trial wave function

Return type

qat.core.Circuit

ucc_action(theta_current, hamiltonian_sp, cluster_ops_sp, hf_init_sp)[source]

It maps the exponential of cluster operators (“cluster_ops_sp”) associated by their parameters (“theta_current”) using the CNOTS-staircase method, which is done by “build_ucc_ansatz” which creates the circuit on the top of the HF-state (“hf_init_sp”). Then, this function also calculates the expected value of the hamiltonian (“hamiltonian_sp”).

Parameters
  • theta_current (List<float>) – the Parameters of the cluster operators

  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops_sp (list[Hamiltonian]) – list of spin cluster operators

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

Returns

res.value – the resulted energy

Return type

float

get_energy_qucc

class openvqe.ucc_family.get_energy_qucc.EnergyUCC[source]
action_quccsd(theta_0, hamiltonian_sp, cluster_ops, hf_init_sp)[source]

It returns the energy from the qubit coupled cluster ansatz which are obtained from common_files.circuit

Parameters
  • theta_0 (List<float>) – the Parameters of the cluster operators

  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops (list[Hamiltonian]) – list of fermionic cluster operators

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

Returns

res.value – the resulted energy

Return type

float

get_energies(hamiltonian_sp, cluster_ops, hf_init_sp, theta_current1, theta_current2, FCI)[source]

It calls internally the functions “action_quccsd” and “prepare_state_ansatz”, and uses scipy.optimize to return the properties of

Parameters
  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops (list[Hamiltonian]) – list of fermionic cluster operators

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

  • theta_current1 (List<float>) – MP2 initial guess obtained from “qat.fermion.chemistry.ucc_deprecated.get_cluster_ops_and_init_guess”

  • theta_current2 (List<float>) – fixed values (e.g. 0.0, 0.001, …) or random values (random.uniform(0,1))

  • FCI (float) – the full configuration interaction energy (for any basis set)

Returns

  • iterations (Dict) – the minimum energy and the optimized parameters

  • result (Dict) – the number of CNOT gates, the number of operators/parameters, and the substraction of the optimized energy from fci.

prepare_hf_state(hf_init_sp, cluster_ops_sp)[source]

It constructs the Hartree-Fock state (ansatz)

Parameters
  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

  • cluster_ops_sp (list[Hamiltonian]) – list of spin cluster operators

Returns

circuit – the circuit representing the HF-state

Return type

qat.core.Circuit

prepare_state_ansatz(hamiltonian_sp, hf_init_sp, cluster_ops, theta)[source]

It constructs the “qubit coupled cluster” trial wave function (ansatz)

Parameters
  • hamiltonian_sp (Hamiltonian) – Hamiltonian in the spin representation

  • cluster_ops (list[Hamiltonian]) – list of fermionic cluster operators

  • hf_init_sp (int) – the integer corresponds to the hf_init (The Hartree-Fock state in integer representation) obtained by using “qat.fermion.transforms.record_integer”.

  • theta (List<float>) – the Parameters for the trial wave function to be constructed

Returns

curr_state – the circuit that represent the trial wave function

Return type

qat.core.Circuit