mindquantum.simulator.mqchem.SequentialUCCAnsatz
- class mindquantum.simulator.mqchem.SequentialUCCAnsatz(n_qubits=None, n_electrons=None)[source]
Sequential Unitary Coupled-Cluster (UCC) Ansatz.
This class allows constructing a UCC ansatz by adding excitation operators sequentially. Unlike
FermionOperatorwhich merges terms with the same index, this class preserves the order and distinctness of each added term, enabling the construction of multi-layer or Trotterized ansatzes where the same excitation operator may appear multiple times with different parameters.Note
The generated circuit uses
UCCExcitationGate, which is intended forMQChemSimulator.- Parameters
Examples
>>> from mindquantum.simulator import mqchem >>> from mindquantum.core.operators import FermionOperator >>> ansatz = mqchem.SequentialUCCAnsatz() >>> ansatz.append(FermionOperator("3^ 1", "a")) >>> ansatz.append(FermionOperator("4^ 2", "b")) >>> ansatz.append(FermionOperator("3^ 1", "c")) >>> print(len(ansatz.circuit)) 3 >>> print(ansatz.circuit.params_name) ['a', 'b', 'c']
- append(operator)[source]
Append a FermionOperator to the ansatz.
- Parameters
operator (FermionOperator) – The excitation operator to add. Must have exactly one term.
- property circuit: mindquantum.core.circuit.circuit.Circuit
Get the generated ansatz circuit.
- property operators
Return the list of operators in the ansatz.