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
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 See the :doc:`Python library <Python_library>` doc page for a
description of the Python interface to LAMMPS, which wraps the C-style 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 See the sample codes in examples/COUPLE/simple for examples of C++ and
C and Fortran codes that invoke LAMMPS through its library interface. C and Fortran codes that invoke LAMMPS through its library interface.
Other examples in the COUPLE directory use coupling ideas discussed on Other examples in the COUPLE directory use coupling ideas discussed on
the :doc:`Howto couple <Howto_couple>` doc page. 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 Overview
-------- --------
PyLammps is a Python wrapper class which can be created on its own or ``PyLammps`` is a Python wrapper class for LAMMPS which can be created
use an existing lammps Python object. It creates a simpler, on its own or use an existing lammps Python object. It creates a simpler,
Python-like interface to common LAMMPS functionality, in contrast to more "pythonic" interface to common LAMMPS functionality, in contrast to
the lammps.py wrapper on the C-style LAMMPS library interface which is the ``lammps.py`` wrapper for the C-style LAMMPS library interface which
written using Python ctypes. The lammps.py wrapper is discussed on is written using `Python ctypes <ctypes_>`_. The ``lammps.py`` wrapper
the :doc:`Python library <Python_library>` doc page. is discussed on the :doc:`Python library <Python_library>` doc page.
Unlike the flat ctypes interface, PyLammps exposes a discoverable API. Unlike the flat ``ctypes`` interface, PyLammps exposes a discoverable
It no longer requires knowledge of the underlying C++ code API. It no longer requires knowledge of the underlying C++ code
implementation. Finally, the IPyLammps wrapper builds on top of implementation. Finally, the ``IPyLammps`` wrapper builds on top of
PyLammps and adds some additional features for IPython integration ``PyLammps`` and adds some additional features for
into IPython notebooks, e.g. for embedded visualization output from `IPython integration <ipython_>`_ into `Jupyter notebooks <jupyter_>`_,
dump/image. 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 Comparison of lammps and PyLammps interfaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -26,7 +30,7 @@ Comparison of lammps and PyLammps interfaces
lammps.lammps lammps.lammps
""""""""""""" """""""""""""
* uses C-Types * uses ``ctypes``
* direct memory access to native C++ data * direct memory access to native C++ data
* provides functions to send and receive data to LAMMPS * provides functions to send and receive data to LAMMPS
* requires knowledge of how LAMMPS internally works (C pointers, etc) * requires knowledge of how LAMMPS internally works (C pointers, etc)
@ -34,7 +38,7 @@ lammps.lammps
lammps.PyLammps 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 * manipulation of Python objects
* communication with LAMMPS is hidden from API user * communication with LAMMPS is hidden from API user
* shorter, more concise Python * shorter, more concise Python