Skip to content

Commit 27e0eb0

Browse files
committed
add uccgsd to introduction.rst
Signed-off-by: marwafar <[email protected]>
1 parent c827537 commit 27e0eb0

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/sphinx/components/solvers/introduction.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ CUDA-QX provides several pre-built operator pools for ADAPT-VQE:
497497

498498
* **spin_complement_gsd**: Spin-complemented generalized singles and doubles
499499
* **uccsd**: UCCSD operators
500+
* **uccgsd**: UCC generalized singles and doubles
500501
* **qaoa**: QAOA mixer excitation operators
501502

502503
.. code-block:: python
@@ -513,6 +514,58 @@ CUDA-QX provides several pre-built operator pools for ADAPT-VQE:
513514
num_electrons=molecule.n_electrons
514515
)
515516
517+
uccgsd_ops = solvers.get_operator_pool(
518+
"uccgsd",
519+
num_orbitals=molecule.n_orbitals
520+
)
521+
522+
Available Ansatz
523+
^^^^^^^^^^^^^^^^^^
524+
525+
CUDA-QX provides several state preparations ansatz for VQE.
526+
527+
* **uccsd**: UCCSD operators
528+
* **uccgsd**: UCC generalized singles and doubles
529+
530+
.. code-block:: python
531+
532+
# Using UCCSD ansatz
533+
geometry = [('H', (0., 0., 0.)), ('H', (0., 0., .7474))]
534+
molecule = solvers.create_molecule(geometry, 'sto-3g', 0, 0, casci=True)
535+
536+
numQubits = molecule.n_orbitals * 2
537+
numElectrons = molecule.n_electrons
538+
spin = 0
539+
540+
@cudaq.kernel
541+
def ansatz(thetas: list[float]):
542+
q = cudaq.qvector(numQubits)
543+
for i in range(numElectrons):
544+
x(q[i])
545+
solvers.stateprep.uccsd(q, thetas, numElectrons, spin)
546+
547+
548+
# Using UCCGSD ansatz
549+
geometry = [('H', (0., 0., 0.)), ('H', (0., 0., .7474))]
550+
molecule = solvers.create_molecule(geometry, 'sto-3g', 0, 0, casci=True)
551+
552+
numQubits = molecule.n_orbitals * 2
553+
numElectrons = molecule.n_electrons
554+
555+
# Get grouped Pauli words and coefficients from UCCGSD pool
556+
pauliWordsList, coefficientsList = solvers.stateprep.get_uccgsd_pauli_lists(
557+
numQubits, only_singles=False, only_doubles=False)
558+
559+
@cudaq.kernel
560+
def ansatz(numQubits: int, numElectrons: int, thetas: list[float],
561+
pauliWordsList: list[list[cudaq.pauli_word]],
562+
coefficientsList: list[list[float]]):
563+
q = cudaq.qvector(numQubits)
564+
for i in range(numElectrons):
565+
x(q[i])
566+
solvers.stateprep.uccgsd(q, thetas, pauliWordsList, coefficientsList)
567+
568+
516569
Algorithm Parameters
517570
^^^^^^^^^^^^^^^^^^^^^^
518571

0 commit comments

Comments
 (0)