Update docs, fix typos
This commit is contained in:
@ -137,17 +137,11 @@ Here are simple examples using all three Python interfaces:
|
|||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|
||||||
from lammps import lammps, PyLammps
|
from lammps import lammps, PyLammps
|
||||||
|
...
|
||||||
# NOTE: argv[0] is set by the lammps class constructor
|
|
||||||
args = ["-log", "none"]
|
|
||||||
# create LAMMPS instance
|
# create LAMMPS instance
|
||||||
lmp = lammps(cmdargs=args)
|
lmp = lammps(cmdargs=args)
|
||||||
# create PyLammps instance using previously created LAMMPS instance
|
# create PyLammps instance using previously created LAMMPS instance
|
||||||
L = PyLammps(ptr=lmp)
|
L = PyLammps(ptr=lmp)
|
||||||
# get and print numerical version code
|
|
||||||
print("LAMMPS Version: ", L.version())
|
|
||||||
# explicitly close and delete LAMMPS instance (optional)
|
|
||||||
L.close()
|
|
||||||
|
|
||||||
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
||||||
instance is a specific way, but want to take advantage of the
|
instance is a specific way, but want to take advantage of the
|
||||||
@ -178,17 +172,11 @@ Here are simple examples using all three Python interfaces:
|
|||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|
||||||
from lammps import lammps, IPyLammps
|
from lammps import lammps, IPyLammps
|
||||||
|
...
|
||||||
# NOTE: argv[0] is set by the lammps class constructor
|
|
||||||
args = ["-log", "none"]
|
|
||||||
# create LAMMPS instance
|
# create LAMMPS instance
|
||||||
lmp = lammps(cmdargs=args)
|
lmp = lammps(cmdargs=args)
|
||||||
# create IPyLammps instance using previously created LAMMPS instance
|
# create PyLammps instance using previously created LAMMPS instance
|
||||||
L = IPyLammps(ptr=lmp)
|
L = PyLammps(ptr=lmp)
|
||||||
# get and print numerical version code
|
|
||||||
print("LAMMPS Version: ", L.version())
|
|
||||||
# explicitly close and delete LAMMPS instance (optional)
|
|
||||||
L.close()
|
|
||||||
|
|
||||||
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
||||||
instance is a specific way, but want to take advantage of the
|
instance is a specific way, but want to take advantage of the
|
||||||
@ -216,7 +204,7 @@ to "compute" what the next LAMMPS command should be.
|
|||||||
.. tab:: lammps API
|
.. tab:: lammps API
|
||||||
|
|
||||||
Same as in the equivalent
|
Same as in the equivalent
|
||||||
`C library functions <pg_lib_execute>`, commands can be read from a file, a
|
:doc:`C library functions <pg_lib_execute>`, commands can be read from a file, a
|
||||||
single string, a list of strings and a block of commands in a single
|
single string, a list of strings and a block of commands in a single
|
||||||
multi-line string. They are processed under the same boundary conditions
|
multi-line string. They are processed under the same boundary conditions
|
||||||
as the C library counterparts. The example below demonstrates the use
|
as the C library counterparts. The example below demonstrates the use
|
||||||
@ -248,32 +236,34 @@ to "compute" what the next LAMMPS command should be.
|
|||||||
Unlike the lammps API, the PyLammps/IPyLammps APIs allow running LAMMPS
|
Unlike the lammps API, the PyLammps/IPyLammps APIs allow running LAMMPS
|
||||||
commands by calling equivalent member functions.
|
commands by calling equivalent member functions.
|
||||||
|
|
||||||
For instance, the following LAMMPS command:
|
For instance, the following LAMMPS command
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
region box block 0 10 0 5 -0.5 0.5
|
region box block 0 10 0 5 -0.5 0.5
|
||||||
|
|
||||||
In the original interface this command can be executed with the following
|
can be executed using the following Python code if *L* is a :py:class:`lammps` instance:
|
||||||
Python code if *L* was a lammps instance:
|
|
||||||
|
|
||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|
||||||
L.command("region box block 0 10 0 5 -0.5 0.5")
|
L.command("region box block 0 10 0 5 -0.5 0.5")
|
||||||
|
|
||||||
With the PyLammps interface, any command can be split up into arbitrary parts
|
With the PyLammps interface, any LAMMPS command can be split up into arbitrary parts.
|
||||||
separated by white-space, passed as individual arguments to a :code:`region` method.
|
These parts are then passed to a member function with the name of the command.
|
||||||
|
For the ``region`` command that means the :code:`region` method can be called.
|
||||||
|
The arguments of the command can be passed as one string, or
|
||||||
|
individually.
|
||||||
|
|
||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|
||||||
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
||||||
|
|
||||||
Note that each parameter is set as Python literal floating-point number. In the
|
In this example all parameters except the first are Python floating-point literals. The
|
||||||
PyLammps interface, each command takes an arbitrary parameter list and transparently
|
PyLammps interface takes the entire parameter list and transparently
|
||||||
merges it to a single command string, separating individual parameters by white-space.
|
merges it to a single command string.
|
||||||
|
|
||||||
The benefit of this approach is avoiding redundant command calls and easier
|
The benefit of this approach is avoiding redundant command calls and easier
|
||||||
parameterization. In the original interface parameterization needed to be done
|
parameterization. In the original interface parameterization this needed to be done
|
||||||
manually by creating formatted strings.
|
manually by creating formatted strings.
|
||||||
|
|
||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|||||||
@ -888,8 +888,8 @@ class lammps(object):
|
|||||||
list of the supported keywords.
|
list of the supported keywords.
|
||||||
This function returns ``None`` if the keyword is not
|
This function returns ``None`` if the keyword is not
|
||||||
recognized. Otherwise it will return a positive integer value that
|
recognized. Otherwise it will return a positive integer value that
|
||||||
corresponds to one of the contants define in the :py:mod:`lammps` module:
|
corresponds to one of the constants define in the :py:mod:`lammps` module:
|
||||||
``LAMMPS_INT``, ``LAMMPS_INT2D``, ``LAMMPS_DOUBLE``,``LAMMPS_DOUBLE2D``,
|
``LAMMPS_INT``, ``LAMMPS_INT2D``, ``LAMMPS_DOUBLE``, ``LAMMPS_DOUBLE2D``,
|
||||||
``LAMMPS_BIGINT``, ``LAMMPS_TAGINT``, ``LAMMPS_TAGINT2D``, and ``LAMMPS_STRING``.
|
``LAMMPS_BIGINT``, ``LAMMPS_TAGINT``, ``LAMMPS_TAGINT2D``, and ``LAMMPS_STRING``.
|
||||||
|
|
||||||
:param name: name of the property
|
:param name: name of the property
|
||||||
@ -964,8 +964,8 @@ class lammps(object):
|
|||||||
list of the supported keywords.
|
list of the supported keywords.
|
||||||
This function returns ``None`` if the keyword is not
|
This function returns ``None`` if the keyword is not
|
||||||
recognized. Otherwise it will return a positive integer value that
|
recognized. Otherwise it will return a positive integer value that
|
||||||
corresponds to one of the contants define in the :py:mod:`lammps` module:
|
corresponds to one of the constants define in the :py:mod:`lammps` module:
|
||||||
``LAMMPS_INT``, ``LAMMPS_INT2D``, ``LAMMPS_DOUBLE``,``LAMMPS_DOUBLE2D``,
|
``LAMMPS_INT``, ``LAMMPS_INT2D``, ``LAMMPS_DOUBLE``, ``LAMMPS_DOUBLE2D``,
|
||||||
``LAMMPS_BIGINT``, ``LAMMPS_TAGINT``, ``LAMMPS_TAGINT2D``, and ``LAMMPS_STRING``.
|
``LAMMPS_BIGINT``, ``LAMMPS_TAGINT``, ``LAMMPS_TAGINT2D``, and ``LAMMPS_STRING``.
|
||||||
|
|
||||||
:param name: name of the property
|
:param name: name of the property
|
||||||
|
|||||||
Reference in New Issue
Block a user