Skip to content

Commit

Permalink
Add docs for libmdanalysis (#3922)
Browse files Browse the repository at this point in the history
* add docs for libmdanalysis

* fix spelling error

* add docs

* add example

* Apply suggestions from code review

Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
  • Loading branch information
hmacdope and orbeckst authored Nov 19, 2022
1 parent fc9dee0 commit 497f45e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions package/doc/sphinx/source/documentation_pages/lib_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,31 @@ Python-based projects.

./lib/formats/libmdaxdr
./lib/formats/libdcd

Libmdanalysis
-------------

The :file:`__init__.pxd` file in :mod:`MDAnalysis.lib.libmdanalysis` provides a
single place to ``cimport`` MDAnalysis' public Cython headers. This is recommended
for advanced developers only.

For example, imagine we are writing a Cython extension module in
:mod:`MDAnalysis.lib` and we would like to make a function that creates a
:class:`MDAnalysis.coordinates.timestep.Timestep`

.. code-block:: cython
from MDAnalysis.lib.libmdanalysis cimport timestep
# or we could use the relative cimport
# from .libmdanalysis cimport timestep
cdef timestep.Timestep make_timestep(int natoms):
cdef timestep.Timestep ts = timestep.Timestep(natoms)
return ts
Currently modules that are exposed as public Cython headers are:

- :mod:`MDAnalysis.coordinates.timestep`

For more details consult the source :mod:`MDAnalysis.lib.libmdanalysis.__init__.pxd`

0 comments on commit 497f45e

Please sign in to comment.