Merge branch 'master' into gran_attractive
This commit is contained in:
@ -113,7 +113,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
|||||||
|
|
||||||
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
|
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
|
||||||
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
|
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
|
||||||
QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
||||||
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
|
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
|
||||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
|
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
|
||||||
USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF
|
USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF
|
||||||
@ -533,6 +533,18 @@ foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if(PKG_PLUGIN)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||||
|
else()
|
||||||
|
message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled")
|
||||||
|
endif()
|
||||||
|
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||||
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
|
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# the windows version of LAMMPS requires a couple extra libraries
|
# the windows version of LAMMPS requires a couple extra libraries
|
||||||
# and the MPI library - if use - has to be linked right before those
|
# and the MPI library - if use - has to be linked right before those
|
||||||
|
|||||||
@ -2,8 +2,4 @@ set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to
|
|||||||
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
|
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
|
||||||
add_library(molfile INTERFACE)
|
add_library(molfile INTERFACE)
|
||||||
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
||||||
# no need to link with -ldl on windows
|
|
||||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
|
||||||
endif()
|
|
||||||
target_link_libraries(lammps PRIVATE molfile)
|
target_link_libraries(lammps PRIVATE molfile)
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
||||||
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
|
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
|
||||||
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||||
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||||
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD
|
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD
|
||||||
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
Basic build options
|
Basic build options
|
||||||
===================
|
===================
|
||||||
|
|
||||||
The following topics are covered on this page, for building both with
|
The following topics are covered on this page, for building with both
|
||||||
CMake and make:
|
CMake and make:
|
||||||
|
|
||||||
* :ref:`Serial vs parallel build <serial>`
|
* :ref:`Serial vs parallel build <serial>`
|
||||||
|
|||||||
@ -86,6 +86,7 @@ An alphabetic list of all general LAMMPS commands.
|
|||||||
* :doc:`pair_style <pair_style>`
|
* :doc:`pair_style <pair_style>`
|
||||||
* :doc:`pair_write <pair_write>`
|
* :doc:`pair_write <pair_write>`
|
||||||
* :doc:`partition <partition>`
|
* :doc:`partition <partition>`
|
||||||
|
* :doc:`plugin <plugin>`
|
||||||
* :doc:`prd <prd>`
|
* :doc:`prd <prd>`
|
||||||
* :doc:`print <print>`
|
* :doc:`print <print>`
|
||||||
* :doc:`processors <processors>`
|
* :doc:`processors <processors>`
|
||||||
|
|||||||
@ -187,7 +187,7 @@ OPT.
|
|||||||
* :doc:`mgpt <pair_mgpt>`
|
* :doc:`mgpt <pair_mgpt>`
|
||||||
* :doc:`mie/cut (g) <pair_mie>`
|
* :doc:`mie/cut (g) <pair_mie>`
|
||||||
* :doc:`mliap <pair_mliap>`
|
* :doc:`mliap <pair_mliap>`
|
||||||
* :doc:`mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>`
|
* :doc:`mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||||
* :doc:`momb <pair_momb>`
|
* :doc:`momb <pair_momb>`
|
||||||
* :doc:`morse (gkot) <pair_morse>`
|
* :doc:`morse (gkot) <pair_morse>`
|
||||||
* :doc:`morse/smooth/linear (o) <pair_morse>`
|
* :doc:`morse/smooth/linear (o) <pair_morse>`
|
||||||
|
|||||||
@ -14,6 +14,7 @@ of time and requests from the LAMMPS user community.
|
|||||||
Developer_flow
|
Developer_flow
|
||||||
Developer_write
|
Developer_write
|
||||||
Developer_notes
|
Developer_notes
|
||||||
|
Developer_plugins
|
||||||
Developer_unittest
|
Developer_unittest
|
||||||
Classes
|
Classes
|
||||||
Developer_utils
|
Developer_utils
|
||||||
|
|||||||
258
doc/src/Developer_plugins.rst
Normal file
258
doc/src/Developer_plugins.rst
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
Writing plugins
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Plugins provide a mechanism to add functionality to a LAMMPS executable
|
||||||
|
without recompiling LAMMPS. The functionality for this and the
|
||||||
|
:doc:`plugin command <plugin>` are implemented in the
|
||||||
|
:ref:`PLUGIN package <PKG-PLUGIN>` which must be installed to use plugins.
|
||||||
|
|
||||||
|
Plugins use the operating system's capability to load dynamic shared
|
||||||
|
object (DSO) files in a way similar shared libraries and then reference
|
||||||
|
specific functions in those DSOs. Any DSO file with plugins has to include
|
||||||
|
an initialization function with a specific name, "lammpsplugin_init", that
|
||||||
|
has to follow specific rules described below. When loading the DSO with
|
||||||
|
the "plugin" command, this function is looked up and called and will then
|
||||||
|
register the contained plugin(s) with LAMMPS.
|
||||||
|
|
||||||
|
From the programmer perspective this can work because of the object
|
||||||
|
oriented design of LAMMPS where all pair style commands are derived from
|
||||||
|
the class Pair, all fix style commands from the class Fix and so on and
|
||||||
|
usually only functions present in those base classes are called
|
||||||
|
directly. When a :doc:`pair_style` command or :doc:`fix` command is
|
||||||
|
issued a new instance of such a derived class is created. This is done
|
||||||
|
by a so-called factory function which is mapped to the style name. Thus
|
||||||
|
when, for example, the LAMMPS processes the command ``pair_style lj/cut
|
||||||
|
2.5``, LAMMPS will look up the factory function for creating the
|
||||||
|
``PairLJCut`` class and then execute it. The return value of that
|
||||||
|
function is a ``Pair *`` pointer and the pointer will be assigned to the
|
||||||
|
location for the currently active pair style.
|
||||||
|
|
||||||
|
A DSO file with a plugin thus has to implement such a factory function
|
||||||
|
and register it with LAMMPS so that it gets added to the map of available
|
||||||
|
styles of the given category. To register a plugin with LAMMPS an
|
||||||
|
initialization function has to be present in the DSO file called
|
||||||
|
``lammpsplugin_init`` which is called with three ``void *`` arguments:
|
||||||
|
a pointer to the current LAMMPS instance, a pointer to the opened DSO
|
||||||
|
handle, and a pointer to the registration function. The registration
|
||||||
|
function takes two arguments: a pointer to a ``lammpsplugin_t`` struct
|
||||||
|
with information about the plugin and a pointer to the current LAMMPS
|
||||||
|
instance. Please see below for an example of how the registration is
|
||||||
|
done.
|
||||||
|
|
||||||
|
Members of ``lammpsplugin_t``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
:widths: auto
|
||||||
|
|
||||||
|
* - Member
|
||||||
|
- Description
|
||||||
|
* - version
|
||||||
|
- LAMMPS Version string the plugin was compiled for
|
||||||
|
* - style
|
||||||
|
- Style of the plugin (pair, bond, fix, command, etc.)
|
||||||
|
* - name
|
||||||
|
- Name of the plugin style
|
||||||
|
* - info
|
||||||
|
- String with information about the plugin
|
||||||
|
* - author
|
||||||
|
- String with the name and email of the author
|
||||||
|
* - creator.v1
|
||||||
|
- Pointer to factory function for pair, bond, angle, dihedral, or improper styles
|
||||||
|
* - creator.v2
|
||||||
|
- Pointer to factory function for compute, fix, or region styles
|
||||||
|
* - creator.v3
|
||||||
|
- Pointer to factory function for command styles
|
||||||
|
* - handle
|
||||||
|
- Pointer to the open DSO file handle
|
||||||
|
|
||||||
|
Only one of the three alternate creator entries can be used at a time
|
||||||
|
and which of those is determined by the style of plugin. The "creator.v1"
|
||||||
|
element is for factory functions of supported styles computing forces (i.e.
|
||||||
|
pair, bond, angle, dihedral, or improper styles) and the function takes
|
||||||
|
as single argument the pointer to the LAMMPS instance. The factory function
|
||||||
|
is cast to the ``lammpsplugin_factory1`` type before assignment. The
|
||||||
|
"creator.v2" element is for factory functions creating an instance of
|
||||||
|
a fix, compute, or region style and takes three arguments: a pointer to
|
||||||
|
the LAMMPS instance, an integer with the length of the argument list and
|
||||||
|
a ``char **`` pointer to the list of arguments. The factory function pointer
|
||||||
|
needs to be cast to the ``lammpsplugin_factory2`` type before assignment.
|
||||||
|
The "creator.v3" element takes the same arguments as "creator.v3" but is
|
||||||
|
specific to creating command styles: the factory function has to instantiate
|
||||||
|
the command style locally passing the LAMMPS pointer as argument and then
|
||||||
|
call its "command" member function with the number and list of arguments.
|
||||||
|
The factory function pointer needs to be cast to the
|
||||||
|
``lammpsplugin_factory3`` type before assignment.
|
||||||
|
|
||||||
|
Pair style example
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
As an example, a hypothetical pair style plugin "morse2" implemented in
|
||||||
|
a class ``PairMorse2`` in the files ``pair_morse2.h`` and
|
||||||
|
``pair_morse2.cpp`` with the factory function and initialization
|
||||||
|
function would look like this:
|
||||||
|
|
||||||
|
.. code-block:: C++
|
||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "pair_morse2.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static Pair *morse2creator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new PairMorse2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "pair";
|
||||||
|
plugin.name = "morse2";
|
||||||
|
plugin.info = "Morse2 variant pair style v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
The factory function in this example is called ``morse2creator()``. It
|
||||||
|
receives a pointer to the LAMMPS class as only argument and thus has to
|
||||||
|
be assigned to the *creator.v1* member of the plugin struct and cast to the
|
||||||
|
``lammpsplugin_factory1`` pointer type. It returns a
|
||||||
|
pointer to the allocated class instance derived from the ``Pair`` class.
|
||||||
|
This function may be declared static to avoid clashes with other plugins.
|
||||||
|
The name of the derived class, ``PairMorse2``, must be unique inside
|
||||||
|
the entire LAMMPS executable.
|
||||||
|
|
||||||
|
Fix style example
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
If the factory function would be for a fix or compute, which take three
|
||||||
|
arguments (a pointer to the LAMMPS class, the number of arguments and the
|
||||||
|
list of argument strings), then the pointer type is ``lammpsplugin_factory2``
|
||||||
|
and it must be assigned to the *creator.v2* member of the plugin struct.
|
||||||
|
Below is an example for that:
|
||||||
|
|
||||||
|
.. code-block:: C++
|
||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "fix_nve2.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv)
|
||||||
|
{
|
||||||
|
return new FixNVE2(lmp,argc,argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "fix";
|
||||||
|
plugin.name = "nve2";
|
||||||
|
plugin.info = "NVE2 variant fix style v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Command style example
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
For command styles there is a third variant of factory function as
|
||||||
|
demonstrated in the following example, which also shows that the
|
||||||
|
implementation of the plugin class may also be within the same
|
||||||
|
file as the plugin interface code:
|
||||||
|
|
||||||
|
.. code-block:: C++
|
||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
|
||||||
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "pointers.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
class Hello : protected Pointers {
|
||||||
|
public:
|
||||||
|
Hello(class LAMMPS *lmp) : Pointers(lmp) {};
|
||||||
|
void command(int, char **);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
void Hello::command(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc != 1) error->all(FLERR,"Illegal hello command");
|
||||||
|
if (comm->me == 0)
|
||||||
|
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hellocreator(LAMMPS *lmp, int argc, char **argv)
|
||||||
|
{
|
||||||
|
Hello hello(lmp);
|
||||||
|
hello.command(argc,argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "command";
|
||||||
|
plugin.name = "hello";
|
||||||
|
plugin.info = "Hello world command v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Additional Details
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The initialization function **must** be called ``lammpsplugin_init``, it
|
||||||
|
**must** have C bindings and it takes three void pointers as arguments.
|
||||||
|
The first is a pointer to the LAMMPS class that calls it and it needs to
|
||||||
|
be passed to the registration function. The second argument is a
|
||||||
|
pointer to the internal handle of the DSO file, this needs to be added
|
||||||
|
to the plugin info struct, so that the DSO can be closed and unloaded
|
||||||
|
when all its contained plugins are unloaded. The third argument is a
|
||||||
|
function pointer to the registration function and needs to be stored
|
||||||
|
in a variable of ``lammpsplugin_regfunc`` type and then called with a
|
||||||
|
pointer to the ``lammpsplugin_t`` struct and the pointer to the LAMMPS
|
||||||
|
instance as arguments to register a single plugin. There may be multiple
|
||||||
|
calls to multiple plugins in the same initialization function.
|
||||||
|
|
||||||
|
To register a plugin a struct of the ``lammpsplugin_t`` needs to be filled
|
||||||
|
with relevant info: current LAMMPS version string, kind of style, name of
|
||||||
|
style, info string, author string, pointer to factory function, and the
|
||||||
|
DSO handle. The registration function is called with a pointer to the address
|
||||||
|
of this struct and the pointer of the LAMMPS class. The registration function
|
||||||
|
will then add the factory function of the plugin style to the respective
|
||||||
|
style map under the provided name. It will also make a copy of the struct
|
||||||
|
in a list of all loaded plugins and update the reference counter for loaded
|
||||||
|
plugins from this specific DSO file.
|
||||||
|
|
||||||
|
The pair style itself (i.e. the PairMorse2 class in this example) can be
|
||||||
|
written just like any other pair style that is included in LAMMPS. For
|
||||||
|
a plugin, the use of the ``PairStyle`` macro in the section encapsulated
|
||||||
|
by ``#ifdef PAIR_CLASS`` is not needed, since the mapping of the class
|
||||||
|
name to the style name is done by the plugin registration function with
|
||||||
|
the information from the ``lammpsplugin_t`` struct. It may be included
|
||||||
|
in case the new code is intended to be later included in LAMMPS directly.
|
||||||
@ -101,6 +101,9 @@ and parsing files or arguments.
|
|||||||
.. doxygenfunction:: split_words
|
.. doxygenfunction:: split_words
|
||||||
:project: progguide
|
:project: progguide
|
||||||
|
|
||||||
|
.. doxygenfunction:: split_lines
|
||||||
|
:project: progguide
|
||||||
|
|
||||||
.. doxygenfunction:: strmatch
|
.. doxygenfunction:: strmatch
|
||||||
:project: progguide
|
:project: progguide
|
||||||
|
|
||||||
|
|||||||
@ -18,12 +18,13 @@ This compute
|
|||||||
|
|
||||||
calculates rotational kinetic energy which can be :doc:`output with thermodynamic info <Howto_output>`.
|
calculates rotational kinetic energy which can be :doc:`output with thermodynamic info <Howto_output>`.
|
||||||
|
|
||||||
Use one of these 3 pair potentials, which compute forces and torques
|
Use one of these 4 pair potentials, which compute forces and torques
|
||||||
between interacting pairs of particles:
|
between interacting pairs of particles:
|
||||||
|
|
||||||
* :doc:`pair_style <pair_style>` gran/history
|
* :doc:`pair_style gran/history <pair_gran>`
|
||||||
* :doc:`pair_style <pair_style>` gran/no_history
|
* :doc:`pair_style gran/no_history <pair_gran>`
|
||||||
* :doc:`pair_style <pair_style>` gran/hertzian
|
* :doc:`pair_style gran/hertzian <pair_gran>`
|
||||||
|
* :doc:`pair_style granular <pair_granular>`
|
||||||
|
|
||||||
These commands implement fix options specific to granular systems:
|
These commands implement fix options specific to granular systems:
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ These commands implement fix options specific to granular systems:
|
|||||||
* :doc:`fix pour <fix_pour>`
|
* :doc:`fix pour <fix_pour>`
|
||||||
* :doc:`fix viscous <fix_viscous>`
|
* :doc:`fix viscous <fix_viscous>`
|
||||||
* :doc:`fix wall/gran <fix_wall_gran>`
|
* :doc:`fix wall/gran <fix_wall_gran>`
|
||||||
|
* :doc:`fix wall/gran/region <fix_wall_gran_region>`
|
||||||
|
|
||||||
The fix style *freeze* zeroes both the force and torque of frozen
|
The fix style *freeze* zeroes both the force and torque of frozen
|
||||||
atoms, and should be used for granular system instead of the fix style
|
atoms, and should be used for granular system instead of the fix style
|
||||||
|
|||||||
@ -86,33 +86,59 @@ check out any other desired branch) first.
|
|||||||
|
|
||||||
Once you have updated your local files with a ``git pull`` (or ``git
|
Once you have updated your local files with a ``git pull`` (or ``git
|
||||||
checkout``), you still need to re-build LAMMPS if any source files have
|
checkout``), you still need to re-build LAMMPS if any source files have
|
||||||
changed. To do this, you should cd to the src directory and type:
|
changed. How to do this depends on the build system you are using.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. tabs::
|
||||||
|
|
||||||
|
.. tab:: CMake build
|
||||||
|
|
||||||
|
Change to your build folder and type:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake . --build
|
||||||
|
|
||||||
|
CMake should auto-detect whether it needs to re-run the CMake
|
||||||
|
configuration step and otherwise redo the build for all files
|
||||||
|
that have been changed or files that depend on changed files.
|
||||||
|
In case some build options have been changed or renamed, you
|
||||||
|
may have to update those by running:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake .
|
||||||
|
|
||||||
|
and then rebuild.
|
||||||
|
|
||||||
|
.. tab:: Traditional make
|
||||||
|
|
||||||
|
Switch to the src directory and type:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
$ make purge # remove any deprecated src files
|
$ make purge # remove any deprecated src files
|
||||||
$ make package-update # sync package files with src files
|
$ make package-update # sync package files with src files
|
||||||
$ make foo # re-build for your machine (mpi, serial, etc)
|
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||||
|
|
||||||
just as described on the :doc:`Apply patch <Install_patch>` page,
|
Just as described on the :doc:`Apply patch <Install_patch>` page,
|
||||||
after a patch has been installed.
|
after a patch has been installed.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
If you wish to edit/change a src file that is from a
|
If you wish to edit/change a src file that is from a package,
|
||||||
package, you should edit the version of the file inside the package
|
you should edit the version of the file inside the package
|
||||||
sub-directory with src, then re-install the package. The version in
|
sub-directory with src, then re-install the package. The
|
||||||
the source directory is merely a copy and will be wiped out if you type "make
|
version in the source directory is merely a copy and will be
|
||||||
package-update".
|
wiped out if you type "make package-update".
|
||||||
|
|
||||||
.. warning::
|
.. admonition:: Git protocols
|
||||||
|
:class: note
|
||||||
|
|
||||||
The GitHub servers support both the "git://" and
|
The servers at github.com support the "git://" and "https://" access
|
||||||
"https://" access protocols for anonymous read-only access. If you
|
protocols for anonymous, read-only access. If you have a suitably
|
||||||
have a correspondingly configured GitHub account, you may also use
|
configured GitHub account, you may also use SSH protocol with the
|
||||||
SSH access with the URL "git@github.com:lammps/lammps.git".
|
URL "git@github.com:lammps/lammps.git".
|
||||||
|
|
||||||
The LAMMPS GitHub project is managed by Christoph Junghans (LANL,
|
The LAMMPS GitHub project is currently managed by Axel Kohlmeyer
|
||||||
junghans at lanl.gov), Axel Kohlmeyer (Temple U, akohlmey at
|
(Temple U, akohlmey at gmail.com) and Richard Berger (Temple U,
|
||||||
gmail.com) and Richard Berger (Temple U, richard.berger at
|
richard.berger at temple.edu).
|
||||||
temple.edu).
|
|
||||||
|
|||||||
@ -43,24 +43,54 @@ up to date.
|
|||||||
* A list of updated files print out to the screen. The -b switch
|
* A list of updated files print out to the screen. The -b switch
|
||||||
creates backup files of your originals (e.g. src/force.cpp.orig), so
|
creates backup files of your originals (e.g. src/force.cpp.orig), so
|
||||||
you can manually undo the patch if something goes wrong.
|
you can manually undo the patch if something goes wrong.
|
||||||
* Type the following from the src directory, to enforce consistency
|
|
||||||
between the src and package directories. This is OK to do even if you
|
* Once you have updated your local files you need to re-build LAMMPS.
|
||||||
don't use one or more packages. If you are applying several patches
|
If you are applying several patches successively, you only need to
|
||||||
successively, you only need to type this once at the end. The purge
|
do the rebuild once at the end. How to do it depends on the build
|
||||||
command removes deprecated src files if any were removed by the patch
|
system you are using.
|
||||||
from package sub-directories.
|
|
||||||
|
.. tabs::
|
||||||
|
|
||||||
|
.. tab:: CMake build
|
||||||
|
|
||||||
|
Change to your build folder and type:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ make purge
|
cmake . --build
|
||||||
$ make package-update
|
|
||||||
|
|
||||||
* Re-build LAMMPS via the "make" command.
|
CMake should auto-detect whether it needs to re-run the CMake
|
||||||
|
configuration step and otherwise redo the build for all files
|
||||||
|
that have been changed or files that depend on changed files.
|
||||||
|
In case some build options have been changed or renamed, you
|
||||||
|
may have to update those by running:
|
||||||
|
|
||||||
.. warning::
|
.. code-block:: bash
|
||||||
|
|
||||||
If you wish to edit/change a source file that is part of a package,
|
cmake .
|
||||||
you should edit the version of the file inside the package folder in
|
|
||||||
src, and then re-install or update the package. The version in the
|
and then rebuild.
|
||||||
src directory is merely a copy and will be wiped out when you type
|
|
||||||
"make package-update".
|
.. tab:: Traditional make
|
||||||
|
|
||||||
|
Switch to the src directory and type:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ make purge # remove any deprecated src files
|
||||||
|
$ make package-update # sync package files with src files
|
||||||
|
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||||
|
|
||||||
|
to enforce consistency of the source between the src folder
|
||||||
|
and package directories. This is OK to do even if you don't
|
||||||
|
use any packages. The "make purge" command removes any deprecated
|
||||||
|
src files if they were removed by the patch from a package
|
||||||
|
sub-directory.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
If you wish to edit/change a src file that is from a package,
|
||||||
|
you should edit the version of the file inside the package
|
||||||
|
sub-directory with src, then re-install the package. The
|
||||||
|
version in the source directory is merely a copy and will be
|
||||||
|
wiped out if you type "make package-update".
|
||||||
|
|||||||
@ -50,6 +50,7 @@ page gives those details.
|
|||||||
* :ref:`MSCG <PKG-MSCG>`
|
* :ref:`MSCG <PKG-MSCG>`
|
||||||
* :ref:`OPT <PKG-OPT>`
|
* :ref:`OPT <PKG-OPT>`
|
||||||
* :ref:`PERI <PKG-PERI>`
|
* :ref:`PERI <PKG-PERI>`
|
||||||
|
* :ref:`PLUGIN <PKG-PLUGIN>`
|
||||||
* :ref:`POEMS <PKG-POEMS>`
|
* :ref:`POEMS <PKG-POEMS>`
|
||||||
* :ref:`PYTHON <PKG-PYTHON>`
|
* :ref:`PYTHON <PKG-PYTHON>`
|
||||||
* :ref:`QEQ <PKG-QEQ>`
|
* :ref:`QEQ <PKG-QEQ>`
|
||||||
@ -843,6 +844,28 @@ Foster (UTSA).
|
|||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
.. _PKG-PLUGIN:
|
||||||
|
|
||||||
|
PLUGIN package
|
||||||
|
--------------
|
||||||
|
|
||||||
|
**Contents:**
|
||||||
|
|
||||||
|
A :doc:`plugin <plugin>` command that can load and unload several
|
||||||
|
kind of styles in LAMMPS from shared object files at runtime without
|
||||||
|
having to recompile and relink LAMMPS.
|
||||||
|
|
||||||
|
**Authors:** Axel Kohlmeyer (Temple U)
|
||||||
|
|
||||||
|
**Supporting info:**
|
||||||
|
|
||||||
|
* src/PLUGIN: filenames -> commands
|
||||||
|
* :doc:`plugin command <plugin>`
|
||||||
|
* :doc:`Information on writing plugins <Developer_plugins>`
|
||||||
|
* examples/plugin
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
.. _PKG-POEMS:
|
.. _PKG-POEMS:
|
||||||
|
|
||||||
POEMS package
|
POEMS package
|
||||||
@ -2456,6 +2479,6 @@ which discuss the `QuickFF <quickff_>`_ methodology.
|
|||||||
* :doc:`bond_style mm3 <bond_mm3>`
|
* :doc:`bond_style mm3 <bond_mm3>`
|
||||||
* :doc:`improper_style distharm <improper_distharm>`
|
* :doc:`improper_style distharm <improper_distharm>`
|
||||||
* :doc:`improper_style sqdistharm <improper_sqdistharm>`
|
* :doc:`improper_style sqdistharm <improper_sqdistharm>`
|
||||||
* :doc:`pair_style mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>`
|
* :doc:`pair_style mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||||
* :doc:`pair_style lj/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
* :doc:`pair_style lj/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||||
* examples/USER/yaff
|
* examples/USER/yaff
|
||||||
|
|||||||
@ -71,9 +71,3 @@ Default
|
|||||||
|
|
||||||
none
|
none
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. _cosine-Mayo:
|
|
||||||
|
|
||||||
**(Mayo)** Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909
|
|
||||||
(1990).
|
|
||||||
|
|||||||
@ -77,6 +77,7 @@ Commands
|
|||||||
pair_style
|
pair_style
|
||||||
pair_write
|
pair_write
|
||||||
partition
|
partition
|
||||||
|
plugin
|
||||||
prd
|
prd
|
||||||
print
|
print
|
||||||
processors
|
processors
|
||||||
|
|||||||
@ -15,10 +15,10 @@ Syntax
|
|||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
dihedral_style style interp Ntable
|
dihedral_style style interpolation Ntable
|
||||||
|
|
||||||
* style = *table* or *table/cut*
|
* style = *table* or *table/cut*
|
||||||
* interp = *linear* or *spline* = method of interpolation
|
* interpolation = *linear* or *spline* = method of interpolation
|
||||||
* Ntable = size of the internal lookup table
|
* Ntable = size of the internal lookup table
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
|
|||||||
@ -349,7 +349,7 @@ the box size stored with the snapshot.
|
|||||||
|
|
||||||
The *xtc* style writes XTC files, a compressed trajectory format used
|
The *xtc* style writes XTC files, a compressed trajectory format used
|
||||||
by the GROMACS molecular dynamics package, and described
|
by the GROMACS molecular dynamics package, and described
|
||||||
`here <http://manual.gromacs.org/current/online/xtc.html>`_.
|
`here <https://manual.gromacs.org/current/reference-manual/file-formats.html#xtc>`_.
|
||||||
The precision used in XTC files can be adjusted via the
|
The precision used in XTC files can be adjusted via the
|
||||||
:doc:`dump_modify <dump_modify>` command. The default value of 1000
|
:doc:`dump_modify <dump_modify>` command. The default value of 1000
|
||||||
means that coordinates are stored to 1/1000 nanometer accuracy. XTC
|
means that coordinates are stored to 1/1000 nanometer accuracy. XTC
|
||||||
|
|||||||
@ -307,7 +307,9 @@ atoms in the chunk. The averaged output value for the chunk on the
|
|||||||
average over atoms across the entire *Nfreq* timescale. For the
|
average over atoms across the entire *Nfreq* timescale. For the
|
||||||
*density/number* and *density/mass* values, the volume (bin volume or
|
*density/number* and *density/mass* values, the volume (bin volume or
|
||||||
system volume) used in the final normalization will be the volume at
|
system volume) used in the final normalization will be the volume at
|
||||||
the final *Nfreq* timestep.
|
the final *Nfreq* timestep. For the *temp* values, degrees of freedom and
|
||||||
|
kinetic energy are summed separately across the entire *Nfreq* timescale, and
|
||||||
|
the output value is calculated by dividing those two sums.
|
||||||
|
|
||||||
If the *norm* setting is *sample*\ , the chunk value is summed over
|
If the *norm* setting is *sample*\ , the chunk value is summed over
|
||||||
atoms for each sample, as is the count, and an "average sample value"
|
atoms for each sample, as is the count, and an "average sample value"
|
||||||
|
|||||||
@ -127,6 +127,11 @@ the :doc:`run <run>` command.
|
|||||||
The forces due to this fix are imposed during an energy minimization,
|
The forces due to this fix are imposed during an energy minimization,
|
||||||
invoked by the :doc:`minimize <minimize>` command.
|
invoked by the :doc:`minimize <minimize>` command.
|
||||||
|
|
||||||
|
The :doc:`fix_modify <fix_modify>` *respa* option is supported by this
|
||||||
|
fix. This allows to set at which level of the :doc:`r-RESPA
|
||||||
|
<run_style>` integrator the fix is adding its forces. Default is the
|
||||||
|
outermost level.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If you want the potential energy associated with the CMAP terms
|
If you want the potential energy associated with the CMAP terms
|
||||||
|
|||||||
@ -115,6 +115,18 @@ The version with "bondmax" will just run somewhat faster, due to less
|
|||||||
overhead in computing bond lengths and not storing them in a separate
|
overhead in computing bond lengths and not storing them in a separate
|
||||||
compute.
|
compute.
|
||||||
|
|
||||||
|
A variable can be used to implement a large variety of conditions,
|
||||||
|
including to stop when a specific file exists. Example:
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
variable exit equal is_file(EXIT)
|
||||||
|
fix 10 all halt 100 v_exit != 0 error soft
|
||||||
|
|
||||||
|
Will stop the current run command when a file ``EXIT`` is created
|
||||||
|
in the current working directory. The condition can be cleared
|
||||||
|
by removing the file through the :doc:`shell <shell>` command.
|
||||||
|
|
||||||
The choice of operators listed above are the usual comparison
|
The choice of operators listed above are the usual comparison
|
||||||
operators. The XOR operation (exclusive or) is also included as "\|\^".
|
operators. The XOR operation (exclusive or) is also included as "\|\^".
|
||||||
In this context, XOR means that if either the attribute or avalue is
|
In this context, XOR means that if either the attribute or avalue is
|
||||||
|
|||||||
@ -150,7 +150,7 @@ shifted to be 0.0 at the cutoff distance Rc.
|
|||||||
The :doc:`pair_modify <pair_modify>` table option is not relevant
|
The :doc:`pair_modify <pair_modify>` table option is not relevant
|
||||||
for these pair styles.
|
for these pair styles.
|
||||||
|
|
||||||
These pair style do not support the :doc:`pair_modify <pair_modify>`
|
These pair styles do not support the :doc:`pair_modify <pair_modify>`
|
||||||
tail option for adding long-range tail corrections to energy and
|
tail option for adding long-range tail corrections to energy and
|
||||||
pressure.
|
pressure.
|
||||||
|
|
||||||
|
|||||||
@ -363,7 +363,7 @@ Mixing, shift, table, tail correction, restart, rRESPA info
|
|||||||
|
|
||||||
The different versions of the *lj/cut/soft* pair styles support mixing. For
|
The different versions of the *lj/cut/soft* pair styles support mixing. For
|
||||||
atom type pairs I,J and I != J, the :math:`\epsilon` and :math:`\sigma`
|
atom type pairs I,J and I != J, the :math:`\epsilon` and :math:`\sigma`
|
||||||
coefficients and cutoff distance for these pair style can be mixed. The default
|
coefficients and cutoff distance for these pair styles can be mixed. The default
|
||||||
mix value is *geometric* for 12-6 styles.
|
mix value is *geometric* for 12-6 styles.
|
||||||
|
|
||||||
The mixing rule for epsilon and sigma for *lj/class2/soft* 9-6 potentials is to
|
The mixing rule for epsilon and sigma for *lj/class2/soft* 9-6 potentials is to
|
||||||
|
|||||||
@ -188,7 +188,7 @@ Restrictions
|
|||||||
The *gayberne* style is part of the ASPHERE package. It is only
|
The *gayberne* style is part of the ASPHERE package. It is only
|
||||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||||
|
|
||||||
These pair style require that atoms store torque and a quaternion to
|
These pair styles require that atoms store torque and a quaternion to
|
||||||
represent their orientation, as defined by the
|
represent their orientation, as defined by the
|
||||||
:doc:`atom_style <atom_style>`. It also require they store a per-type
|
:doc:`atom_style <atom_style>`. It also require they store a per-type
|
||||||
:doc:`shape <set>`. The particles cannot store a per-particle
|
:doc:`shape <set>`. The particles cannot store a per-particle
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
.. index:: pair_style lj/switch3/coulgauss/long
|
.. index:: pair_style lj/switch3/coulgauss/long
|
||||||
|
.. index:: pair_style mm3/switch3/coulgauss/long
|
||||||
|
|
||||||
pair_style lj/switch3/coulgauss/long command
|
pair_style lj/switch3/coulgauss/long command
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
|
pair_style mm3/switch3/coulgauss/long command
|
||||||
|
=============================================
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -10,7 +14,7 @@ Syntax
|
|||||||
|
|
||||||
pair_style style args
|
pair_style style args
|
||||||
|
|
||||||
* style = *lj/switch3/coulgauss/long*
|
* style = *lj/switch3/coulgauss/long* or *mm3/switch3/coulgauss/long*
|
||||||
* args = list of arguments for a particular style
|
* args = list of arguments for a particular style
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
@ -20,6 +24,11 @@ Syntax
|
|||||||
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
||||||
width = width parameter of the smoothing function (distance units)
|
width = width parameter of the smoothing function (distance units)
|
||||||
|
|
||||||
|
*mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width
|
||||||
|
cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units)
|
||||||
|
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
||||||
|
width = width parameter of the smoothing function (distance units)
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
""""""""
|
""""""""
|
||||||
|
|
||||||
@ -31,6 +40,12 @@ Examples
|
|||||||
pair_style lj/switch3/coulgauss/long 12.0 10.0 3.0
|
pair_style lj/switch3/coulgauss/long 12.0 10.0 3.0
|
||||||
pair_coeff 1 0.2 2.5 1.2
|
pair_coeff 1 0.2 2.5 1.2
|
||||||
|
|
||||||
|
pair_style mm3/switch3/coulgauss/long 12.0 3.0
|
||||||
|
pair_coeff 1 0.2 2.5 1.2
|
||||||
|
|
||||||
|
pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0
|
||||||
|
pair_coeff 1 0.2 2.5 1.2
|
||||||
|
|
||||||
Description
|
Description
|
||||||
"""""""""""
|
"""""""""""
|
||||||
|
|
||||||
@ -41,8 +56,17 @@ vdW potential
|
|||||||
|
|
||||||
E = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^{6} \right]
|
E = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^{6} \right]
|
||||||
|
|
||||||
, which goes smoothly to zero at the cutoff r_c as defined
|
The *mm3/switch3/coulgauss/long* style evaluates the MM3
|
||||||
by the switching function
|
vdW potential :ref:`(Allinger) <mm3-allinger1989>`
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
|
||||||
|
E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\
|
||||||
|
r_{v,ij} & = r_{v,i} + r_{v,j} \\
|
||||||
|
\epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j}
|
||||||
|
|
||||||
|
Both potentials go smoothly to zero at the cutoff r_c as defined by the
|
||||||
|
switching function
|
||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
|
|
||||||
@ -85,14 +109,35 @@ commands:
|
|||||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
For atom type pairs I,J and I != J, the epsilon and sigma coefficients
|
||||||
|
and cutoff distance for all of the lj/long pair styles can be mixed.
|
||||||
|
The default mix value is *geometric*\ . See the "pair_modify" command
|
||||||
|
for details.
|
||||||
|
|
||||||
Shifting the potential energy is not necessary because the switching
|
Shifting the potential energy is not necessary because the switching
|
||||||
function ensures that the potential is zero at the cut-off.
|
function ensures that the potential is zero at the cut-off.
|
||||||
|
|
||||||
|
These pair styles support the :doc:`pair_modify <pair_modify>` table and
|
||||||
|
options since they can tabulate the short-range portion of the
|
||||||
|
long-range Coulombic interactions.
|
||||||
|
|
||||||
|
Thes pair styles do not support the :doc:`pair_modify <pair_modify>`
|
||||||
|
tail option for adding a long-range tail correction to the
|
||||||
|
Lennard-Jones portion of the energy and pressure.
|
||||||
|
|
||||||
|
These pair styles write their information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands do not need
|
||||||
|
to be specified in an input script that reads a restart file.
|
||||||
|
|
||||||
|
These pair styles can only be used via the *pair* keyword of the
|
||||||
|
:doc:`run_style respa <run_style>` command. They do not support the
|
||||||
|
*inner*\ , *middle*\ , *outer* keywords.
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
||||||
These styles are part of the USER-YAFF package. They are only
|
These styles are part of the USER-YAFF package. They are only enabled
|
||||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
if LAMMPS was built with that package. See the :doc:`Build package
|
||||||
|
<Build_package>` doc page for more info.
|
||||||
|
|
||||||
Related commands
|
Related commands
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|||||||
@ -1,109 +0,0 @@
|
|||||||
.. index:: pair_style mm3/switch3/coulgauss/long
|
|
||||||
|
|
||||||
pair_style mm3/switch3/coulgauss/long command
|
|
||||||
=============================================
|
|
||||||
|
|
||||||
Syntax
|
|
||||||
""""""
|
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
|
||||||
|
|
||||||
pair_style style args
|
|
||||||
|
|
||||||
* style = *mm3/switch3/coulgauss/long*
|
|
||||||
* args = list of arguments for a particular style
|
|
||||||
|
|
||||||
.. parsed-literal::
|
|
||||||
|
|
||||||
*mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width
|
|
||||||
cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units)
|
|
||||||
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
|
||||||
width = width parameter of the smoothing function (distance units)
|
|
||||||
|
|
||||||
Examples
|
|
||||||
""""""""
|
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
|
||||||
|
|
||||||
pair_style mm3/switch3/coulgauss/long 12.0 3.0
|
|
||||||
pair_coeff 1 0.2 2.5 1.2
|
|
||||||
|
|
||||||
pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0
|
|
||||||
pair_coeff 1 0.2 2.5 1.2
|
|
||||||
|
|
||||||
Description
|
|
||||||
"""""""""""
|
|
||||||
|
|
||||||
The *mm3/switch3/coulgauss/long* style evaluates the MM3
|
|
||||||
vdW potential :ref:`(Allinger) <mm3-allinger1989>`
|
|
||||||
|
|
||||||
.. math::
|
|
||||||
|
|
||||||
E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\
|
|
||||||
r_{v,ij} & = r_{v,i} + r_{v,j} \\
|
|
||||||
\epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j}
|
|
||||||
|
|
||||||
, which goes smoothly to zero at the cutoff r_c as defined
|
|
||||||
by the switching function
|
|
||||||
|
|
||||||
.. math::
|
|
||||||
|
|
||||||
S_3(r) = \left\lbrace \begin{array}{ll}
|
|
||||||
1 & \quad\mathrm{if}\quad r < r_\mathrm{c} - w \\
|
|
||||||
3x^2 - 2x^3 & \quad\mathrm{if}\quad r < r_\mathrm{c} \quad\mathrm{with\quad} x=\frac{r_\mathrm{c} - r}{w} \\
|
|
||||||
0 & \quad\mathrm{if}\quad r >= r_\mathrm{c}
|
|
||||||
\end{array} \right.
|
|
||||||
|
|
||||||
where w is the width defined in the arguments. This potential
|
|
||||||
is combined with Coulomb interaction between Gaussian charge densities:
|
|
||||||
|
|
||||||
.. math::
|
|
||||||
|
|
||||||
E = \frac{q_i q_j \mathrm{erf}\left( r/\sqrt{\gamma_1^2+\gamma_2^2} \right) }{\epsilon r_{ij}}
|
|
||||||
|
|
||||||
where :math:`q_i` and :math:`q_j` are the charges on the 2 atoms,
|
|
||||||
epsilon is the dielectric constant which can be set by the
|
|
||||||
:doc:`dielectric <dielectric>` command, ::math:`\gamma_i` and
|
|
||||||
:math:`\gamma_j` are the widths of the Gaussian charge distribution and
|
|
||||||
erf() is the error-function. This style has to be used in conjunction
|
|
||||||
with the :doc:`kspace_style <kspace_style>` command
|
|
||||||
|
|
||||||
If one cutoff is specified it is used for both the vdW and Coulomb
|
|
||||||
terms. If two cutoffs are specified, the first is used as the cutoff
|
|
||||||
for the vdW terms, and the second is the cutoff for the Coulombic term.
|
|
||||||
|
|
||||||
The following coefficients must be defined for each pair of atoms
|
|
||||||
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
|
|
||||||
above, or in the data file or restart files read by the
|
|
||||||
:doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
|
|
||||||
commands:
|
|
||||||
|
|
||||||
* :math:`\epsilon` (energy)
|
|
||||||
* :math:`r_v` (distance)
|
|
||||||
* :math:`\gamma` (distance)
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
Mixing rules are fixed for this style as defined above.
|
|
||||||
|
|
||||||
Shifting the potential energy is not necessary because the switching
|
|
||||||
function ensures that the potential is zero at the cut-off.
|
|
||||||
|
|
||||||
Restrictions
|
|
||||||
""""""""""""
|
|
||||||
|
|
||||||
These styles are part of the USER-YAFF package. They are only
|
|
||||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
|
||||||
|
|
||||||
Related commands
|
|
||||||
""""""""""""""""
|
|
||||||
|
|
||||||
:doc:`pair_coeff <pair_coeff>`
|
|
||||||
|
|
||||||
Default
|
|
||||||
"""""""
|
|
||||||
|
|
||||||
none
|
|
||||||
@ -250,7 +250,7 @@ accelerated styles exist.
|
|||||||
* :doc:`mgpt <pair_mgpt>` - simplified model generalized pseudopotential theory (MGPT) potential
|
* :doc:`mgpt <pair_mgpt>` - simplified model generalized pseudopotential theory (MGPT) potential
|
||||||
* :doc:`mesont/tpm <pair_mesont_tpm>` - nanotubes mesoscopic force field
|
* :doc:`mesont/tpm <pair_mesont_tpm>` - nanotubes mesoscopic force field
|
||||||
* :doc:`mie/cut <pair_mie>` - Mie potential
|
* :doc:`mie/cut <pair_mie>` - Mie potential
|
||||||
* :doc:`mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>` - smoothed MM3 vdW potential with Gaussian electrostatics
|
* :doc:`mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>` - smoothed MM3 vdW potential with Gaussian electrostatics
|
||||||
* :doc:`momb <pair_momb>` - Many-Body Metal-Organic (MOMB) force field
|
* :doc:`momb <pair_momb>` - Many-Body Metal-Organic (MOMB) force field
|
||||||
* :doc:`morse <pair_morse>` - Morse potential
|
* :doc:`morse <pair_morse>` - Morse potential
|
||||||
* :doc:`morse/smooth/linear <pair_morse>` - linear smoothed Morse potential
|
* :doc:`morse/smooth/linear <pair_morse>` - linear smoothed Morse potential
|
||||||
|
|||||||
@ -217,7 +217,7 @@ This pair style can only be used via the *pair* keyword of the
|
|||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
||||||
These pair style are part of the MANYBODY package. They is only
|
These pair styles are part of the MANYBODY package. They are only
|
||||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||||
|
|
||||||
These pair styles requires the :doc:`newton <newton>` setting to be "on"
|
These pair styles requires the :doc:`newton <newton>` setting to be "on"
|
||||||
|
|||||||
90
doc/src/plugin.rst
Normal file
90
doc/src/plugin.rst
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
.. index:: plugin
|
||||||
|
|
||||||
|
plugin command
|
||||||
|
==============
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
""""""
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
plugin command args
|
||||||
|
|
||||||
|
* command = *load* or *unload* or *list* or *clear*
|
||||||
|
* args = list of arguments for a particular plugin command
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
*load* file = load plugin(s) from shared object in *file*
|
||||||
|
*unload* style name = unload plugin *name* of style *style*
|
||||||
|
*style* = *pair* or *bond* or *angle* or *dihedral* or *improper* or *compute* or *fix* or *region* or *command*
|
||||||
|
*list* = print a list of currently loaded plugins
|
||||||
|
*clear* = unload all currently loaded plugins
|
||||||
|
|
||||||
|
Examples
|
||||||
|
""""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
plugin load morse2plugin.so
|
||||||
|
plugin unload pair morse2/omp
|
||||||
|
plugin unload command hello
|
||||||
|
plugin list
|
||||||
|
plugin clear
|
||||||
|
|
||||||
|
Description
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
The plugin command allows to load (and unload) additional styles and
|
||||||
|
commands into a LAMMPS binary from so-called dynamic shared object (DSO)
|
||||||
|
files. This enables to add new functionality to an existing LAMMPS
|
||||||
|
binary without having to recompile and link the entire executable.
|
||||||
|
|
||||||
|
The *load* command will load and initialize all plugins contained in the
|
||||||
|
plugin DSO with the given filename. A message with information the
|
||||||
|
plugin style and name and more will be printed. Individual DSO files
|
||||||
|
may contain multiple plugins. More details about how to write and
|
||||||
|
compile the plugin DSO is given in programmer's guide part of the manual
|
||||||
|
under :doc:`Developer_plugins`.
|
||||||
|
|
||||||
|
The *unload* command will remove the given style or the given name from
|
||||||
|
the list of available styles. If the plugin style is currently in use,
|
||||||
|
that style instance will be deleted.
|
||||||
|
|
||||||
|
The *list* command will print a list of the loaded plugins and their
|
||||||
|
styles and names.
|
||||||
|
|
||||||
|
The *clear* command will unload all currently loaded plugins.
|
||||||
|
|
||||||
|
|
||||||
|
Restrictions
|
||||||
|
""""""""""""
|
||||||
|
|
||||||
|
The *plugin* command is part of the PLUGIN package. It is
|
||||||
|
only enabled if LAMMPS was built with that package.
|
||||||
|
See the :doc:`Build package <Build_package>` doc page for
|
||||||
|
more info. Plugins are not available on Windows.
|
||||||
|
|
||||||
|
For the loading of plugins to work the LAMMPS library must be
|
||||||
|
:ref:`compiled as a shared library <library>`. If plugins
|
||||||
|
access functions or classes from a package, LAMMPS must have
|
||||||
|
been compiled with that package included.
|
||||||
|
|
||||||
|
Plugins are dependent on the LAMMPS binary interface (ABI)
|
||||||
|
and particularly the MPI library used. So they are not guaranteed
|
||||||
|
to work when the plugin was compiled with a different MPI library
|
||||||
|
or different compilation settings or a different LAMMPS version.
|
||||||
|
There are no checks, so if there is a mismatch the plugin object
|
||||||
|
will either not load or data corruption and crashes may happen.
|
||||||
|
|
||||||
|
|
||||||
|
Related commands
|
||||||
|
""""""""""""""""
|
||||||
|
|
||||||
|
none
|
||||||
|
|
||||||
|
|
||||||
|
Default
|
||||||
|
"""""""
|
||||||
|
|
||||||
|
none
|
||||||
@ -87,7 +87,7 @@ energy is a derived unit (in SI units you equivalently have the relation
|
|||||||
* charge = reduced LJ charge, where :math:`q^* = q \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon}}`
|
* charge = reduced LJ charge, where :math:`q^* = q \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon}}`
|
||||||
* dipole = reduced LJ dipole, moment where :math:`\mu^* = \mu \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma^3 \epsilon}}`
|
* dipole = reduced LJ dipole, moment where :math:`\mu^* = \mu \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma^3 \epsilon}}`
|
||||||
* electric field = force/charge, where :math:`E^* = E \frac{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon} \sigma}{\epsilon}`
|
* electric field = force/charge, where :math:`E^* = E \frac{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon} \sigma}{\epsilon}`
|
||||||
* density = mass/volume, where :math:`\rho^* = \rho \sigma^{dim}`
|
* density = mass/volume, where :math:`\rho^* = \rho \frac{\sigma^{dim}}{m}`
|
||||||
|
|
||||||
Note that for LJ units, the default mode of thermodynamic output via
|
Note that for LJ units, the default mode of thermodynamic output via
|
||||||
the :doc:`thermo_style <thermo_style>` command is to normalize all
|
the :doc:`thermo_style <thermo_style>` command is to normalize all
|
||||||
|
|||||||
@ -65,8 +65,8 @@ Syntax
|
|||||||
bound(group,dir,region), gyration(group,region), ke(group,reigon),
|
bound(group,dir,region), gyration(group,region), ke(group,reigon),
|
||||||
angmom(group,dim,region), torque(group,dim,region),
|
angmom(group,dim,region), torque(group,dim,region),
|
||||||
inertia(group,dimdim,region), omega(group,dim,region)
|
inertia(group,dimdim,region), omega(group,dim,region)
|
||||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x)
|
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name)
|
||||||
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
|
feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id)
|
||||||
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
|
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
|
||||||
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
|
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
|
||||||
compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]
|
compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]
|
||||||
@ -429,7 +429,7 @@ argument. For *equal*\ -style variables the formula computes a scalar
|
|||||||
quantity, which becomes the value of the variable whenever it is
|
quantity, which becomes the value of the variable whenever it is
|
||||||
evaluated. For *vector*\ -style variables the formula must compute a
|
evaluated. For *vector*\ -style variables the formula must compute a
|
||||||
vector of quantities, which becomes the value of the variable whenever
|
vector of quantities, which becomes the value of the variable whenever
|
||||||
it is evaluated. The calculated vector can be on length one, but it
|
it is evaluated. The calculated vector can be of length one, but it
|
||||||
cannot be a simple scalar value like that produced by an equal-style
|
cannot be a simple scalar value like that produced by an equal-style
|
||||||
compute. I.e. the formula for a vector-style variable must have at
|
compute. I.e. the formula for a vector-style variable must have at
|
||||||
least one quantity in it that refers to a global vector produced by a
|
least one quantity in it that refers to a global vector produced by a
|
||||||
@ -821,6 +821,10 @@ Special Functions
|
|||||||
Special functions take specific kinds of arguments, meaning their
|
Special functions take specific kinds of arguments, meaning their
|
||||||
arguments cannot be formulas themselves.
|
arguments cannot be formulas themselves.
|
||||||
|
|
||||||
|
The is_file(x) function is a test whether 'x' is a (readable) file
|
||||||
|
and returns 1 in this case, otherwise it returns 0. For that 'x'
|
||||||
|
is taken as a literal string and must not have any blanks in it.
|
||||||
|
|
||||||
The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions
|
The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions
|
||||||
each take 1 argument which is of the form "c_ID" or "c_ID[N]" or
|
each take 1 argument which is of the form "c_ID" or "c_ID[N]" or
|
||||||
"f_ID" or "f_ID[N]" or "v_name". The first two are computes and the
|
"f_ID" or "f_ID[N]" or "v_name". The first two are computes and the
|
||||||
|
|||||||
@ -1588,6 +1588,7 @@ lammps
|
|||||||
Lammps
|
Lammps
|
||||||
LAMMPS
|
LAMMPS
|
||||||
lammpsplot
|
lammpsplot
|
||||||
|
lammpsplugin
|
||||||
Lampis
|
Lampis
|
||||||
Lamoureux
|
Lamoureux
|
||||||
Lanczos
|
Lanczos
|
||||||
|
|||||||
56
examples/deposit/in.deposit.molecule.rigid-small
Normal file
56
examples/deposit/in.deposit.molecule.rigid-small
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# sample surface deposition script for molecules
|
||||||
|
|
||||||
|
units lj
|
||||||
|
atom_style bond
|
||||||
|
boundary p p f
|
||||||
|
|
||||||
|
lattice fcc 1.0
|
||||||
|
region box block 0 5 0 5 0 10
|
||||||
|
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||||
|
|
||||||
|
region substrate block INF INF INF INF INF 3
|
||||||
|
create_atoms 1 region substrate
|
||||||
|
|
||||||
|
pair_style lj/cut 2.5
|
||||||
|
pair_coeff * * 1.0 1.0
|
||||||
|
pair_coeff 1 2 1.0 1.0 5.0
|
||||||
|
mass * 1.0
|
||||||
|
|
||||||
|
bond_style harmonic
|
||||||
|
bond_coeff 1 5.0 1.0
|
||||||
|
|
||||||
|
neigh_modify delay 0
|
||||||
|
|
||||||
|
molecule dimer molecule.dimer
|
||||||
|
region slab block 0 5 0 5 8 9
|
||||||
|
|
||||||
|
group addatoms empty
|
||||||
|
region mobile block 0 5 0 5 2 INF
|
||||||
|
group mobile region mobile
|
||||||
|
|
||||||
|
compute add addatoms temp
|
||||||
|
compute_modify add dynamic/dof yes extra/dof 0
|
||||||
|
|
||||||
|
fix 1 addatoms rigid/small molecule mol dimer
|
||||||
|
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||||
|
fix 3 mobile nve
|
||||||
|
|
||||||
|
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 &
|
||||||
|
mol dimer vz -1.0 -1.0 rigid 1
|
||||||
|
fix 5 addatoms wall/reflect zhi EDGE
|
||||||
|
|
||||||
|
thermo_style custom step atoms temp epair etotal press
|
||||||
|
thermo 100
|
||||||
|
thermo_modify temp add lost/bond ignore lost warn
|
||||||
|
|
||||||
|
#dump 1 all atom 50 dump.deposit.atom
|
||||||
|
|
||||||
|
#dump 2 all image 50 image.*.jpg type type &
|
||||||
|
# axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 2 pad 5
|
||||||
|
|
||||||
|
#dump 3 all movie 50 tmp.mpg type type &
|
||||||
|
# axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 3 pad 5
|
||||||
|
|
||||||
|
run 10000
|
||||||
@ -21,7 +21,7 @@ bond_coeff 1 5.0 1.0
|
|||||||
|
|
||||||
neigh_modify delay 0
|
neigh_modify delay 0
|
||||||
|
|
||||||
group addatoms type 2
|
group addatoms empty
|
||||||
region mobile block 0 5 0 5 2 INF
|
region mobile block 0 5 0 5 2 INF
|
||||||
group mobile region mobile
|
group mobile region mobile
|
||||||
|
|
||||||
|
|||||||
218
examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1
Normal file
218
examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
LAMMPS (10 Mar 2021)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
# sample surface deposition script for molecules
|
||||||
|
|
||||||
|
units lj
|
||||||
|
atom_style bond
|
||||||
|
boundary p p f
|
||||||
|
|
||||||
|
lattice fcc 1.0
|
||||||
|
Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011
|
||||||
|
region box block 0 5 0 5 0 10
|
||||||
|
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||||
|
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011)
|
||||||
|
1 by 1 by 1 MPI processor grid
|
||||||
|
|
||||||
|
region substrate block INF INF INF INF INF 3
|
||||||
|
create_atoms 1 region substrate
|
||||||
|
Created 350 atoms
|
||||||
|
create_atoms CPU = 0.001 seconds
|
||||||
|
|
||||||
|
pair_style lj/cut 2.5
|
||||||
|
pair_coeff * * 1.0 1.0
|
||||||
|
pair_coeff 1 2 1.0 1.0 5.0
|
||||||
|
mass * 1.0
|
||||||
|
|
||||||
|
bond_style harmonic
|
||||||
|
bond_coeff 1 5.0 1.0
|
||||||
|
|
||||||
|
neigh_modify delay 0
|
||||||
|
|
||||||
|
molecule dimer molecule.dimer
|
||||||
|
Read molecule template dimer:
|
||||||
|
1 molecules
|
||||||
|
2 atoms with max type 3
|
||||||
|
1 bonds with max type 1
|
||||||
|
0 angles with max type 0
|
||||||
|
0 dihedrals with max type 0
|
||||||
|
0 impropers with max type 0
|
||||||
|
region slab block 0 5 0 5 8 9
|
||||||
|
|
||||||
|
group addatoms empty
|
||||||
|
0 atoms in group addatoms
|
||||||
|
region mobile block 0 5 0 5 2 INF
|
||||||
|
group mobile region mobile
|
||||||
|
150 atoms in group mobile
|
||||||
|
|
||||||
|
compute add addatoms temp
|
||||||
|
compute_modify add dynamic/dof yes extra/dof 0
|
||||||
|
|
||||||
|
fix 1 addatoms rigid/small molecule mol dimer
|
||||||
|
create bodies CPU = 0.000 seconds
|
||||||
|
0 rigid bodies with 0 atoms
|
||||||
|
1.0000000 = max distance from body owner to body atom
|
||||||
|
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||||
|
fix 3 mobile nve
|
||||||
|
|
||||||
|
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1
|
||||||
|
fix 5 addatoms wall/reflect zhi EDGE
|
||||||
|
|
||||||
|
thermo_style custom step atoms temp epair etotal press
|
||||||
|
thermo 100
|
||||||
|
thermo_modify temp add lost/bond ignore lost warn
|
||||||
|
WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468)
|
||||||
|
|
||||||
|
#dump 1 all atom 50 dump.deposit.atom
|
||||||
|
|
||||||
|
#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 2 pad 5
|
||||||
|
|
||||||
|
#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 3 pad 5
|
||||||
|
|
||||||
|
run 10000
|
||||||
|
WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182)
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 1 steps, delay 0 steps, check yes
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 5.3
|
||||||
|
ghost atom cutoff = 5.3
|
||||||
|
binsize = 2.65, bins = 3 3 6
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/cut, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
Per MPI rank memory allocation (min/avg/max) = 5.929 | 5.929 | 5.929 Mbytes
|
||||||
|
Step Atoms Temp E_pair TotEng Press
|
||||||
|
0 350 0 -6.9215833 -6.9215833 -1.0052629
|
||||||
|
100 352 1.0079368 -6.8875167 -6.8803581 -0.73353914
|
||||||
|
200 354 1.0081552 -6.8594643 -6.8452248 -0.70421276
|
||||||
|
300 356 1.0085803 -6.8171524 -6.7959042 -0.6917826
|
||||||
|
400 358 1.0099188 -6.7852701 -6.7570601 -0.70371699
|
||||||
|
500 360 1.0140221 -6.7493429 -6.7141338 -0.68415307
|
||||||
|
600 362 1.026148 -6.7105231 -6.6680032 -0.68314418
|
||||||
|
700 364 1.0683344 -6.6725162 -6.621154 -0.65747369
|
||||||
|
800 366 1.0958952 -6.6412275 -6.5813425 -0.68789614
|
||||||
|
900 368 1.1250033 -6.6101882 -6.541404 -0.66674346
|
||||||
|
1000 370 1.2326373 -6.5993719 -6.5160856 -0.6968868
|
||||||
|
1100 372 1.1397426 -6.5912861 -6.5070309 -0.63330356
|
||||||
|
1200 374 1.0514292 -6.5905747 -6.5062354 -0.71020362
|
||||||
|
1300 376 1.003296 -6.5747765 -6.4880555 -0.65459732
|
||||||
|
1400 378 0.82999289 -6.5681797 -6.4913285 -0.60438126
|
||||||
|
1500 380 0.90239175 -6.575298 -6.4862461 -0.66528725
|
||||||
|
1600 382 0.86399799 -6.5692206 -6.4787496 -0.65027781
|
||||||
|
1700 384 0.64747231 -6.5644237 -6.4927634 -0.6304614
|
||||||
|
1800 386 0.74288971 -6.5515735 -6.4649672 -0.67772325
|
||||||
|
1900 388 0.7257202 -6.5565091 -6.4676644 -0.66173549
|
||||||
|
2000 390 0.73381036 -6.5631515 -6.4690733 -0.64685916
|
||||||
|
2100 392 0.76476562 -6.5574124 -6.4549885 -0.68866192
|
||||||
|
2200 394 0.65932468 -6.5511557 -6.459118 -0.71728829
|
||||||
|
2300 396 0.70269509 -6.5728146 -6.4707819 -0.64362081
|
||||||
|
2400 398 0.60528919 -6.5845991 -6.4933494 -0.63956327
|
||||||
|
2500 400 0.51025744 -6.5812452 -6.5015175 -0.68706961
|
||||||
|
2600 402 0.5245131 -6.6003894 -6.5155801 -0.68972215
|
||||||
|
2700 404 0.46330251 -6.5659175 -6.4885092 -0.72870942
|
||||||
|
2800 406 0.48039778 -6.5715192 -6.488692 -0.753758
|
||||||
|
2900 408 0.53698616 -6.5813154 -6.4858951 -0.67117541
|
||||||
|
3000 410 0.50231419 -6.5886963 -6.4968096 -0.71905351
|
||||||
|
3100 412 0.49420225 -6.596733 -6.5037702 -0.65947518
|
||||||
|
3200 414 0.42703699 -6.5879338 -6.5054146 -0.80033546
|
||||||
|
3300 416 0.44306009 -6.580249 -6.4923825 -0.76503083
|
||||||
|
3400 418 0.55620672 -6.5923388 -6.4792346 -0.69367877
|
||||||
|
3500 420 0.39815033 -6.5911154 -6.5081674 -0.65569211
|
||||||
|
3600 422 0.44197847 -6.6026382 -6.5083774 -0.73299102
|
||||||
|
3700 424 0.45049389 -6.6060616 -6.5077817 -0.7552914
|
||||||
|
3800 426 0.43047295 -6.6079275 -6.51193 -0.71501328
|
||||||
|
3900 428 0.43779129 -6.6099306 -6.5102001 -0.71539515
|
||||||
|
4000 430 0.41113503 -6.6123009 -6.5166881 -0.74177096
|
||||||
|
4100 432 0.32800011 -6.5983566 -6.5205325 -0.71688103
|
||||||
|
4200 434 0.39168203 -6.6110342 -6.5162724 -0.78927697
|
||||||
|
4300 436 0.48151013 -6.6183315 -6.4996106 -0.70523035
|
||||||
|
4400 438 0.45391027 -6.6331732 -6.5191775 -0.7270855
|
||||||
|
4500 440 0.349126 -6.6091657 -6.5199006 -0.76974115
|
||||||
|
4600 442 0.43375023 -6.6219188 -6.5090653 -0.74576212
|
||||||
|
4700 444 0.40071749 -6.6184164 -6.5123707 -0.71919052
|
||||||
|
4800 446 0.414292 -6.6298132 -6.5183445 -0.76237313
|
||||||
|
4900 448 0.44210681 -6.6364174 -6.5155288 -0.78753121
|
||||||
|
5000 450 0.36101771 -6.6232703 -6.5229876 -0.73927083
|
||||||
|
5100 452 0.41481171 -6.6442404 -6.5272305 -0.76316209
|
||||||
|
5200 454 0.40283527 -6.6512252 -6.5358759 -0.79645689
|
||||||
|
5300 456 0.3642061 -6.6530346 -6.5472072 -0.77458364
|
||||||
|
5400 458 0.38449826 -6.6514864 -6.5381518 -0.73083784
|
||||||
|
5500 460 0.42559408 -6.6769326 -6.5497169 -0.78932279
|
||||||
|
5600 462 0.38905756 -6.6698705 -6.5519743 -0.77118812
|
||||||
|
5700 464 0.38354955 -6.6706904 -6.5528977 -0.75067129
|
||||||
|
5800 466 0.36760943 -6.6942519 -6.5798669 -0.685487
|
||||||
|
5900 468 0.30783118 -6.6838159 -6.5867965 -0.79233808
|
||||||
|
6000 470 0.33145368 -6.6733504 -6.5675673 -0.84390449
|
||||||
|
6100 472 0.39252324 -6.6912189 -6.5643973 -0.83342022
|
||||||
|
6200 474 0.32342144 -6.6906083 -6.5848481 -0.71262158
|
||||||
|
6300 476 0.34445238 -6.7008453 -6.5868721 -0.76650756
|
||||||
|
6400 478 0.38152782 -6.7017838 -6.5740758 -0.77113022
|
||||||
|
6500 480 0.37540166 -6.7119996 -6.5849105 -0.79907635
|
||||||
|
6600 482 0.3579419 -6.7034721 -6.5809401 -0.8141269
|
||||||
|
6700 484 0.33538235 -6.6916682 -6.575601 -0.83265486
|
||||||
|
6800 486 0.34081871 -6.6931924 -6.573976 -0.80582583
|
||||||
|
6900 488 0.3555283 -6.6939997 -6.5683263 -0.74771423
|
||||||
|
7000 490 0.3543769 -6.7093364 -6.5827732 -0.77643516
|
||||||
|
7100 492 0.31263107 -6.698361 -6.5855723 -0.73108333
|
||||||
|
7200 494 0.32107 -6.6959056 -6.5789166 -0.7575478
|
||||||
|
7300 496 0.32908165 -6.7137605 -6.592677 -0.86538023
|
||||||
|
7400 498 0.32539571 -6.7030353 -6.5821554 -0.79337428
|
||||||
|
7500 500 0.33902577 -6.7078178 -6.5806832 -0.85408988
|
||||||
|
7600 502 0.35530921 -6.707507 -6.5730274 -0.79914613
|
||||||
|
7700 504 0.32391812 -6.6978823 -6.5741635 -0.78603595
|
||||||
|
7800 506 0.36390015 -6.7151325 -6.5748943 -0.83164222
|
||||||
|
7900 508 0.3372561 -6.7086718 -6.5775535 -0.7949992
|
||||||
|
8000 510 0.36612946 -6.7225238 -6.5789437 -0.80322866
|
||||||
|
8100 512 0.34622305 -6.7229825 -6.5860486 -0.70478659
|
||||||
|
8200 514 0.3212233 -6.7202524 -6.5921381 -0.91836713
|
||||||
|
8300 516 0.3402461 -6.721488 -6.5846642 -0.88273592
|
||||||
|
8400 518 0.34070258 -6.7268378 -6.5887152 -0.76057264
|
||||||
|
8500 520 0.36267747 -6.744602 -6.5963924 -0.81051317
|
||||||
|
8600 522 0.3439948 -6.7376267 -6.595943 -0.84600203
|
||||||
|
8700 524 0.30960289 -6.7276471 -6.5991382 -0.90965986
|
||||||
|
8800 526 0.28868972 -6.7159628 -6.595218 -0.876093
|
||||||
|
8900 528 0.31020216 -6.7162903 -6.5855707 -0.83193125
|
||||||
|
9000 530 0.31836275 -6.7171479 -6.5819939 -0.82093897
|
||||||
|
9100 532 0.32543293 -6.724167 -6.5850016 -0.7690143
|
||||||
|
9200 534 0.32644265 -6.7139575 -6.5733549 -0.86903096
|
||||||
|
9300 536 0.33050759 -6.7254715 -6.5821077 -0.94504522
|
||||||
|
9400 538 0.30372582 -6.7139931 -6.5813247 -0.91128612
|
||||||
|
9500 540 0.32943659 -6.7206223 -6.5757312 -0.87818439
|
||||||
|
9600 542 0.30911968 -6.708091 -6.5712114 -0.79092372
|
||||||
|
9700 544 0.33909826 -6.7222948 -6.5711342 -0.80266151
|
||||||
|
9800 546 0.29015141 -6.7086869 -6.5784908 -0.87763769
|
||||||
|
9900 548 0.33838474 -6.7384955 -6.5856667 -0.85630604
|
||||||
|
10000 550 0.30213198 -6.7338924 -6.5965597 -0.75738882
|
||||||
|
Loop time of 17.2852 on 1 procs for 10000 steps with 550 atoms
|
||||||
|
|
||||||
|
Performance: 249924.414 tau/day, 578.529 timesteps/s
|
||||||
|
99.7% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||||
|
|
||||||
|
MPI task timing breakdown:
|
||||||
|
Section | min time | avg time | max time |%varavg| %total
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Pair | 9.637 | 9.637 | 9.637 | 0.0 | 55.75
|
||||||
|
Bond | 0.025444 | 0.025444 | 0.025444 | 0.0 | 0.15
|
||||||
|
Neigh | 4.6852 | 4.6852 | 4.6852 | 0.0 | 27.11
|
||||||
|
Comm | 0.65556 | 0.65556 | 0.65556 | 0.0 | 3.79
|
||||||
|
Output | 0.0099883 | 0.0099883 | 0.0099883 | 0.0 | 0.06
|
||||||
|
Modify | 2.1895 | 2.1895 | 2.1895 | 0.0 | 12.67
|
||||||
|
Other | | 0.08248 | | | 0.48
|
||||||
|
|
||||||
|
Nlocal: 550.000 ave 550 max 550 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Nghost: 2367.00 ave 2367 max 2367 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Neighs: 36781.0 ave 36781 max 36781 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
Total # of neighbors = 36781
|
||||||
|
Ave neighs/atom = 66.874545
|
||||||
|
Ave special neighs/atom = 0.36363636
|
||||||
|
Neighbor list builds = 840
|
||||||
|
Dangerous builds = 0
|
||||||
|
Total wall time: 0:00:17
|
||||||
218
examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4
Normal file
218
examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
LAMMPS (10 Mar 2021)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
# sample surface deposition script for molecules
|
||||||
|
|
||||||
|
units lj
|
||||||
|
atom_style bond
|
||||||
|
boundary p p f
|
||||||
|
|
||||||
|
lattice fcc 1.0
|
||||||
|
Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011
|
||||||
|
region box block 0 5 0 5 0 10
|
||||||
|
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||||
|
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011)
|
||||||
|
1 by 1 by 4 MPI processor grid
|
||||||
|
|
||||||
|
region substrate block INF INF INF INF INF 3
|
||||||
|
create_atoms 1 region substrate
|
||||||
|
Created 350 atoms
|
||||||
|
create_atoms CPU = 0.139 seconds
|
||||||
|
|
||||||
|
pair_style lj/cut 2.5
|
||||||
|
pair_coeff * * 1.0 1.0
|
||||||
|
pair_coeff 1 2 1.0 1.0 5.0
|
||||||
|
mass * 1.0
|
||||||
|
|
||||||
|
bond_style harmonic
|
||||||
|
bond_coeff 1 5.0 1.0
|
||||||
|
|
||||||
|
neigh_modify delay 0
|
||||||
|
|
||||||
|
molecule dimer molecule.dimer
|
||||||
|
Read molecule template dimer:
|
||||||
|
1 molecules
|
||||||
|
2 atoms with max type 3
|
||||||
|
1 bonds with max type 1
|
||||||
|
0 angles with max type 0
|
||||||
|
0 dihedrals with max type 0
|
||||||
|
0 impropers with max type 0
|
||||||
|
region slab block 0 5 0 5 8 9
|
||||||
|
|
||||||
|
group addatoms empty
|
||||||
|
0 atoms in group addatoms
|
||||||
|
region mobile block 0 5 0 5 2 INF
|
||||||
|
group mobile region mobile
|
||||||
|
150 atoms in group mobile
|
||||||
|
|
||||||
|
compute add addatoms temp
|
||||||
|
compute_modify add dynamic/dof yes extra/dof 0
|
||||||
|
|
||||||
|
fix 1 addatoms rigid/small molecule mol dimer
|
||||||
|
create bodies CPU = 0.006 seconds
|
||||||
|
0 rigid bodies with 0 atoms
|
||||||
|
1.0000000 = max distance from body owner to body atom
|
||||||
|
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||||
|
fix 3 mobile nve
|
||||||
|
|
||||||
|
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1
|
||||||
|
fix 5 addatoms wall/reflect zhi EDGE
|
||||||
|
|
||||||
|
thermo_style custom step atoms temp epair etotal press
|
||||||
|
thermo 100
|
||||||
|
thermo_modify temp add lost/bond ignore lost warn
|
||||||
|
WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468)
|
||||||
|
|
||||||
|
#dump 1 all atom 50 dump.deposit.atom
|
||||||
|
|
||||||
|
#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 2 pad 5
|
||||||
|
|
||||||
|
#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30
|
||||||
|
#dump_modify 3 pad 5
|
||||||
|
|
||||||
|
run 10000
|
||||||
|
WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182)
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 1 steps, delay 0 steps, check yes
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 5.3
|
||||||
|
ghost atom cutoff = 5.3
|
||||||
|
binsize = 2.65, bins = 3 3 6
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/cut, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
Per MPI rank memory allocation (min/avg/max) = 5.255 | 5.852 | 6.302 Mbytes
|
||||||
|
Step Atoms Temp E_pair TotEng Press
|
||||||
|
0 350 0 -6.9215833 -6.9215833 -1.0052629
|
||||||
|
100 352 1.0079368 -6.8946578 -6.8874992 -0.73775337
|
||||||
|
200 354 1.0081552 -6.8645575 -6.850318 -0.69629729
|
||||||
|
300 356 1.0085803 -6.821677 -6.8004288 -0.69532657
|
||||||
|
400 358 1.0099188 -6.7837923 -6.7555822 -0.68879568
|
||||||
|
500 360 1.0140221 -6.7446709 -6.7094618 -0.72991641
|
||||||
|
600 362 1.026146 -6.7129201 -6.6704003 -0.67063836
|
||||||
|
700 364 1.0683193 -6.6776523 -6.6262908 -0.65572472
|
||||||
|
800 366 1.0958893 -6.6402029 -6.5803182 -0.66307281
|
||||||
|
900 368 1.1231768 -6.6050912 -6.5364187 -0.64076928
|
||||||
|
1000 370 1.1976283 -6.5942507 -6.5133299 -0.69249019
|
||||||
|
1100 372 1.0506263 -6.5772313 -6.499564 -0.63072939
|
||||||
|
1200 374 0.93724351 -6.5732957 -6.4981157 -0.64963897
|
||||||
|
1300 376 0.93899686 -6.5578406 -6.4766773 -0.65096289
|
||||||
|
1400 378 0.8704974 -6.5468498 -6.4662482 -0.67613931
|
||||||
|
1500 380 0.84490693 -6.5401094 -6.4567304 -0.64385968
|
||||||
|
1600 382 0.9243154 -6.5611604 -6.4643734 -0.62096869
|
||||||
|
1700 384 0.67202953 -6.5590557 -6.4846775 -0.67807465
|
||||||
|
1800 386 0.8712464 -6.5654953 -6.4639251 -0.65860236
|
||||||
|
1900 388 0.70011668 -6.5808612 -6.495151 -0.65146463
|
||||||
|
2000 390 0.64019295 -6.5652168 -6.4831408 -0.70291888
|
||||||
|
2100 392 0.67578277 -6.5596196 -6.469113 -0.63315981
|
||||||
|
2200 394 0.60785287 -6.558941 -6.4740885 -0.7133822
|
||||||
|
2300 396 0.8155086 -6.5756022 -6.4571887 -0.69176417
|
||||||
|
2400 398 0.69028748 -6.5875474 -6.483484 -0.63743938
|
||||||
|
2500 400 0.5013913 -6.5871851 -6.5088427 -0.65872179
|
||||||
|
2600 402 0.51268385 -6.5782356 -6.495339 -0.74289067
|
||||||
|
2700 404 0.57745388 -6.5815718 -6.4850912 -0.67922914
|
||||||
|
2800 406 0.47317895 -6.5974978 -6.5159152 -0.64657562
|
||||||
|
2900 408 0.50593124 -6.6019054 -6.5120034 -0.64211427
|
||||||
|
3000 410 0.44423233 -6.5956684 -6.5144064 -0.66526127
|
||||||
|
3100 412 0.40808865 -6.5949863 -6.5182221 -0.62722445
|
||||||
|
3200 414 0.40692632 -6.5866689 -6.5080358 -0.76440608
|
||||||
|
3300 416 0.43908529 -6.5851721 -6.4980939 -0.69345883
|
||||||
|
3400 418 0.53825907 -6.5880076 -6.478553 -0.69726204
|
||||||
|
3500 420 0.46363057 -6.6135193 -6.5169296 -0.58015901
|
||||||
|
3600 422 0.39262699 -6.621857 -6.5381213 -0.74921264
|
||||||
|
3700 424 0.42679205 -6.6146579 -6.5215488 -0.69040431
|
||||||
|
3800 426 0.38997492 -6.6139725 -6.5270063 -0.78237667
|
||||||
|
3900 428 0.5222531 -6.6403886 -6.5214174 -0.78298122
|
||||||
|
4000 430 0.47841128 -6.6502681 -6.5390097 -0.68125967
|
||||||
|
4100 432 0.44609186 -6.6610827 -6.5552392 -0.81157037
|
||||||
|
4200 434 0.4591431 -6.6858064 -6.5747234 -0.79000753
|
||||||
|
4300 436 0.40690573 -6.6800195 -6.579693 -0.6781696
|
||||||
|
4400 438 0.43023944 -6.6849804 -6.5769294 -0.7620548
|
||||||
|
4500 440 0.40889421 -6.6783124 -6.5737656 -0.8577593
|
||||||
|
4600 442 0.41452051 -6.6968565 -6.5890061 -0.70427746
|
||||||
|
4700 444 0.36740394 -6.6920933 -6.5948636 -0.69303162
|
||||||
|
4800 446 0.40112316 -6.6869413 -6.5790158 -0.84792822
|
||||||
|
4900 448 0.42437165 -6.6789835 -6.5629444 -0.82278531
|
||||||
|
5000 450 0.41822898 -6.6770254 -6.5608507 -0.72224472
|
||||||
|
5100 452 0.38445688 -6.6738997 -6.5654522 -0.7022418
|
||||||
|
5200 454 0.39998238 -6.6670536 -6.5525212 -0.73639959
|
||||||
|
5300 456 0.39471029 -6.6728592 -6.5581681 -0.70419927
|
||||||
|
5400 458 0.35817807 -6.6702423 -6.5646658 -0.81657219
|
||||||
|
5500 460 0.37151428 -6.6690855 -6.558035 -0.78076653
|
||||||
|
5600 462 0.32642513 -6.6622352 -6.5633185 -0.69118644
|
||||||
|
5700 464 0.43665879 -6.6811227 -6.5470195 -0.77500043
|
||||||
|
5800 466 0.40704721 -6.6858874 -6.5592311 -0.72683597
|
||||||
|
5900 468 0.3861903 -6.6896953 -6.5679794 -0.78001958
|
||||||
|
6000 470 0.34073346 -6.6833717 -6.574627 -0.78170837
|
||||||
|
6100 472 0.39953874 -6.7083668 -6.5792785 -0.81791744
|
||||||
|
6200 474 0.36685189 -6.7114648 -6.5915027 -0.80545451
|
||||||
|
6300 476 0.35851799 -6.7261023 -6.607475 -0.77350495
|
||||||
|
6400 478 0.41771823 -6.7427425 -6.6029205 -0.85319003
|
||||||
|
6500 480 0.36519478 -6.732662 -6.6090284 -0.78712805
|
||||||
|
6600 482 0.30669571 -6.7269784 -6.6219892 -0.76698134
|
||||||
|
6700 484 0.3384344 -6.7261448 -6.6090213 -0.79935239
|
||||||
|
6800 486 0.36420902 -6.7320259 -6.6046277 -0.84650552
|
||||||
|
6900 488 0.40181215 -6.7490619 -6.6070279 -0.75753238
|
||||||
|
7000 490 0.30536068 -6.7398924 -6.6308351 -0.73210162
|
||||||
|
7100 492 0.28813004 -6.7257287 -6.6217794 -0.92178435
|
||||||
|
7200 494 0.30956277 -6.7342688 -6.6214727 -0.77532949
|
||||||
|
7300 496 0.36625115 -6.7528159 -6.6180561 -0.76247835
|
||||||
|
7400 498 0.30935271 -6.7401433 -6.6252231 -0.82809158
|
||||||
|
7500 500 0.33222282 -6.7410421 -6.6164585 -0.81948236
|
||||||
|
7600 502 0.33318693 -6.7488106 -6.622704 -0.82395904
|
||||||
|
7700 504 0.34570598 -6.7547394 -6.6226989 -0.85644369
|
||||||
|
7800 506 0.34587242 -6.7446006 -6.6113099 -0.82476511
|
||||||
|
7900 508 0.2969166 -6.7305429 -6.6151078 -0.8210214
|
||||||
|
8000 510 0.32355758 -6.7437629 -6.6168776 -0.81719054
|
||||||
|
8100 512 0.33784479 -6.7545537 -6.6209335 -0.78082067
|
||||||
|
8200 514 0.32351289 -6.7525032 -6.6234757 -0.87093587
|
||||||
|
8300 516 0.31900134 -6.7550972 -6.6268166 -0.79928704
|
||||||
|
8400 518 0.3338521 -6.7588757 -6.6235302 -0.81699503
|
||||||
|
8500 520 0.33115184 -6.7614854 -6.6261589 -0.79958489
|
||||||
|
8600 522 0.29478929 -6.7490188 -6.6276018 -0.81954456
|
||||||
|
8700 524 0.267993 -6.7467764 -6.6355389 -0.76642994
|
||||||
|
8800 526 0.28792085 -6.7527118 -6.6322887 -0.86911619
|
||||||
|
8900 528 0.32430992 -6.75901 -6.6223453 -0.87087898
|
||||||
|
9000 530 0.33151321 -6.7534845 -6.6127478 -0.79309499
|
||||||
|
9100 532 0.32760982 -6.7599992 -6.6199028 -0.7506309
|
||||||
|
9200 534 0.32579101 -6.7671489 -6.6268269 -0.94238755
|
||||||
|
9300 536 0.35144354 -6.7782581 -6.625813 -0.77952234
|
||||||
|
9400 538 0.33689976 -6.7804455 -6.6332867 -0.75768501
|
||||||
|
9500 540 0.3052486 -6.7745436 -6.6402908 -0.89621525
|
||||||
|
9600 542 0.30617581 -6.7648172 -6.6292412 -0.90623541
|
||||||
|
9700 544 0.30097715 -6.7714379 -6.6372707 -0.85534149
|
||||||
|
9800 546 0.31297479 -6.7814978 -6.6410604 -0.88651064
|
||||||
|
9900 548 0.31832347 -6.790661 -6.6468926 -1.006
|
||||||
|
10000 550 0.29239559 -6.7823137 -6.6494066 -1.0337518
|
||||||
|
Loop time of 34.7661 on 4 procs for 10000 steps with 550 atoms
|
||||||
|
|
||||||
|
Performance: 124259.065 tau/day, 287.637 timesteps/s
|
||||||
|
73.4% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||||
|
|
||||||
|
MPI task timing breakdown:
|
||||||
|
Section | min time | avg time | max time |%varavg| %total
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Pair | 0.0076709 | 3.1286 | 9.1834 | 211.7 | 9.00
|
||||||
|
Bond | 0.0040276 | 0.010416 | 0.022169 | 7.0 | 0.03
|
||||||
|
Neigh | 0.052413 | 1.5948 | 4.885 | 155.3 | 4.59
|
||||||
|
Comm | 4.9736 | 12.242 | 20.073 | 166.2 | 35.21
|
||||||
|
Output | 0.053549 | 0.10104 | 0.21642 | 21.0 | 0.29
|
||||||
|
Modify | 13.435 | 16.191 | 23.851 | 110.0 | 46.57
|
||||||
|
Other | | 1.499 | | | 4.31
|
||||||
|
|
||||||
|
Nlocal: 137.500 ave 299 max 2 min
|
||||||
|
Histogram: 2 0 0 0 0 0 0 1 0 1
|
||||||
|
Nghost: 1898.75 ave 2679 max 524 min
|
||||||
|
Histogram: 1 0 0 0 0 0 1 0 0 2
|
||||||
|
Neighs: 9204.00 ave 23014 max 0 min
|
||||||
|
Histogram: 2 0 0 0 0 1 0 0 0 1
|
||||||
|
|
||||||
|
Total # of neighbors = 36816
|
||||||
|
Ave neighs/atom = 66.938182
|
||||||
|
Ave special neighs/atom = 0.36363636
|
||||||
|
Neighbor list builds = 832
|
||||||
|
Dangerous builds = 0
|
||||||
|
Total wall time: 0:00:34
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics
|
# GCMC for CO2 molecular fluid, rigid/small dynamics
|
||||||
# Rigid CO2 TraPPE model
|
# Rigid CO2 TraPPE model
|
||||||
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
||||||
# mixtures containing alkanes, carbon dioxide and
|
# mixtures containing alkanes, carbon dioxide and
|
||||||
@ -58,16 +58,16 @@ timestep 1.0
|
|||||||
|
|
||||||
# rigid constraints with thermostat
|
# rigid constraints with thermostat
|
||||||
|
|
||||||
fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol
|
fix myrigid co2 rigid/small molecule mol co2mol
|
||||||
|
|
||||||
# dynamically update fix rigid/nvt/small temperature ndof
|
# dynamically update fix rigid/nvt/small temperature ndof
|
||||||
fix_modify myrigidnvt dynamic/dof yes
|
fix_modify myrigid dynamic/dof yes
|
||||||
|
|
||||||
# gcmc
|
# gcmc
|
||||||
|
|
||||||
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol &
|
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol &
|
||||||
co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||||
|
|
||||||
# atom counts
|
# atom counts
|
||||||
|
|
||||||
|
|||||||
@ -1,196 +0,0 @@
|
|||||||
LAMMPS (27 Nov 2018)
|
|
||||||
using 1 OpenMP thread(s) per MPI task
|
|
||||||
# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics
|
|
||||||
# Rigid CO2 TraPPE model
|
|
||||||
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
|
||||||
# mixtures containing alkanes, carbon dioxide and
|
|
||||||
# nitrogen AIChE J., 47,1676-1682 (2001)].
|
|
||||||
|
|
||||||
# variables available on command line
|
|
||||||
|
|
||||||
variable mu index -8.1
|
|
||||||
variable disp index 0.5
|
|
||||||
variable temp index 338.0
|
|
||||||
variable lbox index 10.0
|
|
||||||
variable spacing index 5.0
|
|
||||||
|
|
||||||
# global model settings
|
|
||||||
|
|
||||||
units real
|
|
||||||
atom_style full
|
|
||||||
boundary p p p
|
|
||||||
pair_style lj/cut/coul/long 14
|
|
||||||
pair_modify mix arithmetic tail yes
|
|
||||||
kspace_style ewald 0.0001
|
|
||||||
bond_style harmonic
|
|
||||||
angle_style harmonic
|
|
||||||
|
|
||||||
# box, start molecules on simple cubic lattice
|
|
||||||
|
|
||||||
lattice sc ${spacing}
|
|
||||||
lattice sc 5.0
|
|
||||||
Lattice spacing in x,y,z = 5 5 5
|
|
||||||
region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box
|
|
||||||
region box block 0 10.0 0 ${lbox} 0 ${lbox} units box
|
|
||||||
region box block 0 10.0 0 10.0 0 ${lbox} units box
|
|
||||||
region box block 0 10.0 0 10.0 0 10.0 units box
|
|
||||||
create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
|
|
||||||
Created orthogonal box = (0 0 0) to (10 10 10)
|
|
||||||
1 by 1 by 1 MPI processor grid
|
|
||||||
molecule co2mol CO2.txt
|
|
||||||
Read molecule co2mol:
|
|
||||||
3 atoms with max type 2
|
|
||||||
2 bonds with max type 1
|
|
||||||
1 angles with max type 1
|
|
||||||
0 dihedrals with max type 0
|
|
||||||
0 impropers with max type 0
|
|
||||||
create_atoms 0 box mol co2mol 464563 units box
|
|
||||||
Created 24 atoms
|
|
||||||
Time spent = 0.00134993 secs
|
|
||||||
|
|
||||||
# rigid CO2 TraPPE model
|
|
||||||
|
|
||||||
pair_coeff 1 1 0.053649 2.8
|
|
||||||
pair_coeff 2 2 0.156973 3.05
|
|
||||||
bond_coeff 1 0 1.16
|
|
||||||
angle_coeff 1 0 180
|
|
||||||
|
|
||||||
# masses
|
|
||||||
|
|
||||||
mass 1 12.0107
|
|
||||||
mass 2 15.9994
|
|
||||||
|
|
||||||
# MD settings
|
|
||||||
|
|
||||||
group co2 type 1 2
|
|
||||||
24 atoms in group co2
|
|
||||||
neighbor 2.0 bin
|
|
||||||
neigh_modify every 1 delay 10 check yes
|
|
||||||
velocity all create ${temp} 54654
|
|
||||||
velocity all create 338.0 54654
|
|
||||||
timestep 1.0
|
|
||||||
|
|
||||||
# rigid constraints with thermostat
|
|
||||||
|
|
||||||
fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol
|
|
||||||
fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 ${temp} 100 mol co2mol
|
|
||||||
fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 338.0 100 mol co2mol
|
|
||||||
8 rigid bodies with 24 atoms
|
|
||||||
1.16 = max distance from body owner to body atom
|
|
||||||
|
|
||||||
# dynamically update fix rigid/nvt/small temperature ndof
|
|
||||||
fix_modify myrigidnvt dynamic/dof yes
|
|
||||||
|
|
||||||
# gcmc
|
|
||||||
|
|
||||||
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
|
||||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigidnvt
|
|
||||||
|
|
||||||
# atom counts
|
|
||||||
|
|
||||||
variable carbon atom "type==1"
|
|
||||||
variable oxygen atom "type==2"
|
|
||||||
group carbon dynamic co2 var carbon
|
|
||||||
dynamic group carbon defined
|
|
||||||
group oxygen dynamic co2 var oxygen
|
|
||||||
dynamic group oxygen defined
|
|
||||||
variable nC equal count(carbon)
|
|
||||||
variable nO equal count(oxygen)
|
|
||||||
|
|
||||||
# output
|
|
||||||
|
|
||||||
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
|
||||||
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
|
||||||
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
|
||||||
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
|
||||||
|
|
||||||
# dynamically update default temperature ndof
|
|
||||||
compute_modify thermo_temp dynamic/dof yes
|
|
||||||
|
|
||||||
thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
|
||||||
thermo 1000
|
|
||||||
|
|
||||||
# run
|
|
||||||
|
|
||||||
run 20000
|
|
||||||
Ewald initialization ...
|
|
||||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:321)
|
|
||||||
G vector (1/distance) = 0.164636
|
|
||||||
estimated absolute RMS force accuracy = 0.0332064
|
|
||||||
estimated relative force accuracy = 0.0001
|
|
||||||
KSpace vectors: actual max1d max3d = 16 2 62
|
|
||||||
kxmax kymax kzmax = 2 2 2
|
|
||||||
WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:487)
|
|
||||||
0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc
|
|
||||||
0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc
|
|
||||||
WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:471)
|
|
||||||
Neighbor list info ...
|
|
||||||
update every 1 steps, delay 10 steps, check yes
|
|
||||||
max neighbors/atom: 2000, page size: 100000
|
|
||||||
master list distance cutoff = 16
|
|
||||||
ghost atom cutoff = 16
|
|
||||||
binsize = 8, bins = 2 2 2
|
|
||||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
|
||||||
(1) pair lj/cut/coul/long, perpetual
|
|
||||||
attributes: half, newton on
|
|
||||||
pair build: half/bin/newton
|
|
||||||
stencil: half/bin/3d/newton
|
|
||||||
bin: standard
|
|
||||||
Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes
|
|
||||||
Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
|
||||||
0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16
|
|
||||||
1000 267.9799 -73.919548 -3.6735999 5.8578459 0.36539744 15 0.23663972 0.2494423 0 0 5 10
|
|
||||||
2000 409.06596 -98.033864 -6.7570039 10.974131 0.43847693 18 0.29379544 0.29816284 0 0 6 12
|
|
||||||
3000 279.3225 -836.47758 -26.434976 15.819539 0.87695385 36 0.23798567 0.24203908 0 0 12 24
|
|
||||||
4000 333.6181 606.63478 -30.35312 18.894592 0.87695385 36 0.19121778 0.19481508 0 0 12 24
|
|
||||||
5000 405.98741 -103.97582 -14.180277 16.942399 0.65771539 27 0.15272841 0.15982952 0 0 9 18
|
|
||||||
6000 283.5835 -240.01076 -6.7198093 7.607777 0.43847693 18 0.1606796 0.16536735 0 0 6 12
|
|
||||||
7000 142.00717 154.95914 -0.74192319 0.98769159 0.14615898 6 0.19501993 0.20103405 0 0 2 4
|
|
||||||
8000 376.67702 -118.12474 -10.774631 13.847899 0.5846359 24 0.20133396 0.20468352 0 0 8 16
|
|
||||||
9000 305.43166 -1095.8633 -10.388279 9.7112935 0.51155641 21 0.19445239 0.19869334 0 0 7 14
|
|
||||||
10000 244.08225 -179.31274 -12.974988 8.9732748 0.5846359 24 0.19098971 0.19586397 0 0 8 16
|
|
||||||
11000 305.03389 -568.94714 -21.745425 14.244887 0.73079488 30 0.18517522 0.18978828 0 0 10 20
|
|
||||||
12000 318.29735 767.76579 -37.184231 21.189508 1.0231128 42 0.17256426 0.17580267 0 0 14 28
|
|
||||||
13000 411.21707 433.01125 -4.5149215 8.9889065 0.36539744 15 0.16329385 0.16767604 0 0 5 10
|
|
||||||
14000 304.29535 148.28607 -2.3505844 6.6516754 0.36539744 15 0.17435868 0.17897674 0 0 5 10
|
|
||||||
15000 338.00555 2384.1424 -21.438264 17.463859 0.80387436 33 0.17237066 0.17634112 0 0 11 22
|
|
||||||
16000 613.56062 610.93867 -0.057364228 1.2192718 0.073079488 3 0.17128158 0.1758886 0 0 1 2
|
|
||||||
17000 432.63323 -980.52384 -15.79844 18.054365 0.65771539 27 0.17145651 0.17504846 0 0 9 18
|
|
||||||
18000 181.74572 -352.81765 -1.8617959 2.1669979 0.21923846 9 0.17292463 0.17654774 0 0 3 6
|
|
||||||
19000 208.55292 -248.38735 -4.2287767 4.5588154 0.36539744 15 0.18168324 0.18454331 0 0 5 10
|
|
||||||
20000 304.73317 -649.9896 -16.532405 12.716924 0.65771539 27 0.18085983 0.18345574 0 0 9 18
|
|
||||||
Loop time of 21.0434 on 1 procs for 20000 steps with 27 atoms
|
|
||||||
|
|
||||||
Performance: 82.116 ns/day, 0.292 hours/ns, 950.415 timesteps/s
|
|
||||||
98.5% CPU use with 1 MPI tasks x 1 OpenMP threads
|
|
||||||
|
|
||||||
MPI task timing breakdown:
|
|
||||||
Section | min time | avg time | max time |%varavg| %total
|
|
||||||
---------------------------------------------------------------
|
|
||||||
Pair | 2.2373 | 2.2373 | 2.2373 | 0.0 | 10.63
|
|
||||||
Bond | 0.022895 | 0.022895 | 0.022895 | 0.0 | 0.11
|
|
||||||
Kspace | 0.16756 | 0.16756 | 0.16756 | 0.0 | 0.80
|
|
||||||
Neigh | 0.11436 | 0.11436 | 0.11436 | 0.0 | 0.54
|
|
||||||
Comm | 0.26988 | 0.26988 | 0.26988 | 0.0 | 1.28
|
|
||||||
Output | 0.0014684 | 0.0014684 | 0.0014684 | 0.0 | 0.01
|
|
||||||
Modify | 18.193 | 18.193 | 18.193 | 0.0 | 86.45
|
|
||||||
Other | | 0.03692 | | | 0.18
|
|
||||||
|
|
||||||
Nlocal: 27 ave 27 max 27 min
|
|
||||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
|
||||||
Nghost: 2081 ave 2081 max 2081 min
|
|
||||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
|
||||||
Neighs: 6264 ave 6264 max 6264 min
|
|
||||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
|
||||||
|
|
||||||
Total # of neighbors = 6264
|
|
||||||
Ave neighs/atom = 232
|
|
||||||
Ave special neighs/atom = 2
|
|
||||||
Neighbor list builds = 20177
|
|
||||||
Dangerous builds = 0
|
|
||||||
|
|
||||||
Total wall time: 0:00:21
|
|
||||||
196
examples/gcmc/log.31Mar21.gcmc.co2.g++.1
Normal file
196
examples/gcmc/log.31Mar21.gcmc.co2.g++.1
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
LAMMPS (10 Mar 2021)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
# GCMC for CO2 molecular fluid, rigid/small dynamics
|
||||||
|
# Rigid CO2 TraPPE model
|
||||||
|
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
||||||
|
# mixtures containing alkanes, carbon dioxide and
|
||||||
|
# nitrogen AIChE J., 47,1676-1682 (2001)].
|
||||||
|
|
||||||
|
# variables available on command line
|
||||||
|
|
||||||
|
variable mu index -8.1
|
||||||
|
variable disp index 0.5
|
||||||
|
variable temp index 338.0
|
||||||
|
variable lbox index 10.0
|
||||||
|
variable spacing index 5.0
|
||||||
|
|
||||||
|
# global model settings
|
||||||
|
|
||||||
|
units real
|
||||||
|
atom_style full
|
||||||
|
boundary p p p
|
||||||
|
pair_style lj/cut/coul/long 14
|
||||||
|
pair_modify mix arithmetic tail yes
|
||||||
|
kspace_style ewald 0.0001
|
||||||
|
bond_style harmonic
|
||||||
|
angle_style harmonic
|
||||||
|
|
||||||
|
# box, start molecules on simple cubic lattice
|
||||||
|
|
||||||
|
lattice sc ${spacing}
|
||||||
|
lattice sc 5.0
|
||||||
|
Lattice spacing in x,y,z = 5.0000000 5.0000000 5.0000000
|
||||||
|
region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box
|
||||||
|
region box block 0 10.0 0 ${lbox} 0 ${lbox} units box
|
||||||
|
region box block 0 10.0 0 10.0 0 ${lbox} units box
|
||||||
|
region box block 0 10.0 0 10.0 0 10.0 units box
|
||||||
|
create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
|
||||||
|
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (10.000000 10.000000 10.000000)
|
||||||
|
1 by 1 by 1 MPI processor grid
|
||||||
|
molecule co2mol CO2.txt
|
||||||
|
Read molecule template co2mol:
|
||||||
|
1 molecules
|
||||||
|
3 atoms with max type 2
|
||||||
|
2 bonds with max type 1
|
||||||
|
1 angles with max type 1
|
||||||
|
0 dihedrals with max type 0
|
||||||
|
0 impropers with max type 0
|
||||||
|
create_atoms 0 box mol co2mol 464563 units box
|
||||||
|
Created 24 atoms
|
||||||
|
create_atoms CPU = 0.002 seconds
|
||||||
|
|
||||||
|
# rigid CO2 TraPPE model
|
||||||
|
|
||||||
|
pair_coeff 1 1 0.053649 2.8
|
||||||
|
pair_coeff 2 2 0.156973 3.05
|
||||||
|
bond_coeff 1 0 1.16
|
||||||
|
angle_coeff 1 0 180
|
||||||
|
|
||||||
|
# masses
|
||||||
|
|
||||||
|
mass 1 12.0107
|
||||||
|
mass 2 15.9994
|
||||||
|
|
||||||
|
# MD settings
|
||||||
|
|
||||||
|
group co2 type 1 2
|
||||||
|
24 atoms in group co2
|
||||||
|
neighbor 2.0 bin
|
||||||
|
neigh_modify every 1 delay 10 check yes
|
||||||
|
velocity all create ${temp} 54654
|
||||||
|
velocity all create 338.0 54654
|
||||||
|
timestep 1.0
|
||||||
|
|
||||||
|
# rigid constraints with thermostat
|
||||||
|
|
||||||
|
fix myrigid co2 rigid/small molecule mol co2mol
|
||||||
|
create bodies CPU = 0.000 seconds
|
||||||
|
8 rigid bodies with 24 atoms
|
||||||
|
1.1600000 = max distance from body owner to body atom
|
||||||
|
|
||||||
|
# dynamically update fix rigid/nvt/small temperature ndof
|
||||||
|
fix_modify myrigid dynamic/dof yes
|
||||||
|
|
||||||
|
# gcmc
|
||||||
|
|
||||||
|
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
||||||
|
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||||
|
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||||
|
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||||
|
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||||
|
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigid
|
||||||
|
|
||||||
|
# atom counts
|
||||||
|
|
||||||
|
variable carbon atom "type==1"
|
||||||
|
variable oxygen atom "type==2"
|
||||||
|
group carbon dynamic co2 var carbon
|
||||||
|
dynamic group carbon defined
|
||||||
|
group oxygen dynamic co2 var oxygen
|
||||||
|
dynamic group oxygen defined
|
||||||
|
variable nC equal count(carbon)
|
||||||
|
variable nO equal count(oxygen)
|
||||||
|
|
||||||
|
# output
|
||||||
|
|
||||||
|
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
||||||
|
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
||||||
|
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
||||||
|
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
||||||
|
|
||||||
|
# dynamically update default temperature ndof
|
||||||
|
compute_modify thermo_temp dynamic/dof yes
|
||||||
|
|
||||||
|
thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||||
|
thermo 1000
|
||||||
|
|
||||||
|
# run
|
||||||
|
|
||||||
|
run 20000
|
||||||
|
Ewald initialization ...
|
||||||
|
using 12-bit tables for long-range coulomb (src/kspace.cpp:339)
|
||||||
|
G vector (1/distance) = 0.16463644
|
||||||
|
estimated absolute RMS force accuracy = 0.033206372
|
||||||
|
estimated relative force accuracy = 0.0001
|
||||||
|
KSpace vectors: actual max1d max3d = 16 2 62
|
||||||
|
kxmax kymax kzmax = 2 2 2
|
||||||
|
WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:482)
|
||||||
|
0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc
|
||||||
|
0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc
|
||||||
|
WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486)
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 1 steps, delay 10 steps, check yes
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 16
|
||||||
|
ghost atom cutoff = 16
|
||||||
|
binsize = 8, bins = 2 2 2
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/cut/coul/long, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes
|
||||||
|
Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||||
|
0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16
|
||||||
|
1000 261.50949 -204.60974 -9.6459249 8.3147747 0.51155641 21 0.096366192 0.097590121 0 0 7 14
|
||||||
|
2000 479.39697 231.28436 -7.0089345 10.47927 0.36539744 15 0.085531005 0.085453295 0 0 5 10
|
||||||
|
3000 318.31766 -433.17133 -7.3680951 8.5396005 0.43847693 18 0.078556687 0.080101462 0 0 6 12
|
||||||
|
4000 357.40776 -186.78 -16.453111 14.915105 0.65771539 27 0.082003877 0.08249082 0 0 9 18
|
||||||
|
5000 399.94731 1524.2909 -16.624678 18.677282 0.73079488 30 0.071285101 0.072731705 0 0 10 20
|
||||||
|
6000 354.71736 60.134827 -18.988979 16.565073 0.73079488 30 0.071615663 0.071713414 0 0 10 20
|
||||||
|
7000 483.32057 966.32174 -5.7393251 10.565037 0.36539744 15 0.087027775 0.089855826 0 0 5 10
|
||||||
|
8000 547.68562 494.96891 -4.125626 11.97201 0.36539744 15 0.11738082 0.11937373 0 0 5 10
|
||||||
|
9000 433.76488 390.91467 -0.85312985 5.1718828 0.21923846 9 0.13265238 0.13513212 0 0 3 6
|
||||||
|
10000 330.01685 -862.07457 -26.494645 18.690633 0.87695385 36 0.13775034 0.13905403 0 0 12 24
|
||||||
|
11000 334.26318 -578.48274 -13.236965 12.288625 0.5846359 24 0.13713936 0.13960485 0 0 8 16
|
||||||
|
12000 243.68657 -1244.7156 -25.757644 12.590645 0.80387436 33 0.1339588 0.13588739 0 0 11 22
|
||||||
|
13000 307.66758 -429.66928 -17.864639 14.367878 0.73079488 30 0.12604721 0.1278094 0 0 10 20
|
||||||
|
14000 330.91434 495.97112 -15.374248 13.809499 0.65771539 27 0.12011756 0.12145865 0 0 9 18
|
||||||
|
15000 564.87966 982.72332 -14.810525 26.379517 0.73079488 30 0.12164324 0.12343521 0 0 10 20
|
||||||
|
16000 342.63867 -54.776299 -2.2580523 5.7875978 0.29231795 12 0.13535812 0.13790758 0 0 4 8
|
||||||
|
17000 461.07005 -2.4317694 -1.145154 3.2068452 0.14615898 6 0.1444739 0.14730804 0 0 2 4
|
||||||
|
18000 197.21207 -40.124433 -7.0857418 5.2906654 0.43847693 18 0.14403997 0.14574329 0 0 6 12
|
||||||
|
19000 393.36395 -420.49802 -11.172739 14.461366 0.5846359 24 0.15005606 0.15142063 0 0 8 16
|
||||||
|
20000 356.48539 56.071962 -1.7861789 4.2504609 0.21923846 9 0.15422732 0.15627984 0 0 3 6
|
||||||
|
Loop time of 19.5982 on 1 procs for 20000 steps with 9 atoms
|
||||||
|
|
||||||
|
Performance: 88.171 ns/day, 0.272 hours/ns, 1020.502 timesteps/s
|
||||||
|
99.5% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||||
|
|
||||||
|
MPI task timing breakdown:
|
||||||
|
Section | min time | avg time | max time |%varavg| %total
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Pair | 2.3404 | 2.3404 | 2.3404 | 0.0 | 11.94
|
||||||
|
Bond | 0.033919 | 0.033919 | 0.033919 | 0.0 | 0.17
|
||||||
|
Kspace | 0.19974 | 0.19974 | 0.19974 | 0.0 | 1.02
|
||||||
|
Neigh | 0.11478 | 0.11478 | 0.11478 | 0.0 | 0.59
|
||||||
|
Comm | 0.22538 | 0.22538 | 0.22538 | 0.0 | 1.15
|
||||||
|
Output | 0.00096536 | 0.00096536 | 0.00096536 | 0.0 | 0.00
|
||||||
|
Modify | 16.627 | 16.627 | 16.627 | 0.0 | 84.84
|
||||||
|
Other | | 0.05594 | | | 0.29
|
||||||
|
|
||||||
|
Nlocal: 9.00000 ave 9 max 9 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Nghost: 703.000 ave 703 max 703 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Neighs: 719.000 ave 719 max 719 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
Total # of neighbors = 719
|
||||||
|
Ave neighs/atom = 79.888889
|
||||||
|
Ave special neighs/atom = 2.0000000
|
||||||
|
Neighbor list builds = 20196
|
||||||
|
Dangerous builds = 0
|
||||||
|
|
||||||
|
Total wall time: 0:00:19
|
||||||
1
examples/plugins/.gitignore
vendored
Normal file
1
examples/plugins/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build*
|
||||||
68
examples/plugins/CMakeLists.txt
Normal file
68
examples/plugins/CMakeLists.txt
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
##########################################
|
||||||
|
# CMake build system for plugin examples.
|
||||||
|
# The is meant to be used as a template for plugins that are
|
||||||
|
# distributed independent from the LAMMPS package.
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
# enforce out-of-source build
|
||||||
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. "
|
||||||
|
"Please remove CMakeCache.txt and CMakeFiles first.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(plugins VERSION 1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
# NOTE: the next line should be commented out when used outside of the LAMMPS package
|
||||||
|
get_filename_component(LAMMPS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../src ABSOLUTE)
|
||||||
|
set(LAMMPS_HEADER_DIR ${LAMMPS_SOURCE_DIR} CACHE PATH "Location of LAMMPS headers")
|
||||||
|
if(NOT LAMMPS_HEADER_DIR)
|
||||||
|
message(FATAL_ERROR "Must set LAMMPS_HEADER_DIR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# by default, install into $HOME/.local (not /usr/local),
|
||||||
|
# so that no root access (and sudo) is needed
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# C++11 is required
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# bail out on windows
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||||
|
message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
include(LAMMPSInterfaceCXX)
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# building the plugins
|
||||||
|
|
||||||
|
add_library(morse2plugin MODULE morse2plugin.cpp pair_morse2.cpp pair_morse2_omp.cpp)
|
||||||
|
target_include_directories(morse2plugin PRIVATE "${LAMMPS_HEADER_DIR}/USER-OMP")
|
||||||
|
target_link_libraries(morse2plugin PRIVATE lammps)
|
||||||
|
|
||||||
|
add_library(nve2plugin MODULE nve2plugin.cpp fix_nve2.cpp)
|
||||||
|
target_link_libraries(nve2plugin PRIVATE lammps)
|
||||||
|
|
||||||
|
add_library(helloplugin MODULE helloplugin.cpp)
|
||||||
|
target_link_libraries(helloplugin PRIVATE lammps)
|
||||||
|
|
||||||
|
add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp
|
||||||
|
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
|
||||||
|
target_link_libraries(zero2plugin PRIVATE lammps)
|
||||||
|
|
||||||
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||||
|
PREFIX ""
|
||||||
|
LINK_FLAGS "-rdynamic")
|
||||||
|
|
||||||
|
# MacOS seems to need this
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
|
||||||
|
endif()
|
||||||
86
examples/plugins/LAMMPSInterfaceCXX.cmake
Normal file
86
examples/plugins/LAMMPSInterfaceCXX.cmake
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# Cmake script code to define the LAMMPS C++ interface
|
||||||
|
# settings required for building LAMMPS plugins
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# helper function
|
||||||
|
function(validate_option name values)
|
||||||
|
string(TOLOWER ${${name}} needle_lower)
|
||||||
|
string(TOUPPER ${${name}} needle_upper)
|
||||||
|
list(FIND ${values} ${needle_lower} IDX_LOWER)
|
||||||
|
list(FIND ${values} ${needle_upper} IDX_UPPER)
|
||||||
|
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
|
||||||
|
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
|
||||||
|
message(FATAL_ERROR "\n########################################################################\n"
|
||||||
|
"Invalid value '${${name}}' for option ${name}\n"
|
||||||
|
"\n"
|
||||||
|
"Possible values are:\n"
|
||||||
|
"${POSSIBLE_VALUE_LIST}"
|
||||||
|
"########################################################################")
|
||||||
|
endif()
|
||||||
|
endfunction(validate_option)
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
# LAMMPS C++ interface. We only need the header related parts.
|
||||||
|
add_library(lammps INTERFACE)
|
||||||
|
target_include_directories(lammps INTERFACE ${LAMMPS_HEADER_DIR})
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MPI configuration
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||||
|
find_package(MPI QUIET)
|
||||||
|
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||||
|
else()
|
||||||
|
option(BUILD_MPI "Build MPI version" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_MPI)
|
||||||
|
find_package(MPI REQUIRED)
|
||||||
|
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||||
|
if(LAMMPS_LONGLONG_TO_LONG)
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
|
||||||
|
else()
|
||||||
|
target_include_directories(lammps INTERFACE "${LAMMPS_SOURCE_DIR}/STUBS")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||||
|
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||||
|
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||||
|
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||||
|
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# detect if we may enable OpenMP support by default
|
||||||
|
set(BUILD_OMP_DEFAULT OFF)
|
||||||
|
find_package(OpenMP QUIET)
|
||||||
|
if(OpenMP_FOUND)
|
||||||
|
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||||
|
if(HAVE_OMP_H_INCLUDE)
|
||||||
|
set(BUILD_OMP_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
||||||
|
|
||||||
|
if(BUILD_OMP)
|
||||||
|
find_package(OpenMP REQUIRED)
|
||||||
|
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||||
|
if(NOT HAVE_OMP_H_INCLUDE)
|
||||||
|
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
|
||||||
|
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
||||||
|
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX)
|
||||||
|
endif()
|
||||||
6
examples/plugins/Makefile
Normal file
6
examples/plugins/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CXX=mpicxx
|
||||||
|
CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp
|
||||||
|
LD=$(CXX) -shared -rdynamic -fopenmp
|
||||||
|
DSOEXT=.so
|
||||||
|
|
||||||
|
include Makefile.common
|
||||||
36
examples/plugins/Makefile.common
Normal file
36
examples/plugins/Makefile.common
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
default: morse2plugin$(DSOEXT) nve2plugin$(DSOEXT) helloplugin$(DSOEXT) zero2plugin$(DSOEXT)
|
||||||
|
|
||||||
|
helloplugin$(DSOEXT): helloplugin.o
|
||||||
|
$(LD) -o $@ $^
|
||||||
|
|
||||||
|
morse2plugin$(DSOEXT): morse2plugin.o pair_morse2.o pair_morse2_omp.o
|
||||||
|
$(LD) -o $@ $^
|
||||||
|
|
||||||
|
nve2plugin$(DSOEXT): nve2plugin.o fix_nve2.o
|
||||||
|
$(LD) -o $@ $^
|
||||||
|
|
||||||
|
zero2plugin$(DSOEXT): zero2plugin.o pair_zero2.o bond_zero2.o angle_zero2.o dihedral_zero2.o improper_zero2.o
|
||||||
|
$(LD) -o $@ $^
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CXX) -o $@ $(CXXFLAGS) -c $<
|
||||||
|
|
||||||
|
helloplugin.o: helloplugin.cpp
|
||||||
|
|
||||||
|
pair_morse2.o: pair_morse2.cpp pair_morse2.h
|
||||||
|
pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h
|
||||||
|
morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h
|
||||||
|
|
||||||
|
fix_nve2.o: fix_nve2.cpp fix_nve2.h
|
||||||
|
nve2plugin.o: nve2plugin.cpp fix_nve2.h
|
||||||
|
|
||||||
|
pair_zero2.o: pair_zero2.cpp pair_zero2.h
|
||||||
|
bond_zero2.o: bond_zero2.cpp bond_zero2.h
|
||||||
|
angle_zero2.o: angle_zero2.cpp angle_zero2.h
|
||||||
|
dihedral_zero2.o: dihedral_zero2.cpp dihedral_zero2.h
|
||||||
|
improper_zero2.o: improper_zero2.cpp improper_zero2.h
|
||||||
|
zero2plugin.o: zero2plugin.cpp pair_zero2.h bond_zero2.h angle_zero2.h dihedral_zero2.h
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles
|
||||||
|
|
||||||
6
examples/plugins/Makefile.macos
Normal file
6
examples/plugins/Makefile.macos
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CXX=mpicxx
|
||||||
|
CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP
|
||||||
|
LD=$(CXX) -bundle -rdynamic -Wl,-undefined,dynamic_lookup
|
||||||
|
DSOEXT=.dylib
|
||||||
|
|
||||||
|
include Makefile.common
|
||||||
6
examples/plugins/Makefile.serial
Normal file
6
examples/plugins/Makefile.serial
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CXX=g++
|
||||||
|
CXXFLAGS=-I../../src -I../../src/STUBS -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp
|
||||||
|
LD=$(CXX) -shared -rdynamic -fopenmp
|
||||||
|
DSOEXT=.so
|
||||||
|
|
||||||
|
include Makefile.common
|
||||||
152
examples/plugins/angle_zero2.cpp
Normal file
152
examples/plugins/angle_zero2.cpp
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Carsten Svaneborg (SDU)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "angle_zero2.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "math_const.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
using namespace MathConst;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
AngleZero2::AngleZero2(LAMMPS *lmp) : Angle(lmp), coeffflag(1) {}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
AngleZero2::~AngleZero2()
|
||||||
|
{
|
||||||
|
if (allocated && !copymode) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
memory->destroy(theta0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg != 0) && (narg != 1))
|
||||||
|
error->all(FLERR,"Illegal angle_style command");
|
||||||
|
|
||||||
|
if (narg == 1) {
|
||||||
|
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||||
|
else error->all(FLERR,"Illegal angle_style command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->nangletypes;
|
||||||
|
|
||||||
|
memory->create(theta0,n+1,"angle:theta0");
|
||||||
|
memory->create(setflag,n+1,"angle:setflag");
|
||||||
|
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more types
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg < 1) || (coeffflag && narg > 2))
|
||||||
|
error->all(FLERR,"Incorrect args for angle coefficients");
|
||||||
|
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error);
|
||||||
|
|
||||||
|
double theta0_one = 0.0;
|
||||||
|
if (coeffflag && (narg == 2))
|
||||||
|
theta0_one = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
|
|
||||||
|
// convert theta0 from degrees to radians
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
setflag[i] = 1;
|
||||||
|
theta0[i] = theta0_one/180.0 * MY_PI;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for angle coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double AngleZero2::equilibrium_angle(int i)
|
||||||
|
{
|
||||||
|
return theta0[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes out coeffs to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::write_restart(FILE *fp) {
|
||||||
|
fwrite(&theta0[1],sizeof(double),atom->nangletypes,fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads coeffs from restart file, bcasts them
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::read_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
|
||||||
|
if (comm->me == 0) {
|
||||||
|
utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world);
|
||||||
|
|
||||||
|
for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1;
|
||||||
|
}
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AngleZero2::write_data(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->nangletypes; i++)
|
||||||
|
fprintf(fp,"%d %g\n",i,theta0[i]/MY_PI*180.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double AngleZero2::single(int /*type*/, int /*i1*/, int /*i2*/, int /*i3*/)
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
57
examples/plugins/angle_zero2.h
Normal file
57
examples/plugins/angle_zero2.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_ANGLE_ZERO2_H
|
||||||
|
#define LMP_ANGLE_ZERO2_H
|
||||||
|
|
||||||
|
#include "angle.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class AngleZero2 : public Angle {
|
||||||
|
public:
|
||||||
|
AngleZero2(class LAMMPS *);
|
||||||
|
virtual ~AngleZero2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual void coeff(int, char **);
|
||||||
|
virtual void settings(int, char **);
|
||||||
|
|
||||||
|
double equilibrium_angle(int);
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
|
||||||
|
double single(int, int, int, int);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double *theta0;
|
||||||
|
int coeffflag;
|
||||||
|
|
||||||
|
void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
UNDOCUMENTED
|
||||||
|
|
||||||
|
E: Incorrect args for angle coefficients
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
|
*/
|
||||||
161
examples/plugins/bond_zero2.cpp
Normal file
161
examples/plugins/bond_zero2.cpp
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Carsten Svaneborg (SDU)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "bond_zero2.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
BondZero2::BondZero2(LAMMPS *lmp) : Bond(lmp), coeffflag(1) {}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
BondZero2::~BondZero2()
|
||||||
|
{
|
||||||
|
if (allocated && !copymode) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
memory->destroy(r0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg != 0) && (narg != 1))
|
||||||
|
error->all(FLERR,"Illegal bond_style command");
|
||||||
|
|
||||||
|
if (narg == 1) {
|
||||||
|
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||||
|
else error->all(FLERR,"Illegal bond_style command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->nbondtypes;
|
||||||
|
|
||||||
|
memory->create(r0,n+1,"bond:r0");
|
||||||
|
memory->create(setflag,n+1,"bond:setflag");
|
||||||
|
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more types
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg < 1) || (coeffflag && narg > 2))
|
||||||
|
error->all(FLERR,"Incorrect args for bond coefficients");
|
||||||
|
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error);
|
||||||
|
|
||||||
|
double r0_one = 0.0;
|
||||||
|
if (coeffflag && (narg == 2))
|
||||||
|
r0_one = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
setflag[i] = 1;
|
||||||
|
r0[i] = r0_one;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for bond coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
return an equilbrium bond length
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double BondZero2::equilibrium_distance(int i)
|
||||||
|
{
|
||||||
|
return r0[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes out coeffs to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::write_restart(FILE *fp) {
|
||||||
|
fwrite(&r0[1],sizeof(double),atom->nbondtypes,fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads coeffs from restart file, bcasts them
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::read_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
|
||||||
|
if (comm->me == 0) {
|
||||||
|
utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world);
|
||||||
|
|
||||||
|
for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void BondZero2::write_data(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->nbondtypes; i++)
|
||||||
|
fprintf(fp,"%d %g\n",i,r0[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double BondZero2::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/,
|
||||||
|
double & /*fforce*/)
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void *BondZero2::extract(const char *str, int &dim)
|
||||||
|
{
|
||||||
|
dim = 1;
|
||||||
|
if (strcmp(str,"r0")==0) return (void*) r0;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
58
examples/plugins/bond_zero2.h
Normal file
58
examples/plugins/bond_zero2.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_BOND_ZERO2_H
|
||||||
|
#define LMP_BOND_ZERO2_H
|
||||||
|
|
||||||
|
#include "bond.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class BondZero2 : public Bond {
|
||||||
|
public:
|
||||||
|
BondZero2(class LAMMPS *);
|
||||||
|
virtual ~BondZero2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual void settings(int, char **);
|
||||||
|
|
||||||
|
void coeff(int, char **);
|
||||||
|
double equilibrium_distance(int);
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
|
||||||
|
double single(int, double, int, int, double &);
|
||||||
|
virtual void *extract(const char *, int &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double *r0;
|
||||||
|
int coeffflag;
|
||||||
|
|
||||||
|
virtual void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
UNDOCUMENTED
|
||||||
|
|
||||||
|
E: Incorrect args for bond coefficients
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
|
*/
|
||||||
121
examples/plugins/dihedral_zero2.cpp
Normal file
121
examples/plugins/dihedral_zero2.cpp
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Carsten Svaneborg (SDU)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "dihedral_zero2.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
DihedralZero2::DihedralZero2(LAMMPS *lmp) : Dihedral(lmp), coeffflag(1)
|
||||||
|
{
|
||||||
|
writedata = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
DihedralZero2::~DihedralZero2()
|
||||||
|
{
|
||||||
|
if (allocated && !copymode) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg != 0) && (narg != 1))
|
||||||
|
error->all(FLERR,"Illegal dihedral_style command");
|
||||||
|
|
||||||
|
if (narg == 1) {
|
||||||
|
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||||
|
else error->all(FLERR,"Illegal dihedral_style command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->ndihedraltypes;
|
||||||
|
|
||||||
|
memory->create(setflag,n+1,"dihedral:setflag");
|
||||||
|
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more types
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg < 1) || (coeffflag && narg > 1))
|
||||||
|
error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||||
|
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
setflag[i] = 1;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes out coeffs to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::write_restart(FILE * /*fp*/) {}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads coeffs from restart file, bcasts them
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::read_restart(FILE * /*fp*/)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DihedralZero2::write_data(FILE *fp) {
|
||||||
|
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||||
|
fprintf(fp,"%d\n",i);
|
||||||
|
}
|
||||||
57
examples/plugins/dihedral_zero2.h
Normal file
57
examples/plugins/dihedral_zero2.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
|
||||||
|
Identical to dihedral harmonic, except if all k's are zero the
|
||||||
|
force loop is skipped.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_DIHEDRAL_ZERO2_H
|
||||||
|
#define LMP_DIHEDRAL_ZERO2_H
|
||||||
|
|
||||||
|
#include "dihedral.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class DihedralZero2 : public Dihedral {
|
||||||
|
public:
|
||||||
|
DihedralZero2(class LAMMPS *);
|
||||||
|
virtual ~DihedralZero2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual void coeff(int, char **);
|
||||||
|
virtual void settings(int, char **);
|
||||||
|
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int coeffflag;
|
||||||
|
|
||||||
|
virtual void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
UNDOCUMENTED
|
||||||
|
|
||||||
|
E: Incorrect args for dihedral coefficients
|
||||||
|
|
||||||
|
UNDOCUMENTED
|
||||||
|
|
||||||
|
*/
|
||||||
171
examples/plugins/fix_nve2.cpp
Normal file
171
examples/plugins/fix_nve2.cpp
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "fix_nve2.h"
|
||||||
|
#include <cstring>
|
||||||
|
#include "atom.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "update.h"
|
||||||
|
#include "respa.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
using namespace FixConst;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
FixNVE2::FixNVE2(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Fix(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
if (strcmp(style,"nve/sphere") != 0 && narg < 3)
|
||||||
|
error->all(FLERR,"Illegal fix nve command");
|
||||||
|
|
||||||
|
dynamic_group_allow = 1;
|
||||||
|
time_integrate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int FixNVE2::setmask()
|
||||||
|
{
|
||||||
|
int mask = 0;
|
||||||
|
mask |= INITIAL_INTEGRATE;
|
||||||
|
mask |= FINAL_INTEGRATE;
|
||||||
|
mask |= INITIAL_INTEGRATE_RESPA;
|
||||||
|
mask |= FINAL_INTEGRATE_RESPA;
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::init()
|
||||||
|
{
|
||||||
|
dtv = update->dt;
|
||||||
|
dtf = 0.5 * update->dt * force->ftm2v;
|
||||||
|
|
||||||
|
if (strstr(update->integrate_style,"respa"))
|
||||||
|
step_respa = ((Respa *) update->integrate)->step;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
allow for both per-type and per-atom mass
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::initial_integrate(int /*vflag*/)
|
||||||
|
{
|
||||||
|
double dtfm;
|
||||||
|
|
||||||
|
// update v and x of atoms in group
|
||||||
|
|
||||||
|
double **x = atom->x;
|
||||||
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
if (rmass) {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / rmass[i];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
x[i][0] += dtv * v[i][0];
|
||||||
|
x[i][1] += dtv * v[i][1];
|
||||||
|
x[i][2] += dtv * v[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / mass[type[i]];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
x[i][0] += dtv * v[i][0];
|
||||||
|
x[i][1] += dtv * v[i][1];
|
||||||
|
x[i][2] += dtv * v[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::final_integrate()
|
||||||
|
{
|
||||||
|
double dtfm;
|
||||||
|
|
||||||
|
// update v of atoms in group
|
||||||
|
|
||||||
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
if (rmass) {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / rmass[i];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / mass[type[i]];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::initial_integrate_respa(int vflag, int ilevel, int /*iloop*/)
|
||||||
|
{
|
||||||
|
dtv = step_respa[ilevel];
|
||||||
|
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||||
|
|
||||||
|
// innermost level - NVE update of v and x
|
||||||
|
// all other levels - NVE update of v
|
||||||
|
|
||||||
|
if (ilevel == 0) initial_integrate(vflag);
|
||||||
|
else final_integrate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::final_integrate_respa(int ilevel, int /*iloop*/)
|
||||||
|
{
|
||||||
|
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||||
|
final_integrate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVE2::reset_dt()
|
||||||
|
{
|
||||||
|
dtv = update->dt;
|
||||||
|
dtf = 0.5 * update->dt * force->ftm2v;
|
||||||
|
}
|
||||||
58
examples/plugins/fix_nve2.h
Normal file
58
examples/plugins/fix_nve2.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
|
FixStyle(nve2,FixNVE2)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_FIX_NVE2_H
|
||||||
|
#define LMP_FIX_NVE2_H
|
||||||
|
|
||||||
|
#include "fix.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class FixNVE2 : public Fix {
|
||||||
|
public:
|
||||||
|
FixNVE2(class LAMMPS *, int, char **);
|
||||||
|
virtual ~FixNVE2() {}
|
||||||
|
int setmask();
|
||||||
|
virtual void init();
|
||||||
|
virtual void initial_integrate(int);
|
||||||
|
virtual void final_integrate();
|
||||||
|
virtual void initial_integrate_respa(int, int, int);
|
||||||
|
virtual void final_integrate_respa(int, int);
|
||||||
|
virtual void reset_dt();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double dtv,dtf;
|
||||||
|
double *step_respa;
|
||||||
|
int mass_require;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script syntax and compare to the
|
||||||
|
documentation for the command. You can use -echo screen as a
|
||||||
|
command-line option when running LAMMPS to see the offending line.
|
||||||
|
|
||||||
|
*/
|
||||||
47
examples/plugins/helloplugin.cpp
Normal file
47
examples/plugins/helloplugin.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
|
||||||
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "pointers.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
class Hello : protected Pointers {
|
||||||
|
public:
|
||||||
|
Hello(class LAMMPS *lmp) : Pointers(lmp) {};
|
||||||
|
void command(int, char **);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
void Hello::command(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc != 1) error->all(FLERR,"Illegal hello command");
|
||||||
|
if (comm->me == 0)
|
||||||
|
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hellocreator(LAMMPS *lmp, int argc, char **argv)
|
||||||
|
{
|
||||||
|
Hello hello(lmp);
|
||||||
|
hello.command(argc,argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "command";
|
||||||
|
plugin.name = "hello";
|
||||||
|
plugin.info = "Hello world command v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
122
examples/plugins/improper_zero2.cpp
Normal file
122
examples/plugins/improper_zero2.cpp
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Carsten Svaneborg (SDU)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "improper_zero2.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ImproperZero2::ImproperZero2(LAMMPS *lmp) : Improper(lmp), coeffflag(1)
|
||||||
|
{
|
||||||
|
writedata = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ImproperZero2::~ImproperZero2()
|
||||||
|
{
|
||||||
|
if (allocated && !copymode) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg != 0) && (narg != 1))
|
||||||
|
error->all(FLERR,"Illegal improper_style command");
|
||||||
|
|
||||||
|
if (narg == 1) {
|
||||||
|
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||||
|
else error->all(FLERR,"Illegal improper_style command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->nimpropertypes;
|
||||||
|
|
||||||
|
memory->create(setflag,n+1,"improper:setflag");
|
||||||
|
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more types
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg < 1) || (coeffflag && narg > 1))
|
||||||
|
error->all(FLERR,"Incorrect args for improper coefficients");
|
||||||
|
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
setflag[i] = 1;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for improper coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes out coeffs to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::write_restart(FILE * /*fp*/) {}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads coeffs from restart file, bcasts them
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::read_restart(FILE * /*fp*/)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ImproperZero2::write_data(FILE *fp) {
|
||||||
|
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||||
|
fprintf(fp,"%d\n",i);
|
||||||
|
}
|
||||||
|
|
||||||
53
examples/plugins/improper_zero2.h
Normal file
53
examples/plugins/improper_zero2.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_IMPROPER_ZERO2_H
|
||||||
|
#define LMP_IMPROPER_ZERO2_H
|
||||||
|
|
||||||
|
#include "improper.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class ImproperZero2 : public Improper {
|
||||||
|
public:
|
||||||
|
ImproperZero2(class LAMMPS *);
|
||||||
|
virtual ~ImproperZero2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual void coeff(int, char **);
|
||||||
|
virtual void settings(int, char **);
|
||||||
|
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int coeffflag;
|
||||||
|
|
||||||
|
virtual void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
UNDOCUMENTED
|
||||||
|
|
||||||
|
E: Incorrect args for improper coefficients
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
|
*/
|
||||||
43
examples/plugins/morse2plugin.cpp
Normal file
43
examples/plugins/morse2plugin.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "pair_morse2.h"
|
||||||
|
#include "pair_morse2_omp.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static Pair *morse2creator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new PairMorse2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Pair *morse2ompcreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new PairMorse2OMP(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
|
||||||
|
// register plain morse2 pair style
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "pair";
|
||||||
|
plugin.name = "morse2";
|
||||||
|
plugin.info = "Morse2 variant pair style v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
|
||||||
|
// also register morse2/omp pair style. only need to update changed fields
|
||||||
|
plugin.name = "morse2/omp";
|
||||||
|
plugin.info = "Morse2 variant pair style for OpenMP v1.0";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2ompcreator;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
30
examples/plugins/nve2plugin.cpp
Normal file
30
examples/plugins/nve2plugin.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "fix_nve2.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv)
|
||||||
|
{
|
||||||
|
return new FixNVE2(lmp, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "fix";
|
||||||
|
plugin.name = "nve2";
|
||||||
|
plugin.info = "NVE2 variant fix style v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
359
examples/plugins/pair_morse2.cpp
Normal file
359
examples/plugins/pair_morse2.cpp
Normal file
@ -0,0 +1,359 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "pair_morse2.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
PairMorse2::PairMorse2(LAMMPS *lmp) : Pair(lmp)
|
||||||
|
{
|
||||||
|
writedata = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
PairMorse2::~PairMorse2()
|
||||||
|
{
|
||||||
|
if (allocated) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
memory->destroy(cutsq);
|
||||||
|
|
||||||
|
memory->destroy(cut);
|
||||||
|
memory->destroy(d0);
|
||||||
|
memory->destroy(alpha);
|
||||||
|
memory->destroy(r0);
|
||||||
|
memory->destroy(morse1);
|
||||||
|
memory->destroy(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||||
|
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||||
|
double rsq,r,dr,dexp,factor_lj;
|
||||||
|
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||||
|
|
||||||
|
evdwl = 0.0;
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
|
||||||
|
double **x = atom->x;
|
||||||
|
double **f = atom->f;
|
||||||
|
int *type = atom->type;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
double *special_lj = force->special_lj;
|
||||||
|
int newton_pair = force->newton_pair;
|
||||||
|
|
||||||
|
inum = list->inum;
|
||||||
|
ilist = list->ilist;
|
||||||
|
numneigh = list->numneigh;
|
||||||
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
|
// loop over neighbors of my atoms
|
||||||
|
|
||||||
|
for (ii = 0; ii < inum; ii++) {
|
||||||
|
i = ilist[ii];
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
itype = type[i];
|
||||||
|
jlist = firstneigh[i];
|
||||||
|
jnum = numneigh[i];
|
||||||
|
|
||||||
|
for (jj = 0; jj < jnum; jj++) {
|
||||||
|
j = jlist[jj];
|
||||||
|
factor_lj = special_lj[sbmask(j)];
|
||||||
|
j &= NEIGHMASK;
|
||||||
|
|
||||||
|
delx = xtmp - x[j][0];
|
||||||
|
dely = ytmp - x[j][1];
|
||||||
|
delz = ztmp - x[j][2];
|
||||||
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
jtype = type[j];
|
||||||
|
|
||||||
|
if (rsq < cutsq[itype][jtype]) {
|
||||||
|
r = sqrt(rsq);
|
||||||
|
dr = r - r0[itype][jtype];
|
||||||
|
dexp = exp(-alpha[itype][jtype] * dr);
|
||||||
|
fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||||
|
|
||||||
|
f[i][0] += delx*fpair;
|
||||||
|
f[i][1] += dely*fpair;
|
||||||
|
f[i][2] += delz*fpair;
|
||||||
|
if (newton_pair || j < nlocal) {
|
||||||
|
f[j][0] -= delx*fpair;
|
||||||
|
f[j][1] -= dely*fpair;
|
||||||
|
f[j][2] -= delz*fpair;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eflag) {
|
||||||
|
evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) -
|
||||||
|
offset[itype][jtype];
|
||||||
|
evdwl *= factor_lj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||||
|
evdwl,0.0,fpair,delx,dely,delz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vflag_fdotr) virial_fdotr_compute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
allocate all arrays
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->ntypes;
|
||||||
|
|
||||||
|
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||||
|
for (int i = 1; i <= n; i++)
|
||||||
|
for (int j = i; j <= n; j++)
|
||||||
|
setflag[i][j] = 0;
|
||||||
|
|
||||||
|
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||||
|
|
||||||
|
memory->create(cut,n+1,n+1,"pair:cut");
|
||||||
|
memory->create(d0,n+1,n+1,"pair:d0");
|
||||||
|
memory->create(alpha,n+1,n+1,"pair:alpha");
|
||||||
|
memory->create(r0,n+1,n+1,"pair:r0");
|
||||||
|
memory->create(morse1,n+1,n+1,"pair:morse1");
|
||||||
|
memory->create(offset,n+1,n+1,"pair:offset");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
global settings
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (narg != 1) error->all(FLERR,"Illegal pair_style command");
|
||||||
|
|
||||||
|
cut_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||||
|
|
||||||
|
// reset cutoffs that have been explicitly set
|
||||||
|
|
||||||
|
if (allocated) {
|
||||||
|
int i,j;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i; j <= atom->ntypes; j++)
|
||||||
|
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more type pairs
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (narg < 5 || narg > 6)
|
||||||
|
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi,jlo,jhi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||||
|
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||||
|
|
||||||
|
double d0_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||||
|
double alpha_one = utils::numeric(FLERR,arg[3],false,lmp);
|
||||||
|
double r0_one = utils::numeric(FLERR,arg[4],false,lmp);
|
||||||
|
|
||||||
|
double cut_one = cut_global;
|
||||||
|
if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||||
|
d0[i][j] = d0_one;
|
||||||
|
alpha[i][j] = alpha_one;
|
||||||
|
r0[i][j] = r0_one;
|
||||||
|
cut[i][j] = cut_one;
|
||||||
|
setflag[i][j] = 1;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
init for one type pair i,j and corresponding j,i
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double PairMorse2::init_one(int i, int j)
|
||||||
|
{
|
||||||
|
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||||
|
|
||||||
|
morse1[i][j] = 2.0*d0[i][j]*alpha[i][j];
|
||||||
|
|
||||||
|
if (offset_flag) {
|
||||||
|
double alpha_dr = -alpha[i][j] * (cut[i][j] - r0[i][j]);
|
||||||
|
offset[i][j] = d0[i][j] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr));
|
||||||
|
} else offset[i][j] = 0.0;
|
||||||
|
|
||||||
|
d0[j][i] = d0[i][j];
|
||||||
|
alpha[j][i] = alpha[i][j];
|
||||||
|
r0[j][i] = r0[i][j];
|
||||||
|
morse1[j][i] = morse1[i][j];
|
||||||
|
offset[j][i] = offset[i][j];
|
||||||
|
|
||||||
|
return cut[i][j];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::write_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
write_restart_settings(fp);
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i; j <= atom->ntypes; j++) {
|
||||||
|
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||||
|
if (setflag[i][j]) {
|
||||||
|
fwrite(&d0[i][j],sizeof(double),1,fp);
|
||||||
|
fwrite(&alpha[i][j],sizeof(double),1,fp);
|
||||||
|
fwrite(&r0[i][j],sizeof(double),1,fp);
|
||||||
|
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads from restart file, bcasts
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::read_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
read_restart_settings(fp);
|
||||||
|
|
||||||
|
allocate();
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
int me = comm->me;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i; j <= atom->ntypes; j++) {
|
||||||
|
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||||
|
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||||
|
if (setflag[i][j]) {
|
||||||
|
if (me == 0) {
|
||||||
|
utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world);
|
||||||
|
MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world);
|
||||||
|
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
|
||||||
|
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::write_restart_settings(FILE *fp)
|
||||||
|
{
|
||||||
|
fwrite(&cut_global,sizeof(double),1,fp);
|
||||||
|
fwrite(&offset_flag,sizeof(int),1,fp);
|
||||||
|
fwrite(&mix_flag,sizeof(int),1,fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads from restart file, bcasts
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::read_restart_settings(FILE *fp)
|
||||||
|
{
|
||||||
|
if (comm->me == 0) {
|
||||||
|
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||||
|
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
|
||||||
|
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::write_data(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++)
|
||||||
|
fprintf(fp,"%d %g %g %g\n",i,d0[i][i],alpha[i][i],r0[i][i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes all pairs to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2::write_data_all(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (int j = i; j <= atom->ntypes; j++)
|
||||||
|
fprintf(fp,"%d %d %g %g %g %g\n",
|
||||||
|
i,j,d0[i][j],alpha[i][j],r0[i][j],cut[i][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double PairMorse2::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
|
||||||
|
double /*factor_coul*/, double factor_lj,
|
||||||
|
double &fforce)
|
||||||
|
{
|
||||||
|
double r,dr,dexp,phi;
|
||||||
|
|
||||||
|
r = sqrt(rsq);
|
||||||
|
dr = r - r0[itype][jtype];
|
||||||
|
dexp = exp(-alpha[itype][jtype] * dr);
|
||||||
|
fforce = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||||
|
|
||||||
|
phi = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - offset[itype][jtype];
|
||||||
|
return factor_lj*phi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void *PairMorse2::extract(const char *str, int &dim)
|
||||||
|
{
|
||||||
|
dim = 2;
|
||||||
|
if (strcmp(str,"d0") == 0) return (void *) d0;
|
||||||
|
if (strcmp(str,"r0") == 0) return (void *) r0;
|
||||||
|
if (strcmp(str,"alpha") == 0) return (void *) alpha;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
70
examples/plugins/pair_morse2.h
Normal file
70
examples/plugins/pair_morse2.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_PAIR_MORSE2_H
|
||||||
|
#define LMP_PAIR_MORSE2_H
|
||||||
|
|
||||||
|
#include "pair.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class PairMorse2 : public Pair {
|
||||||
|
public:
|
||||||
|
PairMorse2(class LAMMPS *);
|
||||||
|
virtual ~PairMorse2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
|
||||||
|
void settings(int, char **);
|
||||||
|
void coeff(int, char **);
|
||||||
|
double init_one(int, int);
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_restart_settings(FILE *);
|
||||||
|
void read_restart_settings(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
void write_data_all(FILE *);
|
||||||
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
|
void *extract(const char *, int &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double cut_global;
|
||||||
|
double **cut;
|
||||||
|
double **d0,**alpha,**r0;
|
||||||
|
double **morse1;
|
||||||
|
double **offset;
|
||||||
|
|
||||||
|
virtual void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script syntax and compare to the
|
||||||
|
documentation for the command. You can use -echo screen as a
|
||||||
|
command-line option when running LAMMPS to see the offending line.
|
||||||
|
|
||||||
|
E: Incorrect args for pair coefficients
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
|
E: All pair coeffs are not set
|
||||||
|
|
||||||
|
All pair coefficients must be set in the data file or by the
|
||||||
|
pair_coeff command before running a simulation.
|
||||||
|
|
||||||
|
*/
|
||||||
160
examples/plugins/pair_morse2_omp.cpp
Normal file
160
examples/plugins/pair_morse2_omp.cpp
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
This software is distributed under the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Axel Kohlmeyer (Temple U)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "pair_morse2_omp.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
#include "suffix.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "omp_compat.h"
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
PairMorse2OMP::PairMorse2OMP(LAMMPS *lmp) :
|
||||||
|
PairMorse2(lmp), ThrOMP(lmp, THR_PAIR)
|
||||||
|
{
|
||||||
|
suffix_flag |= Suffix::OMP;
|
||||||
|
respa_enable = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairMorse2OMP::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
|
||||||
|
const int nall = atom->nlocal + atom->nghost;
|
||||||
|
const int nthreads = comm->nthreads;
|
||||||
|
const int inum = list->inum;
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int ifrom, ito, tid;
|
||||||
|
|
||||||
|
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||||
|
ThrData *thr = fix->get_thr(tid);
|
||||||
|
thr->timer(Timer::START);
|
||||||
|
ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr);
|
||||||
|
|
||||||
|
if (evflag) {
|
||||||
|
if (eflag) {
|
||||||
|
if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr);
|
||||||
|
else eval<1,1,0>(ifrom, ito, thr);
|
||||||
|
} else {
|
||||||
|
if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr);
|
||||||
|
else eval<1,0,0>(ifrom, ito, thr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr);
|
||||||
|
else eval<0,0,0>(ifrom, ito, thr);
|
||||||
|
}
|
||||||
|
|
||||||
|
thr->timer(Timer::PAIR);
|
||||||
|
reduce_thr(this, eflag, vflag, thr);
|
||||||
|
} // end of omp parallel region
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||||
|
void PairMorse2OMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||||
|
{
|
||||||
|
int i,j,ii,jj,jnum,itype,jtype;
|
||||||
|
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||||
|
double rsq,r,dr,dexp,factor_lj;
|
||||||
|
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||||
|
|
||||||
|
evdwl = 0.0;
|
||||||
|
|
||||||
|
const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
|
||||||
|
dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0];
|
||||||
|
const int * _noalias const type = atom->type;
|
||||||
|
const int nlocal = atom->nlocal;
|
||||||
|
const double * _noalias const special_lj = force->special_lj;
|
||||||
|
double fxtmp,fytmp,fztmp;
|
||||||
|
|
||||||
|
ilist = list->ilist;
|
||||||
|
numneigh = list->numneigh;
|
||||||
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
|
// loop over neighbors of my atoms
|
||||||
|
|
||||||
|
for (ii = iifrom; ii < iito; ++ii) {
|
||||||
|
|
||||||
|
i = ilist[ii];
|
||||||
|
xtmp = x[i].x;
|
||||||
|
ytmp = x[i].y;
|
||||||
|
ztmp = x[i].z;
|
||||||
|
itype = type[i];
|
||||||
|
jlist = firstneigh[i];
|
||||||
|
jnum = numneigh[i];
|
||||||
|
fxtmp=fytmp=fztmp=0.0;
|
||||||
|
|
||||||
|
for (jj = 0; jj < jnum; jj++) {
|
||||||
|
j = jlist[jj];
|
||||||
|
factor_lj = special_lj[sbmask(j)];
|
||||||
|
j &= NEIGHMASK;
|
||||||
|
|
||||||
|
delx = xtmp - x[j].x;
|
||||||
|
dely = ytmp - x[j].y;
|
||||||
|
delz = ztmp - x[j].z;
|
||||||
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
jtype = type[j];
|
||||||
|
|
||||||
|
if (rsq < cutsq[itype][jtype]) {
|
||||||
|
r = sqrt(rsq);
|
||||||
|
dr = r - r0[itype][jtype];
|
||||||
|
dexp = exp(-alpha[itype][jtype] * dr);
|
||||||
|
fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||||
|
|
||||||
|
fxtmp += delx*fpair;
|
||||||
|
fytmp += dely*fpair;
|
||||||
|
fztmp += delz*fpair;
|
||||||
|
if (NEWTON_PAIR || j < nlocal) {
|
||||||
|
f[j].x -= delx*fpair;
|
||||||
|
f[j].y -= dely*fpair;
|
||||||
|
f[j].z -= delz*fpair;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFLAG) {
|
||||||
|
evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) -
|
||||||
|
offset[itype][jtype];
|
||||||
|
evdwl *= factor_lj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR,
|
||||||
|
evdwl,0.0,fpair,delx,dely,delz,thr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f[i].x += fxtmp;
|
||||||
|
f[i].y += fytmp;
|
||||||
|
f[i].z += fztmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double PairMorse2OMP::memory_usage()
|
||||||
|
{
|
||||||
|
double bytes = memory_usage_thr();
|
||||||
|
bytes += PairMorse2::memory_usage();
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
41
examples/plugins/pair_morse2_omp.h
Normal file
41
examples/plugins/pair_morse2_omp.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Axel Kohlmeyer (Temple U)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_PAIR_MORSE2_OMP_H
|
||||||
|
#define LMP_PAIR_MORSE2_OMP_H
|
||||||
|
|
||||||
|
#include "pair_morse2.h"
|
||||||
|
#include "thr_omp.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class PairMorse2OMP : public PairMorse2, public ThrOMP {
|
||||||
|
|
||||||
|
public:
|
||||||
|
PairMorse2OMP(class LAMMPS *);
|
||||||
|
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual double memory_usage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||||
|
void eval(int ifrom, int ito, ThrData * const thr);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
247
examples/plugins/pair_zero2.cpp
Normal file
247
examples/plugins/pair_zero2.cpp
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Carsten Svaneborg (SDU)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "pair_zero2.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
PairZero2::PairZero2(LAMMPS *lmp) : Pair(lmp) {
|
||||||
|
coeffflag=1;
|
||||||
|
writedata=1;
|
||||||
|
single_enable=1;
|
||||||
|
respa_enable=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
PairZero2::~PairZero2()
|
||||||
|
{
|
||||||
|
if (allocated) {
|
||||||
|
memory->destroy(setflag);
|
||||||
|
memory->destroy(cutsq);
|
||||||
|
memory->destroy(cut);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::compute(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
if (vflag_fdotr) virial_fdotr_compute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::compute_outer(int eflag, int vflag)
|
||||||
|
{
|
||||||
|
ev_init(eflag,vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
allocate all arrays
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::allocate()
|
||||||
|
{
|
||||||
|
allocated = 1;
|
||||||
|
int n = atom->ntypes;
|
||||||
|
|
||||||
|
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||||
|
for (int i = 1; i <= n; i++)
|
||||||
|
for (int j = i; j <= n; j++)
|
||||||
|
setflag[i][j] = 0;
|
||||||
|
|
||||||
|
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||||
|
memory->create(cut,n+1,n+1,"pair:cut");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
global settings
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::settings(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg != 1) && (narg != 2))
|
||||||
|
error->all(FLERR,"Illegal pair_style command");
|
||||||
|
|
||||||
|
cut_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||||
|
if (narg == 2) {
|
||||||
|
if (strcmp("nocoeff",arg[1]) == 0) coeffflag=0;
|
||||||
|
else error->all(FLERR,"Illegal pair_style command");
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset cutoffs that have been explicitly set
|
||||||
|
|
||||||
|
if (allocated) {
|
||||||
|
int i,j;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i+1; j <= atom->ntypes; j++)
|
||||||
|
cut[i][j] = cut_global;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set coeffs for one or more type pairs
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::coeff(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if ((narg < 2) || (coeffflag && narg > 3))
|
||||||
|
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
|
||||||
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
int ilo,ihi,jlo,jhi;
|
||||||
|
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||||
|
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||||
|
|
||||||
|
double cut_one = cut_global;
|
||||||
|
if (coeffflag && (narg == 3)) cut_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
|
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||||
|
cut[i][j] = cut_one;
|
||||||
|
setflag[i][j] = 1;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
init for one type pair i,j and corresponding j,i
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double PairZero2::init_one(int i, int j)
|
||||||
|
{
|
||||||
|
if (setflag[i][j] == 0) {
|
||||||
|
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cut[i][j];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::write_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
write_restart_settings(fp);
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i; j <= atom->ntypes; j++) {
|
||||||
|
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||||
|
if (setflag[i][j]) {
|
||||||
|
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads from restart file, bcasts
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::read_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
read_restart_settings(fp);
|
||||||
|
allocate();
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
int me = comm->me;
|
||||||
|
for (i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (j = i; j <= atom->ntypes; j++) {
|
||||||
|
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||||
|
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||||
|
if (setflag[i][j]) {
|
||||||
|
if (me == 0) {
|
||||||
|
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::write_restart_settings(FILE *fp)
|
||||||
|
{
|
||||||
|
fwrite(&cut_global,sizeof(double),1,fp);
|
||||||
|
fwrite(&coeffflag,sizeof(int),1,fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 reads from restart file, bcasts
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::read_restart_settings(FILE *fp)
|
||||||
|
{
|
||||||
|
int me = comm->me;
|
||||||
|
if (me == 0) {
|
||||||
|
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||||
|
utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error);
|
||||||
|
}
|
||||||
|
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||||
|
MPI_Bcast(&coeffflag,1,MPI_INT,0,world);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::write_data(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++)
|
||||||
|
fprintf(fp,"%d\n",i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
proc 0 writes all pairs to data file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void PairZero2::write_data_all(FILE *fp)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++)
|
||||||
|
for (int j = i; j <= atom->ntypes; j++)
|
||||||
|
fprintf(fp,"%d %d %g\n",i,j,cut[i][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double PairZero2::single(int /*i*/, int /*j*/, int /* itype */, int /* jtype */,
|
||||||
|
double /* rsq */, double /*factor_coul*/,
|
||||||
|
double /* factor_lj */, double &fforce)
|
||||||
|
{
|
||||||
|
fforce = 0.0;
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
77
examples/plugins/pair_zero2.h
Normal file
77
examples/plugins/pair_zero2.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
|
||||||
|
Pair zero is a dummy pair interaction useful for requiring a
|
||||||
|
force cutoff distance in the absence of pair-interactions or
|
||||||
|
with hybrid/overlay if a larger force cutoff distance is required.
|
||||||
|
|
||||||
|
This can be used in conjunction with bond/create to create bonds
|
||||||
|
that are longer than the cutoff of a given force field, or to
|
||||||
|
calculate radial distribution functions for models without
|
||||||
|
pair interactions.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_PAIR_ZERO2_H
|
||||||
|
#define LMP_PAIR_ZERO2_H
|
||||||
|
|
||||||
|
#include "pair.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class PairZero2 : public Pair {
|
||||||
|
public:
|
||||||
|
PairZero2(class LAMMPS *);
|
||||||
|
virtual ~PairZero2();
|
||||||
|
virtual void compute(int, int);
|
||||||
|
virtual void compute_outer(int, int);
|
||||||
|
void settings(int, char **);
|
||||||
|
void coeff(int, char **);
|
||||||
|
double init_one(int, int);
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void read_restart(FILE *);
|
||||||
|
void write_restart_settings(FILE *);
|
||||||
|
void read_restart_settings(FILE *);
|
||||||
|
void write_data(FILE *);
|
||||||
|
void write_data_all(FILE *);
|
||||||
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double cut_global;
|
||||||
|
double **cut;
|
||||||
|
int coeffflag;
|
||||||
|
|
||||||
|
virtual void allocate();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script syntax and compare to the
|
||||||
|
documentation for the command. You can use -echo screen as a
|
||||||
|
command-line option when running LAMMPS to see the offending line.
|
||||||
|
|
||||||
|
E: Incorrect args for pair coefficients
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
|
U: Pair cutoff < Respa interior cutoff
|
||||||
|
|
||||||
|
One or more pairwise cutoffs are too short to use with the specified
|
||||||
|
rRESPA cutoffs.
|
||||||
|
|
||||||
|
*/
|
||||||
78
examples/plugins/zero2plugin.cpp
Normal file
78
examples/plugins/zero2plugin.cpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
#include "lammpsplugin.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "pair_zero2.h"
|
||||||
|
#include "bond_zero2.h"
|
||||||
|
#include "angle_zero2.h"
|
||||||
|
#include "dihedral_zero2.h"
|
||||||
|
#include "improper_zero2.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static Pair *pairzerocreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new PairZero2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bond *bondzerocreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new BondZero2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Angle *anglezerocreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new AngleZero2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Dihedral *dihedralzerocreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new DihedralZero2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Improper *improperzerocreator(LAMMPS *lmp)
|
||||||
|
{
|
||||||
|
return new ImproperZero2(lmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||||
|
{
|
||||||
|
lammpsplugin_t plugin;
|
||||||
|
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||||
|
|
||||||
|
// register zero2 pair style
|
||||||
|
plugin.version = LAMMPS_VERSION;
|
||||||
|
plugin.style = "pair";
|
||||||
|
plugin.name = "zero2";
|
||||||
|
plugin.info = "Zero2 variant pair style v1.0";
|
||||||
|
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &pairzerocreator;
|
||||||
|
plugin.handle = handle;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
|
||||||
|
// register zero2 bond style
|
||||||
|
plugin.style = "bond";
|
||||||
|
plugin.info = "Zero2 variant bond style v1.0";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &bondzerocreator;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
|
||||||
|
// register zero2 angle style
|
||||||
|
plugin.style = "angle";
|
||||||
|
plugin.info = "Zero2 variant angle style v1.0";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &anglezerocreator;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
|
||||||
|
// register zero2 dihedral style
|
||||||
|
plugin.style = "dihedral";
|
||||||
|
plugin.info = "Zero2 variant dihedral style v1.0";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &dihedralzerocreator;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
|
||||||
|
// register zero2 improper style
|
||||||
|
plugin.style = "improper";
|
||||||
|
plugin.info = "Zero2 variant improper style v1.0";
|
||||||
|
plugin.creator.v1 = (lammpsplugin_factory1 *) &improperzerocreator;
|
||||||
|
(*register_plugin)(&plugin,lmp);
|
||||||
|
}
|
||||||
@ -41,6 +41,8 @@ mscg hooks to the MSCG library, used by fix_mscg command
|
|||||||
from Jacob Wagner and Greg Voth group (U Chicago)
|
from Jacob Wagner and Greg Voth group (U Chicago)
|
||||||
netcdf hooks to a NetCDF library installed on your system
|
netcdf hooks to a NetCDF library installed on your system
|
||||||
from Lars Pastewka (Karlsruhe Institute of Technology)
|
from Lars Pastewka (Karlsruhe Institute of Technology)
|
||||||
|
plugin settings to load styles into LAMMPS from plugins
|
||||||
|
from Axel Kohlmeyer (Temple U)
|
||||||
poems POEMS rigid-body integration package, POEMS package
|
poems POEMS rigid-body integration package, POEMS package
|
||||||
from Rudranarayan Mukherjee (RPI)
|
from Rudranarayan Mukherjee (RPI)
|
||||||
python hooks to the system Python library, used by the PYTHON package
|
python hooks to the system Python library, used by the PYTHON package
|
||||||
|
|||||||
@ -740,6 +740,7 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum,
|
|||||||
|
|
||||||
// If binning on GPU, do this now
|
// If binning on GPU, do this now
|
||||||
if (_gpu_nbor==1) {
|
if (_gpu_nbor==1) {
|
||||||
|
mn = _max_nbors;
|
||||||
const numtyp i_cell_size=static_cast<numtyp>(1.0/_cell_size);
|
const numtyp i_cell_size=static_cast<numtyp>(1.0/_cell_size);
|
||||||
const int neigh_block=_block_cell_id;
|
const int neigh_block=_block_cell_id;
|
||||||
const int GX=(int)ceil((float)nall/neigh_block);
|
const int GX=(int)ceil((float)nall/neigh_block);
|
||||||
|
|||||||
16
lib/plugin/Makefile.lammps
Normal file
16
lib/plugin/Makefile.lammps
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# This file contains the hooks to build and link LAMMPS so it can load plugins
|
||||||
|
#
|
||||||
|
# The plugin_SYSINC and plugin_SYSPATH variables do not typically need
|
||||||
|
# to be set. If the dl library is not in a place the linker can find
|
||||||
|
# it, specify its directory via the plugin_SYSPATH variable, e.g.
|
||||||
|
# -Ldir.
|
||||||
|
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
|
||||||
|
# Settings that the LAMMPS build will import when this package is installed
|
||||||
|
|
||||||
|
ifeq ($(mode),shared)
|
||||||
|
plugin_SYSINC = -DLMP_PLUGIN
|
||||||
|
endif
|
||||||
|
plugin_SYSLIB = -ldl
|
||||||
|
plugin_SYSPATH =
|
||||||
16
lib/plugin/README
Normal file
16
lib/plugin/README
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
This directory has a Makefile.lammps file with settings that allows
|
||||||
|
LAMMPS to dynamically link LAMMPS plugins. More details about this
|
||||||
|
are in the manual.
|
||||||
|
|
||||||
|
In order to be able to dynamically load and execute the plugins from
|
||||||
|
inside LAMMPS, you need to link with a system library containing functions
|
||||||
|
like dlopen(), dlsym() and so on for dynamic linking of executable code
|
||||||
|
into an executable. This library is defined by setting the plugin_SYSLIB
|
||||||
|
variable in the Makefile.lammps file in this dir. For this mechanism
|
||||||
|
to work, LAMMPS must be built as a shared library (i.e. with mode=shared).
|
||||||
|
|
||||||
|
For Linux and most current unix-like operating systems, this can be
|
||||||
|
kept at the default setting of "-ldl" (on some platforms this library
|
||||||
|
is called "-ldld"). The Windows platform is currently not supported.
|
||||||
|
|
||||||
|
See the header of Makefile.lammps for more info.
|
||||||
@ -15,7 +15,7 @@ from .pylammps import *
|
|||||||
|
|
||||||
# convert module string version to numeric version
|
# convert module string version to numeric version
|
||||||
def get_version_number():
|
def get_version_number():
|
||||||
from datetime import datetime
|
import time
|
||||||
from sys import version_info
|
from sys import version_info
|
||||||
vstring = None
|
vstring = None
|
||||||
if version_info.major == 3 and version_info.minor >= 8:
|
if version_info.major == 3 and version_info.minor >= 8:
|
||||||
@ -32,7 +32,7 @@ def get_version_number():
|
|||||||
if not vstring:
|
if not vstring:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
d = datetime.strptime(vstring, "%d%b%Y")
|
t = time.strptime(vstring, "%d%b%Y")
|
||||||
return d.year*10000 + d.month*100 + d.day
|
return t.tm_year*10000 + t.tm_mon*100 + t.tm_mday
|
||||||
|
|
||||||
__version__ = get_version_number()
|
__version__ = get_version_number()
|
||||||
|
|||||||
@ -278,6 +278,9 @@ class lammps(object):
|
|||||||
|
|
||||||
self.lib.lammps_id_name.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_int]
|
self.lib.lammps_id_name.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_int]
|
||||||
|
|
||||||
|
self.lib.lammps_plugin_count.argtypes = [ ]
|
||||||
|
self.lib.lammps_plugin_name.argtypes = [c_int, c_char_p, c_char_p, c_int]
|
||||||
|
|
||||||
self.lib.lammps_version.argtypes = [c_void_p]
|
self.lib.lammps_version.argtypes = [c_void_p]
|
||||||
|
|
||||||
self.lib.lammps_get_os_info.argtypes = [c_char_p, c_int]
|
self.lib.lammps_get_os_info.argtypes = [c_char_p, c_int]
|
||||||
@ -729,12 +732,11 @@ class lammps(object):
|
|||||||
def extract_global(self, name, dtype=LAMMPS_AUTODETECT):
|
def extract_global(self, name, dtype=LAMMPS_AUTODETECT):
|
||||||
"""Query LAMMPS about global settings of different types.
|
"""Query LAMMPS about global settings of different types.
|
||||||
|
|
||||||
This is a wrapper around the :cpp:func:`lammps_extract_global`
|
This is a wrapper around the :cpp:func:`lammps_extract_global` function
|
||||||
function of the C-library interface. Unlike the C function
|
of the C-library interface. Since there are no pointers in Python, this
|
||||||
this method returns the value and not a pointer and thus can
|
method will - unlike the C function - return the value or a list of
|
||||||
only return the first value for keywords representing a list
|
values. The :cpp:func:`lammps_extract_global` documentation includes a
|
||||||
of values. The :cpp:func:`lammps_extract_global` documentation
|
list of the supported keywords and their data types.
|
||||||
includes a list of the supported keywords and their data types.
|
|
||||||
Since Python needs to know the data type to be able to interpret
|
Since Python needs to know the data type to be able to interpret
|
||||||
the result, by default, this function will try to auto-detect the data type
|
the result, by default, this function will try to auto-detect the data type
|
||||||
by asking the library. You can also force a specific data type. For that
|
by asking the library. You can also force a specific data type. For that
|
||||||
@ -746,12 +748,23 @@ class lammps(object):
|
|||||||
:type name: string
|
:type name: string
|
||||||
:param dtype: data type of the returned data (see :ref:`py_datatype_constants`)
|
:param dtype: data type of the returned data (see :ref:`py_datatype_constants`)
|
||||||
:type dtype: int, optional
|
:type dtype: int, optional
|
||||||
:return: value of the property or None
|
:return: value of the property or list of values or None
|
||||||
:rtype: int, float, or NoneType
|
:rtype: int, float, list, or NoneType
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if dtype == LAMMPS_AUTODETECT:
|
if dtype == LAMMPS_AUTODETECT:
|
||||||
dtype = self.extract_global_datatype(name)
|
dtype = self.extract_global_datatype(name)
|
||||||
|
|
||||||
|
# set length of vector for items that are not a scalar
|
||||||
|
vec_dict = { 'boxlo':3, 'boxhi':3, 'sublo':3, 'subhi':3,
|
||||||
|
'sublo_lambda':3, 'subhi_lambda':3, 'periodicity':3 }
|
||||||
|
if name in vec_dict:
|
||||||
|
veclen = vec_dict[name]
|
||||||
|
elif name == 'respa_dt':
|
||||||
|
veclen = self.extract_global('respa_levels',LAMMPS_INT)
|
||||||
|
else:
|
||||||
|
veclen = 1
|
||||||
|
|
||||||
if name: name = name.encode()
|
if name: name = name.encode()
|
||||||
else: return None
|
else: return None
|
||||||
|
|
||||||
@ -766,14 +779,19 @@ class lammps(object):
|
|||||||
target_type = float
|
target_type = float
|
||||||
elif dtype == LAMMPS_STRING:
|
elif dtype == LAMMPS_STRING:
|
||||||
self.lib.lammps_extract_global.restype = c_char_p
|
self.lib.lammps_extract_global.restype = c_char_p
|
||||||
target_type = lambda x: str(x, 'ascii')
|
|
||||||
|
|
||||||
ptr = self.lib.lammps_extract_global(self.lmp, name)
|
ptr = self.lib.lammps_extract_global(self.lmp, name)
|
||||||
if ptr:
|
if ptr:
|
||||||
return target_type(ptr[0])
|
if dtype == LAMMPS_STRING:
|
||||||
|
return ptr.decode('utf-8')
|
||||||
|
if veclen > 1:
|
||||||
|
result = []
|
||||||
|
for i in range(0,veclen):
|
||||||
|
result.append(target_type(ptr[i]))
|
||||||
|
return result
|
||||||
|
else: return target_type(ptr[0])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# extract per-atom info datatype
|
# extract per-atom info datatype
|
||||||
|
|
||||||
@ -1640,6 +1658,29 @@ class lammps(object):
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def available_plugins(self, category):
|
||||||
|
"""Returns a list of plugins available for a given category
|
||||||
|
|
||||||
|
This is a wrapper around the functions :cpp:func:`lammps_plugin_count()`
|
||||||
|
and :cpp:func:`lammps_plugin_name()` of the library interface.
|
||||||
|
|
||||||
|
.. versionadded:: 10Mar2021
|
||||||
|
|
||||||
|
:return: list of style/name pairs of loaded plugins
|
||||||
|
:rtype: list
|
||||||
|
"""
|
||||||
|
|
||||||
|
available_plugins = []
|
||||||
|
num = self.lib.lammps_plugin_count(self.lmp)
|
||||||
|
sty = create_string_buffer(100)
|
||||||
|
nam = create_string_buffer(100)
|
||||||
|
for idx in range(num):
|
||||||
|
self.lib.lammps_plugin_name(idx, sty, nam, 100)
|
||||||
|
available_plugins.append([sty.value.decode(), nam.value.decode()])
|
||||||
|
return available_plugins
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
def set_fix_external_callback(self, fix_name, callback, caller=None):
|
def set_fix_external_callback(self, fix_name, callback, caller=None):
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|||||||
4
src/.gitignore
vendored
4
src/.gitignore
vendored
@ -172,6 +172,10 @@
|
|||||||
/pair_lj_charmmfsw_coul_long.cpp
|
/pair_lj_charmmfsw_coul_long.cpp
|
||||||
/pair_lj_charmmfsw_coul_long.h
|
/pair_lj_charmmfsw_coul_long.h
|
||||||
|
|
||||||
|
/plugin.cpp
|
||||||
|
/plugin.h
|
||||||
|
/lammpsplugin.h
|
||||||
|
|
||||||
/atom_vec_spin.cpp
|
/atom_vec_spin.cpp
|
||||||
/atom_vec_spin.h
|
/atom_vec_spin.h
|
||||||
/compute_spin.cpp
|
/compute_spin.cpp
|
||||||
|
|||||||
@ -195,7 +195,7 @@ void FixWallBodyPolygon::init()
|
|||||||
|
|
||||||
void FixWallBodyPolygon::setup(int vflag)
|
void FixWallBodyPolygon::setup(int vflag)
|
||||||
{
|
{
|
||||||
if (strstr(update->integrate_style,"verlet"))
|
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -202,7 +202,7 @@ void FixWallBodyPolyhedron::init()
|
|||||||
|
|
||||||
void FixWallBodyPolyhedron::setup(int vflag)
|
void FixWallBodyPolyhedron::setup(int vflag)
|
||||||
{
|
{
|
||||||
if (strstr(update->integrate_style,"verlet"))
|
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -491,7 +491,7 @@ void PairLJClass2::init_style()
|
|||||||
int irequest;
|
int irequest;
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ void PairLJClass2::init_style()
|
|||||||
|
|
||||||
// set rRESPA cutoffs
|
// set rRESPA cutoffs
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa") &&
|
if (utils::strmatch(update->integrate_style,"^respa") &&
|
||||||
((Respa *) update->integrate)->level_inner >= 0)
|
((Respa *) update->integrate)->level_inner >= 0)
|
||||||
cut_respa = ((Respa *) update->integrate)->cutoff;
|
cut_respa = ((Respa *) update->integrate)->cutoff;
|
||||||
else cut_respa = nullptr;
|
else cut_respa = nullptr;
|
||||||
|
|||||||
@ -671,7 +671,7 @@ void PairLJClass2CoulLong::init_style()
|
|||||||
int irequest;
|
int irequest;
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ void PairLJClass2CoulLong::init_style()
|
|||||||
|
|
||||||
// set rRESPA cutoffs
|
// set rRESPA cutoffs
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa") &&
|
if (utils::strmatch(update->integrate_style,"^respa") &&
|
||||||
((Respa *) update->integrate)->level_inner >= 0)
|
((Respa *) update->integrate)->level_inner >= 0)
|
||||||
cut_respa = ((Respa *) update->integrate)->cutoff;
|
cut_respa = ((Respa *) update->integrate)->cutoff;
|
||||||
else cut_respa = nullptr;
|
else cut_respa = nullptr;
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void FixGPU::setup(int vflag)
|
|||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot use neigh_modify exclude with GPU neighbor builds");
|
"Cannot use neigh_modify exclude with GPU neighbor builds");
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"verlet")) post_force(vflag);
|
if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag);
|
||||||
else {
|
else {
|
||||||
// In setup only, all forces calculated on GPU are put in the outer level
|
// In setup only, all forces calculated on GPU are put in the outer level
|
||||||
((Respa *) update->integrate)->copy_flevel_f(_nlevels_respa-1);
|
((Respa *) update->integrate)->copy_flevel_f(_nlevels_respa-1);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ FixNHGPU::~FixNHGPU()
|
|||||||
void FixNHGPU::setup(int vflag)
|
void FixNHGPU::setup(int vflag)
|
||||||
{
|
{
|
||||||
FixNH::setup(vflag);
|
FixNH::setup(vflag);
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
_respa_on = 1;
|
_respa_on = 1;
|
||||||
else
|
else
|
||||||
_respa_on = 0;
|
_respa_on = 0;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ FixNVEGPU::~FixNVEGPU()
|
|||||||
void FixNVEGPU::setup(int vflag)
|
void FixNVEGPU::setup(int vflag)
|
||||||
{
|
{
|
||||||
FixNVE::setup(vflag);
|
FixNVE::setup(vflag);
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
_respa_on = 1;
|
_respa_on = 1;
|
||||||
else
|
else
|
||||||
_respa_on = 0;
|
_respa_on = 0;
|
||||||
|
|||||||
@ -149,7 +149,7 @@ void PPPMGPU::init()
|
|||||||
// GPU precision specific init
|
// GPU precision specific init
|
||||||
|
|
||||||
bool respa_value=false;
|
bool respa_value=false;
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
respa_value=true;
|
respa_value=true;
|
||||||
|
|
||||||
if (order>8)
|
if (order>8)
|
||||||
|
|||||||
@ -69,7 +69,7 @@ void FixFreeze::init()
|
|||||||
|
|
||||||
void FixFreeze::setup(int vflag)
|
void FixFreeze::setup(int vflag)
|
||||||
{
|
{
|
||||||
if (strstr(update->integrate_style,"verlet"))
|
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
else {
|
else {
|
||||||
int nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
int nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
||||||
|
|||||||
@ -17,29 +17,25 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "fix_wall_gran.h"
|
#include "fix_wall_gran.h"
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "update.h"
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "modify.h"
|
|
||||||
#include "respa.h"
|
|
||||||
#include "math_const.h"
|
#include "math_const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "modify.h"
|
||||||
#include "neighbor.h"
|
#include "neighbor.h"
|
||||||
|
#include "respa.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
using namespace MathConst;
|
using namespace MathConst;
|
||||||
|
|
||||||
// XYZ PLANE need to be 0,1,2
|
|
||||||
|
|
||||||
enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION};
|
|
||||||
enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR};
|
|
||||||
enum{NONE,CONSTANT,EQUAL};
|
|
||||||
|
|
||||||
#define PI27SQ 266.47931882941264802866 // 27*PI**2
|
#define PI27SQ 266.47931882941264802866 // 27*PI**2
|
||||||
#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3)
|
#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3)
|
||||||
#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6)
|
#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6)
|
||||||
@ -48,19 +44,21 @@ enum{NONE,CONSTANT,EQUAL};
|
|||||||
#define THREEQUARTERS 0.75 // 3/4
|
#define THREEQUARTERS 0.75 // 3/4
|
||||||
#define TWOPI 6.28318530717959 // 2*PI
|
#define TWOPI 6.28318530717959 // 2*PI
|
||||||
|
|
||||||
|
#define BIG 1.0e20
|
||||||
#define EPSILON 1e-10
|
#define EPSILON 1e-10
|
||||||
|
|
||||||
enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR};
|
// XYZ PLANE need to be 0,1,2
|
||||||
enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI};
|
|
||||||
enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY,
|
enum {XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION};
|
||||||
|
|
||||||
|
enum {NONE,CONSTANT,EQUAL};
|
||||||
|
enum {DAMPING_NONE, VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI};
|
||||||
|
enum {TANGENTIAL_NONE, TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY,
|
||||||
TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE,
|
TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE,
|
||||||
TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE};
|
TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE};
|
||||||
enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL};
|
enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL};
|
||||||
enum {ROLL_NONE, ROLL_SDS};
|
enum {ROLL_NONE, ROLL_SDS};
|
||||||
|
|
||||||
#define BIG 1.0e20
|
|
||||||
#define EPSILON 1e-10
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||||
@ -85,6 +83,10 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
use_history = restart_peratom = 1;
|
use_history = restart_peratom = 1;
|
||||||
if (pairstyle == HOOKE) use_history = restart_peratom = 0;
|
if (pairstyle == HOOKE) use_history = restart_peratom = 0;
|
||||||
|
tangential_history = roll_history = twist_history = 0;
|
||||||
|
normal_model = NORMAL_NONE;
|
||||||
|
tangential_model = TANGENTIAL_NONE;
|
||||||
|
damping_model = DAMPING_NONE;
|
||||||
|
|
||||||
// wall/particle coefficients
|
// wall/particle coefficients
|
||||||
|
|
||||||
@ -127,7 +129,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
iarg = 4;
|
iarg = 4;
|
||||||
damping_model = VISCOELASTIC;
|
damping_model = VISCOELASTIC;
|
||||||
roll_model = twist_model = NONE;
|
roll_model = twist_model = NONE;
|
||||||
tangential_history = roll_history = twist_history = 0;
|
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg], "hooke") == 0) {
|
if (strcmp(arg[iarg], "hooke") == 0) {
|
||||||
if (iarg + 2 >= narg)
|
if (iarg + 2 >= narg)
|
||||||
@ -493,7 +494,7 @@ void FixWallGran::init()
|
|||||||
|
|
||||||
dt = update->dt;
|
dt = update->dt;
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
||||||
|
|
||||||
// check for FixRigid so can extract rigid body masses
|
// check for FixRigid so can extract rigid body masses
|
||||||
@ -541,7 +542,7 @@ void FixWallGran::init()
|
|||||||
|
|
||||||
void FixWallGran::setup(int vflag)
|
void FixWallGran::setup(int vflag)
|
||||||
{
|
{
|
||||||
if (strstr(update->integrate_style,"verlet"))
|
if (utils::strmatch(update->integrate_style,"^verlet"))
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
else {
|
else {
|
||||||
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
|
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
|
||||||
|
|||||||
@ -26,6 +26,10 @@ namespace LAMMPS_NS {
|
|||||||
|
|
||||||
class FixWallGran : public Fix {
|
class FixWallGran : public Fix {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum {HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR};
|
||||||
|
enum {NORMAL_NONE, NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR};
|
||||||
|
|
||||||
FixWallGran(class LAMMPS *, int, char **);
|
FixWallGran(class LAMMPS *, int, char **);
|
||||||
virtual ~FixWallGran();
|
virtual ~FixWallGran();
|
||||||
int setmask();
|
int setmask();
|
||||||
|
|||||||
@ -16,26 +16,21 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "fix_wall_gran_region.h"
|
#include "fix_wall_gran_region.h"
|
||||||
#include <cstring>
|
|
||||||
#include "region.h"
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "domain.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "memory.h"
|
||||||
#include "neighbor.h"
|
#include "neighbor.h"
|
||||||
|
#include "region.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
// same as FixWallGran
|
|
||||||
|
|
||||||
enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR};
|
|
||||||
enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR};
|
|
||||||
|
|
||||||
#define BIG 1.0e20
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) :
|
FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) :
|
||||||
@ -186,7 +181,7 @@ void FixWallGranRegion::post_force(int /*vflag*/)
|
|||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (!region->match(x[i][0],x[i][1],x[i][2])) continue;
|
if (!region->match(x[i][0],x[i][1],x[i][2])) continue;
|
||||||
|
|
||||||
if (pairstyle == GRANULAR && normal_model == JKR) {
|
if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) {
|
||||||
nc = region->surface(x[i][0],x[i][1],x[i][2],
|
nc = region->surface(x[i][0],x[i][1],x[i][2],
|
||||||
radius[i]+pulloff_distance(radius[i]));
|
radius[i]+pulloff_distance(radius[i]));
|
||||||
}
|
}
|
||||||
@ -228,7 +223,7 @@ void FixWallGranRegion::post_force(int /*vflag*/)
|
|||||||
|
|
||||||
rsq = region->contact[ic].r*region->contact[ic].r;
|
rsq = region->contact[ic].r*region->contact[ic].r;
|
||||||
|
|
||||||
if (pairstyle == GRANULAR && normal_model == JKR) {
|
if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) {
|
||||||
if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i]*radius[i]) {
|
if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i]*radius[i]) {
|
||||||
for (m = 0; m < size_history; m++)
|
for (m = 0; m < size_history; m++)
|
||||||
history_many[i][0][m] = 0.0;
|
history_many[i][0][m] = 0.0;
|
||||||
@ -264,18 +259,18 @@ void FixWallGranRegion::post_force(int /*vflag*/)
|
|||||||
else
|
else
|
||||||
contact = nullptr;
|
contact = nullptr;
|
||||||
|
|
||||||
if (pairstyle == HOOKE)
|
if (pairstyle == FixWallGran::HOOKE)
|
||||||
hooke(rsq,dx,dy,dz,vwall,v[i],f[i],
|
hooke(rsq,dx,dy,dz,vwall,v[i],f[i],
|
||||||
omega[i],torque[i],radius[i],meff, contact);
|
omega[i],torque[i],radius[i],meff, contact);
|
||||||
else if (pairstyle == HOOKE_HISTORY)
|
else if (pairstyle == FixWallGran::HOOKE_HISTORY)
|
||||||
hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i],
|
hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i],
|
||||||
omega[i],torque[i],radius[i],meff,
|
omega[i],torque[i],radius[i],meff,
|
||||||
history_many[i][c2r[ic]], contact);
|
history_many[i][c2r[ic]], contact);
|
||||||
else if (pairstyle == HERTZ_HISTORY)
|
else if (pairstyle == FixWallGran::HERTZ_HISTORY)
|
||||||
hertz_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
|
hertz_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
|
||||||
v[i],f[i],omega[i],torque[i],
|
v[i],f[i],omega[i],torque[i],
|
||||||
radius[i],meff,history_many[i][c2r[ic]], contact);
|
radius[i],meff,history_many[i][c2r[ic]], contact);
|
||||||
else if (pairstyle == GRANULAR)
|
else if (pairstyle == FixWallGran::GRANULAR)
|
||||||
granular(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
|
granular(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
|
||||||
v[i],f[i],omega[i],torque[i],
|
v[i],f[i],omega[i],torque[i],
|
||||||
radius[i],meff,history_many[i][c2r[ic]],contact);
|
radius[i],meff,history_many[i][c2r[ic]],contact);
|
||||||
|
|||||||
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Contributing authors: Axel Kohlmeyer (Temple U),
|
Contributing authors: Axel Kohlmeyer (Temple U),
|
||||||
Ryan S. Elliott (UMN)
|
Ryan S. Elliott (UMN),
|
||||||
Ellad B. Tadmor (UMN)
|
Ellad B. Tadmor (UMN),
|
||||||
Ronald Miller (Carleton U)
|
Ronald Miller (Carleton U),
|
||||||
Yaser Afshar (UMN)
|
Yaser Afshar (UMN)
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -65,6 +65,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "fix_store_kim.h"
|
#include "fix_store_kim.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "variable.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
@ -129,6 +130,7 @@ void KimInteractions::do_setup(int narg, char **arg)
|
|||||||
"=======\n");
|
"=======\n");
|
||||||
|
|
||||||
if (simulatorModel) {
|
if (simulatorModel) {
|
||||||
|
auto first_visit = input->variable->find("kim_update");
|
||||||
if (!fixed_types) {
|
if (!fixed_types) {
|
||||||
std::string atom_type_sym_list =
|
std::string atom_type_sym_list =
|
||||||
fmt::format("{}", fmt::join(arg, arg + narg, " "));
|
fmt::format("{}", fmt::join(arg, arg + narg, " "));
|
||||||
@ -198,15 +200,17 @@ void KimInteractions::do_setup(int narg, char **arg)
|
|||||||
|
|
||||||
const std::string sim_field_str(sim_field);
|
const std::string sim_field_str(sim_field);
|
||||||
if (sim_field_str == "model-defn") {
|
if (sim_field_str == "model-defn") {
|
||||||
|
if (first_visit < 0) input->one("variable kim_update equal 0");
|
||||||
|
else input->one("variable kim_update equal 1");
|
||||||
if (domain->periodicity[0] &&
|
if (domain->periodicity[0] &&
|
||||||
domain->periodicity[1] &&
|
domain->periodicity[1] &&
|
||||||
domain->periodicity[2])
|
domain->periodicity[2])
|
||||||
input->one("variable kim_periodic equal 1");
|
input->one("variable kim_periodic equal 1");
|
||||||
else if (domain->periodicity[0] &&
|
else if (!domain->periodicity[0] &&
|
||||||
domain->periodicity[1] &&
|
!domain->periodicity[1] &&
|
||||||
!domain->periodicity[2])
|
!domain->periodicity[2])
|
||||||
input->one("variable kim_periodic equal 2");
|
input->one("variable kim_periodic equal 0");
|
||||||
else input->one("variable kim_periodic equal 0");
|
else input->one("variable kim_periodic equal 2");
|
||||||
|
|
||||||
// KIM Simulator Model has a Model definition
|
// KIM Simulator Model has a Model definition
|
||||||
no_model_definition = false;
|
no_model_definition = false;
|
||||||
@ -241,6 +245,7 @@ void KimInteractions::do_setup(int narg, char **arg)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
// not a simulator model. issue pair_style and pair_coeff commands.
|
// not a simulator model. issue pair_style and pair_coeff commands.
|
||||||
|
|
||||||
if (fixed_types)
|
if (fixed_types)
|
||||||
|
|||||||
@ -1171,7 +1171,6 @@ void AtomVecHybridKokkos::build_styles()
|
|||||||
|
|
||||||
allstyles = new char*[nallstyles];
|
allstyles = new char*[nallstyles];
|
||||||
|
|
||||||
int n;
|
|
||||||
nallstyles = 0;
|
nallstyles = 0;
|
||||||
#define ATOM_CLASS
|
#define ATOM_CLASS
|
||||||
#define AtomStyle(key,Class) \
|
#define AtomStyle(key,Class) \
|
||||||
|
|||||||
@ -67,7 +67,7 @@ void FixSetForceKokkos<DeviceType>::init()
|
|||||||
{
|
{
|
||||||
FixSetForce::init();
|
FixSetForce::init();
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
error->all(FLERR,"Cannot (yet) use respa with Kokkos");
|
error->all(FLERR,"Cannot (yet) use respa with Kokkos");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ void FixShakeKokkos<DeviceType>::init()
|
|||||||
{
|
{
|
||||||
FixShake::init();
|
FixShake::init();
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa"))
|
if (utils::strmatch(update->integrate_style,"^respa"))
|
||||||
error->all(FLERR,"Cannot yet use respa with Kokkos");
|
error->all(FLERR,"Cannot yet use respa with Kokkos");
|
||||||
|
|
||||||
if (rattle)
|
if (rattle)
|
||||||
|
|||||||
@ -285,7 +285,7 @@ void PairBuckCoulCutKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -447,7 +447,7 @@ void PairBuckCoulLongKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -205,7 +205,7 @@ void PairBuckKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -405,7 +405,7 @@ void PairCoulLongKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ void PairHybridKokkos::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
Respa *respa = nullptr;
|
Respa *respa = nullptr;
|
||||||
respaflag = 0;
|
respaflag = 0;
|
||||||
if (strstr(update->integrate_style,"respa")) {
|
if (utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
respa = (Respa *) update->integrate;
|
respa = (Respa *) update->integrate;
|
||||||
if (respa->nhybrid_styles > 0) respaflag = 1;
|
if (respa->nhybrid_styles > 0) respaflag = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -450,7 +450,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -451,7 +451,7 @@ void PairLJCharmmCoulCharmmKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -459,7 +459,7 @@ void PairLJCharmmCoulLongKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -287,7 +287,7 @@ void PairLJClass2CoulCutKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -442,7 +442,7 @@ void PairLJClass2CoulLongKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ void PairLJClass2Kokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
@ -278,7 +278,7 @@ void PairLJCutCoulCutKokkos<DeviceType>::init_style()
|
|||||||
|
|
||||||
// error if rRESPA with inner levels
|
// error if rRESPA with inner levels
|
||||||
|
|
||||||
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
|
if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) {
|
||||||
int respa = 0;
|
int respa = 0;
|
||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user