Merge pull request #1945 from akohlmey/collected-small-changes

Collected small changes
This commit is contained in:
Axel Kohlmeyer 2020-03-19 05:31:22 -04:00 committed by GitHub
commit 245e200c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 335 additions and 217 deletions

View File

@ -51,42 +51,35 @@ check_for_autogen_files(${LAMMPS_SOURCE_DIR})
include(CheckCCompilerFlag)
include(CheckIncludeFileCXX)
# set required compiler flags and compiler/CPU arch specific optimizations
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
else()
set(CMAKE_TUNE_DEFAULT "-xHost")
endif()
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(NOT ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug"))
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -ftree-vectorize -fexpensive-optimizations")
endif()
set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native")
endif()
# we require C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# GNU compiler features
# GNU compiler specific features for testing
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
option(ENABLE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
mark_as_advanced(ENABLE_COVERAGE)
if(ENABLE_COVERAGE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()
option(ENABLE_SANITIZE_ADDRESS "Enable address sanitizer" OFF)
mark_as_advanced(ENABLE_SANITIZE_ADDRESS)
if(ENABLE_SANITIZE_ADDRESS)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
option(ENABLE_SANITIZE_UNDEFINED "Enable undefined behavior sanitizer" OFF)
mark_as_advanced(ENABLE_SANITIZE_UNDEFINED)
if(ENABLE_SANITIZE_UNDEFINED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
endif()
option(ENABLE_SANITIZE_THREAD "Enable thread sanitizer" OFF)
mark_as_advanced(ENABLE_SANITIZE_THREAD)
if(ENABLE_SANITIZE_THREAD)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
endif()
endif()
########################################################################
@ -347,6 +340,11 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(APPEND LAMMPS_LINK_LIBS -lwsock32 -lpsapi)
endif()
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific optimization or instrumentation")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_TUNE_FLAGS}")
if(CMAKE_Fortran_FLAGS)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_TUNE_FLAGS}")
endif()
########################################################################
# Basic system tests (standard libraries, headers, functions, types) #
########################################################################

View File

@ -74,11 +74,6 @@ if(PKG_USER-INTEL)
add_definitions(-DLMP_INTEL_OFFLOAD)
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
endif()
include(CheckCXXCompilerFlag)
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
check_cxx_compiler_flag("${__FLAG}" COMPILER_SUPPORTS${_FLAG})

View File

@ -13,5 +13,5 @@ set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_CXX "clang++" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "/usr/lib64/libomp.so" CACHE PATH "" FORCE)
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)

17
cmake/presets/intel.cmake Normal file
View File

@ -0,0 +1,17 @@
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-O3 -DNDEBG" CACHE STRING "" FORCE)
set(MPI_CXX "icpc" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "icc" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)

View File

@ -13,3 +13,5 @@ set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL
foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()
set(BUILD_TOOLS ON CACHE BOOL "" FORCE)

View File

@ -213,6 +213,14 @@ A few example command lines are:
For compiling with the Clang/LLVM compilers a special CMake preset is
included that can be loaded with `-C ../cmake/presets/clang.cmake`.
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add compiler
flags to tune for optimal performance on given hosts. By default these are
initialized to some compiler specific flags, where known, to optimize the
LAMMPS executable with optimizations and instructions available on the host
where LAMMPS is compiled. For example, for Intel compilers this would be
``-xHost`` and for GNU compilers this would be ``-march=native``. To turn
these flags off, set ``-D CMAKE_TUNE_FLAGS=``.
.. note::
When the cmake command completes, it prints a summary to the screen

View File

