mindquantum.simulator.mqchem.CIHamiltonian#
- class mindquantum.simulator.mqchem.CIHamiltonian(fermion_hamiltonian: FermionOperator)#
A wrapper for a fermionic Hamiltonian to be used with the
MQChemSimulator.This class stores a fermionic Hamiltonian for efficient expectation value calculations within a specific CI space.
Note
This Hamiltonian object is specifically designed for the MQChemSimulator and is not compatible with the standard state-vector Simulator.
- Parameters:
fermion_hamiltonian (FermionOperator) – A normal-ordered fermionic Hamiltonian.
Examples
>>> from mindquantum.core.operators import FermionOperator >>> from mindquantum.simulator import mqchem >>> ham_op = FermionOperator('0^ 0', 1.0) + FermionOperator('1^ 1', 0.5) >>> ci_ham = mqchem.CIHamiltonian(ham_op) >>> ci_ham 1 [0^ 0] + 1/2 [1^ 1]
- get_cpp_obj(backend, n_qubits, n_electrons)#
Return the underlying C++ CppCIHamiltonian object for a given backend.
Note
This method is for internal use by the
MQChemSimulator.- Parameters:
backend – The C++ backend module (_mq_chem.float or _mq_chem.double).
n_qubits (int) – The total number of qubits (spin-orbitals) in the system.
n_electrons (int) – The total number of electrons in the system.
- Returns:
The C++ object used for simulation.