Skip to content

Commit

Permalink
Draft code-examples documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
chmwzc committed Dec 4, 2023
1 parent 2647294 commit c287677
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
46 changes: 46 additions & 0 deletions doc/source/code-examples/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Basic examples
==============

Here are a few short basic `how to` examples.

How to define a Molecule in Qibochem
------------------------------------

A ``Molecule`` can be defined either inline, or using an ``.xyz`` file. An example for a H2 molecule:

.. code-block::
from qibochem.driver.molecule import Molecule
# Inline definition
h2 = Molecule([('H', (0.0, 0.0, 0.0)), ('H', (0.0, 0.0, 0.74804))])
# From an .xyz file
# h2 = Molecule(xyz_file='h2.xyz')
Interfacing with PSI4/PySCF to obtain the 1-/2- electron integrals
------------------------------------------------------------------

After defining a ``Molecule``, the next step is to obtain the molecular integrals. Qibochem has has functions that interface with either `PySCF`_ or `PSI4`_ to do so:

.. _PySCF: https://pyscf.org/
.. _PSI4: https://psicode.org/

.. code-block::
from qibochem.driver.molecule import Molecule
# Inline definition of H2
h2 = Molecule([('H', (0.0, 0.0, 0.0)), ('H', (0.0, 0.0, 0.74804))])
# Using PySCF
h2.run_pyscf()
# Using PSI4
# h2.run_psi4()
Next section
------------

hello world


11 changes: 11 additions & 0 deletions doc/source/code-examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _examples:

Code examples
=============

This section provides examples of how to use Qibochem.

.. toctree::
:maxdepth: 2

examples
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Contents
:caption: Introduction

getting-started/index
code-examples/index

.. toctree::
:maxdepth: 2
Expand Down

0 comments on commit c287677

Please sign in to comment.