Merge branch 'develop' of github.com:lammps/lammps into kk_occupancy
This commit is contained in:
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@ -37,6 +37,7 @@ src/MESONT/* @iafoss
|
||||
src/ML-HDNNP/* @singraber
|
||||
src/ML-IAP/* @athomps
|
||||
src/ML-PACE/* @yury-lysogorskiy
|
||||
src/ML-POD/* @exapde @rohskopf
|
||||
src/MOFFF/* @hheenen
|
||||
src/MOLFILE/* @akohlmey
|
||||
src/NETCDF/* @pastewka
|
||||
@ -63,6 +64,8 @@ src/MANYBODY/pair_atm.* @sergeylishchuk
|
||||
src/REPLICA/*_grem.* @dstelter92
|
||||
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
||||
src/MISC/*_tracker.* @jtclemm
|
||||
src/MC/fix_gcmc.* @athomps
|
||||
src/MC/fix_sgcmc.* @athomps
|
||||
|
||||
# core LAMMPS classes
|
||||
src/lammps.* @sjplimp
|
||||
|
||||
6
.github/workflows/compile-msvc.yml
vendored
6
.github/workflows/compile-msvc.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
- name: Select Python version
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
@ -37,6 +37,8 @@ jobs:
|
||||
nuget install MSMPIDIST
|
||||
cmake -C cmake/presets/windows.cmake \
|
||||
-D PKG_PYTHON=on \
|
||||
-D WITH_PNG=off \
|
||||
-D WITH_JPEG=off \
|
||||
-S cmake -B build \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D LAMMPS_EXCEPTIONS=on \
|
||||
@ -52,4 +54,4 @@ jobs:
|
||||
- name: Run Unit Tests
|
||||
working-directory: build
|
||||
shell: bash
|
||||
run: ctest -V -C Release
|
||||
run: ctest -V -C Release -E FixTimestep:python_move_nve
|
||||
|
||||
@ -266,6 +266,7 @@ set(STANDARD_PACKAGES
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
ML-POD
|
||||
MOFFF
|
||||
MOLECULE
|
||||
MOLFILE
|
||||
@ -432,7 +433,7 @@ if(BUILD_OMP)
|
||||
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
|
||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE)
|
||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_LATTE OR PKG_ELECTRODE)
|
||||
enable_language(C)
|
||||
if (NOT USE_INTERNAL_LINALG)
|
||||
find_package(LAPACK)
|
||||
@ -638,7 +639,7 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_ELECTRODE)
|
||||
if(PKG_ELECTRODE OR PKG_ML-POD)
|
||||
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
@ -667,7 +668,7 @@ endif()
|
||||
# packages which selectively include variants based on enabled styles
|
||||
# e.g. accelerator packages
|
||||
######################################################################
|
||||
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
||||
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
||||
if(PKG_${PKG_WITH_INCL})
|
||||
include(Packages/${PKG_WITH_INCL})
|
||||
endif()
|
||||
|
||||
@ -124,7 +124,7 @@ set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
||||
|
||||
if(PKG_KSPACE)
|
||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/grid3d_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
if(NOT (FFT STREQUAL "KISS"))
|
||||
|
||||
9
cmake/Modules/Packages/MC.cmake
Normal file
9
cmake/Modules/Packages/MC.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
# fix sgcmc may only be installed if also the EAM pair style from MANYBODY is installed
|
||||
if(NOT PKG_MANYBODY)
|
||||
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
||||
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.h)
|
||||
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||
endif()
|
||||
@ -56,6 +56,7 @@ set(ALL_PACKAGES
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-PACE
|
||||
ML-POD
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
|
||||
@ -58,6 +58,7 @@ set(ALL_PACKAGES
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-PACE
|
||||
ML-POD
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
|
||||
@ -47,6 +47,7 @@ set(WIN_PACKAGES
|
||||
MISC
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-POD
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
|
||||
@ -41,6 +41,7 @@ set(ALL_PACKAGES
|
||||
MEAM
|
||||
MISC
|
||||
ML-IAP
|
||||
ML-POD
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
MOLECULE
|
||||
|
||||
@ -45,7 +45,7 @@ SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocess
|
||||
# we only want to use explicitly listed files.
|
||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check xmlgen fasthtml
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
@ -96,6 +96,7 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
rst_anchor_check src/*.rst ;\
|
||||
python $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||
python $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
||||
echo "############################################" ;\
|
||||
deactivate ;\
|
||||
@ -175,6 +176,7 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
rst_anchor_check src/*.rst ;\
|
||||
python utils/check-packages.py -s ../src -d src ;\
|
||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||
python utils/check-styles.py -s ../src -d src ;\
|
||||
echo "############################################" ;\
|
||||
deactivate ;\
|
||||
@ -220,6 +222,9 @@ package_check : $(VENV)
|
||||
char_check :
|
||||
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||
|
||||
role_check :
|
||||
@( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : )
|
||||
|
||||
xmlgen : doxygen/xml/index.xml
|
||||
|
||||
doxygen/Doxyfile: doxygen/Doxyfile.in
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.TH LAMMPS "1" "3 November 2022" "2022-11-3"
|
||||
.TH LAMMPS "1" "22 December 2022" "2022-12-22"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator. Version 3 November 2022
|
||||
\- Molecular Dynamics Simulator. Version 22 December 2022
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B lmp
|
||||
|
||||
@ -36,6 +36,7 @@ This is the list of packages that may require additional steps.
|
||||
* :ref:`AWPMD <awpmd>`
|
||||
* :ref:`COLVARS <colvars>`
|
||||
* :ref:`COMPRESS <compress>`
|
||||
* :ref:`ELECTRODE <electrode>`
|
||||
* :ref:`GPU <gpu>`
|
||||
* :ref:`H5MD <h5md>`
|
||||
* :ref:`INTEL <intel>`
|
||||
@ -48,6 +49,7 @@ This is the list of packages that may require additional steps.
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`ML-PACE <ml-pace>`
|
||||
* :ref:`ML-POD <ml-pod>`
|
||||
* :ref:`ML-QUIP <ml-quip>`
|
||||
* :ref:`MOLFILE <molfile>`
|
||||
* :ref:`MSCG <mscg>`
|
||||
@ -1411,6 +1413,49 @@ at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps
|
||||
|
||||
----------
|
||||
|
||||
.. _ml-pod:
|
||||
|
||||
ML-POD package
|
||||
-----------------------------
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: CMake build
|
||||
|
||||
No additional settings are needed besides ``-D PKG_ML-POD=yes``.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
Before building LAMMPS, you must configure the ML-POD support
|
||||
settings in ``lib/mlpod``. You can do this manually, if you
|
||||
prefer, or do it in one step from the ``lammps/src`` dir, using a
|
||||
command like the following, which simply invoke the
|
||||
``lib/mlpod/Install.py`` script with the specified args:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-mlpod # print help message
|
||||
$ make lib-mlpod args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
$ make lib-mlpod args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
$ make lib-mlpod args="-m mpi -e linalg" # same as above but use the bundled linalg lib
|
||||
|
||||
Note that the ``Makefile.lammps`` file has settings to use the BLAS
|
||||
and LAPACK linear algebra libraries. These can either exist on
|
||||
your system, or you can use the files provided in ``lib/linalg``.
|
||||
In the latter case you also need to build the library in
|
||||
``lib/linalg`` with a command like these:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-linalg # print help message
|
||||
$ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
$ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
$ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
|
||||
The package itself is activated with ``make yes-ML-POD``.
|
||||
|
||||
----------
|
||||
|
||||
.. _plumed:
|
||||
|
||||
PLUMED package
|
||||
|
||||
@ -31,7 +31,6 @@ table above.
|
||||
* :doc:`bond_style <bond_style>`
|
||||
* :doc:`bond_write <bond_write>`
|
||||
* :doc:`boundary <boundary>`
|
||||
* :doc:`box <box>`
|
||||
* :doc:`change_box <change_box>`
|
||||
* :doc:`clear <clear>`
|
||||
* :doc:`comm_modify <comm_modify>`
|
||||
@ -90,8 +89,7 @@ table above.
|
||||
* :doc:`region <region>`
|
||||
* :doc:`replicate <replicate>`
|
||||
* :doc:`rerun <rerun>`
|
||||
* :doc:`reset_atom_ids <reset_atom_ids>`
|
||||
* :doc:`reset_mol_ids <reset_mol_ids>`
|
||||
* :doc:`reset_atoms <reset_atoms>`
|
||||
* :doc:`reset_timestep <reset_timestep>`
|
||||
* :doc:`restart <restart>`
|
||||
* :doc:`run <run>`
|
||||
@ -127,6 +125,7 @@ additional letter in parenthesis: k = KOKKOS.
|
||||
* :doc:`group2ndx <group2ndx>`
|
||||
* :doc:`hyper <hyper>`
|
||||
* :doc:`kim <kim_commands>`
|
||||
* :doc:`fitpod <fitpod_command>`
|
||||
* :doc:`mdi <mdi>`
|
||||
* :doc:`ndx2group <group2ndx>`
|
||||
* :doc:`neb <neb>`
|
||||
|
||||
@ -25,7 +25,6 @@ Setup simulation box:
|
||||
:columns: 4
|
||||
|
||||
* :doc:`boundary <boundary>`
|
||||
* :doc:`box <box>`
|
||||
* :doc:`change_box <change_box>`
|
||||
* :doc:`create_box <create_box>`
|
||||
* :doc:`dimension <dimension>`
|
||||
|
||||
@ -107,6 +107,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`pressure/uef <compute_pressure_uef>`
|
||||
* :doc:`property/atom <compute_property_atom>`
|
||||
* :doc:`property/chunk <compute_property_chunk>`
|
||||
* :doc:`property/grid <compute_property_grid>`
|
||||
* :doc:`property/local <compute_property_local>`
|
||||
* :doc:`ptm/atom <compute_ptm_atom>`
|
||||
* :doc:`rdf <compute_rdf>`
|
||||
|
||||
@ -36,7 +36,8 @@ An alphabetic list of all LAMMPS :doc:`dump <dump>` commands.
|
||||
* :doc:`custom/mpiio <dump>`
|
||||
* :doc:`custom/zstd <dump>`
|
||||
* :doc:`dcd <dump>`
|
||||
* :doc:`deprecated <dump>`
|
||||
* :doc:`grid <dump>`
|
||||
* :doc:`grid/vtk <dump>`
|
||||
* :doc:`h5md <dump_h5md>`
|
||||
* :doc:`image <dump_image>`
|
||||
* :doc:`local <dump>`
|
||||
|
||||
@ -38,6 +38,7 @@ OPT.
|
||||
* :doc:`ave/chunk <fix_ave_chunk>`
|
||||
* :doc:`ave/correlate <fix_ave_correlate>`
|
||||
* :doc:`ave/correlate/long <fix_ave_correlate_long>`
|
||||
* :doc:`ave/grid <fix_ave_grid>`
|
||||
* :doc:`ave/histo <fix_ave_histo>`
|
||||
* :doc:`ave/histo/weight <fix_ave_histo>`
|
||||
* :doc:`ave/time <fix_ave_time>`
|
||||
@ -65,13 +66,13 @@ OPT.
|
||||
* :doc:`drude <fix_drude>`
|
||||
* :doc:`drude/transform/direct <fix_drude_transform>`
|
||||
* :doc:`drude/transform/inverse <fix_drude_transform>`
|
||||
* :doc:`dt/reset <fix_dt_reset>`
|
||||
* :doc:`dt/reset (k) <fix_dt_reset>`
|
||||
* :doc:`edpd/source <fix_dpd_source>`
|
||||
* :doc:`efield <fix_efield>`
|
||||
* :doc:`ehex <fix_ehex>`
|
||||
* :doc:`electrode/conp (i) <fix_electrode_conp>`
|
||||
* :doc:`electrode/conq (i) <fix_electrode_conp>`
|
||||
* :doc:`electrode/thermo (i) <fix_electrode_conp>`
|
||||
* :doc:`electrode/conp (i) <fix_electrode>`
|
||||
* :doc:`electrode/conq (i) <fix_electrode>`
|
||||
* :doc:`electrode/thermo (i) <fix_electrode>`
|
||||
* :doc:`electron/stopping <fix_electron_stopping>`
|
||||
* :doc:`electron/stopping/fit <fix_electron_stopping>`
|
||||
* :doc:`enforce2d (k) <fix_enforce2d>`
|
||||
@ -213,6 +214,7 @@ OPT.
|
||||
* :doc:`saed/vtk <fix_saed_vtk>`
|
||||
* :doc:`setforce (k) <fix_setforce>`
|
||||
* :doc:`setforce/spin <fix_setforce>`
|
||||
* :doc:`sgcmc <fix_sgcmc>`
|
||||
* :doc:`shake (k) <fix_shake>`
|
||||
* :doc:`shardlow (k) <fix_shardlow>`
|
||||
* :doc:`smd <fix_smd>`
|
||||
@ -249,7 +251,7 @@ OPT.
|
||||
* :doc:`tune/kspace <fix_tune_kspace>`
|
||||
* :doc:`vector <fix_vector>`
|
||||
* :doc:`viscosity <fix_viscosity>`
|
||||
* :doc:`viscous <fix_viscous>`
|
||||
* :doc:`viscous (k) <fix_viscous>`
|
||||
* :doc:`viscous/sphere <fix_viscous_sphere>`
|
||||
* :doc:`wall/body/polygon <fix_wall_body_polygon>`
|
||||
* :doc:`wall/body/polyhedron <fix_wall_body_polyhedron>`
|
||||
|
||||
@ -93,8 +93,8 @@ OPT.
|
||||
* :doc:`coul/wolf/cs <pair_cs>`
|
||||
* :doc:`dpd (giko) <pair_dpd>`
|
||||
* :doc:`dpd/fdt <pair_dpd_fdt>`
|
||||
* :doc:`dpd/ext (k) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext/tstat (k) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext (ko) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext/tstat (ko) <pair_dpd_ext>`
|
||||
* :doc:`dpd/fdt/energy (k) <pair_dpd_fdt>`
|
||||
* :doc:`dpd/tstat (gko) <pair_dpd>`
|
||||
* :doc:`dsmc <pair_dsmc>`
|
||||
@ -237,6 +237,7 @@ OPT.
|
||||
* :doc:`oxrna2/coaxstk <pair_oxrna2>`
|
||||
* :doc:`pace (k) <pair_pace>`
|
||||
* :doc:`pace/extrapolation <pair_pace>`
|
||||
* :doc:`pod <pair_pod>`
|
||||
* :doc:`peri/eps <pair_peri>`
|
||||
* :doc:`peri/lps (o) <pair_peri>`
|
||||
* :doc:`peri/pmb (o) <pair_peri>`
|
||||
|
||||
@ -2,14 +2,17 @@ Removed commands and packages
|
||||
=============================
|
||||
|
||||
This page lists LAMMPS commands and packages that have been removed from
|
||||
the distribution and provides suggestions for alternatives or replacements.
|
||||
LAMMPS has special dummy styles implemented, that will stop LAMMPS and
|
||||
print a suitable error message in most cases, when a style/command is used
|
||||
that has been removed.
|
||||
the distribution and provides suggestions for alternatives or
|
||||
replacements. LAMMPS has special dummy styles implemented, that will
|
||||
stop LAMMPS and print a suitable error message in most cases, when a
|
||||
style/command is used that has been removed or will replace the command
|
||||
with the direct alternative (if available) and print a warning.
|
||||
|
||||
Fix ave/spatial and fix ave/spatial/sphere
|
||||
------------------------------------------
|
||||
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS
|
||||
since they were superseded by the more general and extensible "chunk
|
||||
infrastructure". Here the system is partitioned in one of many possible
|
||||
@ -17,10 +20,23 @@ ways through the :doc:`compute chunk/atom <compute_chunk_atom>` command
|
||||
and then averaging is done using :doc:`fix ave/chunk <fix_ave_chunk>`.
|
||||
Please refer to the :doc:`chunk HOWTO <Howto_chunk>` section for an overview.
|
||||
|
||||
Reset_ids command
|
||||
-----------------
|
||||
Box command
|
||||
-----------
|
||||
|
||||
The reset_ids command has been renamed to :doc:`reset_atom_ids <reset_atom_ids>`.
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *box* command has been removed and the LAMMPS code changed so it won't
|
||||
be needed. If present, LAMMPS will ignore the command and print a warning.
|
||||
|
||||
Reset_ids, reset_atom_ids, reset_mol_ids commands
|
||||
-------------------------------------------------
|
||||
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *reset_ids*, *reset_atom_ids*, and *reset_mol_ids* commands have
|
||||
been folded into the :doc:`reset_atoms <reset_atoms>` command. If
|
||||
present, LAMMPS will replace the commands accordingly and print a
|
||||
warning.
|
||||
|
||||
MEAM package
|
||||
------------
|
||||
@ -30,18 +46,21 @@ The code in the :ref:`MEAM package <PKG-MEAM>` is a translation of the
|
||||
Fortran code of MEAM into C++, which removes several restrictions
|
||||
(e.g. there can be multiple instances in hybrid pair styles) and allows
|
||||
for some optimizations leading to better performance. The pair style
|
||||
:doc:`meam <pair_meam>` has the exact same syntax.
|
||||
:doc:`meam <pair_meam>` has the exact same syntax. For a transition
|
||||
period the C++ version of MEAM was called USER-MEAMC so it could
|
||||
coexist with the Fortran version.
|
||||
|
||||
REAX package
|
||||
------------
|
||||
|
||||
The REAX package has been removed since it was superseded by the
|
||||
:ref:`REAXFF package <PKG-REAXFF>`. The REAXFF
|
||||
package has been tested to yield equivalent results to the REAX package,
|
||||
offers better performance, supports OpenMP multi-threading via OPENMP,
|
||||
and GPU and threading parallelization through KOKKOS. The new pair styles
|
||||
are not syntax compatible with the removed reax pair style, so input
|
||||
files will have to be adapted.
|
||||
:ref:`REAXFF package <PKG-REAXFF>`. The REAXFF package has been tested
|
||||
to yield equivalent results to the REAX package, offers better
|
||||
performance, supports OpenMP multi-threading via OPENMP, and GPU and
|
||||
threading parallelization through KOKKOS. The new pair styles are not
|
||||
syntax compatible with the removed reax pair style, so input files will
|
||||
have to be adapted. The REAXFF package was originally called
|
||||
USER-REAXC.
|
||||
|
||||
USER-CUDA package
|
||||
-----------------
|
||||
@ -60,5 +79,6 @@ restart2data tool
|
||||
The functionality of the restart2data tool has been folded into the
|
||||
LAMMPS executable directly instead of having a separate tool. A
|
||||
combination of the commands :doc:`read_restart <read_restart>` and
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For added
|
||||
convenience this conversion can also be triggered by :doc:`command line flags <Run_options>`
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For
|
||||
added convenience this conversion can also be triggered by
|
||||
:doc:`command line flags <Run_options>`
|
||||
|
||||
@ -23,3 +23,4 @@ of time and requests from the LAMMPS user community.
|
||||
Classes
|
||||
Developer_platform
|
||||
Developer_utils
|
||||
Developer_grid
|
||||
|
||||
@ -50,7 +50,7 @@ parallel each MPI process creates such an instance. This can be seen
|
||||
in the ``main.cpp`` file where the core steps of running a LAMMPS
|
||||
simulation are the following 3 lines of code:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm);
|
||||
lammps->input->file();
|
||||
@ -78,7 +78,7 @@ LAMMPS makes extensive use of the object oriented programming (OOP)
|
||||
principles of *compositing* and *inheritance*. Classes like the
|
||||
``LAMMPS`` class are a **composite** containing pointers to instances
|
||||
of other classes like ``Atom``, ``Comm``, ``Force``, ``Neighbor``,
|
||||
``Modify``, and so on. Each of these classes implement certain
|
||||
``Modify``, and so on. Each of these classes implements certain
|
||||
functionality by storing and manipulating data related to the
|
||||
simulation and providing member functions that trigger certain
|
||||
actions. Some of those classes like ``Force`` are themselves
|
||||
@ -87,9 +87,9 @@ interactions. Similarly the ``Modify`` class contains a list of
|
||||
``Fix`` and ``Compute`` classes. If the input commands that
|
||||
correspond to these classes include the word *style*, then LAMMPS
|
||||
stores only a single instance of that class. E.g. *atom_style*,
|
||||
*comm_style*, *pair_style*, *bond_style*. It the input command does
|
||||
not include the word *style*, there can be many instances of that
|
||||
class defined. E.g. *region*, *fix*, *compute*, *dump*.
|
||||
*comm_style*, *pair_style*, *bond_style*. If the input command does
|
||||
**not** include the word *style*, then there may be many instances of
|
||||
that class defined, for example *region*, *fix*, *compute*, *dump*.
|
||||
|
||||
**Inheritance** enables creation of *derived* classes that can share
|
||||
common functionality in their base class while providing a consistent
|
||||
@ -232,7 +232,7 @@ macro ``PairStyle()`` will associate the style name "lj/cut"
|
||||
with a factory function creating an instance of the ``PairLJCut``
|
||||
class.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
// from force.h
|
||||
typedef Pair *(*PairCreator)(LAMMPS *);
|
||||
@ -360,7 +360,7 @@ characters; "{:<8}" would do this as left aligned, "{:^8}" as centered,
|
||||
argument type must be compatible or else the {fmt} formatting code will
|
||||
throw an exception. Some format string examples are given below:
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c++
|
||||
|
||||
auto mesg = fmt::format(" CPU time: {:4d}:{:02d}:{:02d}\n", cpuh, cpum, cpus);
|
||||
mesg = fmt::format("{:<8s}| {:<10.5g} | {:<10.5g} | {:<10.5g} |{:6.1f} |{:6.2f}\n",
|
||||
|
||||
846
doc/src/Developer_grid.rst
Normal file
846
doc/src/Developer_grid.rst
Normal file
@ -0,0 +1,846 @@
|
||||
Use of distributed grids within style classes
|
||||
---------------------------------------------
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
The LAMMPS source code includes two classes which facilitate the
|
||||
creation and use of distributed grids. These are the Grid2d and
|
||||
Grid3d classes in the src/grid2d.cpp.h and src/grid3d.cpp.h files
|
||||
respectively. As the names imply, they are used for 2d or 3d
|
||||
simulations, as defined by the :doc:`dimension <dimension>` command.
|
||||
|
||||
The :doc:`Howto_grid <Howto_grid>` page gives an overview of how
|
||||
distributed grids are defined from a user perspective, lists LAMMPS
|
||||
commands which use them, and explains how grid cell data is referenced
|
||||
from an input script. Please read that page first as it motivates the
|
||||
coding details discussed here.
|
||||
|
||||
This doc page is for users who wish to write new styles (input script
|
||||
commands) which use distributed grids. There are a variety of
|
||||
material models and analysis methods which use atoms (or
|
||||
coarse-grained particles) and grids in tandem.
|
||||
|
||||
A *distributed* grid means each processor owns a subset of the grid
|
||||
cells. In LAMMPS, the subset for each processor will be a sub-block
|
||||
of grid cells with low and high index bounds in each dimension of the
|
||||
grid. The union of the sub-blocks across all processors is the global
|
||||
grid.
|
||||
|
||||
More specifically, a grid point is defined for each cell (by default
|
||||
the center point), and a processor owns a grid cell if its point is
|
||||
within the processor's spatial sub-domain. The union of processor
|
||||
sub-domains is the global simulation box. If a grid point is on the
|
||||
boundary of two sub-domains, the lower processor owns the grid cell. A
|
||||
processor may also store copies of ghost cells which surround its
|
||||
owned cells.
|
||||
|
||||
----------
|
||||
|
||||
Style commands
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Style commands which can define and use distributed grids include the
|
||||
:doc:`compute <compute>`, :doc:`fix <fix>`, :doc:`pair <pair_style>`,
|
||||
and :doc:`kspace <kspace_style>` styles. If you wish grid cell data
|
||||
to persist across timesteps, then use a fix. If you wish grid cell
|
||||
data to be accessible by other commands, then use a fix or compute.
|
||||
Currently in LAMMPS, the :doc:`pair_style amoeba <pair_amoeba>`,
|
||||
:doc:`kspace_style pppm <kspace_style>`, and :doc:`kspace_style msm
|
||||
<kspace_style>` commands use distributed grids but do not require
|
||||
either of these capabilities; they thus create and use distributed
|
||||
grids internally. Note that a pair style which needs grid cell data
|
||||
to persist could be coded to work in tandem with a fix style which
|
||||
provides that capability.
|
||||
|
||||
The *size* of a grid is specified by the number of grid cells in each
|
||||
dimension of the simulation domain. In any dimension the size can be
|
||||
any value >= 1. Thus a 10x10x1 grid for a 3d simulation is
|
||||
effectively a 2d grid, where each grid cell spans the entire
|
||||
z-dimension. A 1x100x1 grid for a 3d simulation is effectively a 1d
|
||||
grid, where grid cells are a series of thin xz slabs in the
|
||||
y-dimension. It is even possible to define a 1x1x1 3d grid, though it
|
||||
may be inefficient to use it in a computational sense.
|
||||
|
||||
Note that the choice of grid size is independent of the number of
|
||||
processors or their layout in a grid of processor sub-domains which
|
||||
overlays the simulations domain. Depending on the distributed grid
|
||||
size, a single processor may own many 1000s or no grid cells.
|
||||
|
||||
A command can define multiple grids, each of a different size. Each
|
||||
grid is an instantiation of the Grid2d or Grid3d class.
|
||||
|
||||
The command also defines what data it will store for each grid it
|
||||
creates and it allocates the multi-dimensional array(s) needed to
|
||||
store the data. No grid cell data is stored within the Grid2d or
|
||||
Grid3d classes.
|
||||
|
||||
If a single value per grid cell is needed, the data array will have
|
||||
the same dimension as the grid, i.e. a 2d array for a 2d grid,
|
||||
likewise for 3d. If multiple values per grid cell are needed, the
|
||||
data array will have one more dimension than the grid, i.e. a 3d array
|
||||
for a 2d grid, or 4d array for a 3d grid. A command can choose to
|
||||
define multiple data arrays for each grid it defines.
|
||||
|
||||
----------
|
||||
|
||||
Grid data allocation and access
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The simplest way for a command to allocate and access grid cell data
|
||||
is to use the *create_offset()* methods provided by the Memory class.
|
||||
Arguments for these methods can be values returned by the
|
||||
*setup_grid()* method (described below), which define the extent of
|
||||
the grid cells (owned+ghost) the processor owns. These 4 methods
|
||||
allocate memory for 2d (first two) and 3d (second two) grid data. The
|
||||
two methods that end in "_one" allocate an array which stores a single
|
||||
value per grid cell. The two that end in "_multi" allocate an array
|
||||
which stores *Nvalues* per grid cell.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
// single value per cell for a 2d grid = 2d array
|
||||
memory->create2d_offset(data2d_one, nylo_out, nyhi_out,
|
||||
nxlo_out, nxhi_out, "data2d_one");
|
||||
|
||||
// nvalues per cell for a 2d grid = 3d array
|
||||
memory->create3d_offset_last(data2d_multi, nylo_out, nyhi_out,
|
||||
nxlo_out, nxhi_out, nvalues, "data2d_multi");
|
||||
|
||||
// single value per cell for a 3d grid = 3d array
|
||||
memory->create3d_offset(data3d_one, nzlo_out, nzhi_out, nylo_out,
|
||||
nyhi_out, nxlo_out, nxhi_out, "data3d_one");
|
||||
|
||||
// nvalues per cell for a 3d grid = 4d array
|
||||
memory->create4d_offset_last(data3d_multi, nzlo_out, nzhi_out, nylo_out,
|
||||
nyhi_out, nxlo_out, nxhi_out, nvalues,
|
||||
"data3d_multi");
|
||||
|
||||
Note that these multi-dimensional arrays are allocated as contiguous
|
||||
chunks of memory where the x-index of the grid varies fastest, then y,
|
||||
and the z-index slowest. For multiple values per grid cell, the
|
||||
Nvalues are contiguous, so their index varies even faster than the
|
||||
x-index.
|
||||
|
||||
The key point is that the "offset" methods create arrays which are
|
||||
indexed by the range of indices which are the bounds of the sub-block
|
||||
of the global grid owned by this processor. This means loops like
|
||||
these can be written in the caller code to loop over owned grid cells,
|
||||
where the "i" loop bounds are the range of owned grid cells for the
|
||||
processor. These are the bounds returned by the *setup_grid()*
|
||||
method:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
for (int iy = iylo; iy <= iyhi; iy++)
|
||||
for (int ix = ixlo; ix <= ixhi; ix++)
|
||||
data2d_one[iy][ix] = 0.0;
|
||||
|
||||
for (int iy = iylo; iy <= iyhi; iy++)
|
||||
for (int ix = ixlo; ix <= ixhi; ix++)
|
||||
for (int m = 0; m < nvalues; m++)
|
||||
data2d_multi[iy][ix][m] = 0.0;
|
||||
|
||||
for (int iz = izlo; iz <= izhi; iz++)
|
||||
for (int iy = iylo; iy <= iyhi; iy++)
|
||||
for (int ix = ixlo; ix <= ixhi; ix++)
|
||||
data3d_one[iz][iy][ix] = 0.0;
|
||||
|
||||
for (int iz = izlo; iz <= izhi; iz++)
|
||||
for (int iy = iylo; iy <= iyhi; iy++)
|
||||
for (int ix = ixlo; ix <= ixhi; ix++)
|
||||
for (int m = 0; m < nvalues; m++)
|
||||
data3d_multi[iz][iy][ix][m] = 0.0;
|
||||
|
||||
Simply replacing the "i" bounds with "o" bounds, also returned by the
|
||||
*setup_grid()* method, would alter this code to loop over owned+ghost
|
||||
cells (the entire allocated grid).
|
||||
|
||||
----------
|
||||
|
||||
Grid class constructors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following sub-sections describe the public methods of the Grid3d
|
||||
class which a style command can invoke. The Grid2d methods are
|
||||
similar; simply remove arguments which refer to the z-dimension.
|
||||
|
||||
There are 2 constructors which can be used. They differ in the extra
|
||||
i/o xyz lo/hi arguments:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
Grid3d(class LAMMPS *lmp, MPI_Comm gcomm, int gnx, int gny, int gnz)
|
||||
Grid3d(class LAMMPS *lmp, MPI_Comm gcomm, int gnx, int gny, int gnz,
|
||||
int ixlo, int ixhi, int iylo, int iyhi, int izlo, int izhi,
|
||||
int oxlo, int oxhi, int oylo, int oyhi, int ozlo, int ozhi)
|
||||
|
||||
Both constructors take the LAMMPS instance pointer and a communicator
|
||||
over which the grid will be distributed. Typically this is the
|
||||
*world* communicator the LAMMPS instance is using. The
|
||||
:doc:`kspace_style msm <kspace_style>` command creates a series of
|
||||
grids, each of different size, which are partitioned across different
|
||||
sub-communicators of processors. Both constructors are also passed
|
||||
the global grid size: *gnx* by *gny* by *gnz*.
|
||||
|
||||
The first constructor is used when the caller wants the Grid class to
|
||||
partition the global grid across processors; the Grid class defines
|
||||
which grid cells each processor owns and also which it stores as ghost
|
||||
cells. A subsequent call to *setup_grid()*, discussed below, returns
|
||||
this info to the caller.
|
||||
|
||||
The second constructor allows the caller to define the extent of owned
|
||||
and ghost cells, and pass them to the Grid class. The 6 arguments
|
||||
which start with "i" are the inclusive lower and upper index bounds of
|
||||
the owned (inner) grid cells this processor owns in each of the 3
|
||||
dimensions within the global grid. Owned grid cells are indexed from
|
||||
0 to N-1 in each dimension.
|
||||
|
||||
The 6 arguments which start with "o" are the inclusive bounds of the
|
||||
owned+ghost (outer) grid cells it stores. If the ghost cells are on
|
||||
the other side of a periodic boundary, then these indices may be < 0
|
||||
or >= N in any dimension, so that oxlo <= ixlo and ixhi >= ixhi is
|
||||
always the case.
|
||||
|
||||
For example, if Nx = 100, then a processor might pass ixlo=50,
|
||||
ixhi=60, oxlo=48, oxhi=62 to the Grid class. Or ixlo=0, ixhi=10,
|
||||
oxlo=-2, oxhi=13. If a processor owns no grid cells in a dimension,
|
||||
then the ihi value should be specified as one less than the ilo value.
|
||||
|
||||
Note that the only reason to use the second constructor is if the
|
||||
logic for assigning ghost cells is too complex for the Grid class to
|
||||
compute, using the various set() methods described next. Currently
|
||||
only the kspace_style pppm/electrode and kspace_style msm commands use
|
||||
the second constructor.
|
||||
|
||||
----------
|
||||
|
||||
Grid class set methods
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following methods affect how the Grid class computes which owned
|
||||
and ghost cells are assigned to each processor. *Set_shift_grid()* is
|
||||
the only method which influences owned cell assignment; all the rest
|
||||
influence ghost cell assignment. These methods are only used with the
|
||||
first constructor; they are ignored if the second constructor is used.
|
||||
These methods must be called before the *setup_grid()* method is
|
||||
invoked, because they influence its operation.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void set_shift_grid(double shift);
|
||||
void set_distance(double distance);
|
||||
void set_stencil_atom(int lo, int hi);
|
||||
void set_shift_atom(double shift_lo, double shift_hi);
|
||||
void set_stencil_grid(int lo, int hi);
|
||||
void set_zfactor(double factor);
|
||||
|
||||
Processors own a grid cell if a point within the grid cell is inside
|
||||
the processor's sub-domain. By default this is the center point of the
|
||||
grid cell. The *set_shift_grid()* method can change this. The *shift*
|
||||
argument is a value from 0.0 to 1.0 (inclusive) which is the offset of
|
||||
the point within the grid cell in each dimension. The default is 0.5
|
||||
for the center of the cell. A value of 0.0 is the lower left corner
|
||||
point; a value of 1.0 is the upper right corner point. There is
|
||||
typically no need to change the default as it is optimal for
|
||||
minimizing the number of ghost cells needed.
|
||||
|
||||
If a processor maps its particles to grid cells, it needs to allow for
|
||||
its particles being outside its sub-domain between reneighboring. The
|
||||
*distance* argument of the *set_distance()* method sets the furthest
|
||||
distance outside a processor's sub-domain which a particle can move.
|
||||
Typically this is half the neighbor skin distance, assuming
|
||||
reneighboring is done appropriately. This distance is used in
|
||||
determining how many ghost cells a processor needs to store to enable
|
||||
its particles to be mapped to grid cells. The default value is 0.0.
|
||||
|
||||
Some commands, like the :doc:`kspace_style pppm <kspace_style>`
|
||||
command, map values (charge in the case of PPPM) to a stencil of grid
|
||||
cells beyond the grid cell the particle is in. The stencil extent may
|
||||
be different in the low and high directions. The *set_stencil_atom()*
|
||||
method defines the maximum values of those 2 extents, assumed to be
|
||||
the same in each of the 3 dimensions. Both the lo and hi values are
|
||||
specified as positive integers. The default values are both 0.
|
||||
|
||||
Some commands, like the :doc:`kspace_style pppm <kspace_style>`
|
||||
command, shift the position of an atom when mapping it to a grid cell,
|
||||
based on the size of the stencil used to map values to the grid
|
||||
(charge in the case of PPPM). The lo and hi arguments of the
|
||||
*set_shift_atom()* method are the minimum shift in the low direction
|
||||
and the maximum shift in the high direction, assumed to be the same in
|
||||
each of the 3 dimensions. The shifts should be fractions of a grid
|
||||
cell size with values between 0.0 and 1.0 inclusive. The default
|
||||
values are both 0.0. See the src/pppm.cpp file for examples of these
|
||||
lo/hi values for regular and staggered grids.
|
||||
|
||||
Some methods like the :doc:`fix ttm/grid <fix_ttm>` command, perform
|
||||
finite difference kinds of operations on the grid, to diffuse electron
|
||||
heat in the case of the two-temperature model (TTM). This operation
|
||||
uses ghost grid values beyond the owned grid values the processor
|
||||
updates. The *set_stencil_grid()* method defines the extent of this
|
||||
stencil in both directions, assumed to be the same in each of the 3
|
||||
dimensions. Both the lo and hi values are specified as positive
|
||||
integers. The default values are both 0.
|
||||
|
||||
The kspace_style pppm commands allow a grid to be defined which
|
||||
overlays a volume which extends beyond the simulation box in the z
|
||||
dimension. This is for the purpose of modeling a 2d-periodic slab
|
||||
(non-periodic in z) as if it were a larger 3d periodic system,
|
||||
extended (with empty space) in the z dimension. The
|
||||
:doc:`kspace_modify slab <kspace_modify>` command is used to specify
|
||||
the ratio of the larger volume to the simulation volume; a volume
|
||||
ratio of ~3 is typical. For this kind of model, the PPPM caller sets
|
||||
the global grid size *gnz* ~3x larger than it would be otherwise.
|
||||
This same ratio is passed by the PPPM caller as the *factor* argument
|
||||
to the Grid class via the *set_zfactor()* method (*set_yfactor()* for
|
||||
2d grids). The Grid class will then assign ownership of the 1/3 of
|
||||
grid cells that overlay the simulation box to the processors which
|
||||
also overlay the simulation box. The remaining 2/3 of the grid cells
|
||||
are assigned to processors whose sub-domains are adjacent to the upper
|
||||
z boundary of the simulation box.
|
||||
|
||||
----------
|
||||
|
||||
Grid class setup_grid method
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The *setup_grid()* method is called after the first constructor
|
||||
(above) to partition the grid across processors, which determines
|
||||
which grid cells each processor owns. It also calculates how many
|
||||
ghost grid cells in each dimension and each direction each processor
|
||||
needs to store.
|
||||
|
||||
Note that this method is NOT called if the second constructor above is
|
||||
used. In that case, the caller assigns owned and ghost cells to each
|
||||
processor.
|
||||
|
||||
Also note that this method must be invoked after any *set_*()* methods have
|
||||
been used, since they can influence the assignment of owned and ghost
|
||||
cells.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void setup_grid(int &ixlo, int &ixhi, int &iylo, int &iyhi, int &izlo, int &izhi,
|
||||
int &oxlo, int &oxhi, int &oylo, int &oyhi, int &ozlo, int &ozhi)
|
||||
|
||||
The 6 return arguments which start with "i" are the inclusive lower
|
||||
and upper index bounds of the owned (inner) grid cells this processor
|
||||
owns in each of the 3 dimensions within the global grid. Owned grid
|
||||
cells are indexed from 0 to N-1 in each dimension.
|
||||
|
||||
The 6 return arguments which start with "o" are the inclusive bounds of
|
||||
the owned+ghost cells it owns. If the ghost cells are on the other
|
||||
side of a periodic boundary, then these indices may be < 0 or >= N in
|
||||
any dimension, so that oxlo <= ixlo and ixhi >= ixhi is always the
|
||||
case.
|
||||
|
||||
----------
|
||||
|
||||
More grid class set methods
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following 2 methods can be used to override settings made by the
|
||||
constructors above. If used, they must be called called before the
|
||||
*setup_comm()* method is invoked, since it uses the settings that
|
||||
these methods override. In LAMMPS these methods are called by by the
|
||||
:doc:`kspace_style msm <kspace_style>` command for the grids it
|
||||
instantiates using the 2nd constructor above.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void set_proc_neighs(int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi)
|
||||
void set_caller_grid(int fxlo, int fxhi, int fylo, int fyhi, int fzlo, int fzhi)
|
||||
|
||||
The *set_proc_neighs()* method sets the processor IDs of the 6
|
||||
neighboring processors for each processor. Normally these would match
|
||||
the processor grid neighbors which LAMMPS creates to overlay the
|
||||
simulation box (the default). However, MSM excludes non-participating
|
||||
processors from coarse grid communication when less processors are
|
||||
used. This method allows MSM to override the default values.
|
||||
|
||||
The *set_caller_grid()* method species the size of the data arrays the
|
||||
caller allocates. Normally these would match the extent of the ghost
|
||||
grid cells (the default). However the MSM caller allocates a larger
|
||||
data array (more ghost cells) for its finest-level grid, for use in
|
||||
other operations besides owned/ghost cell communication. This method
|
||||
allows MSM to override the default values.
|
||||
|
||||
|
||||
----------
|
||||
|
||||
Grid class get methods
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following methods allow the caller to query the settings for a
|
||||
specific grid, whether it created the grid or another command created
|
||||
it.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void get_size(int &nxgrid, int &nygrid, int &nzgrid);
|
||||
void get_bounds_owned(int &xlo, int &xhi, int &ylo, int &yhi, int &zlo, int &zhi)
|
||||
void get_bounds_ghost(int &xlo, int &xhi, int &ylo, int &yhi, int &zlo, int &zhi)
|
||||
|
||||
The *get_size()* method returns the size of the global grid in each dimension.
|
||||
|
||||
The *get_bounds_owned()* method return the inclusive index bounds of
|
||||
the grid cells this processor owns. The values range from 0 to N-1 in
|
||||
each dimension. These values are the same as the "i" values returned
|
||||
by *setup_grid()*.
|
||||
|
||||
The *get_bounds_ghost()* method return the inclusive index bounds of
|
||||
the owned+ghost grid cells this processor stores. The owned cell
|
||||
indices range from 0 to N-1, so these indices may be less than 0 or
|
||||
greater than or equal to N in each dimension. These values are the
|
||||
same as the "o" values returned by *setup_grid()*.
|
||||
|
||||
----------
|
||||
|
||||
Grid class owned/ghost communication
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If needed by the command, the following methods setup and perform
|
||||
communication of grid data to/from neighboring processors. The
|
||||
*forward_comm()* method sends owned grid cell data to the
|
||||
corresponding ghost grid cells on other processors. The
|
||||
*reverse_comm()* method sends ghost grid cell data to the
|
||||
corresponding owned grid cells on another processor. The caller can
|
||||
choose to sum ghost grid cell data to the owned grid cell or simply
|
||||
copy it.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void setup_comm(int &nbuf1, int &nbuf2)
|
||||
void forward_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype);
|
||||
void reverse_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
int ghost_adjacent();
|
||||
|
||||
The *setup_comm()* method must be called one time before performing
|
||||
*forward* or *reverse* communication (multiple times if needed). It
|
||||
returns two integers, which should be used to allocate two buffers.
|
||||
The *nbuf1* and *nbuf2* values are the number of grid cells whose data
|
||||
will be stored in two buffers by the Grid class when *forward* or
|
||||
*reverse* communication is performed. The caller should thus allocate
|
||||
them to a size large enough to hold all the data used in any single
|
||||
forward or reverse communication operation it performs. Note that the
|
||||
caller may allocate and communicate multiple data arrays for a grid it
|
||||
instantiates. This size includes the bytes needed for the data type
|
||||
of the grid data it stores, e.g. double precision values.
|
||||
|
||||
The *forward_comm()* and *reverse_comm()* methods send grid cell data
|
||||
from owned to ghost cells, or ghost to owned cells, respectively, as
|
||||
described above. The *caller* argument should be one of these values
|
||||
-- Grid3d::COMPUTE, Grid3d::FIX, Grid3d::KSPACE, Grid3d::PAIR --
|
||||
depending on the style of the caller class. The *ptr* argument is the
|
||||
"this" pointer to the caller class. These 2 arguments are used to
|
||||
call back to pack()/unpack() functions in the caller class, as
|
||||
explained below.
|
||||
|
||||
The *which* argument is a flag the caller can set which is passed to
|
||||
the caller's pack()/unpack() methods. This allows a single callback
|
||||
method to pack/unpack data for several different flavors of
|
||||
forward/reverse communication, e.g. operating on different grids or
|
||||
grid data.
|
||||
|
||||
The *nper* argument is the number of values per grid cell to be
|
||||
communicated. The *nbyte* argument is the number of bytes per value,
|
||||
e.g. 8 for double-precision values. The *buf1* and *buf2* arguments
|
||||
are the two allocated buffers described above. So long as they are
|
||||
allocated for the maximum size communication, they can be re-used for
|
||||
any *forward_comm()/reverse_comm()* call. The *datatype* argument is
|
||||
the MPI_Datatype setting, which should match the buffer allocation and
|
||||
the *nbyte* argument. E.g. MPI_DOUBLE for buffers storing double
|
||||
precision values.
|
||||
|
||||
To use the *forward_grid()* method, the caller must provide two
|
||||
callback functions; likewise for use of the *reverse_grid()* methods.
|
||||
These are the 4 functions, their arguments are all the same.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void pack_forward_grid(int which, void *vbuf, int nlist, int *list);
|
||||
void unpack_forward_grid(int which, void *vbuf, int nlist, int *list);
|
||||
void pack_reverse_grid(int which, void *vbuf, int nlist, int *list);
|
||||
void unpack_reverse_grid(int which, void *vbuf, int nlist, int *list);
|
||||
|
||||
The *which* argument is set to the *which* value of the
|
||||
*forward_comm()* or *reverse_comm()* calls. It allows the pack/unpack
|
||||
function to select what data values to pack/unpack. *Vbuf* is the
|
||||
buffer to pack/unpack the data to/from. It is a void pointer so that
|
||||
the caller can cast it to whatever data type it chooses, e.g. double
|
||||
precision values. *Nlist* is the number of grid cells to pack/unpack
|
||||
and *list* is a vector (nlist in length) of offsets to where the data
|
||||
for each grid cell resides in the caller's data arrays, which is best
|
||||
illustrated with an example from the src/EXTRA-FIX/fix_ttm_grid.cpp
|
||||
class which stores the scalar electron temperature for 3d system in a
|
||||
3d grid (one value per grid cell):
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void FixTTMGrid::pack_forward_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *src = &T_electron[nzlo_out][nylo_out][nxlo_out];
|
||||
for (int i = 0; i < nlist; i++) buf[i] = src[list[i]];
|
||||
}
|
||||
|
||||
In this case, the *which* argument is not used, *vbuf* points to a
|
||||
buffer of doubles, and the electron temperature is stored by the
|
||||
FixTTMGrid class in a 3d array of owned+ghost cells called T_electron.
|
||||
That array is allocated by the *memory->create_3d_offset()* method
|
||||
described above so that the first grid cell it stores is indexed as
|
||||
T_electron[nzlo_out][nylo_out][nxlo_out]. The *nlist* values in
|
||||
*list* are integer offsets from that first grid cell. Setting *src*
|
||||
to the address of the first cell allows those offsets to be used to
|
||||
access the temperatures to pack into the buffer.
|
||||
|
||||
Here is a similar portion of code from the src/fix_ave_grid.cpp class
|
||||
which can store two kinds of data, a scalar count of atoms in a grid
|
||||
cell, and one or more grid-cell-averaged atom properties. The code
|
||||
from its *unpack_reverse_grid()* function for 2d grids and multiple
|
||||
per-atom properties per grid cell (*nvalues*) is shown here:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void FixAveGrid::unpack_reverse_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *count,*data,*values;
|
||||
count = &count2d[nylo_out][nxlo_out];
|
||||
data = &array2d[nylo_out][nxlo_out][0];
|
||||
m = 0;
|
||||
for (i = 0; i < nlist; i++) {
|
||||
count[list[i]] += buf[m++];
|
||||
values = &data[nvalues*list[i]];
|
||||
for (j = 0; j < nvalues; j++)
|
||||
values[j] += buf[m++];
|
||||
}
|
||||
}
|
||||
|
||||
Both the count and the multiple values per grid cell are communicated
|
||||
in *vbuf*. Note that *data* is now a pointer to the first value in
|
||||
the first grid cell. And *values* points to where the first value in
|
||||
*data* is for an offset of grid cells, calculated by multiplying
|
||||
*nvalues* by *list[i]*. Finally, because this is reverse
|
||||
communication, the communicated buffer values are summed to the caller
|
||||
values.
|
||||
|
||||
The *ghost_adjacent()* method returns a 1 if every processor can
|
||||
perform the necessary owned/ghost communication with only its nearest
|
||||
neighbor processors (4 in 2d, 6 in 3d). It returns a 0 if any
|
||||
processor's ghost cells extend further than nearest neighbor
|
||||
processors.
|
||||
|
||||
This can be checked by callers who have the option to change the
|
||||
global grid size to insure more efficient nearest-neighbor-only
|
||||
communication if they wish. In this case, they instantiate a grid of
|
||||
a given size (resolution), then invoke *setup_comm()* followed by
|
||||
*ghost_adjacent()*. If the ghost cells are not adjacent, they destroy
|
||||
the grid instance and start over with a higher-resolution grid.
|
||||
Several of the :doc:`kspace_style pppm <kspace_style>` command
|
||||
variants have this option.
|
||||
|
||||
----------
|
||||
|
||||
Grid class remap methods for load balancing
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following methods are used when a load-balancing operation,
|
||||
triggered by the :doc:`balance <balance>` or :doc:`fix balance
|
||||
<fix_balance>` commands, changes the partitioning of the simulation
|
||||
domain into processor sub-domains.
|
||||
|
||||
In order to work with load-balancing, any style command (compute, fix,
|
||||
pair, or kspace style) which allocates a grid and stores per-grid data
|
||||
should define a *reset_grid()* method; it takes no arguments. It will
|
||||
be called by the two balance commands after they have reset processor
|
||||
sub-domains and migrated atoms (particles) to new owning processors.
|
||||
The *reset_grid()* method will typically perform some or all of the
|
||||
following operations. See the src/fix_ave_grid.cpp and
|
||||
src/EXTRA_FIX/fix_ttm_grid.cpp files for examples of *reset_grid()*
|
||||
methods, as well as the *pack_remap_grid()* and *unpack_remap_grid()*
|
||||
functions.
|
||||
|
||||
First, the *reset_grid()* method can instantiate new grid(s) of the
|
||||
same global size, then call *setup_grid()* to partition them via the
|
||||
new processor sub-domains. At this point, it can invoke the
|
||||
*identical()* method which compares the owned and ghost grid cell
|
||||
index bounds between two grids, the old grid passed as a pointer
|
||||
argument, and the new grid whose *identical()* method is being called.
|
||||
It returns 1 if the indices match on all processors, otherwise 0. If
|
||||
they all match, then the new grids can be deleted; the command can
|
||||
continue to use the old grids.
|
||||
|
||||
If not, then the command should allocate new grid data array(s) which
|
||||
depend on the new partitioning. If the command does not need to
|
||||
persist its grid data from the old partitioning to the new one, then
|
||||
the command can simply delete the old data array(s) and grid
|
||||
instance(s). It can then return.
|
||||
|
||||
If the grid data does need to persist, then the data for each grid
|
||||
needs to be "remapped" from the old grid partitioning to the new grid
|
||||
partitioning. The *setup_remap()* and *remap()* methods are used for
|
||||
that purpose.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int identical(Grid3d *old);
|
||||
void setup_remap(Grid3d *old, int &nremap_buf1, int &nremap_buf2)
|
||||
void remap(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
|
||||
The arguments to these methods are identical to those for
|
||||
the *setup_comm()* and *forward_comm()* or *reverse_comm()* methods.
|
||||
However the returned *nremap_buf1* and *nremap2_buf* values will be
|
||||
different than the *nbuf1* and *nbuf2* values. They should be used to
|
||||
allocate two different remap buffers, separate from the owned/ghost
|
||||
communication buffers.
|
||||
|
||||
To use the *remap()* method, the caller must provide two
|
||||
callback functions:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void pack_remap_grid(int which, void *vbuf, int nlist, int *list);
|
||||
void unpack_remap_grid(int which, void *vbuf, int list, int *list);
|
||||
|
||||
Their arguments are identical to those for the *pack_forward_grid()*
|
||||
and *unpack_forward_grid()* callback functions (or the reverse
|
||||
variants) discussed above. Normally, both these methods pack/unpack
|
||||
all the data arrays for a given grid. The *which* argument of the
|
||||
*remap()* method sets the *which* value for the pack/unpack functions.
|
||||
If the command instantiates multiple grids (of different sizes), it
|
||||
can be used within the pack/unpack methods to select which grid's data
|
||||
is being remapped.
|
||||
|
||||
Note that the *pack_remap_grid()* function must copy values from the
|
||||
OLD grid data arrays into the *vbuf* buffer. The *unpack_remap_grid()*
|
||||
function must copy values from the *vbuf* buffer into the NEW grid
|
||||
data arrays.
|
||||
|
||||
After the remap operation for grid cell data has been performed, the
|
||||
*reset_grid()* method can deallocate the two remap buffers it created,
|
||||
and can then exit.
|
||||
|
||||
----------
|
||||
|
||||
Grid class I/O methods
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
There are two I/O methods in the Grid classes which can be used to
|
||||
read and write grid cell data to files. The caller can decide on the
|
||||
precise format of each file, e.g. whether header lines are prepended
|
||||
or comment lines are allowed. Fundamentally, the file should contain
|
||||
one line per grid cell for the entire global grid. Each line should
|
||||
contain identifying info as to which grid cell it is, e.g. a unique
|
||||
grid cell ID or the ix,iy,iz indices of the cell within a 3d grid.
|
||||
The line should also contain one or more data values which are stored
|
||||
within the grid data arrays created by the command
|
||||
|
||||
For grid cell IDs, the LAMMPS convention is that the IDs run from 1 to
|
||||
N, where N = Nx * Ny for 2d grids and N = Nx * Ny * Nz for 3d grids.
|
||||
The x-index of the grid cell varies fastest, then y, and the z-index
|
||||
varies slowest. So for a 10x10x10 grid the cell IDs from 901-1000
|
||||
would be in the top xy layer of the z dimension.
|
||||
|
||||
The *read_file()* method does something simple. It reads a chunk of
|
||||
consecutive lines from the file and passes them back to the caller to
|
||||
process. The caller provides a *unpack_read_grid()* function for this
|
||||
purpose. The function checks the grid cell ID or indices and only
|
||||
stores grid cell data for the grid cells it owns.
|
||||
|
||||
The *write_file()* method does something slightly more complex. Each
|
||||
processor packs the data for its owned grid cells into a buffer. The
|
||||
caller provides a *pack_write_grid()* function for this purpose. The
|
||||
*write_file()* method then loops over all processors and each sends
|
||||
its buffer one at a time to processor 0, along with the 3d (or 2d)
|
||||
index bounds of its grid cell data within the global grid. Processor
|
||||
0 calls back to the *unpack_write_grid()* function provided by the
|
||||
caller with the buffer. The function writes one line per grid cell to
|
||||
the file.
|
||||
|
||||
See the src/EXTRA_FIX/fix_ttm_grid.cpp file for examples of now both
|
||||
these methods are used to read/write electron temperature values
|
||||
from/to a file, as well as for implementations of the the pack/unpack
|
||||
functions described below.
|
||||
|
||||
Here are the details of the two I/O methods and the 3 callback
|
||||
functions. See the src/fix_ave_grid.cpp file for examples of all of
|
||||
them.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
void read_file(int caller, void *ptr, FILE *fp, int nchunk, int maxline)
|
||||
void write_file(int caller, void *ptr, int which,
|
||||
int nper, int nbyte, MPI_Datatype datatype
|
||||
|
||||
The *caller* argument in both methods should be one of these values --
|
||||
Grid3d::COMPUTE, Grid3d::FIX, Grid3d::KSPACE, Grid3d::PAIR --
|
||||
depending on the style of the caller class. The *ptr* argument in
|
||||
both methods is the "this" pointer to the caller class. These 2
|
||||
arguments are used to call back to pack()/unpack() functions in the
|
||||
caller class, as explained below.
|
||||
|
||||
For the *read_file()* method, the *fp* argument is a file pointer to
|
||||
the file to be read from, opened on processor 0 by the caller.
|
||||
*Nchunk* is the number of lines to read per chunk, and *maxline* is
|
||||
the maximum number of characters per line. The Grid class will
|
||||
allocate a buffer for storing chunks of lines based on these values.
|
||||
|
||||
For the *write_file()* method, the *which* argument is a flag the
|
||||
caller can set which is passed back to the caller's pack()/unpack()
|
||||
methods. If the command instantiates multiple grids (of different
|
||||
sizes), this flag can be used within the pack/unpack methods to select
|
||||
which grid's data is being written out (presumably to different
|
||||
files). the *nper* argument is the number of values per grid cell to
|
||||
be written out. The *nbyte* argument is the number of bytes per
|
||||
value, e.g. 8 for double-precision values. The *datatype* argument is
|
||||
the MPI_Datatype setting, which should match the *nbyte* argument.
|
||||
E.g. MPI_DOUBLE for double precision values.
|
||||
|
||||
To use the *read_grid()* method, the caller must provide one callback
|
||||
function. To use the *write_grid()* method, it provides two callback
|
||||
functions:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int unpack_read_grid(int nlines, char *buffer)
|
||||
void pack_write_grid(int which, void *vbuf)
|
||||
void unpack_write_grid(int which, void *vbuf, int *bounds)
|
||||
|
||||
For *unpack_read_grid()* the *nlines* argument is the number of lines
|
||||
of character data read from the file and contained in *buffer*. The
|
||||
lines each include a newline character at the end. When the function
|
||||
processes the lines, it may choose to skip some of them (header or
|
||||
comment lines). It returns an integer count of the number of grid
|
||||
cell lines it processed. This enables the Grid class *read_file()*
|
||||
method to know when it has read the correct number of lines.
|
||||
|
||||
For *pack_write_grid()* and *unpack_write_grid()*, the *vbuf* argument
|
||||
is the buffer to pack/unpack data to/from. It is a void pointer so
|
||||
that the caller can cast it to whatever data type it chooses,
|
||||
e.g. double precision values. the *which* argument is set to the
|
||||
*which* value of the *write_file()* method. It allows the caller to
|
||||
choose which grid data to operate on.
|
||||
|
||||
For *unpack_write_grid()*, the *bounds* argument is a vector of 4 or 6
|
||||
integer grid indices (4 for 2d, 6 for 3d). They are the
|
||||
xlo,xhi,ylo,yhi,zlo,zhi index bounds of the portion of the global grid
|
||||
which the *vbuf* holds owned grid cell data values for. The caller
|
||||
should loop over the values in *vbuf* with a double loop (2d) or
|
||||
triple loop (3d), similar to the code snippets listed above. The
|
||||
x-index varies fastest, then y, and the z-index slowest. If there are
|
||||
multiple values per grid cell, the index for those values varies
|
||||
fastest of all. The caller can add the x,y,z indices of the grid cell
|
||||
(or the corresponding grid cell ID) to the data value(s) written as
|
||||
one line to the output file.
|
||||
|
||||
----------
|
||||
|
||||
Style class grid access methods
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A style command can enable its grid cell data to be accessible from
|
||||
other commands. For example :doc:`fix ave/grid <fix_ave_grid>` or
|
||||
:doc:`dump grid <dump>` or :doc:`dump grid/vtk <dump>`. Those
|
||||
commands access the grid cell data by using a *grid reference* in
|
||||
their input script syntax, as described on the :doc:`Howto_grid
|
||||
<Howto_grid>` doc page. They look like this:
|
||||
|
||||
* c_ID:gname:dname
|
||||
* c_ID:gname:dname[I]
|
||||
* f_ID:gname:dname
|
||||
* f_ID:gname:dname[I]
|
||||
|
||||
Each grid a command instantiates has a unique *gname*, defined by the
|
||||
command. Likewise each grid cell data structure (scalar or vector)
|
||||
associated with a grid has a unique *dname*, also defined by the
|
||||
command.
|
||||
|
||||
To provide access to its grid cell data, a style command needs to
|
||||
implement the following 4 methods:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int get_grid_by_name(const std::string &name, int &dim);
|
||||
void *get_grid_by_index(int index);
|
||||
int get_griddata_by_name(int igrid, const std::string &name, int &ncol);
|
||||
void *get_griddata_by_index(int index);
|
||||
|
||||
Currently only computes and fixes can implement these methods. If it
|
||||
does so, the compute of fix should also set the variable
|
||||
*pergrid_flag* to 1. See any of the compute or fix commands which set
|
||||
"pergrid_flag = 1" for examples of how these 4 functions can be
|
||||
implemented.
|
||||
|
||||
The *get_grid_by_name()* method takes a grid name as input and returns
|
||||
two values. The *dim* argument is returned as 2 or 3 for the
|
||||
dimensionality of the grid. The function return is a grid index from
|
||||
0 to G-1 where *G* is the number of grids the command instantiates. A
|
||||
value of -1 is returned if the grid name is not recognized.
|
||||
|
||||
The *get_grid_by_index()* method is called after the
|
||||
*get_grid_by_name()* method, using the grid index it returned as its
|
||||
argument. This method will return a pointer to the Grid2d or Grid3d
|
||||
class. The caller can use this to query grid attributes, such as the
|
||||
global size of the grid. The :doc:`dump grid <dump>` to insure each
|
||||
its grid reference arguments are for grids of the same size.
|
||||
|
||||
The *get_griddata_by_name()* method takes a grid index *igrid* and a
|
||||
data name as input. It returns two values. The *ncol* argument is
|
||||
returned as a 0 if the grid data is a single value (scalar) per grid
|
||||
cell, or an integer M > 0 if there are M values (vector) per grid
|
||||
cell. Note that even if M = 1, it is still a 1-length vector, not a
|
||||
scalar. The function return is a data index from 0 to D-1 where *D*
|
||||
is the number of data sets associated with that grid by the command.
|
||||
A value of -1 is returned if the data name is not recognized.
|
||||
|
||||
The *get_griddata_by_index()* method is called after the
|
||||
*get_griddata_by_name()* method, using the data index it returned as
|
||||
its argument. This method will return a pointer to the
|
||||
multi-dimensional array which stores the requested data.
|
||||
|
||||
As in the discussion above of the Memory class *create_offset()*
|
||||
methods, the dimensionality of the array associated with the returned
|
||||
pointer depends on whether it is a 2d or 3d grid and whether there is
|
||||
a single or multiple values stored for each grid cell:
|
||||
|
||||
* single value per cell for a 2d grid = 2d array pointer
|
||||
* multiple values per cell for a 2d grid = 3d array pointer
|
||||
* single value per cell for a 3d grid = 3d array pointer
|
||||
* multiple values per cell for a 3d grid = 4d array pointer
|
||||
|
||||
The caller will typically access the data by casting the void pointer
|
||||
to the corresponding array pointer and using nested loops in x,y,z
|
||||
between owned or ghost index bounds returned by the
|
||||
*get_bounds_owned()* or *get_bounds_ghost()* methods to index into the
|
||||
array. Example code snippets with this logic were listed above,
|
||||
|
||||
----------
|
||||
|
||||
Final notes
|
||||
^^^^^^^^^^^
|
||||
|
||||
Finally, here are some additional issues to pay attention to for
|
||||
writing any style command which uses distributed grids via the Grid2d
|
||||
or Grid3d class.
|
||||
|
||||
The command destructor should delete all instances of the Grid class,
|
||||
any buffers it allocated for forward/reverse or remap communication,
|
||||
and any data arrays it allocated to store grid cell data.
|
||||
|
||||
If a command is intended to work for either 2d or 3d simulations, then
|
||||
it should have logic to instantiate either 2d or 3d grids and their
|
||||
associated data arrays, depending on the dimension of the simulation
|
||||
box. The :doc:`fix ave/grid <fix_ave_grid>` command is an example of
|
||||
such a command.
|
||||
|
||||
When a command maps its particles to the grid and updates grid cell
|
||||
values, it should check that it is not updating or accessing a grid
|
||||
cell value outside the range of its owned+ghost cells, and generate an
|
||||
error message if that is the case. This could happen, for example, if
|
||||
a particle has moved further than half the neighbor skin distance,
|
||||
because the neighbor list update criterion are not adequate to prevent
|
||||
it from happening. See the src/KSPACE/pppm.cpp file and its
|
||||
*particle_map()* method for an example of this kind of error check.
|
||||
@ -105,7 +105,7 @@ list, where each pair of atoms is listed only once (except when the
|
||||
pairs straddling sub-domains or periodic boundaries will be listed twice).
|
||||
Thus these are the default settings when a neighbor list request is created in:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void Pair::init_style()
|
||||
{
|
||||
@ -129,7 +129,7 @@ neighbor list request to the specific needs of a style an additional
|
||||
request flag is needed. The :doc:`tersoff <pair_tersoff>` pair style,
|
||||
for example, needs a "full" neighbor list:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairTersoff::init_style()
|
||||
{
|
||||
@ -141,7 +141,7 @@ When a pair style supports r-RESPA time integration with different cutoff region
|
||||
the request flag may depend on the corresponding r-RESPA settings. Here an example
|
||||
from pair style lj/cut:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairLJCut::init_style()
|
||||
{
|
||||
@ -160,7 +160,7 @@ Granular pair styles need neighbor lists based on particle sizes and not cutoff
|
||||
and also may require to have the list of previous neighbors available ("history").
|
||||
For example with:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY);
|
||||
else neighbor->add_request(this, NeighConst::REQ_SIZE);
|
||||
@ -170,7 +170,7 @@ settings each request can set an id which is then used in the corresponding
|
||||
``init_list()`` function to assign it to the suitable pointer variable. This is
|
||||
done for example by the :doc:`pair style meam <pair_meam>`:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairMEAM::init_style()
|
||||
{
|
||||
@ -189,7 +189,7 @@ just once) and this can also be indicated by a flag. As an example here
|
||||
is the request from the ``FixPeriNeigh`` class which is created
|
||||
internally by :doc:`Peridynamics pair styles <pair_peri>`:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
@ -198,7 +198,7 @@ than what is usually inferred from the pair style settings (largest cutoff of
|
||||
all pair styles plus neighbor list skin). The following is used in the
|
||||
:doc:`compute rdf <compute_rdf>` command implementation:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (cutflag)
|
||||
neighbor->add_request(this, NeighConst::REQ_OCCASIONAL)->set_cutoff(mycutneigh);
|
||||
@ -212,7 +212,7 @@ for printing the neighbor list summary the name of the requesting command
|
||||
should be set. Below is the request from the :doc:`delete atoms <delete_atoms>`
|
||||
command:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
neighbor->add_request(this, "delete_atoms", NeighConst::REQ_FULL);
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
@ -141,7 +141,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
@ -176,7 +176,7 @@ demonstrated in the following example, which also shows that the
|
||||
implementation of the plugin class may be within the same source
|
||||
file as the plugin interface code:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ macro. These tests operate by capturing the screen output when executing
|
||||
the failing command and then comparing that with a provided regular
|
||||
expression string pattern. Example:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
TEST_F(SimpleCommandsTest, UnknownCommand)
|
||||
{
|
||||
@ -226,9 +226,9 @@ The following test programs are currently available:
|
||||
* - ``test_kim_commands.cpp``
|
||||
- KimCommands
|
||||
- Tests for several commands from the :ref:`KIM package <PKG-KIM>`
|
||||
* - ``test_reset_ids.cpp``
|
||||
- ResetIDs
|
||||
- Tests to validate the :doc:`reset_atom_ids <reset_atom_ids>` and :doc:`reset_mol_ids <reset_mol_ids>` commands
|
||||
* - ``test_reset_atoms.cpp``
|
||||
- ResetAtoms
|
||||
- Tests to validate the :doc:`reset_atoms <reset_atoms>` sub-commands
|
||||
|
||||
|
||||
Tests for the C-style library interface
|
||||
@ -249,7 +249,7 @@ MPI support. These include tests where LAMMPS is run in multi-partition
|
||||
mode or only on a subset of the MPI world communicator. The CMake
|
||||
script code for adding this kind of test looks like this:
|
||||
|
||||
.. code-block:: CMake
|
||||
.. code-block:: cmake
|
||||
|
||||
if (BUILD_MPI)
|
||||
add_executable(test_library_mpi test_library_mpi.cpp)
|
||||
|
||||
@ -25,6 +25,7 @@ Available topics in mostly chronological order are:
|
||||
- `Simplified and more compact neighbor list requests`_
|
||||
- `Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM`_
|
||||
- `Use Output::get_dump_by_id() instead of Output::find_dump()`_
|
||||
- `Refactored grid communication using Grid3d/Grid2d classes instead of GridComm`_
|
||||
|
||||
----
|
||||
|
||||
@ -61,7 +62,7 @@ header file needs to be updated accordingly.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int PairEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
||||
{
|
||||
@ -75,7 +76,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int PairEAM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
||||
{
|
||||
@ -112,14 +113,14 @@ Example from a pair style:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (eflag || vflag) ev_setup(eflag, vflag);
|
||||
else evflag = vflag_fdotr = eflag_global = eflag_atom = 0;
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
@ -142,14 +143,14 @@ when they are called from only one or a subset of the MPI processes.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
val = force->numeric(FLERR, arg[1]);
|
||||
num = force->inumeric(FLERR, arg[2]);
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
val = utils::numeric(FLERR, true, arg[1], lmp);
|
||||
num = utils::inumeric(FLERR, false, arg[2], lmp);
|
||||
@ -183,14 +184,14 @@ copy them around for simulations.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
fp = force->open_potential(filename);
|
||||
fp = fopen(filename, "r");
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
fp = utils::open_potential(filename, lmp);
|
||||
|
||||
@ -207,7 +208,7 @@ Example:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (fptr == NULL) {
|
||||
char str[128];
|
||||
@ -217,7 +218,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (fptr == nullptr)
|
||||
error->one(FLERR, "Cannot open AEAM potential file {}: {}", filename, utils::getsyserror());
|
||||
@ -237,7 +238,7 @@ an example from the ``FixWallReflect`` class:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixWallReflect(class LAMMPS *, int, char **);
|
||||
virtual ~FixWallReflect();
|
||||
@ -247,7 +248,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixWallReflect(class LAMMPS *, int, char **);
|
||||
~FixWallReflect() override;
|
||||
@ -271,7 +272,7 @@ the type of the "this" pointer argument.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
comm->forward_comm_pair(this);
|
||||
comm->forward_comm_fix(this);
|
||||
@ -284,7 +285,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
comm->forward_comm(this);
|
||||
comm->reverse_comm(this);
|
||||
@ -304,7 +305,7 @@ requests can be :doc:`found here <Developer_notes>`. Example from the
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
@ -317,7 +318,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL);
|
||||
if (cutflag) req->set_cutoff(mycutneigh);
|
||||
@ -340,7 +341,7 @@ these are internal fixes, there is no user visible change.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store.h"
|
||||
|
||||
@ -351,7 +352,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store_peratom.h"
|
||||
|
||||
@ -362,7 +363,7 @@ New:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store.h"
|
||||
|
||||
@ -373,7 +374,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store_global.h"
|
||||
|
||||
@ -396,7 +397,7 @@ the dump directly. Example:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int idump = output->find_dump(arg[iarg+1]);
|
||||
if (idump < 0)
|
||||
@ -412,7 +413,7 @@ Old:
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
auto idump = output->get_dump_by_id(arg[iarg+1]);
|
||||
if (!idump) error->all(FLERR,"Dump ID {} in hyper command does not exist", arg[iarg+1]);
|
||||
@ -423,3 +424,56 @@ New:
|
||||
if (dumpflag) for (auto idump : dumplist) idump->write();
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
Refactored grid communication using Grid3d/Grid2d classes instead of GridComm
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 22Dec2022
|
||||
|
||||
The ``GridComm`` class was for creating and communicating distributed
|
||||
grids was replaced by the ``Grid3d`` class with added functionality.
|
||||
A ``Grid2d`` class was also added for additional flexibility.
|
||||
|
||||
The new functionality and commands using the two grid classes are
|
||||
discussed on the following documentation pages:
|
||||
|
||||
- :doc:`Howto_grid`
|
||||
- :doc:`Developer_grid`
|
||||
|
||||
If you have custom LAMMPS code, which uses the GridComm class, here are some notes
|
||||
on how to adapt it for using the Grid3d class.
|
||||
|
||||
(1) The constructor has changed to allow the ``Grid3d`` / ``Grid2d``
|
||||
classes to partition the global grid across processors, both for
|
||||
owned and ghost grid cells. Previously any class which called
|
||||
``GridComm`` performed the partitioning itself and that information
|
||||
was passed in the ``GridComm::GridComm()`` constructor. There are
|
||||
several "set" functions which can be called to alter how ``Grid3d``
|
||||
/ ``Grid2d`` perform the partitioning. They should be sufficient
|
||||
for most use cases of the grid classes.
|
||||
|
||||
(2) The partitioning is triggered by the ``setup_grid()`` method.
|
||||
|
||||
(3) The ``setup()`` method of the ``GridComm`` class has been replaced
|
||||
by the ``setup_comm()`` method in the new grid classes. The syntax
|
||||
for the ``forward_comm()`` and ``reverse_comm()`` methods is
|
||||
slightly altered as is the syntax of the associated pack/unpack
|
||||
callback methods. But the functionality of these operations is the
|
||||
same as before.
|
||||
|
||||
(4) The new ``Grid3d`` / ``Grid2d`` classes have additional
|
||||
functionality for dynamic load-balancing of grids and their
|
||||
associated data across processors. This did not exist in the
|
||||
``GridComm`` class.
|
||||
|
||||
This and more is explained in detail on the :doc:`Developer_grid` page.
|
||||
The following LAMMPS source files can be used as illustrative examples
|
||||
for how the new grid classes are used by computes, fixes, and various
|
||||
KSpace solvers which use distributed FFT grids:
|
||||
|
||||
- ``src/fix_ave_grid.cpp``
|
||||
- ``src/compute_property_grid.cpp``
|
||||
- ``src/EXTRA-FIX/fix_ttm_grid.cpp``
|
||||
- ``src/KSPACE/pppm.cpp``
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
@ -133,6 +133,9 @@ and parsing files or arguments.
|
||||
.. doxygenfunction:: trim_comment
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strip_style_suffix
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: star_subst
|
||||
:project: progguide
|
||||
|
||||
@ -211,6 +214,9 @@ Argument processing
|
||||
.. doxygenfunction:: expand_args
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: parse_grid_id
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: expand_type
|
||||
:project: progguide
|
||||
|
||||
@ -317,7 +323,7 @@ are all "whitespace" characters, i.e. the space character, the tabulator
|
||||
character, the carriage return character, the linefeed character, and
|
||||
the form feed character.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Tokenizer class example listing entries of the PATH environment variable
|
||||
|
||||
#include "tokenizer.h"
|
||||
@ -349,7 +355,7 @@ tokenizer into a ``try`` / ``catch`` block to handle errors. The
|
||||
when a (type of) number is requested as next token that is not
|
||||
compatible with the string representing the next word.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: ValueTokenizer class example with exception handling
|
||||
|
||||
#include "tokenizer.h"
|
||||
@ -427,7 +433,7 @@ one or two array indices "[<number>]" with numbers > 0.
|
||||
|
||||
A typical code segment would look like this:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Usage example for ArgInfo class
|
||||
|
||||
int nvalues = 0;
|
||||
@ -476,7 +482,7 @@ open the file, and will call the :cpp:class:`LAMMPS_NS::Error` class in
|
||||
case of failures to read or to convert numbers, so that LAMMPS will be
|
||||
aborted.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Use of PotentialFileReader class in pair style coul/streitz
|
||||
|
||||
PotentialFileReader reader(lmp, file, "coul/streitz");
|
||||
@ -555,7 +561,7 @@ chunk size needs to be known in advance, 2) with :cpp:func:`MyPage::vget()
|
||||
its size is registered later with :cpp:func:`MyPage::vgot()
|
||||
<LAMMPS_NS::MyPage::vgot>`.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Example of using :cpp:class:`MyPage <LAMMPS_NS::MyPage>`
|
||||
|
||||
#include "my_page.h"
|
||||
|
||||
@ -26,7 +26,7 @@ constructor with the signature: ``FixPrintVel(class LAMMPS *, int, char **)``.
|
||||
Every fix must be registered in LAMMPS by writing the following lines
|
||||
of code in the header before include guards:
|
||||
|
||||
.. code-block:: c
|
||||
.. code-block:: c++
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
// clang-format off
|
||||
@ -47,7 +47,7 @@ keyword when it parses the input script.
|
||||
Let's write a simple fix which will print the average velocity at the end
|
||||
of each timestep. First of all, implement a constructor:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg)
|
||||
: Fix(lmp, narg, arg)
|
||||
@ -72,7 +72,7 @@ in the Fix class called ``nevery`` which specifies how often the method
|
||||
|
||||
The next method we need to implement is ``setmask()``:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int FixPrintVel::setmask()
|
||||
{
|
||||
@ -87,7 +87,7 @@ during execution. The constant ``END_OF_STEP`` corresponds to the
|
||||
are called during a timestep and the order in which they are called
|
||||
are shown in the previous section.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void FixPrintVel::end_of_step()
|
||||
{
|
||||
@ -143,7 +143,7 @@ The group membership information of an atom is contained in the *mask*
|
||||
property of and atom and the bit corresponding to a given group is
|
||||
stored in the groupbit variable which is defined in Fix base class:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
if (atom->mask[i] & groupbit) {
|
||||
@ -174,7 +174,7 @@ to store positions of atoms from previous timestep, we need to add
|
||||
``double** xold`` to the header file. Than add allocation code
|
||||
to the constructor:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixSavePos::FixSavePos(LAMMPS *lmp, int narg, char **arg), xold(nullptr)
|
||||
{
|
||||
@ -190,7 +190,7 @@ to the constructor:
|
||||
|
||||
Implement the aforementioned methods:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
double FixSavePos::memory_usage()
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,7 @@ Analysis howto
|
||||
|
||||
Howto_output
|
||||
Howto_chunk
|
||||
Howto_grid
|
||||
Howto_temperature
|
||||
Howto_elastic
|
||||
Howto_kappa
|
||||
|
||||
102
doc/src/Howto_grid.rst
Normal file
102
doc/src/Howto_grid.rst
Normal file
@ -0,0 +1,102 @@
|
||||
Using distributed grids
|
||||
=======================
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
LAMMPS has internal capabilities to create uniformly spaced grids
|
||||
which overlay the simulation domain. For 2d and 3d simulations these
|
||||
are 2d and 3d grids respectively. Conceptually a grid can be thought
|
||||
of as a collection of grid cells. Each grid cell can store one or
|
||||
more values (data).
|
||||
|
||||
The grid cells and data they store are distributed across processors.
|
||||
Each processor owns the grid cells (and data) whose center points lie
|
||||
within the spatial sub-domain of the processor. If needed for its
|
||||
computations, a processor may also store ghost grid cells with their
|
||||
data.
|
||||
|
||||
Distributed grids can overlay orthogonal or triclinic simulation
|
||||
boxes; see the :doc:`Howto triclinic <Howto_triclinic>` doc page for
|
||||
an explanation of the latter. For a triclinic box, the grid cell
|
||||
shape conforms to the shape of the simulation domain,
|
||||
e.g. parallelograms instead of rectangles in 2d.
|
||||
|
||||
If the box size or shape changes during a simulation, the grid changes
|
||||
with it, so that it always overlays the entire simulation domain. For
|
||||
non-periodic dimensions, the grid size in that dimension matches the
|
||||
box size, as set by the :doc:`boundary <boundary>` command for fixed
|
||||
or shrink-wrapped boundaries.
|
||||
|
||||
If load-balancing is invoked by the :doc:`balance <balance>` or
|
||||
:doc:`fix balance <fix_balance>` commands, then the sub-domain owned
|
||||
by a processor can change which may also change which grid cells they
|
||||
own.
|
||||
|
||||
Post-processing and visualization of grid cell data can be enabled by
|
||||
the :doc:`dump grid <dump>`, :doc:`dump grid/vtk <dump>`, and
|
||||
:doc:`dump image <dump_image>` commands. The latter has an optional
|
||||
*grid* keyword. The `OVITO visualization tool
|
||||
<https://www.ovito.org>`_ also plans (as of Nov 2022) to add support
|
||||
for visualizing grid cell data (along with atoms) using :doc:`dump
|
||||
grid <dump>` output files as input.
|
||||
|
||||
.. note::
|
||||
|
||||
For developers, distributed grids are implemented within the code via
|
||||
two classes: Grid2d and Grid3d. These partition the grid across
|
||||
processors and have methods which allow forward and reverse
|
||||
communication of ghost grid data as well as load balancing. If you
|
||||
write a new compute or fix which needs a distributed grid, these are
|
||||
the classes to look at. A new pair style could use a distributed
|
||||
grid by having a fix define it. Please see the section on
|
||||
:doc:`using distributed grids within style classes <Developer_grid>`
|
||||
for a detailed description.
|
||||
|
||||
----------
|
||||
|
||||
These are the commands which currently define or use distributed
|
||||
grids:
|
||||
|
||||
* :doc:`fix ttm/grid <fix_ttm>` - store electron temperature on grid
|
||||
* :doc:`fix ave/grid <fix_ave_grid>` - time average per-atom or per-grid values
|
||||
* :doc:`compute property/grid <compute_property_grid>` - generate grid IDs and coords
|
||||
* :doc:`dump grid <dump>` - output per-grid values in LAMMPS format
|
||||
* :doc:`dump grid/vtk <dump>` - output per-grid values in VTK format
|
||||
* :doc:`dump image grid <dump_image>` - include colored grid in output images
|
||||
* :doc:`pair_style amoeba <pair_amoeba>` - FFT grids
|
||||
* :doc:`kspace_style pppm <kspace_style>` (and variants) - FFT grids
|
||||
* :doc:`kspace_style msm <kspace_style>` (and variants) - MSM grids
|
||||
|
||||
The grids used by the :doc:`kspace_style <kspace_style>` can not be
|
||||
referenced by an input script. However the grids and data created and
|
||||
used by the other commands can be.
|
||||
|
||||
A compute or fix command may create one or more grids (of different
|
||||
sizes). Each grid can store one or more data fields. A data field
|
||||
can be a single value per grid point (per-grid vector) or multiple
|
||||
values per grid point (per-grid array). See the :doc:`Howto output
|
||||
<Howto_output>` doc page for an explanation of how per-grid data can
|
||||
be generated by some commands and used by other commands.
|
||||
|
||||
A command accesses grid data from a compute or fix using a *grid
|
||||
reference* with the following syntax:
|
||||
|
||||
* c_ID:gname:dname
|
||||
* c_ID:gname:dname[I]
|
||||
* f_ID:gname:dname
|
||||
* f_ID:gname:dname[I]
|
||||
|
||||
The prefix "c\_" or "f\_" refers to the ID of the compute or fix; gname is
|
||||
the name of the grid, which is assigned by the compute or fix; dname is
|
||||
the name of the data field, which is also assigned by the compute or
|
||||
fix.
|
||||
|
||||
If the data field is a per-grid vector (one value per grid point),
|
||||
then no brackets are used to access the values. If the data field is
|
||||
a per-grid array (multiple values per grid point), then brackets are
|
||||
used to specify the column I of the array. I ranges from 1 to Ncol
|
||||
inclusive, where Ncol is the number of columns in the array and is
|
||||
defined by the compute or fix.
|
||||
|
||||
Currently, there are no per-grid variables implemented in LAMMPS. We
|
||||
may add this feature at some point.
|
||||
@ -22,14 +22,17 @@ commands you specify.
|
||||
As discussed below, LAMMPS gives you a variety of ways to determine
|
||||
what quantities are computed and printed when the thermodynamics,
|
||||
dump, or fix commands listed above perform output. Throughout this
|
||||
discussion, note that users can also :doc:`add their own computes and fixes to LAMMPS <Modify>` which can then generate values that can then be
|
||||
output with these commands.
|
||||
discussion, note that users can also :doc:`add their own computes and
|
||||
fixes to LAMMPS <Modify>` which can then generate values that can then
|
||||
be output with these commands.
|
||||
|
||||
The following sub-sections discuss different LAMMPS command related
|
||||
The following sub-sections discuss different LAMMPS commands related
|
||||
to output and the kind of data they operate on and produce:
|
||||
|
||||
* :ref:`Global/per-atom/local data <global>`
|
||||
* :ref:`Global/per-atom/local/per-grid data <global>`
|
||||
* :ref:`Scalar/vector/array data <scalar>`
|
||||
* :ref:`Per-grid data <grid>`
|
||||
* :ref:`Disambiguation <disambiguation>`
|
||||
* :ref:`Thermodynamic output <thermo>`
|
||||
* :ref:`Dump file output <dump>`
|
||||
* :ref:`Fixes that write output files <fixoutput>`
|
||||
@ -42,27 +45,32 @@ to output and the kind of data they operate on and produce:
|
||||
|
||||
.. _global:
|
||||
|
||||
Global/per-atom/local data
|
||||
--------------------------
|
||||
Global/per-atom/local/per-grid data
|
||||
-----------------------------------
|
||||
|
||||
Various output-related commands work with three different styles of
|
||||
data: global, per-atom, or local. A global datum is one or more
|
||||
system-wide values, e.g. the temperature of the system. A per-atom
|
||||
datum is one or more values per atom, e.g. the kinetic energy of each
|
||||
atom. Local datums are calculated by each processor based on the
|
||||
atoms it owns, but there may be zero or more per atom, e.g. a list of
|
||||
bond distances.
|
||||
Various output-related commands work with four different styles of
|
||||
data: global, per-atom, local, and per-grid. A global datum is one or
|
||||
more system-wide values, e.g. the temperature of the system. A
|
||||
per-atom datum is one or more values per atom, e.g. the kinetic energy
|
||||
of each atom. Local datums are calculated by each processor based on
|
||||
the atoms it owns, but there may be zero or more per atom, e.g. a list
|
||||
of bond distances.
|
||||
|
||||
A per-grid datum is one or more values per grid cell, for a grid which
|
||||
overlays the simulation domain. The grid cells and the data they
|
||||
store are distributed across processors; each processor owns the grid
|
||||
cells whose center point falls within its sub-domain.
|
||||
|
||||
.. _scalar:
|
||||
|
||||
Scalar/vector/array data
|
||||
------------------------
|
||||
|
||||
Global, per-atom, and local datums can each come in three kinds: a
|
||||
single scalar value, a vector of values, or a 2d array of values. The
|
||||
doc page for a "compute" or "fix" or "variable" that generates data
|
||||
will specify both the style and kind of data it produces, e.g. a
|
||||
per-atom vector.
|
||||
Global, per-atom, and local datums can come in three kinds: a single
|
||||
scalar value, a vector of values, or a 2d array of values. The doc
|
||||
page for a "compute" or "fix" or "variable" that generates data will
|
||||
specify both the style and kind of data it produces, e.g. a per-atom
|
||||
vector.
|
||||
|
||||
When a quantity is accessed, as in many of the output commands
|
||||
discussed below, it can be referenced via the following bracket
|
||||
@ -83,6 +91,18 @@ the dimension twice (array -> scalar). Thus a command that uses
|
||||
scalar values as input can typically also process elements of a vector
|
||||
or array.
|
||||
|
||||
.. _grid:
|
||||
|
||||
Per-grid data
|
||||
------------------------
|
||||
|
||||
Per-grid data can come in two kinds: a vector of values (one per grid
|
||||
cekk), or a 2d array of values (multiple values per grid ckk). The
|
||||
doc page for a "compute" or "fix" that generates data will specify
|
||||
names for both the grid(s) and datum(s) it produces, e.g. per-grid
|
||||
vectors or arrays, which can be referenced by other commands. See the
|
||||
:doc:`Howto grid <Howto_grid>` doc page for more details.
|
||||
|
||||
.. _disambiguation:
|
||||
|
||||
Disambiguation
|
||||
@ -90,15 +110,15 @@ Disambiguation
|
||||
|
||||
Some computes and fixes produce data in multiple styles, e.g. a global
|
||||
scalar and a per-atom vector. Usually the context in which the input
|
||||
script references the data determines which style is meant. Example: if
|
||||
a compute provides both a global scalar and a per-atom vector, the
|
||||
script references the data determines which style is meant. Example:
|
||||
if a compute provides both a global scalar and a per-atom vector, the
|
||||
former will be accessed by using ``c_ID`` in an equal-style variable,
|
||||
while the latter will be accessed by using ``c_ID`` in an atom-style
|
||||
variable. Note that atom-style variable formulas can also access global
|
||||
scalars, but in this case it is not possible to do directly because of
|
||||
the ambiguity. Instead, an equal-style variable can be defined which
|
||||
accesses the global scalar, and that variable used in the atom-style
|
||||
variable formula in place of ``c_ID``.
|
||||
variable. Note that atom-style variable formulas can also access
|
||||
global scalars, but in this case it is not possible to do this
|
||||
directly because of the ambiguity. Instead, an equal-style variable
|
||||
can be defined which accesses the global scalar, and that variable can
|
||||
be used in the atom-style variable formula in place of ``c_ID``.
|
||||
|
||||
.. _thermo:
|
||||
|
||||
@ -107,15 +127,14 @@ Thermodynamic output
|
||||
|
||||
The frequency and format of thermodynamic output is set by the
|
||||
:doc:`thermo <thermo>`, :doc:`thermo_style <thermo_style>`, and
|
||||
:doc:`thermo_modify <thermo_modify>` commands. The
|
||||
:doc:`thermo_style <thermo_style>` command also specifies what values
|
||||
are calculated and written out. Pre-defined keywords can be specified
|
||||
(e.g. press, etotal, etc). Three additional kinds of keywords can
|
||||
also be specified (c_ID, f_ID, v_name), where a :doc:`compute <compute>`
|
||||
or :doc:`fix <fix>` or :doc:`variable <variable>` provides the value to be
|
||||
output. In each case, the compute, fix, or variable must generate
|
||||
global values for input to the :doc:`thermo_style custom <dump>`
|
||||
command.
|
||||
:doc:`thermo_modify <thermo_modify>` commands. The :doc:`thermo_style
|
||||
<thermo_style>` command also specifies what values are calculated and
|
||||
written out. Pre-defined keywords can be specified (e.g. press, etotal,
|
||||
etc). Three additional kinds of keywords can also be specified (c_ID,
|
||||
f_ID, v_name), where a :doc:`compute <compute>` or :doc:`fix <fix>` or
|
||||
:doc:`variable <variable>` provides the value to be output. In each
|
||||
case, the compute, fix, or variable must generate global values for
|
||||
input to the :doc:`thermo_style custom <dump>` command.
|
||||
|
||||
Note that thermodynamic output values can be "extensive" or
|
||||
"intensive". The former scale with the number of atoms in the system
|
||||
@ -141,9 +160,10 @@ There is also a :doc:`dump custom <dump>` format where the user
|
||||
specifies what values are output with each atom. Pre-defined atom
|
||||
attributes can be specified (id, x, fx, etc). Three additional kinds
|
||||
of keywords can also be specified (c_ID, f_ID, v_name), where a
|
||||
:doc:`compute <compute>` or :doc:`fix <fix>` or :doc:`variable <variable>`
|
||||
provides the values to be output. In each case, the compute, fix, or
|
||||
variable must generate per-atom values for input to the :doc:`dump custom <dump>` command.
|
||||
:doc:`compute <compute>` or :doc:`fix <fix>` or :doc:`variable
|
||||
<variable>` provides the values to be output. In each case, the
|
||||
compute, fix, or variable must generate per-atom values for input to
|
||||
the :doc:`dump custom <dump>` command.
|
||||
|
||||
There is also a :doc:`dump local <dump>` format where the user specifies
|
||||
what local values to output. A pre-defined index keyword can be
|
||||
@ -154,18 +174,23 @@ provides the values to be output. In each case, the compute or fix
|
||||
must generate local values for input to the :doc:`dump local <dump>`
|
||||
command.
|
||||
|
||||
There is also a :doc:`dump grid <dump>` format where the user
|
||||
specifies what per-grid values to output from computes or fixes that
|
||||
generate per-grid data.
|
||||
|
||||
.. _fixoutput:
|
||||
|
||||
Fixes that write output files
|
||||
-----------------------------
|
||||
|
||||
Several fixes take various quantities as input and can write output
|
||||
files: :doc:`fix ave/time <fix_ave_time>`, :doc:`fix ave/chunk <fix_ave_chunk>`, :doc:`fix ave/histo <fix_ave_histo>`,
|
||||
:doc:`fix ave/correlate <fix_ave_correlate>`, and :doc:`fix print <fix_print>`.
|
||||
files: :doc:`fix ave/time <fix_ave_time>`, :doc:`fix ave/chunk
|
||||
<fix_ave_chunk>`, :doc:`fix ave/histo <fix_ave_histo>`, :doc:`fix
|
||||
ave/correlate <fix_ave_correlate>`, and :doc:`fix print <fix_print>`.
|
||||
|
||||
The :doc:`fix ave/time <fix_ave_time>` command enables direct output to
|
||||
a file and/or time-averaging of global scalars or vectors. The user
|
||||
specifies one or more quantities as input. These can be global
|
||||
The :doc:`fix ave/time <fix_ave_time>` command enables direct output
|
||||
to a file and/or time-averaging of global scalars or vectors. The
|
||||
user specifies one or more quantities as input. These can be global
|
||||
:doc:`compute <compute>` values, global :doc:`fix <fix>` values, or
|
||||
:doc:`variables <variable>` of any style except the atom style which
|
||||
produces per-atom values. Since a variable can refer to keywords used
|
||||
@ -184,8 +209,14 @@ atoms, e.g. individual molecules. The per-atom quantities can be atom
|
||||
density (mass or number) or atom attributes such as position,
|
||||
velocity, force. They can also be per-atom quantities calculated by a
|
||||
:doc:`compute <compute>`, by a :doc:`fix <fix>`, or by an atom-style
|
||||
:doc:`variable <variable>`. The chunk-averaged output of this fix can
|
||||
also be used as input to other output commands.
|
||||
:doc:`variable <variable>`. The chunk-averaged output of this fix is
|
||||
global and can also be used as input to other output commands.
|
||||
|
||||
Note that the :doc:`fix ave/grid <fix_ave_grid>` command can also
|
||||
average the same per-atom quantities within spatial bins, but it does
|
||||
this for a distributed grid whose grid cells are owned by different
|
||||
processors. It outputs per-grid data, not global data, so it is more
|
||||
efficient for large numbers of averaging bins.
|
||||
|
||||
The :doc:`fix ave/histo <fix_ave_histo>` command enables direct output
|
||||
to a file of histogrammed quantities, which can be global or per-atom
|
||||
@ -202,38 +233,53 @@ written to the screen and log file or to a separate file, periodically
|
||||
during a running simulation. The line can contain one or more
|
||||
:doc:`variable <variable>` values for any style variable except the
|
||||
vector or atom styles). As explained above, variables themselves can
|
||||
contain references to global values generated by :doc:`thermodynamic keywords <thermo_style>`, :doc:`computes <compute>`,
|
||||
:doc:`fixes <fix>`, or other :doc:`variables <variable>`, or to per-atom
|
||||
values for a specific atom. Thus the :doc:`fix print <fix_print>`
|
||||
command is a means to output a wide variety of quantities separate
|
||||
from normal thermodynamic or dump file output.
|
||||
contain references to global values generated by :doc:`thermodynamic
|
||||
keywords <thermo_style>`, :doc:`computes <compute>`, :doc:`fixes
|
||||
<fix>`, or other :doc:`variables <variable>`, or to per-atom values
|
||||
for a specific atom. Thus the :doc:`fix print <fix_print>` command is
|
||||
a means to output a wide variety of quantities separate from normal
|
||||
thermodynamic or dump file output.
|
||||
|
||||
.. _computeoutput:
|
||||
|
||||
Computes that process output quantities
|
||||
---------------------------------------
|
||||
|
||||
The :doc:`compute reduce <compute_reduce>` and :doc:`compute reduce/region <compute_reduce>` commands take one or more per-atom
|
||||
or local vector quantities as inputs and "reduce" them (sum, min, max,
|
||||
The :doc:`compute reduce <compute_reduce>` and :doc:`compute
|
||||
reduce/region <compute_reduce>` commands take one or more per-atom or
|
||||
local vector quantities as inputs and "reduce" them (sum, min, max,
|
||||
ave) to scalar quantities. These are produced as output values which
|
||||
can be used as input to other output commands.
|
||||
|
||||
The :doc:`compute slice <compute_slice>` command take one or more global
|
||||
vector or array quantities as inputs and extracts a subset of their
|
||||
values to create a new vector or array. These are produced as output
|
||||
values which can be used as input to other output commands.
|
||||
The :doc:`compute slice <compute_slice>` command take one or more
|
||||
global vector or array quantities as inputs and extracts a subset of
|
||||
their values to create a new vector or array. These are produced as
|
||||
output values which can be used as input to other output commands.
|
||||
|
||||
The :doc:`compute property/atom <compute_property_atom>` command takes a
|
||||
list of one or more pre-defined atom attributes (id, x, fx, etc) and
|
||||
The :doc:`compute property/atom <compute_property_atom>` command takes
|
||||
a list of one or more pre-defined atom attributes (id, x, fx, etc) and
|
||||
stores the values in a per-atom vector or array. These are produced
|
||||
as output values which can be used as input to other output commands.
|
||||
The list of atom attributes is the same as for the :doc:`dump custom <dump>` command.
|
||||
The list of atom attributes is the same as for the :doc:`dump custom
|
||||
<dump>` command.
|
||||
|
||||
The :doc:`compute property/local <compute_property_local>` command takes
|
||||
a list of one or more pre-defined local attributes (bond info, angle
|
||||
info, etc) and stores the values in a local vector or array. These
|
||||
are produced as output values which can be used as input to other
|
||||
output commands.
|
||||
The :doc:`compute property/local <compute_property_local>` command
|
||||
takes a list of one or more pre-defined local attributes (bond info,
|
||||
angle info, etc) and stores the values in a local vector or array.
|
||||
These are produced as output values which can be used as input to
|
||||
other output commands.
|
||||
|
||||
The :doc:`compute property/grid <compute_property_grid>` command takes
|
||||
a list of one or more pre-defined per-grid attributes (id, grid cell
|
||||
coords, etc) and stores the values in a per-grid vector or array.
|
||||
These are produced as output values which can be used as input to the
|
||||
:doc:`dump grid <dump>` command.
|
||||
|
||||
The :doc:`compute property/chunk <compute_property_chunk>` command
|
||||
takes a list of one or more pre-defined chunk attributes (id, count,
|
||||
coords for spatial bins) and stores the values in a global vector or
|
||||
array. These are produced as output values which can be used as input
|
||||
to other output commands.
|
||||
|
||||
.. _fixprocoutput:
|
||||
|
||||
@ -247,18 +293,42 @@ a time.
|
||||
The :doc:`fix ave/atom <fix_ave_atom>` command performs time-averaging
|
||||
of per-atom vectors. The per-atom quantities can be atom attributes
|
||||
such as position, velocity, force. They can also be per-atom
|
||||
quantities calculated by a :doc:`compute <compute>`, by a
|
||||
:doc:`fix <fix>`, or by an atom-style :doc:`variable <variable>`. The
|
||||
quantities calculated by a :doc:`compute <compute>`, by a :doc:`fix
|
||||
<fix>`, or by an atom-style :doc:`variable <variable>`. The
|
||||
time-averaged per-atom output of this fix can be used as input to
|
||||
other output commands.
|
||||
|
||||
The :doc:`fix store/state <fix_store_state>` command can archive one or
|
||||
more per-atom attributes at a particular time, so that the old values
|
||||
can be used in a future calculation or output. The list of atom
|
||||
attributes is the same as for the :doc:`dump custom <dump>` command,
|
||||
including per-atom quantities calculated by a :doc:`compute <compute>`,
|
||||
by a :doc:`fix <fix>`, or by an atom-style :doc:`variable <variable>`.
|
||||
The output of this fix can be used as input to other output commands.
|
||||
The :doc:`fix store/state <fix_store_state>` command can archive one
|
||||
or more per-atom attributes at a particular time, so that the old
|
||||
values can be used in a future calculation or output. The list of
|
||||
atom attributes is the same as for the :doc:`dump custom <dump>`
|
||||
command, including per-atom quantities calculated by a :doc:`compute
|
||||
<compute>`, by a :doc:`fix <fix>`, or by an atom-style :doc:`variable
|
||||
<variable>`. The output of this fix can be used as input to other
|
||||
output commands.
|
||||
|
||||
The :doc:`fix ave/grid <fix_ave_grid>` command performs time-averaging
|
||||
of either per-atom or per-grid data.
|
||||
|
||||
For per-atom data it performs averaging for the atoms within each grid
|
||||
cell, similar to the :doc:`fix ave/chunk <fix_ave_chunk>` command when
|
||||
its chunks are defined as regular 2d or 3d bins. The per-atom
|
||||
quantities can be atom density (mass or number) or atom attributes
|
||||
such as position, velocity, force. They can also be per-atom
|
||||
quantities calculated by a :doc:`compute <compute>`, by a :doc:`fix
|
||||
<fix>`, or by an atom-style :doc:`variable <variable>`.
|
||||
|
||||
The chief difference between the :doc:`fix ave/grid <fix_ave_grid>`
|
||||
and :doc:`fix ave/chunk <fix_ave_chunk>` commands when used in this
|
||||
context is that the former uses a distributed grid, while the latter
|
||||
uses a global grid. Distributed means that each processor owns the
|
||||
subset of grid cells within its sub-domain. Global means that each
|
||||
processor owns a copy of the entire grid. The :doc:`fix ave/grid
|
||||
<fix_ave_grid>` command is thus more efficient for large grids.
|
||||
|
||||
For per-grid data, the :doc:`fix ave/grid <fix_ave_grid>` command
|
||||
takes inputs for grid data produced by other computes or fixes and
|
||||
averages the values for each grid point over time.
|
||||
|
||||
.. _compute:
|
||||
|
||||
@ -266,24 +336,25 @@ Computes that generate values to output
|
||||
---------------------------------------
|
||||
|
||||
Every :doc:`compute <compute>` in LAMMPS produces either global or
|
||||
per-atom or local values. The values can be scalars or vectors or
|
||||
arrays of data. These values can be output using the other commands
|
||||
described in this section. The page for each compute command
|
||||
per-atom or local or per-grid values. The values can be scalars or
|
||||
vectors or arrays of data. These values can be output using the other
|
||||
commands described in this section. The page for each compute command
|
||||
describes what it produces. Computes that produce per-atom or local
|
||||
values have the word "atom" or "local" in their style name. Computes
|
||||
without the word "atom" or "local" produce global values.
|
||||
or per-grid values have the word "atom" or "local" or "grid as the
|
||||
last word in their style name. Computes without the word "atom" or
|
||||
"local" or "grid" produce global values.
|
||||
|
||||
.. _fix:
|
||||
|
||||
Fixes that generate values to output
|
||||
------------------------------------
|
||||
|
||||
Some :doc:`fixes <fix>` in LAMMPS produces either global or per-atom or
|
||||
local values which can be accessed by other commands. The values can
|
||||
be scalars or vectors or arrays of data. These values can be output
|
||||
using the other commands described in this section. The page for
|
||||
each fix command tells whether it produces any output quantities and
|
||||
describes them.
|
||||
Some :doc:`fixes <fix>` in LAMMPS produces either global or per-atom
|
||||
or local or per-grid values which can be accessed by other commands.
|
||||
The values can be scalars or vectors or arrays of data. These values
|
||||
can be output using the other commands described in this section. The
|
||||
page for each fix command tells whether it produces any output
|
||||
quantities and describes them.
|
||||
|
||||
.. _variable:
|
||||
|
||||
@ -300,6 +371,8 @@ computes, fixes, and other variables. The values generated by
|
||||
variables can be used as input to and thus output by the other
|
||||
commands described in this section.
|
||||
|
||||
Per-grid variables have not (yet) been implemented.
|
||||
|
||||
.. _table:
|
||||
|
||||
Summary table of output options and data flow between commands
|
||||
@ -319,44 +392,52 @@ Also note that, as described above, when a command takes a scalar as
|
||||
input, that could be an element of a vector or array. Likewise a
|
||||
vector input could be a column of an array.
|
||||
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| Command | Input | Output |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`thermo_style custom <thermo_style>` | global scalars | screen, log file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`dump custom <dump>` | per-atom vectors | dump file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`dump local <dump>` | local vectors | dump file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix print <fix_print>` | global scalar from variable | screen, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`print <print>` | global scalar from variable | screen |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`computes <compute>` | N/A | global/per-atom/local scalar/vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fixes <fix>` | N/A | global/per-atom/local scalar/vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`variables <variable>` | global scalars and vectors, per-atom vectors | global scalar and vector, per-atom vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`compute reduce <compute_reduce>` | per-atom/local vectors | global scalar/vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`compute slice <compute_slice>` | global vectors/arrays | global vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`compute property/atom <compute_property_atom>` | per-atom vectors | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`compute property/local <compute_property_local>` | local vectors | local vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix vector <fix_vector>` | global scalars | global vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix ave/atom <fix_ave_atom>` | per-atom vectors | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix ave/time <fix_ave_time>` | global scalars/vectors | global scalar/vector/array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix ave/chunk <fix_ave_chunk>` | per-atom vectors | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix ave/histo <fix_ave_histo>` | global/per-atom/local scalars and vectors | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix ave/correlate <fix_ave_correlate>` | global scalars | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
| :doc:`fix store/state <fix_store_state>` | per-atom vectors | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+-------------------------------------------+
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| Command | Input | Output |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`thermo_style custom <thermo_style>` | global scalars | screen, log file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`dump custom <dump>` | per-atom vectors | dump file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`dump local <dump>` | local vectors | dump file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`dump grid <dump>` | per-grid vectors | dump file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix print <fix_print>` | global scalar from variable | screen, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`print <print>` | global scalar from variable | screen |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`computes <compute>` | N/A | global/per-atom/local/per-grid scalar/vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fixes <fix>` | N/A | global/per-atom/local/per-grid scalar/vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`variables <variable>` | global scalars and vectors, per-atom vectors | global scalar and vector, per-atom vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute reduce <compute_reduce>` | per-atom/local vectors | global scalar/vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute slice <compute_slice>` | global vectors/arrays | global vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute property/atom <compute_property_atom>` | N/A | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute property/local <compute_property_local>` | N/A | local vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute property/grid <compute_property_grid>` | N/A | per-grid vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`compute property/chunk <compute_property_chunk>` | N/A | global vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix vector <fix_vector>` | global scalars | global vector |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/atom <fix_ave_atom>` | per-atom vectors | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/time <fix_ave_time>` | global scalars/vectors | global scalar/vector/array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/chunk <fix_ave_chunk>` | per-atom vectors | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/grid <fix_ave_grid>` | per-atom vectors or per-grid vectors | per-grid vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/histo <fix_ave_histo>` | global/per-atom/local scalars and vectors | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix ave/correlate <fix_ave_correlate>` | global scalars | global array, file |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
| :doc:`fix store/state <fix_store_state>` | per-atom vectors | per-atom vector/array |
|
||||
+--------------------------------------------------------+----------------------------------------------+----------------------------------------------------+
|
||||
|
||||
@ -152,14 +152,14 @@ Creating a new instance of PyLammps
|
||||
To create a PyLammps object you need to first import the class from the lammps
|
||||
module. By using the default constructor, a new *lammps* instance is created.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import PyLammps
|
||||
L = PyLammps()
|
||||
|
||||
You can also initialize PyLammps on top of this existing *lammps* object:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps, PyLammps
|
||||
lmp = lammps()
|
||||
@ -180,14 +180,14 @@ For instance, let's take the following LAMMPS command:
|
||||
In the original interface this command can be executed with the following
|
||||
Python code if *L* was a lammps instance:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.command("region box block 0 10 0 5 -0.5 0.5")
|
||||
|
||||
With the PyLammps interface, any command can be split up into arbitrary parts
|
||||
separated by white-space, passed as individual arguments to a region method.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
||||
|
||||
@ -199,14 +199,14 @@ The benefit of this approach is avoiding redundant command calls and easier
|
||||
parameterization. In the original interface parameterization needed to be done
|
||||
manually by creating formatted strings.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
||||
|
||||
In contrast, methods of PyLammps accept parameters directly and will convert
|
||||
them automatically to a final command string.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
||||
|
||||
@ -256,7 +256,7 @@ LAMMPS variables can be both defined and accessed via the PyLammps interface.
|
||||
|
||||
To define a variable you can use the :doc:`variable <variable>` command:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.variable("a index 2")
|
||||
|
||||
@ -265,14 +265,14 @@ A dictionary of all variables is returned by L.variables
|
||||
you can access an individual variable by retrieving a variable object from the
|
||||
L.variables dictionary by name
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
a = L.variables['a']
|
||||
|
||||
The variable value can then be easily read and written by accessing the value
|
||||
property of this object.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
print(a.value)
|
||||
a.value = 4
|
||||
@ -284,7 +284,7 @@ LAMMPS expressions can be immediately evaluated by using the eval method. The
|
||||
passed string parameter can be any expression containing global thermo values,
|
||||
variables, compute or fix data.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
result = L.eval("ke") # kinetic energy
|
||||
result = L.eval("pe") # potential energy
|
||||
@ -298,7 +298,7 @@ All atoms in the current simulation can be accessed by using the L.atoms list.
|
||||
Each element of this list is an object which exposes its properties (id, type,
|
||||
position, velocity, force, etc.).
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# access first atom
|
||||
L.atoms[0].id
|
||||
@ -311,7 +311,7 @@ position, velocity, force, etc.).
|
||||
|
||||
Some properties can also be used to set:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# set position in 2D simulation
|
||||
L.atoms[0].position = (1.0, 0.0)
|
||||
@ -328,7 +328,7 @@ after a run via the L.runs list. This list contains a growing list of run data.
|
||||
The first element is the output of the first run, the second element that of
|
||||
the second run.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.run(1000)
|
||||
L.runs[0] # data of first 1000 time steps
|
||||
@ -339,14 +339,14 @@ the second run.
|
||||
Each run contains a dictionary of all trajectories. Each trajectory is
|
||||
accessible through its thermo name:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.runs[0].thermo.Step # list of time steps in first run
|
||||
L.runs[0].thermo.Ke # list of kinetic energy values in first run
|
||||
|
||||
Together with matplotlib plotting data out of LAMMPS becomes simple:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
import matplotlib.plot as plt
|
||||
steps = L.runs[0].thermo.Step
|
||||
@ -406,7 +406,7 @@ Four atoms are placed in the simulation and the dihedral potential is applied on
|
||||
them using a datafile. Then one of the atoms is rotated along the central axis by
|
||||
setting its position from Python, which changes the dihedral angle.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
phi = [d \* math.pi / 180 for d in range(360)]
|
||||
|
||||
@ -439,7 +439,7 @@ Initially, a 2D system is created in a state with minimal energy.
|
||||
|
||||
It is then disordered by moving each atom by a random delta.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
random.seed(27848)
|
||||
deltaperturb = 0.2
|
||||
@ -458,7 +458,7 @@ It is then disordered by moving each atom by a random delta.
|
||||
Finally, the Monte Carlo algorithm is implemented in Python. It continuously
|
||||
moves random atoms by a random delta and only accepts certain moves.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
estart = L.eval("pe")
|
||||
elast = estart
|
||||
@ -517,7 +517,7 @@ PyLammps can be run in parallel using mpi4py. This python package can be install
|
||||
The following is a short example which reads in an existing LAMMPS input file and
|
||||
executes it in parallel. You can find in.melt in the examples/melt folder.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from mpi4py import MPI
|
||||
from lammps import PyLammps
|
||||
|
||||
@ -43,7 +43,7 @@ JSON
|
||||
"ke": $(ke)
|
||||
}""" file current_state.json screen no
|
||||
|
||||
.. code-block:: JSON
|
||||
.. code-block:: json
|
||||
:caption: current_state.json
|
||||
|
||||
{
|
||||
|
||||
@ -144,11 +144,6 @@ does not change the atom positions due to non-periodicity. In this
|
||||
mode, if you tilt the system to extreme angles, the simulation will
|
||||
simply become inefficient, due to the highly skewed simulation box.
|
||||
|
||||
The limitation on not creating a simulation box with a tilt factor
|
||||
skewing the box more than half the distance of the parallel box length
|
||||
can be overridden via the :doc:`box <box>` command. Setting the *tilt*
|
||||
keyword to *large* allows any tilt factors to be specified.
|
||||
|
||||
Box flips that may occur using the :doc:`fix deform <fix_deform>` or
|
||||
:doc:`fix npt <fix_nh>` commands can be turned off using the *flip no*
|
||||
option with either of the commands.
|
||||
|
||||
@ -39,7 +39,7 @@ crashes within LAMMPS may be recovered from by enabling
|
||||
:ref:`exceptions <exceptions>`, avoiding them proactively is a safer
|
||||
approach.
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
:caption: Example for using configuration settings functions
|
||||
|
||||
#include "library.h"
|
||||
|
||||
@ -22,7 +22,7 @@ as the "handle" argument in subsequent function calls until that
|
||||
instance is destroyed by calling :cpp:func:`lammps_close`. Here is a
|
||||
simple example demonstrating its use:
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
|
||||
#include "library.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -30,7 +30,7 @@ be included in the file or strings, and expansion of variables with
|
||||
``${name}`` or ``$(expression)`` syntax is performed.
|
||||
Below is a short example using some of these functions.
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
|
||||
/* define to make the otherwise hidden prototype for "lammps_open()" visible */
|
||||
#define LAMMPS_LIB_MPI
|
||||
|
||||
@ -32,7 +32,7 @@ indexed accordingly. Per-atom data can change sizes and ordering at
|
||||
every neighbor list rebuild or atom sort event as atoms migrate between
|
||||
sub-domains and processors.
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
|
||||
#include "library.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -7,6 +7,7 @@ functions. They do not directly call the LAMMPS library.
|
||||
- :cpp:func:`lammps_encode_image_flags`
|
||||
- :cpp:func:`lammps_decode_image_flags`
|
||||
- :cpp:func:`lammps_set_fix_external_callback`
|
||||
- :cpp:func:`lammps_fix_external_get_force`
|
||||
- :cpp:func:`lammps_fix_external_set_energy_global`
|
||||
- :cpp:func:`lammps_fix_external_set_energy_peratom`
|
||||
- :cpp:func:`lammps_fix_external_set_virial_global`
|
||||
@ -44,6 +45,11 @@ where such memory buffers were allocated that require the use of
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_fix_external_get_force
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_fix_external_set_energy_global
|
||||
:project: progguide
|
||||
|
||||
|
||||
@ -13,24 +13,65 @@ Here is a brief description of common methods you define in your
|
||||
new derived class. See bond.h, angle.h, dihedral.h, and improper.h
|
||||
for details and specific additional methods.
|
||||
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| init | check if all coefficients are set, calls *init_style* (optional) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| init_style | check if style specific conditions are met (optional) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| compute | compute the molecular interactions (required) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| settings | apply global settings for all types (optional) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| coeff | set coefficients for one type (required) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| equilibrium_distance | length of bond, used by SHAKE (required, bond only) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| equilibrium_angle | opening of angle, used by SHAKE (required, angle only) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| write & read_restart | writes/reads coeffs to restart files (required) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| single | force (bond only) and energy of a single bond or angle (required, bond or angle only) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
| memory_usage | tally memory allocated by the style (optional) |
|
||||
+-----------------------+---------------------------------------------------------------------------------------+
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| Required | "pure" methods that *must* be overridden in a derived class |
|
||||
+=======================+=====================================================================+
|
||||
| compute | compute the molecular interactions for all listed items |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| coeff | set coefficients for one type |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| equilibrium_distance | length of bond, used by SHAKE (bond styles only) |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| equilibrium_angle | opening of angle, used by SHAKE (angle styles only) |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| write & read_restart | writes/reads coeffs to restart files |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
| single | force/r (bond styles only) and energy of a single bond or angle |
|
||||
+-----------------------+---------------------------------------------------------------------+
|
||||
|
||||
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| Optional | methods that have a default or dummy implementation |
|
||||
+================================+======================================================================+
|
||||
| init | check if all coefficients are set, calls init_style() |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| init_style | check if style specific conditions are met |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| settings | apply global settings for all types |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| write & read_restart_settings | writes/reads global style settings to restart files |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| write_data | write corresponding Coeffs section(s) in data file |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| memory_usage | tally memory allocated by the style |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| extract | provide access to internal data (bond or angle styles only) |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| reinit | reset all type-based parameters, called by fix adapt (bonds only) |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| pack & unpack_forward_comm | copy data to and from buffer in forward communication (bonds only) |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
| pack & unpack_reverse_comm | copy data to and from buffer in reverse communication (bonds only) |
|
||||
+--------------------------------+----------------------------------------------------------------------+
|
||||
|
||||
Here is a list of flags or settings that should be set in the
|
||||
constructor of the derived class when they differ from the default
|
||||
setting.
|
||||
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| Name of flag | Description | default |
|
||||
+=================================+==============================================================================+=========+
|
||||
| writedata | 1 if write_data() is implemented | 1 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| single_extra | number of extra single values calculated (bond styles only) | 0 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| partial_flag | 1 if bond type can be set to 0 and deleted (bond styles only) | 0 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| reinitflag | 1 if style has reinit() and is compatible with fix adapt | 1 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| comm_forward | size of buffer (in doubles) for forward communication (bond styles only) | 0 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| comm_reverse | size of buffer (in doubles) for reverse communication (bond styles only) | 0 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
| comm_reverse_off | size of buffer for reverse communication with newton off (bond styles only) | 0 |
|
||||
+---------------------------------+------------------------------------------------------------------------------+---------+
|
||||
|
||||
@ -1,35 +1,121 @@
|
||||
Pair styles
|
||||
===========
|
||||
|
||||
Classes that compute pairwise interactions are derived from the Pair
|
||||
class. In LAMMPS, pairwise calculation include many-body potentials
|
||||
such as EAM or Tersoff where particles interact without a static bond
|
||||
topology. New styles can be created to add new pair potentials to
|
||||
LAMMPS.
|
||||
Classes that compute pairwise non-bonded interactions are derived from
|
||||
the Pair class. In LAMMPS, pairwise calculation include many-body
|
||||
potentials such as EAM, Tersoff, or ReaxFF where particles interact
|
||||
without an explicit bond topology but include interactions beyond
|
||||
pairwise non-bonded contributions. New styles can be created to add
|
||||
support for additional pair potentials to LAMMPS. When the
|
||||
modifications are small, sometimes it is more effective to derive from
|
||||
an existing pair style class. This latter approach is also used by
|
||||
:doc:`Accelerator packages <Speed_packages>` where the accelerated style
|
||||
names differ from their base classes by an appended suffix.
|
||||
|
||||
Pair_lj_cut.cpp is a simple example of a Pair class, though it
|
||||
includes some optional methods to enable its use with rRESPA.
|
||||
The file ``src/pair_lj_cut.cpp`` is an example of a Pair class with a
|
||||
very simple potential function. It includes several optional methods to
|
||||
enable its use with :doc:`run_style respa <run_style>` and :doc:`compute
|
||||
group/group <compute_group_group>`.
|
||||
|
||||
Here is a brief description of the class methods in pair.h:
|
||||
Here is a brief list of some the class methods in the Pair class that
|
||||
*must* be or *may* be overridden in a derived class.
|
||||
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| Required | "pure" methods that *must* be overridden in a derived class |
|
||||
+=================================+=====================================================================+
|
||||
| compute | workhorse routine that computes pairwise interactions |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| settings | reads the input script line with arguments you define |
|
||||
| settings | processes the arguments to the pair_style command |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| coeff | set coefficients for one i,j type pair |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| init_one | perform initialization for one i,j type pair |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| init_style | initialization specific to this pair style |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| write & read_restart | write/read i,j pair coeffs to restart files |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| write & read_restart_settings | write/read global settings to restart files |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| single | force/r and energy of a single pairwise interaction between 2 atoms |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
| compute_inner/middle/outer | versions of compute used by rRESPA |
|
||||
| coeff | set coefficients for one i,j type pair, called from pair_coeff |
|
||||
+---------------------------------+---------------------------------------------------------------------+
|
||||
|
||||
The inner/middle/outer routines are optional.
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| Optional | methods that have a default or dummy implementation |
|
||||
+=================================+======================================================================+
|
||||
| init_one | perform initialization for one i,j type pair |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| init_style | style initialization: request neighbor list(s), error checks |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| init_list | Neighbor class callback function to pass neighbor list to pair style |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| single | force/r and energy of a single pairwise interaction between 2 atoms |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| compute_inner/middle/outer | versions of compute used by rRESPA |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| memory_usage | return estimated amount of memory used by the pair style |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| modify_params | process arguments to pair_modify command |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| extract | provide access to internal scalar or per-type data like cutoffs |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| extract_peratom | provide access to internal per-atom data |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| setup | initialization at the beginning of a run |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| finish | called at the end of a run, e.g. to print |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| write & read_restart | write/read i,j pair coeffs to restart files |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| write & read_restart_settings | write/read global settings to restart files |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| write_data | write Pair Coeffs section to data file |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| write_data_all | write PairIJ Coeffs section to data file |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| pack & unpack_forward_comm | copy data to and from buffer if style uses forward communication |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| pack & unpack_reverse_comm | copy data to and from buffer if style uses reverse communication |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| reinit | reset all type-based parameters, called by fix adapt for example |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
| reset_dt | called when the time step is changed by timestep or fix reset/dt |
|
||||
+---------------------------------+----------------------------------------------------------------------+
|
||||
|
||||
Here is a list of flags or settings that should be set in the
|
||||
constructor of the derived pair class when they differ from the default
|
||||
setting.
|
||||
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| Name of flag | Description | default |
|
||||
+=================================+=============================================================+=========+
|
||||
| single_enable | 1 if single() method is implemented, 0 if missing | 1 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| respa_enable | 1 if pair style has compute_inner/middle/outer() | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| restartinfo | 1 if pair style writes its settings to a restart | 1 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| one_coeff | 1 if only a pair_coeff * * command is allowed | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| manybody_flag | 1 if pair style is a manybody potential | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| unit_convert_flag | value != 0 indicates support for unit conversion | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| no_virial_fdotr_compute | 1 if pair style does not call virial_fdotr_compute() | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| writedata | 1 if write_data() and write_data_all() are implemented | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| comm_forward | size of buffer (in doubles) for forward communication | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| comm_reverse | size of buffer (in doubles) for reverse communication | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| ghostneigh | 1 if cutghost is set and style uses neighbors of ghosts | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| finitecutflag | 1 if cutoff depends on diameter of atoms | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| reinitflag | 1 if style has reinit() and is compatible with fix adapt | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| ewaldflag | 1 if compatible with kspace_style ewald | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| pppmflag | 1 if compatible with kspace_style pppm | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| msmflag | 1 if compatible with kspace_style msm | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| dispersionflag | 1 if compatible with ewald/disp or pppm/disp | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| tip4pflag | 1 if compatible with kspace_style pppm/tip4p | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| dipoleflag | 1 if compatible with dipole kspace_style | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
| spinflag | 1 if compatible with spin kspace_style | 0 |
|
||||
+---------------------------------+-------------------------------------------------------------+---------+
|
||||
|
||||
@ -80,6 +80,7 @@ page gives those details.
|
||||
* :ref:`ML-HDNNP <PKG-ML-HDNNP>`
|
||||
* :ref:`ML-IAP <PKG-ML-IAP>`
|
||||
* :ref:`ML-PACE <PKG-ML-PACE>`
|
||||
* :ref:`ML-POD <PKG-ML-POD>`
|
||||
* :ref:`ML-QUIP <PKG-ML-QUIP>`
|
||||
* :ref:`ML-RANN <PKG-ML-RANN>`
|
||||
* :ref:`ML-SNAP <PKG-ML-SNAP>`
|
||||
@ -865,7 +866,7 @@ ELECTRODE package
|
||||
The ELECTRODE package allows the user to enforce a constant potential method for
|
||||
groups of atoms that interact with the remaining atoms as electrolyte.
|
||||
|
||||
**Authors:** The ELECTRODE library is written and maintained by Ludwig
|
||||
**Authors:** The ELECTRODE package is written and maintained by Ludwig
|
||||
Ahrens-Iwers (TUHH, Hamburg, Germany), Shern Tee (UQ, Brisbane, Australia) and
|
||||
Robert Meissner (TUHH, Hamburg, Germany).
|
||||
|
||||
@ -878,7 +879,7 @@ This package has :ref:`specific installation instructions <electrode>` on the
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* :doc:`fix electrode/conp <fix_electrode_conp>`
|
||||
* :doc:`fix electrode/conp <fix_electrode>`
|
||||
|
||||
----------
|
||||
|
||||
@ -1485,8 +1486,9 @@ MC package
|
||||
|
||||
Several fixes and a pair style that have Monte Carlo (MC) or MC-like
|
||||
attributes. These include fixes for creating, breaking, and swapping
|
||||
bonds, for performing atomic swaps, and performing grand-canonical MC
|
||||
(GCMC) or similar processes in conjunction with dynamics.
|
||||
bonds, for performing atomic swaps, and performing grand canonical
|
||||
MC (GCMC), semi-grand canonical MC (SGCMC), or similar processes in
|
||||
conjunction with molecular dynamics (MD).
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
@ -1498,6 +1500,7 @@ bonds, for performing atomic swaps, and performing grand-canonical MC
|
||||
* :doc:`fix bond/swap <fix_bond_swap>`
|
||||
* :doc:`fix charge/regulation <fix_charge_regulation>`
|
||||
* :doc:`fix gcmc <fix_gcmc>`
|
||||
* :doc:`fix sgcmc <fix_sgcmc>`
|
||||
* :doc:`fix tfmc <fix_tfmc>`
|
||||
* :doc:`fix widom <fix_widom>`
|
||||
* :doc:`pair_style dsmc <pair_dsmc>`
|
||||
@ -1796,6 +1799,39 @@ This package has :ref:`specific installation instructions <ml-pace>` on the
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-ML-POD:
|
||||
|
||||
ML-POD package
|
||||
-------------------
|
||||
|
||||
**Contents:**
|
||||
|
||||
A pair style and fitpod style for Proper Orthogonal Descriptors
|
||||
(POD). POD is a methodology for deriving descriptors based on the proper
|
||||
orthogonal decomposition. The ML-POD package provides an efficient
|
||||
implementation for running simulations with POD potentials, along with
|
||||
fitting the potentials natively in LAMMPS.
|
||||
|
||||
**Authors:**
|
||||
|
||||
Ngoc Cuong Nguyen (MIT), Andrew Rohskopf (Sandia)
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
**Install:**
|
||||
|
||||
This package has :ref:`specific installation instructions <ml-pod>` on the
|
||||
:doc:`Build extras <Build_extras>` page.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* src/ML-POD: filenames -> commands
|
||||
* :doc:`pair_style pod <pair_pod>`
|
||||
* :doc:`command_style fitpod <fitpod_command>`
|
||||
* examples/PACKAGES/pod
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-ML-QUIP:
|
||||
|
||||
ML-QUIP package
|
||||
|
||||
@ -155,7 +155,7 @@ whether an extra library is needed to build and use the package:
|
||||
- no
|
||||
* - :ref:`ELECTRODE <PKG-ELECTRODE>`
|
||||
- electrode charges to match potential
|
||||
- :doc:`fix electrode/conp <fix_electrode_conp>`
|
||||
- :doc:`fix electrode/conp <fix_electrode>`
|
||||
- PACKAGES/electrode
|
||||
- no
|
||||
* - :ref:`EXTRA-COMPUTE <PKG-EXTRA-COMPUTE>`
|
||||
@ -298,6 +298,11 @@ whether an extra library is needed to build and use the package:
|
||||
- :doc:`pair pace <pair_pace>`
|
||||
- PACKAGES/pace
|
||||
- ext
|
||||
* - :ref:`ML-POD <PKG-ML-POD>`
|
||||
- Proper orthogonal decomposition potentials
|
||||
- :doc:`pair pod <pair_pod>`
|
||||
- pod
|
||||
- ext
|
||||
* - :ref:`ML-QUIP <PKG-ML-QUIP>`
|
||||
- QUIP/libatoms interface
|
||||
- :doc:`pair_style quip <pair_quip>`
|
||||
|
||||
@ -58,7 +58,7 @@ against invalid accesses.
|
||||
Each element of this list is a :py:class:`Atom <lammps.Atom>` or :py:class:`Atom2D <lammps.Atom2D>` object. The attributes of
|
||||
these objects provide access to their data (id, type, position, velocity, force, etc.):
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# access first atom
|
||||
L.atoms[0].id
|
||||
@ -71,7 +71,7 @@ against invalid accesses.
|
||||
|
||||
Some attributes can be changed:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# set position in 2D simulation
|
||||
L.atoms[0].position = (1.0, 0.0)
|
||||
|
||||
@ -4,7 +4,7 @@ Configuration information
|
||||
The following methods can be used to query the LAMMPS library
|
||||
about compile time settings and included packages and styles.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
:caption: Example for using configuration settings functions
|
||||
|
||||
from lammps import lammps
|
||||
|
||||
@ -74,7 +74,7 @@ Here are simple examples using all three Python interfaces:
|
||||
:py:class:`PyLammps <lammps.PyLammps>` objects can also be created on top of an existing
|
||||
:py:class:`lammps <lammps.lammps>` object:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps, PyLammps
|
||||
...
|
||||
@ -113,7 +113,7 @@ Here are simple examples using all three Python interfaces:
|
||||
|
||||
You can also initialize IPyLammps on top of an existing :py:class:`lammps` or :py:class:`PyLammps` object:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps, IPyLammps
|
||||
...
|
||||
@ -142,7 +142,7 @@ the MPI and/or Kokkos environment if enabled and active.
|
||||
Note that you can create multiple LAMMPS objects in your Python
|
||||
script, and coordinate and run multiple simulations, e.g.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps
|
||||
lmp1 = lammps()
|
||||
|
||||
@ -7,7 +7,7 @@ current Python process with an error message. C++ exceptions allow capturing
|
||||
them on the C++ side and rethrowing them on the Python side. This way
|
||||
LAMMPS errors can be handled through the Python exception handling mechanism.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps, MPIAbortException
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ it is possible to "compute" what the next LAMMPS command should be.
|
||||
can be executed using with the lammps API with the following Python code if ``lmp`` is an
|
||||
instance of :py:class:`lammps <lammps.lammps>`:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps
|
||||
|
||||
@ -73,7 +73,7 @@ it is possible to "compute" what the next LAMMPS command should be.
|
||||
The arguments of the command can be passed as one string, or
|
||||
individually.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import PyLammps
|
||||
|
||||
@ -93,14 +93,14 @@ it is possible to "compute" what the next LAMMPS command should be.
|
||||
parameterization. In the lammps API parameterization needed to be done
|
||||
manually by creating formatted command strings.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
lmp.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
||||
|
||||
In contrast, methods of PyLammps accept parameters directly and will convert
|
||||
them automatically to a final command string.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ and you should see the same output as if you had typed
|
||||
|
||||
Note that without the mpi4py specific lines from ``test.py``
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps
|
||||
lmp = lammps()
|
||||
|
||||
@ -76,7 +76,7 @@ computes, fixes, or variables in LAMMPS using the :py:mod:`lammps` module.
|
||||
|
||||
To define a variable you can use the :doc:`variable <variable>` command:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.variable("a index 2")
|
||||
|
||||
@ -85,14 +85,14 @@ computes, fixes, or variables in LAMMPS using the :py:mod:`lammps` module.
|
||||
you can access an individual variable by retrieving a variable object from the
|
||||
``L.variables`` dictionary by name
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
a = L.variables['a']
|
||||
|
||||
The variable value can then be easily read and written by accessing the value
|
||||
property of this object.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
print(a.value)
|
||||
a.value = 4
|
||||
|
||||
@ -105,7 +105,7 @@ against invalid accesses.
|
||||
variables, compute or fix data (see :doc:`Howto_output`):
|
||||
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
result = L.eval("ke") # kinetic energy
|
||||
result = L.eval("pe") # potential energy
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Scatter/gather operations
|
||||
=========================
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
data = lmp.gather_atoms(name,type,count) # return per-atom property of all atoms gathered into data, ordered by atom ID
|
||||
# name = "x", "charge", "type", etc
|
||||
@ -42,7 +42,7 @@ For the scatter methods, the array of coordinates passed to must be a
|
||||
ctypes vector of ints or doubles, allocated and initialized something
|
||||
like this:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from ctypes import c_double
|
||||
natoms = lmp.get_natoms()
|
||||
|
||||
@ -262,6 +262,8 @@ Disable generating a citation reminder (see above) at all.
|
||||
|
||||
**-nonbuf**
|
||||
|
||||
.. versionadded:: 15Sep2022
|
||||
|
||||
Turn off buffering for screen and logfile output. For performance
|
||||
reasons, output to the screen and logfile is usually buffered, i.e.
|
||||
output is only written to a file if its buffer - typically 4096 bytes -
|
||||
@ -442,7 +444,7 @@ the LAMMPS simulation domain.
|
||||
|
||||
.. _restart2data:
|
||||
|
||||
**-restart2data restartfile [remap] datafile keyword value ...**
|
||||
**-restart2data restartfile datafile keyword value ...**
|
||||
|
||||
Convert the restart file into a data file and immediately exit. This
|
||||
is the same operation as if the following 2-line input script were
|
||||
@ -450,7 +452,7 @@ run:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
read_restart restartfile [remap]
|
||||
read_restart restartfile
|
||||
write_data datafile keyword value ...
|
||||
|
||||
The specified restartfile and/or datafile name may contain the wild-card
|
||||
@ -462,28 +464,21 @@ Note that a filename such as file.\* may need to be enclosed in quotes or
|
||||
the "\*" character prefixed with a backslash ("\") to avoid shell
|
||||
expansion of the "\*" character.
|
||||
|
||||
Following restartfile argument, the optional word "remap" may be used.
|
||||
This has the same effect like adding it to a
|
||||
:doc:`read_restart <read_restart>` command, and operates as explained on
|
||||
its doc page. This is useful if reading the restart file triggers an
|
||||
error that atoms have been lost. In that case, use of the remap flag
|
||||
should allow the data file to still be produced.
|
||||
|
||||
The syntax following restartfile (or remap), namely
|
||||
The syntax following restartfile, namely
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
datafile keyword value ...
|
||||
|
||||
is identical to the arguments of the :doc:`write_data <write_data>`
|
||||
command. See its page for details. This includes its
|
||||
command. See its documentation page for details. This includes its
|
||||
optional keyword/value settings.
|
||||
|
||||
----------
|
||||
|
||||
.. _restart2dump:
|
||||
|
||||
**-restart2dump restartfile [remap] group-ID dumpstyle dumpfile arg1 arg2 ...**
|
||||
**-restart2dump restartfile group-ID dumpstyle dumpfile arg1 arg2 ...**
|
||||
|
||||
Convert the restart file into a dump file and immediately exit. This
|
||||
is the same operation as if the following 2-line input script were
|
||||
@ -491,7 +486,7 @@ run:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
read_restart restartfile [remap]
|
||||
read_restart restartfile
|
||||
write_dump group-ID dumpstyle dumpfile arg1 arg2 ...
|
||||
|
||||
Note that the specified restartfile and dumpfile names may contain
|
||||
@ -503,24 +498,17 @@ such as file.\* may need to be enclosed in quotes or the "\*" character
|
||||
prefixed with a backslash ("\") to avoid shell expansion of the "\*"
|
||||
character.
|
||||
|
||||
Note that following the restartfile argument, the optional word "remap"
|
||||
can be used. This has the effect as adding it to the
|
||||
:doc:`read_restart <read_restart>` command, as explained on its doc page.
|
||||
This is useful if reading the restart file triggers an error that atoms
|
||||
have been lost. In that case, use of the remap flag should allow the
|
||||
dump file to still be produced.
|
||||
|
||||
The syntax following restartfile (or remap), namely
|
||||
The syntax following restartfile, namely
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
group-ID dumpstyle dumpfile arg1 arg2 ...
|
||||
|
||||
is identical to the arguments of the :doc:`write_dump <write_dump>`
|
||||
command. See its page for details. This includes what per-atom
|
||||
fields are written to the dump file and optional dump_modify settings,
|
||||
including ones that affect how parallel dump files are written, e.g.
|
||||
the *nfile* and *fileper* keywords. See the
|
||||
command. See its documentation page for details. This includes what
|
||||
per-atom fields are written to the dump file and optional dump_modify
|
||||
settings, including ones that affect how parallel dump files are written,
|
||||
e.g. the *nfile* and *fileper* keywords. See the
|
||||
:doc:`dump_modify <dump_modify>` page for details.
|
||||
|
||||
----------
|
||||
|
||||
@ -212,14 +212,15 @@ threads/task as Nt. The product of these two values should be N, i.e.
|
||||
.. note::
|
||||
|
||||
The default for the :doc:`package kokkos <package>` command when
|
||||
running on KNL is to use "half" neighbor lists and set the Newton flag
|
||||
to "on" for both pairwise and bonded interactions. This will typically
|
||||
be best for many-body potentials. For simpler pairwise potentials, it
|
||||
may be faster to use a "full" neighbor list with Newton flag to "off".
|
||||
Use the "-pk kokkos" :doc:`command-line switch <Run_options>` to change
|
||||
the default :doc:`package kokkos <package>` options. See its page for
|
||||
details and default settings. Experimenting with its options can provide
|
||||
a speed-up for specific calculations. For example:
|
||||
running on KNL is to use "half" neighbor lists and set the Newton
|
||||
flag to "on" for both pairwise and bonded interactions. This will
|
||||
typically be best for many-body potentials. For simpler pairwise
|
||||
potentials, it may be faster to use a "full" neighbor list with
|
||||
Newton flag to "off". Use the "-pk kokkos" :doc:`command-line switch
|
||||
<Run_options>` to change the default :doc:`package kokkos <package>`
|
||||
options. See its documentation page for details and default
|
||||
settings. Experimenting with its options can provide a speed-up for
|
||||
specific calculations. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -271,17 +272,18 @@ one or more nodes, each with two GPUs:
|
||||
.. note::
|
||||
|
||||
The default for the :doc:`package kokkos <package>` command when
|
||||
running on GPUs is to use "full" neighbor lists and set the Newton flag
|
||||
to "off" for both pairwise and bonded interactions, along with threaded
|
||||
communication. When running on Maxwell or Kepler GPUs, this will
|
||||
typically be best. For Pascal GPUs and beyond, using "half" neighbor lists and
|
||||
setting the Newton flag to "on" may be faster. For many pair styles,
|
||||
setting the neighbor binsize equal to twice the CPU default value will
|
||||
give speedup, which is the default when running on GPUs. Use the "-pk
|
||||
kokkos" :doc:`command-line switch <Run_options>` to change the default
|
||||
:doc:`package kokkos <package>` options. See its page for details and
|
||||
default settings. Experimenting with its options can provide a speed-up
|
||||
for specific calculations. For example:
|
||||
running on GPUs is to use "full" neighbor lists and set the Newton
|
||||
flag to "off" for both pairwise and bonded interactions, along with
|
||||
threaded communication. When running on Maxwell or Kepler GPUs, this
|
||||
will typically be best. For Pascal GPUs and beyond, using "half"
|
||||
neighbor lists and setting the Newton flag to "on" may be faster. For
|
||||
many pair styles, setting the neighbor binsize equal to twice the CPU
|
||||
default value will give speedup, which is the default when running on
|
||||
GPUs. Use the "-pk kokkos" :doc:`command-line switch <Run_options>`
|
||||
to change the default :doc:`package kokkos <package>` options. See
|
||||
its documentation page for details and default
|
||||
settings. Experimenting with its options can provide a speed-up for
|
||||
specific calculations. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ Pre-processing tools
|
||||
* :ref:`msi2lmp <msi>`
|
||||
* :ref:`polybond <polybond>`
|
||||
* :ref:`stl_bin2txt <stlconvert>`
|
||||
|
||||
* :ref:`tabulate <tabulate>`
|
||||
|
||||
Post-processing tools
|
||||
=====================
|
||||
@ -1159,13 +1159,27 @@ For illustration purposes below is a part of the Tcl example script.
|
||||
|
||||
----------
|
||||
|
||||
.. _tabulate:
|
||||
|
||||
tabulate tool
|
||||
--------------
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
The ``tabulate`` folder contains Python scripts scripts to generate tabulated
|
||||
potential files for LAMMPS. The bulk of the code is in the ``tabulate`` module
|
||||
in the ``tabulate.py`` file. Some example files demonstrating its use are
|
||||
included. See the README file for more information.
|
||||
|
||||
----------
|
||||
|
||||
.. _vim:
|
||||
|
||||
vim tool
|
||||
------------------
|
||||
|
||||
The files in the tools/vim directory are add-ons to the VIM editor
|
||||
that allow easier editing of LAMMPS input scripts. See the README.txt
|
||||
The files in the ``tools/vim`` directory are add-ons to the VIM editor
|
||||
that allow easier editing of LAMMPS input scripts. See the ``README.txt``
|
||||
file for details.
|
||||
|
||||
These files were provided by Gerolf Ziegenhain (gerolf at
|
||||
|
||||
@ -25,23 +25,25 @@ The *gaussian* angle style uses the potential:
|
||||
|
||||
.. math::
|
||||
|
||||
E = -k_B T ln\left(\sum_{i=1}^{n} \frac{A_i}{w_i \sqrt{\pi/2}} exp\left( \frac{-(\theta-\theta_{i})^2}{w_i^2})\right) \right)
|
||||
E = -k_B T ln\left(\sum_{i=1}^{n} \frac{A_i}{w_i \sqrt{\pi/2}} exp\left( \frac{-2(\theta-\theta_{i})^2}{w_i^2}\right) \right)
|
||||
|
||||
This analytical form is a suitable potential for obtaining mesoscale
|
||||
effective force fields which can reproduce target atomistic
|
||||
distributions :ref:`(Milano) <Milano1>`.
|
||||
|
||||
This analytical form is a suitable potential for obtaining
|
||||
mesoscale effective force fields which can reproduce target atomistic distributions :ref:`(Milano) <Milano1>`
|
||||
The following coefficients must be defined for each angle type via the
|
||||
:doc:`angle_coeff <angle_coeff>` command as in the example above, or in
|
||||
the data file or restart files read by the :doc:`read_data <read_data>`
|
||||
or :doc:`read_restart <read_restart>` commands:
|
||||
|
||||
* T temperature at which the potential was derived
|
||||
* :math:`T` temperature at which the potential was derived
|
||||
* :math:`n` (integer >=1)
|
||||
* :math:`A_1` (-)
|
||||
* :math:`w_1` (-)
|
||||
* :math:`A_1` (> 0, radians)
|
||||
* :math:`w_1` (> 0, radians)
|
||||
* :math:`\theta_1` (degrees)
|
||||
* ...
|
||||
* :math:`A_n` (-)
|
||||
* :math:`w_n` (-)
|
||||
* :math:`A_n` (> 0, radians)
|
||||
* :math:`w_n` (> 0, radians)
|
||||
* :math:`\theta_n` (degrees)
|
||||
|
||||
|
||||
|
||||
@ -59,6 +59,10 @@ format of this file is described below.
|
||||
|
||||
----------
|
||||
|
||||
Suitable tables for use with this angle style can be created using the
|
||||
Python code in the ``tools/tabulate`` folder of the LAMMPS source code
|
||||
distribution.
|
||||
|
||||
The format of a tabulated file is as follows (without the
|
||||
parenthesized comments):
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ which is proportional to the tangential shear displacement with a
|
||||
stiffness of :math:`k_s`. This tangential force also induces a torque.
|
||||
In addition, bending and twisting torques are also applied to
|
||||
particles which are proportional to angular bending and twisting
|
||||
displacements with stiffnesses of :math`k_b` and :math:`k_t',
|
||||
displacements with stiffnesses of :math:`k_b` and :math:`k_t`,
|
||||
respectively. Details on the calculations of shear displacements and
|
||||
angular displacements can be found in :ref:`(Wang) <Wang2009>` and
|
||||
:ref:`(Wang and Mora) <Wang2009b>`.
|
||||
|
||||
@ -25,33 +25,34 @@ The *gaussian* bond style uses the potential:
|
||||
|
||||
.. math::
|
||||
|
||||
E = -k_B T ln\left(\sum_{i=1}^{n} \frac{A_i}{w_i \sqrt{\pi/2}} exp\left( \frac{-(r-r_{i})^2}{w_i^2})\right) \right)
|
||||
E = -k_B T ln\left(\sum_{i=1}^{n} \frac{A_i}{w_i \sqrt{\pi/2}} exp\left( \frac{-2(r-r_{i})^2}{w_i^2}\right)\right)
|
||||
|
||||
This analytical form is a suitable potential for obtaining
|
||||
mesoscale effective force fields which can reproduce target atomistic distributions :ref:`(Milano) <Milano0>`
|
||||
This analytical form is a suitable potential for obtaining mesoscale
|
||||
effective force fields which can reproduce target atomistic
|
||||
distributions :ref:`(Milano) <Milano0>`
|
||||
|
||||
The following coefficients must be defined for each bond type via the
|
||||
:doc:`bond_coeff <bond_coeff>` command as in the example above, or in
|
||||
the data file or restart files read by the :doc:`read_data <read_data>`
|
||||
or :doc:`read_restart <read_restart>` commands:
|
||||
|
||||
* T temperature at which the potential was derived
|
||||
* :math:`T` temperature at which the potential was derived
|
||||
* :math:`n` (integer >=1)
|
||||
* :math:`A_1` (-)
|
||||
* :math:`w_1` (-)
|
||||
* :math:`r_1` (length)
|
||||
* :math:`A_1` (> 0, distance)
|
||||
* :math:`w_1` (> 0, distance)
|
||||
* :math:`r_1` (>= 0, distance)
|
||||
* ...
|
||||
* :math:`A_n` (-)
|
||||
* :math:`w_n` (-)
|
||||
* :math:`r_n` (length)
|
||||
* :math:`A_n` (> 0, distance)
|
||||
* :math:`w_n` (> 0, distance)
|
||||
* :math:`r_n` (>= 0, distance)
|
||||
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This bond style can only be used if LAMMPS was built with the
|
||||
EXTRA-MOLECULE package. See the :doc:`Build package <Build_package>` doc
|
||||
page for more info.
|
||||
EXTRA-MOLECULE package. See the :doc:`Build package <Build_package>`
|
||||
doc page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -59,6 +59,13 @@ this file is described below.
|
||||
|
||||
----------
|
||||
|
||||
Suitable tables for use with this bond style can be created by LAMMPS
|
||||
itself from existing bond styles using the :doc:`bond_write
|
||||
<bond_write>` command. This can be useful to have a template file for
|
||||
testing the bond style settings and to build a compatible custom file.
|
||||
Another option to generate tables is the Python code in the
|
||||
``tools/tabulate`` folder of the LAMMPS source code distribution.
|
||||
|
||||
The format of a tabulated file is as follows (without the
|
||||
parenthesized comments):
|
||||
|
||||
@ -149,7 +156,8 @@ info.
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`bond_coeff <bond_coeff>`, :doc:`delete_bonds <delete_bonds>`
|
||||
:doc:`bond_coeff <bond_coeff>`, :doc:`delete_bonds <delete_bonds>`,
|
||||
:doc:`bond_write <bond_write>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
.. index:: box
|
||||
|
||||
box command
|
||||
===========
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
box keyword value ...
|
||||
|
||||
* one or more keyword/value pairs may be appended
|
||||
* keyword = *tilt*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*tilt* value = *small* or *large*
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
box tilt large
|
||||
box tilt small
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Set attributes of the simulation box.
|
||||
|
||||
For triclinic (non-orthogonal) simulation boxes, the *tilt* keyword
|
||||
allows simulation domains to be created with arbitrary tilt factors,
|
||||
e.g. via the :doc:`create_box <create_box>` or
|
||||
:doc:`read_data <read_data>` commands. Tilt factors determine how
|
||||
skewed the triclinic box is; see the :doc:`Howto triclinic <Howto_triclinic>` page for a discussion of triclinic
|
||||
boxes in LAMMPS.
|
||||
|
||||
LAMMPS normally requires that no tilt factor can skew the box more
|
||||
than half the distance of the parallel box length, which is the first
|
||||
dimension in the tilt factor (x for xz). If *tilt* is set to
|
||||
*small*, which is the default, then an error will be
|
||||
generated if a box is created which exceeds this limit. If *tilt*
|
||||
is set to *large*, then no limit is enforced. You can create
|
||||
a box with any tilt factors you wish.
|
||||
|
||||
Note that if a simulation box has a large tilt factor, LAMMPS will run
|
||||
less efficiently, due to the large volume of communication needed to
|
||||
acquire ghost atoms around a processor's irregular-shaped sub-domain.
|
||||
For extreme values of tilt, LAMMPS may also lose atoms and generate an
|
||||
error.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This command cannot be used after the simulation box is defined by a
|
||||
:doc:`read_data <read_data>` or :doc:`create_box <create_box>` command or
|
||||
:doc:`read_restart <read_restart>` command.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
none
|
||||
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The default value is tilt = small.
|
||||
@ -13,7 +13,6 @@ Commands
|
||||
bond_style
|
||||
bond_write
|
||||
boundary
|
||||
box
|
||||
change_box
|
||||
clear
|
||||
comm_modify
|
||||
@ -43,6 +42,7 @@ Commands
|
||||
echo
|
||||
fix
|
||||
fix_modify
|
||||
fitpod_command
|
||||
group
|
||||
group2ndx
|
||||
hyper
|
||||
@ -90,8 +90,7 @@ Commands
|
||||
region
|
||||
replicate
|
||||
rerun
|
||||
reset_atom_ids
|
||||
reset_mol_ids
|
||||
reset_atoms
|
||||
reset_timestep
|
||||
restart
|
||||
run
|
||||
|
||||
@ -43,29 +43,38 @@ underscores.
|
||||
|
||||
----------
|
||||
|
||||
Computes calculate one of three styles of quantities: global,
|
||||
per-atom, or local. A global quantity is one or more system-wide
|
||||
values (e.g., the temperature of the system). A per-atom quantity is
|
||||
one or more values per atom (e.g., the kinetic energy of each atom).
|
||||
Per-atom values are set to 0.0 for atoms not in the specified compute
|
||||
group. Local quantities are calculated by each processor based on the
|
||||
atoms it owns, but there may be zero or more per atom (e.g., a list of
|
||||
bond distances). Computes that produce per-atom quantities have the
|
||||
word "atom" in their style (e.g., *ke/atom*\ ). Computes that produce
|
||||
local quantities have the word "local" in their style
|
||||
(e.g., *bond/local*\ ). Styles with neither "atom" or "local" in their
|
||||
style produce global quantities.
|
||||
Computes calculate one or more of four styles of quantities: global,
|
||||
per-atom, local, or per-atom. A global quantity is one or more
|
||||
system-wide values, e.g. the temperature of the system. A per-atom
|
||||
quantity is one or more values per atom, e.g. the kinetic energy of
|
||||
each atom. Per-atom values are set to 0.0 for atoms not in the
|
||||
specified compute group. Local quantities are calculated by each
|
||||
processor based on the atoms it owns, but there may be zero or more
|
||||
per atom, e.g. a list of bond distances. Per-grid quantities are
|
||||
calculated on a regular 2d or 3d grid which overlays a 2d or 3d
|
||||
simulation domain. The grid points and the data they store are
|
||||
distributed across processors; each processor owns the grid points
|
||||
which fall within its sub-domain.
|
||||
|
||||
Note that a single compute can produce either global or per-atom or
|
||||
local quantities, but not both global and per-atom. It can produce
|
||||
local quantities in tandem with global or per-atom quantities. The
|
||||
compute page will explain.
|
||||
Computes that produce per-atom quantities have the word "atom" at the
|
||||
end of their style, e.g. *ke/atom*\ . Computes that produce local
|
||||
quantities have the word "local" at the end of their style,
|
||||
e.g. *bond/local*\ . Computes that produce per-grid quantities have
|
||||
the word "grid" at the end of their style, e.g. *property/grid*\ .
|
||||
Styles with neither "atom" or "local" or "grid" at the end of their
|
||||
style name produce global quantities.
|
||||
|
||||
Global, per-atom, and local quantities each come in three kinds: a
|
||||
single scalar value, a vector of values, or a 2d array of values. The
|
||||
doc page for each compute describes the style and kind of values it
|
||||
produces (e.g., a per-atom vector). Some computes produce more than one
|
||||
kind of a single style (e.g., a global scalar and a global vector).
|
||||
Note that a single compute typically produces either global or
|
||||
per-atom or local or per-grid values. It does not compute both global
|
||||
and per-atom values. It can produce local values or per-grid values
|
||||
in tandem with global or per-atom quantities. The compute doc page
|
||||
will explain the details.
|
||||
|
||||
Global, per-atom, local, and per-grid quantities come in three kinds:
|
||||
a single scalar value, a vector of values, or a 2d array of values.
|
||||
The doc page for each compute describes the style and kind of values
|
||||
it produces, e.g. a per-atom vector. Some computes produce more than
|
||||
one kind of a single style, e.g. a global scalar and a global vector.
|
||||
|
||||
When a compute quantity is accessed, as in many of the output commands
|
||||
discussed below, it can be referenced via the following bracket
|
||||
@ -252,7 +261,8 @@ The individual style names on the :doc:`Commands compute <Commands_compute>` pag
|
||||
* :doc:`pressure/uef <compute_pressure_uef>` - pressure tensor in the reference frame of an applied flow field
|
||||
* :doc:`property/atom <compute_property_atom>` - convert atom attributes to per-atom vectors/arrays
|
||||
* :doc:`property/chunk <compute_property_chunk>` - extract various per-chunk attributes
|
||||
* :doc:`property/local <compute_property_local>` - convert local attributes to localvectors/arrays
|
||||
* :doc:`property/grid <compute_property_grid>` - convert per-grid attributes to per-grid vectors/arrays
|
||||
* :doc:`property/local <compute_property_local>` - convert local attributes to local vectors/arrays
|
||||
* :doc:`ptm/atom <compute_ptm_atom>` - determines the local lattice structure based on the Polyhedral Template Matching method
|
||||
* :doc:`rdf <compute_rdf>` - radial distribution function :math:`g(r)` histogram of group of atoms
|
||||
* :doc:`reduce <compute_reduce>` - combine per-atom quantities into a single global value
|
||||
|
||||
@ -37,27 +37,29 @@ Description
|
||||
Modify one or more parameters of a previously defined compute. Not
|
||||
all compute styles support all parameters.
|
||||
|
||||
The *extra/dof* or *extra* keyword refers to how many degrees of freedom are
|
||||
subtracted (typically from :math:`3N`) as a normalizing
|
||||
The *extra/dof* or *extra* keyword refers to how many degrees of
|
||||
freedom are subtracted (typically from :math:`3N`) as a normalizing
|
||||
factor in a temperature computation. Only computes that compute a
|
||||
temperature use this option. The default is 2 or 3 for
|
||||
:doc:`2d or 3d systems <dimension>`, which is a correction factor for an
|
||||
ensemble of velocities with zero total linear momentum. For compute
|
||||
temp/partial, if one or more velocity components are excluded, the
|
||||
value used for *extra* is scaled accordingly. You can use a negative
|
||||
number for the *extra* parameter if you need to add
|
||||
degrees-of-freedom. See the :doc:`compute temp/asphere <compute_temp_asphere>` command for an example.
|
||||
temperature use this option. The default is 2 or 3 for :doc:`2d or 3d
|
||||
systems <dimension>` which is a correction factor for an ensemble of
|
||||
velocities with zero total linear momentum. For compute temp/partial,
|
||||
if one or more velocity components are excluded, the value used for
|
||||
*extra* is scaled accordingly. You can use a negative number for the
|
||||
*extra* parameter if you need to add degrees-of-freedom. See the
|
||||
:doc:`compute temp/asphere <compute_temp_asphere>` command for an
|
||||
example.
|
||||
|
||||
The *dynamic/dof* or *dynamic* keyword determines whether the number
|
||||
of atoms :math:`N` in the compute group and their associated degrees of
|
||||
freedom (DOF) are re-computed each time a temperature is computed. Only
|
||||
compute styles that calculate a temperature use this option. By
|
||||
default, :math:`N` and their DOF are assumed to be constant. If you are
|
||||
adding atoms or molecules to the system (see the :doc:`fix pour <fix_pour>`,
|
||||
:doc:`fix deposit <fix_deposit>`, and :doc:`fix gcmc <fix_gcmc>` commands) or
|
||||
expect atoms or molecules to be lost (e.g., due to exiting the simulation box
|
||||
or via :doc:`fix evaporate <fix_evaporate>`), then this option should be used
|
||||
to ensure the temperature is correctly normalized.
|
||||
of atoms :math:`N` in the compute group and their associated degrees
|
||||
of freedom (DOF) are re-computed each time a temperature is computed.
|
||||
Only compute styles that calculate a temperature use this option. By
|
||||
default, :math:`N` and their DOF are assumed to be constant. If you
|
||||
are adding atoms or molecules to the system (see the :doc:`fix pour
|
||||
<fix_pour>`, :doc:`fix deposit <fix_deposit>`, and :doc:`fix gcmc
|
||||
<fix_gcmc>` commands) or expect atoms or molecules to be lost
|
||||
(e.g. due to exiting the simulation box or via :doc:`fix evaporate
|
||||
<fix_evaporate>`), then this option should be used to insure the
|
||||
temperature is correctly normalized.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ commands.
|
||||
The value *dist* is the distance between the pair of atoms.
|
||||
The values *dx*, *dy*, and *dz* are the :math:`(x,y,z)` components of the
|
||||
*distance* between the pair of atoms. This value is always the
|
||||
distance from the atom of lower to the one with the higher id.
|
||||
distance from the atom of higher to the one with the lower atom ID.
|
||||
|
||||
The value *eng* is the interaction energy for the pair of atoms.
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@ Syntax
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* property/chunk = style name of this compute command
|
||||
* input = one or more attributes
|
||||
* chunkID = ID of :doc:`compute chunk/atom <compute_chunk_atom>` command that defines the chunks
|
||||
* input1,etc = one or more attributes
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -26,8 +27,8 @@ Examples
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all property/chunk count
|
||||
compute 1 all property/chunk ID coord1
|
||||
compute 1 all property/chunk bin2d id count
|
||||
compute 1 all property/chunk myChunks id coord1
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -35,29 +36,28 @@ Description
|
||||
Define a computation that stores the specified attributes of chunks of
|
||||
atoms.
|
||||
|
||||
In LAMMPS, chunks are collections of atoms defined by a
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command, which assigns each atom
|
||||
to a single chunk (or no chunk). The ID for this command is specified
|
||||
as chunkID. For example, a single chunk could be the atoms in a molecule or
|
||||
atoms in a spatial bin. See the :doc:`compute chunk/atom <compute_chunk_atom>`
|
||||
and :doc:`Howto chunk <Howto_chunk>` doc pages for details of how chunks can be
|
||||
defined and examples of how they can be used to measure properties of a system.
|
||||
In LAMMPS, chunks are collections of atoms defined by a :doc:`compute
|
||||
chunk/atom <compute_chunk_atom>` command, which assigns each atom to a
|
||||
single chunk (or no chunk). The ID for this command is specified as
|
||||
chunkID. For example, a single chunk could be the atoms in a molecule
|
||||
or atoms in a spatial bin. See the :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` and :doc:`Howto chunk <Howto_chunk>` doc pages
|
||||
for details of how chunks can be defined and examples of how they can
|
||||
be used to measure properties of a system.
|
||||
|
||||
This compute calculates and stores the specified attributes of chunks
|
||||
as global data so they can be accessed by other
|
||||
:doc:`output commands <Howto_output>` and used in conjunction with other
|
||||
commands that generate per-chunk data, such as
|
||||
:doc:`compute com/chunk <compute_com_chunk>` or
|
||||
:doc:`compute msd/chunk <compute_msd_chunk>`.
|
||||
as global data so they can be accessed by other :doc:`output commands
|
||||
<Howto_output>` and used in conjunction with other commands that
|
||||
generate per-chunk data, such as :doc:`compute com/chunk
|
||||
<compute_com_chunk>` or :doc:`compute msd/chunk <compute_msd_chunk>`.
|
||||
|
||||
Note that only atoms in the specified group contribute to the
|
||||
calculation of the *count* attribute. The
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command defines its own group;
|
||||
atoms will have a chunk ID = 0 if they are not in that group,
|
||||
signifying they are not assigned to a chunk, and will thus also not
|
||||
contribute to this calculation. You can specify the "all" group for
|
||||
this command if you simply want to include atoms with non-zero chunk
|
||||
IDs.
|
||||
calculation of the *count* attribute. The :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` command defines its own group; atoms will have a
|
||||
chunk ID = 0 if they are not in that group, signifying they are not
|
||||
assigned to a chunk, and will thus also not contribute to this
|
||||
calculation. You can specify the "all" group for this command if you
|
||||
simply want to include atoms with non-zero chunk IDs.
|
||||
|
||||
The *count* attribute is the number of atoms in the chunk.
|
||||
|
||||
@ -66,21 +66,24 @@ can only be used if the *compress* keyword was set to *yes* for the
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command referenced by
|
||||
chunkID. This means that the original chunk IDs (e.g., molecule IDs)
|
||||
will have been compressed to remove chunk IDs with no atoms assigned
|
||||
to them. Thus a compressed chunk ID of 3 may correspond to an original
|
||||
chunk ID (molecule ID in this case) of 415. The *id* attribute will
|
||||
then be 415 for the third chunk.
|
||||
to them. Thus a compressed chunk ID of 3 may correspond to an
|
||||
original chunk ID (molecule ID in this case) of 415. The *id*
|
||||
attribute will then be 415 for the third chunk.
|
||||
|
||||
The *coordN* attributes can only be used if a *binning* style was used
|
||||
in the :doc:`compute chunk/atom <compute_chunk_atom>` command referenced
|
||||
by chunkID. For *bin/1d*, *bin/2d*, and *bin/3d* styles the attribute
|
||||
is the center point of the bin in the corresponding dimension. Style
|
||||
*bin/1d* only defines a *coord1* attribute. Style *bin/2d* adds a
|
||||
*coord2* attribute. Style *bin/3d* adds a *coord3* attribute.
|
||||
|
||||
Note that if the value of the *units* keyword used in the :doc:`compute chunk/atom command <compute_chunk_atom>` is *box* or *lattice*, the
|
||||
*coordN* attributes will be in distance :doc:`units <units>`. If the
|
||||
value of the *units* keyword is *reduced*, the *coordN* attributes
|
||||
will be in unitless reduced units (0--1).
|
||||
in the :doc:`compute chunk/atom <compute_chunk_atom>` command
|
||||
referenced by chunkID. For *bin/1d*, *bin/2d*, and *bin/3d* styles
|
||||
the attribute is the center point of the bin in the corresponding
|
||||
dimension. Style *bin/1d* only defines a *coord1* attribute. Style
|
||||
*bin/2d* adds a *coord2* attribute. Style *bin/3d* adds a *coord3*
|
||||
attribute.
|
||||
|
||||
Note that if the value of the *units* keyword used in the
|
||||
:doc:`compute chunk/atom command <compute_chunk_atom>` is *box* or
|
||||
*lattice*, the *coordN* attributes will be in distance :doc:`units
|
||||
<units>`. If the value of the *units* keyword is *reduced*, the
|
||||
*coordN* attributes will be in unitless reduced units (0-1).
|
||||
|
||||
The simplest way to output the results of the compute property/chunk
|
||||
calculation to a file is to use the :doc:`fix ave/time <fix_ave_time>`
|
||||
|
||||
114
doc/src/compute_property_grid.rst
Normal file
114
doc/src/compute_property_grid.rst
Normal file
@ -0,0 +1,114 @@
|
||||
.. index:: compute property/grid
|
||||
|
||||
compute property/grid command
|
||||
=============================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
compute ID group-ID property/grid Nx Ny Nz input1 input2 ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* property/grid = style name of this compute command
|
||||
* Nx, Ny, Nz = grid size in each dimension
|
||||
* input1,etc = one or more attributes
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
attributes = id, ix, iy, iz, x, y, z, xs, ys, zs, xc, yc, zc, xsc, ysc, zsc
|
||||
id = ID of grid cell, x fastest, y next, z slowest
|
||||
ix,iy,iz = grid indices in each dimension (1 to N inclusive)
|
||||
x,y,z = coords of lower left corner of grid cell
|
||||
xs,ys,zs = scaled coords of lower left corner of grid cell (0.0 to 1.0)
|
||||
xc,yc,zc = coords of center point of grid cell
|
||||
xsc,ysc,zsc = scaled coords of center point of grid cell (0.0 to 1.0)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all property/grid id ix iy iz
|
||||
compute 1 all property/grid id xc yc zc
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Define a computation that stores the specified attributes of a
|
||||
distributed grid. In LAMMPS, distributed grids are regular 2d or 3d
|
||||
grids which overlay a 2d or 3d simulation domain. Each processor owns
|
||||
the grid cells whose center points lie within its sub-domain. See the
|
||||
:doc:`Howto grid <Howto_grid>` doc page for details of how distributed
|
||||
grids can be defined by various commands and referenced.
|
||||
|
||||
This compute stores the specified attributes of grids as per-grid data
|
||||
so they can be accessed by other :doc:`output commands <Howto_output>`
|
||||
such as :doc:`dump grid <dump>`.
|
||||
|
||||
*Nx*, *Ny*, and *Nz* define the size of the grid. For a 2d simulation
|
||||
*Nz* must be 1. When this compute is used by :doc:`dump grid <dump>`,
|
||||
to output per-grid values from other computes of fixes, the grid size
|
||||
specified for this command must be consistent with the grid sizes
|
||||
used by the other commands.
|
||||
|
||||
The *id* attribute stores the grid ID for each grid cell. For a
|
||||
global grid of size Nx by Ny by Nz (in 3d simulations) the grid IDs
|
||||
range from 1 to Nx*Ny*Nz. They are ordered with the X index of the 3d
|
||||
grid varying fastest, then Y, then Z slowest. For 2d grids (in 2d
|
||||
simulations), the grid IDs range from 1 to Nx*Ny, with X varying
|
||||
fastest and Y slowest.
|
||||
|
||||
The *ix*, *iy*, *iz* attributes are the indices of a grid cell in
|
||||
each dimension. They range from 1 to Nx inclusive in the X dimension,
|
||||
and similar for Y and Z.
|
||||
|
||||
The *x*, *y*, *z* attributes are the coordinates of the lower left
|
||||
corner point of each grid cell.
|
||||
|
||||
The *xs*, *ys*, *zs* attributes are also coordinates of the lower left
|
||||
corner point of each grid cell, except in scaled coordinates, where
|
||||
the lower-left corner of the entire simulation box is (0,0,0) and the
|
||||
upper right corner is (1,1,1).
|
||||
|
||||
The *xc*, *yc*, *zc* attributes are the coordinates of the center
|
||||
point of each grid cell.
|
||||
|
||||
The *xsc*, *ysc*, *zsc* attributes are also coordinates of the center
|
||||
point each grid cell, except in scaled coordinates, where the
|
||||
lower-left corner of the entire simulation box is (0,0,0) and the upper
|
||||
right corner is (1,1,1).
|
||||
|
||||
For :doc:`triclinic simulation boxes <Howto_triclinic>`, the grid
|
||||
point coordinates for (x,y,z) and (xc,yc,zc) will reflect the
|
||||
triclinic geometry. For (xs,yz,zs) and (xsc,ysc,zsc), the coordinates
|
||||
are the same for orthogonal versus triclinic boxes.
|
||||
|
||||
Output info
|
||||
"""""""""""
|
||||
|
||||
This compute calculates a per-grid vector or array depending on the
|
||||
number of input values. The length of the vector or number of array
|
||||
rows (distributed across all processors) is Nx * Ny * Nz. For access
|
||||
by other commands, the name of the single grid produced by this
|
||||
command is "grid". The name of its per-grid data is "data".
|
||||
|
||||
The (x,y,z) and (xc,yc,zc) coordinates are in distance :doc:`units
|
||||
<units>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
For 2d simulations, the attributes which refer to
|
||||
the Z dimension cannot be used.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`dump grid <dump>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
@ -85,10 +85,11 @@ Description
|
||||
"""""""""""
|
||||
|
||||
Define a computation that stores the specified attributes as local
|
||||
data so it can be accessed by other :doc:`output commands <Howto_output>`. If the input attributes refer to bond
|
||||
information, then the number of datums generated, aggregated across
|
||||
all processors, equals the number of bonds in the system. Ditto for
|
||||
pairs, angles, etc.
|
||||
data so it can be accessed by other :doc:`output commands
|
||||
<Howto_output>`. If the input attributes refer to bond information,
|
||||
then the number of datums generated, aggregated across all processors,
|
||||
equals the number of bonds in the system. Ditto for pairs, angles,
|
||||
etc.
|
||||
|
||||
If multiple attributes are specified then they must all generate the
|
||||
same amount of information, so that the resulting local array has the
|
||||
@ -129,17 +130,20 @@ specified compute group. Likewise for angles, dihedrals, etc.
|
||||
For bonds and angles, a bonds/angles that have been broken by setting
|
||||
their bond/angle type to 0 will not be included. Bonds/angles that
|
||||
have been turned off (see the :doc:`fix shake <fix_shake>` or
|
||||
:doc:`delete_bonds <delete_bonds>` commands) by setting their bond/angle
|
||||
type negative are written into the file. This is consistent with the
|
||||
:doc:`compute bond/local <compute_bond_local>` and :doc:`compute angle/local <compute_angle_local>` commands
|
||||
:doc:`delete_bonds <delete_bonds>` commands) by setting their
|
||||
bond/angle type negative are written into the file. This is
|
||||
consistent with the :doc:`compute bond/local <compute_bond_local>` and
|
||||
:doc:`compute angle/local <compute_angle_local>` commands
|
||||
|
||||
Note that as atoms migrate from processor to processor, there will be
|
||||
no consistent ordering of the entries within the local vector or array
|
||||
from one timestep to the next. The only consistency that is
|
||||
guaranteed is that the ordering on a particular timestep will be the
|
||||
same for local vectors or arrays generated by other compute commands.
|
||||
For example, output from the :doc:`compute bond/local <compute_bond_local>` command can be combined with bond
|
||||
atom indices from this command and output by the :doc:`dump local <dump>` command in a consistent way.
|
||||
For example, output from the :doc:`compute bond/local
|
||||
<compute_bond_local>` command can be combined with bond atom indices
|
||||
from this command and output by the :doc:`dump local <dump>` command
|
||||
in a consistent way.
|
||||
|
||||
The *natom1* and *natom2* or *patom1* and *patom2* attributes refer
|
||||
to the atom IDs of the 2 atoms in each pairwise interaction computed
|
||||
@ -177,9 +181,8 @@ the array is the number of bonds, angles, etc. If a single input is
|
||||
specified, a local vector is produced. If two or more inputs are
|
||||
specified, a local array is produced where the number of columns = the
|
||||
number of inputs. The vector or array can be accessed by any command
|
||||
that uses local values from a compute as input. See the
|
||||
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
|
||||
options.
|
||||
that uses local values from a compute as input. See the :doc:`Howto
|
||||
output <Howto_output>` page for an overview of LAMMPS output options.
|
||||
|
||||
The vector or array values will be integers that correspond to the
|
||||
specified attribute.
|
||||
|
||||
@ -29,8 +29,9 @@ Description
|
||||
|
||||
Define a computation that calculates the temperature of a group of
|
||||
atoms. A compute of this style can be used by any command that
|
||||
computes a temperature (e.g., :doc:`thermo_modify <thermo_modify>`,
|
||||
:doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix npt <fix_nh>`)
|
||||
computes a temperature, e.g. :doc:`thermo_modify <thermo_modify>`,
|
||||
:doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix npt <fix_nh>`,
|
||||
etc.
|
||||
|
||||
The temperature is calculated by the formula
|
||||
|
||||
@ -39,17 +40,17 @@ The temperature is calculated by the formula
|
||||
\text{KE} = \frac{\text{dim}}{2} N k_B T,
|
||||
|
||||
where KE = total kinetic energy of the group of atoms (sum of
|
||||
:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the simulation,
|
||||
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
|
||||
constant, and :math:`T` is the absolute temperature.
|
||||
:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the
|
||||
simulation, :math:`N` is the number of atoms in the group, :math:`k_B`
|
||||
is the Boltzmann constant, and :math:`T` is the absolute temperature.
|
||||
|
||||
A kinetic energy tensor, stored as a six-element vector, is also
|
||||
calculated by this compute for use in the computation of a pressure
|
||||
tensor. The formula for the components of the tensor is the same as
|
||||
the above formula, except that :math:`v^2` is replaced by
|
||||
:math:`v_x v_y` for the :math:`xy` component, and so on.
|
||||
The six components of the vector are ordered :math:`xx`, :math:`yy`,
|
||||
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
|
||||
the above formula, except that :math:`v^2` is replaced by :math:`v_x
|
||||
v_y` for the :math:`xy` component, and so on. The six components of
|
||||
the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`,
|
||||
:math:`xz`, :math:`yz`.
|
||||
|
||||
The number of atoms contributing to the temperature is assumed to be
|
||||
constant for the duration of the run; use the *dynamic* option of the
|
||||
@ -85,11 +86,10 @@ Output info
|
||||
"""""""""""
|
||||
|
||||
This compute calculates a global scalar (the temperature) and a global
|
||||
vector of length six (KE tensor), which can be accessed by indices 1--6.
|
||||
These values can be used by any command that uses global scalar or
|
||||
vector values from a compute as input. See the
|
||||
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
|
||||
options.
|
||||
vector of length six (KE tensor), which can be accessed by indices
|
||||
1--6. These values can be used by any command that uses global scalar
|
||||
or vector values from a compute as input. See the :doc:`Howto output
|
||||
<Howto_output>` page for an overview of LAMMPS output options.
|
||||
|
||||
The scalar value calculated by this compute is "intensive". The
|
||||
vector values are "extensive".
|
||||
@ -104,7 +104,9 @@ Restrictions
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`compute temp/partial <compute_temp_partial>`, :doc:`compute temp/region <compute_temp_region>`, :doc:`compute pressure <compute_pressure>`
|
||||
:doc:`compute temp/partial <compute_temp_partial>`,
|
||||
:doc:`compute temp/region <compute_temp_region>`,
|
||||
:doc:`compute pressure <compute_pressure>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -66,20 +66,21 @@ positive or negative values and are called "tilt factors" because they
|
||||
are the amount of displacement applied to faces of an originally
|
||||
orthogonal box to transform it into the parallelepiped.
|
||||
|
||||
By default, a *prism* region used with the create_box command must
|
||||
have tilt factors :math:`(xy,xz,yz)` that do not skew the box more than half
|
||||
By default, a *prism* region used with the create_box command must have
|
||||
tilt factors :math:`(xy,xz,yz)` that do not skew the box more than half
|
||||
the distance of the parallel box length. For example, if
|
||||
:math:`x_\text{lo} = 2` and :math:`x_\text{hi} = 12`, then the :math:`x`
|
||||
box length is 10 and the :math:`xy` tilt factor must be between :math:`-5` and
|
||||
:math:`5`. Similarly, both :math:`xz` and :math:`yz` must be between
|
||||
:math:`-(x_\text{hi}-x_\text{lo})/2` and :math:`+(y_\text{hi}-y_\text{lo})/2`.
|
||||
Note that this is not a limitation, since if the maximum tilt factor is 5 (as
|
||||
in this example), then configurations with tilt :math:`= \dots, -15`,
|
||||
:math:`-5`, :math:`5`, :math:`15`, :math:`25, \dots`
|
||||
are all geometrically equivalent. If you wish to define a box with tilt
|
||||
factors that exceed these limits, you can use the :doc:`box tilt <box>`
|
||||
command, with a setting of *large*\ ; a setting of *small* is the
|
||||
default.
|
||||
box length is 10 and the :math:`xy` tilt factor must be between
|
||||
:math:`-5` and :math:`5`. Similarly, both :math:`xz` and :math:`yz`
|
||||
must be between :math:`-(x_\text{hi}-x_\text{lo})/2` and
|
||||
:math:`+(y_\text{hi}-y_\text{lo})/2`. Note that this is not a
|
||||
limitation, since if the maximum tilt factor is 5 (as in this example),
|
||||
then configurations with tilt :math:`= \dots, -15`, :math:`-5`,
|
||||
:math:`5`, :math:`15`, :math:`25, \dots` are all geometrically
|
||||
equivalent. Simulations with large tilt factors will run inefficiently,
|
||||
since they require more ghost atoms and thus more communication. With
|
||||
very large tilt factors, LAMMPS will eventually produce incorrect
|
||||
trajectories and stop with errors due to lost atoms or similar.
|
||||
|
||||
See the :doc:`Howto triclinic <Howto_triclinic>` page for a
|
||||
geometric description of triclinic boxes, as defined by LAMMPS, and
|
||||
|
||||
@ -135,7 +135,7 @@ number of atoms in the system. Note that this is not done for
|
||||
molecular systems (see the :doc:`atom_style <atom_style>` command),
|
||||
regardless of the *compress* setting, since it would foul up the bond
|
||||
connectivity that has already been assigned. However, the
|
||||
:doc:`reset_atom_ids <reset_atom_ids>` command can be used after this
|
||||
:doc:`reset_atoms id <reset_atoms>` command can be used after this
|
||||
command to accomplish the same thing.
|
||||
|
||||
Note that the re-assignment of IDs is not really a compression, where
|
||||
@ -203,7 +203,7 @@ using molecule template files via the :doc:`molecule <molecule>` and
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`create_atoms <create_atoms>`, :doc:`reset_atom_ids <reset_atom_ids>`
|
||||
:doc:`create_atoms <create_atoms>`, :doc:`reset_atoms id <reset_atoms>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -114,6 +114,10 @@ below.
|
||||
|
||||
----------
|
||||
|
||||
Suitable tables for use with this dihedral style can be created using
|
||||
the Python code in the ``tools/tabulate`` folder of the LAMMPS source
|
||||
code distribution.
|
||||
|
||||
The format of a tabulated file is as follows (without the
|
||||
parenthesized comments). It can begin with one or more comment
|
||||
or blank lines.
|
||||
|
||||
649
doc/src/dump.rst
649
doc/src/dump.rst
@ -3,6 +3,8 @@
|
||||
.. index:: dump cfg
|
||||
.. index:: dump custom
|
||||
.. index:: dump dcd
|
||||
.. index:: dump grid
|
||||
.. index:: dump grid/vtk
|
||||
.. index:: dump local
|
||||
.. index:: dump xtc
|
||||
.. index:: dump yaml
|
||||
@ -57,46 +59,48 @@ Syntax
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dump ID group-ID style N file args
|
||||
dump ID group-ID style N file attribute1 attribute2 ...
|
||||
|
||||
* ID = user-assigned name for the dump
|
||||
* group-ID = ID of the group of atoms to be dumped
|
||||
* style = *atom* or *atom/adios* or *atom/gz* or *atom/zstd* or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *custom/adios* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml*
|
||||
* style = *atom* or *atom/adios* or *atom/gz* or *atom/zstd* or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *custom/adios* or *dcd* or *grid* or *grid/vtk* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* or *yaml*
|
||||
* N = dump on timesteps which are multiples of N
|
||||
* file = name of file to write dump info to
|
||||
* args = list of arguments for a particular style
|
||||
* attribute1,attribute2,... = list of attributes for a particular style
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*atom* args = none
|
||||
*atom/adios* args = none, discussed on :doc:`dump atom/adios <dump_adios>` page
|
||||
*atom/gz* args = none
|
||||
*atom/zstd* args = none
|
||||
*atom/mpiio* args = none
|
||||
*cfg* args = same as *custom* args, see below
|
||||
*cfg/gz* args = same as *custom* args, see below
|
||||
*cfg/zstd* args = same as *custom* args, see below
|
||||
*cfg/mpiio* args = same as *custom* args, see below
|
||||
*cfg/uef* args = same as *custom* args, discussed on :doc:`dump cfg/uef <dump_cfg_uef>` page
|
||||
*custom*, *custom/gz*, *custom/zstd*, *custom/mpiio* args = see below
|
||||
*custom/adios* args = same as *custom* args, discussed on :doc:`dump custom/adios <dump_adios>` page
|
||||
*dcd* args = none
|
||||
*h5md* args = discussed on :doc:`dump h5md <dump_h5md>` page
|
||||
*image* args = discussed on :doc:`dump image <dump_image>` page
|
||||
*local*, *local/gz*, *local/zstd* args = see below
|
||||
*molfile* args = discussed on :doc:`dump molfile <dump_molfile>` page
|
||||
*movie* args = discussed on :doc:`dump image <dump_image>` page
|
||||
*netcdf* args = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*netcdf/mpiio* args = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*vtk* args = same as *custom* args, see below, also :doc:`dump vtk <dump_vtk>` page
|
||||
*xtc* args = none
|
||||
*xyz* args = none
|
||||
*xyz/gz* args = none
|
||||
*xyz/zstd* args = none
|
||||
*xyz/mpiio* args = none
|
||||
*yaml* args = same as *custom* args, see below
|
||||
*atom* attributes = none
|
||||
*atom/adios* attributes = none, discussed on :doc:`dump atom/adios <dump_adios>` page
|
||||
*atom/gz* attributes = none
|
||||
*atom/zstd* attributes = none
|
||||
*atom/mpiio* attributes = none
|
||||
*cfg* attributes = same as *custom* attributes, see below
|
||||
*cfg/gz* attributes = same as *custom* attributes, see below
|
||||
*cfg/zstd* attributes = same as *custom* attributes, see below
|
||||
*cfg/mpiio* attributes = same as *custom* attributes, see below
|
||||
*cfg/uef* attributes = same as *custom* attributes, discussed on :doc:`dump cfg/uef <dump_cfg_uef>` page
|
||||
*custom*, *custom/gz*, *custom/zstd*, *custom/mpiio* attributes = see below
|
||||
*custom/adios* attributes = same as *custom* attributes, discussed on :doc:`dump custom/adios <dump_adios>` page
|
||||
*dcd* attributes = none
|
||||
*h5md* attributes = discussed on :doc:`dump h5md <dump_h5md>` page
|
||||
*grid* attributes = see below
|
||||
*grid/vtk* attributes = see below
|
||||
*image* attributes = discussed on :doc:`dump image <dump_image>` page
|
||||
*local*, *local/gz*, *local/zstd* attributes = see below
|
||||
*molfile* attributes = discussed on :doc:`dump molfile <dump_molfile>` page
|
||||
*movie* attributes = discussed on :doc:`dump image <dump_image>` page
|
||||
*netcdf* attributes = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*netcdf/mpiio* attributes = discussed on :doc:`dump netcdf <dump_netcdf>` page
|
||||
*vtk* attributes = same as *custom* attributes, see below, also :doc:`dump vtk <dump_vtk>` page
|
||||
*xtc* attributes = none
|
||||
*xyz* attributes = none
|
||||
*xyz/gz* attributes = none
|
||||
*xyz/zstd* attributes = none
|
||||
*xyz/mpiio* attributes = none
|
||||
*yaml* attributes = same as *custom* attributes, see below
|
||||
|
||||
* *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *netcdf* or *netcdf/mpiio* or *yaml* args = list of atom attributes
|
||||
* *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *cfg/uef* or *netcdf* or *netcdf/mpiio* or *yaml* attributes:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -143,7 +147,7 @@ Syntax
|
||||
i2_name[I] = Ith column of custom integer array with name, I can include wildcard (see below)
|
||||
d2_name[I] = Ith column of custom floating point vector with name, I can include wildcard (see below)
|
||||
|
||||
* *local* or *local/gz* or *local/zstd* args = list of local attributes
|
||||
* *local* or *local/gz* or *local/zstd* attributes:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -154,6 +158,18 @@ Syntax
|
||||
f_ID = local vector calculated by a fix with ID
|
||||
f_ID[I] = Ith column of local array calculated by a fix with ID, I can include wildcard (see below)
|
||||
|
||||
* *grid* or *grid/vtk* attributes:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
possible attributes = c_ID:gname:dname, c_ID:gname:dname[I], f_ID:gname:dname, f_ID:gname:dname[I]
|
||||
gname = name of grid defined by compute or fix
|
||||
dname = name of data field defined by compute or fix
|
||||
c_ID = per-grid vector calculated by a compute with ID
|
||||
c_ID[I] = Ith column of per-grid array calculated by a compute with ID, I can include wildcard (see below)
|
||||
f_ID = per-grid vector calculated by a fix with ID
|
||||
f_ID[I] = Ith column of per-grid array calculated by a fix with ID, I can include wildcard (see below)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
@ -176,24 +192,32 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Dump a snapshot of atom quantities to one or more files once every
|
||||
:math:`N` timesteps in one of several styles. The *image* and *movie*
|
||||
styles are the exception: the *image* style renders a JPG, PNG, or PPM
|
||||
image file of the atom configuration every :math:`N` timesteps while
|
||||
the *movie* style combines and compresses them into a movie file; both
|
||||
are discussed in detail on the :doc:`dump image <dump_image>` page.
|
||||
The timesteps on which dump output is written can also be controlled
|
||||
by a variable. See the :doc:`dump_modify every <dump_modify>`
|
||||
command.
|
||||
Dump a snapshot of quantities to one or more files once every
|
||||
:math:`N` timesteps in one of several styles. The timesteps on which
|
||||
dump output is written can also be controlled by a variable. See the
|
||||
:doc:`dump_modify every <dump_modify>` command.
|
||||
|
||||
Almost all the styles output per-atom data, i.e. one or more values
|
||||
per atom. The exceptions are as follows. The *local* styles output
|
||||
one or more values per bond (angle, dihedral, improper) or per pair of
|
||||
interacting atoms (force or neighbor interactions). The *grid* styles
|
||||
output one or more values per grid cell, which are produced by other
|
||||
commands which overlay the simulation domain with a regular grid. See
|
||||
the :doc:`Howto grid <Howto_grid>` doc page for details. The *image*
|
||||
style renders a JPG, PNG, or PPM image file of the system for each
|
||||
snapshot, while the *movie* style combines and compresses the series
|
||||
of images into a movie file; both styles are discussed in detail on
|
||||
the :doc:`dump image <dump_image>` page.
|
||||
|
||||
Only information for atoms in the specified group is dumped. The
|
||||
:doc:`dump_modify thresh and region and refresh <dump_modify>` commands
|
||||
can also alter what atoms are included. Not all styles support
|
||||
these options; see details on the :doc:`dump_modify <dump_modify>` doc page.
|
||||
:doc:`dump_modify thresh and region and refresh <dump_modify>`
|
||||
commands can also alter what atoms are included. Not all styles
|
||||
support these options; see details on the :doc:`dump_modify
|
||||
<dump_modify>` doc page.
|
||||
|
||||
As described below, the filename determines the kind of output (text
|
||||
or binary or gzipped, one big file or one per timestep, one big file
|
||||
or multiple smaller files).
|
||||
As described below, the filename determines the kind of output: text
|
||||
or binary or gzipped, one big file or one per timestep, one file for
|
||||
all the processors or multiple smaller files.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -207,74 +231,54 @@ or multiple smaller files).
|
||||
|
||||
.. note::
|
||||
|
||||
Unless the :doc:`dump_modify sort <dump_modify>` option is
|
||||
invoked, the lines of atom information written to dump files
|
||||
(typically one line per atom) will be in an indeterminate order for
|
||||
each snapshot. This is even true when running on a single processor,
|
||||
if the :doc:`atom_modify sort <atom_modify>` option is on, which it is
|
||||
by default. In this case atoms are re-ordered periodically during a
|
||||
simulation, due to spatial sorting. It is also true when running in
|
||||
parallel, because data for a single snapshot is collected from
|
||||
multiple processors, each of which owns a subset of the atoms.
|
||||
Unless the :doc:`dump_modify sort <dump_modify>` option is invoked,
|
||||
the lines of atom or grid information written to dump files
|
||||
(typically one line per atom or grid cell) will be in an
|
||||
indeterminate order for each snapshot. This is even true when
|
||||
running on a single processor, if the :doc:`atom_modify sort
|
||||
<atom_modify>` option is on, which it is by default. In this case
|
||||
atoms are re-ordered periodically during a simulation, due to
|
||||
spatial sorting. It is also true when running in parallel, because
|
||||
data for a single snapshot is collected from multiple processors,
|
||||
each of which owns a subset of the atoms.
|
||||
|
||||
For the *atom*, *custom*, *cfg*, and *local* styles, sorting is off by
|
||||
default. For the *dcd*, *xtc*, *xyz*, and *molfile* styles, sorting
|
||||
by atom ID is on by default. See the :doc:`dump_modify <dump_modify>`
|
||||
page for details.
|
||||
For the *atom*, *custom*, *cfg*, *grid*, and *local* styles, sorting
|
||||
is off by default. For the *dcd*, *grid/vtk*, *xtc*, *xyz*, and
|
||||
*molfile* styles, sorting by atom ID or grid ID is on by default. See
|
||||
the :doc:`dump_modify <dump_modify>` page for details.
|
||||
|
||||
The *atom/gz*, *cfg/gz*, *custom/gz*, *local/gz*, and *xyz/gz* styles
|
||||
are identical in command syntax to the corresponding styles without
|
||||
"gz", however, they generate compressed files using the zlib
|
||||
library. Thus the filename suffix ".gz" is mandatory. This is an
|
||||
alternative approach to writing compressed files via a pipe, as done by
|
||||
the regular dump styles, which may be required on clusters where the
|
||||
interface to the high-speed network disallows using the fork() library
|
||||
call (which is needed for a pipe). For the remainder of this page, you
|
||||
should thus consider the *atom* and *atom/gz* styles (etc.) to be
|
||||
inter-changeable, with the exception of the required filename suffix.
|
||||
The *style* keyword determines what kind of data is written to the
|
||||
dump file(s) and in what format.
|
||||
|
||||
Similarly, the *atom/zstd*, *cfg/zstd*, *custom/zstd*, *local/zstd*, and
|
||||
*xyz/zstd* styles are identical to the gz styles, but use the Zstd
|
||||
compression library instead and require the ".zst" suffix. See the
|
||||
:doc:`dump_modify <dump_modify>` page for details on how to control the
|
||||
compression level in both variants.
|
||||
Note that *atom*, *custom*, *dcd*, *xtc*, and *xyz* style dump files
|
||||
can be read directly by `VMD <https://www.ks.uiuc.edu/Research/vmd>`_,
|
||||
a popular tool for viewing molecular system.
|
||||
|
||||
As explained below, the *atom/mpiio*, *cfg/mpiio*, *custom/mpiio*, and
|
||||
*xyz/mpiio* styles are identical in command syntax and in the format of
|
||||
the dump files they create, to the corresponding styles without "mpiio",
|
||||
except the single dump file they produce is written in parallel via the
|
||||
MPI-IO library. For the remainder of this page, you should thus
|
||||
consider the *atom* and *atom/mpiio* styles (etc.) to be
|
||||
inter-changeable. The one exception is how the filename is specified
|
||||
for the MPI-IO styles, as explained below.
|
||||
Likewise the `OVITO visualization tool <https://www.ovito.org>`_,
|
||||
popular for materials modeling, can read the *atom*, *custom*, and
|
||||
*grid* style dump files.
|
||||
|
||||
.. warning::
|
||||
|
||||
The MPIIO package is currently unmaintained and has become
|
||||
unreliable. Use with caution.
|
||||
|
||||
The precision of values output to text-based dump files can be
|
||||
controlled by the :doc:`dump_modify format <dump_modify>` command and
|
||||
its options.
|
||||
Note that settings made via the :doc:`dump_modify <dump_modify>`
|
||||
command can also alter the format of individual values and content of
|
||||
the dump file itself. This includes the precision of values output to
|
||||
text-based dump files which is controlled by the :doc:`dump_modify
|
||||
format <dump_modify>` command and its options.
|
||||
|
||||
----------
|
||||
|
||||
The *style* keyword determines what atom quantities are written to the
|
||||
file and in what format. Settings made via the
|
||||
:doc:`dump_modify <dump_modify>` command can also alter the format of
|
||||
individual values and the file itself.
|
||||
Format of native LAMMPS format dump files:
|
||||
|
||||
The *atom*, *local*, and *custom* styles create files in a simple text
|
||||
format that is self-explanatory when viewing a dump file. Some of the
|
||||
LAMMPS post-processing tools described on the :doc:`Tools <Tools>` doc
|
||||
page, including `Pizza.py <https://lammps.github.io/pizza>`_,
|
||||
work with this format, as does the :doc:`rerun <rerun>` command.
|
||||
The *atom*, *custom*, *grid*, and *local* styles create files in a
|
||||
simple LAMMPS-specific text format that is self-explanatory when
|
||||
viewing a dump file. Many post-processing tools either included with
|
||||
LAMMPS or third-party tools can read this format, as does the
|
||||
:doc:`rerun <rerun>` command. See tools described on the :doc:`Tools
|
||||
<Tools>` doc page for examples, including `Pizza.py
|
||||
<https://lammps.github.io/pizza>`_.
|
||||
|
||||
For post-processing purposes the *atom*, *local*, and *custom* text
|
||||
files are self-describing in the following sense.
|
||||
|
||||
The dimensions of the simulation box are included in each snapshot.
|
||||
For an orthogonal simulation box this information is formatted as:
|
||||
For all these styles, the dimensions of the simulation box are
|
||||
included in each snapshot. For an orthogonal simulation box this
|
||||
information is formatted as:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -316,10 +320,13 @@ bounding box extents (xlo_bound, xhi_bound, etc.) are calculated from the
|
||||
triclinic parameters, and how to transform those parameters to and
|
||||
from other commonly used triclinic representations.
|
||||
|
||||
The "ITEM: ATOMS" line in each snapshot lists column descriptors for
|
||||
the per-atom lines that follow. For example, the descriptors would be
|
||||
"id type xs ys zs" for the default *atom* style, and would be the atom
|
||||
attributes you specify in the dump command for the *custom* style.
|
||||
The *atom* and *custom* styles output a "ITEM: NUMBER OF ATOMS" line
|
||||
with the count of atoms in the snapshot. Likewise they output an
|
||||
"ITEM: ATOMS" line which includes column descriptors for the per-atom
|
||||
lines that follow. For example, the descriptors would be "id type xs
|
||||
ys zs" for the default *atom* style, and would be the atom attributes
|
||||
you specify in the dump command for the *custom* style. Each
|
||||
subsequent line will list the data for a single atom.
|
||||
|
||||
For style *atom*, atom coordinates are written to the file, along with
|
||||
the atom ID and atom type. By default, atom coords are written in a
|
||||
@ -332,12 +339,31 @@ added for each atom via dump_modify.
|
||||
Style *custom* allows you to specify a list of atom attributes to be
|
||||
written to the dump file for each atom. Possible attributes are
|
||||
listed above and will appear in the order specified. You cannot
|
||||
specify a quantity that is not defined for a particular simulation---such as
|
||||
*q* for atom style *bond*, since that atom style does not
|
||||
assign charges. Dumps occur at the very end of a timestep, so atom
|
||||
attributes will include effects due to fixes that are applied during
|
||||
the timestep. An explanation of the possible dump custom attributes
|
||||
is given below.
|
||||
specify a quantity that is not defined for a particular
|
||||
simulation---such as *q* for atom style *bond*, since that atom style
|
||||
does not assign charges. Dumps occur at the very end of a timestep,
|
||||
so atom attributes will include effects due to fixes that are applied
|
||||
during the timestep. An explanation of the possible dump custom
|
||||
attributes is given below.
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
For style *grid* the extent of the Nx by Ny by Nz grid that overlays
|
||||
the simulation domain is output with each snapshot:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
ITEM: GRID EXTENT
|
||||
nx ny nz
|
||||
|
||||
For 2d simulations, nz will be 1. There will also be an "ITEM: GRID
|
||||
DATA" line which includes column descriptors for the per grid cell
|
||||
data. Each subsequent line (Nx * Ny * Nz lines) will list the data
|
||||
for a single grid cell. If grid cell IDs are included in the output
|
||||
via the :doc:`compute property/grid <compute_property_grid>` command,
|
||||
then the IDs will range from 1 to N = Nx*Ny*Nz. The ordering of IDs
|
||||
is with the x index varying fastest, then the y index, and the z index
|
||||
varying slowest.
|
||||
|
||||
For style *local*, local output generated by :doc:`computes <compute>`
|
||||
and :doc:`fixes <fix>` is used to generate lines of output that is
|
||||
@ -351,6 +377,17 @@ generate information on bonds, angles, etc. that can be cut and pasted
|
||||
directly into a data file read by the :doc:`read_data <read_data>`
|
||||
command.
|
||||
|
||||
----------
|
||||
|
||||
Dump files in other popular formats:
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
This section only discusses file formats relevant to this doc page.
|
||||
The top of this page has links to other dump commands (with their
|
||||
own pages) which write files in additional popular formats.
|
||||
|
||||
Style *cfg* has the same command syntax as style *custom* and writes
|
||||
extended CFG format files, as used by the `AtomEye
|
||||
<http://li.mit.edu/Archive/Graphics/A/>`_ visualization package.
|
||||
@ -387,15 +424,15 @@ periodic box. Note that these coordinates may thus be far outside
|
||||
the box size stored with the snapshot.
|
||||
|
||||
The *xtc* style writes XTC files, a compressed trajectory format used
|
||||
by the GROMACS molecular dynamics package, and described
|
||||
`here <https://manual.gromacs.org/current/reference-manual/file-formats.html#xtc>`_.
|
||||
by the GROMACS molecular dynamics package, and described `here
|
||||
<https://manual.gromacs.org/current/reference-manual/file-formats.html#xtc>`_.
|
||||
The precision used in XTC files can be adjusted via the
|
||||
:doc:`dump_modify <dump_modify>` command. The default value of 1000
|
||||
means that coordinates are stored to 1/1000 nanometer accuracy. XTC
|
||||
files are portable binary files written in the NFS XDR data format,
|
||||
so that any machine which supports XDR should be able to read them.
|
||||
The number of atoms per snapshot cannot change with the *xtc* style.
|
||||
The *unwrap* option of the :doc:`dump_modify <dump_modify>` command allows
|
||||
files are portable binary files written in the NFS XDR data format, so
|
||||
that any machine which supports XDR should be able to read them. The
|
||||
number of atoms per snapshot cannot change with the *xtc* style. The
|
||||
*unwrap* option of the :doc:`dump_modify <dump_modify>` command allows
|
||||
XTC coordinates to be written "unwrapped" by the image flags for each
|
||||
atom. Unwrapped means that if the atom has passed through a periodic
|
||||
boundary one or more times, the value is printed for what the
|
||||
@ -404,27 +441,41 @@ box. Note that these coordinates may thus be far outside the box size
|
||||
stored with the snapshot.
|
||||
|
||||
The *xyz* style writes XYZ files, which is a simple text-based
|
||||
coordinate format that many codes can read. Specifically it has
|
||||
a line with the number of atoms, then a comment line that is
|
||||
usually ignored followed by one line per atom with the atom type
|
||||
and the :math:`x`-, :math:`y`-, and :math:`z`-coordinate of that atom.
|
||||
You can use the :doc:`dump_modify element <dump_modify>` option to change the
|
||||
output from using the (numerical) atom type to an element name (or some other
|
||||
label). This will help many visualization programs to guess bonds and colors.
|
||||
coordinate format that many codes can read. Specifically it has a line
|
||||
with the number of atoms, then a comment line that is usually ignored
|
||||
followed by one line per atom with the atom type and the :math:`x`-,
|
||||
:math:`y`-, and :math:`z`-coordinate of that atom. You can use the
|
||||
:doc:`dump_modify element <dump_modify>` option to change the output
|
||||
from using the (numerical) atom type to an element name (or some other
|
||||
label). This will help many visualization programs to guess bonds and
|
||||
colors.
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
The *grid/vtk* style writes VTK files for grid data on a regular
|
||||
rectilinear grid. Its content is conceptually similar to that of the
|
||||
text file produced by the *grid* style, except that it in an XML-based
|
||||
format which visualization programs which support the VTK format can
|
||||
read, e.g. the `ParaView tool <https://www.paraview.org>`_. For this
|
||||
style, there can only be 1 or 3 per grid cell attributes specified.
|
||||
If it is a single value, it is a scalar quantity. If 3 values are
|
||||
specified it is encoded in the VTK file as a vector quantity (for each
|
||||
grid cell). The filename for this style must include a "\*" wildcard
|
||||
character to produce one file per snapshot; see details below.
|
||||
|
||||
.. versionadded:: 4May2022
|
||||
|
||||
Dump style *yaml* has the same command syntax as style *custom* and
|
||||
writes YAML format files that can be easily parsed by a variety of data
|
||||
processing tools and programming languages. Each timestep will be
|
||||
written as a YAML "document" (i.e., starts with "---" and ends with
|
||||
writes YAML format files that can be easily parsed by a variety of
|
||||
data processing tools and programming languages. Each timestep will
|
||||
be written as a YAML "document" (i.e., starts with "---" and ends with
|
||||
"..."). The style supports writing one file per timestep through the
|
||||
"\*" wildcard but not multi-processor outputs with the "%" token in the
|
||||
filename. In addition to per-atom data, :doc:`thermo <thermo>` data can
|
||||
be included in the *yaml* style dump file using the :doc:`dump_modify
|
||||
thermo yes <dump_modify>`. The data included in the dump file uses the
|
||||
"thermo" tag and is otherwise identical to data specified by the
|
||||
:doc:`thermo_style <thermo_style>` command.
|
||||
"\*" wildcard but not multi-processor outputs with the "%" token in
|
||||
the filename. In addition to per-atom data, :doc:`thermo <thermo>`
|
||||
data can be included in the *yaml* style dump file using the
|
||||
:doc:`dump_modify thermo yes <dump_modify>`. The data included in the
|
||||
dump file uses the "thermo" tag and is otherwise identical to data
|
||||
specified by the :doc:`thermo_style <thermo_style>` command.
|
||||
|
||||
Below is an example for a YAML format dump created by the following commands.
|
||||
|
||||
@ -435,13 +486,13 @@ Below is an example for a YAML format dump created by the following commands.
|
||||
|
||||
The tags "time", "units", and "thermo" are optional and enabled by the
|
||||
dump_modify command. The list under the "box" tag has three lines for
|
||||
orthogonal boxes and four lines for triclinic boxes, where the first three are
|
||||
the box boundaries and the fourth the three tilt factors (:math:`xy`,
|
||||
:math:`xz`, :math:`yz`). The "thermo" data follows the format of the *yaml*
|
||||
thermo style. The "keywords" tag lists the per-atom properties contained in
|
||||
the "data" columns, which contain a list with one line per atom. The keywords
|
||||
may be renamed using the dump_modify command same as for the *custom* dump
|
||||
style.
|
||||
orthogonal boxes and four lines for triclinic boxes, where the first
|
||||
three are the box boundaries and the fourth the three tilt factors
|
||||
(:math:`xy`, :math:`xz`, :math:`yz`). The "thermo" data follows the
|
||||
format of the *yaml* thermo style. The "keywords" tag lists the
|
||||
per-atom properties contained in the "data" columns, which contain a
|
||||
list with one line per atom. The keywords may be renamed using the
|
||||
dump_modify command same as for the *custom* dump style.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@ -479,11 +530,7 @@ style.
|
||||
|
||||
----------
|
||||
|
||||
Note that *atom*, *custom*, *dcd*, *xtc*, and *xyz* style dump files
|
||||
can be read directly by `VMD <https://www.ks.uiuc.edu/Research/vmd>`_, a
|
||||
popular molecular viewing program.
|
||||
|
||||
----------
|
||||
Frequency of dump output:
|
||||
|
||||
Dumps are performed on timesteps that are a multiple of :math:`N`
|
||||
(including timestep 0) and on the last timestep of a minimization if
|
||||
@ -508,29 +555,35 @@ every/time <dump_modify>` command can be used. This can be useful
|
||||
when the timestep size varies during a simulation run, e.g. by use of
|
||||
the :doc:`fix dt/reset <fix_dt_reset>` command.
|
||||
|
||||
The specified filename determines how the dump file(s) is written.
|
||||
The default is to write one large text file, which is opened when the
|
||||
dump command is invoked and closed when an :doc:`undump <undump>`
|
||||
command is used or when LAMMPS exits. For the *dcd* and *xtc* styles,
|
||||
this is a single large binary file.
|
||||
----------
|
||||
|
||||
Dump filenames can contain two wildcard characters. If a "\*"
|
||||
character appears in the filename, then one file per snapshot is
|
||||
written and the "\*" character is replaced with the timestep value.
|
||||
For example, tmp.dump.\* becomes tmp.dump.0, tmp.dump.10000,
|
||||
tmp.dump.20000, etc. This option is not available for the *dcd* and
|
||||
*xtc* styles. Note that the :doc:`dump_modify pad <dump_modify>`
|
||||
command can be used to insure all timestep numbers are the same length
|
||||
(e.g., 00010), which can make it easier to read a series of dump files
|
||||
in order with some post-processing tools.
|
||||
Dump filenames:
|
||||
|
||||
The specified dump filename determines how the dump file(s) is
|
||||
written. The default is to write one large text file, which is opened
|
||||
when the dump command is invoked and closed when an :doc:`undump
|
||||
<undump>` command is used or when LAMMPS exits. For the *dcd* and
|
||||
*xtc* styles, this is a single large binary file.
|
||||
|
||||
Many of the styles allow dump filenames to contain either or both of
|
||||
two wildcard characters. If a "\*" character appears in the filename,
|
||||
then one file per snapshot is written and the "\*" character is
|
||||
replaced with the timestep value. For example, tmp.dump.\* becomes
|
||||
tmp.dump.0, tmp.dump.10000, tmp.dump.20000, etc. This option is not
|
||||
available for the *dcd* and *xtc* styles. Note that the
|
||||
:doc:`dump_modify pad <dump_modify>` command can be used to insure all
|
||||
timestep numbers are the same length (e.g., 00010), which can make it
|
||||
easier to read a series of dump files in order with some
|
||||
post-processing tools.
|
||||
|
||||
If a "%" character appears in the filename, then each of P processors
|
||||
writes a portion of the dump file, and the "%" character is replaced
|
||||
with the processor ID from :math:`0` to :math:`P-1`. For example, tmp.dump.%
|
||||
becomes tmp.dump.0, tmp.dump.1, ... tmp.dump.:math:`P-1`, etc. This creates
|
||||
smaller files and can be a fast mode of output on parallel machines that
|
||||
support parallel I/O for output. This option is **not** available for the
|
||||
*dcd*, *xtc*, *xyz*, and *yaml* styles.
|
||||
with the processor ID from :math:`0` to :math:`P-1`. For example,
|
||||
tmp.dump.% becomes tmp.dump.0, tmp.dump.1, ... tmp.dump.:math:`P-1`,
|
||||
etc. This creates smaller files and can be a fast mode of output on
|
||||
parallel machines that support parallel I/O for output. This option is
|
||||
**not** available for the *dcd*, *xtc*, *xyz*, *grid/vtk*, and *yaml*
|
||||
styles.
|
||||
|
||||
By default, :math:`P` is the the number of processors, meaning one file per
|
||||
processor, but :math:`P` can be set to a smaller value via the *nfile* or
|
||||
@ -541,47 +594,41 @@ when running on large numbers of processors.
|
||||
Note that using the "\*" and "%" characters together can produce a
|
||||
large number of small dump files!
|
||||
|
||||
For the *atom/mpiio*, *cfg/mpiio*, *custom/mpiio*, and *xyz/mpiio*
|
||||
styles, a single dump file is written in parallel via the MPI-IO
|
||||
library, which is part of the MPI standard for versions 2.0 and above.
|
||||
Using MPI-IO requires two steps. First, build LAMMPS with its MPIIO
|
||||
package installed, viz.,
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make yes-mpiio # installs the MPIIO package
|
||||
make mpi # build LAMMPS for your platform
|
||||
|
||||
Second, use a dump filename which contains ".mpiio". Note that it does
|
||||
not have to end in ".mpiio", just contain those characters. Unlike
|
||||
MPI-IO restart files, which must be both written and read using MPI-IO,
|
||||
the dump files produced by these MPI-IO styles are identical in format
|
||||
to the files produced by their non-MPI-IO style counterparts. This
|
||||
means you can write a dump file using MPI-IO and use the :doc:`read_dump
|
||||
For styles that end with *mpiio* an ".mpiio" must appear somewhere in
|
||||
the specified filename. These styles write their dump file in
|
||||
parallel via the MPI-IO library, which is part of the MPI standard for
|
||||
versions 2.0 and above. Note these styles are identical in command
|
||||
syntax to the corresponding styles without "mpiio". Likewise, the
|
||||
dump files produced by these MPI-IO styles are identical in format to
|
||||
the files produced by their non-MPI-IO style counterparts. This means
|
||||
you can write a dump file using MPI-IO and use the :doc:`read_dump
|
||||
<read_dump>` command or perform other post-processing, just as if the
|
||||
dump file was not written using MPI-IO.
|
||||
|
||||
Because MPI-IO dump files are one large file which all processors
|
||||
write to, you cannot use the "%" wildcard character described above in
|
||||
the filename. However you can use the ".bin" or ".lammpsbin" suffix
|
||||
described below. Again, this file will be written in parallel and
|
||||
have the same binary format as if it were written without MPI-IO.
|
||||
|
||||
.. warning::
|
||||
|
||||
The MPIIO package is currently unmaintained and has become
|
||||
unreliable. Use with caution.
|
||||
The MPIIO package within LAMMPS is currently unmaintained and has
|
||||
become unreliable. Use with caution.
|
||||
|
||||
Note that MPI-IO dump files are one large file which all processors
|
||||
write to. You thus cannot use the "%" wildcard character described
|
||||
above in the filename since that specifies generation of multiple files.
|
||||
You can use the ".bin" or ".lammpsbin" suffix described below in an
|
||||
MPI-IO dump file; again this file will be written in parallel and have
|
||||
the same binary format as if it were written without MPI-IO.
|
||||
----------
|
||||
|
||||
If the filename ends with ".bin" or ".lammpsbin", the dump file (or
|
||||
files, if "\*" or "%" is also used) is written in binary format. A
|
||||
binary dump file will be about the same size as a text version, but will
|
||||
typically write out much faster. Of course, when post-processing, you
|
||||
will need to convert it back to text format (see the :ref:`binary2txt
|
||||
tool <binary>`) or write your own code to read the binary file. The
|
||||
format of the binary file can be understood by looking at the
|
||||
:file:`tools/binary2txt.cpp` file. This option is only available for
|
||||
the *atom* and *custom* styles.
|
||||
Compression of dump file data:
|
||||
|
||||
If the specified filename ends with ".bin" or ".lammpsbin", the dump
|
||||
file (or files, if "\*" or "%" is also used) is written in binary
|
||||
format. A binary dump file will be about the same size as a text
|
||||
version, but will typically write out much faster. Of course, when
|
||||
post-processing, you will need to convert it back to text format (see
|
||||
the :ref:`binary2txt tool <binary>`) or write your own code to read
|
||||
the binary file. The format of the binary file can be understood by
|
||||
looking at the :file:`tools/binary2txt.cpp` file. This option is only
|
||||
available for the *atom* and *custom* styles.
|
||||
|
||||
If the filename ends with ".gz", the dump file (or files, if "\*" or "%"
|
||||
is also used) is written in gzipped format. A gzipped dump file will be
|
||||
@ -589,19 +636,40 @@ about :math:`3\times` smaller than the text version, but will also take
|
||||
longer to write. This option is not available for the *dcd* and *xtc*
|
||||
styles.
|
||||
|
||||
Note that styles that end with *gz* are identical in command syntax to
|
||||
the corresponding styles without "gz", however, they generate
|
||||
compressed files using the zlib library. Thus the filename suffix
|
||||
".gz" is mandatory. This is an alternative approach to writing
|
||||
compressed files via a pipe, as done by the regular dump styles, which
|
||||
may be required on clusters where the interface to the high-speed
|
||||
network disallows using the fork() library call (which is needed for a
|
||||
pipe). For the remainder of this page, you should thus consider the
|
||||
*atom* and *atom/gz* styles (etc.) to be inter-changeable, with the
|
||||
exception of the required filename suffix.
|
||||
|
||||
Similarly, styles that end with *zstd* are identical to the gz styles,
|
||||
but use the Zstd compression library instead and require a ".zst"
|
||||
suffix. See the :doc:`dump_modify <dump_modify>` page for details on
|
||||
how to control the compression level in both variants.
|
||||
|
||||
----------
|
||||
|
||||
Note that in the discussion which follows, for styles which can
|
||||
reference values from a compute or fix or custom atom property, like the
|
||||
*custom*\ , *cfg*\ , or *local* styles, the bracketed index :math:`i`
|
||||
can be specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "m\*" or
|
||||
"m\*n". If :math:`N` is the number of columns in the array, then an
|
||||
asterisk with no numeric values means all column indices from 1 to
|
||||
:math:`N`. A leading asterisk means all indices from 1 to n
|
||||
(inclusive). A trailing asterisk means all indices from m to :math:`N`
|
||||
(inclusive). A middle asterisk means all indices from m to n
|
||||
(inclusive).
|
||||
Arguments for different styles:
|
||||
|
||||
The sections below describe per-atom, local, and per grid cell
|
||||
attributes which can be used as arguments to the various styles.
|
||||
|
||||
Note that in the discussion below, for styles which can reference
|
||||
values from a compute or fix or custom atom property, like the
|
||||
*custom*\ , *cfg*\ , *grid* or *local* styles, the bracketed index
|
||||
:math:`i` can be specified using a wildcard asterisk with the index to
|
||||
effectively specify multiple values. This takes the form "\*" or
|
||||
"\*n" or "m\*" or "m\*n". If :math:`N` is the number of columns in
|
||||
the array, then an asterisk with no numeric values means all column
|
||||
indices from 1 to :math:`N`. A leading asterisk means all indices
|
||||
from 1 to n (inclusive). A trailing asterisk means all indices from m
|
||||
to :math:`N` (inclusive). A middle asterisk means all indices from m
|
||||
to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual columns of the array
|
||||
had been listed one by one. For example, these two dump commands are
|
||||
@ -617,63 +685,7 @@ command creates a per-atom array with six columns:
|
||||
|
||||
----------
|
||||
|
||||
This section explains the local attributes that can be specified as
|
||||
part of the *local* style.
|
||||
|
||||
The *index* attribute can be used to generate an index number from 1
|
||||
to :math:`N` for each line written into the dump file, where :math:`N` is the
|
||||
total number of local datums from all processors, or lines of output that
|
||||
will appear in the snapshot. Note that because data from different
|
||||
processors depend on what atoms they currently own, and atoms migrate
|
||||
between processor, there is no guarantee that the same index will be
|
||||
used for the same info (e.g., a particular bond) in successive snapshots.
|
||||
|
||||
The *c_ID* and *c_ID[I]* attributes allow local vectors or arrays
|
||||
calculated by a :doc:`compute <compute>` to be output. The ID in the
|
||||
attribute should be replaced by the actual ID of the compute that has
|
||||
been defined previously in the input script. See the
|
||||
:doc:`compute <compute>` command for details. There are computes for
|
||||
calculating local information such as indices, types, and energies for
|
||||
bonds and angles.
|
||||
|
||||
Note that computes which calculate global or per-atom quantities, as
|
||||
opposed to local quantities, cannot be output in a dump local command.
|
||||
Instead, global quantities can be output by the :doc:`thermo_style
|
||||
custom <thermo_style>` command, and per-atom quantities can be output
|
||||
by the dump custom command.
|
||||
|
||||
If *c_ID* is used as a attribute, then the local vector calculated by
|
||||
the compute is printed. If *c_ID[i]* is used, then :math:`i` must be in the
|
||||
range from :math:`1-M`, which will print the Ith column of the local array
|
||||
with :math:`M` columns calculated by the compute. See the discussion above
|
||||
for how :math:`i` can be specified with a wildcard asterisk to effectively
|
||||
specify multiple values.
|
||||
|
||||
The *f_ID* and *f_ID[I]* attributes allow local vectors or arrays
|
||||
calculated by a :doc:`fix <fix>` to be output. The ID in the attribute
|
||||
should be replaced by the actual ID of the fix that has been defined
|
||||
previously in the input script.
|
||||
|
||||
If *f_ID* is used as a attribute, then the local vector calculated by
|
||||
the fix is printed. If *f_ID[i]* is used, then :math:`i` must be in the
|
||||
range :math:`1`--:math:`M`, which will print the :math:`i`\ th column of the
|
||||
local with :math:`M` columns calculated by the fix. See the discussion above
|
||||
for how :math:`i` can be specified with a wildcard asterisk to effectively
|
||||
specify multiple values.
|
||||
|
||||
Here is an example of how to dump bond info for a system, including
|
||||
the distance and energy of each bond:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all property/local batom1 batom2 btype
|
||||
compute 2 all bond/local dist eng
|
||||
dump 1 all local 1000 tmp.dump index c_1[1] c_1[2] c_1[3] c_2[1] c_2[2]
|
||||
|
||||
----------
|
||||
|
||||
This section explains the atom attributes that can be specified as
|
||||
part of the *custom* and *cfg* styles.
|
||||
Per-atom attributes used as arguments to the *custom* and *cfg* styles:
|
||||
|
||||
The *id*, *mol*, *proc*, *procp1*, *type*, *element*, *mass*, *vx*,
|
||||
*vy*, *vz*, *fx*, *fy*, *fz*, *q* attributes are self-explanatory.
|
||||
@ -808,6 +820,97 @@ which could then be output into dump files.
|
||||
|
||||
----------
|
||||
|
||||
Attributes used as arguments to the *local* style:
|
||||
|
||||
The *index* attribute can be used to generate an index number from 1
|
||||
to N for each line written into the dump file, where N is the total
|
||||
number of local datums from all processors, or lines of output that
|
||||
will appear in the snapshot. Note that because data from different
|
||||
processors depend on what atoms they currently own, and atoms migrate
|
||||
between processor, there is no guarantee that the same index will be
|
||||
used for the same info (e.g. a particular bond) in successive
|
||||
snapshots.
|
||||
|
||||
The *c_ID* and *c_ID[I]* attributes allow local vectors or arrays
|
||||
calculated by a :doc:`compute <compute>` to be output. The ID in the
|
||||
attribute should be replaced by the actual ID of the compute that has
|
||||
been defined previously in the input script. See the
|
||||
:doc:`compute <compute>` command for details. There are computes for
|
||||
calculating local information such as indices, types, and energies for
|
||||
bonds and angles.
|
||||
|
||||
Note that computes which calculate global or per-atom quantities, as
|
||||
opposed to local quantities, cannot be output in a dump local command.
|
||||
Instead, global quantities can be output by the :doc:`thermo_style
|
||||
custom <thermo_style>` command, and per-atom quantities can be output
|
||||
by the dump custom command.
|
||||
|
||||
If *c_ID* is used as a attribute, then the local vector calculated by
|
||||
the compute is printed. If *c_ID[I]* is used, then I must be in the
|
||||
range from 1-M, which will print the Ith column of the local array
|
||||
with M columns calculated by the compute. See the discussion above
|
||||
for how I can be specified with a wildcard asterisk to effectively
|
||||
specify multiple values.
|
||||
|
||||
The *f_ID* and *f_ID[I]* attributes allow local vectors or arrays
|
||||
calculated by a :doc:`fix <fix>` to be output. The ID in the attribute
|
||||
should be replaced by the actual ID of the fix that has been defined
|
||||
previously in the input script.
|
||||
|
||||
If *f_ID* is used as a attribute, then the local vector calculated by
|
||||
the fix is printed. If *f_ID[I]* is used, then I must be in the
|
||||
range from 1-M, which will print the Ith column of the local with M
|
||||
columns calculated by the fix. See the discussion above for how I can
|
||||
be specified with a wildcard asterisk to effectively specify multiple
|
||||
values.
|
||||
|
||||
Here is an example of how to dump bond info for a system, including
|
||||
the distance and energy of each bond:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all property/local batom1 batom2 btype
|
||||
compute 2 all bond/local dist eng
|
||||
dump 1 all local 1000 tmp.dump index c_1[1] c_1[2] c_1[3] c_2[1] c_2[2]
|
||||
|
||||
----------
|
||||
|
||||
Attributes used as arguments to the *grid* and *grid/vtk* styles:
|
||||
|
||||
The attributes that begin with *c_ID* and *f_ID* both take
|
||||
colon-separated fields *gname* and *dname*. These refer to a grid
|
||||
name and data field name which is defined by the compute or fix. Note
|
||||
that a compute or fix can define one or more grids (of different
|
||||
sizes) and one or more data fields for each of those grids. The sizes
|
||||
of all grids output in a single dump grid command must be the same.
|
||||
|
||||
The *c_ID:gname:dname* and *c_ID:gname:dname[I]* attributes allow
|
||||
per-grid vectors or arrays calculated by a :doc:`compute <compute>` to
|
||||
be output. The ID in the attribute should be replaced by the actual
|
||||
ID of the compute that has been defined previously in the input
|
||||
script.
|
||||
|
||||
If *c_ID:gname:dname* is used as a attribute, then the per-grid vector
|
||||
calculated by the compute is printed. If *c_ID:gname:dname[I]* is
|
||||
used, then I must be in the range from 1-M, which will print the Ith
|
||||
column of the per-grid array with M columns calculated by the compute.
|
||||
See the discussion above for how I can be specified with a wildcard
|
||||
asterisk to effectively specify multiple values.
|
||||
|
||||
The *f_ID:gname:dname* and *f_ID:gname:dname[I]* attributes allow
|
||||
per-grid vectors or arrays calculated by a :doc:`fix <fix>` to be
|
||||
output. The ID in the attribute should be replaced by the actual ID
|
||||
of the fix that has been defined previously in the input script.
|
||||
|
||||
If *f_ID:gname:dname* is used as a attribute, then the per-grid vector
|
||||
calculated by the fix is printed. If *f_ID:gname:dname[I]* is used,
|
||||
then I must be in the range from 1-M, which will print the Ith column
|
||||
of the per-grid with M columns calculated by the fix. See the
|
||||
discussion above for how I can be specified with a wildcard asterisk
|
||||
to effectively specify multiple values.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
@ -816,9 +919,9 @@ To write gzipped dump files, you must either compile LAMMPS with the
|
||||
See the :doc:`Build settings <Build_settings>` page for details.
|
||||
|
||||
While a dump command is active (i.e., has not been stopped by using
|
||||
the :doc:`undump command <undump>`), no commands may be used that will change
|
||||
the timestep (e.g., :doc:`reset_timestep <reset_timestep>`). LAMMPS
|
||||
will terminate with an error otherwise.
|
||||
the :doc:`undump command <undump>`), no commands may be used that will
|
||||
change the timestep (e.g., :doc:`reset_timestep <reset_timestep>`).
|
||||
LAMMPS will terminate with an error otherwise.
|
||||
|
||||
The *atom/gz*, *cfg/gz*, *custom/gz*, and *xyz/gz* styles are part of
|
||||
the COMPRESS package. They are only enabled if LAMMPS was built with
|
||||
|
||||
@ -24,7 +24,7 @@ Syntax
|
||||
* color = atom attribute that determines color of each atom
|
||||
* diameter = atom attribute that determines size of each atom
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *atom* or *adiam* or *bond* or *line* or *tri* or *body* or *fix* or *size* or *view* or *center* or *up* or *zoom* or *box* or *axes* or *subbox* or *shiny* or *ssao*
|
||||
* keyword = *atom* or *adiam* or *bond* or *grid* or *line* or *tri* or *body* or *fix* or *size* or *view* or *center* or *up* or *zoom* or *box* or *axes* or *subbox* or *shiny* or *ssao*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -34,6 +34,14 @@ Syntax
|
||||
color = *atom* or *type* or *none*
|
||||
width = number or *atom* or *type* or *none*
|
||||
number = numeric value for bond width (distance units)
|
||||
*grid* = per-grid value to use when coloring each grid cell
|
||||
per-grid value = c_ID:gname:dname, c_ID:gname:dname[I], f_ID:gname:dname, f_ID:gname:dname[I]
|
||||
gname = name of grid defined by compute or fix
|
||||
dname = name of data field defined by compute or fix
|
||||
c_ID = per-grid vector calculated by a compute with ID
|
||||
c_ID[I] = Ith column of per-grid array calculated by a compute with ID
|
||||
f_ID = per-grid vector calculated by a fix with ID
|
||||
f_ID[I] = Ith column of per-grid array calculated by a fix with ID
|
||||
*line* = color width
|
||||
color = *type*
|
||||
width = numeric value for line width (distance units)
|
||||
@ -69,7 +77,7 @@ Syntax
|
||||
yes/no = do or do not draw simulation box lines
|
||||
diam = diameter of box lines as fraction of shortest box length
|
||||
*axes* values = axes length diam = draw xyz axes
|
||||
axes = *yes* or *no = do or do not draw xyz axes lines next to simulation box
|
||||
axes = *yes* or *no* = do or do not draw xyz axes lines next to simulation box
|
||||
length = length of axes lines as fraction of respective box lengths
|
||||
diam = diameter of axes lines as fraction of shortest box length
|
||||
*subbox* values = lines diam = draw outline of processor sub-domains
|
||||
@ -95,7 +103,7 @@ Syntax
|
||||
dump_modify dump-ID keyword values ...
|
||||
|
||||
* these keywords apply only to the *image* and *movie* styles and are documented on this page
|
||||
* keyword = *acolor* or *adiam* or *amap* or *backcolor* or *bcolor* or *bdiam* or *boxcolor* or *color* or *bitrate* or *framerate*
|
||||
* keyword = *acolor* or *adiam* or *amap* or *gmap* or *backcolor* or *bcolor* or *bdiam* or *bitrate* or *boxcolor* or *color* or *framerate* or *gmap*
|
||||
* see the :doc:`dump modify <dump_modify>` doc page for more general keywords
|
||||
|
||||
.. parsed-literal::
|
||||
@ -134,15 +142,16 @@ Syntax
|
||||
*bdiam* args = type diam
|
||||
type = bond type or range of types (see below)
|
||||
diam = diameter of bonds of that type (distance units)
|
||||
*bitrate* arg = rate
|
||||
rate = target bitrate for movie in kbps
|
||||
*boxcolor* arg = color
|
||||
color = name of color for simulation box lines and processor sub-domain lines
|
||||
*color* args = name R G B
|
||||
name = name of color
|
||||
R,G,B = red/green/blue numeric values from 0.0 to 1.0
|
||||
*bitrate* arg = rate
|
||||
rate = target bitrate for movie in kbps
|
||||
*framerate* arg = fps
|
||||
fps = frames per second for movie
|
||||
*gmap* args = identical to *amap* args
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -214,7 +223,7 @@ Similarly, the format of the resulting movie is chosen with the
|
||||
and thus details have to be looked up in the `FFmpeg documentation
|
||||
<https://ffmpeg.org/ffmpeg.html>`_. Typical examples are: .avi, .mpg,
|
||||
.m4v, .mp4, .mkv, .flv, .mov, .gif Additional settings of the movie
|
||||
compression like bitrate and framerate can be set using the
|
||||
compression like *bitrate* and *framerate* can be set using the
|
||||
dump_modify command as described below.
|
||||
|
||||
To write out JPEG and PNG format files, you must build LAMMPS with
|
||||
@ -300,13 +309,13 @@ settings, they are interpreted in the following way.
|
||||
If "vx", for example, is used as the *color* setting, then the color
|
||||
of the atom will depend on the x-component of its velocity. The
|
||||
association of a per-atom value with a specific color is determined by
|
||||
a "color map", which can be specified via the dump_modify command, as
|
||||
described below. The basic idea is that the atom-attribute will be
|
||||
within a range of values, and every value within the range is mapped
|
||||
to a specific color. Depending on how the color map is defined, that
|
||||
mapping can take place via interpolation so that a value of -3.2 is
|
||||
halfway between "red" and "blue", or discretely so that the value of
|
||||
-3.2 is "orange".
|
||||
a "color map", which can be specified via the dump_modify amap
|
||||
command, as described below. The basic idea is that the
|
||||
atom-attribute will be within a range of values, and every value
|
||||
within the range is mapped to a specific color. Depending on how the
|
||||
color map is defined, that mapping can take place via interpolation so
|
||||
that a value of -3.2 is halfway between "red" and "blue", or
|
||||
discretely so that the value of -3.2 is "orange".
|
||||
|
||||
If "vx", for example, is used as the *diameter* setting, then the atom
|
||||
will be rendered using the x-component of its velocity as the
|
||||
@ -948,6 +957,17 @@ frequently.
|
||||
|
||||
----------
|
||||
|
||||
The *gmap* keyword can be used with the dump image command, with its
|
||||
*grid* keyword, to setup a color map. The color map is used to assign
|
||||
a specific RGB (red/green/blue) color value to an individual grid cell
|
||||
when it is drawn, based on the grid cell value, which is a numeric
|
||||
quantity specified with the *grid* keyword.
|
||||
|
||||
The arguments for the *gmap* keyword are identical to those for the
|
||||
*amap* keyword (for atom coloring) described above.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
@ -1031,6 +1051,7 @@ The defaults for the dump_modify keywords specific to dump image and dump movie
|
||||
* boxcolor = yellow
|
||||
* color = 140 color names are pre-defined as listed below
|
||||
* framerate = 24
|
||||
* gmap = min max cf 0.0 2 min blue max red
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -90,8 +90,8 @@ hexahedrons in either legacy .vtk or .vtu XML format.
|
||||
|
||||
Style *vtk* allows you to specify a list of atom attributes to be
|
||||
written to the dump file for each atom. The list of possible attributes
|
||||
is the same as for the :doc:`dump_style custom <dump>` command; see
|
||||
its page for a listing and an explanation of each attribute.
|
||||
is the same as for the :doc:`dump_style custom <dump>` command; see its
|
||||
documentation page for a listing and an explanation of each attribute.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
745
doc/src/fitpod_command.rst
Normal file
745
doc/src/fitpod_command.rst
Normal file
@ -0,0 +1,745 @@
|
||||
.. index:: fitpod
|
||||
|
||||
fitpod command
|
||||
======================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fitpod Ta_param.pod Ta_data.pod
|
||||
|
||||
* fitpod = style name of this command
|
||||
* Ta_param.pod = an input file that describes proper orthogonal descriptors (PODs)
|
||||
* Ta_data.pod = an input file that specifies DFT data used to fit a POD potential
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fitpod Ta_param.pod Ta_data.pod
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
Fit a machine-learning interatomic potential (ML-IAP) based on proper
|
||||
orthogonal descriptors (POD). Two input files are required for this
|
||||
command. The first input file describes a POD potential parameter
|
||||
settings, while the second input file specifies the DFT data used for
|
||||
the fitting procedure.
|
||||
|
||||
The table below has one-line descriptions of all the keywords that can
|
||||
be used in the first input file (i.e. ``Ta_param.pod`` in the example
|
||||
above):
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
* - Keyword
|
||||
- Default
|
||||
- Type
|
||||
- Description
|
||||
* - species
|
||||
- (none)
|
||||
- STRING
|
||||
- Chemical symbols for all elements in the system and have to match XYZ training files.
|
||||
* - pbc
|
||||
- 1 1 1
|
||||
- INT
|
||||
- three integer constants specify boundary conditions
|
||||
* - rin
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real number specifies the inner cut-off radius
|
||||
* - rcut
|
||||
- 5.0
|
||||
- REAL
|
||||
- a real number specifies the outer cut-off radius
|
||||
* - bessel_polynomial_degree
|
||||
- 3
|
||||
- INT
|
||||
- the maximum degree of Bessel polynomials
|
||||
* - inverse_polynomial_degree
|
||||
- 6
|
||||
- INT
|
||||
- the maximum degree of inverse radial basis functions
|
||||
* - onebody
|
||||
- 1
|
||||
- BOOL
|
||||
- turns on/off one-body potential
|
||||
* - twobody_number_radial_basis_functions
|
||||
- 6
|
||||
- INT
|
||||
- number of radial basis functions for two-body potential
|
||||
* - threebody_number_radial_basis_functions
|
||||
- 5
|
||||
- INT
|
||||
- number of radial basis functions for three-body potential
|
||||
* - threebody_number_angular_basis_functions
|
||||
- 5
|
||||
- INT
|
||||
- number of angular basis functions for three-body potential
|
||||
* - fourbody_snap_twojmax
|
||||
- 0
|
||||
- INT
|
||||
- band limit for SNAP bispectrum components (0,2,4,6,8... allowed)
|
||||
* - fourbody_snap_chemflag
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off the explicit multi-element variant of the SNAP bispectrum components
|
||||
* - quadratic_pod_potential
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off quadratic POD potential
|
||||
|
||||
All keywords except *species* have default values. If a keyword is not
|
||||
set in the input file, its default value is used. The next table
|
||||
describes all keywords that can be used in the second input file
|
||||
(i.e. ``Ta_data.pod`` in the example above):
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
* - Keyword
|
||||
- Default
|
||||
- Type
|
||||
- Description
|
||||
* - file_format
|
||||
- extxyz
|
||||
- STRING
|
||||
- only the extended xyz format (extxyz) is currently supported
|
||||
* - file_extension
|
||||
- xyz
|
||||
- STRING
|
||||
- extension of the data files
|
||||
* - path_to_training_data_set
|
||||
- (none)
|
||||
- STRING
|
||||
- specifies the path to training data files in double quotes
|
||||
* - path_to_test_data_set
|
||||
- ""
|
||||
- STRING
|
||||
- specifies the path to test data files in double quotes
|
||||
* - fraction_training_data_set
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real number (<= 1.0) specifies the fraction of the training set used to fit POD
|
||||
* - randomize_training_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off randomization of the training set
|
||||
* - fitting_weight_energy
|
||||
- 100.0
|
||||
- REAL
|
||||
- a real constant specifies the weight for energy in the least-squares fit
|
||||
* - fitting_weight_force
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real constant specifies the weight for force in the least-squares fit
|
||||
* - fitting_regularization_parameter
|
||||
- 1.0e-10
|
||||
- REAL
|
||||
- a real constant specifies the regularization parameter in the least-squares fit
|
||||
* - error_analysis_for_training_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off error analysis for the training data set
|
||||
* - error_analysis_for_test_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off error analysis for the test data set
|
||||
* - basename_for_output_files
|
||||
- pod
|
||||
- STRING
|
||||
- a basename string added to the output files
|
||||
* - precision_for_pod_coefficients
|
||||
- 8
|
||||
- INT
|
||||
- number of digits after the decimal points for numbers in the coefficient file
|
||||
|
||||
All keywords except *path_to_training_data_set* have default values. If
|
||||
a keyword is not set in the input file, its default value is used. After
|
||||
successful training, a number of output files are produced, if enabled:
|
||||
|
||||
* ``<basename>_training_errors.pod`` reports the errors in energy and forces for the training data set
|
||||
* ``<basename>_training_analysis.pod`` reports detailed errors for all training configurations
|
||||
* ``<basename>_test_errors.pod`` reports errors for the test data set
|
||||
* ``<basename>_test_analysis.pod`` reports detailed errors for all test configurations
|
||||
* ``<basename>_coefficients.pod`` contains the coefficients of the POD potential
|
||||
|
||||
After training the POD potential, ``Ta_param.pod`` and ``<basename>_coefficients.pod``
|
||||
are the two files needed to use the POD potential in LAMMPS. See
|
||||
:doc:`pair_style pod <pair_pod>` for using the POD potential. Examples
|
||||
about training and using POD potentials are found in the directory
|
||||
lammps/examples/PACKAGES/pod.
|
||||
|
||||
Parameterized Potential Energy Surface
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
We consider a multi-element system of *N* atoms with :math:`N_{\rm e}`
|
||||
unique elements. We denote by :math:`\boldsymbol r_n` and :math:`Z_n`
|
||||
position vector and type of an atom *n* in the system,
|
||||
respectively. Note that we have :math:`Z_n \in \{1, \ldots, N_{\rm e}
|
||||
\}`, :math:`\boldsymbol R = (\boldsymbol r_1, \boldsymbol r_2, \ldots,
|
||||
\boldsymbol r_N) \in \mathbb{R}^{3N}`, and :math:`\boldsymbol Z = (Z_1,
|
||||
Z_2, \ldots, Z_N) \in \mathbb{N}^{N}`. The potential energy surface
|
||||
(PES) of the system can be expressed as a many-body expansion of the
|
||||
form
|
||||
|
||||
.. math::
|
||||
|
||||
E(\boldsymbol R, \boldsymbol Z, \boldsymbol{\eta}, \boldsymbol{\mu}) \ = \ & \sum_{i} V^{(1)}(\boldsymbol r_i, Z_i, \boldsymbol \mu^{(1)} ) + \frac12 \sum_{i,j} V^{(2)}(\boldsymbol r_i, \boldsymbol r_j, Z_i, Z_j, \boldsymbol \eta, \boldsymbol \mu^{(2)}) \\
|
||||
& + \frac16 \sum_{i,j,k} V^{(3)}(\boldsymbol r_i, \boldsymbol r_j, \boldsymbol r_k, Z_i, Z_j, Z_k, \boldsymbol \eta, \boldsymbol \mu^{(3)}) + \ldots
|
||||
|
||||
where :math:`V^{(1)}` is the one-body potential often used for
|
||||
representing external field or energy of isolated elements, and the
|
||||
higher-body potentials :math:`V^{(2)}, V^{(3)}, \ldots` are symmetric,
|
||||
uniquely defined, and zero if two or more indices take identical values.
|
||||
The superscript on each potential denotes its body order. Each *q*-body
|
||||
potential :math:`V^{(q)}` depends on :math:`\boldsymbol \mu^{(q)}` which
|
||||
are sets of parameters to fit the PES. Note that :math:`\boldsymbol \mu`
|
||||
is a collection of all potential parameters :math:`\boldsymbol
|
||||
\mu^{(1)}`, :math:`\boldsymbol \mu^{(2)}`, :math:`\boldsymbol
|
||||
\mu^{(3)}`, etc, and that :math:`\boldsymbol \eta` is a set of
|
||||
hyper-parameters such as inner cut-off radius :math:`r_{\rm in}` and
|
||||
outer cut-off radius :math:`r_{\rm cut}`.
|
||||
|
||||
Interatomic potentials rely on parameters to learn relationship between
|
||||
atomic environments and interactions. Since interatomic potentials are
|
||||
approximations by nature, their parameters need to be set to some
|
||||
reference values or fitted against data by necessity. Typically,
|
||||
potential fitting finds optimal parameters, :math:`\boldsymbol \mu^*`,
|
||||
to minimize a certain loss function of the predicted quantities and
|
||||
data. Since the fitted potential depends on the data set used to fit it,
|
||||
different data sets will yield different optimal parameters and thus
|
||||
different fitted potentials. When fitting the same functional form on
|
||||
*Q* different data sets, we would obtain *Q* different optimized
|
||||
potentials, :math:`E(\boldsymbol R,\boldsymbol Z, \boldsymbol \eta,
|
||||
\boldsymbol \mu_q^*), 1 \le q \le Q`. Consequently, there exist many
|
||||
different sets of optimized parameters for empirical interatomic
|
||||
potentials.
|
||||
|
||||
Instead of optimizing the potential parameters, inspired by the reduced
|
||||
basis method :ref:`(Grepl) <Grepl20072>` for parameterized partial
|
||||
differential equations, we view the parameterized PES as a parametric
|
||||
manifold of potential energies
|
||||
|
||||
.. math::
|
||||
|
||||
\mathcal{M} = \{E(\boldsymbol R, \boldsymbol Z, \boldsymbol \eta, \boldsymbol \mu) \ | \ \boldsymbol \mu \in \Omega^{\boldsymbol \mu} \}
|
||||
|
||||
where :math:`\Omega^{\boldsymbol \mu}` is a parameter domain in which
|
||||
:math:`\boldsymbol \mu` resides. The parametric manifold
|
||||
:math:`\mathcal{M}` contains potential energy surfaces for all values of
|
||||
:math:`\boldsymbol \mu \in \Omega^{\boldsymbol \mu}`. Therefore, the
|
||||
parametric manifold yields a much richer and more transferable atomic
|
||||
representation than any particular individual PES :math:`E(\boldsymbol
|
||||
R, \boldsymbol Z, \boldsymbol \eta, \boldsymbol \mu^*)`.
|
||||
|
||||
We propose specific forms of the parameterized potentials for one-body,
|
||||
two-body, and three-body interactions. We apply the Karhunen-Loeve
|
||||
expansion to snapshots of the parameterized potentials to obtain sets of
|
||||
orthogonal basis functions. These basis functions are aggregated
|
||||
according to the chemical elements of atoms, thus leading to
|
||||
multi-element proper orthogonal descriptors.
|
||||
|
||||
Proper Orthogonal Descriptors
|
||||
"""""""""""""""""""""""""""""
|
||||
|
||||
Proper orthogonal descriptors are finger prints characterizing the
|
||||
radial and angular distribution of a system of atoms. The detailed
|
||||
mathematical definition is given in the paper by Nguyen and Rohskopf
|
||||
:ref:`(Nguyen) <Nguyen20222>`.
|
||||
|
||||
The descriptors for the one-body interaction are used to capture energy
|
||||
of isolated elements and defined as follows
|
||||
|
||||
.. math::
|
||||
|
||||
D_{ip}^{(1)} = \left\{
|
||||
\begin{array}{ll}
|
||||
1, & \mbox{if } Z_i = p \\
|
||||
0, & \mbox{if } Z_i \neq p
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
for :math:`1 \le i \le N, 1 \le p \le N_{\rm e}`. The number of one-body
|
||||
descriptors per atom is equal to the number of elements. The one-body
|
||||
descriptors are independent of atom positions, but dependent on atom
|
||||
types. The one-body descriptors are active only when the keyword
|
||||
*onebody* is set to 1.
|
||||
|
||||
We adopt the usual assumption that the direct interaction between two
|
||||
atoms vanishes smoothly when their distance is greater than the outer
|
||||
cutoff distance :math:`r_{\rm cut}`. Furthermore, we assume that two
|
||||
atoms can not get closer than the inner cutoff distance :math:`r_{\rm
|
||||
in}` due to the Pauli repulsion principle. Let :math:`r \in (r_{\rm in},
|
||||
r_{\rm cut})`, we introduce the following parameterized radial functions
|
||||
|
||||
.. math::
|
||||
|
||||
\phi(r, r_{\rm in}, r_{\rm cut}, \alpha, \beta) = \frac{\sin (\alpha \pi x) }{r - r_{\rm in}}, \qquad \varphi(r, \gamma) = \frac{1}{r^\gamma} ,
|
||||
|
||||
where the scaled distance function :math:`x` is defined below to enrich the two-body manifold
|
||||
|
||||
.. math::
|
||||
|
||||
x(r, r_{\rm in}, r_{\rm cut}, \beta) = \frac{e^{-\beta(r - r_{\rm in})/(r_{\rm cut} - r_{\rm in})} - 1}{e^{-\beta} - 1} .
|
||||
|
||||
We introduce the following function as a convex combination of the two functions
|
||||
|
||||
.. math::
|
||||
|
||||
\psi(r, r_{\rm in}, r_{\rm cut}, \alpha, \beta, \gamma, \kappa) = \kappa \phi(r, r_{\rm in}, r_{\rm cut}, \alpha, \beta) + (1- \kappa) \varphi(r, \gamma) .
|
||||
|
||||
We see that :math:`\psi` is a function of distance :math:`r`, cut-off
|
||||
distances :math:`r_{\rm in}` and :math:`r_{\rm cut}`, and parameters
|
||||
:math:`\alpha, \beta, \gamma, \kappa`. Together these parameters allow
|
||||
the function :math:`\psi` to characterize a diverse spectrum of two-body
|
||||
interactions within the cut-off interval :math:`(r_{\rm in}, r_{\rm
|
||||
cut})`.
|
||||
|
||||
Next, we introduce the following parameterized potential
|
||||
|
||||
.. math::
|
||||
|
||||
W^{(2)}(r_{ij}, \boldsymbol \eta, \boldsymbol \mu^{(2)}) = f_{\rm c}(r_{ij}, \boldsymbol \eta) \psi(r_{ij}, \boldsymbol \eta, \boldsymbol \mu^{(2)})
|
||||
|
||||
where :math:`\eta_1 = r_{\rm in}, \eta_2 = r_{\rm cut}, \mu_1^{(2)} =
|
||||
\alpha, \mu_2^{(2)} = \beta, \mu_3^{(2)} = \gamma`, and
|
||||
:math:`\mu_4^{(2)} = \kappa`. Here the cut-off function :math:`f_{\rm
|
||||
c}(r_{ij}, \boldsymbol \eta)` proposed in [refs] is used to ensure the
|
||||
smooth vanishing of the potential and its derivative for :math:`r_{ij}
|
||||
\ge r_{\rm cut}`:
|
||||
|
||||
.. math::
|
||||
|
||||
f_{\rm c}(r_{ij}, r_{\rm in}, r_{\rm cut}) = \exp \left(1 -\frac{1}{\sqrt{\left(1 - \frac{(r-r_{\rm in})^3}{(r_{\rm cut} - r_{\rm in})^3} \right)^2 + 10^{-6}}} \right)
|
||||
|
||||
Based on the parameterized potential, we form a set of snapshots as
|
||||
follows. We assume that we are given :math:`N_{\rm s}` parameter tuples
|
||||
:math:`\boldsymbol \mu^{(2)}_\ell, 1 \le \ell \le N_{\rm s}`. We
|
||||
introduce the following set of snapshots on :math:`(r_{\rm in}, r_{\rm
|
||||
cut})`:
|
||||
|
||||
.. math::
|
||||
|
||||
\xi_\ell(r_{ij}, \boldsymbol \eta) = W^{(2)}(r_{ij}, \boldsymbol \eta, \boldsymbol \mu^{(2)}_\ell), \quad \ell = 1, \ldots, N_{\rm s} .
|
||||
|
||||
To ensure adequate sampling of the PES for different parameters, we
|
||||
choose :math:`N_{\rm s}` parameter points :math:`\boldsymbol
|
||||
\mu^{(2)}_\ell = (\alpha_\ell, \beta_\ell, \gamma_\ell, \kappa_\ell), 1
|
||||
\le \ell \le N_{\rm s}` as follows. The parameters :math:`\alpha \in [1,
|
||||
N_\alpha]` and :math:`\gamma \in [1, N_\gamma]` are integers, where
|
||||
:math:`N_\alpha` and :math:`N_\gamma` are the highest degrees for
|
||||
:math:`\alpha` and :math:`\gamma`, respectively. We next choose
|
||||
:math:`N_\beta` different values of :math:`\beta` in the interval
|
||||
:math:`[\beta_{\min}, \beta_{\max}]`, where :math:`\beta_{\min} = 0` and
|
||||
:math:`\beta_{\max} = 4`. The parameter :math:`\kappa` can be set either
|
||||
0 or 1. Hence, the total number of parameter points is :math:`N_{\rm s}
|
||||
= N_\alpha N_\beta + N_\gamma`. Although :math:`N_\alpha, N_\beta,
|
||||
N_\gamma` can be chosen conservatively large, we find that
|
||||
:math:`N_\alpha = 6, N_\beta = 3, N_\gamma = 8` are adequate for most
|
||||
problems. Note that :math:`N_\alpha` and :math:`N_\gamma` correspond to
|
||||
*bessel_polynomial_degree* and *inverse_polynomial_degree*,
|
||||
respectively.
|
||||
|
||||
We employ the Karhunen-Loeve (KL) expansion to generate an orthogonal
|
||||
basis set which is known to be optimal for representation of the
|
||||
snapshot family :math:`\{\xi_\ell\}_{\ell=1}^{N_{\rm s}}`. The two-body
|
||||
orthogonal basis functions are computed as follows
|
||||
|
||||
.. math::
|
||||
|
||||
U^{(2)}_m(r_{ij}, \boldsymbol \eta) = \sum_{\ell = 1}^{N_{\rm s}} A_{\ell m}(\boldsymbol \eta) \, \xi_\ell(r_{ij}, \boldsymbol \eta), \qquad m = 1, \ldots, N_{\rm 2b} ,
|
||||
|
||||
where the matrix :math:`\boldsymbol A \in \mathbb{R}^{N_{\rm s} \times
|
||||
N_{\rm s}}` consists of eigenvectors of the eigenvalue problem
|
||||
|
||||
.. math::
|
||||
|
||||
\boldsymbol C \boldsymbol a = \lambda \boldsymbol a
|
||||
|
||||
with the entries of :math:`\boldsymbol C \in \mathbb{R}^{N_{\rm s} \times N_{\rm s}}` being given by
|
||||
|
||||
.. math::
|
||||
|
||||
C_{ij} = \frac{1}{N_{\rm s}} \int_{r_{\rm in}}^{r_{\rm cut}} \xi_i(x, \boldsymbol \eta) \xi_j(x, \boldsymbol \eta) dx, \quad 1 \le i, j \le N_{\rm s}
|
||||
|
||||
Note that the eigenvalues :math:`\lambda_\ell, 1 \le \ell \le N_{\rm
|
||||
s}`, are ordered such that :math:`\lambda_1 \ge \lambda_2 \ge \ldots \ge
|
||||
\lambda_{N_{\rm s}}`, and that the matrix :math:`\boldsymbol A` is
|
||||
pe-computed and stored for any given :math:`\boldsymbol \eta`. Owing to
|
||||
the rapid convergence of the KL expansion, only a small number of
|
||||
orthogonal basis functions is needed to obtain accurate
|
||||
approximation. The value of :math:`N_{\rm 2b}` corresponds to
|
||||
*twobody_number_radial_basis_functions*.
|
||||
|
||||
The two-body proper orthogonal descriptors at each atom *i* are computed
|
||||
by summing the orthogonal basis functions over the neighbors of atom *i*
|
||||
and numerating on the atom types as follows
|
||||
|
||||
.. math::
|
||||
|
||||
D^{(2)}_{im l(p, q) }(\boldsymbol \eta) = \left\{
|
||||
\begin{array}{ll}
|
||||
\displaystyle \sum_{\{j | Z_j = q\}} U^{(2)}_m(r_{ij}, \boldsymbol \eta), & \mbox{if } Z_i = p \\
|
||||
0, & \mbox{if } Z_i \neq p
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
for :math:`1 \le i \le N, 1 \le m \le N_{\rm 2b}, 1 \le q, p \le N_{\rm
|
||||
e}`. Here :math:`l(p,q)` is a symmetric index mapping such that
|
||||
|
||||
.. math::
|
||||
|
||||
l(p,q) = \left\{
|
||||
\begin{array}{ll}
|
||||
q + (p-1) N_{\rm e} - p(p-1)/2, & \mbox{if } q \ge p \\
|
||||
p + (q-1) N_{\rm e} - q(q-1)/2, & \mbox{if } q < p .
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
The number of two-body descriptors per atom is thus :math:`N_{\rm 2b}
|
||||
N_{\rm e}(N_{\rm e}+1)/2`.
|
||||
|
||||
It is important to note that the orthogonal basis functions do not
|
||||
depend on the atomic numbers :math:`Z_i` and :math:`Z_j`. Therefore, the
|
||||
cost of evaluating the basis functions and their derivatives with
|
||||
respect to :math:`r_{ij}` is independent of the number of elements
|
||||
:math:`N_{\rm e}`. Consequently, even though the two-body proper
|
||||
orthogonal descriptors depend on :math:`\boldsymbol Z`, their
|
||||
computational complexity is independent of :math:`N_{\rm e}`.
|
||||
|
||||
In order to provide proper orthogonal descriptors for three-body
|
||||
interactions, we need to introduce a three-body parameterized
|
||||
potential. In particular, the three-body potential is defined as a
|
||||
product of radial and angular functions as follows
|
||||
|
||||
.. math::
|
||||
|
||||
W^{(3)}(r_{ij}, r_{ik}, \theta_{ijk}, \boldsymbol \eta, \boldsymbol \mu^{(3)}) = \psi(r_{ij}, r_{\rm min}, r_{\rm max}, \alpha, \beta, \gamma, \kappa) f_{\rm c}(r_{ij}, r_{\rm min}, r_{\rm max}) \\
|
||||
\psi(r_{ik}, r_{\rm min}, r_{\rm max}, \alpha, \beta, \gamma, \kappa) f_{\rm c}(r_{ik}, r_{\rm min}, r_{\rm max}) \\
|
||||
\cos (\sigma \theta_{ijk} + \zeta)
|
||||
|
||||
where :math:`\sigma` is the periodic multiplicity, :math:`\zeta` is the
|
||||
equilibrium angle, :math:`\boldsymbol \mu^{(3)} = (\alpha, \beta,
|
||||
\gamma, \kappa, \sigma, \zeta)`. The three-body potential provides an
|
||||
angular fingerprint of the atomic environment through the bond angles
|
||||
:math:`\theta_{ijk}` formed with each pair of neighbors :math:`j` and
|
||||
:math:`k`. Compared to the two-body potential, the three-body potential
|
||||
has two extra parameters :math:`(\sigma, \zeta)` associated with the
|
||||
angular component.
|
||||
|
||||
Let :math:`\boldsymbol \varrho = (\alpha, \beta, \gamma, \kappa)`. We
|
||||
assume that we are given :math:`L_{\rm r}` parameter tuples
|
||||
:math:`\boldsymbol \varrho_\ell, 1 \le \ell \le L_{\rm r}`. We
|
||||
introduce the following set of snapshots on :math:`(r_{\min},
|
||||
r_{\max})`:
|
||||
|
||||
.. math::
|
||||
|
||||
\zeta_\ell(r_{ij}, r_{\rm min}, r_{\rm max} ) = \psi(r_{ij}, r_{\rm min}, r_{\rm max}, \boldsymbol \varrho_\ell) f_{\rm c}(r_{ij}, r_{\rm min}, r_{\rm max}), \quad 1 \le \ell \le L_{\rm r} .
|
||||
|
||||
We apply the Karhunen-Loeve (KL) expansion to this set of snapshots to
|
||||
obtain orthogonal basis functions as follows
|
||||
|
||||
.. math::
|
||||
|
||||
U^{r}_m(r_{ij}, r_{\rm min}, r_{\rm max} ) = \sum_{\ell = 1}^{L_{\rm r}} A_{\ell m} \, \zeta_\ell(r_{ij}, r_{\rm min}, r_{\rm max} ), \qquad m = 1, \ldots, N_{\rm r} ,
|
||||
|
||||
where the matrix :math:`\boldsymbol A \in \mathbb{R}^{L_{\rm r} \times L_{\rm r}}` consists
|
||||
of eigenvectors of the eigenvalue problem. For the parameterized angular function,
|
||||
we consider angular basis functions
|
||||
|
||||
.. math::
|
||||
|
||||
U^{a}_n(\theta_{ijk}) = \cos ((n-1) \theta_{ijk}), \qquad n = 1,\ldots, N_{\rm a},
|
||||
|
||||
where :math:`N_{\rm a}` is the number of angular basis functions. The orthogonal
|
||||
basis functions for the parameterized potential are computed as follows
|
||||
|
||||
.. math::
|
||||
|
||||
U^{(3)}_{mn}(r_{ij}, r_{ik}, \theta_{ijk}, \boldsymbol \eta) = U^{r}_m(r_{ij}, \boldsymbol \eta) U^{r}_m(r_{ik}, \boldsymbol \eta) U^{a}_n(\theta_{ijk}),
|
||||
|
||||
for :math:`1 \le m \le N_{\rm r}, 1 \le n \le N_{\rm a}`. The number of three-body
|
||||
orthogonal basis functions is equal to :math:`N_{\rm 3b} = N_{\rm r} N_{\rm a}` and
|
||||
independent of the number of elements. The value of :math:`N_{\rm r}` corresponds to
|
||||
*threebody_number_radial_basis_functions*, while that of :math:`N_{\rm a}` to
|
||||
*threebody_number_angular_basis_functions*.
|
||||
|
||||
The three-body proper orthogonal descriptors at each atom *i*
|
||||
are obtained by summing over the neighbors *j* and *k* of atom *i* as
|
||||
|
||||
.. math::
|
||||
|
||||
D^{(3)}_{imn \ell(p, q, s)}(\boldsymbol \eta) = \left\{
|
||||
\begin{array}{ll}
|
||||
\displaystyle \sum_{\{j | Z_j = q\}} \sum_{\{k | Z_k = s\}} U^{(3)}_{mn}(r_{ij}, r_{ik}, \theta_{ijk}, \boldsymbol \eta), & \mbox{if } Z_i = p \\
|
||||
0, & \mbox{if } Z_i \neq p
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
for :math:`1 \le i \le N, 1 \le m \le N_{\rm r}, 1 \le n \le N_{\rm a}, 1 \le q, p, s \le N_{\rm e}`,
|
||||
where
|
||||
|
||||
.. math::
|
||||
|
||||
\ell(p,q,s) = \left\{
|
||||
\begin{array}{ll}
|
||||
s + (q-1) N_{\rm e} - q(q-1)/2 + (p-1)N_{\rm e}(1+N_{\rm e})/2 , & \mbox{if } s \ge q \\
|
||||
q + (s-1) N_{\rm e} - s(s-1)/2 + (p-1)N_{\rm e}(1+N_{\rm e})/2, & \mbox{if } s < q .
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
The number of three-body descriptors per atom is thus :math:`N_{\rm 3b} N_{\rm e}^2(N_{\rm e}+1)/2`.
|
||||
While the number of three-body PODs is cubic function of the number of elements,
|
||||
the computational complexity of the three-body PODs is independent of the number of elements.
|
||||
|
||||
Four-Body SNAP Descriptors
|
||||
""""""""""""""""""""""""""
|
||||
|
||||
In addition to the proper orthogonal descriptors described above, we also employ
|
||||
the spectral neighbor analysis potential (SNAP) descriptors. SNAP uses bispectrum components
|
||||
to characterize the local neighborhood of each atom in a very general way. The mathematical definition
|
||||
of the bispectrum calculation and its derivatives w.r.t. atom positions is described in
|
||||
:doc:`compute snap <compute_sna_atom>`. In SNAP, the
|
||||
total energy is decomposed into a sum over atom energies. The energy of
|
||||
atom *i* is expressed as a weighted sum over bispectrum components.
|
||||
|
||||
.. math::
|
||||
|
||||
E_i^{\rm SNAP} = \sum_{k=1}^{N_{\rm 4b}} \sum_{p=1}^{N_{\rm e}} c_{kp}^{(4)} D_{ikp}^{(4)}
|
||||
|
||||
|
||||
where the SNAP descriptors are related to the bispectrum components by
|
||||
|
||||
.. math::
|
||||
|
||||
D^{(4)}_{ikp} = \left\{
|
||||
\begin{array}{ll}
|
||||
\displaystyle B_{ik}, & \mbox{if } Z_i = p \\
|
||||
0, & \mbox{if } Z_i \neq p
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
Here :math:`B_{ik}` is the *k*\ -th bispectrum component of atom *i*. The number of
|
||||
bispectrum components :math:`N_{\rm 4b}` depends on the value of *fourbody_snap_twojmax* :math:`= 2 J_{\rm max}`
|
||||
and *fourbody_snap_chemflag*. If *fourbody_snap_chemflag* = 0
|
||||
then :math:`N_{\rm 4b} = (J_{\rm max}+1)(J_{\rm max}+2)(J_{\rm max}+1.5)/3`.
|
||||
If *fourbody_snap_chemflag* = 1 then :math:`N_{\rm 4b} = N_{\rm e}^3 (J_{\rm max}+1)(J_{\rm max}+2)(J_{\rm max}+1.5)/3`.
|
||||
The bispectrum calculation is described in more detail in :doc:`compute sna/atom <compute_sna_atom>`.
|
||||
|
||||
Linear Proper Orthogonal Descriptor Potentials
|
||||
""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The proper orthogonal descriptors and SNAP descriptors are used to define the atomic energies
|
||||
in the following expansion
|
||||
|
||||
.. math::
|
||||
|
||||
E_{i}(\boldsymbol \eta) = \sum_{p=1}^{N_{\rm e}} c^{(1)}_p D^{(1)}_{ip} + \sum_{m=1}^{N_{\rm 2b}} \sum_{l=1}^{N_{\rm e}(N_{\rm e}+1)/2} c^{(2)}_{ml} D^{(2)}_{iml}(\boldsymbol \eta) + \sum_{m=1}^{N_{\rm r}} \sum_{n=1}^{N_{\rm a}} \sum_{\ell=1}^{N_{\rm e}^2(N_{\rm e}+1)/2} c^{(3)}_{mn\ell} D^{(3)}_{imn\ell}(\boldsymbol \eta) + \sum_{k=1}^{N_{\rm 4b}} \sum_{p=1}^{N_{\rm e}} c_{kp}^{(4)} D_{ikp}^{(4)}(\boldsymbol \eta),
|
||||
|
||||
where :math:`D^{(1)}_{ip}, D^{(2)}_{iml}, D^{(3)}_{imn\ell}, D^{(4)}_{ikp}` are the one-body, two-body, three-body, four-body descriptors,
|
||||
respectively, and :math:`c^{(1)}_p, c^{(2)}_{ml}, c^{(3)}_{mn\ell}, c^{(4)}_{kp}` are their respective expansion
|
||||
coefficients. In a more compact notation that implies summation over descriptor indices
|
||||
the atomic energies can be written as
|
||||
|
||||
.. math::
|
||||
|
||||
E_i(\boldsymbol \eta) = \sum_{m=1}^{N_{\rm e}} c^{(1)}_m D^{(1)}_{im} + \sum_{m=1}^{N_{\rm d}^{(2)}} c^{(2)}_k D^{(2)}_{im} + \sum_{m=1}^{N_{\rm d}^{(3)}} c^{(3)}_m D^{(3)}_{im} + \sum_{m=1}^{N_{\rm d}^{(4)}} c^{(4)}_m D^{(4)}_{im}
|
||||
|
||||
where :math:`N_{\rm d}^{(2)} = N_{\rm 2b} N_{\rm e} (N_{\rm e}+1)/2`,
|
||||
:math:`N_{\rm d}^{(3)} = N_{\rm 3b} N_{\rm e}^2 (N_{\rm e}+1)/2`, and
|
||||
:math:`N_{\rm d}^{(4)} = N_{\rm 4b} N_{\rm e}` are
|
||||
the number of two-body, three-body, and four-body descriptors, respectively.
|
||||
|
||||
The potential energy is then obtained by summing local atomic energies :math:`E_i`
|
||||
for all atoms :math:`i` in the system
|
||||
|
||||
.. math::
|
||||
|
||||
E(\boldsymbol \eta) = \sum_{i}^N E_{i}(\boldsymbol \eta)
|
||||
|
||||
Because the descriptors are one-body, two-body, and three-body terms,
|
||||
the resulting POD potential is a three-body PES. We can express the potential
|
||||
energy as a linear combination of the global descriptors as follows
|
||||
|
||||
.. math::
|
||||
|
||||
E(\boldsymbol \eta) = \sum_{m=1}^{N_{\rm e}} c^{(1)}_m d^{(1)}_{m} + \sum_{m=1}^{N_{\rm d}^{(2)}} c^{(2)}_m d^{(2)}_{m} + \sum_{m=1}^{N_{\rm d}^{(3)}} c^{(3)}_m d^{(3)}_{m} + \sum_{m=1}^{N_{\rm d}^{(4)}} c^{(4)}_m d^{(4)}_{m}
|
||||
|
||||
where the global descriptors are given by
|
||||
|
||||
.. math::
|
||||
|
||||
d_{m}^{(1)}(\boldsymbol \eta) = \sum_{i=1}^N D_{im}^{(1)}(\boldsymbol \eta), \quad d_{m}^{(2)}(\boldsymbol \eta) = \sum_{i=1}^N D_{im}^{(2)}(\boldsymbol \eta), \quad d_{m}^{(3)}(\boldsymbol \eta) = \sum_{i=1}^N D_{im}^{(3)}(\boldsymbol \eta), \quad d_{m}^{(4)}(\boldsymbol \eta) = \sum_{i=1}^N D_{im}^{(4)}(\boldsymbol \eta)
|
||||
|
||||
Hence, we obtain the atomic forces as
|
||||
|
||||
.. math::
|
||||
|
||||
\boldsymbol F = -\nabla E(\boldsymbol \eta) = - \sum_{m=1}^{N_{\rm d}^{(2)}} c^{(2)}_m \nabla d_m^{(2)} - \sum_{m=1}^{N_{\rm d}^{(3)}} c^{(3)}_m \nabla d_m^{(3)} - \sum_{m=1}^{N_{\rm d}^{(4)}} c^{(4)}_m \nabla d_m^{(4)}
|
||||
|
||||
where :math:`\nabla d_m^{(2)}`, :math:`\nabla d_m^{(3)}` and :math:`\nabla d_m^{(4)}` are derivatives of the two-body
|
||||
three-body, and four-body global descriptors with respect to atom positions, respectively.
|
||||
Note that since the first-body global descriptors are constant, their derivatives are zero.
|
||||
|
||||
Quadratic Proper Orthogonal Descriptor Potentials
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
We recall two-body PODs :math:`D^{(2)}_{ik}, 1 \le k \le N_{\rm d}^{(2)}`,
|
||||
and three-body PODs :math:`D^{(3)}_{im}, 1 \le m \le N_{\rm d}^{(3)}`,
|
||||
with :math:`N_{\rm d}^{(2)} = N_{\rm 2b} N_{\rm e} (N_{\rm e}+1)/2` and
|
||||
:math:`N_{\rm d}^{(3)} = N_{\rm 3b} N_{\rm e}^2 (N_{\rm e}+1)/2` being
|
||||
the number of descriptors per atom for the two-body PODs and three-body PODs,
|
||||
respectively. We employ them to define a new set of atomic descriptors as follows
|
||||
|
||||
.. math::
|
||||
|
||||
D^{(2*3)}_{ikm} = \frac{1}{2N}\left( D^{(2)}_{ik} \sum_{j=1}^N D^{(3)}_{jm} + D^{(3)}_{im} \sum_{j=1}^N D^{(2)}_{jk} \right)
|
||||
|
||||
for :math:`1 \le i \le N, 1 \le k \le N_{\rm d}^{(2)}, 1 \le m \le N_{\rm d}^{(3)}`.
|
||||
The new descriptors are four-body because they involve central atom :math:`i` together
|
||||
with three neighbors :math:`j, k` and :math:`l`. The total number of new descriptors per atom is equal to
|
||||
|
||||
.. math::
|
||||
|
||||
N_{\rm d}^{(2*3)} = N_{\rm d}^{(2)} * N_{\rm d}^{(3)} = N_{\rm 2b} N_{\rm 3b} N_{\rm e}^3 (N_{\rm e}+1)^2/4 .
|
||||
|
||||
The new global descriptors are calculated as
|
||||
|
||||
.. math::
|
||||
|
||||
d^{(2*3)}_{km} = \sum_{i=1}^N D^{(2*3)}_{ikm} = \left( \sum_{i=1}^N D^{(2)}_{ik} \right) \left( \sum_{i=1}^N D^{(3)}_{im} \right) = d^{(2)}_{k} d^{(3)}_m,
|
||||
|
||||
for :math:`1 \le k \le N_{\rm d}^{(2)}, 1 \le m \le N_{\rm d}^{(3)}`. Hence, the gradient
|
||||
of the new global descriptors with respect to atom positions is calculated as
|
||||
|
||||
.. math::
|
||||
|
||||
\nabla d^{(2*3)}_{km} = d^{(3)}_m \nabla d^{(2)}_{k} + d^{(2)}_{k} \nabla d^{(3)}_m, \quad 1 \le k \le N_{\rm d}^{(2)}, 1 \le m \le N_{\rm d}^{(3)} .
|
||||
|
||||
The quadratic POD potential is defined as a linear combination of the
|
||||
original and new global descriptors as follows
|
||||
|
||||
.. math::
|
||||
|
||||
E^{(2*3)} = \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} c^{(2*3)}_{km} d^{(2*3)}_{km} .
|
||||
|
||||
It thus follows that
|
||||
|
||||
.. math::
|
||||
|
||||
E^{(2*3)} = 0.5 \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} \left( \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} c^{(2*3)}_{km} d_m^{(3)} \right) d_k^{(2)} + 0.5 \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} \left( \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} c^{(2*3)}_{km} d_k^{(2)} \right) d_m^{(3)} ,
|
||||
|
||||
which is simplified to
|
||||
|
||||
.. math::
|
||||
|
||||
E^{(2*3)} = 0.5 \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} b_k^{(2)} d_k^{(2)} + 0.5 \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} b_m^{(3)} d_m^{(3)}
|
||||
|
||||
where
|
||||
|
||||
.. math::
|
||||
|
||||
b_k^{(2)} & = \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} c^{(2*3)}_{km} d_m^{(3)}, \quad k = 1,\ldots, N_{\rm 2d}^{(2*3)}, \\
|
||||
b_m^{(3)} & = \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} c^{(2*3)}_{km} d_k^{(2)}, \quad m = 1,\ldots, N_{\rm 3d}^{(2*3)} .
|
||||
|
||||
The quadratic POD potential results in the following atomic forces
|
||||
|
||||
.. math::
|
||||
|
||||
\boldsymbol F^{(2*3)} = - \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} c^{(2*3)}_{km} \nabla d^{(2*3)}_{km} .
|
||||
|
||||
It can be shown that
|
||||
|
||||
.. math::
|
||||
|
||||
\boldsymbol F^{(2*3)} = - \sum_{k=1}^{N_{\rm 2d}^{(2*3)}} b^{(2)}_k \nabla d_k^{(2)} - \sum_{m=1}^{N_{\rm 3d}^{(2*3)}} b^{(3)}_m \nabla d_m^{(3)} .
|
||||
|
||||
The calculation of the atomic forces for the quadratic POD potential
|
||||
only requires the extra calculation of :math:`b_k^{(2)}` and :math:`b_m^{(3)}` which can be negligible.
|
||||
As a result, the quadratic POD potential does not increase the computational complexity.
|
||||
|
||||
|
||||
Training
|
||||
""""""""
|
||||
|
||||
POD potentials are trained using the least-squares regression against
|
||||
density functional theory (DFT) data. Let :math:`J` be the number of
|
||||
training configurations, with :math:`N_j` being the number of atoms in
|
||||
the j-th configuration. Let :math:`\{E^{\star}_j\}_{j=1}^{J}` and
|
||||
:math:`\{\boldsymbol F^{\star}_j\}_{j=1}^{J}` be the DFT energies and
|
||||
forces for :math:`J` configurations. Next, we calculate the global
|
||||
descriptors and their derivatives for all training configurations. Let
|
||||
:math:`d_{jm}, 1 \le m \le M`, be the global descriptors associated with
|
||||
the j-th configuration, where :math:`M` is the number of global
|
||||
descriptors. We then form a matrix :math:`\boldsymbol A \in
|
||||
\mathbb{R}^{J \times M}` with entries :math:`A_{jm} = d_{jm}/ N_j` for
|
||||
:math:`j=1,\ldots,J` and :math:`m=1,\ldots,M`. Moreover, we form a
|
||||
matrix :math:`\boldsymbol B \in \mathbb{R}^{\mathcal{N} \times M}` by
|
||||
stacking the derivatives of the global descriptors for all training
|
||||
configurations from top to bottom, where :math:`\mathcal{N} =
|
||||
3\sum_{j=1}^{J} N_j`.
|
||||
|
||||
The coefficient vector :math:`\boldsymbol c` of the POD potential is
|
||||
found by solving the following least-squares problem
|
||||
|
||||
.. math::
|
||||
|
||||
{\min}_{\boldsymbol c \in \mathbb{R}^{M}} \ w_E \|\boldsymbol A(\boldsymbol \eta) \boldsymbol c - \bar{\boldsymbol E}^{\star} \|^2 + w_F \|\boldsymbol B(\boldsymbol \eta) \boldsymbol c + \boldsymbol F^{\star} \|^2 + w_R \|\boldsymbol c \|^2,
|
||||
|
||||
where :math:`w_E` and :math:`w_F` are weights for the energy
|
||||
(*fitting_weight_energy*) and force (*fitting_weight_force*),
|
||||
respectively; and :math:`w_R` is the regularization parameter (*fitting_regularization_parameter*). Here :math:`\bar{\boldsymbol E}^{\star} \in
|
||||
\mathbb{R}^{J}` is a vector of with entries :math:`\bar{E}^{\star}_j =
|
||||
E^{\star}_j/N_j` and :math:`\boldsymbol F^{\star}` is a vector of
|
||||
:math:`\mathcal{N}` entries obtained by stacking :math:`\{\boldsymbol
|
||||
F^{\star}_j\}_{j=1}^{J}` from top to bottom.
|
||||
|
||||
The training procedure is the same for both the linear and quadratic POD
|
||||
potentials. However, since the quadratic POD potential has a
|
||||
significantly larger number of the global descriptors, it is more
|
||||
expensive to train the linear POD potential. This is because the
|
||||
training of the quadratic POD potential still requires us to calculate
|
||||
and store the quadratic global descriptors and their
|
||||
gradient. Furthermore, the quadratic POD potential may require more
|
||||
training data in order to prevent over-fitting. In order to reduce the
|
||||
computational cost of fitting the quadratic POD potential and avoid
|
||||
over-fitting, we can use subsets of two-body and three-body PODs for
|
||||
constructing the new descriptors.
|
||||
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This command is part of the ML-POD package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`pair_style pod <pair_pod>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The keyword defaults are also given in the description of the input files.
|
||||
|
||||
----------
|
||||
|
||||
.. _Grepl20072:
|
||||
|
||||
**(Grepl)** Grepl, Maday, Nguyen, and Patera, ESAIM: Mathematical Modelling and Numerical Analysis 41(3), 575-605, (2007).
|
||||
|
||||
.. _Nguyen20222:
|
||||
|
||||
**(Nguyen)** Nguyen and Rohskopf, arXiv preprint arXiv:2209.02362 (2022).
|
||||
@ -77,26 +77,31 @@ for individual fixes for info on which ones can be restarted.
|
||||
|
||||
----------
|
||||
|
||||
Some fixes calculate one of three styles of quantities: global,
|
||||
per-atom, or local, which can be used by other commands or output as
|
||||
described below. A global quantity is one or more system-wide values
|
||||
(e.g., the energy of a wall interacting with particles). A per-atom
|
||||
quantity is one or more values per atom (e.g., the displacement vector
|
||||
for each atom since time 0). Per-atom values are set to 0.0 for atoms
|
||||
not in the specified fix group. Local quantities are calculated by
|
||||
each processor based on the atoms it owns, but there may be zero or
|
||||
more per atoms.
|
||||
Some fixes calculate one or more of four styles of quantities: global,
|
||||
per-atom, local, or per-grid, which can be used by other commands or
|
||||
output as described below. A global quantity is one or more
|
||||
system-wide values, e.g. the energy of a wall interacting with
|
||||
particles. A per-atom quantity is one or more values per atom,
|
||||
e.g. the displacement vector for each atom since time 0. Per-atom
|
||||
values are set to 0.0 for atoms not in the specified fix group. Local
|
||||
quantities are calculated by each processor based on the atoms it
|
||||
owns, but there may be zero or more per atoms. Per-grid quantities
|
||||
are calculated on a regular 2d or 3d grid which overlays a 2d or 3d
|
||||
simulation domain. The grid points and the data they store are
|
||||
distributed across processors; each processor owns the grid points
|
||||
which fall within its sub-domain.
|
||||
|
||||
Note that a single fix can produce either global or per-atom or local
|
||||
quantities (or none at all), but not both global and per-atom. It can
|
||||
produce local quantities in tandem with global or per-atom quantities.
|
||||
The fix page will explain.
|
||||
Note that a single fix typically produces either global or per-atom or
|
||||
local or per-grid values (or none at all). It does not produce both
|
||||
global and per-atom. It can produce local or per-grid values in
|
||||
tandem with global or per-atom values. The fix doc page will explain
|
||||
the details.
|
||||
|
||||
Global, per-atom, and local quantities each come in three kinds: a
|
||||
single scalar value, a vector of values, or a 2d array of values. The
|
||||
doc page for each fix describes the style and kind of values it
|
||||
produces (e.g., a per-atom vector). Some fixes produce more than one
|
||||
kind of a single style (e.g., a global scalar and a global vector).
|
||||
Global, per-atom, local, and per-grid quantities come in three kinds:
|
||||
a single scalar value, a vector of values, or a 2d array of values.
|
||||
The doc page for each fix describes the style and kind of values it
|
||||
produces, e.g. a per-atom vector. Some fixes produce more than one
|
||||
kind of a single style, e.g. a global scalar and a global vector.
|
||||
|
||||
When a fix quantity is accessed, as in many of the output commands
|
||||
discussed below, it can be referenced via the following bracket
|
||||
@ -185,6 +190,7 @@ accelerated styles exist.
|
||||
* :doc:`ave/chunk <fix_ave_chunk>` - compute per-chunk time-averaged quantities
|
||||
* :doc:`ave/correlate <fix_ave_correlate>` - compute/output time correlations
|
||||
* :doc:`ave/correlate/long <fix_ave_correlate_long>` - alternative to :doc:`ave/correlate <fix_ave_correlate>` that allows efficient calculation over long time windows
|
||||
* :doc:`ave/grid <fix_ave_grid>` - compute per-grid time-averaged quantities
|
||||
* :doc:`ave/histo <fix_ave_histo>` - compute/output time-averaged histograms
|
||||
* :doc:`ave/histo/weight <fix_ave_histo>` - weighted version of fix ave/histo
|
||||
* :doc:`ave/time <fix_ave_time>` - compute/output global time-averaged quantities
|
||||
@ -216,9 +222,9 @@ accelerated styles exist.
|
||||
* :doc:`edpd/source <fix_dpd_source>` - add heat source to eDPD simulations
|
||||
* :doc:`efield <fix_efield>` - impose electric field on system
|
||||
* :doc:`ehex <fix_ehex>` - enhanced heat exchange algorithm
|
||||
* :doc:`electrode/conp <fix_electrode_conp>` - impose electric potential
|
||||
* :doc:`electrode/conq <fix_electrode_conp>` - impose total electric charge
|
||||
* :doc:`electrode/thermo <fix_electrode_conp>` - apply thermo-potentiostat
|
||||
* :doc:`electrode/conp <fix_electrode>` - impose electric potential
|
||||
* :doc:`electrode/conq <fix_electrode>` - impose total electric charge
|
||||
* :doc:`electrode/thermo <fix_electrode>` - apply thermo-potentiostat
|
||||
* :doc:`electron/stopping <fix_electron_stopping>` - electronic stopping power as a friction force
|
||||
* :doc:`electron/stopping/fit <fix_electron_stopping>` - electronic stopping power as a friction force
|
||||
* :doc:`enforce2d <fix_enforce2d>` - zero out *z*-dimension velocity and force
|
||||
@ -360,6 +366,7 @@ accelerated styles exist.
|
||||
* :doc:`saed/vtk <fix_saed_vtk>` - time-average the intensities from :doc:`compute saed <compute_saed>`
|
||||
* :doc:`setforce <fix_setforce>` - set the force on each atom
|
||||
* :doc:`setforce/spin <fix_setforce>` - set magnetic precession vectors on each atom
|
||||
* :doc:`sgcmc <fix_sgcmc>` - fix for hybrid semi-grand canonical MD/MC simulations
|
||||
* :doc:`shake <fix_shake>` - SHAKE constraints on bonds and/or angles
|
||||
* :doc:`shardlow <fix_shardlow>` - integration of DPD equations of motion using the Shardlow splitting
|
||||
* :doc:`smd <fix_smd>` - applied a steered MD force to a group
|
||||
|
||||
@ -63,7 +63,8 @@ be needed when running such a hybrid simulation, especially if the
|
||||
swapped atoms are not well equilibrated.
|
||||
|
||||
The *types* keyword is required. At least two atom types must be
|
||||
specified.
|
||||
specified. If not using *semi-grand*, exactly two atom types
|
||||
are required.
|
||||
|
||||
The *ke* keyword can be set to *no* to turn off kinetic energy
|
||||
conservation for swaps. The default is *yes*, which means that swapped
|
||||
|
||||
@ -112,6 +112,17 @@ or atoms in a spatial bin. See the :doc:`compute chunk/atom
|
||||
page for details of how chunks can be defined and examples of how they
|
||||
can be used to measure properties of a system.
|
||||
|
||||
Note that if the :doc:`compute chunk/atom <compute_chunk_atom>`
|
||||
command defines spatial bins, the fix ave/chunk command performs a
|
||||
similar computation as the :doc:`fix ave/grid <fix_ave_grid>` command.
|
||||
However, the per-bin outputs from the fix ave/chunk command are
|
||||
global; each processor stores a copy of the entire set of bin data.
|
||||
By contrast, the :doc:`fix ave/grid <fix_ave_grid>` command uses a
|
||||
distributed grid where each processor owns a subset of the bins. Thus
|
||||
it is more efficient to use the :doc:`fix ave/grid <fix_ave_grid>`
|
||||
command when the grid is large and a simulation is run on many
|
||||
processors.
|
||||
|
||||
Note that only atoms in the specified group contribute to the summing
|
||||
and averaging calculations. The :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` command defines its own group as well as an
|
||||
@ -141,10 +152,11 @@ quantities. :doc:`Variables <variable>` of style *atom* are the only
|
||||
ones that can be used with this fix since all other styles of variable
|
||||
produce global quantities.
|
||||
|
||||
Note that for values from a compute or fix, the bracketed index I can
|
||||
be specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "m\*" or
|
||||
"m\*n". If :math:`N` is the size of the vector (for *mode* = scalar) or the
|
||||
Note that for values from a compute or fix that produces a per-atom
|
||||
array (multiple values per atom), the bracketed index I can be
|
||||
specified using a wildcard asterisk with the index to effectively
|
||||
specify multiple values. This takes the form "\*" or "\*n" or "n\*"
|
||||
or "m\*n". If :math:`N` = the size of the vector (for *mode* = scalar) or the
|
||||
number of columns in the array (for *mode* = vector), then an asterisk
|
||||
with no numeric values means all indices from 1 to :math:`N`. A leading
|
||||
asterisk means all indices from 1 to n (inclusive). A trailing
|
||||
@ -359,6 +371,8 @@ For the *density/number* and *density/mass* values, the
|
||||
volume (bin volume or system volume) used in the per-sample sum
|
||||
normalization will be the current volume at each sampling step.
|
||||
|
||||
----------
|
||||
|
||||
The *ave* keyword determines how the per-chunk values produced every
|
||||
:math:`N_\text{freq}` steps are averaged with values produced on previous steps
|
||||
that were multiples of :math:`N_\text{freq}`, before they are accessed by
|
||||
@ -385,6 +399,8 @@ of the individual chunk values on time steps 8000, 9000, and 10000. Outputs on
|
||||
early steps will average over less than :math:`M` values if they are not
|
||||
available.
|
||||
|
||||
----------
|
||||
|
||||
The *bias* keyword specifies the ID of a temperature compute that
|
||||
removes a "bias" velocity from each atom, specified as *bias-ID*\ .
|
||||
It is only used when the *temp* value is calculated, to compute the
|
||||
@ -415,6 +431,8 @@ set to the remaining degrees of freedom for the entire molecule
|
||||
(entire chunk in this case), that is, 6 for 3d or 3 for 2d for a rigid
|
||||
molecule.
|
||||
|
||||
----------
|
||||
|
||||
The *file* keyword allows a filename to be specified. Every
|
||||
:math:`N_\text{freq}` timesteps, a section of chunk info will be written to a
|
||||
text file in the following format. A line with the timestep and number of
|
||||
@ -523,12 +541,14 @@ Restrictions
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`compute <compute>`, :doc:`fix ave/atom <fix_ave_atom>`,
|
||||
:doc:`fix ave/histo <fix_ave_histo>`, :doc:`fix ave/time <fix_ave_time>`,
|
||||
:doc:`variable <variable>`, :doc:`fix ave/correlate <fix_ave_correlate>`
|
||||
:doc:`compute <compute>`, :doc:`fix ave/atom <fix_ave_atom>`, `fix
|
||||
:doc:ave/histo <fix_ave_histo>`, :doc:`fix ave/time <fix_ave_time>`,
|
||||
:doc:`variable <variable>`, :doc:`fix ave/correlate
|
||||
:doc:<fix_ave_correlate>`, `fix ave/atogrid <fix_ave_grid>`
|
||||
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The option defaults are norm = all, ave = one, bias = none, no file output, and
|
||||
title 1,2,3 = strings as described above.
|
||||
The option defaults are norm = all, ave = one, bias = none, no file
|
||||
output, and title 1,2,3 = strings as described above.
|
||||
|
||||
509
doc/src/fix_ave_grid.rst
Normal file
509
doc/src/fix_ave_grid.rst
Normal file
@ -0,0 +1,509 @@
|
||||
.. index:: fix ave/grid
|
||||
|
||||
fix ave/grid command
|
||||
=====================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID ave/grid Nevery Nrepeat Nfreq Nx Ny Nz value1 value2 ... keyword args ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* ave/grid = style name of this fix command
|
||||
* Nevery = use input values every this many timesteps
|
||||
* Nrepeat = # of times to use input values for calculating averages
|
||||
* Nfreq = calculate averages every this many timesteps
|
||||
* Nx, Ny, Nz = grid size in each dimension
|
||||
* one or more per-atom or per-grid input values can be listed
|
||||
* per-atom value = vx, vy, vz, fx, fy, fz, density/mass, density/number, mass, temp, c_ID, c_ID[I], f_ID, f_ID[I], v_name
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
vx,vy,vz,fx,fy,fz,mass = atom attribute (velocity, force component, mass)
|
||||
density/number, density/mass = number or mass density (per volume)
|
||||
temp = temperature
|
||||
c_ID = per-atom vector calculated by a compute with ID
|
||||
c_ID[I] = Ith column of per-atom array calculated by a compute with ID, I can include wildcard (see below)
|
||||
f_ID = per-atom vector calculated by a fix with ID
|
||||
f_ID[I] = Ith column of per-atom array calculated by a fix with ID, I can include wildcard (see below)
|
||||
v_name = per-atom vector calculated by an atom-style variable with name
|
||||
|
||||
* per-grid value = c_ID:gname:dname, c_ID:gname:dname[I], f_ID:gname:dname, f_ID:gname:dname[I]
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
gname = name of grid defined by compute or fix
|
||||
dname = name of data field defined by compute or fix
|
||||
c_ID = per-grid vector calculated by a compute with ID
|
||||
c_ID[I] = Ith column of per-grid array calculated by a compute with ID, I can include wildcard (see below)
|
||||
f_ID = per-grid vector calculated by a fix with ID
|
||||
f_ID[I] = Ith column of per-grid array calculated by a fix with ID, I can include wildcard (see below)
|
||||
|
||||
* zero or more keyword/arg pairs may be appended
|
||||
* keyword = *discard* or *norm* or *ave* or *bias* or *adof* or *cdof*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*discard* arg = *yes* or *no*
|
||||
yes = discard an atom outside grid in a non-periodic dimension
|
||||
no = remap an atom outside grid in a non-periodic dimension to first or last grid cell
|
||||
*norm* arg = *all* or *sample* or *none* = how output on *Nfreq* steps is normalized
|
||||
all = output is sum of atoms across all *Nrepeat* samples, divided by atom count
|
||||
sample = output is sum of *Nrepeat* sample averages, divided by *Nrepeat*
|
||||
none = output is sum of *Nrepeat* sample sums, divided by *Nrepeat*
|
||||
*ave* args = *one* or *running* or *window M*
|
||||
one = output new average value every Nfreq steps
|
||||
running = output cumulative average of all previous Nfreq steps
|
||||
window M = output average of M most recent Nfreq steps
|
||||
*bias* arg = bias-ID
|
||||
bias-ID = ID of a temperature compute that removes a velocity bias for temperature calculation
|
||||
*adof* value = dof_per_atom
|
||||
dof_per_atom = define this many degrees-of-freedom per atom for temperature calculation
|
||||
*cdof* value = dof_per_grid_cell
|
||||
dof_per_grid_cell = add this many degrees-of-freedom per grid_cell for temperature calculation
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 1 all ave/grid 10000 1 10000 10 10 10 fx fy fz c_myMSD[*]
|
||||
fix 1 flow ave/grid 100 10 1000 20 20 30 f_TTM:grid:data
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Overlay the 2d or 3d simulation box with a uniformly spaced 2d or 3d
|
||||
grid and use it to either (a) time-average per-atom quantities for the
|
||||
atoms in each grid cell, or to (b) time-average per-grid quantities
|
||||
produced by other computes or fixes. This fix operates in either
|
||||
"per-atom mode" (all input values are per-atom) or in "per-grid mode"
|
||||
(all input values are per-grid). You cannot use both per-atom and
|
||||
per-grid inputs in the same command.
|
||||
|
||||
The grid created by this command is distributed; each processor owns
|
||||
the grid points that are within its sub-domain. This is similar to
|
||||
the :doc:`fix ave/chunk <fix_ave_chunk>` command when it uses chunks
|
||||
from the :doc:`compute chunk/atom <compute_chunk_atom>` command which
|
||||
are 2d or 3d regular bins. However, the per-bin outputs in that case
|
||||
are global; each processor stores a copy of the entire set of bin
|
||||
data. Thus it more efficient to use the fix ave/grid command when the
|
||||
grid is large and a simulation is run on many processors.
|
||||
|
||||
For per-atom mode, only atoms in the specified group contribute to the
|
||||
summing and averaging calculations. For per-grid mode, the specified
|
||||
group is ignored.
|
||||
|
||||
----------
|
||||
|
||||
The *Nevery*, *Nrepeat*, and *Nfreq* arguments specify on what
|
||||
timesteps the input values will be accessed and contribute to the
|
||||
average. The final averaged quantities are generated on timesteps
|
||||
that are a multiples of *Nfreq*\ . The average is over *Nrepeat*
|
||||
quantities, computed in the preceding portion of the simulation every
|
||||
*Nevery* timesteps. *Nfreq* must be a multiple of *Nevery* and
|
||||
*Nevery* must be non-zero even if *Nrepeat* is 1. Also, the timesteps
|
||||
contributing to the average value cannot overlap, i.e. Nrepeat\*Nevery
|
||||
can not exceed Nfreq.
|
||||
|
||||
For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
|
||||
timesteps 90,92,94,96,98,100 will be used to compute the final average
|
||||
on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
|
||||
timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
|
||||
averaging is done; values are simply generated on timesteps
|
||||
100,200,etc.
|
||||
|
||||
In per-atom mode, each input value can also be averaged over the atoms
|
||||
in each grid cell. The way the averaging is done across the *Nrepeat*
|
||||
timesteps to produce output on the *Nfreq* timesteps, and across
|
||||
multiple *Nfreq* outputs, is determined by the *norm* and *ave*
|
||||
keyword settings, as discussed below.
|
||||
|
||||
----------
|
||||
|
||||
The *Nx*, *Ny*, and *Nz* arguments specify the size of the grid that
|
||||
overlays the simulation box. For 2d simulations, *Nz* must be 1. The
|
||||
*Nx*, *Ny*, *Nz* values can be any positive integer. The grid can be
|
||||
very coarse compared to the particle count, or very fine. If one or
|
||||
more of the values = 1, then bins are 2d planes or 1d slices of the
|
||||
simulation domain. Note that if the total number of grid cells is
|
||||
small, it may be more efficient to use the doc:`fix ave/chunk
|
||||
<fix_ave_chunk>` command which can treat a grid defined by the
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command as a global
|
||||
grid where each processor owns a copy of all the grid cells. If *Nx*
|
||||
= *Ny* = *Nz* = 1 is used, the same calculation would be more
|
||||
efficiently performed by the doc:`fix ave/atom <fix_ave_atom>`
|
||||
command.
|
||||
|
||||
If the simulation box size or shape changes during a simulation, the
|
||||
grid always conforms to the size/shape of the current simulation box.
|
||||
If one more dimensions have non-periodic shrink-wrapped boundary
|
||||
conditions, as defined by the :doc:`boundary <boundary>` command, then
|
||||
the grid will extend over the (dynamic) shrink-wrapped extent in each
|
||||
dimension. If the box shape is triclinic, as explained in :doc:`Howto
|
||||
triclinic <Howto_triclinic>`, then the grid is also triclinic; each
|
||||
grid cell is a small triclinic cell with the same shape as the
|
||||
simulation box.
|
||||
|
||||
----------
|
||||
|
||||
In both per-atom and per-grid mode, input values from a compute or fix
|
||||
that produces an array of values (multiple values per atom or per grid
|
||||
point), the bracketed index I can be specified using a wildcard
|
||||
asterisk with the index to effectively specify multiple values. This
|
||||
takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of
|
||||
columns in the array (for *mode* = vector), then an asterisk with no
|
||||
numeric values means all indices from 1 to N. A leading asterisk
|
||||
means all indices from 1 to n (inclusive). A trailing asterisk means
|
||||
all indices from n to N (inclusive). A middle asterisk means all
|
||||
indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual columns of the array
|
||||
had been listed one by one. E.g. if there were a compute fft/grid
|
||||
command which produced 3 values for each grid point, these two fix
|
||||
ave/grid commands would be equivalent:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute myFFT all fft/grid 10 10 10 ...
|
||||
fix 1 all ave/grid 100 1 100 10 10 10 c_myFFT:grid:data[*]
|
||||
fix 2 all ave/grid 100 1 100 10 10 10 c_myFFT:grid:data[*][1] c_myFFT:grid:data[*][2] c_myFFT:grid:data[3]
|
||||
|
||||
----------
|
||||
|
||||
*Per-atom mode*:
|
||||
|
||||
Each specified per-atom value can be an atom attribute (velocity,
|
||||
force component), a number or mass density, a mass or temperature, or
|
||||
the result of a :doc:`compute <compute>` or :doc:`fix <fix>` or the
|
||||
evaluation of an atom-style :doc:`variable <variable>`. In the latter
|
||||
cases, the compute, fix, or variable must produce a per-atom quantity,
|
||||
not a global quantity. Note that the :doc:`compute property/atom
|
||||
<compute_property_atom>` command provides access to any attribute
|
||||
defined and stored by atoms.
|
||||
|
||||
The per-atom values of each input vector are summed and averaged
|
||||
independently of the per-atom values in other input vectors.
|
||||
|
||||
:doc:`Computes <compute>` that produce per-atom quantities are those
|
||||
which have the word *atom* in their style name. See the doc pages for
|
||||
individual :doc:`fixes <fix>` to determine which ones produce per-atom
|
||||
quantities. :doc:`Variables <variable>` of style *atom* are the only
|
||||
ones that can be used with this fix since all other styles of variable
|
||||
produce global quantities.
|
||||
|
||||
----------
|
||||
|
||||
The atom attribute values (vx,vy,vz,fx,fy,fz,mass) are
|
||||
self-explanatory. As noted above, any other atom attributes can be
|
||||
used as input values to this fix by using the :doc:`compute
|
||||
property/atom <compute_property_atom>` command and then specifying an
|
||||
input value from that compute.
|
||||
|
||||
The *density/number* value means the number density is computed for
|
||||
each grid cell, i.e. number/volume. The *density/mass* value means
|
||||
the mass density is computed for each grid/cell,
|
||||
i.e. total-mass/volume. The output values are in units of 1/volume or
|
||||
density (mass/volume). See the :doc:`units <units>` command page for
|
||||
the definition of density for each choice of units, e.g. gram/cm\^3.
|
||||
|
||||
The *temp* value computes the temperature for each grid cell, by the
|
||||
formula
|
||||
|
||||
.. math::
|
||||
|
||||
\text{KE} = \frac{\text{DOF}}{2} k_B T,
|
||||
|
||||
where KE = total kinetic energy of the atoms in the grid cell (
|
||||
:math:`\frac{1}{2} m v^2`), DOF = the total number of degrees of
|
||||
freedom for all atoms in the grid cell, :math:`k_B` = Boltzmann
|
||||
constant, and :math:`T` = temperature.
|
||||
|
||||
The DOF is calculated as N\*adof + cdof, where N = number of atoms in
|
||||
the grid cell, adof = degrees of freedom per atom, and cdof = degrees
|
||||
of freedom per grid cell. By default adof = 2 or 3 = dimensionality
|
||||
of system, as set via the :doc:`dimension <dimension>` command, and
|
||||
cdof = 0.0. This gives the usual formula for temperature.
|
||||
|
||||
Note that currently this temperature only includes translational
|
||||
degrees of freedom for each atom. No rotational degrees of freedom
|
||||
are included for finite-size particles. Also no degrees of freedom
|
||||
are subtracted for any velocity bias or constraints that are applied,
|
||||
such as :doc:`compute temp/partial <compute_temp_partial>`, or
|
||||
:doc:`fix shake <fix_shake>` or :doc:`fix rigid <fix_rigid>`. This is
|
||||
because those degrees of freedom (e.g. a constrained bond) could apply
|
||||
to sets of atoms that are both inside and outside a specific grid
|
||||
cell, and hence the concept is somewhat ill-defined. In some cases,
|
||||
you can use the *adof* and *cdof* keywords to adjust the calculated
|
||||
degrees of freedom appropriately, as explained below.
|
||||
|
||||
Also note that a bias can be subtracted from atom velocities before
|
||||
they are used in the above formula for KE, by using the *bias*
|
||||
keyword. This allows, for example, a thermal temperature to be
|
||||
computed after removal of a flow velocity profile.
|
||||
|
||||
Note that the per-grid-cell temperature calculated by this fix and the
|
||||
:doc:`compute temp/chunk <compute_temp_chunk>` command (using bins)
|
||||
can be different. The compute calculates the temperature for each
|
||||
chunk for a single snapshot. This fix can do that but can also time
|
||||
average those values over many snapshots, or it can compute a
|
||||
temperature as if the atoms in the grid cell on different timesteps
|
||||
were collected together as one set of atoms to calculate their
|
||||
temperature. The compute allows the center-of-mass velocity of each
|
||||
chunk to be subtracted before calculating the temperature; this fix
|
||||
does not.
|
||||
|
||||
If a value begins with "c\_", a compute ID must follow which has been
|
||||
previously defined in the input script. If no bracketed integer is
|
||||
appended, the per-atom vector calculated by the compute is used. If a
|
||||
bracketed integer is appended, the Ith column of the per-atom array
|
||||
calculated by the compute is used. Users can also write code for
|
||||
their own compute styles and :doc:`add them to LAMMPS <Modify>`. See
|
||||
the discussion above for how I can be specified with a wildcard
|
||||
asterisk to effectively specify multiple values.
|
||||
|
||||
If a value begins with "f\_", a fix ID must follow which has been
|
||||
previously defined in the input script. If no bracketed integer is
|
||||
appended, the per-atom vector calculated by the fix is used. If a
|
||||
bracketed integer is appended, the Ith column of the per-atom array
|
||||
calculated by the fix is used. Note that some fixes only produce
|
||||
their values on certain timesteps, which must be compatible with
|
||||
*Nevery*, else an error results. Users can also write code for their
|
||||
own fix styles and :doc:`add them to LAMMPS <Modify>`. See the
|
||||
discussion above for how I can be specified with a wildcard asterisk
|
||||
to effectively specify multiple values.
|
||||
|
||||
If a value begins with "v\_", a variable name must follow which has
|
||||
been previously defined in the input script. Variables of style
|
||||
*atom* can reference thermodynamic keywords and various per-atom
|
||||
attributes, or invoke other computes, fixes, or variables when they
|
||||
are evaluated, so this is a very general means of generating per-atom
|
||||
quantities to average within grid cells.
|
||||
|
||||
----------
|
||||
|
||||
*Per-grid mode*:
|
||||
|
||||
The attributes that begin with *c_ID* and *f_ID* both take
|
||||
colon-separated fields *gname* and *dname*. These refer to a grid
|
||||
name and data field name which is defined by the compute or fix. Note
|
||||
that a compute or fix can define one or more grids (of different
|
||||
sizes) and one or more data fields for each of those grids. The sizes
|
||||
of all grids used as values for one instance of this fix must be the
|
||||
same.
|
||||
|
||||
The *c_ID:gname:dname* and *c_ID:gname:dname[I]* attributes allow
|
||||
per-grid vectors or arrays calculated by a :doc:`compute <compute>` to
|
||||
be accessed. The ID in the attribute should be replaced by the actual
|
||||
ID of the compute that has been defined previously in the input
|
||||
script.
|
||||
|
||||
If *c_ID:gname:dname* is used as a attribute, then the per-grid vector
|
||||
calculated by the compute is accessed. If *c_ID:gname:dname[I]* is
|
||||
used, then I must be in the range from 1-M, which will access the Ith
|
||||
column of the per-grid array with M columns calculated by the compute.
|
||||
See the discussion above for how I can be specified with a wildcard
|
||||
asterisk to effectively specify multiple values.
|
||||
|
||||
The *f_ID:gname:dname* and *f_ID:gname:dname[I]* attributes allow
|
||||
per-grid vectors or arrays calculated by a :doc:`fix <fix>` to be
|
||||
output. The ID in the attribute should be replaced by the actual ID
|
||||
of the fix that has been defined previously in the input script.
|
||||
|
||||
If *f_ID:gname:dname* is used as a attribute, then the per-grid vector
|
||||
calculated by the fix is printed. If *f_ID:gname:dname[I]* is used,
|
||||
then I must be in the range from 1-M, which will print the Ith column
|
||||
of the per-grid with M columns calculated by the fix. See the
|
||||
discussion above for how I can be specified with a wildcard asterisk
|
||||
to effectively specify multiple values.
|
||||
|
||||
----------
|
||||
|
||||
Additional optional keywords also affect the operation of this fix and
|
||||
its outputs. Some are only applicable to per-atom mode. Some are
|
||||
applicable to both per-atom and per-grid mode.
|
||||
|
||||
The *discard* keyword is only applicable to per-atom mode. If a
|
||||
dimension of the system is non-periodic, then grid cells will only
|
||||
span the box dimension (fixed or shrink-wrap boundaries as set by the
|
||||
:doc:`boundary` command). An atom may thus be slightly outside the
|
||||
range of grid cells on a particular timestep. If *discard* is set to
|
||||
*yes* (the default), then the atom will be assigned to the closest
|
||||
grid cell (lowest or highest) in that dimension. If *discard* is set
|
||||
to *no* the atom will be ignored.
|
||||
|
||||
----------
|
||||
|
||||
The *norm* keyword is only applicable to per-atom mode. In per-grid
|
||||
mode, the *norm* keyword setting is ignored. The output grid value on
|
||||
an *Nfreq* timestep is the sum of the grid values in each of the
|
||||
*Nrepeat* samples, divided by *Nrepeat*.
|
||||
|
||||
In per-atom mode, the *norm" keywod affects how averaging is done for
|
||||
the per-grid values that are output on an *Nfreq* timestep. *Nrepeat*
|
||||
samples contribute to the output. The *norm* keyword has 3 possible
|
||||
settings: *all* or *sample* or *none*. *All* is the default.
|
||||
|
||||
In the formulas that follow, SumI is the sum of a per-atom property
|
||||
over the CountI atoms in a grid cell for a single sample I, where I
|
||||
varies from 1 to N, and N = Nrepeat. These formulas are used for any
|
||||
per-atom input value listed above, except *density/number*,
|
||||
*density/mass*, and *temp*. Those input values are discussed below.
|
||||
|
||||
In per-atom mode, for *norm all* the output grid value on the *Nfreq*
|
||||
timestep is an average over atoms across the entire *Nfreq* timescale:
|
||||
|
||||
Output = (Sum1 + Sum2 + ... + SumN) / (Count1 + Count2 + ... + CountN)
|
||||
|
||||
In per-atom mode, for *norm sample* the output grid value on the
|
||||
*Nfreq* timestep is an average of an average:
|
||||
|
||||
Output = (Sum1/Count1 + Sum2/Count2 + ... + SumN/CountN) / Nrepeat
|
||||
|
||||
In per-atom mode, for *norm none* the output grid value on the
|
||||
*Nfreq* timestep is not normalized by the atom counts:
|
||||
|
||||
Output = (Sum1 + Sum2 + ... SumN) / Nrepeat
|
||||
|
||||
For *density/number* and *density/mass*, the output value is the same
|
||||
as in the formulas above for *norm all* and *norm sample*, except that
|
||||
the result is also divided by the grid cell volume. For *norm all*,
|
||||
this will be the volume at the final *Nfreq* timestep. For *norm
|
||||
sample*, the divide-by-volume is done for each sample, using the grid
|
||||
cell volume at the sample timestep. For *norm none*, the output is
|
||||
the same as for *norm all*.
|
||||
|
||||
For *temp*, the output temperature uses the formula for kinetic energy
|
||||
KE listed above, and is normalized similarly to the formulas above for
|
||||
*norm all* and *norm sample*, except for the way the degrees of
|
||||
freedom (DOF) are calculated. For *norm none*, the output is the same
|
||||
as for *norm all*.
|
||||
|
||||
For *norm all*, the DOF = *Nrepeat* times *cdof* plus *Count* times
|
||||
*adof*, where *Count* = (Count1 + Count2 + ... + CountN). The *cdof*
|
||||
and *adof* keywords are discussed below. The output temperature is
|
||||
computed with all atoms across all samples contributing.
|
||||
|
||||
For *norm sample*, the DOF for a single sample = *cdof* plus *Count*
|
||||
times *adof*, where *Count* = CountI for a single sample. The output
|
||||
temperature is the average of *Nsample* temperatures calculated for
|
||||
each sample.
|
||||
|
||||
Finally, for all 3 *norm* settings the output count of atoms per grid
|
||||
cell is:
|
||||
|
||||
Output count = (Count1 + Count2 + ... CountN) / Nrepeat
|
||||
|
||||
This count is the same for all per-atom input values, including
|
||||
*density/number*, *density/mass*, and *temp*.
|
||||
|
||||
----------
|
||||
|
||||
The *ave* keyword is applied to both per-atom and per-grid mode. It
|
||||
determines how the per-grid values produced once every *Nfreq* steps
|
||||
are averaged with values produced on previous steps that were
|
||||
multiples of *Nfreq*, before they are accessed by another output
|
||||
command.
|
||||
|
||||
If the *ave* setting is *one*, which is the default, then the grid
|
||||
values produced on *Nfreq* timesteps are independent of each other;
|
||||
they are output as-is without further averaging.
|
||||
|
||||
If the *ave* setting is *running*, then the grid values produced on
|
||||
*Nfreq* timesteps are summed and averaged in a cumulative sense before
|
||||
being output. Each output grid value is thus the average of the grid
|
||||
value produced on that timestep with all preceding values for the same
|
||||
grid value. This running average begins when the fix is defined; it
|
||||
can only be restarted by deleting the fix via the :doc:`unfix <unfix>`
|
||||
command, or re-defining the fix by re-specifying it.
|
||||
|
||||
If the *ave* setting is *window*, then the grid values produced on
|
||||
*Nfreq* timesteps are summed and averaged within a moving "window" of
|
||||
time, so that the last M values for the same grid are used to produce
|
||||
the output. E.g. if M = 3 and Nfreq = 1000, then the grid value
|
||||
output on step 10000 will be the average of the grid values on steps
|
||||
8000,9000,10000. Outputs on early steps will average over less than M
|
||||
values if they are not available.
|
||||
|
||||
----------
|
||||
|
||||
The *bias*, *adof*, and *cdof* keywords are only applicable to
|
||||
per-atom mode.
|
||||
|
||||
The *bias* keyword specifies the ID of a temperature compute that
|
||||
removes a "bias" velocity from each atom, specified as *bias-ID*\ .
|
||||
It is only used when the *temp* value is calculated, to compute the
|
||||
thermal temperature of each grid cell after the translational kinetic
|
||||
energy components have been altered in a prescribed way, e.g. to
|
||||
remove a flow velocity profile. See the doc pages for individual
|
||||
computes that calculate a temperature to see which ones implement a
|
||||
bias.
|
||||
|
||||
The *adof* and *cdof* keywords define the values used in the degree of
|
||||
freedom (DOF) formula described above for temperature calculation for
|
||||
each grid cell. They are only used when the *temp* value is
|
||||
calculated. They can be used to calculate a more appropriate
|
||||
temperature in some cases. Here are 3 examples:
|
||||
|
||||
If grid cells contain some number of water molecules and :doc:`fix
|
||||
shake <fix_shake>` is used to make each molecule rigid, then you could
|
||||
calculate a temperature with 6 degrees of freedom (DOF) (3
|
||||
translational, 3 rotational) per molecule by setting *adof* to 2.0.
|
||||
|
||||
If :doc:`compute temp/partial <compute_temp_partial>` is used with the
|
||||
*bias* keyword to only allow the x component of velocity to contribute
|
||||
to the temperature, then *adof* = 1.0 would be appropriate.
|
||||
|
||||
Using *cdof* = -2 or -3 (for 2d or 3d simulations) will subtract out 2
|
||||
or 3 degrees of freedom for each grid cell, similar to how the
|
||||
:doc:`compute temp <compute_temp>` command subtracts out 3 DOF for the
|
||||
entire system.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
|
||||
relevant to this fix.
|
||||
|
||||
This fix calculates a per-grid array which has one column for each of
|
||||
the specified input values. The units for each column with be in the
|
||||
:doc:`units <units>` for the per-atom or per-grid quantity for the
|
||||
corresponding input value. If the fix is used in per-atom mode, it
|
||||
also calculates a per-grid vector with the count of atoms in each grid
|
||||
cell. The number of rows in the per-grid array and number of values
|
||||
in the per-grid vector (distributed across all processors) is Nx *
|
||||
Ny * Nz.
|
||||
|
||||
For access by other commands, the name of the single grid produced by
|
||||
this fix is "grid". The names of its two per-grid datums are "data"
|
||||
for the per-grid array and "count" for the per-grid vector (if using
|
||||
per-atom values). Both datums can be accessed by various :doc:`output
|
||||
commands <Howto_output>`.
|
||||
|
||||
In per-atom mode, the per-grid array values calculated by this fix are
|
||||
treated as "intensive", since they are typically already normalized by
|
||||
the count of atoms in each grid cell.
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
none
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix ave/atom <fix_ave_atom>`, :doc:`fix ave/chunk <fix_ave_chunk>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The option defaults are discard = yes, norm = all, ave = one, and bias
|
||||
= none.
|
||||
9
doc/src/fix_ave_spatial.rst
Normal file
9
doc/src/fix_ave_spatial.rst
Normal file
@ -0,0 +1,9 @@
|
||||
Fix ave/spatial command
|
||||
=======================
|
||||
|
||||
.. meta::
|
||||
:http-equiv=Refresh: 5; url='https://docs.lammps.org/Commands_removed.html#fix-ave-spatial-and-fix-ave-spatial-sphere'
|
||||
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The `fix ave/spatial` command has been superseded by :doc:`fix ave/chunk <fix_ave_chunk>`.
|
||||
9
doc/src/fix_ave_spatial_sphere.rst
Normal file
9
doc/src/fix_ave_spatial_sphere.rst
Normal file
@ -0,0 +1,9 @@
|
||||
Fix ave/spatial command
|
||||
=======================
|
||||
|
||||
.. meta::
|
||||
:http-equiv=Refresh: 5; url='https://docs.lammps.org/Commands_removed.html#fix-ave-spatial-and-fix-ave-spatial-sphere'
|
||||
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The `fix ave/spatial/sphere` command has been superseded by :doc:`fix ave/chunk <fix_ave_chunk>`.
|
||||
@ -177,12 +177,12 @@ due to the internal dynamic grouping performed by fix bond/react.
|
||||
If the group-ID is an existing static group, react-group-IDs
|
||||
should also be specified as this static group or a subset.
|
||||
|
||||
The *reset_mol_ids* keyword invokes the :doc:`reset_mol_ids <reset_mol_ids>`
|
||||
command after a reaction occurs, to ensure that molecule IDs are
|
||||
consistent with the new bond topology. The group-ID used for
|
||||
:doc:`reset_mol_ids <reset_mol_ids>` is the group-ID for this fix.
|
||||
Resetting molecule IDs is necessarily a global operation, so it can
|
||||
be slow for very large systems.
|
||||
The *reset_mol_ids* keyword invokes the :doc:`reset_atoms mol
|
||||
<reset_atoms>` command after a reaction occurs, to ensure that
|
||||
molecule IDs are consistent with the new bond topology. The group-ID
|
||||
used for :doc:`reset_atoms mol <reset_atoms>` is the group-ID for this
|
||||
fix. Resetting molecule IDs is necessarily a global operation, so it
|
||||
can be slow for very large systems.
|
||||
|
||||
The following comments pertain to each *react* argument (in other
|
||||
words, they can be customized for each reaction, or reaction step):
|
||||
@ -520,7 +520,7 @@ example, the molecule fragment could consist of only the backbone
|
||||
atoms of a polymer chain. This constraint can be used to enforce a
|
||||
specific relative position and orientation between reacting molecules.
|
||||
|
||||
.. versionchanged:: TBD
|
||||
.. versionchanged:: 22Dec2022
|
||||
|
||||
The constraint of type "custom" has the following syntax:
|
||||
|
||||
@ -637,10 +637,10 @@ eligible reaction only occurs if the random number is less than the
|
||||
fraction. Up to :math:`N` reactions are permitted to occur, as optionally
|
||||
specified by the *max_rxn* keyword.
|
||||
|
||||
.. versionadded:: TBD
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
The *rate_limit* keyword can enforce an upper limit on the overall
|
||||
rate of the reaction. The number of reaction occurences is limited to
|
||||
rate of the reaction. The number of reaction occurrences is limited to
|
||||
Nlimit within an interval of Nsteps timesteps. No reactions are
|
||||
permitted to occur within the first Nsteps timesteps of the first run
|
||||
after reading a data file. Nlimit can be specified with an equal-style
|
||||
@ -664,7 +664,7 @@ charges are updated to those specified by the post-reaction template
|
||||
fragment defined in the pre-reaction molecule template. In this case,
|
||||
only the atomic charges of atoms in the molecule fragment are updated.
|
||||
|
||||
.. versionadded:: TBD
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
The *rescale_charges* keyword can be used to ensure the total charge
|
||||
of the system does not change as reactions occur. When the argument is
|
||||
|
||||
@ -94,12 +94,9 @@ insert (delete) a proton (atom type 2). Besides, the fix implements
|
||||
self-ionization reaction of water :math:`\emptyset \rightleftharpoons
|
||||
\mathrm{H}^++\mathrm{OH}^-`.
|
||||
|
||||
|
||||
|
||||
However, this approach is highly
|
||||
inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of
|
||||
both protons and hydroxyl ions is low, resulting in a relatively low
|
||||
acceptance rate of MC moves.
|
||||
However, this approach is highly inefficient at :math:`\mathrm{pH}
|
||||
\approx 7` when the concentration of both protons and hydroxyl ions is
|
||||
low, resulting in a relatively low acceptance rate of MC moves.
|
||||
|
||||
A more efficient way is to allow salt ions to participate in ionization
|
||||
reactions, which can be easily achieved via
|
||||
@ -108,10 +105,13 @@ reactions, which can be easily achieved via
|
||||
|
||||
fix acid_reaction2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0
|
||||
|
||||
where particles of atom type 4 and 5 are the salt cations and anions, both at activity (effective concentration) of :math:`10^{-2}` mol/l, see :ref:`(Curk1) <Curk1>` and
|
||||
:ref:`(Landsgesell) <Landsgesell>` for more details.
|
||||
where particles of atom type 4 and 5 are the salt cations and anions,
|
||||
both at activity (effective concentration) of :math:`10^{-2}` mol/l, see
|
||||
:ref:`(Curk1) <Curk1>` and :ref:`(Landsgesell) <Landsgesell>` for more
|
||||
details.
|
||||
|
||||
We could have simultaneously added a base ionization reaction (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`)
|
||||
We could have simultaneously added a base ionization reaction
|
||||
(:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`)
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -122,7 +122,18 @@ where the fix will attempt to charge :math:`\mathrm{B}` (discharge
|
||||
insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3.
|
||||
|
||||
|
||||
Dissociated ions and salt ions can be combined into a single particle type, which reduces the number of necessary MC moves and increases sampling performance, see :ref:`(Curk1) <Curk1>`. The :math:`\mathrm{H}^+` and monovalent salt cation (:math:`\mathrm{S}^+`) are combined into a single particle type, :math:`\mathrm{X}^+ = \{\mathrm{H}^+, \mathrm{S}^+\}`. In this case "pIp" refers to the effective concentration of the combined cation type :math:`\mathrm{X}^+` and its value is determined by :math:`10^{-\mathrm{pIp}} = 10^{-\mathrm{pH}} + 10^{-\mathrm{pSp}}`, where :math:`10^{-\mathrm{pSp}}` is the effective concentration of salt cations. For example, at pH=7 and pSp=6 we would find pIp~5.958 and the command that performs reactions with combined ions could read,
|
||||
Dissociated ions and salt ions can be combined into a single particle
|
||||
type, which reduces the number of necessary MC moves and increases
|
||||
sampling performance, see :ref:`(Curk1) <Curk1>`. The
|
||||
:math:`\mathrm{H}^+` and monovalent salt cation (:math:`\mathrm{S}^+`)
|
||||
are combined into a single particle type, :math:`\mathrm{X}^+ =
|
||||
\{\mathrm{H}^+, \mathrm{S}^+\}`. In this case "pIp" refers to the
|
||||
effective concentration of the combined cation type :math:`\mathrm{X}^+`
|
||||
and its value is determined by :math:`10^{-\mathrm{pIp}} =
|
||||
10^{-\mathrm{pH}} + 10^{-\mathrm{pSp}}`, where
|
||||
:math:`10^{-\mathrm{pSp}}` is the effective concentration of salt
|
||||
cations. For example, at pH=7 and pSp=6 we would find pIp~5.958 and the
|
||||
command that performs reactions with combined ions could read,
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -138,16 +149,16 @@ If neither the acid or the base type is specified, for example,
|
||||
|
||||
the fix simply inserts or deletes an ion pair of a free cation (atom
|
||||
type 4) and a free anion (atom type 5) as done in a conventional
|
||||
grand-canonical MC simulation. Multivalent ions can be inserted (deleted) by using the *onlysalt* keyword.
|
||||
grand-canonical MC simulation. Multivalent ions can be inserted
|
||||
(deleted) by using the *onlysalt* keyword.
|
||||
|
||||
|
||||
The fix is compatible with LAMMPS sub-packages such as *molecule* or
|
||||
*rigid*. The acid and base particles can be part of larger
|
||||
molecules or rigid bodies. Free ions that are inserted to or deleted
|
||||
from the system must be defined as single particles (no bonded
|
||||
interactions allowed) and cannot be part of larger molecules or rigid
|
||||
bodies. If *molecule* package is used, all inserted ions have a molecule
|
||||
ID equal to zero.
|
||||
This fix is compatible with LAMMPS packages such as MOLECULE or
|
||||
RIGID. The acid and base particles can be part of larger molecules or
|
||||
rigid bodies. Free ions that are inserted to or deleted from the system
|
||||
must be defined as single particles (no bonded interactions allowed) and
|
||||
cannot be part of larger molecules or rigid bodies. If an atom style
|
||||
with molecule IDs is used, all inserted ions have a molecule ID equal to
|
||||
zero.
|
||||
|
||||
Note that LAMMPS implicitly assumes a constant number of particles
|
||||
(degrees of freedom). Since using this fix alters the total number of
|
||||
@ -164,14 +175,15 @@ Langevin thermostat:
|
||||
fix fT all langevin 1.0 1.0 1.0 123
|
||||
fix_modify fT temp dtemp
|
||||
|
||||
The units of pH, pKa, pKb, pIp, pIm are considered to be in the standard -log10
|
||||
representation assuming reference concentration :math:`\rho_0 =
|
||||
\mathrm{mol}/\mathrm{l}`. For example, in the dilute
|
||||
The units of pH, pKa, pKb, pIp, pIm are considered to be in the
|
||||
standard -log10 representation assuming reference concentration
|
||||
:math:`\rho_0 = \mathrm{mol}/\mathrm{l}`. For example, in the dilute
|
||||
ideal solution limit, the concentration of free cations will be
|
||||
:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. To perform the internal unit
|
||||
conversion, the the value of the LAMMPS unit length must be
|
||||
specified in nanometers via *lunit_nm*. The default value is set to the Bjerrum length in water
|
||||
at room temperature (0.71 nm), *lunit_nm* = 0.71.
|
||||
:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. To
|
||||
perform the internal unit conversion, the the value of the LAMMPS unit
|
||||
length must be specified in nanometers via *lunit_nm*. The default value
|
||||
is set to the Bjerrum length in water at room temperature (0.71 nm),
|
||||
*lunit_nm* = 0.71.
|
||||
|
||||
The temperature used in MC acceptance probability is set by *temp*. This
|
||||
temperature should be the same as the temperature set by the molecular
|
||||
@ -236,9 +248,9 @@ quantities:
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the MC package. It is only enabled if LAMMPS
|
||||
was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
This fix is part of the MC package. It is only enabled if LAMMPS was
|
||||
built with that package. See the :doc:`Build package <Build_package>`
|
||||
page for more info.
|
||||
|
||||
The :doc:`atom_style <atom_style>`, used must contain the charge
|
||||
property, for example, the style could be *charge* or *full*. Only
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
.. index:: fix dt/reset
|
||||
.. index:: fix dt/reset/kk
|
||||
|
||||
fix dt/reset command
|
||||
====================
|
||||
|
||||
Accelerator Variants: *dt/reset/kk*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
@ -86,6 +89,10 @@ allows dump files to be written at intervals specified by simulation
|
||||
time, rather than by timesteps. Simulation time is in time units;
|
||||
see the :doc:`units <units>` doc page for details.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
421
doc/src/fix_electrode.rst
Normal file
421
doc/src/fix_electrode.rst
Normal file
@ -0,0 +1,421 @@
|
||||
.. index:: fix electrode/conp
|
||||
.. index:: fix electrode/conq
|
||||
.. index:: fix electrode/thermo
|
||||
.. index:: fix electrode/conp/intel
|
||||
.. index:: fix electrode/conq/intel
|
||||
.. index:: fix electrode/thermo/intel
|
||||
|
||||
fix electrode/conp command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conp/intel*
|
||||
|
||||
fix electrode/conq command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conq/intel*
|
||||
|
||||
fix electrode/thermo command
|
||||
============================
|
||||
|
||||
Accelerator Variant: *electrode/thermo/intel*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID style args keyword value ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* style = *electrode/conp* or *electrode/conq* or *electrode/thermo*
|
||||
* args = arguments used by a particular style
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*electrode/conp* args = potential eta
|
||||
*electrode/conq* args = charge eta
|
||||
*electrode/thermo* args = potential eta *temp* values
|
||||
potential = electrode potential
|
||||
charge = electrode charge
|
||||
eta = reciprocal width of electrode charge smearing
|
||||
*temp* values = T_v tau_v rng_v
|
||||
T_v = temperature of thermo-potentiostat
|
||||
tau_v = time constant of thermo-potentiostat
|
||||
rng_v = integer used to initialize random number generator
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *algo* or *symm* or *couple* or *etypes* or *ffield* or *write_mat* or *write_inv* or *read_mat* or *read_inv*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*algo* values = *mat_inv* or *mat_cg* tol or *cg* tol
|
||||
specify the algorithm used to compute the electrode charges
|
||||
*symm* value = *on* or *off*
|
||||
turn on/off charge neutrality constraint for the electrodes
|
||||
*couple* values = group-ID val
|
||||
group-ID = group of atoms treated as additional electrode
|
||||
val = electric potential or charge on this electrode
|
||||
*etypes* value = *on* or *off*
|
||||
turn on/off type-based optimized neighbor lists (electrode and electrolyte types may not overlap)
|
||||
*ffield* value = *on* or *off*
|
||||
turn on/off finite-field implementation
|
||||
*write_mat* value = filename
|
||||
filename = file to which to write elastance matrix
|
||||
*write_inv* value = filename
|
||||
filename = file to which to write inverted matrix
|
||||
*read_mat* value = filename
|
||||
filename = file from which to read elastance matrix
|
||||
*read_inv* value = filename
|
||||
filename = file from which to read inverted matrix
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix fxconp bot electrode/conp -1.0 1.805 couple top 1.0 couple ref 0.0 write_inv inv.csv symm on
|
||||
fix fxconp electrodes electrode/conq 0.0 1.805 algo cg 1e-5
|
||||
fix fxconp bot electrode/thermo -1.0 1.805 temp 298 100 couple top 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *electrode* fixes implement the constant potential method (CPM)
|
||||
(:ref:`Siepmann <Siepmann>`, :ref:`Reed <Reed3>`), and modern variants,
|
||||
to accurately model electrified, conductive electrodes. This is
|
||||
primarily useful for studying electrode-electrolyte interfaces,
|
||||
especially at high potential differences or ionicities, with non-planar
|
||||
electrodes such as nanostructures or nanopores, and to study dynamic
|
||||
phenomena such as charging or discharging time scales or conductivity or
|
||||
ionic diffusivities.
|
||||
|
||||
Each *electrode* fix allows users to set additional electrostatic
|
||||
relationships between the specified groups which model useful
|
||||
electrostatic configurations:
|
||||
|
||||
* *electrode/conp* sets potentials or potential differences between electrodes
|
||||
|
||||
* (resulting in changing electrode total charges)
|
||||
|
||||
* *electrode/conq* sets the total charge on each electrode
|
||||
|
||||
* (resulting in changing electrode potentials)
|
||||
|
||||
* *electrode/thermo* sets a thermopotentiostat
|
||||
:ref:`(Deissenbeck)<Deissenbeck>` between two electrodes
|
||||
|
||||
* (resulting in changing charges and potentials with appropriate
|
||||
average potential difference and thermal variance)
|
||||
|
||||
The first group-ID provided to each fix specifies the first electrode
|
||||
group, and more group(s) are added using the *couple* keyword for each
|
||||
additional group. While *electrode/thermo* only accepts two groups,
|
||||
*electrode/conp* and *electrode/conq* accept any number of groups, up to
|
||||
LAMMPS's internal restrictions (see Restrictions below). Electrode
|
||||
groups must not overlap, i.e. the fix will issue an error if any
|
||||
particle is detected to belong to at least two electrode groups.
|
||||
|
||||
CPM involves updating charges on groups of electrode particles, per time
|
||||
step, so that the system's total energy is minimized with respect to
|
||||
those charges. From basic electrostatics, this is equivalent to making
|
||||
each group conductive, or imposing an equal electrostatic potential on
|
||||
every particle in the same group (hence the name CPM). The charges are
|
||||
usually modelled as a Gaussian distribution to make the charge-charge
|
||||
interaction matrix invertible (:ref:`Gingrich <Gingrich>`). The keyword
|
||||
*eta* specifies the distribution's width in units of inverse length.
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
Three algorithms are available to minimize the energy, varying in how
|
||||
matrices are pre-calculated before a run to provide computational
|
||||
speedup. These algorithms can be selected using the keyword *algo*:
|
||||
|
||||
* *algo mat_inv* pre-calculates the capacitance matrix and obtains the
|
||||
charge configuration in one matrix-vector calculation per time step
|
||||
|
||||
* *algo mat_cg* pre-calculates the elastance matrix (inverse of
|
||||
capacitance matrix) and obtains the charge configuration using a
|
||||
conjugate gradient solver in multiple matrix-vector calculations per
|
||||
time step
|
||||
|
||||
* *algo cg* does not perform any pre-calculation and obtains the charge
|
||||
configuration using a conjugate gradient solver and multiple
|
||||
calculations of the electric potential per time step.
|
||||
|
||||
For both *cg* methods, the command must specify the conjugate gradient
|
||||
tolerance. *fix electrode/thermo* currently only supports the *mat_inv*
|
||||
algorithm.
|
||||
|
||||
The keyword *symm* can be set *on* (or *off*) to turn on (or turn off)
|
||||
the capacitance matrix constraint that sets total electrode charge to be
|
||||
zero. This has slightly different effects for each *fix electrode*
|
||||
variant. For *fix electrode/conp*, with *symm off*, the potentials
|
||||
specified are absolute potentials, but the charge configurations
|
||||
satisfying them may add up to an overall non-zero, varying charge for
|
||||
the electrodes (and thus the simulation box). With *symm on*, the total
|
||||
charge over all electrode groups is constrained to zero, and potential
|
||||
differences rather than absolute potentials are the physically relevant
|
||||
quantities.
|
||||
|
||||
For *fix electrode/conq*, with *symm off*, overall neutrality is
|
||||
explicitly obeyed or violated by the user input (which is not
|
||||
checked!). With *symm on*, overall neutrality is ensured by ignoring the
|
||||
user-input charge for the last listed electrode (instead, its charge
|
||||
will always be minus the total sum of all other electrode charges). For
|
||||
*fix electrode/thermo*, overall neutrality is always automatically
|
||||
imposed for any setting of *symm*, but *symm on* allows finite-field
|
||||
mode (*ffield on*, described below) for faster simulations.
|
||||
|
||||
For all three fixes, any potential (or charge for *conq*) can be
|
||||
specified as an equal-style variable prefixed with "v\_". For example,
|
||||
the following code will ramp the potential difference between electrodes
|
||||
from 0.0V to 2.0V over the course of the simulation:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix fxconp bot electrode/conp 0.0 1.805 couple top v_v symm on
|
||||
variable v equal ramp(0.0, 2.0)
|
||||
|
||||
Note that these fixes only parse their supplied variable name when
|
||||
starting a run, and so these fixes will accept equal-style variables
|
||||
defined *after* the fix definition, including variables dependent on the
|
||||
fix's own output. This is useful, for example, in the fix's internal
|
||||
finite-field commands (see below). For an advanced example of this see
|
||||
the in.conq2 input file in the directory
|
||||
``examples/PACKAGES/electrode/graph-il``.
|
||||
|
||||
This fix necessitates the use of a long range solver that calculates and
|
||||
provides the matrix of electrode-electrode interactions and a vector of
|
||||
electrode-electrolyte interactions. The Kspace styles
|
||||
*ewald/electrode*, *pppm/electrode* and *pppm/electrode/intel* are
|
||||
created specifically for this task :ref:`(Ahrens-Iwers) <Ahrens-Iwers>`.
|
||||
|
||||
For systems with non-periodic boundaries in one or two directions dipole
|
||||
corrections are available with the :doc:`kspace_modify <kspace_modify>`.
|
||||
For ewald/electrode a two-dimensional Ewald summation :ref:`(Hu) <Hu>`
|
||||
can be used by setting "slab ew2d":
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify slab <slab_factor>
|
||||
kspace_modify wire <wire_factor>
|
||||
kspace_modify slab ew2d
|
||||
|
||||
Two implementations for the calculation of the elastance matrix are
|
||||
available with pppm and can be selected using the *amat onestep/twostep*
|
||||
keyword. *onestep* is the default; *twostep* can be faster for large
|
||||
electrodes and a moderate mesh size but requires more memory.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify amat onestep/twostep
|
||||
|
||||
For all versions of the fix, the keyword-value *ffield on* enables the
|
||||
finite-field mode (:ref:`Dufils <Dufils>`, :ref:`Tee <Tee>`), which uses
|
||||
an electric field across a periodic cell instead of non-periodic
|
||||
boundary conditions to impose a potential difference between the two
|
||||
electrodes bounding the cell. The fix (with name *fix-ID*) detects which
|
||||
of the two electrodes is "on top" (has the larger maximum *z*-coordinate
|
||||
among all particles). Assuming the first electrode group is on top, it
|
||||
then issues the following commands internally:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable fix-ID_ffield_zfield equal (f_fix-ID[2]-f_fix-ID[1])/lz
|
||||
efield fix-ID_efield all efield 0.0 0.0 v_fix-ID_ffield_zfield
|
||||
|
||||
which implements the required electric field as the potential difference
|
||||
divided by cell length. The internal commands use variable so that the
|
||||
electric field will correctly vary with changing potentials in the
|
||||
correct way (for example with equal-style potential difference or with
|
||||
*fix electrode/conq*). This keyword requires two electrodes and will
|
||||
issue an error with any other number of electrodes. This keyword
|
||||
requires electroneutrality to be imposed (*symm on*) and will issue an
|
||||
error otherwise.
|
||||
|
||||
.. versionchanged:: 22Dec2022
|
||||
|
||||
For all versions of the fix, the keyword-value *etypes on* enables
|
||||
type-based optimized neighbor lists. With this feature enabled, LAMMPS
|
||||
provides the fix with an occasional neighbor list restricted to
|
||||
electrode-electrode interactions for calculating the electrode matrix,
|
||||
and a perpetual neighbor list restricted to electrode-electrolyte
|
||||
interactions for calculating the electrode potentials, using particle
|
||||
types to list only desired interactions, and typically resulting in
|
||||
5--10\% less computational time. Without this feature the fix will
|
||||
simply use the active pair style's neighbor list. This feature cannot
|
||||
be enabled if any electrode particle has the same type as any
|
||||
electrolyte particle (which would be unusual in a typical simulation)
|
||||
and the fix will issue an error in that case.
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This fix currently does not write any information to restart files.
|
||||
|
||||
The *fix_modify tf* option enables the Thomas-Fermi metallicity model
|
||||
(:ref:`Scalfi <Scalfi>`) and allows parameters to be set for each atom type.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID tf type length voronoi
|
||||
|
||||
|
||||
If this option is used parameters must be set for all atom types of the
|
||||
electrode.
|
||||
|
||||
The *fix_modify timer* option turns on (off) additional timer outputs in the log
|
||||
file, for code developers to track optimization.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID timer on/off
|
||||
|
||||
----------
|
||||
|
||||
These fixes compute a global (extensive) scalar, a global (intensive)
|
||||
vector, and a global array, which can be accessed by various
|
||||
:doc:`output commands <Howto_output>`.
|
||||
|
||||
The global scalar outputs the energy added to the system by this fix,
|
||||
which is the negative of the total charge on each electrode multiplied
|
||||
by that electrode's potential.
|
||||
|
||||
The global vector outputs the potential on each electrode (and thus has
|
||||
*N* entries if the fix manages *N* electrode groups), in :doc:`units
|
||||
<units>` of electric field multiplied by distance (thus volts for *real*
|
||||
and *metal* units). The electrode groups' ordering follows the order in
|
||||
which they were input in the fix command using *couple*. The global
|
||||
vector output is useful for *fix electrode/conq* and *fix
|
||||
electrode/thermo*, where potential is dynamically updated based on
|
||||
electrolyte configuration instead of being directly set.
|
||||
|
||||
The global array has *N* rows and *2N+1* columns, where the fix manages
|
||||
*N* electrode groups managed by the fix. For the *I*-th row of the
|
||||
array, the elements are:
|
||||
|
||||
* array[I][1] = total charge that group *I* would have had *if it were
|
||||
at 0 V applied potential* * array[I][2 to *N* + 1] = the *N* entries
|
||||
of the *I*-th row of the electrode capacitance matrix (definition
|
||||
follows) * array[I][*N* + 2 to *2N* + 1] = the *N* entries of the
|
||||
*I*-th row of the electrode elastance matrix (the inverse of the
|
||||
electrode capacitance matrix)
|
||||
|
||||
The :math:`N \times N` electrode capacitance matrix, denoted :math:`\mathbf{C}`
|
||||
in the following equation, summarizes how the total charge induced on each
|
||||
electrode (:math:`\mathbf{Q}` as an *N*-vector) is related to the potential on
|
||||
each electrode, :math:`\mathbf{V}`, and the charge-at-0V :math:`\mathbf{Q}_{0V}`
|
||||
(which is influenced by the local electrolyte structure):
|
||||
|
||||
.. math::
|
||||
|
||||
\mathbf{Q} = \mathbf{Q}_{0V} + \mathbf{C} \cdot \mathbf{V}
|
||||
|
||||
The charge-at-0V, electrode capacitance and elastance matrices are internally
|
||||
used to calculate the potentials required to induce the specified total
|
||||
electrode charges in *fix electrode/conq* and *fix electrode/thermo*. With the
|
||||
*symm on* option, the electrode capacitance matrix would be singular, and thus
|
||||
its last row is replaced with *N* copies of its top-left entry
|
||||
(:math:`\mathbf{C}_{11}`) for invertibility.
|
||||
|
||||
The global array output is mainly useful for quickly determining the 'vacuum
|
||||
capacitance' of the system (capacitance with only electrodes, no electrolyte),
|
||||
and can also be used for advanced simulations setting the potential as some
|
||||
function of the charge-at-0V (such as the ``in.conq2`` example mentioned above).
|
||||
|
||||
Please cite :ref:`(Ahrens-Iwers2022) <Ahrens-Iwers2>` in any publication that
|
||||
uses this implementation. Please cite also the publication on the combination
|
||||
of the CPM with PPPM if you use *pppm/electrode* :ref:`(Ahrens-Iwers)
|
||||
<Ahrens-Iwers>`.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
For algorithms that use a matrix for the electrode-electrode
|
||||
interactions, positions of electrode particles have to be immobilized at
|
||||
all times.
|
||||
|
||||
With *ffield off* (i.e. the default), the box geometry is expected to be
|
||||
*z*-non-periodic (i.e. *boundary p p f*), and this fix will issue an
|
||||
error if the box is *z*-periodic. With *ffield on*, the box geometry is
|
||||
expected to be *z*-periodic, and this fix will issue an error if the box
|
||||
is *z*-non-periodic.
|
||||
|
||||
The parallelization for the fix works best if electrode atoms are evenly
|
||||
distributed across processors. For a system with two electrodes at the bottom
|
||||
and top of the cell this can be achieved with *processors * * 2*, or with the
|
||||
line
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
if "$(extract_setting(world_size) % 2) == 0" then "processors * * 2"
|
||||
|
||||
which avoids an error if the script is run on an odd number of
|
||||
processors (such as on just one processor for testing).
|
||||
|
||||
The fix creates an additional group named *[fix-ID]_group* which is the
|
||||
union of all electrode groups supplied to LAMMPS. This additional group
|
||||
counts towards LAMMPS's limitation on the total number of groups
|
||||
(currently 32), which may not allow scripts that use that many groups to
|
||||
run with this fix.
|
||||
|
||||
The matrix-based algorithms (*algo mat_inv* and *algo mat_cg*) currently
|
||||
store an interaction matrix (either elastance or capacitance) of *N* by
|
||||
*N* doubles for each MPI process. This memory requirement may be
|
||||
prohibitive for large electrode groups. The fix will issue a warning if
|
||||
it expects to use more than 0.5 GiB of memory.
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The default keyword-option settings are *algo mat_inv*, *symm off*,
|
||||
*etypes off* and *ffield off*.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
----------
|
||||
|
||||
.. _Siepmann:
|
||||
|
||||
**(Siepmann)** Siepmann and Sprik, J. Chem. Phys. 102, 511 (1995).
|
||||
|
||||
.. _Reed3:
|
||||
|
||||
**(Reed)** Reed *et al.*, J. Chem. Phys. 126, 084704 (2007).
|
||||
|
||||
.. _Deissenbeck:
|
||||
|
||||
**(Deissenbeck)** Deissenbeck *et al.*, Phys. Rev. Letters 126, 136803 (2021).
|
||||
|
||||
.. _Gingrich:
|
||||
|
||||
**(Gingrich)** Gingrich, `MSc thesis` <https://gingrich.chem.northwestern.edu/papers/ThesiswCorrections.pdf>` (2010).
|
||||
|
||||
.. _Ahrens-Iwers:
|
||||
|
||||
**(Ahrens-Iwers)** Ahrens-Iwers and Meissner, J. Chem. Phys. 155, 104104 (2021).
|
||||
|
||||
.. _Hu:
|
||||
|
||||
**(Hu)** Hu, J. Chem. Theory Comput. 10, 5254 (2014).
|
||||
|
||||
.. _Dufils:
|
||||
|
||||
**(Dufils)** Dufils *et al.*, Phys. Rev. Letters 123, 195501 (2019).
|
||||
|
||||
.. _Tee:
|
||||
|
||||
**(Tee)** Tee and Searles, J. Chem. Phys. 156, 184101 (2022).
|
||||
|
||||
.. _Scalfi:
|
||||
|
||||
**(Scalfi)** Scalfi *et al.*, J. Chem. Phys., 153, 174704 (2020).
|
||||
|
||||
.. _Ahrens-Iwers2:
|
||||
|
||||
**(Ahrens-Iwers2022)** Ahrens-Iwers *et al.*, J. Chem. Phys. 157, 084801 (2022).
|
||||
@ -1,230 +0,0 @@
|
||||
.. index:: fix electrode/conp
|
||||
.. index:: fix electrode/conq
|
||||
.. index:: fix electrode/thermo
|
||||
.. index:: fix electrode/conp/intel
|
||||
.. index:: fix electrode/conq/intel
|
||||
.. index:: fix electrode/thermo/intel
|
||||
|
||||
fix electrode/conp command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conp/intel*
|
||||
|
||||
fix electrode/conq command
|
||||
==========================
|
||||
|
||||
Accelerator Variant: *electrode/conq/intel*
|
||||
|
||||
fix electrode/thermo command
|
||||
============================
|
||||
|
||||
Accelerator Variant: *electrode/thermo/intel*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID style args keyword value ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* style = *electrode/conp* or *electrode/conq* or *electrode/thermo*
|
||||
* args = arguments used by a particular style
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*electrode/conp* args = potential eta
|
||||
*electrode/conq* args = charge eta
|
||||
*electrode/thermo* args = potential eta *temp* values
|
||||
potential = electrode potential
|
||||
charge = electrode charge
|
||||
eta = reciprocal width of electrode charge smearing
|
||||
*temp* values = T_v tau_v rng_v
|
||||
T_v = temperature of thermo-potentiostat
|
||||
tau_v = time constant of thermo-potentiostat
|
||||
rng_v = integer used to initialize random number generator
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *symm* or *couple* or *etypes* or *ffield* or *write_mat* or *write_inv* or *read_mat* or *read_inv*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*symm* value = *on* or *off*
|
||||
turn on/off charge neutrality constraint for the electrodes
|
||||
*couple* values = group-ID val
|
||||
group-ID = group of atoms treated as additional electrode
|
||||
val = electric potential or charge on this electrode
|
||||
*etypes* values = type
|
||||
type = atom type (can be a range) exclusive to the electrode for optimized neighbor lists
|
||||
*ffield* value = *on* or *off*
|
||||
turn on/off finite-field implementation
|
||||
*write_mat* value = filename
|
||||
filename = file to which to write elastance matrix
|
||||
*write_inv* value = filename
|
||||
filename = file to which to write inverted matrix
|
||||
*read_mat* value = filename
|
||||
filename = file from which to read elastance matrix
|
||||
*read_inv* value = filename
|
||||
filename = file from which to read inverted matrix
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix fxconp bot electrode/conp -1.0 1.805 couple top 1.0 couple ref 0.0 write_inv inv.csv symm on
|
||||
fix fxconp electrodes electrode/conq 0.0 1.805
|
||||
fix fxconp bot electrode/thermo -1.0 1.805 temp 298 100 couple top 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
fix electrode/conp mode implements a constant potential method (CPM)
|
||||
(:ref:`Siepmann <Siepmann>`, :ref:`Reed <Reed3>`). Charges of groups specified
|
||||
via group-ID and optionally with the `couple` keyword are adapted to meet their respective
|
||||
potential at every time step. An arbitrary number of electrodes can be set but
|
||||
the respective groups may not overlap. Electrode charges have a Gaussian charge
|
||||
distribution with reciprocal width eta. The energy minimization is achieved via
|
||||
matrix inversion :ref:`(Wang) <Wang5>`.
|
||||
|
||||
fix electrode/conq enforces a total charge specified in the input on each electrode. The energy is
|
||||
minimized w.r.t. the charge distribution within the electrode.
|
||||
|
||||
fix electrode/thermo implements a thermo-potentiostat :ref:`(Deissenbeck)
|
||||
<Deissenbeck>`. Temperature and time constant of the thermo-potentiostat need
|
||||
to be specified using the temp keyword. Currently, only two electrodes are possible with
|
||||
this style.
|
||||
|
||||
This fix necessitates the use of a long range solver that calculates and provides the matrix
|
||||
of electrode-electrode interactions and a vector of electrode-electrolyte
|
||||
interactions. The Kspace styles *ewald/electrode*, *pppm/electrode* and
|
||||
*pppm/electrode/intel* are created specifically for this task
|
||||
:ref:`(Ahrens-Iwers) <Ahrens-Iwers>`.
|
||||
|
||||
For systems with non-periodic boundaries in one or two directions dipole
|
||||
corrections are available with the :doc:`kspace_modify <kspace_modify>`. For
|
||||
ewald/electrode a two-dimensional Ewald summation :ref:`(Hu) <Hu>` can be used
|
||||
by setting "slab ew2d":
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify slab <slab_factor>
|
||||
kspace_modify wire <wire_factor>
|
||||
kspace_modify slab ew2d
|
||||
|
||||
Two implementations for the calculation of the elastance matrix are available
|
||||
with pppm and can be selected using the *amat onestep/twostep* keyword.
|
||||
*onestep* is the default; *twostep* can be faster for large electrodes and a
|
||||
moderate mesh size but requires more memory.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
kspace_modify amat onestep/twostep
|
||||
|
||||
|
||||
The *fix_modify tf* option enables the Thomas-Fermi metallicity model
|
||||
(:ref:`Scalfi <Scalfi>`) and allows parameters to be set for each atom type.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID tf type length voronoi
|
||||
|
||||
|
||||
If this option is used parameters must be set for all atom types of the electrode.
|
||||
|
||||
The *fix_modify timer* option turns on (off) additional timer outputs in the log
|
||||
file, for code developers to track optimization.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify ID timer on/off
|
||||
|
||||
The *fix_modify set* options allow calculated quantities to be accessed via
|
||||
internal variables. Currently four types of quantities can be accessed:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix-modify ID set v group-ID variablename
|
||||
fix-modify ID set qsb group-ID variablename
|
||||
fix-modify ID set mc group-ID1 group-ID2 variablename
|
||||
fix-modify ID set me group-ID1 group-ID2 variablename
|
||||
|
||||
One use case is to output the potential that is internally calculated and
|
||||
applied to each electrode group by *fix electrode/conq* or *fix electrode/thermo*.
|
||||
For that case the *v* option makes *fix electrode* update the variable
|
||||
*variablename* with the potential applied to group *group-ID*, where *group-ID*
|
||||
must be a group whose charges are updated by *fix electrode* and *variablename*
|
||||
must be an internal-style variable:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix conq bot electrode/conq -1.0 1.979 couple top 1.0
|
||||
variable vbot internal 0.0
|
||||
fix_modify conq set v bot vbot
|
||||
|
||||
The *qsb* option similarly outputs the total updated charge of the group if its
|
||||
potential were 0.0V. The *mc* option requires two *group-IDs*, and outputs the
|
||||
entry \{*group-ID1*, *group-ID2*\} of the (symmetric) *macro-capacitance* matrix
|
||||
(MC) which relates the electrodes' applied potentials (V), total charges (Q), and
|
||||
total charges at 0.0 V (Qsb):
|
||||
|
||||
.. math::
|
||||
|
||||
\mathbf{Q} = \mathbf{Q}_{SB} + \mathbf{MC} \cdot \mathbf{V}
|
||||
|
||||
Lastly, the *me* option also requires two *group-IDs* and outputs the entry
|
||||
\{*group-ID1*, *group-ID2*\} of the *macro-elastance* matrix, which is the
|
||||
inverse of the macro-capacitance matrix. (As the names denote, the
|
||||
macro-capacitance matrix gives electrode charges from potentials, and the
|
||||
macro-elastance matrix gives electrode potentials from charges).
|
||||
|
||||
.. warning::
|
||||
|
||||
Positions of electrode particles have to be immobilized at all times.
|
||||
|
||||
The parallelization for the fix works best if electrode atoms are evenly
|
||||
distributed across processors. For a system with two electrodes at the bottom
|
||||
and top of the cell this can be achieved with *processors * * 2*, or with the
|
||||
line
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
if "$(extract_setting(world_size) % 2) == 0" then "processors * * 2"
|
||||
|
||||
which avoids an error if the script is run on an odd number of processors (such
|
||||
as on just one processor for testing).
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
----------
|
||||
|
||||
.. _Siepmann:
|
||||
|
||||
**(Siepmann)** Siepmann and Sprik, J. Chem. Phys. 102, 511 (1995).
|
||||
|
||||
.. _Reed3:
|
||||
|
||||
**(Reed)** Reed *et al.*, J. Chem. Phys. 126, 084704 (2007).
|
||||
|
||||
.. _Wang5:
|
||||
|
||||
**(Wang)** Wang *et al.*, J. Chem. Phys. 141, 184102 (2014).
|
||||
|
||||
.. _Deissenbeck:
|
||||
|
||||
**(Deissenbeck)** Deissenbeck *et al.*, Phys. Rev. Letters 126, 136803 (2021).
|
||||
|
||||
.. _Ahrens-Iwers:
|
||||
|
||||
**(Ahrens-Iwers)** Ahrens-Iwers and Meissner, J. Chem. Phys. 155, 104104 (2021).
|
||||
|
||||
.. _Hu:
|
||||
|
||||
**(Hu)** Hu, J. Chem. Theory Comput. 10, 5254 (2014).
|
||||
|
||||
.. _Scalfi:
|
||||
|
||||
**(Scalfi)** Scalfi *et al.*, J. Chem. Phys., 153, 174704 (2020).
|
||||
|
||||
@ -90,6 +90,12 @@ coordinates are transferred. However, one could use this strategy to
|
||||
define an external potential acting on the atoms that are moved by
|
||||
i-PI.
|
||||
|
||||
Since the i-PI code uses atomic units internally, this fix needs to
|
||||
convert LAMMPS data to and from its :doc:`specified units <units>`
|
||||
accordingly when communicating with i-PI. This is not possible for
|
||||
reduced units ("units lj") and thus *fix ipi* will stop with an error in
|
||||
this case.
|
||||
|
||||
This fix is part of the MISC package. It is only enabled if
|
||||
LAMMPS was built with that package. See the
|
||||
:doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
@ -44,19 +44,23 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This fix can be used to simulate non-equilibrium molecular dynamics
|
||||
(NEMD) under diagonal flow fields, including uniaxial and bi-axial
|
||||
flow. Simulations under continuous extensional flow may be carried
|
||||
out for an indefinite amount of time. It is an implementation of the
|
||||
boundary conditions from :ref:`(Dobson) <Dobson>`, and also uses numerical
|
||||
These fixes can be used to simulate non-equilibrium molecular dynamics
|
||||
(NEMD) under diagonal flow fields, including uniaxial and bi-axial flow.
|
||||
Simulations under continuous extensional flow may be carried out for an
|
||||
indefinite amount of time. It is an implementation of the boundary
|
||||
conditions from :ref:`(Dobson) <Dobson>`, and also uses numerical
|
||||
lattice reduction as was proposed by :ref:`(Hunt) <Hunt>`. The lattice
|
||||
reduction algorithm is from :ref:`(Semaev) <Semaev>`. The fix is intended for
|
||||
simulations of homogeneous flows, and integrates the SLLOD equations
|
||||
of motion, originally proposed by Hoover and Ladd (see :ref:`(Evans and Morriss) <Sllod>`). Additional detail about this implementation can be
|
||||
found in :ref:`(Nicholson and Rutledge) <Nicholson>`.
|
||||
reduction algorithm is from :ref:`(Semaev) <Semaev>`. The fix is
|
||||
intended for simulations of homogeneous flows, and integrates the SLLOD
|
||||
equations of motion, originally proposed by Hoover and Ladd (see
|
||||
:ref:`(Evans and Morriss) <Sllod>`). Additional detail about this
|
||||
implementation can be found in :ref:`(Nicholson and Rutledge)
|
||||
<Nicholson>`.
|
||||
|
||||
Note that NEMD simulations of a continuously strained system can be
|
||||
performed using the :doc:`fix deform <fix_deform>`, :doc:`fix nvt/sllod <fix_nvt_sllod>`, and :doc:`compute temp/deform <compute_temp_deform>` commands.
|
||||
performed using the :doc:`fix deform <fix_deform>`, :doc:`fix nvt/sllod
|
||||
<fix_nvt_sllod>`, and :doc:`compute temp/deform <compute_temp_deform>`
|
||||
commands.
|
||||
|
||||
The applied flow field is set by the *eps* keyword. The values
|
||||
*edot_x* and *edot_y* correspond to the strain rates in the xx and yy
|
||||
@ -73,11 +77,11 @@ to -(*edot_x* + *edot_y*).
|
||||
The boundary conditions require a simulation box that does not have a
|
||||
consistent alignment relative to the applied flow field. Since LAMMPS
|
||||
utilizes an upper-triangular simulation box, it is not possible to
|
||||
express the evolving simulation box in the same coordinate system as
|
||||
the flow field. This fix keeps track of two coordinate systems: the
|
||||
flow frame, and the upper triangular LAMMPS frame. The coordinate
|
||||
systems are related to each other through the QR decomposition, as is
|
||||
illustrated in the image below.
|
||||
express the evolving simulation box in the same coordinate system as the
|
||||
flow field. These fixes keep track of two coordinate systems: the flow
|
||||
frame, and the upper triangular LAMMPS frame. The coordinate systems are
|
||||
related to each other through the QR decomposition, as is illustrated in
|
||||
the image below.
|
||||
|
||||
.. image:: JPG/uef_frames.jpg
|
||||
:align: center
|
||||
@ -99,12 +103,12 @@ using the dump command will be in the LAMMPS frame unless the
|
||||
----------
|
||||
|
||||
Temperature control is achieved with the default Nose-Hoover style
|
||||
thermostat documented in :doc:`fix npt <fix_nh>`. When this fix is
|
||||
thermostat documented in :doc:`fix nvt <fix_nh>`. When this fix is
|
||||
active, only the peculiar velocity of each atom is stored, defined as
|
||||
the velocity relative to the streaming velocity. This is in contrast
|
||||
to :doc:`fix nvt/sllod <fix_nvt_sllod>`, which uses a lab-frame
|
||||
velocity, and removes the contribution from the streaming velocity in
|
||||
order to compute the temperature.
|
||||
the velocity relative to the streaming velocity. This is in contrast to
|
||||
:doc:`fix nvt/sllod <fix_nvt_sllod>`, which uses a lab-frame velocity,
|
||||
and removes the contribution from the streaming velocity in order to
|
||||
compute the temperature.
|
||||
|
||||
Pressure control is achieved using the default Nose-Hoover barostat
|
||||
documented in :doc:`fix npt <fix_nh>`. There are two ways to control the
|
||||
@ -156,8 +160,8 @@ The following commands will not work:
|
||||
|
||||
----------
|
||||
|
||||
These fix computes a temperature and pressure each timestep. To do
|
||||
this, it creates its own computes of style "temp/uef" and
|
||||
These fixes compute a temperature and pressure each timestep. To do
|
||||
this, they create their own computes of style "temp/uef" and
|
||||
"pressure/uef", as if one of these two sets of commands had been
|
||||
issued:
|
||||
|
||||
@ -169,18 +173,19 @@ issued:
|
||||
compute fix-ID_temp all temp/uef
|
||||
compute fix-ID_press all pressure/uef fix-ID_temp
|
||||
|
||||
See the :doc:`compute temp/uef <compute_temp_uef>` and :doc:`compute pressure/uef <compute_pressure_uef>` commands for details. Note
|
||||
that the IDs of the new computes are the fix-ID + underscore + "temp"
|
||||
or fix_ID + underscore + "press".
|
||||
See the :doc:`compute temp/uef <compute_temp_uef>` and :doc:`compute
|
||||
pressure/uef <compute_pressure_uef>` commands for details. Note that
|
||||
the IDs of the new computes are the fix-ID + underscore + "temp" or
|
||||
fix_ID + underscore + "press".
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The fix writes the state of all the thermostat and barostat variables,
|
||||
as well as the cumulative strain applied, to :doc:`binary restart files <restart>`. See the :doc:`read_restart <read_restart>` command
|
||||
for info on how to re-specify a fix in an input script that reads a
|
||||
restart file, so that the operation of the fix continues in an
|
||||
uninterrupted fashion.
|
||||
as well as the cumulative strain applied, to :doc:`binary restart files
|
||||
<restart>`. See the :doc:`read_restart <read_restart>` command for info
|
||||
on how to re-specify a fix in an input script that reads a restart file,
|
||||
so that the operation of the fix continues in an uninterrupted fashion.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -189,43 +194,41 @@ uninterrupted fashion.
|
||||
not contain the cumulative applied strain, will this keyword be
|
||||
necessary.
|
||||
|
||||
This fix can be used with the :doc:`fix_modify <fix_modify>` *temp* and
|
||||
*press* options. The temperature and pressure computes used must be of
|
||||
type *temp/uef* and *pressure/uef*\ .
|
||||
These fixes can be used with the :doc:`fix_modify <fix_modify>` *temp*
|
||||
and *press* options. The temperature and pressure computes used must be
|
||||
of type *temp/uef* and *pressure/uef*\ .
|
||||
|
||||
This fix computes the same global scalar and vector quantities as :doc:`fix npt <fix_nh>`.
|
||||
These fixes compute the same global scalar and vector quantities as
|
||||
:doc:`fix nvt andnpt <fix_nh>`.
|
||||
|
||||
The fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||
These fixes are not invoked during :doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the UEF package. It is only enabled if LAMMPS
|
||||
was built with that package. See the :doc:`Build package <Build_package>` page for more info.
|
||||
These fixes are part of the UEF package. They are only enabled if LAMMPS
|
||||
was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Due to requirements of the boundary conditions, when the *strain*
|
||||
keyword is set to zero (or unset), the initial simulation box must be
|
||||
cubic and have style triclinic. If the box is initially of type ortho,
|
||||
use :doc:`change_box <change_box>` before invoking the fix.
|
||||
|
||||
.. note::
|
||||
|
||||
When resuming from restart files, you may need to use :doc:`box tilt
|
||||
large <box>` since LAMMPS has internal criteria from lattice
|
||||
reduction that are not the same as the criteria in the numerical
|
||||
lattice reduction algorithm.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix nvt <fix_nh>`, :doc:`fix nvt/sllod <fix_nvt_sllod>`, :doc:`compute temp/uef <compute_temp_uef>`, :doc:`compute pressure/uef <compute_pressure_uef>`, :doc:`dump cfg/uef <dump_cfg_uef>`
|
||||
:doc:`fix nvt <fix_nh>`, :doc:`fix npt <fix_nh>`, `fix nvt/sllod
|
||||
:doc:<fix_nvt_sllod>`, `compute temp/uef <compute_temp_uef>`,
|
||||
:doc::doc:`compute pressure/uef <compute_pressure_uef>`, `dump cfg/uef
|
||||
:doc:<dump_cfg_uef>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The default keyword values specific to this fix are exy = xyz, strain
|
||||
= 0 0. The remaining defaults are the same as for :doc:`fix npt <fix_nh>`
|
||||
except tchain = 1. The reason for this change is given in
|
||||
The default keyword values specific to these fixes are exy = xyz, strain
|
||||
= 0 0. The remaining defaults are the same as for :doc:`fix nvt or npt
|
||||
<fix_nh>` except tchain = 1. The reason for this change is given in
|
||||
:doc:`fix nvt/sllod <fix_nvt_sllod>`.
|
||||
|
||||
----------
|
||||
|
||||
@ -156,6 +156,8 @@ This fix is part of the REPLICA package. It is only enabled if
|
||||
LAMMPS was built with that package. See the
|
||||
:doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
Fix pid cannot be used with :doc:`lj units <units>`.
|
||||
|
||||
A PIMD simulation can be initialized with a single data file read via
|
||||
the :doc:`read_data <read_data>` command. However, this means all
|
||||
quasi-beads in a ring polymer will have identical positions and
|
||||
|
||||
188
doc/src/fix_sgcmc.rst
Normal file
188
doc/src/fix_sgcmc.rst
Normal file
@ -0,0 +1,188 @@
|
||||
.. index:: fix sgcmc
|
||||
|
||||
fix sgcmc command
|
||||
=================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID sgcmc every_nsteps swap_fraction temperature deltamu ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* sgcmc = style name of this fix command
|
||||
* every_nsteps = number of MD steps between MC cycles
|
||||
* swap_fraction = fraction of a full MC cycle carried out at each call (a value of 1.0 will perform as many trial moves as there are atoms)
|
||||
* temperature = temperature that enters Boltzmann factor in Metropolis criterion (usually the same as MD temperature)
|
||||
* deltamu = chemical potential difference(s) (`N-1` values must be provided, with `N` being the number of elements)
|
||||
* Zero or more keyword/value pairs may be appended to fix definition line:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
keyword = *variance* or *randseed* or *window_moves* or *window_size*
|
||||
*variance* kappa conc1 [conc2] ... [concN]
|
||||
kappa = variance constraint parameter
|
||||
conc1,conc2,... = target concentration(s) in the range 0.0-1.0 (*N-1* values must be provided, with *N* being the number of elements)
|
||||
*randseed* N
|
||||
N = seed for pseudo random number generator
|
||||
*window_moves* N
|
||||
N = number of times sampling window is moved during one MC cycle
|
||||
*window_size* frac
|
||||
frac = size of sampling window (must be between 0.5 and 1.0)
|
||||
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix mc all sgcmc 50 0.1 400.0 -0.55
|
||||
fix vc all sgcmc 20 0.2 700.0 -0.7 randseed 324234 variance 2000.0 0.05
|
||||
fix 2 all sgcmc 20 0.1 700.0 -0.7 window_moves 20
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
This command allows to carry out parallel hybrid molecular
|
||||
dynamics/Monte Carlo (MD/MC) simulations using the algorithms described
|
||||
in :ref:`(Sadigh1) <Sadigh1>`. Simulations can be carried out in either
|
||||
the semi-grand canonical (SGC) or variance constrained semi-grand
|
||||
canonical (VC-SGC) ensemble :ref:`(Sadigh2) <Sadigh2>`. Only atom type
|
||||
swaps are performed by the SGCMC fix. Relaxations are accounted for by
|
||||
the molecular dynamics integration steps.
|
||||
|
||||
This fix can be used with standard multi-element EAM potentials
|
||||
(:doc:`pair styles eam/alloy or eam/fs <pair_eam>`)
|
||||
|
||||
The SGCMC fix can handle Finnis/Sinclair type EAM potentials where
|
||||
:math:`\rho(r)` is atom-type specific, such that different elements can
|
||||
contribute differently to the total electron density at an atomic site
|
||||
depending on the identity of the element at that atomic site.
|
||||
|
||||
------------
|
||||
|
||||
If this fix is applied, the regular MD simulation will be interrupted in
|
||||
defined intervals to carry out a fraction of a Monte Carlo (MC)
|
||||
cycle. The interval is set using the parameter *every_nsteps* which
|
||||
determines how many MD integrator steps are taken between subsequent
|
||||
calls to the MC routine.
|
||||
|
||||
It is possible to carry out pure lattice MC simulations by setting
|
||||
*every_nsteps* to 1 and not defining an integration fix such as NVE,
|
||||
NPT etc. In that case, the particles will not move and only the MC
|
||||
routine will be called to perform atom type swaps.
|
||||
|
||||
The parameter *swap_fraction* determines how many MC trial steps are carried
|
||||
out every time the MC routine is entered. It is measured in units of full MC
|
||||
cycles where one full cycle, *swap_fraction=1*, corresponds to as many MC
|
||||
trial steps as there are atoms.
|
||||
|
||||
------------
|
||||
|
||||
The parameter *temperature* specifies the temperature that is used
|
||||
to evaluate the Metropolis acceptance criterion. While it usually
|
||||
should be set to the same value as the MD temperature there are cases
|
||||
when it can be useful to use two different values for at least part of
|
||||
the simulation, e.g., to speed up equilibration at low temperatures.
|
||||
|
||||
------------
|
||||
|
||||
The parameter *deltamu* is used to set the chemical potential difference
|
||||
in the SGC MC algorithm (see Eq. 16 in :ref:`Sadigh1 <Sadigh1>`). By
|
||||
convention it is the difference of the chemical potentials of elements
|
||||
`B`, `C` ..., with respect to element A. When the simulation includes
|
||||
`N` elements, `N-1` values must be specified.
|
||||
|
||||
------------
|
||||
|
||||
The variance-constrained SGC MC algorithm is activated if the keyword
|
||||
*variance* is used. In that case the fix parameter *deltamu* determines
|
||||
the effective average constraint in the parallel VC-SGC MC algorithm
|
||||
(parameter :math:`\delta\mu_0` in Eq. (20) of :ref:`Sadigh1
|
||||
<Sadigh1>`). The parameter *kappa* specifies the variance constraint
|
||||
(see Eqs. (20-21) in :ref:`Sadigh1 <Sadigh1>`).
|
||||
|
||||
The parameter *conc* sets the target concentration (parameter
|
||||
:math:`c_0` in Eqs. (20-21) of :ref:`Sadigh1 <Sadigh1>`). The atomic
|
||||
concentrations refer to components `B`, `C` ..., with `A` being set
|
||||
automatically. When the simulation includes `N` elements, `N-1`
|
||||
concentration values must be specified.
|
||||
|
||||
------------
|
||||
|
||||
There are several technical parameters that can be set via optional flags.
|
||||
|
||||
*randseed* is expected to be a positive integer number and is used
|
||||
to initialize the random number generator on each processor.
|
||||
|
||||
*window_size* controls the size of the sampling window in a parallel MC
|
||||
simulation. The size has to lie between 0.5 and 1.0. Normally, this
|
||||
parameter should be left unspecified which instructs the code to choose
|
||||
the optimal window size automatically (see Sect. III.B and Figure 6 in
|
||||
:ref:`Sadigh1 <Sadigh1>` for details).
|
||||
|
||||
The number of times the window is moved during a MC cycle is set using
|
||||
the parameter *window_moves* (see Sect. III.B in :ref:`Sadigh1
|
||||
<Sadigh1>` for details).
|
||||
|
||||
------------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
==========================================================
|
||||
|
||||
No information about this fix is written to restart files.
|
||||
|
||||
The MC routine keeps track of the global concentration(s) as well as the
|
||||
number of accepted and rejected trial swaps during each MC step. These
|
||||
values are provided by the sgcmc fix in the form of a global vector that
|
||||
can be accessed by various :doc:`output commands <Howto_output>`
|
||||
components of the vector represent the following quantities:
|
||||
|
||||
* 1 = The absolute number of accepted trial swaps during the last MC step
|
||||
* 2 = The absolute number of rejected trial swaps during the last MC step
|
||||
* 3 = The current global concentration of species *A* (= number of atoms of type 1 / total number of atoms)
|
||||
* 4 = The current global concentration of species *B* (= number of atoms of type 2 / total number of atoms)
|
||||
* ...
|
||||
* N+2: The current global concentration of species *X* (= number of atoms of type *N* / total number of atoms)
|
||||
|
||||
Restrictions
|
||||
============
|
||||
|
||||
This fix is part of the MC package. It is only enabled if LAMMPS was
|
||||
built with that package. See the :doc:`Build package <Build_package>`
|
||||
page for more info.
|
||||
|
||||
At present the fix provides optimized subroutines for EAM type
|
||||
potentials (see above) that calculate potential energy changes due to
|
||||
*local* atom type swaps very efficiently. Other potentials are
|
||||
supported by using the generic potential functions. This, however, will
|
||||
lead to exceedingly slow simulations since it implies that the
|
||||
energy of the *entire* system is recomputed at each MC trial step. If
|
||||
other potentials are to be used it is strongly recommended to modify and
|
||||
optimize the existing generic potential functions for this purpose.
|
||||
Also, the generic energy calculation can not be used for parallel
|
||||
execution i.e. it only works with a single MPI process.
|
||||
|
||||
------------
|
||||
|
||||
Default
|
||||
=======
|
||||
|
||||
The optional parameters default to the following values:
|
||||
|
||||
* *randseed* = 324234
|
||||
* *window_moves* = 8
|
||||
* *window_size* = automatic
|
||||
|
||||
------------
|
||||
|
||||
.. _Sadigh1:
|
||||
|
||||
**(Sadigh1)** B. Sadigh, P. Erhart, A. Stukowski, A. Caro, E. Martinez, and L. Zepeda-Ruiz, Phys. Rev. B **85**, 184203 (2012)
|
||||
|
||||
.. _Sadigh2:
|
||||
|
||||
**(Sadigh2)** B. Sadigh and P. Erhart, Phys. Rev. B **86**, 134204 (2012)
|
||||
@ -183,29 +183,32 @@ embedded within a larger continuum representation of the electronic
|
||||
subsystem.
|
||||
|
||||
The *set* keyword specifies a *Tinit* temperature value to initialize
|
||||
the value stored on all grid points.
|
||||
the value stored on all grid points. By default the temperatures
|
||||
are all zero when the grid is created.
|
||||
|
||||
The *infile* keyword specifies an input file of electronic temperatures
|
||||
for each grid point to be read in to initialize the grid. By default
|
||||
the temperatures are all zero when the grid is created. The input file
|
||||
is a text file which may have comments starting with the '#' character.
|
||||
Each line contains four numeric columns: ix,iy,iz,Temperature. Empty
|
||||
or comment-only lines will be ignored. The
|
||||
number of lines must be equal to the number of user-specified grid
|
||||
points (Nx by Ny by Nz). The ix,iy,iz are grid point indices ranging
|
||||
from 0 to nxnodes-1 inclusive in each dimension. The lines can appear
|
||||
in any order. For example, the initial electronic temperatures on a 1
|
||||
by 2 by 3 grid could be specified in the file as follows:
|
||||
for each grid point to be read in to initialize the grid, as an alternative
|
||||
to using the *set* keyword.
|
||||
|
||||
The input file is a text file which may have comments starting with
|
||||
the '#' character. Each line contains four numeric columns:
|
||||
ix,iy,iz,Temperature. Empty or comment-only lines will be
|
||||
ignored. The number of lines must be equal to the number of
|
||||
user-specified grid points (Nx by Ny by Nz). The ix,iy,iz are grid
|
||||
point indices ranging from 1 to Nxyz inclusive in each dimension. The
|
||||
lines can appear in any order. For example, the initial electronic
|
||||
temperatures on a 1 by 2 by 3 grid could be specified in the file as
|
||||
follows:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
# UNITS: metal COMMENT: initial electron temperature
|
||||
0 0 0 1.0
|
||||
0 0 1 1.0
|
||||
0 0 2 1.0
|
||||
0 1 0 2.0
|
||||
0 1 1 2.0
|
||||
0 1 2 2.0
|
||||
1 1 1 1.0
|
||||
1 1 2 1.0
|
||||
1 1 3 1.0
|
||||
1 2 1 2.0
|
||||
1 2 2 2.0
|
||||
1 2 3 2.0
|
||||
|
||||
where the electronic temperatures along the y=0 plane have been set to
|
||||
1.0, and the electronic temperatures along the y=1 plane have been set
|
||||
@ -223,17 +226,31 @@ units used.
|
||||
|
||||
The *outfile* keyword has 2 values. The first value *Nout* triggers
|
||||
output of the electronic temperatures for each grid point every Nout
|
||||
timesteps. The second value is the filename for output which will
|
||||
be suffixed by the timestep. The format of each output file is exactly
|
||||
timesteps. The second value is the filename for output, which will be
|
||||
suffixed by the timestep. The format of each output file is exactly
|
||||
the same as the input temperature file. It will contain a comment in
|
||||
the first line reporting the date the file was created, the LAMMPS
|
||||
units setting in use, grid size and the current timestep.
|
||||
|
||||
Note that the atomic temperature for atoms in each grid cell can also
|
||||
be computed and output by the :doc:`fix ave/chunk <fix_ave_chunk>`
|
||||
command using the :doc:`compute chunk/atom <compute_chunk_atom>`
|
||||
command to create a 3d array of chunks consistent with the grid used
|
||||
by this fix.
|
||||
.. note::
|
||||
|
||||
The fix ttm/grid command does not support the *outfile* keyword.
|
||||
Instead you can use the :doc:`dump grid <dump>` command to output
|
||||
the electronic temperature on the distributed grid to a dump file or
|
||||
the :doc:`restart <restart>` command which creates a file specific
|
||||
to this fix which the :doc:`read restart <read_restart>` command
|
||||
reads. The file has the same format as the file the *infile* option
|
||||
reads.
|
||||
|
||||
For the fix ttm and fix ttm/mod commands, the corresponding atomic
|
||||
temperature for atoms in each grid cell can be computed and output by
|
||||
the :doc:`fix ave/chunk <fix_ave_chunk>` command using the
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command to create a 3d
|
||||
array of chunks consistent with the grid used by this fix.
|
||||
|
||||
For the fix ttm/grid command the same thing can be done using the
|
||||
:doc:`fix ave/grid <fix_ave_grid>` command and its per-grid values can
|
||||
be output via the :doc:`dump grid <dump>` command.
|
||||
|
||||
----------
|
||||
|
||||
@ -339,19 +356,25 @@ ignored. The lines with the even numbers are treated as follows:
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
These fixes write the state of the electronic subsystem and the energy
|
||||
exchange between the subsystems to :doc:`binary restart files
|
||||
<restart>`. See the :doc:`read_restart <read_restart>` command for
|
||||
info on how to re-specify a fix in an input script that reads a
|
||||
restart file, so that the operation of the fix continues in an
|
||||
uninterrupted fashion. Note that the restart script must define the
|
||||
same size grid as the original script.
|
||||
The fix ttm and fix ttm/mod commands write the state of the electronic
|
||||
subsystem and the energy exchange between the subsystems to
|
||||
:doc:`binary restart files <restart>`. The fix ttm/grid command does
|
||||
not yet support writing of its distributed grid to a restart file.
|
||||
|
||||
Because the state of the random number generator is not saved in the
|
||||
restart files, this means you cannot do "exact" restarts with this
|
||||
fix, where the simulation continues on the same as if no restart had
|
||||
taken place. However, in a statistical sense, a restarted simulation
|
||||
should produce the same behavior.
|
||||
See the :doc:`read_restart <read_restart>` command for info on how to
|
||||
re-specify a fix in an input script that reads a restart file, so that
|
||||
the operation of the fix continues in an uninterrupted fashion. Note
|
||||
that the restart script must define the same size grid as the original
|
||||
script.
|
||||
|
||||
The fix ttm/grid command also outputs an auxiliary file each time a
|
||||
restart file is written, with the electron temperatures for each grid
|
||||
cell. The format of this file is the same as that read by the
|
||||
*infile* option explained above. The filename is the same as the
|
||||
restart filename with ".ttm" appended. This auxiliary file can be
|
||||
read in for a restarted run by using the *infile* option for the fix
|
||||
ttm/grid command, following the :doc:`read_restart <read_restart>`
|
||||
command.
|
||||
|
||||
None of the :doc:`fix_modify <fix_modify>` options are relevant to
|
||||
these fixes.
|
||||
@ -371,6 +394,14 @@ electronic subsystem energies reported at the end of the timestep.
|
||||
|
||||
The vector values calculated are "extensive".
|
||||
|
||||
The fix ttm/grid command also outputs a per-grid vector which stores
|
||||
the electron temperature for each grid cell in temperature :doc:`units
|
||||
<units>`. which can be accessed by various :doc:`output commands
|
||||
<Howto_output>`. The length of the vector (distributed across all
|
||||
processors) is Nx * Ny * Nz. For access by other commands, the name
|
||||
of the single grid produced by fix ttm/grid is "grid". The name of
|
||||
its per-grid data is "data".
|
||||
|
||||
No parameter of the fixes can be used with the *start/stop* keywords
|
||||
of the :doc:`run <run>` command. The fixes are not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
@ -385,6 +416,15 @@ package <Build_package>` page for more info.
|
||||
As mentioned above, these fixes require 3d simulations and orthogonal
|
||||
simulation boxes periodic in all 3 dimensions.
|
||||
|
||||
These fixes used a random number generator to Langevin thermostat the
|
||||
electron temperature. This means you will not get identical answers
|
||||
when running on different numbers of processors or when restarting a
|
||||
simulation (even on the same number of processors). However, in a
|
||||
statistical sense, simulations on different processor counts and
|
||||
restarted simulation should produce results which are statistically
|
||||
the same.
|
||||
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
.. index:: fix viscous
|
||||
.. index:: fix viscous/kk
|
||||
|
||||
fix viscous command
|
||||
===================
|
||||
|
||||
Accelerator Variants: *viscous/kk*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
@ -84,6 +87,10 @@ more easily be used as a thermostat.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
@ -1333,13 +1333,13 @@ For example,
|
||||
Citation of OpenKIM IMs
|
||||
"""""""""""""""""""""""
|
||||
|
||||
When publishing results obtained using OpenKIM IMs researchers are requested
|
||||
to cite the OpenKIM project :ref:`(Tadmor) <kim-mainpaper>`, KIM API
|
||||
:ref:`(Elliott) <kim-api>`, and the specific IM codes used in the simulations,
|
||||
in addition to the relevant scientific references for the IM. The citation
|
||||
format for an IM is displayed on its page on
|
||||
`OpenKIM <https://openkim.org>`_ along with the corresponding BibTex file, and
|
||||
is automatically added to the LAMMPS citation reminder.
|
||||
When publishing results obtained using OpenKIM IMs researchers are
|
||||
requested to cite the OpenKIM project :ref:`(Tadmor) <kim-mainpaper>`,
|
||||
KIM API :ref:`(Elliott) <kim-api>`, and the specific IM codes used in
|
||||
the simulations, in addition to the relevant scientific references for
|
||||
the IM. The citation format for an IM is displayed on its page on
|
||||
`OpenKIM <https://openkim.org>`_ along with the corresponding BibTex
|
||||
file, and is automatically added to the LAMMPS citation reminder.
|
||||
|
||||
Citing the IM software (KIM infrastructure and specific PM or SM codes) used in
|
||||
the simulation gives credit to the researchers who developed them and enables
|
||||
@ -1348,15 +1348,15 @@ open source efforts like OpenKIM to function.
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
The *kim* command is part of the KIM package. It is only enabled if LAMMPS is
|
||||
built with that package. A requirement for the KIM package, is the KIM API
|
||||
library that must be downloaded from the
|
||||
`OpenKIM website <https://openkim.org/kim-api/>`_ and installed before LAMMPS is
|
||||
The *kim* command is part of the KIM package. It is only enabled if
|
||||
LAMMPS is built with that package. A requirement for the KIM package,
|
||||
is the KIM API library that must be downloaded from the `OpenKIM website
|
||||
<https://openkim.org/kim-api/>`_ and installed before LAMMPS is
|
||||
compiled. When installing LAMMPS from binary, the kim-api package is a
|
||||
dependency that is automatically downloaded and installed. The *kim query*
|
||||
command requires the *libcurl* library to be installed. The *kim property*
|
||||
command requires *Python* 3.6 or later and the *kim-property* python package to
|
||||
be installed. See the KIM section of the
|
||||
dependency that is automatically downloaded and installed. The *kim
|
||||
query* command requires the *libcurl* library to be installed. The *kim
|
||||
property* command requires *Python* 3.6 or later and the *kim-property*
|
||||
python package to be installed. See the KIM section of the
|
||||
:doc:`Packages details <Packages_details>` for details.
|
||||
|
||||
Furthermore, when using *kim* command to run KIM SMs, any packages required by
|
||||
|
||||
@ -51,7 +51,6 @@ Syntax
|
||||
*slab* value = volfactor or *nozforce*
|
||||
volfactor = ratio of the total extended volume used in the
|
||||
2d approximation compared with the volume of the simulation domain
|
||||
*ew2d* EW2D correction (available with ELECTRODE package)
|
||||
*nozforce* turns off kspace forces in the z direction
|
||||
*splittol* value = tol
|
||||
tol = relative size of two eigenvalues (see discussion below)
|
||||
@ -381,18 +380,22 @@ solver is set up.
|
||||
|
||||
The *slab* keyword allows an Ewald or PPPM solver to be used for a
|
||||
systems that are periodic in x,y but non-periodic in z - a
|
||||
:doc:`boundary <boundary>` setting of "boundary p p f". This is done by
|
||||
treating the system as if it were periodic in z, but inserting empty
|
||||
volume between atom slabs and removing dipole inter-slab interactions
|
||||
so that slab-slab interactions are effectively turned off. The
|
||||
volfactor value sets the ratio of the extended dimension in z divided
|
||||
by the actual dimension in z. The recommended value is 3.0. A larger
|
||||
value is inefficient; a smaller value introduces unwanted slab-slab
|
||||
:doc:`boundary <boundary>` setting of "boundary p p f". This is done
|
||||
by treating the system as if it were periodic in z, but inserting
|
||||
empty volume between atom slabs and removing dipole inter-slab
|
||||
interactions so that slab-slab interactions are effectively turned
|
||||
off. The volfactor value sets the ratio of the extended dimension in
|
||||
z divided by the actual dimension in z. It must be a value >= 1.0. A
|
||||
value of 1.0 (the default) means the slab approximation is not used.
|
||||
|
||||
The recommended value for volfactor is 3.0. A larger value is
|
||||
inefficient; a smaller value introduces unwanted slab-slab
|
||||
interactions. The use of fixed boundaries in z means that the user
|
||||
must prevent particle migration beyond the initial z-bounds, typically
|
||||
by providing a wall-style fix. The methodology behind the *slab*
|
||||
option is explained in the paper by :ref:`(Yeh) <Yeh>`. The *slab* option
|
||||
is also extended to non-neutral systems :ref:`(Ballenegger) <Ballenegger>`.
|
||||
option is explained in the paper by :ref:`(Yeh) <Yeh>`. The *slab*
|
||||
option is also extended to non-neutral systems :ref:`(Ballenegger)
|
||||
<Ballenegger>`.
|
||||
|
||||
An alternative slab option can be invoked with the *nozforce* keyword
|
||||
in lieu of the volfactor. This turns off all kspace forces in the z
|
||||
@ -402,8 +405,8 @@ boundaries can be set using :doc:`boundary <boundary>` (the slab
|
||||
approximation in not needed). The *slab* keyword is not currently
|
||||
supported by Ewald or PPPM when using a triclinic simulation cell. The
|
||||
slab correction has also been extended to point dipole interactions
|
||||
:ref:`(Klapp) <Klapp>` in :doc:`kspace_style <kspace_style>` *ewald/disp*,
|
||||
*ewald/dipole*, and *pppm/dipole*\ .
|
||||
:ref:`(Klapp) <Klapp>` in :doc:`kspace_style <kspace_style>`
|
||||
*ewald/disp*, *ewald/dipole*, and *pppm/dipole*\ .
|
||||
|
||||
.. note::
|
||||
|
||||
@ -448,15 +451,32 @@ Related commands
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The option defaults are mesh = mesh/disp = 0 0 0, order = order/disp =
|
||||
5 (PPPM), order = 10 (MSM), minorder = 2, overlap = yes, force = -1.0,
|
||||
gewald = gewald/disp = 0.0, slab = 1.0, compute = yes, cutoff/adjust =
|
||||
yes (MSM), pressure/scalar = yes (MSM), fftbench = no (PPPM), diff =
|
||||
ik (PPPM), mix/disp = pair, force/disp/real = -1.0, force/disp/kspace
|
||||
= -1.0, split = 0, tol = 1.0e-6, and disp/auto = no. For pppm/intel,
|
||||
order = order/disp = 7. For scafacos settings, the scafacos tolerance
|
||||
option depends on the method chosen, as documented above. The
|
||||
scafacos fmm_tuning default = 0.
|
||||
The option defaults are as follows:
|
||||
|
||||
* compute = yes
|
||||
* cutoff/adjust = yes (MSM)
|
||||
* diff = ik (PPPM)
|
||||
* disp/auto = no
|
||||
* fftbench = no (PPPM)
|
||||
* force = -1.0,
|
||||
* force/disp/kspace = -1.0
|
||||
* force/disp/real = -1.0
|
||||
* gewald = gewald/disp = 0.0
|
||||
* mesh = mesh/disp = 0 0 0
|
||||
* minorder = 2
|
||||
* mix/disp = pair
|
||||
* order = 10 (MSM)
|
||||
* order = order/disp = 5 (PPPM)
|
||||
* order = order/disp = 7 (PPPM/intel)
|
||||
* overlap = yes
|
||||
* pressure/scalar = yes (MSM)
|
||||
* slab = 1.0
|
||||
* split = 0
|
||||
* tol = 1.0e-6
|
||||
|
||||
For scafacos settings, the scafacos tolerance option depends on the
|
||||
method chosen, as documented above. The scafacos fmm_tuning default
|
||||
= 0.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -283,7 +283,7 @@ parameters and how to choose them is described in
|
||||
----------
|
||||
|
||||
The *electrode* styles add methods that are required for the constant potential
|
||||
method implemented in :doc:`fix electrode/* <fix_electrode_conp>`. The styles
|
||||
method implemented in :doc:`fix electrode/* <fix_electrode>`. The styles
|
||||
*ewald/electrode*, *pppm/electrode* and *pppm/electrode/intel* are available.
|
||||
These styles do not support the `kspace_modify slab nozforce` command.
|
||||
|
||||
|
||||
@ -174,11 +174,11 @@ shifted force model described in :ref:`Fennell <Fennell1>`, given by:
|
||||
E = q_iq_j \left[ \frac{\mbox{erfc} (\alpha r)}{r} - \frac{\mbox{erfc} (\alpha r_c)}{r_c} +
|
||||
\left( \frac{\mbox{erfc} (\alpha r_c)}{r_c^2} + \frac{2\alpha}{\sqrt{\pi}}\frac{\exp (-\alpha^2 r^2_c)}{r_c} \right)(r-r_c) \right] \qquad r < r_c
|
||||
|
||||
where :math:`\alpha` is the damping parameter and erfc() is the
|
||||
complementary error-function. The potential corrects issues in the
|
||||
Wolf model (described below) to provide consistent forces and energies
|
||||
(the Wolf potential is not differentiable at the cutoff) and smooth
|
||||
decay to zero.
|
||||
where :math:`\alpha` is the damping parameter and *erfc()* is the
|
||||
complementary error-function. The potential corrects issues in the Wolf
|
||||
model (described below) to provide consistent forces and energies (the
|
||||
Wolf potential is not differentiable at the cutoff) and smooth decay to
|
||||
zero.
|
||||
|
||||
----------
|
||||
|
||||
@ -192,30 +192,32 @@ summation method, described in :ref:`Wolf <Wolf1>`, given by:
|
||||
\frac{1}{2} \sum_{j \neq i}
|
||||
\frac{q_i q_j {\rm erf}(\alpha r_{ij})}{r_{ij}} \qquad r < r_c
|
||||
|
||||
where :math:`\alpha` is the damping parameter, and erc() and erfc() are
|
||||
error-function and complementary error-function terms. This potential
|
||||
is essentially a short-range, spherically-truncated,
|
||||
where :math:`\alpha` is the damping parameter, and *erf()* and *erfc()*
|
||||
are error-function and complementary error-function terms. This
|
||||
potential is essentially a short-range, spherically-truncated,
|
||||
charge-neutralized, shifted, pairwise *1/r* summation. With a
|
||||
manipulation of adding and subtracting a self term (for i = j) to the
|
||||
first and second term on the right-hand-side, respectively, and a
|
||||
small enough :math:`\alpha` damping parameter, the second term shrinks and
|
||||
the potential becomes a rapidly-converging real-space summation. With
|
||||
a long enough cutoff and small enough :math:`\alpha` parameter, the energy and
|
||||
forces calculated by the Wolf summation method approach those of the
|
||||
first and second term on the right-hand-side, respectively, and a small
|
||||
enough :math:`\alpha` damping parameter, the second term shrinks and the
|
||||
potential becomes a rapidly-converging real-space summation. With a
|
||||
long enough cutoff and small enough :math:`\alpha` parameter, the energy
|
||||
and forces calculated by the Wolf summation method approach those of the
|
||||
Ewald sum. So it is a means of getting effective long-range
|
||||
interactions with a short-range potential.
|
||||
|
||||
----------
|
||||
|
||||
Style *coul/streitz* is the Coulomb pair interaction defined as part
|
||||
of the Streitz-Mintmire potential, as described in :ref:`this paper <Streitz2>`, in which charge distribution about an atom is modeled
|
||||
as a Slater 1\ *s* orbital. More details can be found in the referenced
|
||||
Style *coul/streitz* is the Coulomb pair interaction defined as part of
|
||||
the Streitz-Mintmire potential, as described in :ref:`this paper
|
||||
<Streitz2>`, in which charge distribution about an atom is modeled as a
|
||||
Slater 1\ *s* orbital. More details can be found in the referenced
|
||||
paper. To fully reproduce the published Streitz-Mintmire potential,
|
||||
which is a variable charge potential, style *coul/streitz* must be
|
||||
used with :doc:`pair_style eam/alloy <pair_eam>` (or some other
|
||||
short-range potential that has been parameterized appropriately) via
|
||||
the :doc:`pair_style hybrid/overlay <pair_hybrid>` command. Likewise,
|
||||
charge equilibration must be performed via the :doc:`fix qeq/slater <fix_qeq>` command. For example:
|
||||
which is a variable charge potential, style *coul/streitz* must be used
|
||||
with :doc:`pair_style eam/alloy <pair_eam>` (or some other short-range
|
||||
potential that has been parameterized appropriately) via the
|
||||
:doc:`pair_style hybrid/overlay <pair_hybrid>` command. Likewise,
|
||||
charge equilibration must be performed via the :doc:`fix qeq/slater
|
||||
<fix_qeq>` command. For example:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
.. index:: pair_style dpd/ext
|
||||
.. index:: pair_style dpd/ext/kk
|
||||
.. index:: pair_style dpd/ext/omp
|
||||
.. index:: pair_style dpd/ext/tstat
|
||||
.. index:: pair_style dpd/ext/tstat/kk
|
||||
.. index:: pair_style dpd/ext/tstat/omp
|
||||
|
||||
pair_style dpd/ext command
|
||||
==========================
|
||||
|
||||
Accelerator Variants: dpd/ext/kk
|
||||
Accelerator Variants: dpd/ext/kk dpd/ext/omp
|
||||
|
||||
pair_style dpd/ext/tstat command
|
||||
================================
|
||||
|
||||
Accelerator Variants: dpd/ext/tstat/kk
|
||||
Accelerator Variants: dpd/ext/tstat/kk dpd/ext/tstat/omp
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
@ -113,10 +115,10 @@ each pair of atoms types via the :doc:`pair_coeff <pair_coeff>` command
|
||||
as in the examples above:
|
||||
|
||||
* A (force units)
|
||||
* :math:`\gamma_{\perp}` (force/velocity units)
|
||||
* :math:`\gamma_{\parallel}` (force/velocity units)
|
||||
* :math:`s_{\perp}` (unitless)
|
||||
* :math:`\gamma_{\perp}` (force/velocity units)
|
||||
* :math:`s_{\parallel}` (unitless)
|
||||
* :math:`s_{\perp}` (unitless)
|
||||
* :math:`r_c` (distance units)
|
||||
|
||||
The last coefficient is optional. If not specified, the global DPD
|
||||
|
||||
97
doc/src/pair_pod.rst
Normal file
97
doc/src/pair_pod.rst
Normal file
@ -0,0 +1,97 @@
|
||||
.. index:: pair_style pod
|
||||
|
||||
pair_style pod command
|
||||
========================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style pod
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style pod
|
||||
pair_coeff * * Ta_param.pod Ta_coefficients.pod Ta
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: 22Dec2022
|
||||
|
||||
Pair style *pod* defines the proper orthogonal descriptor (POD)
|
||||
potential :ref:`(Nguyen) <Nguyen20221>`. The mathematical definition of
|
||||
the POD potential is described from :doc:`fitpod <fitpod_command>`, which is
|
||||
used to fit the POD potential to *ab initio* energy and force data.
|
||||
|
||||
Only a single pair_coeff command is used with the *pod* style which
|
||||
specifies a POD parameter file followed by a coefficient file.
|
||||
|
||||
The coefficient file (``Ta_coefficients.pod``) contains coefficients for the
|
||||
POD potential. The top of the coefficient file can contain any number of
|
||||
blank and comment lines (start with #), but follows a strict format
|
||||
after that. The first non-blank non-comment line must contain:
|
||||
|
||||
* POD_coefficients: *ncoeff*
|
||||
|
||||
This is followed by *ncoeff* coefficients, one per line. The coefficient
|
||||
file is generated after training the POD potential using :doc:`fitpod
|
||||
<fitpod_command>`.
|
||||
|
||||
The POD parameter file (``Ta_param.pod``) can contain blank and comment lines
|
||||
(start with #) anywhere. Each non-blank non-comment line must contain
|
||||
one keyword/value pair. See :doc:`fitpod <fitpod_command>` for the description
|
||||
of all the keywords that can be assigned in the parameter file.
|
||||
|
||||
As an example, if a LAMMPS indium phosphide simulation has 4 atoms
|
||||
types, with the first two being indium and the third and fourth being
|
||||
phophorous, the pair_coeff command would look like this:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_coeff * * pod InP_param.pod InP_coefficients.pod In In P P
|
||||
|
||||
The first 2 arguments must be \* \* so as to span all LAMMPS atom types.
|
||||
The two filenames are for the parameter and coefficient files, respectively.
|
||||
The two trailing 'In' arguments map LAMMPS atom types 1 and 2 to the
|
||||
POD 'In' element. The two trailing 'P' arguments map LAMMPS atom types
|
||||
3 and 4 to the POD 'P' element.
|
||||
|
||||
If a POD mapping value is specified as NULL, the mapping is not
|
||||
performed. This can be used when a *pod* potential is used as part of
|
||||
the *hybrid* pair style. The NULL values are placeholders for atom
|
||||
types that will be used with other potentials.
|
||||
|
||||
Examples about training and using POD potentials are found in the
|
||||
directory lammps/examples/PACKAGES/pod.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This style is part of the ML-POD package. It is only enabled if LAMMPS
|
||||
was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
This pair style does not compute per-atom energies and per-atom stresses.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fitpod <fitpod_command>`,
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _Nguyen20221:
|
||||
|
||||
**(Nguyen)** Nguyen and Rohskopf, arXiv preprint arXiv:2209.02362 (2022).
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user