@ -22,28 +22,30 @@ Makefile(s). Example:
cd lammps # change to the LAMMPS distribution directory
mkdir build; cd build # create a new directory (folder) for build
cmake [options ...] ../cmake # configuration with (command-line) cmake
make # compilation
cmake --build . # compilation (or type "make")
The cmake command will detect available features, enable selected
The ``cmake`` command will detect available features, enable selected
packages and options, and will generate the build environment. By default
this build environment will be created for "Unix Makefiles" on most
platforms and particularly on Linux. However, alternate build tools
(e.g. Ninja) and project files for Integrated Development Environments
(IDEs) like Eclipse, CodeBlocks, or Kate can be generated, too. This is
selected via the "-G" command line flag. For the rest of the documentation
we will assume that the build environment is generated for makefiles
and thus the make command will be used to compile and link LAMMPS as
indicated above, producing (by default) an executable called "lmp" and
a library called "liblammps.a" in the "build" folder. When generating
a build environment for the "Ninja" build tool, the build command would
be "ninja" instead of "make".
selected via the ``-G`` command line flag. Further details about features
and settings for CMake are in the `CMake online documentation <cmake_doc>`_
If your machine has multiple CPU cores (most do these days), using a
command like "make -jN" (with N being the number of available local
CPU cores) can be much faster. If you plan to do development on
LAMMPS or need to re-compile LAMMPS repeatedly, installation of the
ccache (= Compiler Cache) software may speed up repeated compilation
even more.
.. _cmake_doc: https://cmake.org/documentation/
For the rest of the documentation
we will assume that the build environment is generated for "Unix Makefiles"
and thus the ``make`` command will be used to compile and link LAMMPS as
indicated above, producing (by default) an executable called ``lmp`` and
a library called ``liblammps.a`` in the ``build`` folder.
If your machine has multiple CPU cores (most do these days), you can
compile sources in parallel with a command like ``make -j N`` (with N
being the maximum number of concurrently executed tasks). Also
installation of the ``ccache`` (= Compiler Cache) software may speed
up repeated compilation, e.g. during code development, significantly.
After compilation, you may optionally install the LAMMPS executable into
your system with:
@ -60,9 +62,11 @@ to ${HOME}/.local
----------
.. _cmake_build:
There are 3 variants of the CMake command itself: a command-line version
(*cmake* or *cmake3*), a text mode UI version (*ccmake* or *ccmake3*),
and a graphical GUI version (*cmake-gui*). You can use any of them
(``cmake`` or ``cmake3``), a text mode UI version (``ccmake`` or ``ccmake3``),
and a graphical GUI version (``cmake-gui``). You can use any of them
interchangeably to configure and create the LAMMPS build environment.
On Linux all the versions produce a Makefile as their output by default.
See more details on each below.
@ -75,7 +79,7 @@ the :doc:`Build <Build>` doc page.
You must perform the CMake build system generation and compilation in
a new directory you create. It can be anywhere on your local machine.
In these Build pages we assume that you are building in a directory
called "lammps/build". You can perform separate builds independently
called ``lammps/build``. You can perform separate builds independently
with different options, so long as you perform each of them in a
separate directory you create. All the auxiliary files created by one
build process (executable, object files, log files, etc) are stored in
@ -84,10 +88,10 @@ this directory or sub-directories within it that CMake creates.
.. note::
To perform a CMake build, no packages can be installed or a build
been previously attempted in the LAMMPS src directory by using "make"
been previously attempted in the LAMMPS src directory by using ``make``
commands to :doc:`perform a conventional LAMMPS build <Build_make>`.
CMake detects if this is the case and generates an error, telling you
to type "make no-all purge" in the src directory to un-install all
to type ``make no-all purge`` in the src directory to un-install all
packages. The purge removes all the \*.h files auto-generated by
make.
@ -123,7 +127,7 @@ command-line options. Several useful ones are:
-D CMAKE_INSTALL_PREFIX=path # where to install LAMMPS executable/lib if desired
-D CMAKE_BUILD_TYPE=type # type = RelWithDebInfo (default), Release, MinSizeRel, or Debug
-G output # style of output CMake generates (e.g. "Unix Makefiles" or "Ninja")
-D CMAKE_MAKE_PROGRAM=builder # name of the builder executable (e.g. set to "gmake" instead of "make")
-D CMAKE_MAKE_PROGRAM=builder # name of the builder executable (e.g. when using "gmake" instead of "make")
-DVARIABLE=value # setting for a LAMMPS feature to enable
-D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir
-C path/to/preset/file # load some CMake settings before configuring
@ -137,7 +141,7 @@ these forms can be used: yes/no, on/off, 1/0.
On Unix/Linux machines, CMake generates a Makefile by default to
perform the LAMMPS build. Alternate forms of build info can be
generated via the -G switch, e.g. Visual Studio on a Windows machine,
Xcode on MacOS, or KDevelop on Linux. Type "cmake --help" to see the
Xcode on MacOS, or KDevelop on Linux. Type ``cmake --help`` to see the
"Generator" styles of output your system supports.
.. note::

View File

