diff --git a/doc/source/getting-started/quickstart.rst b/doc/source/getting-started/quickstart.rst index 6d491cd..a2ed28d 100644 --- a/doc/source/getting-started/quickstart.rst +++ b/doc/source/getting-started/quickstart.rst @@ -25,7 +25,7 @@ Here is an example of building the UCCD ansatz with the H2 molecule to test your hamiltonian = h2.hamiltonian() # Build a UCC circuit ansatz for running VQE - circuit = hf_circuit(h2.nso, sum(h2.nelec)) + circuit = hf_circuit(h2.nso, h2.nelec) circuit += ucc_circuit(h2.nso, [0, 1, 2, 3]) # Create and run the VQE, starting with random initial parameters diff --git a/doc/source/tutorials/ansatz.rst b/doc/source/tutorials/ansatz.rst index ae3ff31..09b76e2 100644 --- a/doc/source/tutorials/ansatz.rst +++ b/doc/source/tutorials/ansatz.rst @@ -120,7 +120,7 @@ An example of how to build a UCC doubles circuit ansatz for the :math:`H_2` mole # Set parameters for the rest of the experiment n_qubits = mol.nso - n_electrons = mol.nalpha + mol.nbeta + n_electrons = mol.nelec # Build UCCD circuit circuit = hf_circuit(n_qubits, n_electrons) # Start with HF circuit diff --git a/src/qibochem/ansatz/ucc.py b/src/qibochem/ansatz/ucc.py index a234c1b..9888be1 100644 --- a/src/qibochem/ansatz/ucc.py +++ b/src/qibochem/ansatz/ucc.py @@ -300,7 +300,7 @@ def ucc_ansatz( Qibo ``Circuit``: Circuit corresponding to an UCC ansatz """ # Get the number of electrons and spin-orbitals from the molecule argument - n_elec = sum(molecule.nelec) if molecule.n_active_e is None else molecule.n_active_e + n_elec = molecule.nelec if molecule.n_active_e is None else molecule.n_active_e n_orbs = molecule.nso if molecule.n_active_orbs is None else molecule.n_active_orbs # Define the excitation level to be used if no excitations given