Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 12, 2023
1 parent 837604a commit 8ff1a5c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion doc/source/code-examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ Code examples
=============

This section provides tutorials for using qibochem.

1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@ def setup(app):
app.add_transform(AutoStructify)
app.add_css_file("css/style.css")


html_show_sourcelink = False
14 changes: 7 additions & 7 deletions doc/source/getting-started/ansatz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Example
The energy of the state generated from the hardware efficient ansatz for the fermionic two-body Hamiltonian can then be estimated, using statevectors or samples. The following example calculates the energy of the H2 molecule.

Example
Example
^^^^^^^

.. code-block:: python
.. code-block:: python
from qibochem.driver.molecule import Molecule
from qibochem.measurement.expectation import expectation
Expand All @@ -56,7 +56,7 @@ Example
nlayers = 1
nqubits = mol.nso
ntheta = 2 * nqubits * nlayers
hea_ansatz = hardware_efficient.hea(nlayers, nqubits)
circuit = models.Circuit(nqubits)
circuit.add(gates.X(_i) for _i in range(sum(mol.nelec)))
Expand All @@ -76,11 +76,11 @@ Example
converged SCF energy = -1.11628373627429
classical HF/STO-3G energy for H2 at 0.74804 Angstroms: -1.1162837362742921
quantum hardware-efficient circuit expectation value for thetas:
quantum hardware-efficient circuit expectation value for thetas:
theta energy
-0.2 : -1.091694412147
0.0 : -1.116283736274
0.2 : -1.091694412147
-0.2 : -1.091694412147
0.0 : -1.116283736274
0.2 : -1.091694412147
Unitary Coupled Cluster Ansatz
------------------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/source/getting-started/measurement.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ Example
circuit.add(gates.RZ(0, theta=0.0))
circuit.add(gates.CNOT(1, 0))
circuit.add(gates.RX(0, np.pi/2, trainable=False))
circuit.add(gates.RY(1, -np.pi/2, trainable=False))
circuit.add(gates.RY(1, -np.pi/2, trainable=False))
print(circuit.draw())
def energy_expectation_samples(parameters, circuit, hamiltonian, nshots=1024):
return expectation(circuit, hamiltonian, from_samples=True, n_shots=nshots)
parameters = [0.5]
nshots = 8192
vqe_uccsd = minimize(energy_expectation_samples, parameters, args=(circuit, bk_ham, nshots), method='Powell')
Expand Down

0 comments on commit 8ff1a5c

Please sign in to comment.