@ -32,20 +32,27 @@ Another way of doing this without reconfiguration is calling make with variable
Address, Undefined Behavior, and Thread Sanitizer Support
-------------------------------------------------------------------------
Compilers such as GCC and Clang support generating binaries which use different
sanitizers to detect problems in code during run-time. They can detect `memory leaks <https://clang.llvm.org/docs/AddressSanitizer.html>`_,
code that runs into `undefined behavior <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html>`_ of the
language and `data races <https://clang.llvm.org/docs/ThreadSanitizer.html>`_ in threaded code.
Compilers such as GCC and Clang support generating instrumented binaries
which use different sanitizer libraries to detect problems in code
during run-time. They can detect issues like:
The following settings allow you enable these features if your compiler supports
it. Please note that they come with a performance hit. However, they are
usually faster than using tools like Valgrind.
- `memory leaks <https://clang.llvm.org/docs/AddressSanitizer.html>`_
- `undefined behavior <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html>`_
- `data races <https://clang.llvm.org/docs/ThreadSanitizer.html>`_
Please note that this kind of instrumentation usually comes with a small
performance hit (much less than using tools like `Valgrind <valgrind_>`_).
The to enable these features additional compiler flags need to be added
to the compilation and linking stages. This is most easily done through
setting the ``CMAKE_TUNE_FLAGS`` variable during configuration. Examples:
.. code-block:: bash
-D ENABLE_SANITIZE_ADDRESS=value # enable Address Sanitizer, value = no (default) or yes
-D ENABLE_SANITIZE_UNDEFINED=value # enable Undefined Behavior Sanitizer, value = no (default) or yes
-D ENABLE_SANITIZE_THREAD=value # enable Thread Sanitizer, value = no (default) or yes
-D CMAKE_TUNE_FLAGS=-fsanitize=address # enable address sanitizer / memory leak checker
-D CMAKE_TUNE_FLAGS=-fsanitize=undefined # enable undefined behavior sanitizer
-D CMAKE_TUNE_FLAGS=-fsanitize=thread # enable thread sanitizer
.. _valgrind: https://valgrind.org
----------

View File

@ -146,13 +146,14 @@ one of them as a starting point and customize it to your needs.
.. code-block:: bash
cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
cmake -C ../cmake/presets/minimal.cmake [OPTIONS] ../cmake # enable just a few core packages
cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake # enable most common packages
cmake -C ../cmake/presets/most.cmake [OPTIONS] ../cmake # enable most packages
cmake -C ../cmake/presets/nolib.cmake [OPTIONS] ../cmake # disable packages that do require extra libraries or tools
cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default
cmake -C ../cmake/presets/mingw.cmake [OPTIONS] ../cmake # enable all packages compatible with MinGW compilers
cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake # change settings to use the Intel compilers by default
cmake -C ../cmake/presets/mingw.cmake [OPTIONS] ../cmake # enable packages compatible with MinGW compilers for Windows
cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
.. note::

View File

