Merge branch 'develop' into neigh-request-refactor

This commit is contained in:
Axel Kohlmeyer
2022-03-18 19:23:51 -04:00
131 changed files with 181823 additions and 180624 deletions

View File

@ -261,4 +261,4 @@ in case the new code is intended to be later included in LAMMPS directly.
A plugin may be registered under an existing style name. In that case
the plugin will override the existing code. This can be used to modify
the behavior of existing styles or to debug new versions of them without
having to recompile/reinstall all of LAMMPS.
having to re-compile or re-install all of LAMMPS.

View File

@ -165,5 +165,4 @@ changed. How to do this depends on the build system you are using.
URL "git@github.com:lammps/lammps.git".
The LAMMPS GitHub project is currently managed by Axel Kohlmeyer
(Temple U, akohlmey at gmail.com) and Richard Berger (Temple U,
richard.berger at temple.edu).
(Temple U, akohlmey at gmail.com).

View File

@ -143,7 +143,7 @@ control the induced charge solver and the initial values of the interface elemen
*polarize/bem/gmres* or *polarize/bem/icc* compute a global 2-element vector
which can be accessed by various :doc:`output commands <Howto_output>`.
The first element is the number of iterations when the solver terminates
(of which the upperbound is set by *iter_max*). The second element is the RMS error.
(of which the upper bound is set by *iter_max*). The second element is the RMS error.
Restrictions

View File

@ -20,6 +20,9 @@ Examples
pair_style python 2.5
pair_coeff * * py_pot.LJCutMelt lj
pair_style python 10.0
pair_coeff * * py_pot.HarmonicCut A B
pair_style hybrid/overlay coul/long 12.0 python 12.0
pair_coeff * * coul/long
pair_coeff * * python py_pot.LJCutSPCE OW NULL
@ -159,23 +162,82 @@ Following the *LJCutMelt* example, here are the two functions:
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.
Below is a more complex example using *real* units and defines an interaction
equivalent to:
.. code-block:: LAMMPS
units real
pair_style harmonic/cut
pair_coeff 1 1 0.2 9.0
pair_coeff 2 2 0.4 9.0
This uses the default geometric mixing. The equivalent input with pair
style *python* is:
.. code-block:: LAMMPS
units real
pair_style python 10.0
pair_coeff * * py_pot.Harmonic A B
Note that while for pair style *harmonic/cut* the cutoff is implicitly
set to the minimum of the harmonic potential, for pair style python a
global cutoff must be set and it must be equal or larger to the implicit
cutoff of the potential in python, which has to explicitly return zero
force and energy beyond the cutoff. Also, the mixed parameters have to
be explicitly provided. The corresponding python code is:
.. code-block:: python
class Harmonic(LAMMPSPairPotential):
def __init__(self):
super(Harmonic,self).__init__()
self.units = 'real'
# set coeffs: K, r0
self.coeff = {'A' : {'A' : (0.2,9.0),
'B' : (math.sqrt(0.2*0.4),9.0)},
'B' : {'A' : (math.sqrt(0.2*0.4),9.0),
'B' : (0.4,9.0)}}
def compute_force(self,rsq,itype,jtype):
coeff = self.coeff[self.pmap[itype]][self.pmap[jtype]]
r = math.sqrt(rsq)
delta = coeff[1]-r
if (r < coeff[1]):
return 2.0*delta*coeff[0]/r
else:
return 0.0
def compute_energy(self,rsq,itype,jtype):
coeff = self.coeff[self.pmap[itype]][self.pmap[jtype]]
r = math.sqrt(rsq)
delta = coeff[1]-r
if (r < coeff[1]):
return delta*delta*coeff[0]
else:
return 0.0
----------
.. note::
.. admonition:: Performance Impact
:class: note
The evaluation of scripted python code will slow down the
computation pairwise 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 :doc:`pair_write <pair_write>` command. Please see below
for an example LAMMPS input of how to build a table file:
The evaluation of scripted python code will slow down the computation
of pairwise interactions quite significantly. However, this performance
penalty can be worked around through using the python pair style not
for the actual simulation, but to generate tabulated potentials using
the :doc:`pair_write <pair_write>` command. This will also enable
GPU or multi-thread acceleration through the GPU, KOKKOS, or OPENMP
package versions of the *table* pair style. Please see below for a
LAMMPS input example demonstrating how to build a table file:
.. code-block:: LAMMPS
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
shell rm -f lj.table
pair_write 1 1 2000 rsq 0.01 2.5 lj.table lj
Note that it is strongly recommended to try to **delete** the potential
table file before generating it. Since the *pair_write* command will
@ -190,7 +252,7 @@ to be assigned to the LAMMPS atom types like this:
.. code-block:: LAMMPS
pair_style table linear 2000
pair_coeff 1 1 melt.table lj
pair_coeff 1 1 lj.table lj
This can also be done for more complex systems. Please see the
*examples/python* folders for a few more examples.

