add links to ctypes, ipython, and jupyter

This commit is contained in:
Axel Kohlmeyer 2020-03-18 07:01:06 -04:00
parent f1679cd58c
commit 38b1bf9ba5
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 21 additions and 15 deletions

View File

@ -240,9 +240,11 @@ C-style interface, provided in src/library.cpp and src/library.h.
See the :doc:`Python library <Python_library>` doc page for a
description of the Python interface to LAMMPS, which wraps the C-style
interface from a shared library through the ctypes python module.
interface from a shared library through the `ctypes python module <ctypes_>`_.
See the sample codes in examples/COUPLE/simple for examples of C++ and
C and Fortran codes that invoke LAMMPS through its library interface.
Other examples in the COUPLE directory use coupling ideas discussed on
the :doc:`Howto couple <Howto_couple>` doc page.
.. _ctypes: https://docs.python.org/3/library/ctypes.html

View File

@ -6,19 +6,23 @@ PyLammps Tutorial
Overview
--------
PyLammps is a Python wrapper class which can be created on its own or
use an existing lammps Python object. It creates a simpler,
Python-like interface to common LAMMPS functionality, in contrast to
the lammps.py wrapper on the C-style LAMMPS library interface which is
written using Python ctypes. The lammps.py wrapper is discussed on
the :doc:`Python library <Python_library>` doc page.
``PyLammps`` is a Python wrapper class for LAMMPS which can be created
on its own or use an existing lammps Python object. It creates a simpler,
more "pythonic" interface to common LAMMPS functionality, in contrast to
the ``lammps.py`` wrapper for the C-style LAMMPS library interface which
is written using `Python ctypes <ctypes_>`_. The ``lammps.py`` wrapper
is discussed on the :doc:`Python library <Python_library>` doc page.
Unlike the flat ctypes interface, PyLammps exposes a discoverable API.
It no longer requires knowledge of the underlying C++ code
implementation. Finally, the IPyLammps wrapper builds on top of
PyLammps and adds some additional features for IPython integration
into IPython notebooks, e.g. for embedded visualization output from
dump/image.
Unlike the flat ``ctypes`` interface, PyLammps exposes a discoverable
API. It no longer requires knowledge of the underlying C++ code
implementation. Finally, the ``IPyLammps`` wrapper builds on top of
``PyLammps`` and adds some additional features for
`IPython integration <ipython_>`_ into `Jupyter notebooks <jupyter_>`_,
e.g. for embedded visualization output from :doc:`dump style image <dump_image>`.
.. _ctypes: https://docs.python.org/3/library/ctypes.html
.. _ipython: https://ipython.org/
.. _jupyter: https://jupyter.org/
Comparison of lammps and PyLammps interfaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -26,7 +30,7 @@ Comparison of lammps and PyLammps interfaces
lammps.lammps
"""""""""""""
* uses C-Types
* uses ``ctypes``
* direct memory access to native C++ data
* provides functions to send and receive data to LAMMPS
* requires knowledge of how LAMMPS internally works (C pointers, etc)
@ -34,7 +38,7 @@ lammps.lammps
lammps.PyLammps
"""""""""""""""
* higher-level abstraction built on top of original C-Types interface
* higher-level abstraction built on top of original ctypes interface
* manipulation of Python objects
* communication with LAMMPS is hidden from API user
* shorter, more concise Python