Skip to content

Commit

Permalink
Merge pull request #67 from qiboteam/code-examples
Browse files Browse the repository at this point in the history
Documentation: Edit and move some pages from `Getting started` to `Tutorials`
  • Loading branch information
damarkian authored Dec 27, 2023
2 parents fbd0bf3 + 0d7cffa commit 115904e
Show file tree
Hide file tree
Showing 17 changed files with 230 additions and 234 deletions.
14 changes: 0 additions & 14 deletions doc/source/api-reference/driver.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/source/api-reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ In this section we document the main Qibochem components and primitives in the p
.. toctree::
:maxdepth: 1

driver
molecule
ansatz
measurement
12 changes: 12 additions & 0 deletions doc/source/api-reference/molecule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

.. _molecule-class:

Molecule
========

Qibochem provides the ``Molecule`` class to save various properties related to the molecular system,
and to drive the classical quantum chemistry calculation to obtain the necessary quantities for any subsequent quantum compute calculations.

.. autoclass:: qibochem.driver.molecule.Molecule
:members:
:member-order: bysource
5 changes: 0 additions & 5 deletions doc/source/code-examples/index.rst

This file was deleted.

7 changes: 4 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import qibochem

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "qibochem"
copyright = "The Qibo team"
Expand All @@ -33,6 +32,9 @@

master_doc = "index"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
Expand Down Expand Up @@ -69,14 +71,13 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#

html_theme = "furo"
html_favicon = "favicon.ico"

# custom title
html_title = "Qibochem · v" + release

# custom html theme options (colors and font)
html_theme_options = {
"top_of_page_button": "edit",
"source_repository": "https://github.com/qiboteam/qibochem/",
Expand Down
10 changes: 2 additions & 8 deletions doc/source/getting-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
Getting started
===============

This section covers the basics of qibochem. More details are given in the following subsections.

This section covers how to install Qibochem and a basic example presenting the functionality of Qibochem.

.. toctree::
:maxdepth: 1

installation
molecule
hamiltonian
ansatz
measurement
..
measurement
quickstart
26 changes: 21 additions & 5 deletions doc/source/getting-started/installation.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
============
Installation
============
Installation instructions
=========================

Using pip install:
Supported operating systems
---------------------------

At the moment, Qibochem is only actively supported on Linux and MacOS systems.
In principle, it should be possible to install and run Qibochem on Windows, but with the caveat that the PySCF driver for obtaining molecular integrals is not available on Windows systems.

.. note::
Qibochem is supported for Python >= 3.9.

..
TODO: update further when package released on pypi
Installing from source
----------------------

Using ``pip install``:

.. code-block::
git clone https://github.com/qiboteam/qibochem.git
cd qibochem
pip install .
Using poetry:
Using ``poetry``:

.. code-block::
git clone https://github.com/qiboteam/qibochem.git
cd qibochem
poetry install
For larger simulations, it may be desirable to install `other backend drivers <https://qibo.science/qibo/stable/getting-started/backends.html/>`_ for Qibo as well.
78 changes: 0 additions & 78 deletions doc/source/getting-started/molecule.rst

This file was deleted.

35 changes: 35 additions & 0 deletions doc/source/getting-started/quickstart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Quick start
-----------

..
TODO: Add pip install when package on pypi
Here is an example of building the UCCD ansatz with the H2 molecule to test your installation:

.. testcode::
import numpy as np
from qibo.models import VQE

from qibochem.driver.molecule import Molecule
from qibochem.ansatz.hf_reference import hf_circuit
from qibochem.ansatz.ucc import ucc_circuit

# Define the H2 molecule and obtain its 1-/2- electron integrals with PySCF
h2 = Molecule([('H', (0.0, 0.0, 0.0)), ('H', (0.0, 0.0, 0.7))])
h2.run_pyscf()
# Generate the molecular Hamiltonian
hamiltonian = h2.hamiltonian()

# Build a UCC circuit ansatz for running VQE
circuit = hf_circuit(h2.nso, sum(h2.nelec))
circuit += ucc_circuit(h2.nso, [0, 1, 2, 3])

# Create and run the VQE, starting with random initial parameters
vqe = VQE(circuit, hamiltonian)

initial_parameters = np.random.uniform(0.0, 2*np.pi, 8)
best, params, extra = vqe.minimize(initial_parameters)


..
TODO: Another example with measurements
7 changes: 4 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ What is Qibochem?

Qibochem is a plugin to Qibo for quantum chemistry simulations.

Qibochem key features:
Key features of Qibochem:

* General purpose Molecule class

- effective Hamiltonian construction for active space
- inline or .xyz file input for molecular geometry

* PySCF or Psi4 for calculation of 1- and 2-electron integrals
* Calculation of 1- and 2-electron integrals with PySCF
* Unitary Coupled Cluster Ansatz


Expand All @@ -27,7 +27,7 @@ available.
1. **Installation and Setup**: Begin by referring to the
:doc:`/getting-started/index` guide to set up the ``Qibochem`` library in your environment.

2. **Tutorials**: Explore the :doc:`/code-examples/index` section for a range of
2. **Tutorials**: Explore the :doc:`/tutorials/index` section for a range of
tutorials that cater to different levels of expertise. These tutorials cover
basic examples, advanced examples and tutorials with algorithm for specific
applications.
Expand All @@ -45,6 +45,7 @@ Contents
:caption: Introduction

getting-started/index
tutorials/index

.. toctree::
:maxdepth: 2
Expand Down
Loading

0 comments on commit 115904e

Please sign in to comment.