View File

@ -20,8 +20,9 @@ Syntax
dir1,dir2 = one or more directories to create
*mv* args = old new
old = old filename
new = new filename
*rm* args = file1 file2 ...
new = new filename or destination folder
*rm* args = [-f] file1 file2 ...
-f = turn off warnings (optional)
file1,file2 = one or more filenames to delete
*rmdir* args = dir1 dir2 ...
dir1,dir2 = one or more directories to delete
@ -36,8 +37,8 @@ Examples
shell cd sub1
shell cd ..
shell mkdir tmp1 tmp2 tmp3
shell rmdir tmp1
shell mkdir tmp1 tmp2/tmp3
shell rmdir tmp1 tmp2
shell mv log.lammps hold/log.1
shell rm TMP/file1 TMP/file2
shell putenv LAMMPS_POTENTIALS=../../potentials
@ -50,34 +51,39 @@ Description
Execute a shell command. A few simple file-based shell commands are
supported directly, in Unix-style syntax. Any command not listed
above is passed as-is to the C-library system() call, which invokes
the command in a shell.
the command in a shell. To use the external executable instead of
the built-in version one needs to use a full path, for example
*/bin/rm* instead of *rm*. The built-in commands will also work
on operating systems, that do not - by default - provide the
corresponding external executables (like *mkdir* on Windows).
This is means to invoke other commands from your input script. For
example, you can move files around in preparation for the next section
of the input script. Or you can run a program that pre-processes data
for input into LAMMPS. Or you can run a program that post-processes
LAMMPS output data.
This command provides a ways to invoke custom commands or executables
from your input script. For example, you can move files around in
preparation for the next section of the input script. Or you can run a
program that pre-processes data for input into LAMMPS. Or you can run a
program that post-processes LAMMPS output data.
With the exception of *cd*, all commands, including ones invoked via a
system() call, are executed by only a single processor, so that
files/directories are not being manipulated by multiple processors.
files/directories are not being manipulated by multiple processors
concurrently which may result in unexpected errors or corrupted files.
The *cd* command executes the Unix "cd" command to change the working
directory. All subsequent LAMMPS commands that read/write files will
use the new directory. All processors execute this command.
The *cd* command changes the current working directory similar to
the ``cd`` command. All subsequent LAMMPS commands that read/write files
will use the new directory. All processors execute this command.
The *mkdir* command executes the Unix "mkdir" command to create one or
more directories.
The *mkdir* command creates directories similar to the Unix ``mkdir -p``
command. That is, it will attempt to create the entire path of
sub-directories if they do not exist yet.
The *mv* command executes the Unix "mv" command to rename a file and/or
move it to a new directory.
The *mv* command renames a file and/or moves it to a new directory.
It cannot rename files across filesystem boundaries or between drives.
The *rm* command executes the Unix "rm" command to remove one or more
files.
The *rm* command deletes file similar to the Unix ``rm`` command.
The *rmdir* command executes the Unix "rmdir" command to remove one or
more directories. A directory must be empty to be successfully
removed.
The *rmdir* command deletes directories similar to Unix ``rmdir`` command.
If a directory is not empty, its contents are also removed recursively
similar to the Unix ``rm -r`` command.
The *putenv* command defines or updates an environment variable directly.
Since this command does not pass through the shell, no shell variable
@ -107,9 +113,9 @@ with 3 arguments: file1 10 file2.
Restrictions
""""""""""""
LAMMPS does not detect errors or print warnings when any of these
commands execute. E.g. if the specified directory does not exist,
executing the *cd* command will silently do nothing.
LAMMPS will do a best effort to detect errors and print suitable
warnings, but due to the nature of delegating commands to the C-library
system() call, this is not always reliable.
Related commands
""""""""""""""""