From c287677cbb8d2cb41d3baecded581774733e9e76 Mon Sep 17 00:00:00 2001 From: chmwzc <70616433+chmwzc@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:01:24 +0800 Subject: [PATCH] Draft code-examples documentation --- doc/source/code-examples/examples.rst | 46 +++++++++++++++++++++++++++ doc/source/code-examples/index.rst | 11 +++++++ doc/source/index.rst | 1 + 3 files changed, 58 insertions(+) create mode 100644 doc/source/code-examples/examples.rst create mode 100644 doc/source/code-examples/index.rst diff --git a/doc/source/code-examples/examples.rst b/doc/source/code-examples/examples.rst new file mode 100644 index 0000000..56daef8 --- /dev/null +++ b/doc/source/code-examples/examples.rst @@ -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 + + diff --git a/doc/source/code-examples/index.rst b/doc/source/code-examples/index.rst new file mode 100644 index 0000000..ca5822e --- /dev/null +++ b/doc/source/code-examples/index.rst @@ -0,0 +1,11 @@ +.. _examples: + +Code examples +============= + +This section provides examples of how to use Qibochem. + +.. toctree:: + :maxdepth: 2 + + examples diff --git a/doc/source/index.rst b/doc/source/index.rst index 1d44428..f91d0e1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -24,6 +24,7 @@ Contents :caption: Introduction getting-started/index + code-examples/index .. toctree:: :maxdepth: 2