@ -40,33 +40,61 @@ own sub-directories with their own Makefiles and/or README files.
Pre-processing tools
====================
+-----------------------------+------------------------+----------------------+----------------------------------+----------------------------------+-----------------------------+
| :ref:`amber2lmp <amber>` | :ref:`ch2lmp <charmm>` | :ref:`chain <chain>` | :ref:`createatoms <createatoms>` | :ref:`drude <drude>` | :ref:`eam database <eamdb>` |
+-----------------------------+------------------------+----------------------+----------------------------------+----------------------------------+-----------------------------+
| :ref:`eam generate <eamgn>` | :ref:`eff <eff>` | :ref:`ipp <ipp>` | :ref:`micelle2d <micelle>` | :ref:`moltemplate <moltemplate>` | :ref:`msi2lmp <msi>` |
+-----------------------------+------------------------+----------------------+----------------------------------+----------------------------------+-----------------------------+
| :ref:`polybond <polybond>` | | | | | |
+-----------------------------+------------------------+----------------------+----------------------------------+----------------------------------+-----------------------------+
.. table_from_list::
:columns: 6
* :ref:`amber2lmp <amber>`
* :ref:`ch2lmp <charmm>`
* :ref:`chain <chain>`
* :ref:`createatoms <createatoms>`
* :ref:`drude <drude>`
* :ref:`eam database <eamdb>`
* :ref:`eam generate <eamgn>`
* :ref:`eff <eff>`
* :ref:`ipp <ipp>`
* :ref:`micelle2d <micelle>`
* :ref:`moltemplate <moltemplate>`
* :ref:`msi2lmp <msi>`
* :ref:`polybond <polybond>`
Post-processing tools
=====================
+--------------------------+----------------------------+------------------------+--------------------------+-------------------------------+-----------------------------+
| :ref:`amber2lmp <amber>` | :ref:`binary2txt <binary>` | :ref:`ch2lmp <charmm>` | :ref:`colvars <colvars>` | :ref:`eff <eff>` | :ref:`fep <fep>` |
+--------------------------+----------------------------+------------------------+--------------------------+-------------------------------+-----------------------------+
| :ref:`lmp2arc <arc>` | :ref:`lmp2cfg <cfg>` | :ref:`matlab <matlab>` | :ref:`phonon <phonon>` | :ref:`pymol_asphere <pymol>` | :ref:`python <pythontools>` |
+--------------------------+----------------------------+------------------------+--------------------------+-------------------------------+-----------------------------+
| :ref:`reax <reax_tool>` | :ref:`replica <replica>` | :ref:`smd <smd>` | :ref:`spin <spin>` | :ref:`xmgrace <xmgrace>` | |
+--------------------------+----------------------------+------------------------+--------------------------+-------------------------------+-----------------------------+
.. table_from_list::
:columns: 6
* :ref:`amber2lmp <amber>`
* :ref:`binary2txt <binary>`
* :ref:`ch2lmp <charmm>`
* :ref:`colvars <colvars>`
* :ref:`eff <eff>`
* :ref:`fep <fep>`
* :ref:`lmp2arc <arc>`
* :ref:`lmp2cfg <cfg>`
* :ref:`matlab <matlab>`
* :ref:`phonon <phonon>`
* :ref:`pymol_asphere <pymol>`
* :ref:`python <pythontools>`
* :ref:`reax <reax_tool>`
* :ref:`replica <replica>`
* :ref:`smd <smd>`
* :ref:`spin <spin>`
* :ref:`xmgrace <xmgrace>`
Miscellaneous tools
===================
+--------------------------+----------------------+-------------------+--------------------+---------------------------------------+
| :ref:`doxygen <doxygen>` | :ref:`emacs <emacs>` | :ref:`i-pi <ipi>` | :ref:`kate <kate>` | :ref:`singularity <singularity_tool>` |
+--------------------------+----------------------+-------------------+--------------------+---------------------------------------+
| :ref:`vim <vim>` | | | | |
+--------------------------+----------------------+-------------------+--------------------+---------------------------------------+
.. table_from_list::
:columns: 6
* :ref:`CMake <cmake>`
* :ref:`doxygen <doxygen>`
* :ref:`emacs <emacs>`
* :ref:`i-pi <ipi>`
* :ref:`kate <kate>`
* :ref:`singularity <singularity_tool>`
* :ref:`vim <vim>`
----------
@ -157,6 +185,30 @@ See the def.chain or def.chain.ab files in the tools directory for
examples of definition files. This tool was used to create the system
for the :doc:`chain benchmark <Speed_bench>`.
----------
.. _cmake:
CMake tools
-----------
The ``cmbuild`` script is a wrapper around using ``cmake --build <dir>
--target`` and allows compiling LAMMPS in a :ref:`CMake build folder
<cmake_build>` with a make-like syntax regardless of the actual build
tool and the specific name of the program used (e.g. ``ninja-v1.10`` or
``gmake``) when using ``-D CMAKE_MAKE_PROGRAM=<name>``.
.. parsed-literal::
Usage: cmbuild [-v] [-h] [-C <dir>] [-j <num>] [<target>]
Options:
-h print this message
-j <NUM> allow processing of NUM concurrent tasks
-C DIRECTORY execute build in folder DIRECTORY
-v produce verbose output
----------
.. _colvars:

View File

