some more grammar updates and clarifications

This commit is contained in:
Axel Kohlmeyer
2022-11-15 03:45:04 -05:00
parent 175b2b045a
commit 3fd122311d

View File

@ -87,15 +87,15 @@ Examples
Description Description
""""""""""" """""""""""
The *python* command allows to interface LAMMPS with an embedded Python The *python* command allows interfacing LAMMPS with an embedded Python
interpreter and enables either executing arbitrary python code in that interpreter and enables either executing arbitrary python code in that
interpreter, registering a Python function for future execution (as a interpreter, registering a Python function for future execution (as a
python style variable, from a fix interfaced with python or for direct python style variable, from a fix interfaced with python, or for direct
invocation), or invoking such a previously registered function. invocation), or invoking such a previously registered function.
Arguments, including LAMMPS variables, can be passed to the function Arguments, including LAMMPS variables, can be passed to the function
from the LAMMPS input script and a value returned by the Python function from the LAMMPS input script and a value returned by the Python function
to a LAMMPS variable. The Python code for the function can be included assigned to a LAMMPS variable. The Python code for the function can be included
directly in the input script or in a separate Python file. The function directly in the input script or in a separate Python file. The function
can be standard Python code or it can make "callbacks" to LAMMPS through can be standard Python code or it can make "callbacks" to LAMMPS through
its library interface to query or set internal values within LAMMPS. its library interface to query or set internal values within LAMMPS.
@ -132,14 +132,16 @@ of the python command.
If the *source* keyword is used, it is followed by either a file name or If the *source* keyword is used, it is followed by either a file name or
the *here* keyword. No other keywords can be used. The *here* keyword the *here* keyword. No other keywords can be used. The *here* keyword
is followed by a string with python commands, either on a single line is followed by a string with python commands, either on a single line
enclosed in quotes, or as multiple lines enclosed in triple enclosed in quotes, or as multiple lines enclosed in triple quotes.
quotes. These Python commands will be passed to the python interpreter These Python commands will be passed to the python interpreter and
and executed immediately without registering a Python function for executed immediately without registering a Python function for future
future execution. This allows to run arbitrary Python code at any execution. The code will be loaded into and run in the "main" module of
time while processing the LAMMPS input file. This can be used to pre-load the Python interpreter. This allows running arbitrary Python code at
Python modules, initialize global variables or perform operations any time while processing the LAMMPS input file. This can be used to
using the python programming language. The Python code will be executed pre-load Python modules, initialize global variables, define functions
in parallel on all MPI processes. No arguments can be passed. or classes, or perform operations using the python programming language.
The Python code will be executed in parallel on all MPI processes. No
arguments can be passed.
In all other cases, the first argument is the name of a Python function In all other cases, the first argument is the name of a Python function
that will be registered with LAMMPS for future execution. The function that will be registered with LAMMPS for future execution. The function
@ -225,7 +227,8 @@ one of them. These keywords specify what Python code to load into the
Python interpreter. The *file* keyword gives the name of a file Python interpreter. The *file* keyword gives the name of a file
containing Python code, which should end with a ".py" suffix. The code containing Python code, which should end with a ".py" suffix. The code
will be immediately loaded into and run in the "main" module of the will be immediately loaded into and run in the "main" module of the
Python interpreter. Note that Python code which contains a function Python interpreter. The Python code will be executed in parallel on all
MPI processes. Note that Python code which contains a function
definition does not "execute" the function when it is run; it simply definition does not "execute" the function when it is run; it simply
defines the function so that it can be invoked later. defines the function so that it can be invoked later.