mindquantum.algorithm.nisq.UCCAnsatz

View Source On Gitee
class mindquantum.algorithm.nisq.UCCAnsatz(n_qubits=None, n_electrons=None, occ_orb=None, vir_orb=None, generalized=False, trotter_step=1)[source]

The unitary coupled-cluster ansatz for molecular simulations.

\[U(\vec{\theta}) = \prod_{j=1}^{N(N\ge1)}{\prod_{i=0}^{N_{j}}{\exp{(\theta_{i}\hat{\tau}_{i})}}}\]

where \(\hat{\tau}\) are anti-Hermitian operators.

Note

Currently, the circuit is constructed using JW transformation. In addition, the reference state wave function (Hartree-Fock) will NOT be included.

Parameters
  • n_qubits (int) – Number of qubits (spin-orbitals). Default: None.

  • n_electrons (int) – Number of electrons (occupied spin-orbitals). Default: None.

  • occ_orb (list) – Indices of manually assigned occupied spatial orbitals, for ansatz construction only. Default: None.

  • vir_orb (list) – Indices of manually assigned virtual spatial orbitals, for ansatz construction only. Default: None.

  • generalized (bool) – Whether to use generalized excitations which do not distinguish occupied or virtual orbitals (UCCGSD). Default: False.

  • trotter_step (int) – The order of Trotterization step. Default: 1.

Examples

>>> from mindquantum.algorithm.nisq import UCCAnsatz
>>> ucc = UCCAnsatz(12, 4, occ_orb=[1],
...                 vir_orb=[2, 3],
...                 generalized=True,
...                 trotter_step=2)
>>> circuit = ucc.circuit.remove_barrier()
>>> len(circuit)
3624
>>> params_list = ucc.circuit.params_name
>>> len(params_list)
48
>>> circuit[-10:]
            ┏━━━━━━━━━━┓ ┏━━━┓                                      ┏━━━┓
q7: ────■───┨ RX(7π/2) ┠─┨ H ┠───■──────────────────────────────■───┨ H ┠──────────
        ┃   ┗━━━━━━━━━━┛ ┗━━━┛   ┃                              ┃   ┗━━━┛
      ┏━┻━┓ ┏━━━┓ ┏━━━━━━━━━┓  ┏━┻━┓ ┏━━━━━━━━━━━━━━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓
q5: ──┨╺╋╸┠─┨ H ┠─┨ RX(π/2) ┠──┨╺╋╸┠─┨ RZ(-1/2*t_1_d0_d_17) ┠─┨╺╋╸┠─┨ RX(7π/2) ┠───
      ┗━━━┛ ┗━━━┛ ┗━━━━━━━━━┛  ┗━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