Merge branch 'master' into fft-flip-sign

This commit is contained in:
Stan Moore
2021-01-07 10:16:26 -07:00
committed by GitHub
719 changed files with 16683 additions and 8974 deletions

View File

@ -25,7 +25,7 @@ set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
find_package(Git)
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE )
endif()
@ -33,7 +33,7 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
# make sure LIBRARY_PATH is set if environment variable is set
if (DEFINED ENV{LIBRARY_PATH})
if(DEFINED ENV{LIBRARY_PATH})
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIBRARY_PATH}")
message(STATUS "Appending $ENV{LIBRARY_PATH} to CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")
endif()
@ -220,6 +220,7 @@ if(BUILD_OMP)
endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
@ -372,7 +373,7 @@ else()
set(CUDA_REQUEST_PIC)
endif()
foreach(PKG_WITH_INCL KSPACE PYTHON VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM
foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM
USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS)
if(PKG_${PKG_WITH_INCL})
include(Packages/${PKG_WITH_INCL})
@ -579,7 +580,7 @@ add_dependencies(lammps gitversion)
############################################
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
list (FIND LANGUAGES "Fortran" _index)
if (${_index} GREATER -1)
if(${_index} GREATER -1)
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
endif()
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
@ -661,7 +662,7 @@ if(BUILD_SHARED_LIBS)
add_custom_target(
install-python
${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
-m ${LAMMPS_PYTHON_DIR}/lammps.py
-p ${LAMMPS_PYTHON_DIR}/lammps
-l ${CMAKE_BINARY_DIR}/liblammps${CMAKE_SHARED_LIBRARY_SUFFIX}
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
COMMENT "Installing LAMMPS Python module")
@ -691,11 +692,8 @@ if(BUILD_SHARED_LIBS OR PKG_PYTHON)
find_package(Python COMPONENTS Interpreter)
endif()
if (Python_EXECUTABLE)
execute_process(COMMAND ${Python_EXECUTABLE}
-c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE PYTHON_DEFAULT_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PYTHON_INSTDIR ${PYTHON_DEFAULT_INSTDIR} CACHE PATH "Installation folder for LAMMPS Python module")
install(FILES ${LAMMPS_PYTHON_DIR}/lammps.py DESTINATION ${PYTHON_INSTDIR})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python)
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py build -b ${CMAKE_BINARY_DIR}/python install --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR}/ WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR})")
endif()
endif()
@ -739,14 +737,14 @@ if(OPTIONS)
endif()
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
list (FIND LANGUAGES "Fortran" _index)
if (${_index} GREATER -1)
if(${_index} GREATER -1)
message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER}
Type: ${CMAKE_Fortran_COMPILER_ID}
Version: ${CMAKE_Fortran_COMPILER_VERSION}
Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
endif()
list (FIND LANGUAGES "C" _index)
if (${_index} GREATER -1)
if(${_index} GREATER -1)
message(STATUS "C compiler: ${CMAKE_C_COMPILER}
Type: ${CMAKE_C_COMPILER_ID}
Version: ${CMAKE_C_COMPILER_VERSION}

View File

@ -8,7 +8,7 @@ else()
find_package(Python3 COMPONENTS Interpreter QUIET)
endif()
if (Python3_EXECUTABLE)
if(Python3_EXECUTABLE)
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
add_custom_target(
check-whitespace

View File

@ -0,0 +1,30 @@
# Find the Cythonize tool.
#
# This code sets the following variables:
#
# Cythonize_EXECUTABLE
#
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
#=============================================================================
if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12
if(PYTHONINTERP_FOUND)
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
else()
find_package(Python3 3.6 COMPONENTS Interpreter QUIET)
endif()
# Use the Cython executable that lives next to the Python executable
# if it is a local installation.
if(Python3_EXECUTABLE)
get_filename_component(_python_path ${Python3_EXECUTABLE} PATH)
find_program(Cythonize_EXECUTABLE
NAMES cythonize3 cythonize cythonize.bat
HINTS ${_python_path})
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cythonize REQUIRED_VARS Cythonize_EXECUTABLE)
mark_as_advanced(Cythonize_EXECUTABLE)

View File

@ -50,6 +50,7 @@ function(check_for_autogen_files source_dir)
file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h)
file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
foreach(_SRC ${SRC_AUTOGEN_FILES})
get_filename_component(FILENAME "${_SRC}" NAME)
if(EXISTS ${source_dir}/${FILENAME})

View File

@ -1,7 +1,7 @@
# Download and configure custom MPICH files for Windows
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
include(ExternalProject)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
ExternalProject_Add(mpi4win_build
URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz
URL_MD5 4939fdb59d13182fd5dd65211e469f14

View File

@ -19,6 +19,8 @@ if(CURL_FOUND)
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
endif()
endif()
set(KIM_EXTRA_UNITTESTS OFF CACHE STRING "Set extra unit tests verbose mode on/off. If on, extra tests are included.")
mark_as_advanced(KIM_EXTRA_UNITTESTS)
find_package(PkgConfig QUIET)
set(DOWNLOAD_KIM_DEFAULT ON)
if(PKG_CONFIG_FOUND)
@ -34,8 +36,8 @@ if(DOWNLOAD_KIM)
enable_language(C)
enable_language(Fortran)
ExternalProject_Add(kim_build
URL https://s3.openkim.org/kim-api/kim-api-2.2.0.txz
URL_MD5 e7f944e1593cffd7444679a660607f6c
URL https://s3.openkim.org/kim-api/kim-api-2.2.1.txz
URL_MD5 ae1ddda2ef7017ea07934e519d023dca
BINARY_DIR build
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}

View File

@ -0,0 +1,31 @@
# if PYTHON package is included we may also include Python support in MLIAP
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
if(PKG_PYTHON)
find_package(Cythonize)
if(Cythonize_FOUND)
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
endif()
endif()
option(MLIAP_ENABLE_PYTHON "Build MLIAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
if(MLIAP_ENABLE_PYTHON)
find_package(Cythonize REQUIRED)
if(NOT PKG_PYTHON)
message(FATAL_ERROR "Must enable PYTHON package for including Python support in MLIAP")
endif()
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/MLIAP/mliap_model_python_couple.pyx)
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_SRC} NAME_WE)
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
COMMENT "Generating C++ sources with cythonize...")
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
endif()

View File

@ -55,8 +55,8 @@ if(DOWNLOAD_PLUMED)
endif()
include(ExternalProject)
ExternalProject_Add(plumed_build
URL https://github.com/plumed/plumed2/releases/download/v2.6.1/plumed-src-2.6.1.tgz
URL_MD5 89a9a450fc6025299fe16af235957163
URL https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz
URL_MD5 95f29dd0c067577f11972ff90dfc7d12
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
${CONFIGURE_REQUEST_PIC}

16
cmake/presets/pgi.cmake Normal file
View File

@ -0,0 +1,16 @@
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER "pgfortran" CACHE STRING "" FORCE)
set(MPI_CXX "pgc++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "pgcc" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-mp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_CXX "pgc++" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-mp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)

View File

@ -229,7 +229,7 @@ $(VENV):
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
. $(VENV)/bin/activate; \
pip install --upgrade pip; \
pip install --use-feature=2020-resolver -r $(BUILDDIR)/utils/requirements.txt; \
pip install -r $(BUILDDIR)/utils/requirements.txt; \
deactivate;\
)

View File

@ -1,4 +1,4 @@
.TH LAMMPS "30 November 2020" "2020-10-29"
.TH LAMMPS "24 December 2020" "2020-12-24"
.SH NAME
.B LAMMPS
\- Molecular Dynamics Simulator.

View File

@ -236,12 +236,15 @@ LAMMPS.
cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort
# Building with LLVM/Clang Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
# Building with PGI/Nvidia Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=pgcc -DCMAKE_CXX_COMPILER=pgc++ -DCMAKE_Fortran_COMPILER=pgfortran
For compiling with the Clang/LLVM compilers a CMake preset is
provided that can be loaded with
`-C ../cmake/presets/clang.cmake`. Similarly,
`-C ../cmake/presets/intel.cmake` should switch the compiler
toolchain to the Intel compilers.
toolchain to the Intel compilers and `-C ../cmake/presets/pgi.cmake`
should switch the compiler to the PGI compilers.
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
compiler flags to tune for optimal performance on given hosts. By

View File

@ -37,6 +37,7 @@ This is the list of packages that may require additional steps.
* :ref:`KOKKOS <kokkos>`
* :ref:`LATTE <latte>`
* :ref:`MESSAGE <message>`
* :ref:`MLIAP <mliap>`
* :ref:`MSCG <mscg>`
* :ref:`OPT <opt>`
* :ref:`POEMS <poems>`
@ -282,6 +283,7 @@ minutes to hours) to build. Of course you only need to do that once.)
-D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes
-D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on
-D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes
-D KIM_EXTRA_UNITTESTS=value # enables extra unit tests, value = no (default) or yes
If ``DOWNLOAD_KIM`` is set to *yes* (or *on*), the KIM API library
will be downloaded and built inside the CMake build directory. If
@ -290,6 +292,11 @@ minutes to hours) to build. Of course you only need to do that once.)
``PKG_CONFIG_PATH`` environment variable so that libkim-api can be
found, or run the command ``source kim-api-activate``.
Extra unit tests can only be available if they are explicitly requested
(``KIM_EXTRA_UNITTESTS`` is set to *yes* (or *on*)) and the prerequisites
are met. See :ref:`KIM Extra unit tests <kim_extra_unittests>` for
more details on this.
.. tab:: Traditional make
You can download and build the KIM library manually if you prefer;
@ -338,6 +345,38 @@ specify your own CA cert path by setting the environment variable
``CURL_CA_BUNDLE`` to the path of your choice. A call to the KIM web
query would get this value from the environment variable.
.. _kim_extra_unittests:
KIM Extra unit tests (CMake only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
During development, testing, or debugging, if
:doc:`unit testing <Build_development>` is enabled in LAMMPS, one can also
enable extra tests on :doc:`KIM commands <kim_commands>` by setting the
``KIM_EXTRA_UNITTESTS`` to *yes* (or *on*).
Enabling the extra unit tests have some requirements,
* It requires to have internet access.
* It requires to have libcurl installed with the matching development headers
and the curl-config tool.
* It requires to build LAMMPS with the PYTHON package installed and linked to
Python 3.6 or later. See the :ref:`PYTHON package build info <python>` for
more details on this.
* It requires to have ``kim-property`` Python package installed, which can be
easily done using *pip* as ``pip install kim-property``, or from the
*conda-forge* channel as ``conda install kim-property`` if LAMMPS is built in
Conda. More detailed information is available at:
`kim-property installation <https://github.com/openkim/kim-property#installing-kim-property>`_.
* It is also necessary to install
``EAM_Dynamo_Mendelev_2007_Zr__MO_848899341753_000``, and
``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005`` KIM models.
See `Obtaining KIM Models <http://openkim.org/doc/usage/obtaining-models>`_
to learn how to install a pre-build binary of the OpenKIM Repository of
Models or see
`Installing KIM Models <https://openkim.org/doc/usage/obtaining-models/#installing_models>`_
to learn how to install the specific KIM models.
----------
.. _kokkos:
@ -732,6 +771,54 @@ be installed on your system.
----------
.. _mliap:
MLIAP package
---------------------------
Building the MLIAP package requires including the :ref:`SNAP <PKG-SNAP>`
package. There will be an error message if this requirement is not satisfied.
Using the *mliappy* model also requires enabling Python support, which
in turn requires the :ref:`PYTHON <PKG-PYTHON>`
package **and** requires you have the `cython <https://cython.org>`_ software
installed and with it a working ``cythonize`` command. This feature requires
compiling LAMMPS with Python version 3.6 or later.
.. tabs::
.. tab:: CMake build
.. code-block:: bash
-D MLIAP_ENABLE_PYTHON=value # enable mliappy model (default is autodetect)
Without this setting, CMake will check whether it can find a
suitable Python version and the ``cythonize`` command and choose
the default accordingly. During the build procedure the provided
.pyx file(s) will be automatically translated to C++ code and compiled.
Please do **not** run ``cythonize`` manually in the ``src/MLIAP`` folder,
as that can lead to compilation errors if Python support is not enabled.
If you did by accident, please remove the generated .cpp and .h files.
.. tab:: Traditional make
The build uses the ``lib/python/Makefile.mliap_python`` file in the
compile/link process to add a rule to update the files generated by
the ``cythonize`` command in case the corresponding .pyx file(s) were
modified. You may need to modify ``lib/python/Makefile.lammps``
if the LAMMPS build fails.
To manually enforce building MLIAP with Python support enabled,
you can add
``-DMLIAP_PYTHON`` to the ``LMP_INC`` variable in your machine makefile.
You may have to manually run the ``cythonize`` command on .pyx file(s)
in the ``src`` folder, if this is not automatically done during
installing the MLIAP package. Please do **not** run ``cythonize``
in the ``src/MLIAP`` folder, as that can lead to compilation errors
if Python support is not enabled.
If you did by accident, please remove the generated .cpp and .h files.
----------
.. _mscg:
MSCG package

View File

@ -160,6 +160,7 @@ one of them as a starting point and customize it to your needs.
cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default
cmake -C ../cmake/presets/gcc.cmake [OPTIONS] ../cmake # change settings to use the GNU compilers by default
cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake # change settings to use the Intel compilers by default
cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake # change settings to use the PGI compilers by default
cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers

View File

@ -221,6 +221,8 @@ OPT.
* :doc:`temp/rescale <fix_temp_rescale>`
* :doc:`temp/rescale/eff <fix_temp_rescale_eff>`
* :doc:`tfmc <fix_tfmc>`
* :doc:`tgnpt/drude <fix_tgnh_drude>`
* :doc:`tgnvt/drude <fix_tgnh_drude>`
* :doc:`thermal/conductivity <fix_thermal_conductivity>`
* :doc:`ti/spring <fix_ti_spring>`
* :doc:`tmd <fix_tmd>`

View File

@ -13,6 +13,7 @@ of time and requests from the LAMMPS user community.
Developer_org
Developer_flow
Developer_write
Developer_notes
Developer_unittest
Classes
Developer_utils

105
doc/src/Developer_notes.rst Normal file
View File

@ -0,0 +1,105 @@
Notes for Developers and Code Maintainers
-----------------------------------------
This section documents how a few large sections of code with LAMMPS
work at a conceptual level. Comments on code in source files
typically document what a variable stores, what a small section of
code does, or what a function does or its input/outputs. The topics
on this page are intended to document code at a higher level.
KSpace PPPM FFT grids
^^^^^^^^^^^^^^^^^^^^^
The various :doc:`KSpace PPPM <kspace_style>` styles in LAMMPS use
FFTs to solve Poisson's equation. This subsection describes:
* how FFT grids are defined
* how they are decomposed across processors
* how they are indexed by each processor
* how particle charge and electric field values are mapped to/from
the grid
An FFT grid cell is a 3d volume; grid points are corners of a grid
cell and the code stores values assigned to grid points in vectors or
3d arrays. A global 3d FFT grid has points indexed 0 to N-1 inclusive
in each dimension.
Each processor owns two subsets of the grid, each subset is
brick-shaped. Depending on how it is used, these subsets are
allocated as a 1d vector or 3d array. Either way, the ordering of
values within contiguous memory x fastest, then y, z slowest.
For the ``3d decomposition`` of the grid, the global grid is
partitioned into bricks that correspond to the sub-domains of the
simulation box that each processor owns. Often, this is a regular 3d
array (Px by Py by Pz) of bricks, where P = number of processors =
Px * Py * Pz. More generally it can be a tiled decomposition, where
each processor owns a brick and the union of all the bricks is the
global grid. Tiled decompositions are produced by load balancing with
the RCB algorithm; see the :doc:`balance rcb <balance>` command.
For the ``FFT decompostion`` of the grid, each processor owns a brick
that spans the entire x dimension of the grid while the y and z
dimensions are partitioned as a regular 2d array (P1 by P2), where P =
P1 * P2.
The following indices store the inclusive bounds of the brick a
processor owns, within the global grid:
.. parsed-literal::
nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in = 3d decomposition brick
nxlo_fft,nxhi_fft,nylo_fft,nyhi_fft,nzlo_fft,nzhi_fft = FFT decomposition brick
nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out = 3d decomposition brick + ghost cells
The ``in`` and ``fft`` indices are from 0 to N-1 inclusive in each
dimension, where N is the grid size.
The ``out`` indices index an array which stores the ``in`` subset of
the grid plus ghost cells that surround it. These indices can thus be
< 0 or >= N.
The number of ghost cells a processor owns in each of the 6 directions
is a function of:
.. parsed-literal::
neighbor skin distance (since atoms can move outside a proc subdomain)
qdist = offset or charge from atom due to TIP4P fictitious charge
order = mapping stencil size
shift = factor used when order is an even number (see below)
Here is an explanation of how the PPPM variables ``order``,
``nlower`` / ``nupper``, ``shift``, and ``OFFSET`` work. They are the
relevant variables that determine how atom charge is mapped to grid
points and how field values are mapped from grid points to atoms:
.. parsed-literal::
order = # of nearby grid points in each dim that atom charge/field are mapped to/from
nlower,nupper = extent of stencil around the grid point an atom is assigned to
OFFSET = large integer added/subtracted when mapping to avoid int(-0.75) = 0 when -1 is the desired result
The particle_map() method assigns each atom to a grid point.
If order is even, say 4:
.. parsed-literal::
atom is assigned to grid point to its left (in each dim)
shift = OFFSET
nlower = -1, nupper = 2, which are offsets from assigned grid point
window of mapping grid pts is thus 2 grid points to left of atom, 2 to right
If order is odd, say 5:
.. parsed-literal::
atom is assigned to left/right grid pt it is closest to (in each dim)
shift = OFFSET + 0.5
nlower = 2, nupper = 2
if point is in left half of cell, then window of affected grid pts is 3 grid points to left of atom, 2 to right
if point is in right half of cell, then window of affected grid pts is 2 grid points to left of atom, 3 to right
These settings apply to each dimension, so that if order = 5, an
atom's charge is mapped to 125 grid points that surround the atom.

View File

@ -42,10 +42,11 @@ screening. It may be necessary to use the *extra/special/per/atom*
keyword of the :doc:`read_data <read_data>` command. If using :doc:`fix shake <fix_shake>`, make sure no Drude particle is in this fix
group.
There are two ways to thermostat the Drude particles at a low
There are three ways to thermostat the Drude particles at a low
temperature: use either :doc:`fix langevin/drude <fix_langevin_drude>`
for a Langevin thermostat, or :doc:`fix drude/transform/\* <fix_drude_transform>` for a Nose-Hoover
thermostat. The former requires use of the command :doc:`comm_modify vel yes <comm_modify>`. The latter requires two separate integration
thermostat, or :doc:`fix tgnvt/drude <fix_tgnh_drude>` for a temperature-grouped Nose-Hoover thermostat.
The first and third require use of the command :doc:`comm_modify vel yes <comm_modify>`. The second requires two separate integration
fixes like *nvt* or *npt*\ . The correct temperatures of the reduced
degrees of freedom can be calculated using the :doc:`compute temp/drude <compute_temp_drude>`. This requires also to use the
command *comm_modify vel yes*.

View File

@ -221,6 +221,14 @@ modification of forces but no position/velocity updates), the fix
fix NVE all nve
To avoid the flying ice cube artifact, where the atoms progressively freeze and the
center of mass of the whole system drifts faster and faster, the *fix momentum*
can be used. For instance:
.. code-block:: LAMMPS
fix MOMENTUM all momentum 100 linear 1 1 1
Finally, do not forget to update the atom type elements if you use
them in a *dump_modify ... element ...* command, by adding the element
type of the DPs. Here for instance
@ -376,14 +384,7 @@ For our phenol example, the groups would be defined as
Note that with the fixes *drude/transform*\ , it is not required to
specify *comm_modify vel yes* because the fixes do it anyway (several
times and for the forces also). To avoid the flying ice cube artifact
:ref:`(Lamoureux and Roux) <Lamoureux2>`, where the atoms progressively freeze and the
center of mass of the whole system drifts faster and faster, the *fix
momentum* can be used. For instance:
.. code-block:: LAMMPS
fix MOMENTUM all momentum 100 linear 1 1 1
times and for the forces also).
It is a bit more tricky to run a NPT simulation with Nose-Hoover
barostat and thermostat. First, the volume should be integrated only
@ -404,6 +405,31 @@ instructions for thermostatting and barostatting will look like
fix NVT DRUDES nvt temp 1. 1. 20
fix INVERSE all drude/transform/inverse
Another option for thermalizing the Drude model is to use the
temperature-grouped Nose-Hoover (TGNH) thermostat proposed by :ref:`(Son) <TGNH-SON>`.
This is implemented as :doc:`fix tgnvt/drude <fix_tgnh_drude>` and :doc:`fix tgnpt/drude <fix_tgnh_drude>`.
It separates the kinetic energy into three contributions:
the molecular center of mass (COM) motion, the motion of atoms or atom-Drude pairs relative to molecular COMs,
and the relative motion of atom-Drude pairs.
An independent Nose-Hoover chain is applied to each type of motion.
When TGNH is used, the temperatures of molecular, atomic and Drude motion can be printed out with :doc:`thermo_style` command.
NVT simulation with TGNH thermostat
.. code-block:: LAMMPS
comm_modify vel yes
fix TGNVT all tgnvt/drude temp 300. 300. 100 1. 20
thermo_style custom f_TGNVT[1] f_TGNVT[2] f_TGNVT[3]
NPT simulation with TGNH thermostat
.. code-block:: LAMMPS
comm_modify vel yes
fix TGNPT all tgnpt/drude temp 300. 300. 100 1. 20 iso 1. 1. 500
thermo_style custom f_TGNPT[1] f_TGNPT[2] f_TGNPT[3]
----------
**Rigid bodies**
@ -480,3 +506,7 @@ NPT ensemble using Nose-Hoover thermostat:
**(SWM4-NDP)** Lamoureux, Harder, Vorobyov, Roux, MacKerell, Chem Phys
Let, 418, 245-249 (2006)
.. _TGNH-Son:
**(Son)** Son, McDaniel, Cui and Yethiraj, J Phys Chem Lett, 10, 7523 (2019).

View File

@ -9,8 +9,8 @@ Overview
``PyLammps`` is a Python wrapper class for LAMMPS which can be created
on its own or use an existing lammps Python object. It creates a simpler,
more "pythonic" interface to common LAMMPS functionality, in contrast to
the ``lammps.py`` wrapper for the C-style LAMMPS library interface which
is written using `Python ctypes <ctypes_>`_. The ``lammps.py`` wrapper
the ``lammps`` wrapper for the C-style LAMMPS library interface which
is written using `Python ctypes <ctypes_>`_. The ``lammps`` wrapper
is discussed on the :doc:`Python_head` doc page.
Unlike the flat ``ctypes`` interface, PyLammps exposes a discoverable

View File

@ -662,19 +662,31 @@ MLIAP package
**Contents:**
A general interface for machine-learning interatomic potentials.
A general interface for machine-learning interatomic potentials, including PyTorch.
**Install:**
To use this package, also the :ref:`SNAP package <PKG-SNAP>` needs to be installed.
To use this package, also the :ref:`SNAP package <PKG-SNAP>` package needs
to be installed. To make the *mliappy* model available, also the
:ref:`PYTHON package <PKG-PYTHON>` package needs to be installed, the version of
Python must be 3.6 or later, and the `cython <https://cython.org/>`_ software
must be installed.
**Author:** Aidan Thompson (Sandia).
**Author:** Aidan Thompson (Sandia), Nicholas Lubbers (LANL).
**Supporting info:**
* src/MLIAP: filenames -> commands
* src/MLIAP/README
* :doc:`pair_style mliap <pair_mliap>`
* examples/mliap
* :doc:`compute_style mliap <compute_mliap>`
* examples/mliap (see README)
When built with the *mliappy* model this package includes an extension for
coupling with Python models, including PyTorch. In this case, the Python
interpreter linked to LAMMPS will need the ``cython`` and ``numpy`` modules
installed. The provided examples build models with PyTorch, which would
therefore also needs to be installed to run those examples.
----------

View File

@ -9,7 +9,7 @@ This means you can extend the Python wrapper by following these steps:
* Add a new interface function to ``src/library.cpp`` and
``src/library.h``.
* Rebuild LAMMPS as a shared library.
* Add a wrapper method to ``python/lammps.py`` for this interface
* Add a wrapper method to ``python/lammps/core.py`` for this interface
function.
* Define the corresponding ``argtypes`` list and ``restype``
in the ``lammps.__init__()`` function.

View File