@ -12,10 +12,10 @@ Syntax
.. code-block:: LAMMPS
pair_style coul/slater/cut lamda cutoff
pair_style coul/slater/long lamda cutoff
pair_style coul/slater/cut lambda cutoff
pair_style coul/slater/long lambda cutoff
lamda = decay length of the charge (distance units)
lambda = decay length of the charge (distance units)
cutoff = cutoff (distance units)
Examples
@ -45,9 +45,8 @@ distribution in the Coulomb potential, following the formulation of
E = \frac{Cq_iq_j}{\epsilon r} \left( 1- \left( 1 + \frac{r_{ij}}{\lambda} exp\left( -2r_{ij}/\lambda \right) \right) \right) \qquad r < r_c
where :math:`r_c` is the cutoff distance and :math:`\lambda` is the decay length of the charge.
C is the same Coulomb conversion factor as in the pair\_styles coul/cut and coul/long. In this way the Coulomb
C is the same Coulomb conversion factor as in the pair_styles coul/cut and coul/long. In this way the Coulomb
interaction between ions is corrected at small distances r.
For the *coul/slater/cut* style, the potential energy for distances larger than the cutoff is zero,
while for the *coul/slater/long*, the long-range interactions are computed either by the Ewald or the PPPM technique.
@ -66,17 +65,15 @@ commands:
* :math:`r_c` (distance units)
The global decay length of the charge (:math:`\lambda`) specified in the pair\_style command is used for all pairs.
The global decay length of the charge (:math:`\lambda`) specified in the pair_style command is used for all pairs.
----------
**Mixing, shift, table, tail correction, restart, rRESPA info**\ :
For atom type pairs I,J and I != J, the cutoff distance for the
*coul/slater* styles can be mixed. The default mix value is *geometric*\ .
See the "pair\_modify" command for details.
See the "pair_modify" command for details.
The :doc:`pair_modify <pair_modify>` shift and table options are not relevant
for these pair styles.
@ -85,7 +82,7 @@ These pair styles do not support the :doc:`pair_modify <pair_modify>`
tail option for adding long-range tail corrections to energy and
pressure.
These pair styles write their information to :doc:`binary restart files <restart>`, so pair\_style and pair\_coeff commands do not need
These pair styles write their information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands do not need
to be specified in an input script that reads a restart file.
This pair style can only be used via the *pair* keyword of the
@ -109,13 +106,11 @@ Related commands
----------
.. _Melchor:
**(Melchor)** Gonzalez-Melchor, Mayoral, Velázquez, and Alejandre, J Chem Phys, 125, 224107 (2006).
**(Melchor)** Gonzalez-Melchor, Mayoral, Velazquez, and Alejandre, J Chem Phys, 125, 224107 (2006).
.. _Vaiwala:
**(Vaiwala)** Vaiwala, Jadhav, and Thaokar, J Chem Phys, 146, 124904 (2017).

View File

@ -770,7 +770,7 @@ in contact. J. Appl. Mech., ASME 16, 259-268.
.. _Thornton2013:
**(Thornton et al, 2013)** Thornton, C., Cummins, S. J., & Cleary,
P. W. (2013). An investigation of the comparative behaviour of
P. W. (2013). An investigation of the comparative behavior of
alternative contact force models during inelastic collisions. Powder
Technology, 233, 30-46.

View File

@ -1,5 +1,4 @@
<div role="navigation" aria-label="breadcrumbs navigation">
<div style="text-align: center; margin-bottom: -1.5em; display: block"><b>LAMMPS</b> {{ version }}</div>
<ul class="wy-breadcrumbs">
<li><a href="{{ pathto(master_doc) }}">Docs</a> &raquo;</li>
{% for doc in parents %}
@ -22,7 +21,7 @@
{% endif %}
</li>
</ul>
<hr/>
<hr style="margin-top: 6px; margin-bottom: 6px;" width="100%"/>
{% if next or prev %}
<div class="rst-footer-buttons" style="margin-bottom: 1em" role="navigation" aria-label="footer navigation">
{% if next %}

View File

@ -10,7 +10,7 @@
</div>
{% endif %}
<hr/>
<hr style="margin-top: 6px; margin-bottom: 6px;" width="100%"/>
<div role="contentinfo">
<p>

View File

@ -100,6 +100,8 @@
{% endif %}
</a>
<div class="lammps_version">Version: <b>{{ version }}</b></div>
{% include "searchbox.html" %}
{% endblock %}

View File

