update docs before patch release

This commit is contained in:
Steve Plimpton
2017-05-18 13:14:47 -06:00
parent 9db9fc9de3
commit b28ecd44c2
12 changed files with 100 additions and 67 deletions

View File

@ -40,34 +40,34 @@ Only a single pair_coeff command is used with the {python} pair style
which specifies a python class inside a python module or file that
LAMMPS will look up in the current directory, the folder pointed to by
the LAMMPS_POTENTIALS environment variable or somewhere in your python
path. A single python module can hold multiple python pair class
definitions. The class definitions itself have to follow specific rules
that are explained below.
path. A single python module can hold multiple python pair class
definitions. The class definitions itself have to follow specific
rules that are explained below.
Atom types in the python class are specified through symbolic constants,
typically strings. These are mapped to LAMMPS atom types by specifying
N additional arguments after the class name in the pair_coeff command,
where N must be the number of currently defined atom types:
Atom types in the python class are specified through symbolic
constants, typically strings. These are mapped to LAMMPS atom types by
specifying N additional arguments after the class name in the
pair_coeff command, where N must be the number of currently defined
atom types:
As an example, imagine a file {py_pot.py} has a python potential class
names {LJCutMelt} with parameters and potential functions for a two
Lennard-Jones atom types labeled as 'LJ1' and 'LJ2'. In your LAMMPS
input and you would have defined 3 atom types, out of which the first
two are supposed to be using the 'LJ1' parameters and the third
the 'LJ2' parameters, then you would use the following pair_coeff
command:
two are supposed to be using the 'LJ1' parameters and the third the
'LJ2' parameters, then you would use the following pair_coeff command:
pair_coeff * * py_pot.LJCutMelt LJ1 LJ1 LJ2 :pre
The first two arguments [must] be * * so as to span all LAMMPS atom types.
The first two LJ1 arguments map LAMMPS atom types 1 and 2 to the LJ1
atom type in the LJCutMelt class of the py_pot.py file. The final LJ2
argument maps LAMMPS atom type 3 to the LJ2 atom type the python file.
If a mapping value is specified as NULL, the mapping is not performed,
any pair interaction with this atom type will be skipped. This can be
used when a {python} potential is used as part of the {hybrid} or
{hybrid/overlay} pair style. The NULL values are then placeholders for
atom types that will be used with other potentials.
The first two arguments [must] be * * so as to span all LAMMPS atom
types. The first two LJ1 arguments map LAMMPS atom types 1 and 2 to
the LJ1 atom type in the LJCutMelt class of the py_pot.py file. The
final LJ2 argument maps LAMMPS atom type 3 to the LJ2 atom type the
python file. If a mapping value is specified as NULL, the mapping is
not performed, any pair interaction with this atom type will be
skipped. This can be used when a {python} potential is used as part of
the {hybrid} or {hybrid/overlay} pair style. The NULL values are then
placeholders for atom types that will be used with other potentials.
:line
@ -88,14 +88,18 @@ class LAMMPSPairPotential(object):
Any classes with definitions of specific potentials have to be derived
from this class and should be initialize in a similar fashion to the
example given below. NOTE: The class constructor has to set up a data
structure containing the potential parameters supported by this class.
It should also define a variable {self.units} containing a string
matching one of the options of LAMMPS' "units"_units.html command, which
is used to verify, that the potential definition in the python class and
in the LAMMPS input match. Example for a single type Lennard-Jones
potential class {LJCutMelt} in reducted units, which defines an atom
type {lj} for which the parameters epsilon and sigma are both 1.0:
example given below.
NOTE: The class constructor has to set up a data structure containing
the potential parameters supported by this class. It should also
define a variable {self.units} containing a string matching one of the
options of LAMMPS' "units"_units.html command, which is used to
verify, that the potential definition in the python class and in the
LAMMPS input match.
Here is an example for a single type Lennard-Jones potential class
{LJCutMelt} in reducted units, which defines an atom type {lj} for
which the parameters epsilon and sigma are both 1.0:
class LJCutMelt(LAMMPSPairPotential):
def __init__(self):
@ -136,32 +140,32 @@ the {LJCutMelt} example, here are the two functions:
lj4 = coeff\[3\]
return (r6inv * (lj3*r6inv - lj4)) :pre
IMPORTANT NOTE: for consistency with the C++ pair styles in LAMMPS,
the {compute_force} function follows the conventions of the Pair::single()
NOTE: for consistency with the C++ pair styles in LAMMPS, the
{compute_force} function follows the conventions of the Pair::single()
methods and does not return the full force, but the force scaled by
the distance between the two atoms, so this value only needs to be
multiplied by delta x, delta y, and delta z to conveniently obtain
the three components of the force vector between these two atoms.
multiplied by delta x, delta y, and delta z to conveniently obtain the
three components of the force vector between these two atoms.
:line
IMPORTANT NOTE: The evaluation of scripted python code will slow down
the computation pair-wise interactions quite significantly. However,
this can be largely worked around through using the python pair style
not for the actual simulation, but to generate tabulated potentials
on the fly using the "pair_write"_pair_write.html command. Please
see below for an example LAMMPS input of how to build a table file:
NOTE: The evaluation of scripted python code will slow down the
computation pair-wise interactions quite significantly. However, this
can be largely worked around through using the python pair style not
for the actual simulation, but to generate tabulated potentials on the
fly using the "pair_write"_pair_write.html command. Please see below
for an example LAMMPS input of how to build a table file:
pair_style python 2.5
pair_coeff * * py_pot.LJCutMelt lj
shell rm -f melt.table
pair_write 1 1 2000 rsq 0.01 2.5 lj1_lj2.table lj :pre
Note, that it is strong recommended to try to [delete] the potential
Note that it is strongly recommended to try to [delete] the potential
table file before generating it. Since the {pair_write} command will
always append to a table file, which pair style table will use the first
match. Thus when changing the potential function in the python class,
the table pair style will still read the old variant.
always append to a table file, which pair style table will use the
first match. Thus when changing the potential function in the python
class, the table pair style will still read the old variant.
After switching the pair style to {table}, the potential tables need
to be assigned to the LAMMPS atom types like this:
@ -169,7 +173,7 @@ to be assigned to the LAMMPS atom types like this:
pair_style table linear 2000
pair_coeff 1 1 melt.table lj :pre
This can also be done for more complex systems. Please see the
This can also be done for more complex systems. Please see the
{examples/python} folders for a few more examples.
:line
@ -198,9 +202,9 @@ This pair style can only be used via the {pair} keyword of the
[Restrictions:]
This pair style is part of the PYTHON package. It is only enabled
if LAMMPS was built with that package. See
the "Making LAMMPS"_Section_start.html#start_3 section for more info.
This pair style is part of the PYTHON package. It is only enabled if
LAMMPS was built with that package. See the "Making
LAMMPS"_Section_start.html#start_3 section for more info.
[Related commands:]