@ -8,9 +8,9 @@ module. Because of the dynamic loading, it is required that LAMMPS is
compiled in :ref:`"shared" mode <exe>`. It is also recommended to
compile LAMMPS with :ref:`C++ exceptions <exceptions>` enabled.
Two files are necessary for Python to be able to invoke LAMMPS code:
Two components are necessary for Python to be able to invoke LAMMPS code:
* The LAMMPS Python Module (``lammps.py``) from the ``python`` folder
* The LAMMPS Python Package (``lammps``) from the ``python`` folder
* The LAMMPS Shared Library (``liblammps.so``, ``liblammps.dylib`` or
``liblammps.dll``) from the folder where you compiled LAMMPS.
@ -25,10 +25,10 @@ Installing the LAMMPS Python Module and Shared Library
======================================================
Making LAMMPS usable within Python and vice versa requires putting the
LAMMPS Python module file (``lammps.py``) into a location where the
LAMMPS Python package (``lammps``) into a location where the
Python interpreter can find it and installing the LAMMPS shared library
into a folder that the dynamic loader searches or into the same folder
where the ``lammps.py`` file is. There are multiple ways to achieve
into a folder that the dynamic loader searches or inside of the installed
``lammps`` package folder. There are multiple ways to achieve
this.
#. Do a full LAMMPS installation of libraries, executables, selected
@ -36,13 +36,13 @@ this.
available via CMake), which can also be either system-wide or into
user specific folders.
#. Install both files into a Python ``site-packages`` folder, either
#. Install both components into a Python ``site-packages`` folder, either
system-wide or in the corresponding user-specific folder. This way no
additional environment variables need to be set, but the shared
library is otherwise not accessible.
#. Do an installation into a virtual environment. This can either be
an installation of the python module only or a full installation.
#. Do an installation into a virtual environment. This can either be an
installation of the Python package only or a full installation of LAMMPS.
#. Leave the files where they are in the source/development tree and
adjust some environment variables.
@ -81,19 +81,19 @@ this.
This leads to an installation to the following locations:
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===========================================================+=============================================================+
| LAMMPS Python Module | * ``$HOME/.local/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$HOME/.local/lib/`` (32bit) | |
| | * ``$HOME/.local/lib64/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+========================+=================================================================+=============================================================+
| LAMMPS Python package | * ``$HOME/.local/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$HOME/.local/lib/`` (32bit) | Set shared loader environment variable to this path |
| | * ``$HOME/.local/lib64/`` (64bit) | (see below for more info on this) |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS executable | * ``$HOME/.local/bin/`` | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS potential files | * ``$HOME/.local/share/lammps/potentials/`` | Set ``LAMMPS_POTENTIALS`` environment variable to this path |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
For a system-wide installation you need to set
``CMAKE_INSTALL_PREFIX`` to a system folder like ``/usr`` (or
@ -102,19 +102,19 @@ this.
privilege, e.g. by using ``sudo cmake --install .``. The
installation folders will then by changed to:
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===================================================+=============================================================+
| LAMMPS Python Module | * ``/usr/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+========================+=========================================================+=============================================================+
| LAMMPS Python package | * ``/usr/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``/usr/lib/`` (32bit) | |
| | * ``/usr/lib64/`` (64bit) | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS executable | * ``/usr/bin/`` | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS potential files | * ``/usr/share/lammps/potentials/`` | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
To be able to use the "user" installation you have to ensure that
the folder containing the LAMMPS shared library is either included
@ -146,7 +146,7 @@ this.
necessary due to files installed in system folders that are loaded
automatically when a login shell is started.
.. tab:: Python module only
.. tab:: Python package only
Compile LAMMPS with either :doc:`CMake <Build_cmake>` or the
:doc:`traditional make <Build_make>` procedure in :ref:`shared
@ -157,37 +157,37 @@ this.
make install-python
This will try to install (only) the shared library and the python
module into a system folder and if that fails (due to missing
This will try to install (only) the shared library and the Python
package into a system folder and if that fails (due to missing
write permissions) will instead do the installation to a user
folder under ``$HOME/.local``. For a system-wide installation you
would have to gain superuser privilege, e.g. though ``sudo``
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===========================================================+=============================================================+
| LAMMPS Python Module | * ``$HOME/.local/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$HOME/.local/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+========================+=================================================================+=============================================================+
| LAMMPS Python package | * ``$HOME/.local/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$HOME/.local/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$HOME/.local/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
For a system-wide installation those folders would then become.
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===================================================+=============================================================+
| LAMMPS Python Module | * ``/usr/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``/usr/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+---------------------------------------------------+-------------------------------------------------------------+
+========================+=========================================================+=============================================================+
| LAMMPS Python package | * ``/usr/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``/usr/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``/usr/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+
No environment variables need to be set for those, as those
folders are searched by default by Python or the LAMMPS Python
module.
package.
For the traditional make process you can override the python
version to version x.y when calling ``make`` with
@ -199,9 +199,9 @@ this.
.. code-block:: bash
$ python install.py -m <python module> -l <shared library> -v <version.h file> [-d <pydir>]
$ python install.py -p <python package> -l <shared library> -v <version.h file> [-d <pydir>]
* The ``-m`` flag points to the ``lammps.py`` python module file to be installed,
* The ``-p`` flag points to the ``lammps`` Python package folder to be installed,
* the ``-l`` flag points to the LAMMPS shared library file to be installed,
* the ``-v`` flag points to the ``version.h`` file in the LAMMPS source
* and the optional ``-d`` flag to a custom (legacy) installation folder
@ -249,38 +249,38 @@ this.
When using CMake to build LAMMPS, you need to set
``CMAKE_INSTALL_PREFIX`` to the value of the ``$VIRTUAL_ENV``
environment variable during the configuration step. For the
traditional make procedure, not additional steps are needed.
After compiling LAMMPS you can do a "Python module only"
traditional make procedure, no additional steps are needed.
After compiling LAMMPS you can do a "Python package only"
installation with ``make install-python`` and the LAMMPS Python
module and the shared library file are installed into the
package and the shared library file are installed into the
following locations:
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===========================================================+=============================================================+
| LAMMPS Python Module | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+========================+=================================================================+=============================================================+
| LAMMPS Python Module | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
If you do a full installation (CMake only) with "install", this
leads to the following installation locations:
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes |
+========================+===========================================================+=============================================================+
| LAMMPS Python Module | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$VIRTUAL_ENV/lib/`` (32bit) | |
| | * ``$VIRTUAL_ENV/lib64/`` (64bit) | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+========================+=================================================================+=============================================================+
| LAMMPS Python Module | * ``$VIRTUAL_ENV/lib/pythonX.Y/site-packages/lammps`` (32bit) | ``X.Y`` depends on the installed Python version |
| | * ``$VIRTUAL_ENV/lib64/pythonX.Y/site-packages/lammps`` (64bit) | |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS shared library | * ``$VIRTUAL_ENV/lib/`` (32bit) | Set shared loader environment variable to this path |
| | * ``$VIRTUAL_ENV/lib64/`` (64bit) | (see below for more info on this) |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS executable | * ``$VIRTUAL_ENV/bin/`` | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS potential files | * ``$VIRTUAL_ENV/share/lammps/potentials/`` | |
+------------------------+-----------------------------------------------------------+-------------------------------------------------------------+
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
| LAMMPS potential files | * ``$VIRTUAL_ENV/share/lammps/potentials/`` | Set ``LAMMPS_POTENTIALS`` environment variable to this path |
+------------------------+-----------------------------------------------------------------+-------------------------------------------------------------+
In that case you need to modify the ``$HOME/myenv/bin/activate``
script in a similar fashion you need to update your
@ -296,15 +296,15 @@ this.
echo 'export LD_LIBRARY_PATH=$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH' >> $HOME/myenv/bin/activate
# MacOS
echo 'export DYLD_LIBRARY_PATH=$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH' >> $HOME/myenv/bin/activate
echo 'export DYLD_LIBRARY_PATH=$VIRTUAL_ENV/lib:$DYLD_LIBRARY_PATH' >> $HOME/myenv/bin/activate
.. tab:: In place usage
You can also :doc:`compile LAMMPS <Build>` as usual in
:ref:`"shared" mode <exe>` leave the shared library and Python
module files inside the source/compilation folders. Instead of
package inside the source/compilation folders. Instead of
copying the files where they can be found, you need to set the environment
variables ``PYTHONPATH`` (for the Python module) and
variables ``PYTHONPATH`` (for the Python package) and
``LD_LIBRARY_PATH`` (or ``DYLD_LIBRARY_PATH`` on MacOS
For Bourne shells (bash, ksh and similar) the commands are:
@ -325,6 +325,10 @@ this.
You can make those changes permanent by editing your ``$HOME/.bashrc``
or ``$HOME/.login`` files, respectively.
.. note::
The ``PYTHONPATH`` needs to point to the parent folder that contains the ``lammps`` package!
To verify if LAMMPS can be successfully started from Python, start the
Python interpreter, load the ``lammps`` Python module and create a
@ -346,7 +350,7 @@ output similar to the following:
.. note::
Unless you opted for "In place use", you will have to rerun the installation
any time you recompile LAMMPS to ensure the latest Python module and shared
any time you recompile LAMMPS to ensure the latest Python package and shared
library are installed and used.
.. note::

View File

@ -3,12 +3,12 @@ The ``lammps`` Python module
.. py:module:: lammps
The LAMMPS Python interface is implemented as a module called
:py:mod:`lammps` in the ``lammps.py`` file in the ``python`` folder of
the LAMMPS source code distribution. After compilation of LAMMPS, the
module can be installed into a Python system folder or a user folder
with ``make install-python``. Components of the module can then loaded
into a Python session with the ``import`` command.
The LAMMPS Python interface is implemented as a module called :py:mod:`lammps`
which is defined in the ``lammps`` package in the ``python`` folder of the
LAMMPS source code distribution. After compilation of LAMMPS, the module can
be installed into a Python system folder or a user folder with ``make
install-python``. Components of the module can then loaded into a Python
session with the ``import`` command.
There are multiple Python interface classes in the :py:mod:`lammps` module:
@ -44,7 +44,7 @@ functions. Below is a detailed documentation of the API.
.. autoclass:: lammps.lammps
:members:
.. autoclass:: lammps.numpy_wrapper
.. autoclass:: lammps.numpy::numpy_wrapper
:members:
----------
@ -117,8 +117,8 @@ Style Constants
to request from computes or fixes. See :cpp:enum:`_LMP_STYLE_CONST`
for the equivalent constants in the C library interface. Used in
:py:func:`lammps.extract_compute`, :py:func:`lammps.extract_fix`, and their NumPy variants
:py:func:`lammps.numpy.extract_compute() <numpy_wrapper.extract_compute>` and
:py:func:`lammps.numpy.extract_fix() <numpy_wrapper.extract_fix>`.
:py:func:`lammps.numpy.extract_compute() <lammps.numpy.numpy_wrapper.extract_compute>` and
:py:func:`lammps.numpy.extract_fix() <lammps.numpy.numpy_wrapper.extract_fix>`.
.. _py_type_constants:
@ -132,8 +132,8 @@ Type Constants
to request from computes or fixes. See :cpp:enum:`_LMP_TYPE_CONST`
for the equivalent constants in the C library interface. Used in
:py:func:`lammps.extract_compute`, :py:func:`lammps.extract_fix`, and their NumPy variants
:py:func:`lammps.numpy.extract_compute() <numpy_wrapper.extract_compute>` and
:py:func:`lammps.numpy.extract_fix() <numpy_wrapper.extract_fix>`.
:py:func:`lammps.numpy.extract_compute() <lammps.numpy.numpy_wrapper.extract_compute>` and
:py:func:`lammps.numpy.extract_fix() <lammps.numpy.numpy_wrapper.extract_fix>`.
.. _py_vartype_constants:
@ -153,6 +153,6 @@ Classes representing internal objects
:members:
:no-undoc-members:
.. autoclass:: lammps.NumPyNeighList
.. autoclass:: lammps.numpy::NumPyNeighList
:members:
:no-undoc-members:

View File

@ -2,9 +2,9 @@ Overview
========
The LAMMPS distribution includes a ``python`` directory with the Python
code needed to run LAMMPS from Python. The ``python/lammps.py``
contains :doc:`the "lammps" Python <Python_module>` that wraps the
LAMMPS C-library interface. This file makes it is possible to do the
code needed to run LAMMPS from Python. The ``python/lammps`` package
contains :doc:`the "lammps" Python module <Python_module>` that wraps the
LAMMPS C-library interface. This module makes it is possible to do the
following either from a Python script, or interactively from a Python
prompt:
@ -20,8 +20,8 @@ have a version of Python that extends Python to enable multiple
instances of Python to read what you type.
To do all of this, you must build LAMMPS in :ref:`"shared" mode <exe>`
and make certain that your Python interpreter can find the ``lammps.py``
file and the LAMMPS shared library file.
and make certain that your Python interpreter can find the ``lammps``
Python package and the LAMMPS shared library file.
.. _ctypes: https://docs.python.org/3/library/ctypes.html

View File

@ -33,7 +33,7 @@ the constructor call as follows (see :ref:`python_create_lammps` for more detail
>>> lmp = lammps(name='mpi')
You can also test the load directly in Python as follows, without
first importing from the lammps.py file:
first importing from the ``lammps`` module:
.. code-block:: python

View File

@ -38,14 +38,14 @@ produce an executable compatible with a specific hardware.
:class: note
Kokkos with CUDA currently implicitly assumes that the MPI library is
CUDA-aware. This is not always the case, especially when using
GPU-aware. This is not always the case, especially when using
pre-compiled MPI libraries provided by a Linux distribution. This is
not a problem when using only a single GPU with a single MPI
rank. When running with multiple MPI ranks, you may see segmentation
faults without CUDA-aware MPI support. These can be avoided by adding
the flags :doc:`-pk kokkos cuda/aware off <Run_options>` to the
faults without GPU-aware MPI support. These can be avoided by adding
the flags :doc:`-pk kokkos gpu/aware off <Run_options>` to the
LAMMPS command line or by using the command :doc:`package kokkos
cuda/aware off <package>` in the input file.
gpu/aware off <package>` in the input file.
.. admonition:: AMD GPU support
:class: note
@ -242,8 +242,8 @@ case, also packing/unpacking communication buffers on the host may give
speedup (see the KOKKOS :doc:`package <package>` command). Using CUDA MPS
is recommended in this scenario.
Using a CUDA-aware MPI library is highly recommended. CUDA-aware MPI use can be
avoided by using :doc:`-pk kokkos cuda/aware no <package>`. As above for
Using a GPU-aware MPI library is highly recommended. GPU-aware MPI use can be
avoided by using :doc:`-pk kokkos gpu/aware off <package>`. As above for
multi-core CPUs (and no GPU), if N is the number of physical cores/node,
then the number of MPI tasks/node should not exceed N.

View File

@ -288,7 +288,7 @@ adjacent planes are closer together than the neighbor skin distance
(as specified by the :doc`neigh_modify <neigh_modify>` command), then
the plane positions are shifted to separate them by at least this
amount. This is to prevent particles being lost when dynamics are run
with processor subdomains that are too narrow in one or more
with processor sub-domains that are too narrow in one or more
dimensions.
Once the re-balancing is complete and final processor sub-domains

View File

@ -84,13 +84,15 @@ information is available, then also a heuristic based on that bond length
is computed. It is used as communication cutoff, if there is no pair
style present and no *comm_modify cutoff* command used. Otherwise a
warning is printed, if this bond based estimate is larger than the
communication cutoff used. A
communication cutoff used.
The *cutoff/multi* option is equivalent to *cutoff*\ , but applies to
communication mode *multi* instead. Since in this case the communication
cutoffs are determined per atom type, a type specifier is needed and
cutoff for one or multiple types can be extended. Also ranges of types
using the usual asterisk notation can be given.
using the usual asterisk notation can be given. For granular pair styles,
the default cutoff is set to the sum of the current maximum atomic radii
for each type.
These are simulation scenarios in which it may be useful or even
necessary to set a ghost cutoff > neighbor cutoff:

View File

@ -18,7 +18,7 @@ Syntax
.. parsed-literal::
*model* values = style
style = *linear* or *quadratic*
style = *linear* or *quadratic* or *mliappy*
*descriptor* values = style filename
style = *sna*
filename = name of file containing descriptor definitions
@ -56,13 +56,15 @@ and it is also straightforward to add new descriptor styles.
The compute *mliap* command must be followed by two keywords
*model* and *descriptor* in either order.
The *model* keyword is followed by a model style, currently limited to
either *linear* or *quadratic*.
The *model* keyword is followed by the model style (*linear*, *quadratic* or *mliappy*).
The *mliappy* model is only available
if lammps is built with MLIAPPY package.
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
Currently the only descriptor style is *sna*, indicating the bispectrum component
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
:doc:`pair_style snap <pair_snap>`.
The compute currently supports just one descriptor style, but it is
is straightforward to add new descriptor styles.
The SNAP descriptor style *sna* is the same as that used by :doc:`pair_style snap <pair_snap>`,
including the linear, quadratic, and chem variants.
A single additional argument specifies the descriptor filename
containing the parameters and setting used by the SNAP descriptor.
The descriptor filename usually ends in the *.mliap.descriptor* extension.
@ -162,9 +164,10 @@ potentials, see the examples in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.
Restrictions
""""""""""""
This compute is part of the MLIAP package. It is only enabled if
LAMMPS was built with that package. In addition, building LAMMPS with the MLIAP package
This compute is part of the MLIAP package. It is only enabled if LAMMPS
was built with that package. In addition, building LAMMPS with the MLIAP package
requires building LAMMPS with the SNAP package.
The *mliappy* model requires building LAMMPS with the PYTHON package.
See the :doc:`Build package <Build_package>` doc page for more info.
Related commands

View File

@ -115,8 +115,8 @@ The optional keyword *chunksize* is only applicable when using the
the KOKKOS package and is ignored otherwise. This keyword controls
the number of atoms in each pass used to compute the bond-orientational
order parameters and is used to avoid running out of memory. For example
if there are 4000 atoms in the simulation and the *chunksize*
is set to 2000, the parameter calculation will be broken up
if there are 32768 atoms in the simulation and the *chunksize*
is set to 16384, the parameter calculation will be broken up
into two passes.
The value of :math:`Q_l` is set to zero for atoms not in the
@ -193,7 +193,7 @@ Default
The option defaults are *cutoff* = pair style cutoff, *nnn* = 12,
*degrees* = 5 4 6 8 10 12 i.e. :math:`Q_4`, :math:`Q_6`, :math:`Q_8`, :math:`Q_{10}`, and :math:`Q_{12}`,
*wl* = no, *wl/hat* = no, *components* off, and *chunksize* = 2000
*wl* = no, *wl/hat* = no, *components* off, and *chunksize* = 16384
----------

View File

@ -364,6 +364,8 @@ accelerated styles exist.
* :doc:`temp/rescale <fix_temp_rescale>` - temperature control by velocity rescaling
* :doc:`temp/rescale/eff <fix_temp_rescale_eff>` - temperature control by velocity rescaling in the electron force field model
* :doc:`tfmc <fix_tfmc>` - perform force-bias Monte Carlo with time-stamped method
* :doc:`tgnvt/drude <fix_tgnh_drude>` - NVT time integration for Drude polarizable model via temperature-grouped Nose-Hoover
* :doc:`tgnpt/drude <fix_tgnh_drude>` - NPT time integration for Drude polarizable model via temperature-grouped Nose-Hoover
* :doc:`thermal/conductivity <fix_thermal_conductivity>` - Muller-Plathe kinetic energy exchange for thermal conductivity calculation
* :doc:`ti/spring <fix_ti_spring>` -
* :doc:`tmd <fix_tmd>` - guide a group of atoms to a new configuration

View File

@ -93,7 +93,7 @@ from a compute, fix, or variable, then see the :doc:`fix ave/chunk <fix_ave_chun
:doc:`fix ave/histo <fix_ave_histo>` commands. If you wish to convert a
per-atom quantity into a single global value, see the :doc:`compute reduce <compute_reduce>` command.
The input values must either be all scalars. What kinds of
The input values must be all scalars. What kinds of
correlations between input values are calculated is determined by the
*type* keyword as discussed below.

View File

@ -457,6 +457,23 @@ 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.
By default, all constraints must be satisfied for the reaction to
occur. In other words, constraints are evaluated as a series of
logical values using the logical AND operator "&&". More complex logic
can be achieved by explicitly adding the logical AND operator "&&" or
the logical OR operator "||" after a given constraint command. If a
logical operator is specified after a constraint, it must be placed
after all constraint parameters, on the same line as the constraint
(one per line). Similarly, parentheses can be used to group
constraints. The expression that results from concatenating all
constraints should be a valid logical expression that can be read by
the :doc:`variable <variable>` command after converting each
constraint to a logical value. Because exactly one constraint is
allowed per line, having a valid logical expression implies that left
parentheses "(" should only appear before a constraint, and right
parentheses ")" should only appear after a constraint and before any
logical operator.
Once a reaction site has been successfully identified, data structures
within LAMMPS that store bond topology are updated to reflect the
post-reacted molecule template. All force fields with fixed bonds,
@ -599,8 +616,8 @@ reset_mol_ids = yes, custom_charges = no, molecule = off
.. _Gissinger:
**(Gissinger)** Gissinger, Jensen and Wise, Polymer, 128, 211 (2017).
**(Gissinger)** Gissinger, Jensen and Wise, Polymer, 128, 211-217 (2017).
.. _Gissinger2020:
**(Gissinger)** Gissinger, Jensen and Wise, Macromolecules (2020, in press).
**(Gissinger)** Gissinger, Jensen and Wise, Macromolecules, 53, 22, 99539961 (2020).

View File

@ -41,12 +41,12 @@ Restrictions
""""""""""""
This fix should be invoked before any other commands that implement
the Drude oscillator model, such as :doc:`fix langevin/drude <fix_langevin_drude>`, :doc:`fix drude/transform <fix_drude_transform>`, :doc:`compute temp/drude <compute_temp_drude>`, :doc:`pair_style thole <pair_thole>`.
the Drude oscillator model, such as :doc:`fix langevin/drude <fix_langevin_drude>`, :doc:`fix tgnvt/drude <fix_tgnh_drude>`, :doc:`fix drude/transform <fix_drude_transform>`, :doc:`compute temp/drude <compute_temp_drude>`, :doc:`pair_style thole <pair_thole>`.
Related commands
""""""""""""""""
:doc:`fix langevin/drude <fix_langevin_drude>`, :doc:`fix drude/transform <fix_drude_transform>`, :doc:`compute temp/drude <compute_temp_drude>`, :doc:`pair_style thole <pair_thole>`
:doc:`fix langevin/drude <fix_langevin_drude>`, :doc:`fix tgnvt/drude <fix_tgnh_drude>`, :doc:`fix drude/transform <fix_drude_transform>`, :doc:`compute temp/drude <compute_temp_drude>`, :doc:`pair_style thole <pair_thole>`
Default
"""""""

View File

@ -124,6 +124,19 @@ temperature is calculated taking the bias into account, bias is
removed from each atom, thermostatting is performed on the remaining
thermal degrees of freedom, and the bias is added back in.
An important feature of these thermostats is that they have an
associated effective energy that is a constant of motion.
The effective energy is the total energy (kinetic + potential) plus
the accumulated kinetic energy changes due to the thermostat. The
latter quantity is the global scalar computed by these fixes. This
feature is useful to check the integration of the equations of motion
against discretization errors. In other words, the conservation of
the effective energy can be used to choose an appropriate integration
:doc:`timestep <timestep>`. This is similar to the usual paradigm of
checking the conservation of the total energy in the microcanonical
ensemble.
----------
Restart, fix_modify, output, run start/stop, minimize info

305
doc/src/fix_tgnh_drude.rst Normal file
View File

@ -0,0 +1,305 @@
.. index:: fix tgnvt/drude
.. index:: fix tgnpt/drude
fix tgnvt/drude command
=======================
fix tgnpt/drude command
=======================
Syntax
""""""
.. parsed-literal::
fix ID group-ID style_name keyword values ...
* ID, group-ID are documented in :doc:`fix <fix>` command
* style_name = *tgnvt/drude* or *tgnpt/drude*
* one or more keyword/values pairs may be appended
.. parsed-literal::
keyword = *temp* *iso* or *aniso* or *tri* or *x* or *y* or *z* or *xy* or *yz* or *xz* or *couple* or *tchain* or *pchain* or *mtk* or *tloop* or *ploop* or *nreset* or *scalexy* or *scaleyz* or *scalexz* or *flip* or *fixedpoint*
*temp* values = Tstart Tstop Tdamp Tdrude Tdamp_drude
Tstart, Tstop = external temperature at start/end of run (temperature units)
Tdamp = temperature damping parameter (time units)
Tdrude = desired temperature of Drude oscillators (temperature units)
Tdamp_drude = temperature damping parameter for Drude oscillators (time units)
*iso* or *aniso* or *tri* values = Pstart Pstop Pdamp
Pstart,Pstop = scalar external pressure at start/end of run (pressure units)
Pdamp = pressure damping parameter (time units)
*x* or *y* or *z* or *xy* or *yz* or *xz* values = Pstart Pstop Pdamp
Pstart,Pstop = external stress tensor component at start/end of run (pressure units)
Pdamp = stress damping parameter (time units)
*couple* = *none* or *xyz* or *xy* or *yz* or *xz*
*tchain* value = N
N = length of thermostat chain (1 = single thermostat)
*pchain* value = N
N length of thermostat chain on barostat (0 = no thermostat)
*mtk* value = *yes* or *no* = add in MTK adjustment term or not
*tloop* value = M
M = number of sub-cycles to perform on thermostat
*ploop* value = M
M = number of sub-cycles to perform on barostat thermostat
*nreset* value = reset reference cell every this many timesteps
*scalexy* value = *yes* or *no* = scale xy with ly
*scaleyz* value = *yes* or *no* = scale yz with lz
*scalexz* value = *yes* or *no* = scale xz with lz
*flip* value = *yes* or *no* = allow or disallow box flips when it becomes highly skewed
*fixedpoint* values = x y z
x,y,z = perform barostat dilation/contraction around this point (distance units)
Examples
""""""""
.. code-block:: LAMMPS
comm_modify vel yes
fix 1 all tgnvt/drude temp 300.0 300.0 100.0 1.0 20.0
fix 1 water tgnpt/drude temp 300.0 300.0 100.0 1.0 20.0 iso 0.0 0.0 1000.0
fix 2 jello tgnpt/drude temp 300.0 300.0 100.0 1.0 20.0 tri 5.0 5.0 1000.0
fix 2 ice tgnpt/drude temp 250.0 250.0 100.0 1.0 20.0 x 1.0 1.0 0.5 y 2.0 2.0 0.5 z 3.0 3.0 0.5 yz 0.1 0.1 0.5 xz 0.2 0.2 0.5 xy 0.3 0.3 0.5 nreset 1000
Description
"""""""""""
These commands are variants of the Nose-Hoover fix styles :doc:`fix nvt
<fix_nh>` and :doc:`fix npt <fix_nh>` for thermalized Drude polarizable
models. They apply temperature-grouped Nose-Hoover thermostat (TGNH)
proposed by :ref:`(Son) <tgnh-Son>`. When there are fast vibrational
modes with frequencies close to Drude oscillators (e.g. double bonds or
out-of-plane torsions), this thermostat can provide better kinetic
energy equipartitioning.
The difference between TGNH and the original Nose-Hoover thermostat is that,
TGNH separates the kinetic energy of the group into three contributions:
molecular center of mass (COM) motion,
motion of COM of atom-Drude pairs or non-polarizable atoms relative to molecular COM,
and relative motion of atom-Drude pairs.
An independent Nose-Hoover chain is applied to each type of motion.
The temperatures for these three types of motion are denoted as
molecular translational temperature (:math:`T_\mathrm{M}`), real atomic temperature (:math:`T_\mathrm{R}`) and Drude temperature (:math:`T_\mathrm{D}`),
which are defined in terms of their associated degrees of freedom (DOF):
.. math::
T_\mathrm{M}=\frac{\Sigma_{i}^{N_\mathrm{mol}} M_i V_i^2}{3 \left ( N_\mathrm{mol} - \frac{N_\mathrm{mol}}{N_\mathrm{mol,sys}} \right ) k_\mathrm{B}}
.. math::
T_\mathrm{R}=\frac{\Sigma_{i}^{N_\mathrm{real}} m_i (v_i-v_{M,i})^2}{(N_\mathrm{DOF} - 3 N_\mathrm{mol} + 3 \frac{N_\mathrm{mol}}{N_\mathrm{mol,sys}} - 3 N_\mathrm{drude}) k_\mathrm{B}}
.. math::
T_\mathrm{D}=\frac{\Sigma_{i}^{N_\mathrm{drude}} m_i^{\prime} v_i^{\prime 2}}{3 N_\mathrm{drude} k_\mathrm{B}}
Here :math:`N_\mathrm{mol}` and :math:`N_\mathrm{mol,sys}` are the numbers of molecules in the group and in the whole system, respectively.
:math:`N_\mathrm{real}` is the number of atom-Drude pairs and non-polarizable atoms in the group.
:math:`N_\mathrm{drude}` is the number of Drude particles in the group.
:math:`N_\mathrm{DOF}` is the DOF of the group.
:math:`M_i` and :math:`V_i` are the mass and the COM velocity of the i-th molecule.
:math:`m_i` is the mass of the i-th atom-Drude pair or non-polarizable atom.
:math:`v_i` is the velocity of COM of i-th atom-Drude pair or non-polarizable atom.
:math:`v_{M,i}` is the COM velocity of the molecule the i-th atom-Drude pair or non-polarizable atom belongs to.
:math:`m_i^\prime` and :math:`v_i^\prime` are the reduced mass and the relative velocity of the i-th atom-Drude pair.
.. note::
These fixes require that each atom knows whether it is a Drude particle or
not. You must therefore use the :doc:`fix drude <fix_drude>` command to
specify the Drude status of each atom type.
Because the TGNH thermostat thermostats the molecular COM motion,
all atoms belonging to the same molecule must be in the same group.
That is, these fixes can not be applied to a subset of a molecule.
For this fix to act correctly, ghost atoms need to know their velocity.
You must use the :doc:`comm_modify <comm_modify>` command to enable this.
These fixes assume that the translational DOF of the whole system is removed.
It is therefore recommended to invoke :doc:`fix momentum <fix_momentum>` command so that the :math:`T_\mathrm{M}` is calculated correctly.
----------
The thermostat parameters are specified using the *temp* keyword.
The thermostat is applied to only the translational DOF
for the particles. The translational DOF can also have
a bias velocity removed before thermostatting takes place; see the
description below. The desired temperature for molecular and real atomic motion is a
ramped value during the run from *Tstart* to *Tstop*\ . The *Tdamp*
parameter is specified in time units and determines how rapidly the
temperature is relaxed. For example, a value of 10.0 means to relax
the temperature in a timespan of (roughly) 10 time units (e.g. :math:`\tau`
or fs or ps - see the :doc:`units <units>` command).
The parameter *Tdrude* is the desired temperature for Drude motion at each timestep.
Similar to *Tdamp*, the *Tdamp_drude* parameter determines the relaxation speed for Drude motion.
Fix group are the only ones whose velocities and positions are updated
by the velocity/position update portion of the integration.
Other thermostat-related keywords are *tchain*\ and *tloop*\ ,
which are detailed in :doc:`fix nvt <fix_nh>`.
.. note::
A Nose-Hoover thermostat will not work well for arbitrary values
of *Tdamp*\ . If *Tdamp* is too small, the temperature can fluctuate
wildly; if it is too large, the temperature will take a very long time
to equilibrate. A good choice for many models is a *Tdamp* of around
100 timesteps. A smaller *Tdamp_drude* value would be required
to maintain Drude motion at low temperature.
.. code-block:: LAMMPS
fix 1 all nvt temp 300.0 300.0 $(100.0*dt) 1.0 $(20.0*dt)
----------
The barostat parameters for fix style *tgnpt/drude* is specified
using one or more of the *iso*\ , *aniso*\ , *tri*\ , *x*\ , *y*\ , *z*\ , *xy*\ ,
*xz*\ , *yz*\ , and *couple* keywords. These keywords give you the
ability to specify all 6 components of an external stress tensor, and
to couple various of these components together so that the dimensions
they represent are varied together during a constant-pressure
simulation. Other barostat-related keywords are *pchain*\ , *mtk*\ , *ploop*\ ,
*nreset*\ , *scalexy*\ , *scaleyz*\ , *scalexz*\ , *flip*\ and *fixedpoint*.
The meaning of barostat parameters are detailed in :doc:`fix npt <fix_nh>`.
Regardless of what atoms are in the fix group (the only atoms which
are time integrated), a global pressure or stress tensor is computed
for all atoms. Similarly, when the size of the simulation box is
changed, all atoms are re-scaled to new positions.
.. note::
Unlike the :doc:`fix temp/berendsen <fix_temp_berendsen>` command
which performs thermostatting but NO time integration, these fixes
perform thermostatting/barostatting AND time integration. Thus you
should not use any other time integration fix, such as :doc:`fix nve <fix_nve>` on atoms to which this fix is applied.
Likewise, these fixes should not be used on atoms that also
have their temperature controlled by another fix - e.g. by :doc:`fix langevin/drude <fix_langevin_drude>` command.
See the :doc:`Howto thermostat <Howto_thermostat>` and :doc:`Howto barostat <Howto_barostat>` doc pages for a discussion of different
ways to compute temperature and perform thermostatting and
barostatting.
----------
Like other fixes that perform thermostatting, these fixes can
be used with :doc:`compute commands <compute>` that calculate a
temperature after removing a "bias" from the atom velocities.
This is not done by default, but only if the :doc:`fix_modify <fix_modify>` command
is used to assign a temperature compute to this fix that includes such
a bias term. See the doc pages for individual :doc:`compute commands <compute>` to determine which ones include a bias. In
this case, the thermostat works in the following manner: the current
temperature is calculated taking the bias into account, bias is
removed from each atom, thermostatting is performed on the remaining
thermal DOF, and the bias is added back in.
.. note::
However, not all temperature compute commands are valid to be used with these fixes.
Precisely, only temperature compute that does not modify the DOF of the group can be used.
E.g. :doc:`compute temp/ramp <compute_temp_ramp>` and :doc:`compute viscosity/cos <compute_viscosity_cos>`
compute the kinetic energy after remove a velocity gradient without affecting the DOF of the group,
then they can be invoked in this way.
In contrast, :doc:`compute temp/partial <compute_temp_partial>` may remove the DOF at one or more dimensions,
therefore it cannot be used with these fixes.
----------
Restart, fix_modify, output, run start/stop, minimize info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
These fixes writes the state of all the thermostat and barostat
variables 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.
The :doc:`fix_modify <fix_modify>` *temp* and *press* options are
supported by these fixes. You can use them to assign a
:doc:`compute <compute>` you have defined to this fix which will be used
in its thermostatting or barostatting procedure, as described above.
If you do this, note that the kinetic energy derived from the compute
temperature should be consistent with the virial term computed using
all atoms for the pressure. LAMMPS will warn you if you choose to
compute temperature on a subset of atoms.
.. note::
If both the *temp* and *press* keywords are used in a single
thermo_modify command (or in two separate commands), then the order in
which the keywords are specified is important. Note that a :doc:`pressure compute <compute_pressure>` defines its own temperature compute as
an argument when it is specified. The *temp* keyword will override
this (for the pressure compute being used by fix npt), but only if the
*temp* keyword comes after the *press* keyword. If the *temp* keyword
comes before the *press* keyword, then the new pressure compute
specified by the *press* keyword will be unaffected by the *temp*
setting.
The :doc:`fix_modify <fix_modify>` *energy* option is supported by these
fixes to add the energy change induced by Nose/Hoover thermostatting
and barostatting to the system's potential energy as part of
:doc:`thermodynamic output <thermo_style>`.
These fixes compute a global scalar and a global vector of quantities,
which can be accessed by various :doc:`output commands <Howto_output>`.
The scalar value calculated by these fixes is "extensive"; the vector
values are "intensive".
The scalar is the cumulative energy change due to the fix.
The vector stores the three temperatures :math:`T_\mathrm{M}`, :math:`T_\mathrm{R}` and :math:`T_\mathrm{D}`.
These fixes can ramp their external temperature and pressure over
multiple runs, using the *start* and *stop* keywords of the
:doc:`run <run>` command. See the :doc:`run <run>` command for details of
how to do this.
These fixes are not invoked during :doc:`energy minimization <minimize>`.
----------
Restrictions
""""""""""""
These fixes are only available when LAMMPS was built with the USER-DRUDE package.
These fixes cannot be used with dynamic groups as defined by the :doc:`group <group>` command.
These fixes cannot be used in 2D simulations.
*X*\ , *y*\ , *z* cannot be barostatted if the associated dimension is not
periodic. *Xy*\ , *xz*\ , and *yz* can only be barostatted if the
simulation domain is triclinic and the second dimension in the keyword
(\ *y* dimension in *xy*\ ) is periodic. The :doc:`create_box <create_box>`,
:doc:`read data <read_data>`, and :doc:`read_restart <read_restart>`
commands specify whether the simulation box is orthogonal or
non-orthogonal (triclinic) and explain the meaning of the xy,xz,yz
tilt factors.
For the *temp* keyword, the final *Tstop* cannot be 0.0 since it would
make the external T = 0.0 at some timestep during the simulation which
is not allowed in the Nose/Hoover formulation.
The *scaleyz yes*\ , *scalexz yes*\ , and *scalexy yes* options
can only be used if the second dimension in the keyword is periodic,
and if the tilt factor is not coupled to the barostat via keywords
*tri*\ , *yz*\ , *xz*\ , and *xy*\ .
Related commands
""""""""""""""""
:doc:`fix drude <fix_drude>`, :doc:`fix nvt <fix_nh>`, :doc:`fix_npt <fix_nh>`,
:doc:`fix_modify <fix_modify>`
Default
"""""""
The keyword defaults are tchain = 3, pchain = 3, mtk = yes, tloop = 1,
ploop = 1, nreset = 0, couple = none,
flip = yes, scaleyz = scalexz = scalexy = yes if periodic in second
dimension and not coupled to barostat, otherwise no.
----------
.. _tgnh-Son:
**(Son)** Son, McDaniel, Cui and Yethiraj, J Phys Chem Lett, 10, 7523 (2019).

View File

@ -251,12 +251,16 @@ in commands that use the spacings should be decipherable.
----------
Example commands for generating a Wurtzite crystal (courtesy
of Aidan Thompson), with its 8 atom unit cell.
Example commands for generating a Wurtzite crystal.
The lattice constants approximate those of CdSe.
The :math:`\sqrt{3}\times 1` orthorhombic supercell is used
with the x, y, and z directions oriented
along :math:`[\bar{1}\bar{2}30]`,
:math:`[10\bar{1}0]`, and :math:`[0001]`, respectively.
.. code-block:: LAMMPS
variable a equal 4.340330
variable a equal 4.34
variable b equal $a*sqrt(3.0)
variable c equal $a*sqrt(8.0/3.0)
@ -264,8 +268,8 @@ of Aidan Thompson), with its 8 atom unit cell.
variable five6 equal 5.0/6.0
lattice custom 1.0 &
a1 $a 0.0 0.0 &
a2 0.0 $b 0.0 &
a1 $b 0.0 0.0 &
a2 0.0 $a 0.0 &
a3 0.0 0.0 $c &
basis 0.0 0.0 0.0 &
basis 0.5 0.5 0.0 &

View File

@ -49,7 +49,9 @@ sometimes be faster. Either style should give the same answers.
The *multi* style is a modified binning algorithm that is useful for
systems with a wide range of cutoff distances, e.g. due to different
size particles. For the *bin* style, the bin size is set to 1/2 of
size particles. For granular pair styles, cutoffs are set to the
sum of the maximum atomic radii for each atom type.
For the *bin* style, the bin size is set to 1/2 of
the largest cutoff distance between any pair of atom types and a
single set of bins is defined to search over for all atom types. This
can be inefficient if one pair of types has a very long cutoff, but
@ -57,8 +59,10 @@ other type pairs have a much shorter cutoff. For style *multi* the
bin size is set to 1/2 of the shortest cutoff distance and multiple
sets of bins are defined to search over for different atom types.
This imposes some extra setup overhead, but the searches themselves
may be much faster for the short-cutoff cases. See the :doc:`comm_modify mode multi <comm_modify>` command for a communication option
that may also be beneficial for simulations of this kind.
may be much faster for the short-cutoff cases.
See the :doc:`comm_modify mode multi <comm_modify>` command for a
communication option that may also be beneficial for simulations of
this kind.
The :doc:`neigh_modify <neigh_modify>` command has additional options
that control how often neighbor lists are built and which pairs are

View File

@ -18,13 +18,16 @@ Syntax
*gpu* args = Ngpu keyword value ...
Ngpu = # of GPUs per node
zero or more keyword/value pairs may be appended
keywords = *neigh* or *newton* or *binsize* or *split* or *gpuID* or *tpa* or *device* or *blocksize*
keywords = *neigh* or *newton* or *pair/only* or *binsize* or *split* or *gpuID* or *tpa* or *device* or *blocksize*
*neigh* value = *yes* or *no*
yes = neighbor list build on GPU (default)
no = neighbor list build on CPU
*newton* = *off* or *on*
off = set Newton pairwise flag off (default and required)
on = set Newton pairwise flag on (currently not allowed)
*pair/only* = *off* or *on*
off = apply "gpu" suffix to all available styles in the GPU package (default)
on - apply "gpu" suffix only pair styles
*binsize* value = size
size = bin size for neighbor list construction (distance units)
*split* = fraction
@ -65,7 +68,7 @@ Syntax
*no_affinity* values = none
*kokkos* args = keyword value ...
zero or more keyword/value pairs may be appended
keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* or *comm/reverse* or *cuda/aware*
keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* *pair/comm/forward* *fix/comm/forward* or *comm/reverse* or *gpu/aware* or *pair/only*
*neigh* value = *full* or *half*
full = full neighbor list
half = half neighbor list built in thread-safe manner
@ -81,16 +84,21 @@ Syntax
*binsize* value = size
size = bin size for neighbor list construction (distance units)
*comm* value = *no* or *host* or *device*
use value for comm/exchange and comm/forward and comm/reverse
use value for comm/exchange and comm/forward and pair/comm/forward and fix/comm/forward and comm/reverse
*comm/exchange* value = *no* or *host* or *device*
*comm/forward* value = *no* or *host* or *device*
*pair/comm/forward* value = *no* or *device*
*fix/comm/forward* value = *no* or *device*
*comm/reverse* value = *no* or *host* or *device*
no = perform communication pack/unpack in non-KOKKOS mode
host = perform pack/unpack on host (e.g. with OpenMP threading)
device = perform pack/unpack on device (e.g. on GPU)
*cuda/aware* = *off* or *on*
off = do not use CUDA-aware MPI
on = use CUDA-aware MPI (default)
*gpu/aware* = *off* or *on*
off = do not use GPU-aware MPI
on = use GPU-aware MPI (default)
*pair/only* = *off* or *on*
off = use device acceleration (e.g. GPU) for all available styles in the KOKKOS package (default)
on = use device acceleration only for pair styles (and host acceleration for others)
*omp* args = Nthreads keyword value ...
Nthread = # of OpenMP threads to associate with each MPI process
zero or more keyword/value pairs may be appended
@ -194,6 +202,14 @@ for compatibility with the package command for other accelerator
styles. Note that the newton setting for bonded interactions is not
affected by this keyword.
The *pair/only* keyword can change how any "gpu" suffix is applied.
By default a suffix is applied to all styles for which an accelerated
variant is available. However, that is not always the most effective
way to use an accelerator. With *pair/only* set to *on* the suffix
will only by applied to supported pair styles, which tend to be the
most effective in using an accelerator and their operation can be
overlapped with all other computations on the CPU.
The *binsize* keyword sets the size of bins used to bin atoms in
neighbor list builds performed on the GPU, if *neigh* = *yes* is set.
If *binsize* is set to 0.0 (the default), then bins = the size of the
@ -484,7 +500,8 @@ because the GPU is faster at performing pairwise interactions, then this
rule of thumb may give too large a binsize and the default should be
overridden with a smaller value.
The *comm* and *comm/exchange* and *comm/forward* and *comm/reverse*
The *comm* and *comm/exchange* and *comm/forward* and *pair/comm/forward*
and *fix/comm/forward* and comm/reverse*
keywords determine whether the host or device performs the packing and
unpacking of data when communicating per-atom data between processors.
"Exchange" communication happens only on timesteps that neighbor lists
@ -492,18 +509,22 @@ are rebuilt. The data is only for atoms that migrate to new processors.
"Forward" communication happens every timestep. "Reverse" communication
happens every timestep if the *newton* option is on. The data is for
atom coordinates and any other atom properties that needs to be updated
for ghost atoms owned by each processor.
for ghost atoms owned by each processor. "Pair/comm" controls additional
communication in pair styles, such as pair_style EAM. "Fix/comm" controls
additional communication in fixes, such as fix SHAKE.
The *comm* keyword is simply a short-cut to set the same value for both
the *comm/exchange* and *comm/forward* and *comm/reverse* keywords.
The *comm* keyword is simply a short-cut to set the same value for all
the comm keywords.
The value options for all 3 keywords are *no* or *host* or *device*\ . A
The value options for the keywords are *no* or *host* or *device*\ . A
value of *no* means to use the standard non-KOKKOS method of
packing/unpacking data for the communication. A value of *host* means to
use the host, typically a multi-core CPU, and perform the
packing/unpacking in parallel with threads. A value of *device* means to
use the device, typically a GPU, to perform the packing/unpacking
operation.
operation. If a value of *host* is used for the *pair/comm/forward* or
*fix/comm/forward* keyword, it will be automatically be changed to *no*
since these keywords don't support *host* mode.
The optimal choice for these keywords depends on the input script and
the hardware used. The *no* value is useful for verifying that the
@ -524,22 +545,30 @@ pack/unpack communicated data. When running small systems on a GPU,
performing the exchange pack/unpack on the host CPU can give speedup
since it reduces the number of CUDA kernel launches.
The *cuda/aware* keyword chooses whether CUDA-aware MPI will be used. When
The *gpu/aware* keyword chooses whether GPU-aware MPI will be used. When
this keyword is set to *on*\ , buffers in GPU memory are passed directly
through MPI send/receive calls. This reduces overhead of first copying
the data to the host CPU. However CUDA-aware MPI is not supported on all
the data to the host CPU. However GPU-aware MPI is not supported on all
systems, which can lead to segmentation faults and would require using a
value of *off*\ . If LAMMPS can safely detect that CUDA-aware MPI is not
value of *off*\ . If LAMMPS can safely detect that GPU-aware MPI is not
available (currently only possible with OpenMPI v2.0.0 or later), then
the *cuda/aware* keyword is automatically set to *off* by default. When
the *cuda/aware* keyword is set to *off* while any of the *comm*
the *gpu/aware* keyword is automatically set to *off* by default. When
the *gpu/aware* keyword is set to *off* while any of the *comm*
keywords are set to *device*\ , the value for these *comm* keywords will
be automatically changed to *host*\ . This setting has no effect if not
running on GPUs or if using only one MPI rank. CUDA-aware MPI is available
be automatically changed to *no*\ . This setting has no effect if not
running on GPUs or if using only one MPI rank. GPU-aware MPI is available
for OpenMPI 1.8 (or later versions), Mvapich2 1.9 (or later) when the
"MV2_USE_CUDA" environment variable is set to "1", CrayMPI, and IBM
Spectrum MPI when the "-gpu" flag is used.
The *pair/only* keyword can change how the KOKKOS suffix "kk" is applied
when using an accelerator device. By default device acceleration is
always used for all available styles. With *pair/only* set to *on* the
suffix setting will choose device acceleration only for pair styles and
run all other force computations on the host CPU.
The *comm* flags will also automatically be changed to *no*\ . This can
result in better performance for certain configurations and system sizes.
----------
The *omp* style invokes settings associated with the use of the
@ -649,8 +678,8 @@ script or via the "-pk intel" :doc:`command-line switch <Run_options>`.
For the KOKKOS package, the option defaults for GPUs are neigh = full,
neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default
value, comm = device, cuda/aware = on. When LAMMPS can safely detect
that CUDA-aware MPI is not available, the default value of cuda/aware
value, comm = device, gpu/aware = on. When LAMMPS can safely detect
that GPU-aware MPI is not available, the default value of gpu/aware
becomes "off". For CPUs or Xeon Phis, the option defaults are neigh =
half, neigh/qeq = half, newton = on, binsize = 0.0, and comm = no. The
option neigh/thread = on when there are 16K atoms or less on an MPI

View File

@ -20,7 +20,7 @@ Examples
pair_style meam/spline
pair_coeff * * Ti.meam.spline Ti
pair_coeff * * Ti.meam.spline Ti Ti Ti
pair_coeff * * Ti.meam.spline Ti O
Description
"""""""""""
@ -84,23 +84,22 @@ where N is the number of LAMMPS atom types:
See the :doc:`pair_coeff <pair_coeff>` doc page for alternate ways
to specify the path for the potential file.
As an example, imagine the Ti.meam.spline file has values for Ti (old style). If
your LAMMPS simulation has 3 atoms types and they are all to be
treated with this potentials, you would use the following pair_coeff
command:
As an example, imagine the Ti.meam.spline file has values for Ti (old style).
In that case your LAMMPS simulation may only have one atom type which has
to be mapped to the Ti element as follows:
.. code-block:: LAMMPS
pair_coeff * * Ti.meam.spline Ti Ti Ti
pair_coeff * * Ti.meam.spline Ti
The first 2 arguments must be \* \* so as to span all LAMMPS atom types.
The three Ti arguments map LAMMPS atom types 1,2,3 to the Ti element
in the potential file. If a mapping value is specified as NULL, the
mapping is not performed. This can be used when a *meam/spline*
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. The old-style potential maps any non-NULL species named
on the command line to that single type.
The first 2 arguments must be \* \* and there may be only one element
following or NULL. Systems where there would be multiple atom types
assigned to the same element are **not** supported by this pair style
due to limitations in its implementation. If a mapping value is
specified as NULL, the mapping is not performed. This can be used when
a *meam/spline* 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.
An example with a two component spline (new style) is TiO.meam.spline, where
the command
@ -143,6 +142,8 @@ Restrictions
This pair style requires the :doc:`newton <newton>` setting to be "on"
for pair interactions.
This pair style does not support mapping multiple atom types to the same element.
This pair style is only enabled if LAMMPS was built with the USER-MISC
package. See the :doc:`Build package <Build_package>` doc page for more
info.

View File

@ -16,7 +16,7 @@ Syntax
.. parsed-literal::
*model* values = style filename
style = *linear* or *quadratic*
style = *linear* or *quadratic* or *mliappy*
filename = name of file containing model definitions
*descriptor* values = style filename
style = *sna*
@ -40,12 +40,15 @@ definitions of the interatomic potential functional form (*model*)
and the geometric quantities that characterize the atomic positions
(*descriptor*). By defining *model* and *descriptor* separately,
it is possible to use many different models with a given descriptor,
or many different descriptors with a given model. Currently, the pair_style
supports just two models, *linear* and *quadratic*,
and one descriptor, *sna*, the SNAP descriptor used by :doc:`pair_style snap <pair_snap>`, including the linear, quadratic,
and chem variants. Work is currently underway to extend
the interface to handle neural network energy models,
and it is also straightforward to add new descriptor styles.
or many different descriptors with a given model. The
pair style currently supports just one descriptor style, but it is
is straightforward to add new descriptor styles.
The SNAP descriptor style *sna* is the same as that used by :doc:`pair_style snap <pair_snap>`,
including the linear, quadratic, and chem variants.
The available models are *linear*, *quadratic*, and *mliappy*.
The *mliappy* style can be used to couple python models,
e.g. PyTorch neural network energy models, and requires building
LAMMPS with the PYTHON package (see below).
In order to train a model, it is useful to know the gradient or derivative
of energy, force, and stress w.r.t. model parameters. This information
can be accessed using the related :doc:`compute mliap <compute_mliap>` command.
@ -59,9 +62,8 @@ that specify the mapping of MLIAP
element names to LAMMPS atom types,
where N is the number of LAMMPS atom types.
The *model* keyword is followed by a model style, currently limited to
either *linear* or *quadratic*. In both cases,
this is followed by a single argument specifying the model filename containing the
The *model* keyword is followed by the model style. This is followed
by a single argument specifying the model filename containing the
parameters for a set of elements.
The model filename usually ends in the *.mliap.model* extension.
It may contain parameters for many elements. The only requirement is that it
@ -82,6 +84,16 @@ for the :doc:`pair_style snap <pair_snap>` coefficient file.
Specifically, the line containing the element weight and radius is omitted,
since these are handled by the *descriptor*.
Notes on mliappy models:
When the *model* keyword is *mliappy*, the filename should end in '.pt',
'.pth' for pytorch models, or be a pickle file. To load a model from
memory (i.e. an existing python object), specify the filename as
"LATER", and then call `lammps.mliap.load_model(model)` from python
before using the pair style. When using lammps via the library mode, you will need to call
`lammps.mliappy.activate_mliappy(lmp)` on the active lammps object
before the pair style is defined. This call locates and loads the mliap-specific
python module that is built into lammps.
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
Currently the only descriptor style is *sna*, indicating the bispectrum component
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
@ -138,11 +150,13 @@ This pair style can only be used via the *pair* keyword of the
Restrictions
""""""""""""
This style is part of the MLIAP package. It is only enabled if LAMMPS
This pair style is part of the MLIAP package. It is only enabled if LAMMPS
was built with that package. In addition, building LAMMPS with the MLIAP package
requires building LAMMPS with the SNAP package.
The *mliappy* model requires building LAMMPS with the PYTHON package.
See the :doc:`Build package <Build_package>` doc page for more info.
Related commands
""""""""""""""""

View File

@ -152,7 +152,7 @@ The default values for these keywords are
* *chemflag* = 0
* *bnormflag* = 0
* *wselfallflag* = 0
* *chunksize* = 2000
* *chunksize* = 4096
If *quadraticflag* is set to 1, then the SNAP energy expression includes additional quadratic terms
that have been shown to increase the overall accuracy of the potential without much increase
@ -189,8 +189,8 @@ pair style *snap* with the KOKKOS package and is ignored otherwise.
This keyword controls
the number of atoms in each pass used to compute the bispectrum
components and is used to avoid running out of memory. For example
if there are 4000 atoms in the simulation and the *chunksize*
is set to 2000, the bispectrum calculation will be broken up
if there are 8192 atoms in the simulation and the *chunksize*
is set to 4096, the bispectrum calculation will be broken up
into two passes.
Detailed definitions for all the other keywords

View File

@ -323,8 +323,8 @@ Python function is as follows:
The function definition must include a variable (lmpptr in this case)
which corresponds to SELF in the python command. The first line of the
function imports the Python module lammps.py in the python directory of
the distribution. The second line creates a Python object "lmp" which
function imports the :doc:`"lammps" Python module <Python_module>`.
The second line creates a Python object ``lmp`` which
wraps the instance of LAMMPS that called the function. The "ptr=lmpptr"
argument is what makes that happen. The third line invokes the
command() function in the LAMMPS library interface. It takes a single
@ -502,18 +502,16 @@ Python library on your system. Settings to enable this are in the
lib/python/Makefile.lammps file. See the lib/python/README file for
information on those settings.
If you use Python code which calls back to LAMMPS, via the SELF input
argument explained above, there is an extra step required when
building LAMMPS. LAMMPS must also be built as a shared library and
your Python function must be able to load the Python module in
python/lammps.py that wraps the LAMMPS library interface. These are
the same steps required to use Python by itself to wrap LAMMPS.
Details on these steps are explained on the :doc:`Python <Python_head>`
doc page. Note that it is important that the stand-alone LAMMPS
executable and the LAMMPS shared library be consistent (built from the
same source code files) in order for this to work. If the two have
been built at different times using different source files, problems
may occur.
If you use Python code which calls back to LAMMPS, via the SELF input argument
explained above, there is an extra step required when building LAMMPS. LAMMPS
must also be built as a shared library and your Python function must be able to
load the :doc:`"lammps" Python module <Python_module>` that wraps the LAMMPS
library interface. These are the same steps required to use Python by itself
to wrap LAMMPS. Details on these steps are explained on the :doc:`Python
<Python_head>` doc page. Note that it is important that the stand-alone LAMMPS
executable and the LAMMPS shared library be consistent (built from the same
source code files) in order for this to work. If the two have been built at
different times using different source files, problems may occur.
Related commands
""""""""""""""""

View File

@ -533,6 +533,7 @@ cuda
Cuda
CUDA
CuH
Cui
cuFFT
Cummins
Curk
@ -557,6 +558,7 @@ Cygwin
cylindrically
Cyrot
cyrstals
cython
Daivis
Dammak
dampflag
@ -869,6 +871,7 @@ equilibrating
equilibration
Equilibria
equilization
equipartitioning
Ercolessi
Erdmann
eradius
@ -1916,6 +1919,7 @@ mK
mkdir
mkv
mliap
mliappy
mlparks
Mniszewski
mnt
@ -2506,6 +2510,7 @@ Pstart
Pstop
pstyle
Ptarget
pth
pthread
pthreads
ptm
@ -2534,6 +2539,7 @@ pymodule
pymol
pypar
pythonic
pytorch
Pyy
pz
Pz
@ -3001,6 +3007,7 @@ Sukumaran
Sulc
sumsq
Sunderland
supercell
superset
supersphere
Supinski
@ -3070,9 +3077,11 @@ tex
tfac
tfmc
tfMC
th
tgnpt
tgnvt
Thakkar
Thaokar
th
thb
thei
Theodorou
@ -3478,6 +3487,7 @@ Yc
ycm
Yeh
yellowgreen
Yethiraj
yflag
yhi
yi

View File

@ -1,4 +1,4 @@
# this example requires the LAMMPS Python package (lammps.py) to be installed
# this example requires the LAMMPS Python package (python/lammps) to be installed
# and LAMMPS to be loadable as shared library in LD_LIBRARY_PATH
import lammps

View File

@ -1,8 +1,8 @@
Example simulations of polarizable systems using Drude oscillators
==================================================================
Each example comes in two versions for demonstrating the use of
Nosé-Hoover or Langevin thermostats.
Each example comes in several versions for demonstrating the use of
Langevin, Nosé-Hoover and temperature-grouped Nosé-Hoover thermostats.
* `butane` -- simulation in NVT ensemble with Thole damping

View File

@ -0,0 +1,57 @@
# 250 butane system for drude polarizability example (Langevin)
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.089 8.0
pair_modify mix geometric tail yes
kspace_style pppm 1.0e-4
read_data data.butane
comm_modify vel yes
group gBUTANE molecule 1:250
group gCORES type 1 2 3
group gDRUDES type 4 5
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H C2H
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # C2H C2H
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # C2H H
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff * 4*5 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 * thole 1.368000
pair_coeff 2 * thole 1.368000
pair_coeff 4 * thole 1.368000
pair_coeff 5 * thole 1.368000
neighbor 2.0 bin
variable vTEMP equal 260.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gCORES create ${vTEMP} 12345
velocity gDRUDES create ${vTEMP_D} 12345
fix fDRUDE all drude C C N D D
fix fSHAKE gCORES shake 0.0001 20 0 b 2 4
fix fNVT all tgnvt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
thermo 50
timestep 0.5
run 2000

View File

@ -0,0 +1,203 @@
LAMMPS (29 Oct 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
using 1 OpenMP thread(s) per MPI task
# 250 butane system for drude polarizability example (Langevin)
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.089 8.0
pair_modify mix geometric tail yes
kspace_style pppm 1.0e-4
read_data data.butane
Reading data file ...
orthogonal box = (-19.099988 -19.099913 -19.099998) to (19.099998 19.099999 19.099987)
1 by 1 by 1 MPI processor grid
reading atoms ...
4500 atoms
scanning bonds ...
5 = max bonds/atom
scanning angles ...
6 = max angles/atom
scanning dihedrals ...
9 = max dihedrals/atom
reading bonds ...
4250 bonds
reading angles ...
6000 angles
reading dihedrals ...
6750 dihedrals
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0.0 0.0 0.5
special bond factors coul: 0.0 0.0 0.5
5 = max # of 1-2 neighbors
8 = max # of 1-3 neighbors
12 = max # of 1-4 neighbors
17 = max # of special neighbors
special bonds CPU = 0.005 seconds
read_data CPU = 0.107 seconds
comm_modify vel yes
group gBUTANE molecule 1:250
4500 atoms in group gBUTANE
group gCORES type 1 2 3
3500 atoms in group gCORES
group gDRUDES type 4 5
1000 atoms in group gDRUDES
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H C2H
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # C2H C2H
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # C2H H
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff * 4*5 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 * thole 1.368000
pair_coeff 2 * thole 1.368000
pair_coeff 4 * thole 1.368000
pair_coeff 5 * thole 1.368000
neighbor 2.0 bin
variable vTEMP equal 260.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gCORES create ${vTEMP} 12345
velocity gCORES create 260 12345
velocity gDRUDES create ${vTEMP_D} 12345
velocity gDRUDES create 1 12345
fix fDRUDE all drude C C N D D
fix fSHAKE gCORES shake 0.0001 20 0 b 2 4
0 = # of size 2 clusters
500 = # of size 3 clusters
500 = # of size 4 clusters
0 = # of frozen angles
find clusters CPU = 0.002 seconds
fix fNVT all tgnvt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 ${vTEMP} 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 260 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 260 100.0 1 20.0
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
thermo 50
timestep 0.5
run 2000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:328)
G vector (1/distance) = 0.36786669
grid = 36 36 36
stencil order = 5
estimated absolute RMS force accuracy = 0.031353958
estimated relative force accuracy = 9.4421513e-05
using double precision FFTW3
3d grid and FFT values/proc = 79507 46656
Rebuild special list taking Drude particles into account
Old max number of 1-2 to 1-4 neighbors: 17
New max number of 1-2 to 1-4 neighbors: 17 (+0)
Neighbor list info ...
update every 1 steps, delay 10 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 10
ghost atom cutoff = 10
binsize = 5, bins = 8 8 8
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair lj/cut/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair thole, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
TGNHC thermostat for Drude model
DOFs of molecules, atoms and dipoles: 747.0 7250.0 3000.0
Per MPI rank memory allocation (min/avg/max) = 26.74 | 26.74 | 26.74 Mbytes
Step CPU TotEng KinEng Temp PotEng E_bond E_angle E_dihed E_impro E_vdwl E_coul E_long Press Volume c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
0 0 6535.5187 2714.74 248.45112 3820.7787 3724.3278 140.75328 1.4735401 0 -518.77975 595169.42 -594696.41 4439.7916 55742.797 334.61375 18.435655 235.53872 344.96036 18.435655
50 3.1687763 2088.2827 1463.7181 133.95847 624.56452 190.24602 660.52157 113.41252 0 -767.94561 595300.94 -594872.61 2824.2625 55742.797 183.94884 0.5168738 309.18564 171.12124 0.5168738
100 6.392197 2119.741 1619.097 148.17863 500.64399 180.00042 696.41212 164.28885 0 -972.75524 595305.17 -594872.47 1212.6136 55742.797 203.63725 0.14080733 399.49069 183.54186 0.14080733
150 9.5800587 2141.3837 1671.6283 152.98627 469.75531 135.1638 703.8743 168.6738 0 -966.11416 595300.45 -594872.29 4391.1694 55742.797 210.25781 0.10918071 418.15558 188.92417 0.10918071
200 12.853705 2171.9506 1663.8326 152.27281 508.11794 189.68939 718.42616 166.2915 0 -990.53041 595295.36 -594871.12 2071.4055 55742.797 209.24314 0.19965091 435.49843 186.01763 0.19965091
250 16.067977 2208.7064 1678.7069 153.6341 529.99951 152.56393 831.36872 167.05009 0 -1047.6813 595297.24 -594870.54 1092.2375 55742.797 210.84693 0.91289443 438.53468 187.47449 0.91289443
300 19.290601 2251.9246 1764.9742 161.52921 486.95043 145.17235 805.81497 155.39025 0 -1045.9572 595297.21 -594870.68 2438.7801 55742.797 220.85043 3.177778 427.70756 199.6284 3.177778
350 22.523101 2270.9632 1684.9306 154.20368 586.03264 186.29543 828.98436 164.45539 0 -1016.9035 595293.56 -594870.36 2804.0926 55742.797 211.53678 1.1611927 408.91355 191.2877 1.1611927
400 25.747934 2299.236 1742.1505 159.44041 557.0855 171.75438 844.97783 181.89643 0 -1068.3059 595296.85 -594870.09 346.86959 55742.797 219.02792 0.38093991 392.66374 201.22808 0.38093991
450 28.921993 2335.9622 1666.2461 152.49369 669.71602 137.8956 986.46039 179.59582 0 -1060.189 595295.82 -594869.86 -125.83593 55742.797 209.50259 0.31748182 376.15783 192.41804 0.31748182
500 32.312988 2377.923 1744.8977 159.69183 633.02533 192.86619 865.11335 173.23166 0 -1020.1061 595291.45 -594869.53 3306.7537 55742.797 219.29509 0.59010722 361.05703 204.77946 0.59010722
550 36.691992 2428.1816 1631.766 149.33809 796.41562 183.75276 1043.9175 175.64604 0 -1030.3844 595293.08 -594869.6 1566.0362 55742.797 204.67411 1.6260367 344.40559 190.36165 1.6260367
600 41.042781 2475.0304 1615.769 147.87406 859.26146 195.35951 1102.8743 185.82441 0 -1049.7179 595293.93 -594869 751.07631 55742.797 202.5711 1.8674049 324.5681 190.08503 1.8674049
650 45.328915 2516.5445 1706.6033 156.18716 809.94113 177.34479 1029.3219 186.91492 0 -1005.4619 595290.9 -594869.08 2456.1336 55742.797 214.42466 0.73094758 306.66872 205.00907 0.73094758
700 49.764606 2566.0671 1658.8261 151.81461 907.24102 186.97528 1088.6916 184.51371 0 -976.01174 595292.41 -594869.33 403.91053 55742.797 208.52534 0.43420426 292.04619 200.0061 0.43420426
750 54.232008 2621.7889 1798.1047 164.5613 823.68424 181.39689 1029.9425 187.40871 0 -1005.4402 595300.06 -594869.68 93.345406 55742.797 226.01979 0.50741755 278.62961 220.69269 0.50741755
800 58.691111 2682.2116 1697.0698 155.31465 985.14182 215.09199 1113.1134 201.785 0 -975.13212 595300.04 -594869.76 -978.97822 55742.797 213.08116 1.115316 269.45572 207.36081 1.115316
850 63.191067 2745.8302 1887.0667 172.70304 858.76349 213.25376 980.55106 184.54859 0 -948.21117 595298.22 -594869.6 -1842.9661 55742.797 236.69142 1.8946563 265.28903 233.84282 1.8946563
900 68.297608 2799.3194 1855.1338 169.78056 944.1856 201.04167 1103.4608 183.6645 0 -978.27382 595303.89 -594869.59 -1771.6573 55742.797 232.95614 1.1425454 262.10904 230.04879 1.1425454
950 72.791466 2852.8885 1809.5899 165.61241 1043.2986 249.1926 1129.6516 191.5705 0 -961.04118 595303.8 -594869.88 -2342.8998 55742.797 227.44427 0.56184866 253.71617 224.83147 0.56184866
1000 77.035667 2910.6565 1900.2429 173.90892 1010.4136 196.79043 1117.444 178.94619 0 -911.75161 595298.72 -594869.74 -30.451099 55742.797 238.87602 0.48940683 245.53211 238.28906 0.48940683
1050 81.411119 2970.473 1950.8452 178.54 1019.6278 226.17987 1113.3407 186.50456 0 -935.79287 595298.24 -594868.85 -835.03656 55742.797 245.11923 0.81684119 243.27893 245.41028 0.81684119
1100 85.352255 3032.1777 1913.2921 175.10317 1118.8856 252.39337 1183.7624 209.49478 0 -958.58165 595300.89 -594869.07 -2339.7573 55742.797 240.10633 1.5863163 244.29251 239.77436 1.5863163
1150 88.542324 3088.7233 2015.1572 184.4258 1073.5661 215.84757 1132.2268 209.14846 0 -912.58909 595297.76 -594868.83 53.404069 55742.797 252.92982 1.5639609 247.6541 253.57807 1.5639609
1200 92.122601 3137.9447 1895.1546 173.44324 1242.7901 238.97673 1266.308 207.46165 0 -898.18367 595297.09 -594868.86 -940.55827 55742.797 238.13441 0.75999751 245.44164 237.48006 0.75999751
1250 95.311451 3187.5696 2117.7204 193.81231 1069.8492 181.35781 1173.5116 216.10446 0 -933.15422 595300.81 -594868.78 -1638.23 55742.797 266.21428 0.54658889 243.60628 268.65384 0.54658889
1300 98.511654 3238.1405 2050.9414 187.70074 1187.1991 249.20898 1196.3016 223.50078 0 -909.6591 595296.3 -594868.46 -1547.4617 55742.797 257.76705 0.6695258 252.14097 258.4534 0.6695258
1350 101.52721 3288.0387 2035.6917 186.3051 1252.347 218.31874 1254.421 222.85512 0 -868.43705 595293.49 -594868.3 390.90212 55742.797 255.64252 1.2189872 257.21253 255.58654 1.2189872
1400 104.52829 3334.0324 2200.7086 201.40733 1133.3238 203.591 1213.1272 225.86605 0 -936.79465 595295.53 -594868 1372.2474 55742.797 276.25415 1.6144005 265.70225 277.45567 1.6144005
1450 107.57536 3365.7397 2053.535 187.9381 1312.2047 229.27407 1349.3993 233.25524 0 -924.22271 595292.17 -594867.67 -836.52213 55742.797 257.94919 1.053914 270.4816 256.76466 1.053914
1500 110.67807 3391.6801 2142.1349 196.04671 1249.5452 216.36803 1271.289 236.65847 0 -894.899 595287.51 -594867.38 1789.6923 55742.797 269.25236 0.63559736 274.68538 268.80398 0.63559736
1550 113.65872 3411.9839 2115.0942 193.57196 1296.8897 192.92659 1363.4027 230.98652 0 -914.70137 595291.47 -594867.19 2191.6084 55742.797 265.85125 0.63359087 272.59399 265.26653 0.63359087
1600 116.66477 3424.9783 2002.6546 183.28156 1422.3237 261.62038 1419.7862 242.17905 0 -928.05995 595294.38 -594867.58 -1278.1217 55742.797 251.58666 0.95135757 265.94171 250.2117 0.95135757
1650 119.69122 3429.9661 2102.8573 192.45205 1327.1088 253.88883 1296.8164 239.01537 0 -888.25345 595293.11 -594867.47 948.16575 55742.797 263.99864 1.4686915 261.93718 264.32028 1.4686915
1700 122.69838 3421.465 2141.4791 195.98669 1279.9859 181.31236 1326.081 226.54243 0 -878.86521 595292.19 -594867.28 241.93125 55742.797 268.9293 1.2770595 262.79349 269.67278 1.2770595
1750 125.70436 3402.5396 2090.1999 191.29365 1312.3397 263.74025 1296.4274 228.60032 0 -905.54661 595296.37 -594867.25 -1707.3557 55742.797 262.65583 0.80319616 257.84463 263.26023 0.80319616
1800 128.64288 3381.1607 2133.1735 195.22657 1247.9872 234.93738 1242.035 231.34689 0 -887.78079 595295.05 -594867.6 -6.7713651 55742.797 268.11425 0.66416955 258.06107 269.26102 0.66416955
1850 131.64553 3358.3375 2097.2908 191.9426 1261.0467 207.32514 1269.9582 225.83462 0 -867.84477 595293.05 -594867.28 1032.3077 55742.797 263.55741 0.77783532 261.21918 263.90739 0.77783532
1900 134.66459 3335.0634 2130.3209 194.96549 1204.7425 244.28549 1208.9691 209.87044 0 -885.54671 595293.8 -594866.63 -302.54262 55742.797 267.53309 1.2569444 256.95232 268.73397 1.2569444
1950 137.77487 3309.5009 2065.148 189.00092 1244.3529 244.25407 1240.7976 222.92873 0 -891.58467 595294.86 -594866.9 -2000.0789 55742.797 259.29344 1.3652015 254.19331 259.92622 1.3652015
2000 140.88126 3284.0767 2005.7474 183.56462 1278.3292 226.17277 1236.5565 225.16671 0 -837.57878 595295.52 -594867.51 942.09961 55742.797 251.97128 0.96329477 250.4516 252.23212 0.96329477
Loop time of 140.882 on 1 procs for 2000 steps with 4500 atoms
Performance: 0.613 ns/day, 39.134 hours/ns, 14.196 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 90.189 | 90.189 | 90.189 | 0.0 | 64.02
Bond | 5.0432 | 5.0432 | 5.0432 | 0.0 | 3.58
Kspace | 39.478 | 39.478 | 39.478 | 0.0 | 28.02
Neigh | 2.4322 | 2.4322 | 2.4322 | 0.0 | 1.73
Comm | 0.62876 | 0.62876 | 0.62876 | 0.0 | 0.45
Output | 0.021652 | 0.021652 | 0.021652 | 0.0 | 0.02
Modify | 2.9918 | 2.9918 | 2.9918 | 0.0 | 2.12
Other | | 0.09631 | | | 0.07
Nlocal: 4500.00 ave 4500 max 4500 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 9440.00 ave 9440 max 9440 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 811251.0 ave 811251 max 811251 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 811251
Ave neighs/atom = 180.27800
Ave special neighs/atom = 13.333333
Neighbor list builds = 31
Dangerous builds = 0
Total wall time: 0:02:21

View File

@ -0,0 +1,203 @@
LAMMPS (29 Oct 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
using 1 OpenMP thread(s) per MPI task
# 250 butane system for drude polarizability example (Langevin)
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.089 8.0
pair_modify mix geometric tail yes
kspace_style pppm 1.0e-4
read_data data.butane
Reading data file ...
orthogonal box = (-19.099988 -19.099913 -19.099998) to (19.099998 19.099999 19.099987)
2 by 1 by 2 MPI processor grid
reading atoms ...
4500 atoms
scanning bonds ...
5 = max bonds/atom
scanning angles ...
6 = max angles/atom
scanning dihedrals ...
9 = max dihedrals/atom
reading bonds ...
4250 bonds
reading angles ...
6000 angles
reading dihedrals ...
6750 dihedrals
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0.0 0.0 0.5
special bond factors coul: 0.0 0.0 0.5
5 = max # of 1-2 neighbors
8 = max # of 1-3 neighbors
12 = max # of 1-4 neighbors
17 = max # of special neighbors
special bonds CPU = 0.002 seconds
read_data CPU = 0.135 seconds
comm_modify vel yes
group gBUTANE molecule 1:250
4500 atoms in group gBUTANE
group gCORES type 1 2 3
3500 atoms in group gCORES
group gDRUDES type 4 5
1000 atoms in group gDRUDES
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H C2H
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # C2H C2H
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # C2H H
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff * 4*5 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 * thole 1.368000
pair_coeff 2 * thole 1.368000
pair_coeff 4 * thole 1.368000
pair_coeff 5 * thole 1.368000
neighbor 2.0 bin
variable vTEMP equal 260.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gCORES create ${vTEMP} 12345
velocity gCORES create 260 12345
velocity gDRUDES create ${vTEMP_D} 12345
velocity gDRUDES create 1 12345
fix fDRUDE all drude C C N D D
fix fSHAKE gCORES shake 0.0001 20 0 b 2 4
0 = # of size 2 clusters
500 = # of size 3 clusters
500 = # of size 4 clusters
0 = # of frozen angles
find clusters CPU = 0.003 seconds
fix fNVT all tgnvt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 ${vTEMP} 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 260 100.0 ${vTEMP_D} 20.0
fix fNVT all tgnvt/drude temp 260 260 100.0 1 20.0
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
thermo 50
timestep 0.5
run 2000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:328)
G vector (1/distance) = 0.36786669
grid = 36 36 36
stencil order = 5
estimated absolute RMS force accuracy = 0.031353958
estimated relative force accuracy = 9.4421513e-05
using double precision FFTW3
3d grid and FFT values/proc = 26875 11664
Rebuild special list taking Drude particles into account
Old max number of 1-2 to 1-4 neighbors: 17
New max number of 1-2 to 1-4 neighbors: 17 (+0)
Neighbor list info ...
update every 1 steps, delay 10 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 10
ghost atom cutoff = 10
binsize = 5, bins = 8 8 8
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair lj/cut/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair thole, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
TGNHC thermostat for Drude model
DOFs of molecules, atoms and dipoles: 747.0 7250.0 3000.0
Per MPI rank memory allocation (min/avg/max) = 17.33 | 17.61 | 17.71 Mbytes
Step CPU TotEng KinEng Temp PotEng E_bond E_angle E_dihed E_impro E_vdwl E_coul E_long Press Volume c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
0 0 6535.5187 2714.74 248.45112 3820.7787 3724.3278 140.75328 1.4735401 0 -518.77975 595169.42 -594696.41 4439.7916 55742.797 334.61375 18.435655 235.53872 344.96036 18.435655
50 1.2808116 2088.3442 1463.7416 133.96062 624.60259 190.28732 660.54143 113.40785 0 -767.95454 595300.93 -594872.61 2824.0523 55742.797 183.9497 0.52468068 309.23594 171.11764 0.52468068
100 2.5584104 2119.7471 1619.1466 148.18318 500.60051 180.0129 696.37693 164.27736 0 -972.76956 595305.17 -594872.47 1212.1148 55742.797 203.64285 0.14251823 399.52878 183.54411 0.14251823
150 3.8010236 2141.3696 1671.6877 152.99171 469.68182 135.1764 703.84494 168.6598 0 -966.14516 595300.44 -594872.29 4390.752 55742.797 210.26485 0.11034179 418.18146 188.92927 0.11034179
200 5.1283429 2171.9547 1663.9057 152.2795 508.04901 189.69207 718.41361 166.26728 0 -990.56316 595295.36 -594871.12 2071.2788 55742.797 209.25133 0.20233224 435.53114 186.0233 0.20233224
250 6.4042978 2208.7763 1678.8339 153.64571 529.94239 152.60724 831.35366 166.99449 0 -1047.7147 595297.24 -594870.54 1092.02 55742.797 210.85827 0.9252592 438.54342 187.4861 0.9252592
300 7.6759895 2251.8197 1764.844 161.5173 486.97577 145.12518 805.82891 155.36767 0 -1045.8941 595297.22 -594870.68 2440.3181 55742.797 220.83898 3.1684561 427.70245 199.61611 3.1684561
350 8.9352416 2270.8953 1684.8322 154.19468 586.06305 186.26267 828.9806 164.47014 0 -1016.8664 595293.58 -594870.36 2805.0915 55742.797 211.52748 1.151954 408.90784 191.27829 1.151954
400 10.226474 2299.1993 1742.2608 159.4505 556.93851 171.73982 844.94626 181.87018 0 -1068.3641 595296.84 -594870.09 346.42411 55742.797 219.04152 0.38166821 392.61871 201.24772 0.38166821
450 11.460384 2335.947 1666.1971 152.4892 669.74994 137.90858 986.43107 179.60302 0 -1060.1348 595295.81 -594869.87 -124.88535 55742.797 209.49545 0.32005879 376.11474 192.41461 0.32005879
500 12.727526 2377.9345 1744.9374 159.69546 632.99715 192.8966 865.02273 173.24203 0 -1020.0569 595291.42 -594869.52 3307.6909 55742.797 219.29743 0.59718599 361.06132 204.78161 0.59718599
550 14.002285 2428.2193 1631.8271 149.34369 796.3922 183.78402 1043.8511 175.66575 0 -1030.3885 595293.08 -594869.6 1565.6449 55742.797 204.6776 1.6372397 344.46071 190.35982 1.6372397
600 15.309195 2474.8599 1615.6237 147.86076 859.23616 195.26628 1102.8384 185.89393 0 -1049.6659 595293.91 -594869.01 751.15809 55742.797 202.55856 1.8521167 324.58977 190.06895 1.8521167
650 16.528946 2516.5107 1706.7483 156.20043 809.76241 177.33665 1029.1545 186.8922 0 -1005.4741 595290.93 -594869.08 2457.4736 55742.797 214.44458 0.72647262 306.69821 205.02801 0.72647262
700 17.788857 2566.0306 1658.7538 151.808 907.27687 187.0133 1088.6084 184.61388 0 -976.00491 595292.38 -594869.33 403.14977 55742.797 208.51586 0.43547213 292.00328 200.00013 0.43547213
750 19.056136 2621.8108 1798.0665 164.5578 823.74429 181.38067 1030.1211 187.24746 0 -1005.3911 595300.06 -594869.68 92.552993 55742.797 226.01327 0.51200863 278.52415 220.69636 0.51200863
800 20.328816 2682.2638 1697.1503 155.32202 985.11349 215.11037 1113.1057 201.61206 0 -974.97574 595300.02 -594869.76 -976.02218 55742.797 213.08709 1.1265124 269.37146 207.37604 1.1265124
850 21.675028 2745.7956 1887.1133 172.70731 858.68222 213.20281 980.38605 184.58101 0 -948.10772 595298.22 -594869.6 -1838.829 55742.797 236.69968 1.8882632 265.22854 233.85817 1.8882632
900 22.973234 2799.2121 1855.3963 169.80459 943.81573 200.99559 1103.2167 183.64073 0 -978.26954 595303.83 -594869.59 -1773.6417 55742.797 232.99302 1.1323134 262.06588 230.09392 1.1323134
950 24.248459 2852.9103 1809.6345 165.6165 1043.2758 249.23659 1129.5155 191.54177 0 -960.95833 595303.82 -594869.88 -2343.6579 55742.797 227.45041 0.56047502 253.63589 224.84652 0.56047502
1000 25.536354 2910.7011 1900.5669 173.93856 1010.1343 196.76213 1117.2835 179.06956 0 -911.9529 595298.71 -594869.74 -33.375682 55742.797 238.91568 0.49230975 245.54917 238.33106 0.49230975
1050 27.032801 2970.593 1950.7545 178.53171 1019.8385 226.09391 1113.2803 186.61907 0 -935.59614 595298.29 -594868.85 -832.86686 55742.797 245.10467 0.82528071 243.25364 245.39681 0.82528071
1100 28.276849 3032.248 1914.0097 175.16884 1118.2383 252.4222 1183.4081 209.13741 0 -958.53105 595300.88 -594869.07 -2341.1239 55742.797 240.19374 1.5939531 244.2841 239.87168 1.5939531
1150 29.492505 3088.6987 2014.6006 184.37485 1074.0982 215.76487 1132.4575 209.01044 0 -912.08646 595297.78 -594868.83 59.335425 55742.797 252.86479 1.5506297 247.67435 253.50422 1.5506297
1200 30.792128 3137.976 1895.5574 173.4801 1242.4187 239.01663 1266.2435 206.94828 0 -898.01399 595297.09 -594868.87 -935.85119 55742.797 238.18675 0.75585601 245.80184 237.50082 0.75585601
1250 32.351654 3187.6007 2118.7576 193.90723 1068.8431 181.27841 1173.4284 215.72666 0 -933.61935 595300.82 -594868.79 -1641.4966 55742.797 266.34429 0.54783845 244.09536 268.74691 0.54783845
1300 34.279555 3238.1339 2050.9128 187.69812 1187.2212 249.09831 1195.8579 223.95802 0 -909.52255 595296.29 -594868.46 -1548.7665 55742.797 257.76137 0.67507496 252.48992 258.41118 0.67507496
1350 36.142639 3287.8996 2035.6486 186.30115 1252.251 218.35091 1254.3488 223.36318 0 -868.93347 595293.43 -594868.31 385.64561 55742.797 255.63367 1.2281317 257.51447 255.54567 1.2281317
1400 37.680265 3333.7702 2200.7264 201.40895 1133.0439 203.40304 1213.391 225.99045 0 -937.20521 595295.47 -594868.01 1368.2351 55742.797 276.25818 1.6096154 265.82263 277.44771 1.6096154
1450 38.930719 3365.4323 2053.468 187.93197 1311.9643 229.10608 1350.1009 232.99574 0 -924.67313 595292.11 -594867.67 -844.05749 55742.797 257.94445 1.0440927 270.14303 256.79431 1.0440927
1500 40.161434 3391.3707 2141.7727 196.01356 1249.598 216.2106 1271.1542 236.52415 0 -894.39832 595287.52 -594867.41 1800.4964 55742.797 269.20769 0.63415006 273.93125 268.83182 0.63415006
1550 41.331434 3411.6894 2114.0335 193.47488 1297.6559 192.9656 1363.167 231.27359 0 -913.98645 595291.45 -594867.21 2209.1641 55742.797 265.71649 0.63741948 271.92193 265.18682 0.63741948
1600 42.514856 3424.7938 2003.2634 183.33728 1421.5305 261.67378 1419.189 241.66354 0 -927.77417 595294.37 -594867.6 -1282.8296 55742.797 251.6594 0.96160577 265.79668 250.30691 0.96160577
1650 43.712954 3429.9764 2104.4785 192.60041 1325.4979 253.75783 1296.7732 237.25083 0 -887.95744 595293.15 -594867.48 966.66903 55742.797 264.20211 1.4699573 262.83185 264.45262 1.4699573
1700 44.988869 3421.4427 2141.3199 195.97211 1280.1228 180.56711 1326.1422 227.27194 0 -878.75929 595292.2 -594867.3 269.33339 55742.797 268.91342 1.2659937 264.28353 269.50173 1.2659937
1750 46.32512 3402.6047 2089.4689 191.22675 1313.1357 263.71155 1295.9383 229.85515 0 -905.40883 595296.3 -594867.26 -1711.6299 55742.797 262.56648 0.79625261 258.49733 263.09439 0.79625261
1800 47.626741 3381.3633 2132.4465 195.16003 1248.9167 234.45582 1241.8128 232.64927 0 -887.43322 595295.06 -594867.63 6.1750563 55742.797 268.02308 0.66339407 257.61935 269.20593 0.66339407
1850 48.859097 3358.9769 2090.1997 191.29363 1268.7772 207.84877 1271.8504 229.08032 0 -865.66614 595292.95 -594867.29 1046.4693 55742.797 262.66189 0.78698303 260.47063 262.99635 0.78698303
1900 50.086851 3336.417 2129.6659 194.90555 1206.7511 244.28118 1211.1819 208.93923 0 -884.87319 595293.88 -594866.65 -289.20276 55742.797 267.44697 1.2668343 256.868 268.64764 1.2668343
1950 51.245913 3311.0369 2068.2384 189.28375 1242.7985 243.85893 1242.1317 220.07989 0 -891.04779 595294.68 -594866.91 -1991.6618 55742.797 259.6859 1.3553911 254.54251 260.3233 1.3553911
2000 52.444694 3285.8337 2003.2382 183.33497 1282.5955 227.01654 1237.0479 227.77755 0 -837.34967 595295.6 -594867.49 937.91227 55742.797 251.65869 0.95505158 250.48617 251.88363 0.95505158
Loop time of 52.4449 on 4 procs for 2000 steps with 4500 atoms
Performance: 1.647 ns/day, 14.568 hours/ns, 38.135 timesteps/s
98.1% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 26.398 | 27.961 | 29.034 | 18.3 | 53.31
Bond | 1.3959 | 1.5762 | 1.7169 | 9.5 | 3.01
Kspace | 17.592 | 18.436 | 19.757 | 18.9 | 35.15
Neigh | 0.8492 | 0.85015 | 0.85101 | 0.1 | 1.62
Comm | 1.311 | 1.6626 | 2.0789 | 22.0 | 3.17
Output | 0.010571 | 0.011494 | 0.013821 | 1.3 | 0.02
Modify | 1.8078 | 1.8237 | 1.8372 | 0.8 | 3.48
Other | | 0.1236 | | | 0.24
Nlocal: 1125.00 ave 1220 max 1043 min
Histogram: 1 0 1 0 0 0 1 0 0 1
Nghost: 5813.50 ave 5907 max 5699 min
Histogram: 1 0 0 1 0 0 0 0 1 1
Neighs: 202807.0 ave 217353 max 190808 min
Histogram: 1 1 0 0 0 0 1 0 0 1
Total # of neighbors = 811227
Ave neighs/atom = 180.27267
Ave special neighs/atom = 13.333333
Neighbor list builds = 31
Dangerous builds = 0
Total wall time: 0:00:52

View File

@ -0,0 +1,79 @@
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.600 8.0
kspace_style pppm 1.0e-4
comm_modify vel yes
read_data data.ethanol
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H CTO
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 1 4 lj/cut/coul/long 0.105921 3.304542 # C3H OH
pair_coeff 1 5 lj/cut/coul/long 0.000000 0.000000 # C3H HO
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # CTO CTO
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # CTO H
pair_coeff 2 4 lj/cut/coul/long 0.105921 3.304542 # CTO OH
pair_coeff 2 5 lj/cut/coul/long 0.000000 0.000000 # CTO HO
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff 3 4 lj/cut/coul/long 0.071413 2.792848 # H OH
pair_coeff 3 5 lj/cut/coul/long 0.000000 0.000000 # H HO
pair_coeff 4 4 lj/cut/coul/long 0.169996 3.120000 # OH OH
pair_coeff 4 5 lj/cut/coul/long 0.000000 0.000000 # OH HO
pair_coeff 5 5 lj/cut/coul/long 0.000000 0.000000 # HO HO
pair_coeff * 6*8 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 1 thole 2.051000
pair_coeff 1 2 thole 1.580265
pair_coeff 1 4 thole 1.416087
pair_coeff 1 6 thole 2.051000
pair_coeff 1 7 thole 1.580265
pair_coeff 1 8 thole 1.416087
pair_coeff 2 2 thole 1.217570
pair_coeff 2 4 thole 1.091074
pair_coeff 2 6 thole 1.580265
pair_coeff 2 7 thole 1.217570
pair_coeff 2 8 thole 1.091074
pair_coeff 4 4 thole 0.977720
pair_coeff 4 6 thole 1.416087
pair_coeff 4 7 thole 1.091074
pair_coeff 4 8 thole 0.977720
pair_coeff 6 6 thole 2.051000
pair_coeff 6 7 thole 1.580265
pair_coeff 6 8 thole 1.416087
pair_coeff 7 7 thole 1.217570
pair_coeff 7 8 thole 1.091074
pair_coeff 8 8 thole 0.977720
group gETHANOL molecule 1:250
group gATOMS type 1 2 3 4 5
group gDRUDES type 6 7 8
neighbor 2.0 bin
variable vTEMP equal 300.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gATOMS create ${vTEMP} 12345
velocity gDRUDES create ${vTEMP_D} 12345
fix fDRUDE all drude C C N C N D D D
fix fSHAKE gATOMS shake 0.0001 20 0 b 2 3 5
fix fNPT all tgnpt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNPT[1] f_fNPT[2] f_fNPT[3]
thermo 20
timestep 0.5
run 2000

View File

@ -0,0 +1,287 @@
LAMMPS (29 Oct 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
using 1 OpenMP thread(s) per MPI task
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.600 8.0
kspace_style pppm 1.0e-4
comm_modify vel yes
read_data data.ethanol
Reading data file ...
orthogonal box = (-14.013845 -14.027809 -14.018882) to (14.016930 14.017730 14.085730)
1 by 1 by 1 MPI processor grid
reading atoms ...
3000 atoms
scanning bonds ...
5 = max bonds/atom
scanning angles ...
6 = max angles/atom
scanning dihedrals ...
9 = max dihedrals/atom
reading bonds ...
2750 bonds
reading angles ...
3250 angles
reading dihedrals ...
3000 dihedrals
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0.0 0.0 0.5
special bond factors coul: 0.0 0.0 0.5
5 = max # of 1-2 neighbors
6 = max # of 1-3 neighbors
10 = max # of 1-4 neighbors
11 = max # of special neighbors
special bonds CPU = 0.003 seconds
read_data CPU = 0.062 seconds
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H CTO
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 1 4 lj/cut/coul/long 0.105921 3.304542 # C3H OH
pair_coeff 1 5 lj/cut/coul/long 0.000000 0.000000 # C3H HO
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # CTO CTO
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # CTO H
pair_coeff 2 4 lj/cut/coul/long 0.105921 3.304542 # CTO OH
pair_coeff 2 5 lj/cut/coul/long 0.000000 0.000000 # CTO HO
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff 3 4 lj/cut/coul/long 0.071413 2.792848 # H OH
pair_coeff 3 5 lj/cut/coul/long 0.000000 0.000000 # H HO
pair_coeff 4 4 lj/cut/coul/long 0.169996 3.120000 # OH OH
pair_coeff 4 5 lj/cut/coul/long 0.000000 0.000000 # OH HO
pair_coeff 5 5 lj/cut/coul/long 0.000000 0.000000 # HO HO
pair_coeff * 6*8 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 1 thole 2.051000
pair_coeff 1 2 thole 1.580265
pair_coeff 1 4 thole 1.416087
pair_coeff 1 6 thole 2.051000
pair_coeff 1 7 thole 1.580265
pair_coeff 1 8 thole 1.416087
pair_coeff 2 2 thole 1.217570
pair_coeff 2 4 thole 1.091074
pair_coeff 2 6 thole 1.580265
pair_coeff 2 7 thole 1.217570
pair_coeff 2 8 thole 1.091074
pair_coeff 4 4 thole 0.977720
pair_coeff 4 6 thole 1.416087
pair_coeff 4 7 thole 1.091074
pair_coeff 4 8 thole 0.977720
pair_coeff 6 6 thole 2.051000
pair_coeff 6 7 thole 1.580265
pair_coeff 6 8 thole 1.416087
pair_coeff 7 7 thole 1.217570
pair_coeff 7 8 thole 1.091074
pair_coeff 8 8 thole 0.977720
group gETHANOL molecule 1:250
3000 atoms in group gETHANOL
group gATOMS type 1 2 3 4 5
2250 atoms in group gATOMS
group gDRUDES type 6 7 8
750 atoms in group gDRUDES
neighbor 2.0 bin
variable vTEMP equal 300.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gATOMS create ${vTEMP} 12345
velocity gATOMS create 300 12345
velocity gDRUDES create ${vTEMP_D} 12345
velocity gDRUDES create 1 12345
fix fDRUDE all drude C C N C N D D D
fix fSHAKE gATOMS shake 0.0001 20 0 b 2 3 5
250 = # of size 2 clusters
250 = # of size 3 clusters
250 = # of size 4 clusters
0 = # of frozen angles
find clusters CPU = 0.001 seconds
fix fNPT all tgnpt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso 1 ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso 1 1 1000
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNPT[1] f_fNPT[2] f_fNPT[3]
thermo 20
timestep 0.5
run 2000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:328)
G vector (1/distance) = 0.37973843
grid = 30 30 30
stencil order = 5
estimated absolute RMS force accuracy = 0.028997858
estimated relative force accuracy = 8.7326188e-05
using double precision FFTW3
3d grid and FFT values/proc = 50653 27000
Rebuild special list taking Drude particles into account
Old max number of 1-2 to 1-4 neighbors: 11
New max number of 1-2 to 1-4 neighbors: 11 (+0)
Neighbor list info ...
update every 1 steps, delay 10 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 10
ghost atom cutoff = 10
binsize = 5, bins = 6 6 6
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair lj/cut/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair thole, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
TGNHC thermostat for Drude model
DOFs of molecules, atoms and dipoles: 747.0 4500.0 2250.0
Per MPI rank memory allocation (min/avg/max) = 22.99 | 22.99 | 22.99 Mbytes
Step CPU TotEng KinEng Temp PotEng E_bond E_angle E_dihed E_impro E_vdwl E_coul E_long Press Volume c_cTEMP[1] c_cTEMP[2] f_fNPT[1] f_fNPT[2] f_fNPT[3]
0 0 13868.828 2013.3852 270.28772 11855.443 3145.896 51.880809 0.00019113234 0 8481.5109 514734.14 -514557.98 170210.19 22094.109 381.62759 10.134301 291.07893 396.91308 10.134301
20 1.299002 9802.0013 5175.0939 694.7326 4626.9074 1138.6388 2334.7257 132.32135 0 1890.1205 514082.52 -514951.42 83148.665 22175.038 987.97886 9.5650257 2458.1912 744.58226 9.5650257
40 2.6585262 9235.2784 5579.5869 749.03392 3655.6915 905.50827 1897.9797 277.48003 0 1696.6242 513843.84 -514965.74 60300.581 22359.787 1068.9505 1.5632512 2851.9591 773.68368 1.5632512
60 4.0767848 8671.8892 5504.7567 738.98831 3167.1326 829.06537 2052.5827 330.50295 0 997.94126 513948.25 -514991.2 48878.532 22600.438 1054.9063 0.8609188 3046.3154 725.0357 0.8609188
80 5.4198065 8041.4551 5718.4601 767.67701 2322.9951 733.58679 1714.9273 332.16847 0 607.45721 513906.05 -514971.19 46156.9 22855.703 1095.9536 0.67476425 2911.1504 795.36156 0.67476425
100 6.8445274 7424.1846 5485.2445 736.36888 1938.9402 725.61122 1556.2473 334.28427 0 311.33112 513993.29 -514981.82 35649.376 23094.997 1051.3109 0.5222695 2722.3778 774.61471 0.5222695
120 8.1987147 6864.2981 5106.0869 685.46872 1758.2112 639.80517 1608.9702 330.7119 0 225.63755 513930.12 -514977.04 28592.139 23302.575 978.67156 0.41481306 2531.1524 721.61219 0.41481306
140 9.6125531 6355.2419 4782.2344 641.99302 1573.0074 692.8178 1572.2236 329.75157 0 62.526757 513879.29 -514963.61 24166.914 23482.684 916.61358 0.35571984 2382.5955 673.87165 0.35571984
160 10.981043 5871.6552 4610.4861 618.9366 1261.169 680.52384 1414.3474 329.28182 0 -159.78058 513987.52 -514990.72 27542.211 23647.419 883.68752 0.35918951 2123.8994 678.40147 0.35918951
180 12.332621 5435.5691 4279.3184 574.47885 1156.2507 684.91656 1423.9511 309.44801 0 -233.41405 513945.61 -514974.26 18688.318 23808.753 820.22155 0.31322062 1867.6728 646.89147 0.31322062
200 13.684023 5063.6933 3974.692 533.58416 1089.0012 610.82746 1398.9423 299.55778 0 -238.71277 514006.42 -514988.03 14346.596 23962.516 761.81108 0.34323344 1649.6269 614.94153 0.34323344
220 15.025737 4729.6345 3862.1044 518.46979 867.53006 589.15408 1361.5835 291.68077 0 -382.15023 514000.76 -514993.5 14084.228 24106.002 740.21384 0.37572015 1480.8499 617.76172 0.37572015
240 16.361954 4425.17 3701.2817 496.88008 723.88831 584.37459 1295.507 282.13297 0 -468.19466 514014.29 -514984.22 13175.309 24240.893 709.36164 0.42725973 1335.0379 605.97228 0.42725973
260 17.686205 4147.8236 3444.1814 462.36555 703.6422 561.69812 1304.6664 277.46507 0 -505.18688 514062.51 -514997.51 9960.5444 24367.441 660.03654 0.51674844 1202.6787 570.39815 0.51663293
280 19.001433 3906.0499 3263.3789 438.09363 642.67099 612.03629 1258.9736 278.79088 0 -503.36734 513978.2 -514981.97 5911.2321 24482.777 625.29586 0.70431199 1076.194 550.86363 0.70431199
300 20.239475 3688.6521 3138.7761 421.36628 549.87595 589.66541 1229.0183 274.52568 0 -529.41366 513980.02 -514993.93 8818.9035 24585 601.19081 1.2138917 967.42544 540.79666 1.2138917
320 21.55208 3484.9768 3041.6682 408.32999 443.30859 581.36133 1221.761 276.40415 0 -581.91733 513938.29 -514992.59 9181.7725 24679.377 582.27807 1.9067083 865.20562 535.70028 1.9067083
340 22.866527 3301.111 2892.7326 388.33607 408.3784 575.39496 1150.6761 289.75308 0 -522.13929 513897.14 -514982.44 7705.6777 24768.367 553.48144 2.4790842 782.86323 515.77305 2.4790842
360 24.169391 3134.601 2727.1786 366.11121 407.42236 560.04836 1167.7896 290.8151 0 -534.37256 513917.26 -514994.12 5173.1603 24851.201 521.90957 2.0935593 720.9275 489.22054 2.0935593
380 25.499891 2978.9742 2626.4574 352.58985 352.51679 565.92745 1159.8532 276.01665 0 -574.15206 513906.53 -514981.66 5406.7601 24926.52 502.85217 1.5076664 663.92569 476.44959 1.5078823
400 26.749513 2830.4515 2571.0905 345.15709 259.36106 608.49648 1122.7921 254.35509 0 -631.46578 513898.27 -514993.09 6598.5441 24996.189 492.43661 1.0446762 619.49263 471.67242 1.0443567
420 28.295841 2690.9016 2510.0923 336.96837 180.80925 579.44132 1054.4508 246.41333 0 -619.58628 513907.01 -514986.92 3344.148 25062.431 480.89086 0.69994647 565.8201 467.11319 0.69994647
440 29.740652 2568.0899 2415.0979 324.2158 152.99201 549.56174 1062.4133 248.3112 0 -625.52103 513895.56 -514977.34 1508.2507 25122.432 462.77313 0.4830629 522.5615 453.15678 0.4830629
460 31.033999 2452.8301 2374.2562 318.73299 78.573926 560.62424 1025.2699 241.11159 0 -664.87807 513904.81 -514988.36 2645.1623 25175.119 454.98091 0.39620035 489.058 449.62743 0.39620035
480 32.287371 2343.6513 2309.9229 310.09654 33.728418 543.67605 1036.735 236.6691 0 -646.19525 513846.07 -514983.23 4840.3297 25223.454 442.64176 0.41089885 466.91678 438.90721 0.41089885
500 33.575452 2237.0869 2186.7578 293.56219 50.329153 569.29753 1077.789 237.78011 0 -644.2024 513802.59 -514992.93 3147.641 25270.717 419.03821 0.39338041 448.26725 414.46511 0.39352695
520 34.882586 2139.9267 2184.6613 293.28075 -44.734618 598.44589 949.76187 230.75426 0 -639.80829 513811.79 -514995.68 89.417432 25315.104 418.62009 0.43123772 424.93066 417.85161 0.43123772
540 36.099168 2047.6906 2096.7059 281.47314 -49.015331 603.23512 994.03336 236.23878 0 -642.85411 513760.61 -515000.28 2488.0247 25353.845 401.6824 0.6095642 402.80198 401.76434 0.6095642
560 37.392444 1959.8223 2108.0902 283.00143 -148.26783 556.77844 933.83445 228.23222 0 -640.71325 513772.73 -514999.13 3943.0471 25390.643 403.78476 0.79631768 387.29154 406.79182 0.79631768
580 38.599277 1877.9441 2032.3004 272.827 -154.35632 567.35925 915.88654 217.432 0 -638.21268 513777.18 -514994 990.21765 25427.432 389.08915 1.184871 380.81536 390.72199 1.184871
600 39.880662 1802.0089 2025.4302 271.90471 -223.42134 546.62696 900.79592 214.83879 0 -668.01506 513782.41 -515000.08 13.167029 25461.023 387.51997 1.7732181 375.29493 389.80736 1.773544
620 41.151704 1729.2181 1934.4658 259.69315 -205.24769 550.82063 913.19495 217.45935 0 -675.32746 513791.35 -515002.74 241.52954 25490.189 369.99117 1.9848435 365.94576 370.90937 1.9848435
640 42.367107 1658.2621 1869.4172 250.96067 -211.15505 560.62227 911.72129 213.95368 0 -665.21833 513766.85 -514999.08 3632.223 25516.498 357.58414 1.8379694 353.567 358.48938 1.8379694
660 43.641386 1588.4137 1852.2333 248.65382 -263.8196 577.15612 856.06817 203.8208 0 -643.32076 513743.58 -515001.12 1748.9053 25544.141 354.40947 1.5590879 342.18406 356.67449 1.5598187
680 44.916294 1522.8833 1803.3756 242.0949 -280.4923 569.2594 868.20962 207.92742 0 -667.28233 513741.85 -515000.45 -707.71197 25570.844 345.28497 0.99527257 329.41069 348.14899 0.99572941
700 46.126721 1461.9096 1769.8128 237.58924 -307.90315 542.7914 861.81473 203.22264 0 -674.68634 513754.76 -514995.8 1167.0096 25593.851 338.95839 0.74443058 320.56652 342.23742 0.74427874
720 47.342692 1403.7901 1774.9009 238.2723 -371.11079 533.63282 871.2916 186.94204 0 -661.24368 513696.56 -514998.29 1734.2343 25615.595 339.99734 0.59618884 315.31635 344.32074 0.59612251
740 48.606886 1347.7019 1788.1767 240.05451 -440.47482 551.44173 832.07818 173.00046 0 -679.31011 513685.34 -515003.03 1108.3607 25637.321 342.57548 0.51883795 311.99896 347.87957 0.51883795
760 49.886167 1294.2014 1732.3399 232.55868 -438.13849 563.187 825.18662 175.50788 0 -672.34818 513677.51 -515007.18 -2118.7763 25657.738 331.88911 0.47758368 305.31362 336.52173 0.47757969
780 51.181176 1243.7936 1720.77 231.00547 -476.9764 565.28094 800.5385 187.89263 0 -663.7818 513643.08 -515009.99 142.9942 25673.523 329.66915 0.48221433 293.10673 335.95739 0.48257178
800 52.501053 1195.7584 1713.4482 230.02255 -517.6898 575.29743 793.40588 182.96177 0 -652.3437 513594.18 -515011.19 2569.2035 25687.829 328.22734 0.57136512 282.06342 336.10937 0.57136512
820 53.730285 1149.3704 1688.6401 226.69218 -539.26966 566.02535 783.51259 170.42752 0 -645.21365 513596.56 -515010.58 158.43243 25703.753 323.41372 0.70633792 274.90722 331.6814 0.70633792
840 55.059346 1107.3402 1626.7277 218.38072 -519.38749 557.00463 817.13283 161.18356 0 -661.6802 513616.64 -515009.67 -859.99932 25718.477 311.42538 0.98533165 274.36623 317.78482 0.98533165
860 56.26804 1067.0989 1619.5401 217.41582 -552.44114 567.51474 819.44456 157.01002 0 -653.65749 513563.92 -515006.67 -110.22037 25730.521 309.90587 1.3158099 279.28284 315.1959 1.3158099
880 57.552129 1028.7737 1622.6482 217.83307 -593.87455 579.7559 769.38822 163.25737 0 -641.48094 513545.77 -515010.56 2044.3918 25741.489 310.33341 1.7085038 277.85767 315.93127 1.7085038
900 58.752011 990.85148 1635.8709 219.60816 -645.01941 590.07687 741.99946 160.20976 0 -648.65733 513521.95 -515010.6 -616.21441 25753.742 312.82551 1.8081896 279.97773 318.48679 1.8081896
920 60.02342 953.65737 1657.228 222.47525 -703.57061 574.2732 734.42873 151.5283 0 -657.51865 513506.29 -515012.57 -2391.2196 25763.907 316.97803 1.6721323 286.84832 322.1911 1.6717714
940 61.246864 917.3708 1532.2653 205.69958 -614.89448 576.8991 775.3663 162.78532 0 -639.35069 513524.45 -515015.04 564.89367 25770.107 293.21271 1.2280076 293.75433 293.31884 1.2282942
960 62.520232 883.18364 1537.9463 206.46223 -654.76268 563.51425 761.32405 161.47799 0 -631.38061 513503.44 -515013.14 1374.3226 25776.278 294.40866 0.9786147 300.31219 293.62423 0.97818807
980 63.72859 851.43088 1538.0246 206.47273 -686.59368 565.62724 756.61795 152.08723 0 -645.22417 513500.66 -515016.36 -203.76984 25783.711 294.53876 0.71003563 300.78246 293.69924 0.71029723
1000 65.325249 822.29342 1546.1186 207.55932 -723.82514 573.24707 705.27714 145.40402 0 -627.3824 513491.87 -515012.24 -1482.5195 25790.098 296.12917 0.61958842 301.40343 295.45106 0.61958842
1020 67.066265 795.41337 1551.6368 208.30012 -756.22343 597.40466 700.03219 143.14559 0 -631.02663 513445.32 -515011.1 748.62224 25794.159 297.21498 0.5543604 297.93873 297.29299 0.5543604
1040 68.784411 769.92029 1548.9081 207.9338 -778.9878 581.53993 723.87795 137.61133 0 -624.63041 513420.31 -515017.7 1356.2174 25798.811 296.7141 0.50251818 294.64447 297.25547 0.50251818
1060 70.531164 745.98628 1514.0024 203.24787 -768.0161 590.02417 718.13714 148.25485 0 -620.67061 513412.77 -515016.53 -984.90789 25804.672 289.98962 0.57944566 296.06714 289.17408 0.57944566
1080 72.339286 724.41988 1468.7378 197.17131 -744.31795 587.12574 750.82761 166.43289 0 -611.54088 513376.94 -515014.1 -1369.9774 25808.741 281.26901 0.68044534 297.86474 278.70146 0.68043227
1100 74.081078 705.1492 1475.7507 198.11275 -770.60147 596.03939 703.74275 166.87407 0 -604.94878 513382.71 -515015.02 322.11458 25810.632 282.54351 0.84350846 304.3263 279.11613 0.84359917
1120 75.92559 688.04772 1517.3948 203.70329 -829.34708 589.83314 688.24666 158.8665 0 -610.41803 513358.01 -515013.88 1171.4548 25812.799 290.41298 1.1090646 307.74167 287.73002 1.1090646
1140 77.724149 672.36504 1512.4831 203.04391 -840.11804 611.8019 686.11567 154.1589 0 -600.4798 513325.18 -515016.9 -1129.2791 25816.098 289.32063 1.4608372 307.70226 286.46216 1.4608372
1160 79.533442 657.64948 1524.9394 204.71611 -867.2899 614.09367 686.86805 145.77079 0 -587.50349 513287.47 -515013.99 -1405.9783 25817.666 291.61223 1.6855491 302.37391 290.02089 1.6855106
1180 81.243201 643.07936 1483.2148 199.11478 -840.13545 607.70554 729.46823 145.73396 0 -581.12793 513268.2 -515010.11 951.82863 25817.313 283.62844 1.6507547 296.31179 281.7127 1.6507678
1200 83.124235 628.84892 1508.103 202.45591 -879.25413 610.27958 699.47204 146.65751 0 -581.22705 513258.98 -515013.42 845.8635 25818.085 288.47775 1.4683346 288.26595 288.70552 1.4687429
1220 84.861868 615.48595 1506.3938 202.22645 -890.90781 640.61601 705.74981 149.24915 0 -568.44006 513197.45 -515015.53 -989.87699 25819.897 288.2897 1.1425522 284.47457 289.11499 1.1433225
1240 86.657973 603.46611 1521.8 204.29466 -918.3339 627.93094 681.9999 147.50604 0 -563.03024 513206.69 -515019.43 -1294.0886 25820.275 291.33208 0.93495852 284.52005 292.65658 0.93566845
1260 88.527368 592.83025 1550.0222 208.08336 -957.19193 638.74876 684.27892 144.10419 0 -567.28292 513161.98 -515019.02 366.82518 25818.88 296.84123 0.70423253 289.40784 298.27306 0.70423253
1280 90.26083 583.62238 1500.3203 201.41111 -916.69791 658.39007 717.40575 149.49357 0 -560.74831 513138.12 -515019.36 468.99306 25817.909 287.36089 0.59306602 294.54267 286.36029 0.59306602
1300 92.13165 575.42151 1519.3082 203.96014 -943.88664 655.72041 704.25181 141.32573 0 -550.47558 513125.5 -515020.21 -1022.3924 25817.559 291.00356 0.58689962 300.73954 289.58167 0.58691655
1320 93.894194 568.3477 1518.4074 203.83922 -950.05966 670.96379 726.82052 139.93925 0 -527.97883 513058.34 -515018.15 -972.06273 25815.822 290.83615 0.57457637 307.54777 288.256 0.57459152
1340 95.719114 562.07892 1523.1375 204.47422 -961.05857 677.25051 688.02873 138.64793 0 -528.35304 513081.3 -515017.94 1058.9949 25813.039 291.70253 0.66885112 312.02785 288.52311 0.66873042
1360 97.524416 556.93389 1560.3959 209.47598 -1003.462 665.73523 686.80959 139.77318 0 -523.04289 513045.29 -515018.03 937.16072 25811.796 298.7948 0.7861094 312.82634 296.66456 0.78666076
1380 99.357452 553.33396 1516.3062 203.55714 -962.97224 678.04454 713.74957 137.42774 0 -517.91272 513044.03 -515018.31 -292.99291 25811.915 290.25807 0.98357958 308.02329 287.50255 0.98357958
1400 101.09848 550.59887 1532.5676 205.74016 -981.9687 668.87709 700.85053 135.12927 0 -539.20798 513074.89 -515022.51 -1158.8487 25811.561 293.25245 1.2705054 302.5546 291.90379 1.2705054
1420 102.92972 548.73321 1476.7658 198.24903 -928.03261 677.96546 739.35433 145.56163 0 -552.34431 513084.77 -515023.34 9.5625031 25809.75 282.48418 1.436009 300.29464 279.71597 1.436009
1440 104.66752 547.12666 1527.8761 205.11036 -980.74947 650.61377 711.8671 147.59824 0 -556.66671 513090.53 -515024.69 1019.1836 25808.157 292.23402 1.5483375 300.12772 291.11848 1.5483375
1460 106.50314 545.65053 1490.3999 200.07935 -944.74941 670.75445 719.7737 150.18449 0 -549.39105 513087.25 -515023.32 -1319.4425 25807.672 285.07809 1.4821899 301.34029 282.56847 1.4823299
1480 108.28741 544.77516 1526.097 204.87152 -981.32183 652.3433 696.79415 149.20209 0 -556.6563 513098.18 -515021.18 -742.16174 25805.656 292.01497 1.2636175 302.51451 290.4664 1.2639932
1500 110.12511 545.19541 1545.583 207.48742 -1000.3876 645.73389 715.44716 136.9985 0 -567.26011 513090.87 -515022.18 -400.28471 25802.486 295.86865 0.987897 302.34922 294.99013 0.987897
1520 111.89057 546.1418 1523.2045 204.48322 -977.06274 643.78664 737.65713 128.87884 0 -556.6123 513087.83 -515018.61 382.6378 25799.004 291.65193 0.81691637 299.79434 290.49472 0.81691637
1540 113.68915 548.12322 1532.5317 205.73534 -984.40845 662.00085 713.14115 141.83628 0 -546.54637 513065.85 -515020.69 -558.02865 25796.128 293.49257 0.69415483 292.07299 293.92389 0.69415483
1560 115.74426 551.58749 1524.0291 204.59391 -972.44159 662.89347 709.62799 163.91089 0 -538.91833 513050.59 -515020.55 -1648.6737 25792.534 291.9015 0.60340834 283.91962 293.42109 0.60340834
1580 118.02455 556.31359 1557.1932 209.04604 -1000.8797 650.22504 703.18471 164.34921 0 -547.76291 513048.79 -515019.67 218.40066 25787.071 298.26162 0.59762744 279.75915 301.53187 0.59762744
1600 119.98362 561.8489 1536.2864 206.2394 -974.4375 650.4012 725.52549 152.37926 0 -524.6233 513039.24 -515017.36 724.91327 25782.038 294.23674 0.63726972 276.89513 297.31161 0.63726972
1620 121.24569 568.29298 1516.8518 203.6304 -948.55886 669.43634 758.17152 141.59579 0 -508.64869 513005.84 -515014.95 305.45057 25778.393 290.46698 0.74019001 276.01771 293.0592 0.74019001
1640 122.52086 575.42679 1531.3719 205.57965 -955.94515 683.26836 731.47049 143.09022 0 -504.62735 513005.89 -515015.04 -1258.1839 25775.243 293.18351 0.89655264 276.95868 296.07228 0.89655264
1660 123.85319 583.33428 1520.971 204.18338 -937.63676 670.138 752.36615 158.20486 0 -497.10065 512993.63 -515014.87 990.4476 25771.018 291.11283 1.0757415 276.8874 293.66833 1.0757415
1680 125.13263 591.99646 1532.4661 205.72654 -940.46967 689.25478 743.16987 168.03522 0 -502.0189 512975.1 -515014.01 1349.4251 25768.301 293.2049 1.3360644 279.26444 295.71449 1.3360644
1700 126.41729 600.72595 1576.928 211.69534 -976.20204 698.82384 728.20266 164.32429 0 -509.63109 512960.78 -515018.71 -714.74537 25767.499 301.65964 1.4963853 288.03969 304.12166 1.4963853
1720 127.8002 608.72776 1572.2293 211.06457 -963.50155 686.50487 751.5254 162.66596 0 -520.30848 512974.4 -515018.29 -1233.7505 25765.895 300.75432 1.507047 296.46478 301.66689 1.507047
1740 129.05369 615.86972 1571.5987 210.97992 -955.72903 672.03255 760.03518 170.57691 0 -531.78859 512987.74 -515014.32 -5.6954413 25762.646 300.66959 1.422713 303.78613 300.35269 1.422713
1760 130.46587 622.55796 1579.5377 212.04568 -956.97974 706.80226 734.80437 178.63803 0 -529.02192 512966.71 -515014.91 1439.5408 25759.728 302.30266 1.1633531 310.55359 301.13515 1.1641118
1780 131.77476 628.52662 1584.4407 212.70388 -955.91404 676.79766 773.29727 172.22703 0 -534.56221 512976.35 -515020.03 -1144.3707 25758.632 303.36936 0.86750014 314.93649 301.6529 0.86760316
1800 133.12003 634.21603 1614.4896 216.73781 -980.27353 677.17437 758.17735 157.86038 0 -522.96761 512972.14 -515022.66 -952.36111 25756.246 309.15671 0.80472277 318.00054 307.89448 0.80488217
1820 134.41588 639.49479 1633.2745 219.2596 -993.77971 706.25176 736.76382 153.75695 0 -523.32693 512955.21 -515022.44 534.27821 25752.618 312.8094 0.68438418 326.33448 310.77281 0.68437053
1840 135.69809 643.87101 1634.8429 219.47015 -990.97185 701.84421 766.76216 151.35177 0 -502.94871 512911.91 -515019.89 654.67154 25749.912 313.13395 0.62866073 330.35595 310.48258 0.62856511
1860 137.01849 646.9769 1624.5262 218.08519 -977.54933 717.81093 788.02881 151.94179 0 -495.90915 512881.92 -515021.34 -1064.2782 25748.146 311.14125 0.66359764 330.55161 308.12656 0.66359764
1880 138.29577 648.32991 1639.5616 220.10361 -991.23166 726.93665 759.79041 159.81907 0 -493.81895 512873.87 -515017.83 -1411.6366 25744.916 313.99078 0.74007658 329.3198 311.65549 0.74007658
1900 139.67366 648.89417 1644.4291 220.75706 -995.53493 724.72865 762.39029 163.96612 0 -495.61342 512866.53 -515017.54 1351.1833 25740.228 314.85836 0.89300573 324.54001 313.46241 0.89316115
1920 140.93714 648.51479 1660.4204 222.90381 -1011.9056 683.6849 759.17365 164.85228 0 -494.26512 512891.03 -515016.38 401.57284 25737.361 317.86954 1.0199045 319.35529 317.83552 1.0202343
1940 142.29997 646.69169 1612.2108 216.43189 -965.51908 714.97385 778.57354 175.15205 0 -508.7717 512893.53 -515018.97 -1076.6986 25735.181 308.53939 1.2258299 312.47436 308.09188 1.2258299
1960 143.5485 643.66804 1612.4723 216.467 -968.80423 729.94319 778.86473 177.62474 0 -483.88964 512849.44 -515020.79 -696.10678 25731.708 308.50602 1.4206534 300.71602 310.00483 1.4206534
1980 144.89715 639.49991 1600.0251 214.79602 -960.52514 725.68053 773.8468 176.16615 0 -469.86188 512851.09 -515017.45 822.18174 25727.586 306.08335 1.5058554 291.63271 308.68799 1.505066
2000 146.15013 633.86554 1648.9263 221.36078 -1015.0607 703.29388 761.03433 170.08933 0 -468.34451 512835.81 -515016.94 763.74636 25724.778 315.51687 1.3681009 284.57812 320.86295 1.3683497
Loop time of 146.15 on 1 procs for 2000 steps with 3000 atoms
Performance: 0.591 ns/day, 40.597 hours/ns, 13.685 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 92.462 | 92.462 | 92.462 | 0.0 | 63.26
Bond | 2.9377 | 2.9377 | 2.9377 | 0.0 | 2.01
Kspace | 28.493 | 28.493 | 28.493 | 0.0 | 19.50
Neigh | 4.3811 | 4.3811 | 4.3811 | 0.0 | 3.00
Comm | 0.86167 | 0.86167 | 0.86167 | 0.0 | 0.59
Output | 0.040132 | 0.040132 | 0.040132 | 0.0 | 0.03
Modify | 16.886 | 16.886 | 16.886 | 0.0 | 11.55
Other | | 0.08886 | | | 0.06
Nlocal: 3000.00 ave 3000 max 3000 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 10696.0 ave 10696 max 10696 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 737603.0 ave 737603 max 737603 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 737603
Ave neighs/atom = 245.86767
Ave special neighs/atom = 10.500000
Neighbor list builds = 59
Dangerous builds = 0
Total wall time: 0:02:26

View File

@ -0,0 +1,287 @@
LAMMPS (29 Oct 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
using 1 OpenMP thread(s) per MPI task
units real
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5
pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.600 8.0
kspace_style pppm 1.0e-4
comm_modify vel yes
read_data data.ethanol
Reading data file ...
orthogonal box = (-14.013845 -14.027809 -14.018882) to (14.016930 14.017730 14.085730)
1 by 2 by 2 MPI processor grid
reading atoms ...
3000 atoms
scanning bonds ...
5 = max bonds/atom
scanning angles ...
6 = max angles/atom
scanning dihedrals ...
9 = max dihedrals/atom
reading bonds ...
2750 bonds
reading angles ...
3250 angles
reading dihedrals ...
3000 dihedrals
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0.0 0.0 0.5
special bond factors coul: 0.0 0.0 0.5
5 = max # of 1-2 neighbors
6 = max # of 1-3 neighbors
10 = max # of 1-4 neighbors
11 = max # of special neighbors
special bonds CPU = 0.003 seconds
read_data CPU = 0.115 seconds
pair_coeff 1 1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff 1 2 lj/cut/coul/long 0.065997 3.500000 # C3H CTO
pair_coeff 1 3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff 1 4 lj/cut/coul/long 0.105921 3.304542 # C3H OH
pair_coeff 1 5 lj/cut/coul/long 0.000000 0.000000 # C3H HO
pair_coeff 2 2 lj/cut/coul/long 0.065997 3.500000 # CTO CTO
pair_coeff 2 3 lj/cut/coul/long 0.044496 2.958040 # CTO H
pair_coeff 2 4 lj/cut/coul/long 0.105921 3.304542 # CTO OH
pair_coeff 2 5 lj/cut/coul/long 0.000000 0.000000 # CTO HO
pair_coeff 3 3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff 3 4 lj/cut/coul/long 0.071413 2.792848 # H OH
pair_coeff 3 5 lj/cut/coul/long 0.000000 0.000000 # H HO
pair_coeff 4 4 lj/cut/coul/long 0.169996 3.120000 # OH OH
pair_coeff 4 5 lj/cut/coul/long 0.000000 0.000000 # OH HO
pair_coeff 5 5 lj/cut/coul/long 0.000000 0.000000 # HO HO
pair_coeff * 6*8 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff 1 1 thole 2.051000
pair_coeff 1 2 thole 1.580265
pair_coeff 1 4 thole 1.416087
pair_coeff 1 6 thole 2.051000
pair_coeff 1 7 thole 1.580265
pair_coeff 1 8 thole 1.416087
pair_coeff 2 2 thole 1.217570
pair_coeff 2 4 thole 1.091074
pair_coeff 2 6 thole 1.580265
pair_coeff 2 7 thole 1.217570
pair_coeff 2 8 thole 1.091074
pair_coeff 4 4 thole 0.977720
pair_coeff 4 6 thole 1.416087
pair_coeff 4 7 thole 1.091074
pair_coeff 4 8 thole 0.977720
pair_coeff 6 6 thole 2.051000
pair_coeff 6 7 thole 1.580265
pair_coeff 6 8 thole 1.416087
pair_coeff 7 7 thole 1.217570
pair_coeff 7 8 thole 1.091074
pair_coeff 8 8 thole 0.977720
group gETHANOL molecule 1:250
3000 atoms in group gETHANOL
group gATOMS type 1 2 3 4 5
2250 atoms in group gATOMS
group gDRUDES type 6 7 8
750 atoms in group gDRUDES
neighbor 2.0 bin
variable vTEMP equal 300.0
variable vTEMP_D equal 1.0
variable vPRESS equal 1.0
velocity gATOMS create ${vTEMP} 12345
velocity gATOMS create 300 12345
velocity gDRUDES create ${vTEMP_D} 12345
velocity gDRUDES create 1 12345
fix fDRUDE all drude C C N C N D D D
fix fSHAKE gATOMS shake 0.0001 20 0 b 2 3 5
250 = # of size 2 clusters
250 = # of size 3 clusters
250 = # of size 4 clusters
0 = # of frozen angles
find clusters CPU = 0.001 seconds
fix fNPT all tgnpt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso ${vPRESS} ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso 1 ${vPRESS} 1000
fix fNPT all tgnpt/drude temp 300 300 100.0 1 20.0 iso 1 1 1000
compute cTEMP all temp/drude
thermo_style custom step cpu etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNPT[1] f_fNPT[2] f_fNPT[3]
thermo 20
timestep 0.5
run 2000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:328)
G vector (1/distance) = 0.37973843
grid = 30 30 30
stencil order = 5
estimated absolute RMS force accuracy = 0.028997858
estimated relative force accuracy = 8.7326188e-05
using double precision FFTW3
3d grid and FFT values/proc = 17908 7200
Rebuild special list taking Drude particles into account
Old max number of 1-2 to 1-4 neighbors: 11
New max number of 1-2 to 1-4 neighbors: 11 (+0)
Neighbor list info ...
update every 1 steps, delay 10 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 10
ghost atom cutoff = 10
binsize = 5, bins = 6 6 6
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair lj/cut/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair thole, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
TGNHC thermostat for Drude model
DOFs of molecules, atoms and dipoles: 747.0 4500.0 2250.0
Per MPI rank memory allocation (min/avg/max) = 16.30 | 16.32 | 16.34 Mbytes
Step CPU TotEng KinEng Temp PotEng E_bond E_angle E_dihed E_impro E_vdwl E_coul E_long Press Volume c_cTEMP[1] c_cTEMP[2] f_fNPT[1] f_fNPT[2] f_fNPT[3]
0 0 13868.828 2013.3852 270.28772 11855.443 3145.896 51.880809 0.00019113234 0 8481.5109 514734.14 -514557.98 170210.19 22094.109 381.62759 10.134301 291.07893 396.91308 10.134301
20 0.5489804 9803.4819 5175.7976 694.82706 4627.6843 1139.1179 2334.7381 132.32214 0 1890.1377 514082.74 -514951.37 83147.098 22175.037 987.97841 9.8830686 2458.1459 744.58371 9.8830686
40 1.1305859 9235.5604 5579.723 749.0522 3655.8374 905.64066 1897.9743 277.47993 0 1696.6152 513843.93 -514965.8 60300.791 22359.784 1068.9531 1.6180875 2851.9045 773.69577 1.6180875
60 1.7763265 8672.0018 5504.7529 738.98781 3167.2488 829.16747 2052.5807 330.50296 0 997.97233 513948.23 -514991.2 48877.822 22600.434 1054.8974 0.8814188 3046.2785 725.0302 0.8814188
80 2.3974232 8041.5241 5718.5668 767.69134 2322.9573 733.63486 1714.8909 332.16188 0 607.44872 513906.01 -514971.19 46157.199 22855.699 1095.9682 0.68487797 2911.1669 795.37545 0.68487797
100 3.0302813 7424.2386 5485.3388 736.38155 1938.8999 725.65842 1556.2309 334.30067 0 311.29882 513993.24 -514981.83 35648.625 23094.994 1051.3251 0.52778467 2722.3899 774.63067 0.52778467
120 3.6273007 6864.3426 5106.0771 685.46741 1758.2655 639.83956 1608.9962 330.73079 0 225.62345 513930.12 -514977.04 28591.458 23302.572 978.66797 0.41866327 2531.1648 721.6052 0.41866327
140 4.196656 6355.3019 4782.0272 641.9652 1573.2747 692.74007 1572.242 329.76251 0 62.485696 513879.64 -514963.6 24167.635 23482.68 916.57384 0.35834425 2382.631 673.81858 0.35834425
160 4.779717 5871.7118 4610.7111 618.9668 1261.0006 680.57069 1414.3177 329.24321 0 -159.81123 513987.38 -514990.7 27541.231 23647.415 883.72945 0.36200572 2123.9268 678.44584 0.36200572
180 5.338641 5435.6217 4279.7314 574.5343 1155.8903 684.86021 1423.9782 309.42239 0 -233.49805 513945.42 -514974.29 18687.102 23808.747 820.29876 0.31648848 1867.6601 646.98347 0.31648848
200 5.9102262 5063.7313 3974.8766 533.60893 1088.8548 610.8373 1399.1355 299.45065 0 -238.66713 514006.14 -514988.04 14346.964 23962.508 761.84531 0.34591369 1649.624 614.98194 0.34591369
220 6.4670983 4729.6679 3862.1203 518.47192 867.54758 589.19356 1361.7383 291.57325 0 -382.16606 514000.72 -514993.51 14083.524 24105.992 740.21525 0.37963928 1480.8429 617.76448 0.37963928
240 7.0337756 4425.2126 3701.4126 496.89765 723.79998 584.3439 1295.3888 282.13205 0 -468.28082 514014.44 -514984.22 13173.086 24240.879 709.38377 0.43418988 1335.0115 606.00249 0.43418988
260 7.6151553 4147.9089 3443.8677 462.32342 704.04123 561.65864 1304.8745 277.43914 0 -505.26328 514062.78 -514997.45 9958.5179 24367.421 659.97189 0.52765671 1202.5793 570.33937 0.52753359
280 8.1803862 3906.1678 3262.9801 438.0401 643.18765 611.98615 1259.2636 278.89902 0 -503.31011 513978.3 -514981.95 5914.4091 24482.749 625.21285 0.7191852 1076.0582 550.78956 0.7191852
300 8.7043311 3688.7789 3139.2097 421.42449 549.56918 589.70836 1228.8579 274.66549 0 -529.44562 513979.71 -514993.93 8820.6294 24584.968 601.2678 1.2327257 967.30569 540.9051 1.2327257
320 9.2828722 3485.0301 3041.6251 408.32421 443.40492 581.268 1221.8962 276.57911 0 -581.90861 513938.2 -514992.63 9180.621 24679.345 582.26671 1.9139563 865.07721 535.70848 1.9139563
340 9.8440863 3301.0782 2892.3054 388.27872 408.77286 575.63973 1150.7154 289.94072 0 -522.07034 513896.97 -514982.42 7703.8271 24768.334 553.40856 2.4558958 782.77492 515.70254 2.4558958
360 10.398275 3134.468 2727.432 366.14522 407.03603 560.03929 1167.6565 290.68699 0 -534.30813 513917.05 -514994.09 5177.6501 24851.165 521.97249 2.0603668 720.8089 489.31359 2.0603668
380 10.971208 2978.8927 2626.9512 352.65614 351.94143 566.26677 1159.7933 275.53948 0 -574.10697 513905.99 -514981.54 5406.9463 24926.487 502.95796 1.4831172 663.80755 476.59194 1.4833313
400 11.487591 2830.3779 2572.5528 345.3534 257.82518 609.13682 1122.447 253.59547 0 -631.51589 513897.17 -514993.01 6594.5632 24996.158 492.72116 1.0347263 619.38728 472.02151 1.0352452
420 12.147771 2690.8114 2511.4485 337.15043 179.36289 580.62912 1054.4972 245.98614 0 -619.15187 513904.39 -514986.98 3340.3887 25062.398 481.15102 0.69884987 565.60536 467.45245 0.69884987
440 12.683915 2567.8386 2417.1223 324.48758 150.71626 550.84021 1061.6154 248.79898 0 -625.11745 513892.15 -514977.57 1516.8529 25122.396 463.15967 0.48668891 522.23117 453.66261 0.48668891
460 13.219765 2452.4983 2377.8819 319.21973 74.616329 562.85065 1024.1437 240.77499 0 -664.71238 513899.97 -514988.41 2625.4899 25175.085 455.6735 0.40127583 488.72927 450.48999 0.40127583
480 13.734817 2343.3317 2306.9816 309.70169 36.35008 544.98865 1036.7003 239.14437 0 -646.5969 513844.75 -514982.63 4826.9949 25223.402 442.07562 0.41558073 466.54905 438.30802 0.41558073
500 14.2704 2236.968 2183.0006 293.0578 53.967445 569.68824 1077.5153 241.06612 0 -644.36418 513802.58 -514992.52 3137.1149 25270.633 418.31485 0.39923526 447.67208 413.72065 0.39935381
520 14.830149 2139.9757 2184.3136 293.23408 -44.337922 598.68848 949.68592 231.65813 0 -640.55841 513811.34 -514995.15 74.532539 25314.977 418.54937 0.44074429 424.27621 417.87775 0.44074429
540 15.342945 2047.7713 2097.3453 281.55898 -49.574068 603.65225 992.19405 234.95516 0 -644.08949 513763.2 -514999.49 2503.1827 25353.667 401.80131 0.61813129 402.19428 402.00395 0.61813129
560 15.876281 1959.9733 2106.7002 282.81483 -146.72689 554.39132 933.09924 226.68229 0 -642.41154 513779.76 -514998.25 3929.9055 25390.434 403.5098 0.81842484 386.57171 406.59055 0.81842484
580 16.38257 1878.3658 2030.0966 272.53115 -151.7308 563.56362 914.74758 216.22925 0 -639.68928 513785.76 -514992.34 1013.3048 25427.188 388.65548 1.2108332 381.10541 390.16777 1.2108332
600 16.920685 1802.551 2017.1476 270.7928 -214.59656 542.55586 900.05624 215.01335 0 -670.18556 513796.03 -514998.07 18.493782 25460.775 385.93337 1.7700661 377.13463 387.65116 1.7700661
620 17.474131 1730.0309 1927.5545 258.76534 -197.52353 548.09305 912.68313 219.66229 0 -677.86412 513801.32 -515001.42 211.58879 25489.947 368.6727 1.9725715 368.40356 368.96285 1.9725715
640 17.983631 1659.1463 1874.5489 251.64958 -215.40256 560.91381 910.47755 215.67628 0 -668.88025 513765.74 -514999.33 3576.6139 25516.217 358.58525 1.8035012 356.22593 359.21531 1.8035012
660 18.557287 1589.2837 1850.4075 248.40872 -261.12386 578.2925 854.48492 205.27001 0 -645.94735 513747.59 -515000.82 1704.7835 25543.749 354.0776 1.5147284 344.22319 355.94967 1.5157289
680 19.099188 1523.7572 1809.2809 242.88766 -285.52371 571.10597 870.42753 209.32749 0 -670.04285 513734.83 -515001.17 -730.02178 25570.285 346.40935 1.010892 331.62309 349.09523 1.010892
700 19.606934 1462.426 1781.0971 239.10411 -318.67111 547.9598 858.22372 204.5839 0 -674.26004 513742.06 -514997.24 1193.1019 25593.123 341.12225 0.74301975 322.22823 344.48583 0.74301975
720 20.138988 1403.965 1772.7176 237.9792 -368.75257 537.38813 872.15383 187.31368 0 -658.83726 513691.57 -514998.34 1717.9835 25614.736 339.57934 0.59520661 315.58412 343.78893 0.59520661
740 20.654731 1347.9142 1778.2063 238.71603 -430.29207 554.12065 833.24568 175.13397 0 -676.57227 513685.79 -515002.01 1164.2855 25636.35 340.66194 0.52336173 311.70411 345.69611 0.52336173
760 21.20085 1294.8201 1727.5363 231.91382 -432.71627 562.83637 826.41881 177.39944 0 -670.89859 513677.68 -515006.15 -2179.3296 25656.719 330.96325 0.48927201 305.61756 335.39128 0.48927201
780 21.736798 1244.1479 1729.459 232.17193 -485.31103 563.29093 800.45744 179.65918 0 -660.60078 513641.9 -515010.01 140.35372 25672.399 331.32725 0.49993893 293.14787 337.88591 0.49993893
800 22.313875 1195.9276 1716.8118 230.47411 -520.8842 572.20526 790.59915 174.22123 0 -646.04585 513597.21 -515009.08 2706.2932 25686.61 328.8596 0.60065349 282.54175 336.7676 0.60065349
820 22.880819 1149.3267 1681.646 225.75325 -532.31925 564.24784 783.06404 168.40012 0 -638.53799 513598.2 -515007.69 291.5994 25702.646 322.07401 0.70343079 279.53588 329.34955 0.70332477
840 23.400356 1107.2877 1640.6002 220.24304 -533.31252 558.56409 815.12167 157.71519 0 -653.87313 513597.92 -515008.76 -762.24777 25717.669 314.07832 1.0007715 278.89623 320.12842 1.0010942
860 23.930137 1066.5896 1621.3757 217.66224 -554.78609 569.30332 821.05893 152.83409 0 -645.45431 513552.23 -515004.75 100.50325 25730.157 310.25167 1.3271389 283.08497 314.96823 1.3271389
880 24.425549 1027.6567 1624.8454 218.12803 -597.18868 587.96681 765.45362 159.91238 0 -628.42404 513525.88 -515007.98 2270.6911 25741.827 310.74777 1.7225758 280.31191 316.00736 1.7225758
900 24.945527 989.67183 1619.7368 217.44223 -630.06494 605.34666 753.15286 166.12808 0 -637.67643 513491.85 -515008.87 -504.34781 25755.03 309.75098 1.7673447 280.95321 314.73839 1.7673447
920 25.481976 952.75609 1646.0573 220.97563 -693.30118 586.10824 737.80362 161.44982 0 -645.91448 513480.65 -515013.4 -2245.0436 25766.26 314.83888 1.6620102 286.24272 319.79545 1.6618169
940 26.009417 916.27341 1558.2262 209.18472 -641.95282 584.88671 784.61327 161.29551 0 -636.55462 513482.98 -515019.17 351.20595 25773.56 298.17626 1.2572795 293.25423 299.19214 1.2573671
960 26.54868 881.26579 1570.5631 210.84088 -689.29727 567.48803 757.85558 154.89763 0 -628.37927 513476.62 -515017.78 1224.7198 25780.472 300.67272 0.95167357 297.40913 301.41483 0.95167357
980 27.082306 848.00567 1563.3504 209.87262 -715.34478 576.51161 766.15302 148.2325 0 -637.27495 513450.83 -515019.79 -304.57224 25788.336 299.38564 0.72910884 295.89994 300.16415 0.72910884
1000 27.619404 817.47747 1553.8221 208.59349 -736.34466 586.86696 709.60783 150.55877 0 -608.57994 513440.8 -515015.6 -1422.5332 25794.968 297.60262 0.62762006 294.24682 298.35812 0.62773318
1020 28.12313 789.1786 1563.9655 209.95519 -774.78691 608.04057 694.03517 152.80101 0 -605.61567 513386.72 -515010.76 1005.4938 25799.349 299.58342 0.54306229 290.32557 301.31971 0.54293571
1040 28.647646 762.65087 1534.0005 205.93252 -771.3496 587.61838 735.74998 150.09823 0 -603.04152 513371.63 -515013.4 1470.8094 25804.634 293.84005 0.54036941 291.28531 294.46003 0.54036941
1060 29.166844 737.77923 1518.4576 203.84597 -780.67842 594.18573 720.72071 149.63679 0 -601.17736 513365.82 -515009.86 -729.10372 25811.329 290.84548 0.57532052 295.86391 290.20631 0.57532052
1080 29.694185 715.33941 1497.4861 201.03063 -782.14665 601.83156 732.61956 157.72044 0 -593.12281 513331.09 -515012.29 -1329.475 25816.507 286.76945 0.70534246 298.86373 284.95298 0.70534246
1100 30.187888 694.69953 1511.5454 202.91803 -816.84589 616.66719 703.13897 158.99611 0 -577.76244 513295.95 -515013.83 324.57282 25819.509 289.39998 0.85625823 302.74025 287.37843 0.85625823
1120 30.72232 675.80012 1511.985 202.97705 -836.18488 604.64779 695.06693 153.9432 0 -584.60486 513304.31 -515009.54 1125.7488 25822.677 289.3669 1.1300709 304.44007 287.0563 1.1300629
1140 31.225571 658.36551 1521.8389 204.29988 -863.47335 629.12728 674.88861 150.24405 0 -590.89933 513286.66 -515013.49 -980.39731 25826.849 291.15043 1.376207 307.33908 288.65717 1.3761333
1160 31.744542 641.31431 1531.9582 205.65836 -890.64389 626.42495 680.62653 148.56061 0 -577.09298 513242.55 -515011.72 -1275.5851 25829.398 292.96469 1.6693561 303.6583 291.38487 1.6693561
1180 32.314241 624.85166 1471.4431 197.53448 -846.59145 617.3346 711.86666 153.07391 0 -572.06725 513251.25 -515008.05 1129.9547 25830.175 281.38976 1.6087801 294.57721 279.38824 1.6087801
1200 32.836834 609.19491 1498.3739 201.14982 -889.17902 629.25511 684.67985 160.94667 0 -569.8543 513217.89 -515012.1 714.83828 25832.193 286.64705 1.3880783 283.02115 287.44058 1.3888122
1220 33.330996 594.74278 1478.8355 198.52688 -884.09277 636.92004 698.39685 160.32561 0 -562.35565 513195.99 -515013.37 -758.81758 25835.054 283.01514 1.1229017 278.46407 283.95841 1.1229296
1240 33.860993 582.31866 1493.1918 200.45414 -910.87313 618.74977 681.25809 152.31533 0 -562.54483 513217.1 -515017.75 -1008.5931 25836.703 285.8671 0.88995954 281.0699 286.85402 0.88995954
1260 34.359886 571.65412 1485.3064 199.39557 -913.6523 627.02685 698.36302 149.47819 0 -579.83549 513207.17 -515015.85 -191.59975 25836.765 284.43438 0.70581205 287.41841 284.12865 0.70581205
1280 34.886036 563.01807 1489.0976 199.90452 -926.07957 639.7656 697.32018 156.99221 0 -585.76217 513181.62 -515016.02 169.07813 25836.47 285.20229 0.61087596 293.46017 284.02179 0.61087596
1300 35.37543 555.84411 1527.2006 205.01966 -971.35646 641.09274 662.1865 159.13537 0 -579.97157 513161.92 -515015.72 -1463.4981 25836.182 292.51734 0.58590366 295.34409 292.24276 0.58590366
1320 35.905183 550.05933 1490.5448 200.09879 -940.48543 625.52991 696.21744 165.64927 0 -566.29494 513152.4 -515013.99 -1001.3282 25833.961 285.49188 0.58134778 295.28397 284.05681 0.58136859
1340 36.400304 545.82552 1477.3653 198.3295 -931.53974 649.76738 698.13673 166.18782 0 -561.79356 513131.65 -515015.49 256.39573 25830.414 282.92884 0.6685389 293.55866 281.35291 0.66910289
1360 36.922034 543.45958 1491.565 200.23575 -948.10541 625.58496 716.94864 163.71131 0 -571.55519 513134.22 -515017.02 297.35038 25827.363 285.59777 0.79202277 296.88495 283.9144 0.79202277
1380 37.451357 542.88076 1508.4282 202.49956 -965.54741 646.84583 717.12486 157.01613 0 -570.9963 513101.79 -515017.33 -727.70264 25824.817 288.73715 1.0078391 299.43294 287.15417 1.0078391
1400 37.973437 543.25917 1541.9768 207.00331 -998.71768 642.88473 676.64442 147.18972 0 -575.45961 513127.78 -515017.75 -1351.9224 25821.311 295.05395 1.2758201 298.33888 294.70535 1.2758201
1420 38.477087 544.25328 1494.226 200.59298 -949.97275 637.44698 691.08413 146.44269 0 -570.05548 513163.4 -515018.29 -270.25101 25816.213 285.82275 1.45608 293.72434 284.70163 1.45608
1440 39.004978 546.23983 1496.1396 200.84988 -949.89981 631.74619 738.457 152.80933 0 -573.9543 513118.44 -515017.39 211.73327 25811.001 286.12443 1.60978 287.34634 286.11175 1.60978
1460 39.506582 548.84457 1466.6766 196.8946 -917.83206 633.37692 721.14643 162.99807 0 -556.88904 513139.89 -515018.35 -423.45238 25806.343 280.53109 1.4808771 287.46457 279.56727 1.4808771
1480 40.013021 551.95616 1529.776 205.3654 -977.81982 643.3714 687.91646 168.45052 0 -559.19128 513096.53 -515014.9 -1060.0608 25801.347 292.71931 1.2657554 295.62549 292.43217 1.2657554
1500 40.538129 555.97974 1537.2966 206.37501 -981.31688 625.22061 717.66026 158.35427 0 -572.42591 513106.71 -515016.83 -521.38973 25795.193 294.26369 1.0278009 305.22402 292.64051 1.0278009
1520 41.025889 561.04463 1546.2574 207.57796 -985.21278 635.77714 721.02166 143.98506 0 -562.3667 513090.07 -515013.7 480.66458 25788.679 296.07983 0.80049966 308.03207 294.29295 0.80049966
1540 41.55805 566.68767 1533.2704 205.83452 -966.58278 654.42171 733.05018 143.06827 0 -536.78594 513051.91 -515012.25 -13.266306 25783.154 293.62787 0.70845158 300.7356 292.64315 0.70845158
1560 42.081834 573.47741 1545.9514 207.53687 -972.47397 667.35837 705.11749 148.50883 0 -511.03863 513035.3 -515017.72 -1128.9314 25777.865 296.082 0.65411382 299.13367 295.77283 0.65411382
1580 42.665773 580.84578 1594.8648 214.10328 -1014.0191 665.14281 711.19644 150.09976 0 -528.59268 513008.73 -515020.6 202.40236 25771.588 305.48503 0.59346496 305.13087 305.74762 0.59346496
1600 43.198806 587.93053 1593.0533 213.8601 -1005.1228 667.00914 717.18229 154.08514 0 -518.43498 512998.02 -515022.99 1129.067 25765.95 305.11474 0.64754135 305.66863 305.22598 0.64754135
1620 43.714818 594.73059 1540.0228 206.74099 -945.29217 676.98346 739.79112 155.99494 0 -494.24155 512994.51 -515018.33 526.11962 25762.249 294.90314 0.75499506 297.8325 294.6134 0.75499506
1640 44.259458 602.01816 1574.0462 211.30848 -972.02805 663.3896 727.17417 151.24073 0 -494.0956 513000.57 -515020.3 -575.47503 25759.514 301.37613 0.86690808 296.74738 302.34638 0.86686227
1660 44.764134 609.8688 1585.4465 212.83891 -975.57766 664.90151 754.20462 143.39975 0 -512.60013 512995.21 -515020.69 120.01767 25756.288 303.44799 1.1375937 302.29356 303.8427 1.1375483
1680 45.295079 617.0121 1599.4294 214.71606 -982.41735 673.71348 740.31978 139.29744 0 -523.39592 513004.17 -515016.52 1018.995 25753.537 306.06349 1.2857605 306.24911 306.23701 1.2851446
1700 45.797194 622.7816 1587.5062 213.11542 -964.72461 681.14985 737.5354 142.64373 0 -527.89471 513016.69 -515014.85 -762.54382 25752.152 303.67113 1.5346092 313.56414 302.2316 1.5344941
1720 46.320299 627.3514 1607.6889 215.82486 -980.33755 664.85413 752.47086 151.63477 0 -558.53514 513025.83 -515016.59 -1533.2781 25749.855 307.5455 1.5204255 324.85436 304.8785 1.5204255
1740 46.830115 630.51695 1598.6908 214.6169 -968.17382 653.58364 747.05167 160.79211 0 -580.54509 513063.86 -515012.91 -682.94257 25745.444 305.87278 1.3989272 333.2609 301.5297 1.3989272
1760 47.394788 632.38111 1593.237 213.88475 -960.85589 650.78705 764.11644 167.2889 0 -573.51639 513045.53 -515015.07 563.26755 25740.336 304.94629 1.1225547 334.94227 300.17035 1.1225547
1780 47.922889 633.30997 1598.6499 214.61141 -965.33996 653.54119 765.83593 164.00427 0 -562.23222 513033.51 -515020 -1327.8381 25735.912 306.08499 0.88668411 334.15679 301.62884 0.88668411
1800 48.463113 633.70382 1649.9701 221.50091 -1016.2663 659.96781 745.28779 159.23213 0 -549.62971 512990.43 -515021.55 -1220.9829 25730.022 315.99137 0.72802345 326.79654 314.40852 0.72802345
1820 48.984029 633.58292 1659.156 222.73407 -1025.573 665.57877 731.85128 149.46328 0 -533.84488 512983.77 -515022.39 259.29033 25722.788 317.77089 0.68459607 313.70692 318.65732 0.68459607
1840 49.535432 632.84896 1602.3796 215.1121 -969.53059 677.68273 790.85762 153.52845 0 -510.95603 512938.27 -515018.91 271.83168 25716.16 306.91304 0.62307528 301.73642 307.97704 0.62193772
1860 50.131212 631.44034 1614.3342 216.71695 -982.89384 704.07775 755.95641 164.4832 0 -496.35082 512910.85 -515021.91 193.91175 25710.384 309.1988 0.63700741 295.94067 311.60525 0.63654587
1880 50.855644 629.18958 1597.9323 214.51508 -968.74275 705.91154 777.10222 163.27419 0 -490.72673 512895.73 -515020.04 -974.53867 25705.004 306.00767 0.74633313 296.65573 307.7641 0.74633313
1900 51.442767 625.97644 1641.4591 220.35835 -1015.4827 686.52567 770.03702 156.74058 0 -497.98541 512884.62 -515015.42 634.14021 25698.897 314.30703 0.85093529 303.58173 316.29697 0.85093529
1920 52.143124 621.81199 1629.0055 218.68651 -1007.1935 697.66793 744.88149 154.37261 0 -496.80305 512905.46 -515012.77 706.77423 25693.859 311.83949 1.0371868 309.16955 312.48998 1.0372355
1940 52.903306 616.46004 1627.6423 218.50351 -1011.1823 701.93564 779.10792 151.5545 0 -486.4562 512854.72 -515012.04 -356.74685 25690.093 311.50393 1.2116518 310.99764 311.79486 1.2113866
1960 53.626542 609.78344 1638.9504 220.02157 -1029.167 696.4213 776.28011 154.35764 0 -474.71134 512832.29 -515013.81 -303.73538 25686.165 313.59711 1.3852662 315.5116 313.48837 1.3852662
1980 54.31028 600.96661 1637.173 219.78295 -1036.2064 718.42192 759.0789 153.6092 0 -472.50282 512815.84 -515010.66 -151.6766 25681.92 313.21609 1.4792586 321.24113 312.09275 1.4792586
2000 54.986641 589.81965 1648.0734 221.24629 -1058.2538 690.75922 747.98481 160.84305 0 -487.54224 512840.7 -515011 980.73982 25677.907 315.36457 1.3399431 321.77651 314.51049 1.3399431
Loop time of 54.9868 on 4 procs for 2000 steps with 3000 atoms
Performance: 1.571 ns/day, 15.274 hours/ns, 36.372 timesteps/s
98.8% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 27.901 | 28.34 | 29.027 | 7.9 | 51.54
Bond | 0.92918 | 0.94546 | 0.97217 | 1.7 | 1.72
Kspace | 14.647 | 15.356 | 15.836 | 11.2 | 27.93
Neigh | 1.6543 | 1.6584 | 1.6622 | 0.2 | 3.02
Comm | 1.5279 | 1.6227 | 1.7184 | 5.6 | 2.95
Output | 0.022354 | 0.027337 | 0.040941 | 4.8 | 0.05
Modify | 5.7813 | 6.226 | 6.5243 | 12.2 | 11.32
Other | | 0.8108 | | | 1.47
Nlocal: 750.000 ave 763 max 736 min
Histogram: 1 0 0 0 1 0 1 0 0 1
Nghost: 6184.00 ave 6204 max 6165 min
Histogram: 1 0 0 1 0 0 1 0 0 1
Neighs: 185088.0 ave 189615 max 180533 min
Histogram: 2 0 0 0 0 0 0 0 0 2
Total # of neighbors = 740354
Ave neighs/atom = 246.78467
Ave special neighs/atom = 10.500000
Neighbor list builds = 63
Dangerous builds = 0
Total wall time: 0:00:55

103
examples/mliap/README Normal file
View File

@ -0,0 +1,103 @@
This directory contains multiple examples of
machine-learning potentials defined using the
MLIAP package in LAMMPS. The input files
are described below.
in.mliap.snap.Ta06A
-------------------
Run linear SNAP, equivalent to examples/snap/in.snap.Ta06A
in.mliap.snap.WBe.PRB2019
-------------------------
Run linear SNAP, equivalent to examples/snap/in.snap.WBe.PRB2019
in.mliap.snap.quadratic
-----------------------
Run quadratic SNAP
in.mliap.snap.chem
------------------
Run EME-SNAP, equivalent to examples/snap/in.snap.InP.JCPA2020
in.mliap.snap.compute
---------------------
Generate the A matrix, the gradients (w.r.t. coefficients)
of total potential energy, forces, and stress tensor for
linear SNAP, equivalent to in.snap.compute
in.mliap.quadratic.compute
--------------------------
Generate the A matrix, the gradients (w.r.t. coefficients)
of total potential energy, forces, and stress tensor for
for quadratic SNAP, equivalent to in.snap.compute.quadratic
in.mliap.pytorch.Ta06A
-----------------------
This reproduces the output of in.mliap.snap.Ta06A above,
but using the Python coupling to PyTorch.
This example can be run in two different ways:
1: Running a LAMMPS executable: in.mliap.pytorch.Ta06A
First run ``python convert_mliap_Ta06A.py``. It creates
a PyTorch energy model that replicates the
SNAP Ta06A potential and saves it in the file
"Ta06A.mliap.pytorch.model.pt".
You can then run the example as follows
`lmp -in in.mliap.pytorch.Ta06A -echo both`
The resultant log.lammps output should be identical to that generated
by in.mliap.snap.Ta06A.
If this fails, see the instructions for building the MLIAP package
with Python support enabled. Also, confirm that the
LAMMPS Python embedded Python interpreter is
working by running ../examples/in.python.
2: Running a Python script: mliap_pytorch_Ta06A.py
Before testing this, ensure that the previous method
(running a LAMMPS executable) works.
You can run the example in serial:
`python mliap_pytorch_Ta06A.py`
or in parallel:
`mpirun -np 4 python mliap_pytorch_Ta06A.py`
The resultant log.lammps output should be identical to that generated
by in.mliap.snap.Ta06A and in.mliap.pytorch.Ta06A.
Not all Python installations support this mode of operation.
It requires that the Python interpreter be initialized. If not,
the script will exit with an error message.
in.mliap.pytorch.relu1hidden
----------------------------
This example demonstrates a simple neural network potential
using PyTorch and SNAP descriptors.
`lmp -in in.mliap.pytorch.relu1hidden -echo both`
It was trained on just the energy component (no forces) of
the data used in the original SNAP Ta06A potential for
tantalum (Thompson, Swiler, Trott, Foiles, Tucker,
J Comp Phys, 285, 316 (2015).). Because of the very small amount
of energy training data, it uses just 1 hidden layer with
a ReLU activation function. It is not expected to be
very accurate for forces.
NOTE: Unlike the previous example, this example uses
a pre-built PyTorch file `Ta06A.mliap.pytorch.model.pt`.
It is read using `torch.load`,
which implicitly uses the Python `pickle` module.
This is known to be insecure. It is possible to construct malicious
pickle data that will execute arbitrary code during unpickling. Never
load data that could have come from an untrusted source, or that
could have been tampered with. Only load data you trust.

View File

@ -0,0 +1,18 @@
# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
mliap model mliappy Ta06A.mliap.pytorch.model.pt &
descriptor sna Ta06A.mliap.descriptor
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * mliap Ta

View File

@ -0,0 +1,26 @@
import sys
import numpy as np
import torch
# torch.nn.modules useful for defining a MLIAPPY model.
from lammps.mliap.pytorch import TorchWrapper, IgnoreElems
# Read coefficients
coeffs = np.genfromtxt("Ta06A.mliap.model",skip_header=6)
# Write coefficients to a pytorch linear model
bias = coeffs[0]
weights = coeffs[1:]
lin = torch.nn.Linear(weights.shape[0],1)
lin.to(torch.float64)
with torch.autograd.no_grad():
lin.weight.set_(torch.from_numpy(weights).unsqueeze(0))
lin.bias.set_(torch.as_tensor(bias,dtype=torch.float64).unsqueeze(0))
# Wrap the pytorch model for usage with mliappy coupling.
model = IgnoreElems(lin) # The linear module does not use the types.
n_descriptors = lin.weight.shape[1]
n_elements = 1
linked_model = TorchWrapper(model,n_descriptors=n_descriptors,n_elements=n_elements)
torch.save(linked_model,"Ta06A.mliap.pytorch.model.pt")

View File

@ -0,0 +1,53 @@
# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.316
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable ny equal ${nrep}
variable nz equal ${nrep}
boundary p p p
lattice bcc $a
region box block 0 ${nx} 0 ${ny} 0 ${nz}
create_box 1 box
create_atoms 1 box
mass 1 180.88
# choose potential
include Ta06A.mliap.pytorch
# Setup output
compute eatom all pe/atom
compute energy all reduce sum c_eatom
compute satom all stress/atom NULL
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
thermo_style custom step temp epair c_energy etotal press v_press
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459 loop geom
fix 1 all nve
run ${nsteps}

View File

@ -0,0 +1,53 @@
# Demonstrate MLIAP interface to linear SNAP potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.316
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable ny equal ${nrep}
variable nz equal ${nrep}
boundary p p p
lattice bcc $a
region box block 0 ${nx} 0 ${ny} 0 ${nz}
create_box 1 box
create_atoms 1 box
mass 1 180.88
# choose potential
include relu1hidden.mliap.pytorch
# Setup output
compute eatom all pe/atom
compute energy all reduce sum c_eatom
compute satom all stress/atom NULL
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
thermo_style custom step temp epair c_energy etotal press v_press
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459 loop geom
fix 1 all nve
run ${nsteps}

View File

@ -1,4 +1,4 @@
# Demonstrate MLIAP interface to kinear SNAP potential
# Demonstrate MLIAP interface to linear SNAP potential
# Initialize simulation

View File

@ -0,0 +1,157 @@
LAMMPS (30 Nov 2020)
using 48 OpenMP thread(s) per MPI task
# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.316
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable nx equal 4
variable ny equal ${nrep}
variable ny equal 4
variable nz equal ${nrep}
variable nz equal 4
boundary p p p
lattice bcc $a
lattice bcc 3.316
Lattice spacing in x,y,z = 3.3160000 3.3160000 3.3160000
region box block 0 ${nx} 0 ${ny} 0 ${nz}
region box block 0 4 0 ${ny} 0 ${nz}
region box block 0 4 0 4 0 ${nz}
region box block 0 4 0 4 0 4
create_box 1 box
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (13.264000 13.264000 13.264000)
1 by 1 by 1 MPI processor grid
create_atoms 1 box
Created 128 atoms
create_atoms CPU = 0.002 seconds
mass 1 180.88
# choose potential
include Ta06A.mliap.pytorch
# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
pair_style hybrid/overlay zbl 4 4.8 mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
Loading python model complete.
Reading potential file Ta06A.mliap.descriptor with DATE: 2014-09-05
SNAP keyword rcutfac 4.67637
SNAP keyword twojmax 6
SNAP keyword nelems 1
SNAP keyword elems Ta
SNAP keyword radelems 0.5
SNAP keyword welems 1
SNAP keyword rfac0 0.99363
SNAP keyword rmin0 0
SNAP keyword bzeroflag 0
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff 1 1 zbl 73 ${zblz}
pair_coeff 1 1 zbl 73 73
pair_coeff * * mliap Ta
# Setup output
compute eatom all pe/atom
compute energy all reduce sum c_eatom
compute satom all stress/atom NULL
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
thermo_style custom step temp epair c_energy etotal press v_press
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459 loop geom
fix 1 all nve
run ${nsteps}
run 100
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 5.8
ghost atom cutoff = 5.8
binsize = 2.9, bins = 5 5 5
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair zbl, perpetual, half/full from (2)
attributes: half, newton on
pair build: halffull/newton
stencil: none
bin: none
(2) pair mliap, perpetual
attributes: full, newton on
pair build: full/bin/atomonly
stencil: full/bin/3d
bin: standard
Per MPI rank memory allocation (min/avg/max) = 159.8 | 159.8 | 159.8 Mbytes
Step Temp E_pair c_energy TotEng Press v_press
0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661
10 296.01467 -11.851059 -11.851059 -11.813095 2697.4796 -2697.4796
20 284.53666 -11.849587 -11.849587 -11.813095 2289.1527 -2289.1527
30 266.51577 -11.847275 -11.847275 -11.813095 1851.7131 -1851.7131
40 243.05007 -11.844266 -11.844266 -11.813095 1570.684 -1570.684
50 215.51032 -11.840734 -11.840734 -11.813094 1468.1899 -1468.1899
60 185.48331 -11.836883 -11.836883 -11.813094 1524.8757 -1524.8757
70 154.6736 -11.832931 -11.832931 -11.813094 1698.3351 -1698.3351
80 124.79303 -11.829099 -11.829099 -11.813094 1947.0715 -1947.0715
90 97.448054 -11.825592 -11.825592 -11.813094 2231.9563 -2231.9563
100 74.035418 -11.822589 -11.822589 -11.813094 2515.8526 -2515.8526
Loop time of 2.00236 on 48 procs for 100 steps with 128 atoms
Performance: 2.157 ns/day, 11.124 hours/ns, 49.941 timesteps/s
288.8% CPU use with 1 MPI tasks x 48 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 1.9998 | 1.9998 | 1.9998 | 0.0 | 99.87
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.0011814 | 0.0011814 | 0.0011814 | 0.0 | 0.06
Output | 0.00059724 | 0.00059724 | 0.00059724 | 0.0 | 0.03
Modify | 0.00047352 | 0.00047352 | 0.00047352 | 0.0 | 0.02
Other | | 0.0003468 | | | 0.02
Nlocal: 128.000 ave 128 max 128 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 727.000 ave 727 max 727 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 3712.00 ave 3712 max 3712 min
Histogram: 1 0 0 0 0 0 0 0 0 0
FullNghs: 7424.00 ave 7424 max 7424 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 7424
Ave neighs/atom = 58.000000
Neighbor list builds = 0
Dangerous builds = 0
Total wall time: 0:00:03

View File

@ -0,0 +1,157 @@
LAMMPS (30 Nov 2020)
using 48 OpenMP thread(s) per MPI task
# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.316
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable nx equal 4
variable ny equal ${nrep}
variable ny equal 4
variable nz equal ${nrep}
variable nz equal 4
boundary p p p
lattice bcc $a
lattice bcc 3.316
Lattice spacing in x,y,z = 3.3160000 3.3160000 3.3160000
region box block 0 ${nx} 0 ${ny} 0 ${nz}
region box block 0 4 0 ${ny} 0 ${nz}
region box block 0 4 0 4 0 ${nz}
region box block 0 4 0 4 0 4
create_box 1 box
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (13.264000 13.264000 13.264000)
1 by 2 by 2 MPI processor grid
create_atoms 1 box
Created 128 atoms
create_atoms CPU = 0.002 seconds
mass 1 180.88
# choose potential
include Ta06A.mliap.pytorch
# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
pair_style hybrid/overlay zbl 4 4.8 mliap model mliappy Ta06A.mliap.pytorch.model.pkl descriptor sna Ta06A.mliap.descriptor
Loading python model complete.
Reading potential file Ta06A.mliap.descriptor with DATE: 2014-09-05
SNAP keyword rcutfac 4.67637
SNAP keyword twojmax 6
SNAP keyword nelems 1
SNAP keyword elems Ta
SNAP keyword radelems 0.5
SNAP keyword welems 1
SNAP keyword rfac0 0.99363
SNAP keyword rmin0 0
SNAP keyword bzeroflag 0
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff 1 1 zbl 73 ${zblz}
pair_coeff 1 1 zbl 73 73
pair_coeff * * mliap Ta
# Setup output
compute eatom all pe/atom
compute energy all reduce sum c_eatom
compute satom all stress/atom NULL
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
thermo_style custom step temp epair c_energy etotal press v_press
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459 loop geom
fix 1 all nve
run ${nsteps}
run 100
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 5.8
ghost atom cutoff = 5.8
binsize = 2.9, bins = 5 5 5
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair zbl, perpetual, half/full from (2)
attributes: half, newton on
pair build: halffull/newton
stencil: none
bin: none
(2) pair mliap, perpetual
attributes: full, newton on
pair build: full/bin/atomonly
stencil: full/bin/3d
bin: standard
Per MPI rank memory allocation (min/avg/max) = 159.7 | 159.7 | 159.7 Mbytes
Step Temp E_pair c_energy TotEng Press v_press
0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661
10 296.01467 -11.851059 -11.851059 -11.813095 2697.4796 -2697.4796
20 284.53666 -11.849587 -11.849587 -11.813095 2289.1527 -2289.1527
30 266.51577 -11.847275 -11.847275 -11.813095 1851.7131 -1851.7131
40 243.05007 -11.844266 -11.844266 -11.813095 1570.684 -1570.684
50 215.51032 -11.840734 -11.840734 -11.813094 1468.1899 -1468.1899
60 185.48331 -11.836883 -11.836883 -11.813094 1524.8757 -1524.8757
70 154.6736 -11.832931 -11.832931 -11.813094 1698.3351 -1698.3351
80 124.79303 -11.829099 -11.829099 -11.813094 1947.0715 -1947.0715
90 97.448054 -11.825592 -11.825592 -11.813094 2231.9563 -2231.9563
100 74.035418 -11.822589 -11.822589 -11.813094 2515.8526 -2515.8526
Loop time of 0.562802 on 192 procs for 100 steps with 128 atoms
Performance: 7.676 ns/day, 3.127 hours/ns, 177.682 timesteps/s
99.7% CPU use with 4 MPI tasks x 48 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.53583 | 0.54622 | 0.55401 | 0.9 | 97.05
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.0071442 | 0.01491 | 0.025289 | 5.4 | 2.65
Output | 0.00092525 | 0.00095771 | 0.0010166 | 0.0 | 0.17
Modify | 0.00014479 | 0.00015043 | 0.00015893 | 0.0 | 0.03
Other | | 0.0005624 | | | 0.10
Nlocal: 32.0000 ave 32 max 32 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Nghost: 431.000 ave 431 max 431 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Neighs: 928.000 ave 928 max 928 min
Histogram: 4 0 0 0 0 0 0 0 0 0
FullNghs: 1856.00 ave 1856 max 1856 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Total # of neighbors = 7424
Ave neighs/atom = 58.000000
Neighbor list builds = 0
Dangerous builds = 0
Total wall time: 0:00:02

View File

@ -0,0 +1,104 @@
# Demonstrate how to load a model from the python side.
# This is essentially the same as in.mliap.pytorch.Ta06A
# except that python is the driving program, and lammps
# is in library mode.
before_loading =\
"""# Demonstrate MLIAP/PyTorch interface to linear SNAP potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.316
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable ny equal ${nrep}
variable nz equal ${nrep}
boundary p p p
lattice bcc $a
region box block 0 ${nx} 0 ${ny} 0 ${nz}
create_box 1 box
create_atoms 1 box
mass 1 180.88
# choose potential
# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
mliap model mliappy LATER &
descriptor sna Ta06A.mliap.descriptor
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * mliap Ta
"""
after_loading =\
"""
# Setup output
compute eatom all pe/atom
compute energy all reduce sum c_eatom
compute satom all stress/atom NULL
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
thermo_style custom step temp epair c_energy etotal press v_press
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459 loop geom
fix 1 all nve
run ${nsteps}
"""
import lammps
lmp = lammps.lammps(cmdargs=['-echo','both'])
# Before defining the pair style, one must do the following:
import lammps.mliap
lammps.mliap.activate_mliappy(lmp)
# Otherwise, when running lammps in library mode,
# you will get an error:
# "ERROR: Loading MLIAPPY coupling module failure."
# Setup the simulation and declare an empty model
# by specifying model filename as "LATER"
lmp.commands_string(before_loading)
# Define the model however you like. In this example
# we load it from disk:
import torch
model = torch.load('Ta06A.mliap.pytorch.model.pt')
# Connect the PyTorch model to the mliap pair style.
lammps.mliap.load_model(model)
# run the simulation with the mliap pair style
lmp.commands_string(after_loading)

View File

@ -0,0 +1,18 @@
# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
mliap model mliappy relu1hidden.mliap.pytorch.model.pt &
descriptor sna Ta06A.mliap.descriptor
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * mliap Ta

Binary file not shown.

View File

@ -18,13 +18,14 @@ parser = ArgumentParser(prog='Install.py',
# settings
thisdir = fullpath('.')
version = "2.2.0"
version = "2.2.1"
# known checksums for different KIM-API versions. used to validate the download.
checksums = { \
'2.1.2' : '6ac52e14ef52967fc7858220b208cba5', \
'2.1.3' : '6ee829a1bbba5f8b9874c88c4c4ebff8', \
'2.2.0' : 'e7f944e1593cffd7444679a660607f6c', \
'2.2.1' : 'ae1ddda2ef7017ea07934e519d023dca', \
}

View File

@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py',
# settings
version = "2.6.1"
version = "2.7.0"
mode = "static"
# help message
@ -49,6 +49,7 @@ checksums = { \
'2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \
'2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \
'2.6.1' : '89a9a450fc6025299fe16af235957163', \
'2.7.0' : '95f29dd0c067577f11972ff90dfc7d12', \
}
# parse and process arguments

View File

@ -2,6 +2,6 @@
# See the README file for more explanation
python_SYSINC = $(shell which python-config > /dev/null 2>&1 && python-config --includes || :)
python_SYSLIB = $(shell which python-config > /dev/null 2>&1 && python-config --ldflags || :)
python_SYSLIB = $(shell which python-config > /dev/null 2>&1 && python-config --ldflags --embed > /dev/null 2>&1 && python-config --ldflags --embed || (which python-config > /dev/null 2>&1 && python-config --ldflags || :) )
python_SYSPATH =
PYTHON=python

View File

@ -2,6 +2,6 @@
# See the README file for more explanation
python_SYSINC = $(shell which python3-config > /dev/null 2>&1 && python3-config --includes || (which python-config > /dev/null 2>&1 && python-config --includes || :))
python_SYSLIB = $(shell which python3-config > /dev/null 2>&1 && python3-config --ldflags || (which python-config > /dev/null 2>&1 && python-config --ldflags || :))
python_SYSLIB = $(shell which python3-config > /dev/null 2>&1 && python3-config --ldflags --embed > /dev/null 2>&1 && python3-config --ldflags --embed || (which python3-config > /dev/null 2>&1 && python3-config --ldflags || (which python-config > /dev/null 2>&1 && python-config --ldflags || :) ) )
python_SYSPATH =
PYTHON=$(shell which python3 > /dev/null 2>&1 && echo python3 || echo python)

View File

@ -0,0 +1,3 @@
../mliap_model_python_couple.cpp: ../mliap_model_python_couple.pyx
cythonize -3 ../mliap_model_python_couple.cpp

View File

@ -1,42 +1,42 @@
#!/usr/bin/env python
"""
Installer script to install the LAMMPS python module and the corresponding
Installer script to install the LAMMPS python package and the corresponding
shared library into either the system-wide site-packages tree, or - failing
that - into the corresponding user tree. Called from the 'install-python'
build target in the conventional and CMake based build systems
"""
# copy LAMMPS shared library and lammps.py to system dirs
# copy LAMMPS shared library and lammps package to system dirs
from __future__ import print_function
import sys,os,shutil
from argparse import ArgumentParser
parser = ArgumentParser(prog='install.py',
description='LAMMPS python module installer script')
description='LAMMPS python package installer script')
parser.add_argument("-m", "--module", required=True,
help="path to the source of the LAMMPS Python module")
parser.add_argument("-p", "--package", required=True,
help="path to the LAMMPS Python package")
parser.add_argument("-l", "--lib", required=True,
help="path to the compiled LAMMPS shared library")
parser.add_argument("-v", "--version", required=True,
help="path to the LAMMPS version.h header file")
parser.add_argument("-d","--dir",
help="Legacy custom installation folder selection for module and library")
help="Legacy custom installation folder selection for package and library")
args = parser.parse_args()
# validate arguments and make paths absolute
if args.module:
if not os.path.exists(args.module):
print( "ERROR: LAMMPS module file %s does not exist" % args.module)
if args.package:
if not os.path.exists(args.package):
print( "ERROR: LAMMPS package %s does not exist" % args.package)
parser.print_help()
sys.exit(1)
else:
args.module = os.path.abspath(args.module)
args.package = os.path.abspath(args.package)
if args.lib:
if not os.path.exists(args.lib):
@ -66,9 +66,9 @@ if args.dir:
# without any special processing or additional steps to that folder
if args.dir:
print("Copying LAMMPS Python module to custom folder %s" % args.dir)
print("Copying LAMMPS Python package to custom folder %s" % args.dir)
try:
shutil.copyfile(args.module, os.path.join(args.dir,'lammps.py'))
shutil.copytree(args.package, os.path.join(args.dir,'lammps'))
except shutil.Error:
pass # fail silently
@ -81,32 +81,40 @@ if args.dir:
sys.exit()
# extract version string from header
fp = open(args.version,'r')
txt=fp.read().split('"')[1].split()
verstr=txt[0]+txt[1]+txt[2]
fp.close()
def get_lammps_version(header):
with open(header, 'r') as f:
line = f.readline()
start_pos = line.find('"')+1
end_pos = line.find('"', start_pos)
return "".join(line[start_pos:end_pos].split())
print("Installing LAMMPS Python module version %s into site-packages folder" % verstr)
verstr = get_lammps_version(args.version)
# we need to switch to the folder of the python module
os.chdir(os.path.dirname(args.module))
print("Installing LAMMPS Python package version %s into site-packages folder" % verstr)
# we need to switch to the folder of the python package
os.chdir(os.path.dirname(args.package))
from distutils.core import setup
from distutils.sysconfig import get_python_lib
import site
tryuser=False
#Arguments common to global or user install -- everything but data_files
setup_kwargs= dict(name="lammps",
version=verstr,
author="Steve Plimpton",
author_email="sjplimp@sandia.gov",
url="https://lammps.sandia.gov",
description="LAMMPS Molecular Dynamics Python package",
license="GPL",
packages=["lammps","lammps.mliap"],
)
tryuser=False
try:
sys.argv = ["setup.py","install"] # as if had run "python setup.py install"
setup(name = "lammps",
version = verstr,
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "https://lammps.sandia.gov",
description = "LAMMPS Molecular Dynamics Python module",
license = "GPL",
py_modules = ["lammps"],
data_files = [(get_python_lib(), [args.lib])])
setup_kwargs['data_files']=[(os.path.join(get_python_lib(), 'lammps'), [args.lib])]
setup(**setup_kwargs)
except:
tryuser=True
print ("Installation into global site-packages folder failed.\nTrying user folder %s now." % site.USER_SITE)
@ -114,14 +122,7 @@ except:
if tryuser:
try:
sys.argv = ["setup.py","install","--user"] # as if had run "python setup.py install --user"
setup(name = "lammps",
version = verstr,
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "https://lammps.sandia.gov",
description = "LAMMPS Molecular Dynamics Python module",
license = "GPL",
py_modules = ["lammps"],
data_files = [(site.USER_SITE, [args.lib])])
setup_kwargs['data_files']=[(os.path.join(site.USER_SITE, 'lammps'), [args.lib])]
setup(**setup_kwargs)
except:
print("Installation into user site package folder failed.")

View File

@ -0,0 +1,4 @@
from .constants import *
from .core import *
from .data import *
from .pylammps import *

View File

@ -0,0 +1,49 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
from ctypes import c_int, c_int32, c_int64
# various symbolic constants to be used
# in certain calls to select data formats
LAMMPS_AUTODETECT = None
LAMMPS_INT = 0
LAMMPS_INT_2D = 1
LAMMPS_DOUBLE = 2
LAMMPS_DOUBLE_2D = 3
LAMMPS_INT64 = 4
LAMMPS_INT64_2D = 5
LAMMPS_STRING = 6
# these must be kept in sync with the enums in library.h
LMP_STYLE_GLOBAL = 0
LMP_STYLE_ATOM = 1
LMP_STYLE_LOCAL = 2
LMP_TYPE_SCALAR = 0
LMP_TYPE_VECTOR = 1
LMP_TYPE_ARRAY = 2
LMP_SIZE_VECTOR = 3
LMP_SIZE_ROWS = 4
LMP_SIZE_COLS = 5
LMP_VAR_EQUAL = 0
LMP_VAR_ATOM = 1
# -------------------------------------------------------------------------
def get_ctypes_int(size):
if size == 4:
return c_int32
elif size == 8:
return c_int64
return c_int

File diff suppressed because it is too large Load Diff

73
python/lammps/data.py Normal file
View File

@ -0,0 +1,73 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
################################################################################
# LAMMPS data structures
# Written by Richard Berger <richard.berger@temple.edu>
################################################################################
class NeighList:
"""This is a wrapper class that exposes the contents of a neighbor list.
It can be used like a regular Python list. Each element is a tuple of:
* the atom local index
* its number of neighbors
* and a pointer to an c_int array containing local atom indices of its
neighbors
Internally it uses the lower-level LAMMPS C-library interface.
:param lmp: reference to instance of :py:class:`lammps`
:type lmp: lammps
:param idx: neighbor list index
:type idx: int
"""
def __init__(self, lmp, idx):
self.lmp = lmp
self.idx = idx
def __str__(self):
return "Neighbor List ({} atoms)".format(self.size)
def __repr__(self):
return self.__str__()
@property
def size(self):
"""
:return: number of elements in neighbor list
"""
return self.lmp.get_neighlist_size(self.idx)
def get(self, element):
"""
:return: tuple with atom local index, numpy array of neighbor local atom indices
:rtype: (int, int, ctypes.POINTER(c_int))
"""
iatom, numneigh, neighbors = self.lmp.get_neighlist_element_neighbors(self.idx, element)
return iatom, numneigh, neighbors
# the methods below implement the iterator interface, so NeighList can be used like a regular Python list
def __getitem__(self, element):
return self.get(element)
def __len__(self):
return self.size
def __iter__(self):
inum = self.size
for ii in range(inum):
yield self.get(ii)

View File

@ -0,0 +1,13 @@
# Check compatiblity of this build with the python shared library.
# If this fails, lammps will segfault because its library will
# try to improperly start up a new interpreter.
import sysconfig
import ctypes
library = sysconfig.get_config_vars('INSTSONAME')[0]
pylib = ctypes.CDLL(library)
if not pylib.Py_IsInitialized():
raise RuntimeError("This interpreter is not compatible with python-based mliap for LAMMPS.")
del sysconfig, ctypes, library, pylib
from .loader import load_model, activate_mliappy

View File

@ -0,0 +1,52 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
# ----------------------------------------------------------------------
# Contributing author: Nicholas Lubbers (LANL)
# -------------------------------------------------------------------------
import sys
import importlib.util
import importlib.machinery
def activate_mliappy(lmp):
try:
# Begin Importlib magic to find the embedded python module
# This is needed because the filename for liblammps does not
# match the spec for normal python modules, wherein
# file names match with PyInit function names.
# Also, python normally doesn't look for extensions besides '.so'
# We fix both of these problems by providing an explict
# path to the extension module 'mliap_model_python_couple' in
path = lmp.lib._name
loader = importlib.machinery.ExtensionFileLoader('mliap_model_python_couple', path)
spec = importlib.util.spec_from_loader('mliap_model_python_couple', loader)
module = importlib.util.module_from_spec(spec)
sys.modules['mliap_model_python_couple'] = module
spec.loader.exec_module(module)
# End Importlib magic to find the embedded python module
except Exception as ee:
raise ImportError("Could not load MLIAP python coupling module.") from ee
def load_model(model):
try:
import mliap_model_python_couple
except ImportError as ie:
raise ImportError("MLIAP python module must be activated before loading\n"
"the pair style. Call lammps.mliap.activate_mliappy(lmp)."
) from ie
mliap_model_python_couple.load_from_python(model)

View File

@ -0,0 +1,65 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
# ----------------------------------------------------------------------
# Contributing author: Nicholas Lubbers (LANL)
# -------------------------------------------------------------------------
import numpy as np
import torch
def calc_n_params(model):
return sum(p.nelement() for p in model.parameters())
class TorchWrapper(torch.nn.Module):
def __init__(self, model,n_descriptors,n_elements,n_params=None,device=None,dtype=torch.float64):
super().__init__()
self.model = model
self.device = device
self.dtype = dtype
# Put model on device and convert to dtype
self.to(self.dtype)
self.to(self.device)
if n_params is None:
n_params = calc_n_params(model)
self.n_params = n_params
self.n_descriptors = n_descriptors
self.n_elements = n_elements
def forward(self, elems, bispectrum, beta, energy):
bispectrum = torch.from_numpy(bispectrum).to(dtype=self.dtype, device=self.device).requires_grad_(True)
elems = torch.from_numpy(elems).to(dtype=torch.long, device=self.device) - 1
with torch.autograd.enable_grad():
energy_nn = self.model(bispectrum, elems)
if energy_nn.ndim > 1:
energy_nn = energy_nn.flatten()
beta_nn = torch.autograd.grad(energy_nn.sum(), bispectrum)[0]
beta[:] = beta_nn.detach().cpu().numpy().astype(np.float64)
energy[:] = energy_nn.detach().cpu().numpy().astype(np.float64)
class IgnoreElems(torch.nn.Module):
def __init__(self,subnet):
super().__init__()
self.subnet = subnet
def forward(self,bispectrum,elems):
return self.subnet(bispectrum)

338
python/lammps/numpy.py Normal file
View File

@ -0,0 +1,338 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
################################################################################
# NumPy additions
# Written by Richard Berger <richard.berger@temple.edu>
################################################################################
import warnings
from ctypes import POINTER, c_double, c_int, c_int32, c_int64, cast
from .constants import *
from .data import NeighList
class numpy_wrapper:
"""lammps API NumPy Wrapper
This is a wrapper class that provides additional methods on top of an
existing :py:class:`lammps` instance. The methods transform raw ctypes
pointers into NumPy arrays, which give direct access to the
original data while protecting against out-of-bounds accesses.
There is no need to explicitly instantiate this class. Each instance
of :py:class:`lammps` has a :py:attr:`numpy <lammps.numpy>` property
that returns an instance.
:param lmp: instance of the :py:class:`lammps` class
:type lmp: lammps
"""
def __init__(self, lmp):
self.lmp = lmp
# -------------------------------------------------------------------------
def _ctype_to_numpy_int(self, ctype_int):
import numpy as np
if ctype_int == c_int32:
return np.int32
elif ctype_int == c_int64:
return np.int64
return np.intc
# -------------------------------------------------------------------------
def extract_atom(self, name, dtype=LAMMPS_AUTODETECT, nelem=LAMMPS_AUTODETECT, dim=LAMMPS_AUTODETECT):
"""Retrieve per-atom properties from LAMMPS as NumPy arrays
This is a wrapper around the :py:meth:`lammps.extract_atom()` method.
It behaves the same as the original method, but returns NumPy arrays
instead of ``ctypes`` pointers.
.. note::
While the returned arrays of per-atom data are dimensioned
for the range [0:nmax] - as is the underlying storage -
the data is usually only valid for the range of [0:nlocal],
unless the property of interest is also updated for ghost
atoms. In some cases, this depends on a LAMMPS setting, see
for example :doc:`comm_modify vel yes <comm_modify>`.
:param name: name of the property
:type name: string
:param dtype: type of the returned data (see :ref:`py_datatype_constants`)
:type dtype: int, optional
:param nelem: number of elements in array
:type nelem: int, optional
:param dim: dimension of each element
:type dim: int, optional
:return: requested data as NumPy array with direct access to C data or None
:rtype: numpy.array or NoneType
"""
if dtype == LAMMPS_AUTODETECT:
dtype = self.lmp.extract_atom_datatype(name)
if nelem == LAMMPS_AUTODETECT:
if name == "mass":
nelem = self.lmp.extract_global("ntypes") + 1
else:
nelem = self.lmp.extract_global("nlocal")
if dim == LAMMPS_AUTODETECT:
if dtype in (LAMMPS_INT_2D, LAMMPS_DOUBLE_2D, LAMMPS_INT64_2D):
# TODO add other fields
if name in ("x", "v", "f", "angmom", "torque", "csforce", "vforce"):
dim = 3
else:
dim = 2
else:
dim = 1
raw_ptr = self.lmp.extract_atom(name, dtype)
if dtype in (LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D):
return self.darray(raw_ptr, nelem, dim)
elif dtype in (LAMMPS_INT, LAMMPS_INT_2D):
return self.iarray(c_int32, raw_ptr, nelem, dim)
elif dtype in (LAMMPS_INT64, LAMMPS_INT64_2D):
return self.iarray(c_int64, raw_ptr, nelem, dim)
return raw_ptr
# -------------------------------------------------------------------------
def extract_atom_iarray(self, name, nelem, dim=1):
warnings.warn("deprecated, use extract_atom instead", DeprecationWarning)
if name in ['id', 'molecule']:
c_int_type = self.lmp.c_tagint
elif name in ['image']:
c_int_type = self.lmp.c_imageint
else:
c_int_type = c_int
if dim == 1:
raw_ptr = self.lmp.extract_atom(name, LAMMPS_INT)
else:
raw_ptr = self.lmp.extract_atom(name, LAMMPS_INT_2D)
return self.iarray(c_int_type, raw_ptr, nelem, dim)
# -------------------------------------------------------------------------
def extract_atom_darray(self, name, nelem, dim=1):
warnings.warn("deprecated, use extract_atom instead", DeprecationWarning)
if dim == 1:
raw_ptr = self.lmp.extract_atom(name, LAMMPS_DOUBLE)
else:
raw_ptr = self.lmp.extract_atom(name, LAMMPS_DOUBLE_2D)
return self.darray(raw_ptr, nelem, dim)
# -------------------------------------------------------------------------
def extract_compute(self, cid, style, type):
"""Retrieve data from a LAMMPS compute
This is a wrapper around the
:py:meth:`lammps.extract_compute() <lammps.lammps.extract_compute()>` method.
It behaves the same as the original method, but returns NumPy arrays
instead of ``ctypes`` pointers.
:param id: compute ID
:type id: string
:param style: style of the data retrieve (global, atom, or local), see :ref:`py_style_constants`
:type style: int
:param type: type of the returned data (scalar, vector, or array), see :ref:`py_type_constants`
:type type: int
:return: requested data either as float, as NumPy array with direct access to C data, or None
:rtype: float, numpy.array, or NoneType
"""
value = self.lmp.extract_compute(cid, style, type)
if style in (LMP_STYLE_GLOBAL, LMP_STYLE_LOCAL):
if type == LMP_TYPE_VECTOR:
nrows = self.lmp.extract_compute(cid, style, LMP_SIZE_VECTOR)
return self.darray(value, nrows)
elif type == LMP_TYPE_ARRAY:
nrows = self.lmp.extract_compute(cid, style, LMP_SIZE_ROWS)
ncols = self.lmp.extract_compute(cid, style, LMP_SIZE_COLS)
return self.darray(value, nrows, ncols)
elif style == LMP_STYLE_ATOM:
if type == LMP_TYPE_VECTOR:
nlocal = self.lmp.extract_global("nlocal")
return self.darray(value, nlocal)
elif type == LMP_TYPE_ARRAY:
nlocal = self.lmp.extract_global("nlocal")
ncols = self.lmp.extract_compute(cid, style, LMP_SIZE_COLS)
return self.darray(value, nlocal, ncols)
return value
# -------------------------------------------------------------------------
def extract_fix(self, fid, style, type, nrow=0, ncol=0):
"""Retrieve data from a LAMMPS fix
This is a wrapper around the :py:meth:`lammps.extract_fix() <lammps.lammps.extract_fix()>` method.
It behaves the same as the original method, but returns NumPy arrays
instead of ``ctypes`` pointers.
:param id: fix ID
:type id: string
:param style: style of the data retrieve (global, atom, or local), see :ref:`py_style_constants`
:type style: int
:param type: type or size of the returned data (scalar, vector, or array), see :ref:`py_type_constants`
:type type: int
:param nrow: index of global vector element or row index of global array element
:type nrow: int
:param ncol: column index of global array element
:type ncol: int
:return: requested data
:rtype: integer or double value, pointer to 1d or 2d double array or None
"""
value = self.lmp.extract_fix(fid, style, type, nrow, ncol)
if style == LMP_STYLE_ATOM:
if type == LMP_TYPE_VECTOR:
nlocal = self.lmp.extract_global("nlocal")
return self.darray(value, nlocal)
elif type == LMP_TYPE_ARRAY:
nlocal = self.lmp.extract_global("nlocal")
ncols = self.lmp.extract_fix(fid, style, LMP_SIZE_COLS, 0, 0)
return self.darray(value, nlocal, ncols)
elif style == LMP_STYLE_LOCAL:
if type == LMP_TYPE_VECTOR:
nrows = self.lmp.extract_fix(fid, style, LMP_SIZE_ROWS, 0, 0)
return self.darray(value, nrows)
elif type == LMP_TYPE_ARRAY:
nrows = self.lmp.extract_fix(fid, style, LMP_SIZE_ROWS, 0, 0)
ncols = self.lmp.extract_fix(fid, style, LMP_SIZE_COLS, 0, 0)
return self.darray(value, nrows, ncols)
return value
# -------------------------------------------------------------------------
def extract_variable(self, name, group=None, vartype=LMP_VAR_EQUAL):
""" Evaluate a LAMMPS variable and return its data
This function is a wrapper around the function
:py:meth:`lammps.extract_variable() <lammps.lammps.extract_variable()>`
method. It behaves the same as the original method, but returns NumPy arrays
instead of ``ctypes`` pointers.
:param name: name of the variable to execute
:type name: string
:param group: name of group for atom-style variable (ignored for equal-style variables)
:type group: string
:param vartype: type of variable, see :ref:`py_vartype_constants`
:type vartype: int
:return: the requested data or None
:rtype: c_double, numpy.array, or NoneType
"""
import numpy as np
value = self.lmp.extract_variable(name, group, vartype)
if vartype == LMP_VAR_ATOM:
return np.ctypeslib.as_array(value)
return value
# -------------------------------------------------------------------------
def get_neighlist(self, idx):
"""Returns an instance of :class:`NumPyNeighList` which wraps access to the neighbor list with the given index
:param idx: index of neighbor list
:type idx: int
:return: an instance of :class:`NumPyNeighList` wrapping access to neighbor list data
:rtype: NumPyNeighList
"""
if idx < 0:
return None
return NumPyNeighList(self.lmp, idx)
# -------------------------------------------------------------------------
def get_neighlist_element_neighbors(self, idx, element):
"""Return data of neighbor list entry
This function is a wrapper around the function
:py:meth:`lammps.get_neighlist_element_neighbors() <lammps.lammps.get_neighlist_element_neighbors()>`
method. It behaves the same as the original method, but returns a NumPy array containing the neighbors
instead of a ``ctypes`` pointer.
:param element: neighbor list index
:type element: int
:param element: neighbor list element index
:type element: int
:return: tuple with atom local index and numpy array of neighbor local atom indices
:rtype: (int, numpy.array)
"""
iatom, numneigh, c_neighbors = self.lmp.get_neighlist_element_neighbors(idx, element)
neighbors = self.iarray(c_int, c_neighbors, numneigh, 1)
return iatom, neighbors
# -------------------------------------------------------------------------
def iarray(self, c_int_type, raw_ptr, nelem, dim=1):
import numpy as np
np_int_type = self._ctype_to_numpy_int(c_int_type)
if dim == 1:
ptr = cast(raw_ptr, POINTER(c_int_type * nelem))
else:
ptr = cast(raw_ptr[0], POINTER(c_int_type * nelem * dim))
a = np.frombuffer(ptr.contents, dtype=np_int_type)
a.shape = (nelem, dim)
return a
# -------------------------------------------------------------------------
def darray(self, raw_ptr, nelem, dim=1):
import numpy as np
if dim == 1:
ptr = cast(raw_ptr, POINTER(c_double * nelem))
else:
ptr = cast(raw_ptr[0], POINTER(c_double * nelem * dim))
a = np.frombuffer(ptr.contents)
a.shape = (nelem, dim)
return a
# -------------------------------------------------------------------------
class NumPyNeighList(NeighList):
"""This is a wrapper class that exposes the contents of a neighbor list.
It can be used like a regular Python list. Each element is a tuple of:
* the atom local index
* a NumPy array containing the local atom indices of its neighbors
Internally it uses the lower-level LAMMPS C-library interface.
:param lmp: reference to instance of :py:class:`lammps`
:type lmp: lammps
:param idx: neighbor list index
:type idx: int
"""
def __init__(self, lmp, idx):
super(NumPyNeighList, self).__init__(lmp, idx)
def get(self, element):
"""
:return: tuple with atom local index, numpy array of neighbor local atom indices
:rtype: (int, numpy.array)
"""
iatom, neighbors = self.lmp.numpy.get_neighlist_element_neighbors(self.idx, element)
return iatom, neighbors

861
python/lammps/pylammps.py Normal file
View File

@ -0,0 +1,861 @@
# ----------------------------------------------------------------------
# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
# http://lammps.sandia.gov, Sandia National Laboratories
# Steve Plimpton, sjplimp@sandia.gov
#
# Copyright (2003) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# the GNU General Public License.
#
# See the README file in the top-level LAMMPS directory.
# -------------------------------------------------------------------------
################################################################################
# Alternative Python Wrapper
# Written by Richard Berger <richard.berger@temple.edu>
################################################################################
# for python2/3 compatibility
from __future__ import print_function
import os
import re
import select
import sys
from collections import namedtuple
from .core import lammps
class OutputCapture(object):
""" Utility class to capture LAMMPS library output """
def __init__(self):
self.stdout_pipe_read, self.stdout_pipe_write = os.pipe()
self.stdout_fd = 1
def __enter__(self):
self.stdout = os.dup(self.stdout_fd)
os.dup2(self.stdout_pipe_write, self.stdout_fd)
return self
def __exit__(self, type, value, tracebac):
os.dup2(self.stdout, self.stdout_fd)
os.close(self.stdout)
os.close(self.stdout_pipe_read)
os.close(self.stdout_pipe_write)
# check if we have more to read from the pipe
def more_data(self, pipe):
r, _, _ = select.select([pipe], [], [], 0)
return bool(r)
# read the whole pipe
def read_pipe(self, pipe):
out = ""
while self.more_data(pipe):
out += os.read(pipe, 1024).decode()
return out
@property
def output(self):
return self.read_pipe(self.stdout_pipe_read)
# -------------------------------------------------------------------------
class Variable(object):
def __init__(self, pylammps_instance, name, style, definition):
self._pylmp = pylammps_instance
self.name = name
self.style = style
self.definition = definition.split()
@property
def value(self):
if self.style == 'atom':
return list(self._pylmp.lmp.extract_variable(self.name, "all", 1))
else:
value = self._pylmp.lmp_print('"${%s}"' % self.name).strip()
try:
return float(value)
except ValueError:
return value
# -------------------------------------------------------------------------
class AtomList(object):
"""
A dynamic list of atoms that returns either an :py:class:`Atom` or
:py:class:`Atom2D` instance for each atom. Instances are only allocated
when accessed.
:ivar natoms: total number of atoms
:ivar dimensions: number of dimensions in system
"""
def __init__(self, pylammps_instance):
self._pylmp = pylammps_instance
self.natoms = self._pylmp.system.natoms
self.dimensions = self._pylmp.system.dimensions
self._loaded = {}
def __getitem__(self, index):
"""
Return Atom with given local index
:param index: Local index of atom
:type index: int
:rtype: Atom or Atom2D
"""
if index not in self._loaded:
if self.dimensions == 2:
atom = Atom2D(self._pylmp, index + 1)
else:
atom = Atom(self._pylmp, index + 1)
self._loaded[index] = atom
return self._loaded[index]
def __len__(self):
return self.natoms
# -------------------------------------------------------------------------
class Atom(object):
"""
A wrapper class then represents a single atom inside of LAMMPS
It provides access to properties of the atom and allows you to change some of them.
"""
def __init__(self, pylammps_instance, index):
self._pylmp = pylammps_instance
self.index = index
@property
def id(self):
"""
Return the atom ID
:type: int
"""
return int(self._pylmp.eval("id[%d]" % self.index))
@property
def type(self):
"""
Return the atom type
:type: int
"""
return int(self._pylmp.eval("type[%d]" % self.index))
@property
def mol(self):
"""
Return the atom molecule index
:type: int
"""
return self._pylmp.eval("mol[%d]" % self.index)
@property
def mass(self):
"""
Return the atom mass
:type: float
"""
return self._pylmp.eval("mass[%d]" % self.index)
@property
def position(self):
"""
:getter: Return position of atom
:setter: Set position of atom
:type: tuple (float, float, float)
"""
return (self._pylmp.eval("x[%d]" % self.index),
self._pylmp.eval("y[%d]" % self.index),
self._pylmp.eval("z[%d]" % self.index))
@position.setter
def position(self, value):
"""
:getter: Return velocity of atom
:setter: Set velocity of atom
:type: tuple (float, float, float)
"""
self._pylmp.set("atom", self.index, "x", value[0])
self._pylmp.set("atom", self.index, "y", value[1])
self._pylmp.set("atom", self.index, "z", value[2])
@property
def velocity(self):
return (self._pylmp.eval("vx[%d]" % self.index),
self._pylmp.eval("vy[%d]" % self.index),
self._pylmp.eval("vz[%d]" % self.index))
@velocity.setter
def velocity(self, value):
self._pylmp.set("atom", self.index, "vx", value[0])
self._pylmp.set("atom", self.index, "vy", value[1])
self._pylmp.set("atom", self.index, "vz", value[2])
@property
def force(self):
"""
Return the total force acting on the atom
:type: tuple (float, float, float)
"""
return (self._pylmp.eval("fx[%d]" % self.index),
self._pylmp.eval("fy[%d]" % self.index),
self._pylmp.eval("fz[%d]" % self.index))
@property
def charge(self):
"""
Return the atom charge
:type: float
"""
return self._pylmp.eval("q[%d]" % self.index)
# -------------------------------------------------------------------------
class Atom2D(Atom):
"""
A wrapper class then represents a single 2D atom inside of LAMMPS
Inherits all properties from the :py:class:`Atom` class, but returns 2D versions
of position, velocity, and force.
It provides access to properties of the atom and allows you to change some of them.
"""
def __init__(self, pylammps_instance, index):
super(Atom2D, self).__init__(pylammps_instance, index)
@property
def position(self):
"""
:getter: Return position of atom
:setter: Set position of atom
:type: tuple (float, float)
"""
return (self._pylmp.eval("x[%d]" % self.index),
self._pylmp.eval("y[%d]" % self.index))
@position.setter
def position(self, value):
self._pylmp.set("atom", self.index, "x", value[0])
self._pylmp.set("atom", self.index, "y", value[1])
@property
def velocity(self):
"""
:getter: Return velocity of atom
:setter: Set velocity of atom
:type: tuple (float, float)
"""
return (self._pylmp.eval("vx[%d]" % self.index),
self._pylmp.eval("vy[%d]" % self.index))
@velocity.setter
def velocity(self, value):
self._pylmp.set("atom", self.index, "vx", value[0])
self._pylmp.set("atom", self.index, "vy", value[1])
@property
def force(self):
"""
Return the total force acting on the atom
:type: tuple (float, float)
"""
return (self._pylmp.eval("fx[%d]" % self.index),
self._pylmp.eval("fy[%d]" % self.index))
# -------------------------------------------------------------------------
class variable_set:
def __init__(self, name, variable_dict):
self._name = name
array_pattern = re.compile(r"(?P<arr>.+)\[(?P<index>[0-9]+)\]")
for key, value in variable_dict.items():
m = array_pattern.match(key)
if m:
g = m.groupdict()
varname = g['arr']
idx = int(g['index'])
if varname not in self.__dict__:
self.__dict__[varname] = {}
self.__dict__[varname][idx] = value
else:
self.__dict__[key] = value
def __str__(self):
return "{}({})".format(self._name, ','.join(["{}={}".format(k, self.__dict__[k]) for k in self.__dict__.keys() if not k.startswith('_')]))
def __repr__(self):
return self.__str__()
# -------------------------------------------------------------------------
def get_thermo_data(output):
""" traverse output of runs and extract thermo data columns """
if isinstance(output, str):
lines = output.splitlines()
else:
lines = output
runs = []
columns = []
in_run = False
current_run = {}
for line in lines:
if line.startswith("Per MPI rank memory allocation"):
in_run = True
elif in_run and len(columns) == 0:
# first line after memory usage are column names
columns = line.split()
current_run = {}
for col in columns:
current_run[col] = []
elif line.startswith("Loop time of "):
in_run = False
columns = None
thermo_data = variable_set('ThermoData', current_run)
r = {'thermo' : thermo_data }
runs.append(namedtuple('Run', list(r.keys()))(*list(r.values())))
elif in_run and len(columns) > 0:
items = line.split()
# Convert thermo output and store it.
# It must have the same number of columns and
# all of them must be convertible to floats.
# Otherwise we ignore the line
if len(items) == len(columns):
try:
values = [float(x) for x in items]
for i, col in enumerate(columns):
current_run[col].append(values[i])
except ValueError:
pass
return runs
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
class PyLammps(object):
"""
This is a Python wrapper class around the lower-level
:py:class:`lammps` class, exposing a more Python-like,
object-oriented interface for prototyping system inside of IPython and
Jupyter notebooks.
It either creates its own instance of :py:class:`lammps` or can be
initialized with an existing instance. The arguments are the same of the
lower-level interface. The original interface can still be accessed via
:py:attr:`PyLammps.lmp`.
:param name: "machine" name of the shared LAMMPS library ("mpi" loads ``liblammps_mpi.so``, "" loads ``liblammps.so``)
:type name: string
:param cmdargs: list of command line arguments to be passed to the :cpp:func:`lammps_open` function. The executable name is automatically added.
:type cmdargs: list
:param ptr: pointer to a LAMMPS C++ class instance when called from an embedded Python interpreter. None means load symbols from shared library.
:type ptr: pointer
:param comm: MPI communicator (as provided by `mpi4py <mpi4py_docs_>`_). ``None`` means use ``MPI_COMM_WORLD`` implicitly.
:type comm: MPI_Comm
:ivar lmp: instance of original LAMMPS Python interface
:vartype lmp: :py:class:`lammps`
:ivar runs: list of completed runs, each storing the thermo output
:vartype run: list
"""
def __init__(self, name="", cmdargs=None, ptr=None, comm=None):
self.has_echo = False
if cmdargs:
if '-echo' in cmdargs:
idx = cmdargs.index('-echo')
# ensures that echo line is ignored during output capture
self.has_echo = idx+1 < len(cmdargs) and cmdargs[idx+1] in ('screen', 'both')
if ptr:
if isinstance(ptr,PyLammps):
self.lmp = ptr.lmp
elif isinstance(ptr,lammps):
self.lmp = ptr
else:
self.lmp = lammps(name=name,cmdargs=cmdargs,ptr=ptr,comm=comm)
else:
self.lmp = lammps(name=name,cmdargs=cmdargs,ptr=None,comm=comm)
print("LAMMPS output is captured by PyLammps wrapper")
self._cmd_history = []
self.runs = []
def __del__(self):
if self.lmp: self.lmp.close()
self.lmp = None
def close(self):
"""Explicitly delete a LAMMPS instance
This is a wrapper around the :py:meth:`lammps.close` of the Python interface.
"""
if self.lmp: self.lmp.close()
self.lmp = None
def version(self):
"""Return a numerical representation of the LAMMPS version in use.
This is a wrapper around the :py:meth:`lammps.version` function of the Python interface.
:return: version number
:rtype: int
"""
return self.lmp.version()
def file(self, file):
"""Read LAMMPS commands from a file.
This is a wrapper around the :py:meth:`lammps.file` function of the Python interface.
:param path: Name of the file/path with LAMMPS commands
:type path: string
"""
self.lmp.file(file)
def write_script(self, filepath):
"""
Write LAMMPS script file containing all commands executed up until now
:param filepath: path to script file that should be written
:type filepath: string
"""
with open(filepath, "w") as f:
for cmd in self._cmd_history:
print(cmd, file=f)
def command(self, cmd):
"""
Execute LAMMPS command
All commands executed will be stored in a command history which can be
written to a file using :py:meth:`PyLammps.write_script()`
:param cmd: command string that should be executed
:type: cmd: string
"""
self.lmp.command(cmd)
self._cmd_history.append(cmd)
def run(self, *args, **kwargs):
"""
Execute LAMMPS run command with given arguments
All thermo output during the run is captured and saved as new entry in
:py:attr:`PyLammps.runs`. The latest run can be retrieved by
:py:attr:`PyLammps.last_run`.
"""
output = self.__getattr__('run')(*args, **kwargs)
comm = self.lmp.get_mpi_comm()
if comm:
output = self.lmp.comm.bcast(output, root=0)
self.runs += get_thermo_data(output)
return output
@property
def last_run(self):
"""
Return data produced of last completed run command
:getter: Returns an object containing information about the last run command
:type: dict
"""
if len(self.runs) > 0:
return self.runs[-1]
return None
@property
def atoms(self):
"""
All atoms of this LAMMPS instance
:getter: Returns a list of atoms currently in the system
:type: AtomList
"""
return AtomList(self)
@property
def system(self):
"""
The system state of this LAMMPS instance
:getter: Returns an object with properties storing the current system state
:type: namedtuple
"""
output = self.info("system")
d = self._parse_info_system(output)
return namedtuple('System', d.keys())(*d.values())
@property
def communication(self):
"""
The communication state of this LAMMPS instance
:getter: Returns an object with properties storing the current communication state
:type: namedtuple
"""
output = self.info("communication")
d = self._parse_info_communication(output)
return namedtuple('Communication', d.keys())(*d.values())
@property
def computes(self):
"""
The list of active computes of this LAMMPS instance
:getter: Returns a list of computes that are currently active in this LAMMPS instance
:type: list
"""
output = self.info("computes")
return self._parse_element_list(output)
@property
def dumps(self):
"""
The list of active dumps of this LAMMPS instance
:getter: Returns a list of dumps that are currently active in this LAMMPS instance
:type: list
"""
output = self.info("dumps")
return self._parse_element_list(output)
@property
def fixes(self):
"""
The list of active fixes of this LAMMPS instance
:getter: Returns a list of fixes that are currently active in this LAMMPS instance
:type: list
"""
output = self.info("fixes")
return self._parse_element_list(output)
@property
def groups(self):
"""
The list of active atom groups of this LAMMPS instance
:getter: Returns a list of atom groups that are currently active in this LAMMPS instance
:type: list
"""
output = self.info("groups")
return self._parse_groups(output)
@property
def variables(self):
"""
Returns a dictionary of all variables defined in the current LAMMPS instance
:getter: Returns a dictionary of all variables that are defined in this LAMMPS instance
:type: dict
"""
output = self.info("variables")
vars = {}
for v in self._parse_element_list(output):
vars[v['name']] = Variable(self, v['name'], v['style'], v['def'])
return vars
def eval(self, expr):
"""
Evaluate expression
:param expr: the expression string that should be evaluated inside of LAMMPS
:type expr: string
:return: the value of the evaluated expression
:rtype: float if numeric, string otherwise
"""
value = self.lmp_print('"$(%s)"' % expr).strip()
try:
return float(value)
except ValueError:
return value
def _split_values(self, line):
return [x.strip() for x in line.split(',')]
def _get_pair(self, value):
return [x.strip() for x in value.split('=')]
def _parse_info_system(self, output):
lines = output[6:-2]
system = {}
for line in lines:
if line.startswith("Units"):
system['units'] = self._get_pair(line)[1]
elif line.startswith("Atom style"):
system['atom_style'] = self._get_pair(line)[1]
elif line.startswith("Atom map"):
system['atom_map'] = self._get_pair(line)[1]
elif line.startswith("Atoms"):
parts = self._split_values(line)
system['natoms'] = int(self._get_pair(parts[0])[1])
system['ntypes'] = int(self._get_pair(parts[1])[1])
system['style'] = self._get_pair(parts[2])[1]
elif line.startswith("Kspace style"):
system['kspace_style'] = self._get_pair(line)[1]
elif line.startswith("Dimensions"):
system['dimensions'] = int(self._get_pair(line)[1])
elif line.startswith("Orthogonal box"):
system['orthogonal_box'] = [float(x) for x in self._get_pair(line)[1].split('x')]
elif line.startswith("Boundaries"):
system['boundaries'] = self._get_pair(line)[1]
elif line.startswith("xlo"):
keys, values = [self._split_values(x) for x in self._get_pair(line)]
for key, value in zip(keys, values):
system[key] = float(value)
elif line.startswith("ylo"):
keys, values = [self._split_values(x) for x in self._get_pair(line)]
for key, value in zip(keys, values):
system[key] = float(value)
elif line.startswith("zlo"):
keys, values = [self._split_values(x) for x in self._get_pair(line)]
for key, value in zip(keys, values):
system[key] = float(value)
elif line.startswith("Molecule type"):
system['molecule_type'] = self._get_pair(line)[1]
elif line.startswith("Bonds"):
parts = self._split_values(line)
system['nbonds'] = int(self._get_pair(parts[0])[1])
system['nbondtypes'] = int(self._get_pair(parts[1])[1])
system['bond_style'] = self._get_pair(parts[2])[1]
elif line.startswith("Angles"):
parts = self._split_values(line)
system['nangles'] = int(self._get_pair(parts[0])[1])
system['nangletypes'] = int(self._get_pair(parts[1])[1])
system['angle_style'] = self._get_pair(parts[2])[1]
elif line.startswith("Dihedrals"):
parts = self._split_values(line)
system['ndihedrals'] = int(self._get_pair(parts[0])[1])
system['ndihedraltypes'] = int(self._get_pair(parts[1])[1])
system['dihedral_style'] = self._get_pair(parts[2])[1]
elif line.startswith("Impropers"):
parts = self._split_values(line)
system['nimpropers'] = int(self._get_pair(parts[0])[1])
system['nimpropertypes'] = int(self._get_pair(parts[1])[1])
system['improper_style'] = self._get_pair(parts[2])[1]
return system
def _parse_info_communication(self, output):
lines = output[6:-3]
comm = {}
for line in lines:
if line.startswith("MPI library"):
comm['mpi_version'] = line.split(':')[1].strip()
elif line.startswith("Comm style"):
parts = self._split_values(line)
comm['comm_style'] = self._get_pair(parts[0])[1]
comm['comm_layout'] = self._get_pair(parts[1])[1]
elif line.startswith("Processor grid"):
comm['proc_grid'] = [int(x) for x in self._get_pair(line)[1].split('x')]
elif line.startswith("Communicate velocities for ghost atoms"):
comm['ghost_velocity'] = (self._get_pair(line)[1] == "yes")
elif line.startswith("Nprocs"):
parts = self._split_values(line)
comm['nprocs'] = int(self._get_pair(parts[0])[1])
comm['nthreads'] = int(self._get_pair(parts[1])[1])
return comm
def _parse_element_list(self, output):
lines = output[6:-3]
elements = []
for line in lines:
element_info = self._split_values(line.split(':')[1].strip())
element = {'name': element_info[0]}
for key, value in [self._get_pair(x) for x in element_info[1:]]:
element[key] = value
elements.append(element)
return elements
def _parse_groups(self, output):
lines = output[6:-3]
groups = []
group_pattern = re.compile(r"(?P<name>.+) \((?P<type>.+)\)")
for line in lines:
m = group_pattern.match(line.split(':')[1].strip())
group = {'name': m.group('name'), 'type': m.group('type')}
groups.append(group)
return groups
def lmp_print(self, s):
""" needed for Python2 compatibility, since print is a reserved keyword """
return self.__getattr__("print")(s)
def __dir__(self):
return ['angle_coeff', 'angle_style', 'atom_modify', 'atom_style', 'atom_style',
'bond_coeff', 'bond_style', 'boundary', 'change_box', 'communicate', 'compute',
'create_atoms', 'create_box', 'delete_atoms', 'delete_bonds', 'dielectric',
'dihedral_coeff', 'dihedral_style', 'dimension', 'dump', 'fix', 'fix_modify',
'group', 'improper_coeff', 'improper_style', 'include', 'kspace_modify',
'kspace_style', 'lattice', 'mass', 'minimize', 'min_style', 'neighbor',
'neigh_modify', 'newton', 'nthreads', 'pair_coeff', 'pair_modify',
'pair_style', 'processors', 'read', 'read_data', 'read_restart', 'region',
'replicate', 'reset_timestep', 'restart', 'run', 'run_style', 'thermo',
'thermo_modify', 'thermo_style', 'timestep', 'undump', 'unfix', 'units',
'variable', 'velocity', 'write_restart']
def __getattr__(self, name):
"""
This method is where the Python 'magic' happens. If a method is not
defined by the class PyLammps, it assumes it is a LAMMPS command. It takes
all the arguments, concatinates them to a single string, and executes it using
:py:meth:`lammps.PyLammps.command()`.
:param verbose: Print output of command
:type verbose: bool
:return: line or list of lines of output, None if no output
:rtype: list or string
"""
def handler(*args, **kwargs):
cmd_args = [name] + [str(x) for x in args]
with OutputCapture() as capture:
cmd = ' '.join(cmd_args)
self.command(cmd)
output = capture.output
if 'verbose' in kwargs and kwargs['verbose']:
print(output)
lines = output.splitlines()
if self.has_echo:
lines = lines[1:]
if len(lines) > 1:
return lines
elif len(lines) == 1:
return lines[0]
return None
return handler
class IPyLammps(PyLammps):
"""
IPython wrapper for LAMMPS which adds embedded graphics capabilities to PyLammmps interface
It either creates its own instance of :py:class:`lammps` or can be
initialized with an existing instance. The arguments are the same of the
lower-level interface. The original interface can still be accessed via
:py:attr:`PyLammps.lmp`.
:param name: "machine" name of the shared LAMMPS library ("mpi" loads ``liblammps_mpi.so``, "" loads ``liblammps.so``)
:type name: string
:param cmdargs: list of command line arguments to be passed to the :cpp:func:`lammps_open` function. The executable name is automatically added.
:type cmdargs: list
:param ptr: pointer to a LAMMPS C++ class instance when called from an embedded Python interpreter. None means load symbols from shared library.
:type ptr: pointer
:param comm: MPI communicator (as provided by `mpi4py <mpi4py_docs_>`_). ``None`` means use ``MPI_COMM_WORLD`` implicitly.
:type comm: MPI_Comm
"""
def __init__(self,name="",cmdargs=None,ptr=None,comm=None):
super(IPyLammps, self).__init__(name=name,cmdargs=cmdargs,ptr=ptr,comm=comm)
def image(self, filename="snapshot.png", group="all", color="type", diameter="type",
size=None, view=None, center=None, up=None, zoom=1.0, background_color="white"):
""" Generate image using write_dump command and display it
See :doc:`dump image <dump_image>` for more information.
:param filename: Name of the image file that should be generated. The extension determines whether it is PNG or JPEG
:type filename: string
:param group: the group of atoms write_image should use
:type group: string
:param color: name of property used to determine color
:type color: string
:param diameter: name of property used to determine atom diameter
:type diameter: string
:param size: dimensions of image
:type size: tuple (width, height)
:param view: view parameters
:type view: tuple (theta, phi)
:param center: center parameters
:type center: tuple (flag, center_x, center_y, center_z)
:param up: vector pointing to up direction
:type up: tuple (up_x, up_y, up_z)
:param zoom: zoom factor
:type zoom: float
:param background_color: background color of scene
:type background_color: string
:return: Image instance used to display image in notebook
:rtype: :py:class:`IPython.core.display.Image`
"""
cmd_args = [group, "image", filename, color, diameter]
if size:
width = size[0]
height = size[1]
cmd_args += ["size", width, height]
if view:
theta = view[0]
phi = view[1]
cmd_args += ["view", theta, phi]
if center:
flag = center[0]
Cx = center[1]
Cy = center[2]
Cz = center[3]
cmd_args += ["center", flag, Cx, Cy, Cz]
if up:
Ux = up[0]
Uy = up[1]
Uz = up[2]
cmd_args += ["up", Ux, Uy, Uz]
if zoom:
cmd_args += ["zoom", zoom]
cmd_args.append("modify backcolor " + background_color)
self.write_dump(*cmd_args)
from IPython.core.display import Image
return Image(filename)
def video(self, filename):
"""
Load video from file
Can be used to visualize videos from :doc:`dump movie <dump_image>`.
:param filename: Path to video file
:type filename: string
:return: HTML Video Tag used by notebook to embed a video
:rtype: :py:class:`IPython.display.HTML`
"""
from IPython.display import HTML
return HTML("<video controls><source src=\"" + filename + "\"></video>")

26
python/setup.py Normal file
View File

@ -0,0 +1,26 @@
# this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed
from distutils.core import setup
import os
LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__))
LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR)
LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src')
def get_lammps_version():
with open(os.path.join(LAMMPS_SOURCE_DIR, 'version.h'), 'r') as f:
line = f.readline()
start_pos = line.find('"')+1
end_pos = line.find('"', start_pos)
return "".join(line[start_pos:end_pos].split())
setup(
name = "lammps",
version = get_lammps_version(),
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "https://lammps.sandia.gov",
description = "LAMMPS Molecular Dynamics Python package",
license = "GPL",
packages=["lammps","lammps.mliap"],
)

View File

@ -99,20 +99,20 @@ void PairBrownian::compute(int eflag, int vflag)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -494,7 +494,7 @@ void PairBrownian::init_style()
// are re-calculated at every step.
flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0)
flagdeform = 1;
else if (strstr(modify->fix[i]->style,"wall") != nullptr) {
@ -514,14 +514,14 @@ void PairBrownian::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
// Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);

View File

@ -82,20 +82,20 @@ void PairBrownianPoly::compute(int eflag, int vflag)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (j = 0; j < 3; j++){
for (j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -355,7 +355,7 @@ void PairBrownianPoly::init_style()
// are re-calculated at every step.
flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0)
flagdeform = 1;
else if (strstr(modify->fix[i]->style,"wall") != nullptr) {
@ -375,14 +375,14 @@ void PairBrownianPoly::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
// Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);

View File

@ -155,20 +155,20 @@ void PairLubricate::compute(int eflag, int vflag)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -559,7 +559,7 @@ void PairLubricate::init_style()
// are re-calculated at every step.
shearing = flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0) {
shearing = flagdeform = 1;
if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP)
@ -584,15 +584,15 @@ void PairLubricate::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
//Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);

View File

@ -158,8 +158,8 @@ void PairLubricateU::compute(int eflag, int vflag)
// store back the saved forces and torques in original arrays
for(i=0;i<nlocal+nghost;i++) {
for(j=0;j<3;j++) {
for (i=0;i<nlocal+nghost;i++) {
for (j=0;j<3;j++) {
f[i][j] = fl[i][j];
torque[i][j] = Tl[i][j];
}
@ -223,7 +223,7 @@ void PairLubricateU::stage_one()
// Find the right hand side= -ve of all forces/torques
// b = 6*Npart in overall size
for(ii = 0; ii < inum; ii++) {
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
for (j = 0; j < 3; j++) {
bcg[6*ii+j] = -f[i][j];
@ -407,7 +407,7 @@ void PairLubricateU::stage_two(double **x)
// Find the right hand side= -ve of all forces/torques
// b = 6*Npart in overall size
for(ii = 0; ii < inum; ii++) {
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
for (j = 0; j < 3; j++) {
bcg[6*ii+j] = -f[i][j];
@ -581,20 +581,20 @@ void PairLubricateU::compute_Fh(double **x)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -813,20 +813,20 @@ void PairLubricateU::compute_RU()
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -1013,7 +1013,7 @@ void PairLubricateU::compute_RU()
torque[i][1] -= vxmu2f*ty;
torque[i][2] -= vxmu2f*tz;
if(newton_pair || j < nlocal) {
if (newton_pair || j < nlocal) {
torque[j][0] -= vxmu2f*tx;
torque[j][1] -= vxmu2f*ty;
torque[j][2] -= vxmu2f*tz;
@ -1084,20 +1084,20 @@ void PairLubricateU::compute_RU(double **x)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -1284,7 +1284,7 @@ void PairLubricateU::compute_RU(double **x)
torque[i][1] -= vxmu2f*ty;
torque[i][2] -= vxmu2f*tz;
if(newton_pair || j < nlocal) {
if (newton_pair || j < nlocal) {
torque[j][0] -= vxmu2f*tx;
torque[j][1] -= vxmu2f*ty;
torque[j][2] -= vxmu2f*tz;
@ -1791,7 +1791,7 @@ void PairLubricateU::init_style()
// are re-calculated at every step.
flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0)
flagdeform = 1;
else if (strstr(modify->fix[i]->style,"wall") != nullptr) {
@ -1811,14 +1811,14 @@ void PairLubricateU::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
//Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);

View File

@ -126,8 +126,8 @@ void PairLubricateUPoly::compute(int eflag, int vflag)
// Store back the saved forces and torques in original arrays
for(i=0;i<nlocal+nghost;i++) {
for(j=0;j<3;j++) {
for (i=0;i<nlocal+nghost;i++) {
for (j=0;j<3;j++) {
f[i][j] = fl[i][j];
torque[i][j] = Tl[i][j];
}
@ -172,7 +172,7 @@ void PairLubricateUPoly::iterate(double **x, int stage)
// Find the right hand side= -ve of all forces/torques
// b = 6*Npart in overall size
for(ii = 0; ii < inum; ii++) {
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
for (j = 0; j < 3; j++) {
bcg[6*ii+j] = -f[i][j];
@ -351,20 +351,20 @@ void PairLubricateUPoly::compute_Fh(double **x)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -626,20 +626,20 @@ void PairLubricateUPoly::compute_RU(double **x)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (j = 0; j < 3; j++){
for (j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -1155,10 +1155,10 @@ void PairLubricateUPoly::init_style()
// are re-calculated at every step.
flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0)
flagdeform = 1;
else if (strstr(modify->fix[i]->style,"wall") != nullptr){
else if (strstr(modify->fix[i]->style,"wall") != nullptr) {
if (flagwall)
error->all(FLERR,
"Cannot use multiple fix wall commands with "
@ -1176,14 +1176,14 @@ void PairLubricateUPoly::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
//Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
@ -1214,7 +1214,7 @@ void PairLubricateUPoly::init_style()
if (!flagVF) vol_f = 0;
if (!comm->me) {
if(logfile)
if (logfile)
fprintf(logfile, "lubricateU: vol_f = %g, vol_p = %g, vol_T = %g\n",
vol_f,vol_P,vol_T);
if (screen)

View File

@ -137,20 +137,20 @@ void PairLubricatePoly::compute(int eflag, int vflag)
double dims[3], wallcoord;
if (flagVF) // Flag for volume fraction corrections
if (flagdeform || flagwall == 2){ // Possible changes in volume fraction
if (flagdeform || flagwall == 2) { // Possible changes in volume fraction
if (flagdeform && !flagwall)
for (j = 0; j < 3; j++)
dims[j] = domain->prd[j];
else if (flagwall == 2 || (flagdeform && flagwall == 1)){
else if (flagwall == 2 || (flagdeform && flagwall == 1)) {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
@ -461,7 +461,7 @@ void PairLubricatePoly::init_style()
// are re-calculated at every step.
shearing = flagdeform = flagwall = 0;
for (int i = 0; i < modify->nfix; i++){
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"deform") == 0) {
shearing = flagdeform = 1;
if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP)
@ -478,9 +478,9 @@ void PairLubricatePoly::init_style()
if (wallfix->xflag) flagwall = 2; // Moving walls exist
}
if (strstr(modify->fix[i]->style,"wall") != nullptr){
if (strstr(modify->fix[i]->style,"wall") != nullptr) {
flagwall = 1; // Walls exist
if (((FixWall *) modify->fix[i])->xflag ) {
if (((FixWall *) modify->fix[i])->xflag) {
flagwall = 2; // Moving walls exist
wallfix = (FixWall *) modify->fix[i];
}
@ -492,14 +492,14 @@ void PairLubricatePoly::init_style()
if (!flagwall) vol_T = domain->xprd*domain->yprd*domain->zprd;
else {
double wallhi[3], walllo[3];
for (int j = 0; j < 3; j++){
for (int j = 0; j < 3; j++) {
wallhi[j] = domain->prd[j];
walllo[j] = 0;
}
for (int m = 0; m < wallfix->nwall; m++){
for (int m = 0; m < wallfix->nwall; m++) {
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
if (wallfix->xstyle[m] == VARIABLE){
if (wallfix->xstyle[m] == VARIABLE) {
wallfix->xindex[m] = input->variable->find(wallfix->xstr[m]);
//Since fix->wall->init happens after pair->init_style
wallcoord = input->variable->compute_equal(wallfix->xindex[m]);

View File

@ -168,7 +168,7 @@ void DumpAtomGZ::write()
int DumpAtomGZ::modify_param(int narg, char **arg)
{
int consumed = DumpAtom::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
if (strcmp(arg[0],"compression_level") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int min_level = Z_DEFAULT_COMPRESSION;

View File

@ -171,7 +171,7 @@ void DumpAtomZstd::write()
int DumpAtomZstd::modify_param(int narg, char **arg)
{
int consumed = DumpAtom::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
try {
if (strcmp(arg[0],"checksum") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");

View File

@ -176,7 +176,7 @@ void DumpCFGGZ::write()
int DumpCFGGZ::modify_param(int narg, char **arg)
{
int consumed = DumpCFG::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
if (strcmp(arg[0],"compression_level") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int min_level = Z_DEFAULT_COMPRESSION;

View File

@ -173,7 +173,7 @@ void DumpCFGZstd::write()
int DumpCFGZstd::modify_param(int narg, char **arg)
{
int consumed = DumpCFG::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
try {
if (strcmp(arg[0],"checksum") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");

View File

@ -168,7 +168,7 @@ void DumpCustomGZ::write()
int DumpCustomGZ::modify_param(int narg, char **arg)
{
int consumed = DumpCustom::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
if (strcmp(arg[0],"compression_level") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int min_level = Z_DEFAULT_COMPRESSION;

View File

@ -171,7 +171,7 @@ void DumpCustomZstd::write()
int DumpCustomZstd::modify_param(int narg, char **arg)
{
int consumed = DumpCustom::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
try {
if (strcmp(arg[0],"checksum") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");

View File

@ -183,7 +183,7 @@ void DumpLocalGZ::write()
int DumpLocalGZ::modify_param(int narg, char **arg)
{
int consumed = DumpLocal::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
if (strcmp(arg[0],"compression_level") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int min_level = Z_DEFAULT_COMPRESSION;

View File

@ -171,7 +171,7 @@ void DumpLocalZstd::write()
int DumpLocalZstd::modify_param(int narg, char **arg)
{
int consumed = DumpLocal::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
try {
if (strcmp(arg[0],"checksum") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");

View File

@ -147,7 +147,7 @@ void DumpXYZGZ::write()
int DumpXYZGZ::modify_param(int narg, char **arg)
{
int consumed = DumpXYZ::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
if (strcmp(arg[0],"compression_level") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
int min_level = Z_DEFAULT_COMPRESSION;

View File

@ -145,7 +145,7 @@ void DumpXYZZstd::write()
int DumpXYZZstd::modify_param(int narg, char **arg)
{
int consumed = DumpXYZ::modify_param(narg, arg);
if(consumed == 0) {
if (consumed == 0) {
try {
if (strcmp(arg[0],"checksum") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");

View File

@ -48,7 +48,7 @@ ZstdFileWriter::~ZstdFileWriter()
void ZstdFileWriter::open(const std::string &path)
{
if(isopen()) return;
if (isopen()) return;
fp = fopen(path.c_str(), "wb");
@ -72,16 +72,16 @@ void ZstdFileWriter::open(const std::string &path)
size_t ZstdFileWriter::write(const void * buffer, size_t length)
{
if(!isopen()) return 0;
if (!isopen()) return 0;
ZSTD_inBuffer input = { buffer, length, 0 };
ZSTD_EndDirective mode = ZSTD_e_continue;
do {
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
size_t const remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
ZSTD_compressStream2(cctx, &output, &input, mode);
fwrite(out_buffer, sizeof(char), output.pos, fp);
} while(input.pos < input.size);
} while (input.pos < input.size);
return length;
}
@ -90,7 +90,7 @@ size_t ZstdFileWriter::write(const void * buffer, size_t length)
void ZstdFileWriter::flush()
{
if(!isopen()) return;
if (!isopen()) return;
size_t remaining;
ZSTD_inBuffer input = { nullptr, 0, 0 };
@ -100,7 +100,7 @@ void ZstdFileWriter::flush()
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
fwrite(out_buffer, sizeof(char), output.pos, fp);
} while(remaining);
} while (remaining);
fflush(fp);
}
@ -109,7 +109,7 @@ void ZstdFileWriter::flush()
void ZstdFileWriter::close()
{
if(!isopen()) return;
if (!isopen()) return;
size_t remaining;
ZSTD_inBuffer input = { nullptr, 0, 0 };
@ -119,7 +119,7 @@ void ZstdFileWriter::close()
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
fwrite(out_buffer, sizeof(char), output.pos, fp);
} while(remaining);
} while (remaining);
ZSTD_freeCCtx(cctx);
cctx = nullptr;
@ -144,7 +144,7 @@ void ZstdFileWriter::setCompressionLevel(int level)
const int min_level = ZSTD_minCLevel();
const int max_level = ZSTD_maxCLevel();
if(level < min_level || level > max_level)
if (level < min_level || level > max_level)
throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
compression_level = level;

View File

@ -232,7 +232,7 @@ double ComputeTempCS::compute_scalar()
double t = 0.0;
for (int i = 0; i < nlocal; i++){
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
vthermal[0] = v[i][0] - vint[i][0];
vthermal[1] = v[i][1] - vint[i][1];
@ -271,7 +271,7 @@ void ComputeTempCS::compute_vector()
double t[6];
for (int i = 0; i < 6; i++) t[i] = 0.0;
for (int i = 0; i < nlocal; i++){
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
if (rmass) massone = rmass[i];
else massone = mass[type[i]];

View File

@ -106,6 +106,10 @@ if (test $1 = "PERI") then
depend USER-OMP
fi
if (test $1 = "PYTHON") then
depend MLIAP
fi
if (test $1 = "RIGID") then
depend KOKKOS
depend USER-OMP
@ -114,6 +118,7 @@ fi
if (test $1 = "SNAP") then
depend KOKKOS
depend MLIAP
fi
if (test $1 = "USER-CGSDK") then

View File

@ -120,6 +120,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
double binsize = 0.0;
char *opencl_flags = nullptr;
int block_pair = -1;
int pair_only_flag = 0;
int iarg = 4;
while (iarg < narg) {
@ -169,6 +170,12 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command");
block_pair = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"pair/only") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command");
if (strcmp(arg[iarg+1],"off") == 0) pair_only_flag = 0;
else if (strcmp(arg[iarg+1],"on") == 0) pair_only_flag = 1;
else error->all(FLERR,"Illegal package gpu command");
iarg += 2;
} else error->all(FLERR,"Illegal package gpu command");
}
@ -186,6 +193,16 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
if (force->newton_pair || force->newton_bond) force->newton = 1;
else force->newton = 0;
if (pair_only_flag) {
lmp->suffixp = lmp->suffix;
lmp->suffix = nullptr;
} else {
if (lmp->suffixp) {
lmp->suffix = lmp->suffixp;
lmp->suffixp = nullptr;
}
}
// pass params to GPU library
// change binsize default (0.0) to -1.0 used by GPU lib

Some files were not shown because too many files have changed in this diff Show More