@ -4189,8 +4189,7 @@ div[class^='highlight'] pre {
}
}
.wy-affix {
position: fixed;
top: 1.618em;
position: fixed; top: 0.618em;
}
.wy-menu a:hover {
@ -4411,7 +4410,7 @@ div[class^='highlight'] pre {
font-weight: bold;
display: inline-block;
padding: 4px 6px;
margin-bottom: 0.809em;
/*margin-bottom: 0.809em;*/
}
.wy-side-nav-search > a:hover, .wy-side-nav-search .wy-dropdown > a:hover {
background: rgba(255, 255, 255, 0.1);
@ -4540,7 +4539,7 @@ div[class^='highlight'] pre {
}
.wy-nav-content {
padding: 1.618em 3.236em;
padding: 0.5em 1.0em;
height: 100%;
margin: auto;
}
@ -5105,4 +5104,10 @@ span[id*='MathJax-Span'] {
padding: 0;
}
.lammps_version {
text-align: center;
display: block;
margin-bottom: 0.809em;
}
/*# sourceMappingURL=theme.css.map */

View File

@ -202,7 +202,6 @@ bcolor
bdiam
bdw
Beckman
behaviour
Belak
Bellott
benchmarking
@ -2559,8 +2558,7 @@ Salles
sandia
Sandia
sandybrown
Sanitizer
sanitizers
sanitizer
Sanyal
sc
scafacos

View File

@ -1659,7 +1659,7 @@ int PPPMDisp::check_convergence(double** A,double** Q,double** A0,
allocate memory that depends on # of K-vectors and order
------------------------------------------------------------------------- */
void PPPMDisp::allocate()
void _noopt PPPMDisp::allocate()
{
int (*procneigh)[2] = comm->procneigh;

View File

@ -5017,7 +5017,7 @@ double PairBOP::PiBo(int itmp, int jtmp)
/* ---------------------------------------------------------------------- */
void PairBOP::read_table(char *filename)
void _noopt PairBOP::read_table(char *filename)
{
int i,j,k,n,m;
int buf1,pass;

View File

@ -214,7 +214,7 @@ protected:
void alloyparams();
void compute_pair_meam();
double phi_meam(double, int, int);
const double phi_meam_series(const double scrn, const int Z1, const int Z2, const int a, const int b, const double r, const double arat);
double phi_meam_series(const double scrn, const int Z1, const int Z2, const int a, const int b, const double r, const double arat);
void compute_reference_density();
void get_tavref(double*, double*, double*, double*, double*, double*, double, double, double, double,
double, double, double, int, int, lattice_t);

View File

@ -163,11 +163,10 @@ MEAM::alloyparams(void)
void
MEAM::compute_pair_meam(void)
{
double r, b2nn, phi_val;
double r;
int j, a, b, nv2;
double astar, frac, phizbl;
int n, Z1, Z2;
int Z1, Z2;
double arat, rarat, scrn, scrn2;
double phiaa, phibb /*unused:,phitmp*/;
double C, s111, s112, s221, S11, S22;
@ -320,7 +319,7 @@ MEAM::phi_meam(double r, int a, int b)
double Eu;
double arat, scrn, scrn2;
int Z12, errorflag;
int n, Z1nn, Z2nn;
int Z1nn, Z2nn;
lattice_t latta /*unused:,lattb*/;
double rho_bkgd1, rho_bkgd2;
double b11s, b22s;
@ -519,7 +518,7 @@ MEAM::phi_meam(double r, int a, int b)
// To avoid nan values of phir due to rapid decrease of b2nn^n or/and
// argument of phi_meam, i.e. r*arat^n, in some cases (3NN dia with low Cmin value)
//
const double
double
MEAM::phi_meam_series(const double scrn, const int Z1, const int Z2, const int a, const int b, const double r, const double arat)
{
double phi_sum = 0.0;

View File

@ -973,16 +973,23 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
error->all(FLERR,"Incorrect atom format in data file");
}
if (imageflag)
imagedata = ((imageint) (atoi(values[iptr]) + IMGMAX) & IMGMASK) |
(((imageint) (atoi(values[iptr+1]) + IMGMAX) & IMGMASK) << IMGBITS) |
(((imageint) (atoi(values[iptr+2]) + IMGMAX) & IMGMASK) << IMG2BITS);
else imagedata = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
int imx = 0;
int imy = 0;
int imz = 0;
if (imageflag) {
imx = utils::inumeric(FLERR,values[iptr],false,lmp);
imy = utils::inumeric(FLERR,values[iptr+1],false,lmp);
imz = utils::inumeric(FLERR,values[iptr+2],false,lmp);
if ((domain->dimension == 2) && (imz != 0))
error->all(FLERR,"Z-direction image flag must be 0 for 2d-systems");
}
imagedata = ((imageint) (imx + IMGMAX) & IMGMASK) |
(((imageint) (imy + IMGMAX) & IMGMASK) << IMGBITS) |
(((imageint) (imz + IMGMAX) & IMGMASK) << IMG2BITS);
xdata[0] = atof(values[xptr]);
xdata[1] = atof(values[xptr+1]);
xdata[2] = atof(values[xptr+2]);
xdata[0] = utils::numeric(FLERR,values[xptr],false,lmp);
xdata[1] = utils::numeric(FLERR,values[xptr+1],false,lmp);
xdata[2] = utils::numeric(FLERR,values[xptr+2],false,lmp);
if (shiftflag) {
xdata[0] += shift[0];
xdata[1] += shift[1];

View File

@ -40,8 +40,8 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), numdiff_forces(NULL), temp_f(NULL),
id_pe(NULL)
Fix(lmp, narg, arg), id_pe(NULL), numdiff_forces(NULL),
temp_x(NULL), temp_f(NULL)
{
if (narg < 5) error->all(FLERR,"Illegal fix numdiff command");
@ -68,9 +68,6 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
delete [] newarg;
maxatom = 0;
numdiff_forces = NULL;
temp_x = NULL;
temp_f = NULL;
if (atom->map_style == 0)
error->all(FLERR,"Fix numdiff requires an atom map, see atom_modify");
@ -156,7 +153,7 @@ void FixNumDiff::min_setup(int vflag)
/* ---------------------------------------------------------------------- */
void FixNumDiff::post_force(int vflag)
void FixNumDiff::post_force(int /* vflag */)
{
if (update->ntimestep % nevery) return;

View File

@ -45,8 +45,8 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) :
improper_type(NULL), improper_atom1(NULL), improper_atom2(NULL),
improper_atom3(NULL), improper_atom4(NULL), nspecial(NULL), special(NULL),
shake_flag(NULL), shake_atom(NULL), shake_type(NULL), avec_body(NULL), ibodyparams(NULL),
dbodyparams(NULL), dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL),
fp(NULL), count(NULL), fragmentmask(NULL)
dbodyparams(NULL), fragmentmask(NULL), fragmentnames(NULL),
dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL), fp(NULL), count(NULL)
{
me = comm->me;
@ -1569,10 +1569,12 @@ void Molecule::allocate()
if (xflag) memory->create(x,natoms,3,"molecule:x");
if (typeflag) memory->create(type,natoms,"molecule:type");
if (moleculeflag) memory->create(molecule,natoms,"molecule:molecule");
if (fragmentflag) fragmentnames = new char*[nfragments];
if (fragmentflag) memory->create(fragmentmask,nfragments,natoms,"molecule:fragmentmask");
if (fragmentflag) {
fragmentnames = new char*[nfragments];
memory->create(fragmentmask,nfragments,natoms,"molecule:fragmentmask");
for (int i = 0; i < nfragments; i++)
for (int j = 0; j < natoms; j++) fragmentmask[i][j] = 0;
}
if (qflag) memory->create(q,natoms,"molecule:q");
if (radiusflag) memory->create(radius,natoms,"molecule:radius");
if (rmassflag) memory->create(rmass,natoms,"molecule:rmass");
@ -1665,6 +1667,7 @@ void Molecule::deallocate()
memory->destroy(radius);
memory->destroy(rmass);
memory->destroy(molecule);
memory->destroy(fragmentmask);
if (fragmentflag) {
for (int i = 0; i < nfragments; i++) delete [] fragmentnames[i];

View File

@ -34,10 +34,6 @@ class Molecule : protected Pointers {
int nbondtypes,nangletypes,ndihedraltypes,nimpropertypes;
int nibody,ndbody;
// fragment info
char **fragmentnames;
int **fragmentmask; // nfragments by natoms
// max bond,angle,etc per atom
int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom;
@ -95,6 +91,11 @@ class Molecule : protected Pointers {
int *ibodyparams; // integer and double body params
double *dbodyparams;
// fragment info
int **fragmentmask; // nfragments by natoms
char **fragmentnames;
double center[3]; // geometric center of molecule
double masstotal; // total mass of molecule
double com[3]; // center of mass of molecule

View File

@ -84,29 +84,6 @@ bool utils::strmatch(std::string text, std::string pattern)
return (pos >= 0);
}
/* utility function to avoid code repetition when parsing args */
int utils::cfvarg(std::string mode, const char *arg, char *&cfv_id)
{
int rv = utils::NONE;
cfv_id = NULL;
if (!arg) return rv;
if (utils::strmatch(arg,std::string("^[") + mode + "]_")) {
if (*arg == 'c') rv = utils::COMPUTE;
else if (*arg == 'f') rv = utils::FIX;
else if (*arg == 'v') rv = utils::VARIABLE;
else return rv; // should not happen
arg += 2;
int n = strlen(arg)+1;
cfv_id = new char[n];
strcpy(cfv_id,arg);
}
return rv;
}
/** \brief try to detect pathname from FILE pointer. Currently only supported on Linux, otherwise will report "(unknown)".
*
* \param buf storage buffer for pathname. output will be truncated if not large enough

View File

@ -36,25 +36,6 @@ namespace LAMMPS_NS {
*/
bool strmatch(std::string text, std::string pattern);
/** Categories of special arguments for cfvarg() function
*
* Enum starts from 100 to avoid conflicts with other local define flags
*/
enum {NONE=100, /// does not match any category
COMPUTE, /// processed a compute
FIX, /// processed a fix
VARIABLE /// processed a variable
};
/** \brief Convenience function to process 'c_', 'f_', and 'v_' arguments
*
* \param mode types to search for. 1-3 char string from 'c', 'f', or 'v'
* \param arg argument string to test against the prefixes
* \param cfv_id name or ID of the compute, fix, or variable
* \return utils::COMPUTE, utils::FIX, utils::VARIABLE or utils::NONE
*/
int cfvarg(std::string mode, const char *arg, char *&cfv_id);
/** \brief safe wrapper around fgets() which aborts on errors
* or EOF and prints a suitable error message to help debugging
*

View File

@ -16,6 +16,7 @@ amber2lmp python scripts for using AMBER to setup LAMMPS input
binary2txt convert a LAMMPS dump file from binary to ASCII text
ch2lmp convert CHARMM files to LAMMPS input
chain create a data file of bead-spring chains
cmake tools and scripts for use with CMake
colvars post-process output of the fix colvars command
createatoms generate lattices of atoms within a geometry
drude create Drude core/electron atom pairs in a data file

69
tools/cmake/cmbuild Executable file
View File

@ -0,0 +1,69 @@
#!/bin/bash
# make like wrapper around "cmake --build"
# (c) 2020 Axel Kohlmeyer <akohlmey@temple.edu>
# This file is in the public domain
WORKDIR="${PWD}"
PARAMS=""
MYARGS=""
usage()
{
echo "Usage: cmbuild [-v] [-h] [-C <dir>] [-j <num>] [<target>]" >&2
}
help()
{
usage
cat >&2 <<EOF
Options:
-h print this message
-j <NUM> allow processing of NUM concurrent tasks
-C DIRECTORY execute build in folder DIRECTORY
-v produce verbose output
EOF
}
while (( "$#" )); do
case "$1" in
-C)
WORKDIR="$2"
shift 2
;;
-v)
MYARGS="${MYARGS} -v"
shift
;;
-h)
help
exit 2
;;
-j)
MYARGS="${MYARGS} -j $2"
shift 2
;;
--)
shift
break
;;
-*)
echo "Error: Unsupported flag $1" >&2
echo
usage
exit 1
;;
*)
PARAMS="${PARAMS} $1"
shift
;;
esac
done
if [ ! -f "${WORKDIR}/CMakeCache.txt" ] ; then
echo "Must execute in a CMake build directory or use -C flag to select one" >&2
exit 3
fi
eval set -- "${PARAMS} $@"
exec cmake --build "${WORKDIR}" ${MYARGS} --target "$@"

View File

@ -5,7 +5,7 @@ From: centos:8
dnf -y install epel-release dnf-utils
dnf config-manager --set-enabled PowerTools
dnf -y update
dnf -y install vim-enhanced ccache gcc-c++ gcc-gfortran clang gdb make cmake patch which file git libpng-devel libjpeg-devel openmpi-devel mpich-devel fftw-devel voro++-devel gsl-devel enchant platform-python-devel python3-virtualenv valgrind openblas ninja-build eigen3-devel
dnf -y install vim-enhanced ccache gcc-c++ gcc-gfortran clang gdb make cmake patch which file git libpng-devel libjpeg-devel openmpi-devel mpich-devel fftw-devel voro++-devel gsl-devel enchant platform-python-devel python3-virtualenv valgrind openblas ninja-build eigen3-devel libubsan libasan libtsan
#No match for argument: valgrind-openmpi