Merge pull request #34 from lammps/master

rebase
This commit is contained in:
Jacob Gissinger 2018-11-16 20:29:46 -07:00 committed by GitHub
commit 177a5ddb7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 714 additions and 383 deletions

1
.github/CODEOWNERS vendored
View File

@ -29,6 +29,7 @@ src/USER-MEAMC/* @martok
src/USER-MOFFF/* @hheenen
src/USER-MOLFILE/* @akohlmey
src/USER-NETCDF/* @pastewka
src/USER-PLUMED/* @gtribello
src/USER-PHONON/* @lingtikong
src/USER-PTM/* @pmla
src/USER-OMP/* @akohlmey

View File

@ -304,7 +304,7 @@ pkg_depends(USER-SCAFACOS MPI)
find_package(OpenMP QUIET)
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
if(BUILD_OMP OR PKG_USER-OMP OR PKG_KOKKOS OR PKG_USER-INTEL)
if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL)
find_package(OpenMP REQUIRED)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
@ -349,7 +349,7 @@ if(PKG_KSPACE)
endif()
endif()
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE OR PKG_USER-PLUMED)
find_package(LAPACK)
find_package(BLAS)
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND)
@ -531,6 +531,12 @@ endif()
if(PKG_USER-PLUMED)
find_package(GSL REQUIRED)
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
set(PLUMED_MODE_VALUES static shared runtime)
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
option(DOWNLOAD_PLUMED "Download Plumed (instead of using the system's one)" OFF)
if(DOWNLOAD_PLUMED)
include(ExternalProject)
@ -543,13 +549,29 @@ if(PKG_USER-PLUMED)
ExternalProject_get_property(plumed_build INSTALL_DIR)
set(PLUMED_INSTALL_DIR ${INSTALL_DIR})
list(APPEND LAMMPS_DEPS plumed_build)
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/plumed/obj/kernel.o
${PLUMED_INSTALL_DIR}/lib/plumed/obj/PlumedStatic.o ${GSL_LIBRARIES} ${CMAKE_DL_LIBS})
if(PLUMED_MODE STREQUAL "STATIC")
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/plumed/obj/kernel.o
"${PLUMED_INSTALL_DIR}/lib/plumed/obj/PlumedStatic.o" ${GSL_LIBRARIES} ${CMAKE_DL_LIBS} ${LAPACK_LIBRARIES})
elseif(PLUMED_MODE STREQUAL "SHARED")
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${CMAKE_DL_LIBS})
elseif(PLUMED_MODE STREQUAL "RUNTIME")
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so)
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS})
endif()
set(PLUMED_INCLUDE_DIRS "${PLUMED_INSTALL_DIR}/include")
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(PLUMED plumed REQUIRED)
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
if(PLUMED_MODE STREQUAL "STATIC")
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
elseif(PLUMED_MODE STREQUAL "SHARED")
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
elseif(PLUMED_MODE STREQUAL "RUNTIME")
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel.so)
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
endif()
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_LOAD})
endif()
include_directories(${PLUMED_INCLUDE_DIRS})
@ -797,7 +819,7 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD
if(PKG_LIB STREQUAL awpmd)
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
elseif(PKG_LIB STREQUAL h5md)
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include)
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS})
elseif(PKG_LIB STREQUAL colvars)
target_compile_options(colvars PRIVATE -DLEPTON)
target_include_directories(colvars PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include)
@ -820,6 +842,7 @@ if(PKG_USER-H5MD)
find_package(HDF5 REQUIRED)
target_link_libraries(h5md ${HDF5_LIBRARIES})
target_include_directories(h5md PRIVATE ${HDF5_INCLUDE_DIRS})
include_directories(${HDF5_INCLUDE_DIRS})
endif()

View File

@ -1492,6 +1492,11 @@ target API.
</dl>
</td>
</tr>
<tr>
<td><code>BIN2C</code> (CUDA only)</td>
<td>Path to bin2c executable, will automatically pick up the first one in your $PATH.</td>
<td>(automatic)</td>
</tr>
</tbody>
</table>
@ -1647,9 +1652,8 @@ requires `gzip` to be in your `PATH`
</tr>
<tr>
<td><code>GZIP_EXECUTABLE</code></td>
<td></td>
<td>
</td>
<td>Path to gzip executable, will automatically pick up the first one in your $PATH.</td>
<td>(automatic)</td>
</tr>
</tbody>
</table>
@ -1679,9 +1683,8 @@ requires `ffmpeg` to be in your `PATH`
</tr>
<tr>
<td><code>FFMPEG_EXECUTABLE</code></td>
<td></td>
<td>
</td>
<td>Path to ffmpeg executable, will automatically pick up the first one in your $PATH.</td>
<td>(automatic)</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,187 @@
# Outline of the GitHub Development Workflow
This purpose of this document is to provide a point of reference for the
core LAMMPS developers and other LAMMPS contributors to understand the
choices the LAMMPS developers have agreed on. Git and GitHub provide the
tools, but do not set policies, so it is up to the developers to come to
an agreement as to how to define and interpret policies. This document
is likely to change as our experiences and needs change and we try to
adapt accordingly. Last change 2018-11-15.
## Table of Contents
* [GitHub Merge Management](#github-merge-management)
* [Pull Requests](#pull-requests)
* [Pull Request Assignments](#pull-request-assignments)
* [Pull Request Reviews](#pull-request-reviews)
* [Pull Request Discussions](#pull-request-discussions)
* [Checklist for Pull Requests](#checklist-for-pull-requests)
* [GitHub Issues](#github-issues)
* [Milestones and Release Planning](#milestones-and-release-planning)
## GitHub Merge Management
In the interest of consistency, ONLY ONE of the core LAMMPS developers
should doing the merging itself. This is currently
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer).
If this assignment needs to be changed, it shall be done right after a
stable release. If the currently assigned developer cannot merge outstanding pull
requests in a timely manner, or in other extenuating circumstances,
other core LAMMPS developers with merge rights can merge pull requests,
when necessary.
## Pull Requests
ALL changes to the LAMMPS code and documentation, however trivial, MUST
be submitted as a pull request to GitHub. All changes to the "master"
branch must be made exclusively through merging pull requests. The
"unstable" and "stable" branches, respectively are only to be updated
upon patch or stable releases with fast-forward merges based on the
associated tags. Pull requests may also be submitted to (long-running)
feature branches created by LAMMPS developers inside the LAMMPS project,
if needed. Those are not subject to the merge and review restrictions
discussed in this document, though, but get managed as needed on a
case-by-case basis.
### Pull Request Assignments
Pull requests can be "chaperoned" by one of the LAMMPS core developers.
This is indicated by who the pull request is assigned to. LAMMPS core
developers can self-assign or they can decide to assign a pull request
to a different LAMMPS developer. Being assigned to a pull request means,
that this pull request may need some work and the assignee is tasked to
determine what this might be needed or not, and may either implement the
required changes or ask the submitter of the pull request to implement
them. Even though, all LAMMPS developers may have write access to pull
requests (if enabled by the submitter, which is the default), only the
submitter or the assignee of a pull request may do so. During this
period the "work_in_progress" label shall be applied to the pull
request. The assignee gets to decide what happens to the pull request
next, e.g. whether it should be assigned to a different developer for
additional checks and changes, or is recommended to be merged. Removing
the "work_in_progress" label and assigning the pull request to the
developer tasked with merging signals that a pull request is ready to be
merged.
### Pull Request Reviews
People can be assigned to review a pull request in two ways:
* They can be assigned manually to review a pull request
by the submitter or a LAMMPS developer
* They can be automatically assigned, because a developers matches
a file pattern in the `.github/CODEOWNERS` file, which associates
developers with the code they contributed and maintain.
Reviewers are requested to state their appraisal of the proposed changes
and either approve or request changes. People may unassign themselves
from review, if they feel not competent about the changes proposed. At
least one review from a LAMMPS developer with write access is required
before merging in addition to the automated compilation tests. The
feature, that reviews from code owners are "hard" reviews (i.e. they
must all be approved before merging is allowed), is currently disabled
and it is in the discretion of the merge maintainer to assess when
a sufficient degree of approval has been reached. Reviews may be
(automatically) dismissed, when the reviewed code has been changed,
and then approval is required a second time.
### Pull Request Discussions
All discussions about a pull request should be kept as much as possible
on the pull request discussion page on GitHub, so that other developers
can later review the entire discussion after the fact and understand the
rationale behind choices made. Exceptions to this policy are technical
discussions, that are centered on tools or policies themselves
(git, github, c++) rather than on the content of the pull request.
### Checklist for Pull Requests
Here are some items to check:
* source and text files should not have CR/LF line endings (use dos2unix to remove)
* every new command or style should have documentation. The names of
source files (c++ and manual) should follow the name of the style.
(example: `src/fix_nve.cpp`, `src/fix_nve.h` for `fix nve` command,
implementing the class `FixNVE`, documented in `doc/src/fix_nve.txt`)
* all new style names should be lower case, the must be no dashes,
blanks, or underscores separating words, only forward slashes.
* new style docs should be added to the "overview" files in
`doc/src/Commands_*.txt`, `doc/src/{fixes,computes,pairs,bonds,...}.txt`
and `doc/src/lammps.book`
* new files in packages should be added to `src/.gitignore`
* removed or renamed files in packages should be added to `src/Purge.list`
* C++ source files should use C++ style include files for accessing
C-library APIs, e.g. `#include <cstdlib>` instead of `#include <stdlib.h>`.
And they should use angular brackets instead of double quotes. Full list:
* assert.h -> cassert
* ctype.h -> cctype
* errno.h -> cerrno
* float.h -> cfloat
* limits.h -> climits
* math.h -> cmath
* omplex.h -> complex
* setjmp.h -> csetjmp
* signal.h -> csignal
* stddef.h -> cstddef
* stdint.h -> cstdint
* stdio.h -> cstdio
* stdlib.h -> cstdlib
* string.h -> cstring
* time.h -> ctime
Do not replace (as they are C++-11): `inttypes.h` and `stdint.h`.
* Code should follow the C++-98 standard. C++-11 is only accepted
in individual special purpose packages
* indentation is two spaces per level
* there should be no tabs and no trailing whitespace
* header files, especially of new styles, should not include any
other headers, except the header with the base class or cstdio.
Forward declarations should be used instead when possible.
* iostreams should be avoided. LAMMPS uses stdio from the C-library.
* use of STL in headers and class definitions should be avoided.
* static class members should be avoided at all cost.
* anything storing atom IDs should be using `tagint` and not `int`.
This can be flagged by the compiler only for pointers and only when
compiling LAMMPS with `-DLAMMPS_BIGBIG`.
* when including both `lmptype.h` (and using defines or macros from it)
and `mpi.h`, `lmptype.h` must be included first.
## GitHub Issues
The GitHub issue tracker is the location where the LAMMPS developers
and other contributors or LAMMPS users can report issues or bugs with
the LAMMPS code or request new features to be added. Feature requests
are usually indicated by a `[Feature Request]` marker in the subject.
Issues are assigned to a person, if this person is working on this
feature or working to resolve an issue. Issues that have nobody working
on them at the moment, have the label `volunteer needed` attached.
When an issue, say `#125` is resolved by a specific pull request,
the comment for the pull request shall contain the text `closes #125`
or `fixes #125`, so that the issue is automatically deleted when
the pull request is merged.
## Milestones and Release Planning
LAMMPS uses a continuous release development model with incremental
changes, i.e. significant effort is made - including automated pre-merge
testing - that the code in the branch "master" does not get broken.
More extensive testing (including regression testing) is performed after
code is merged to the "master" branch. There are patch releases of
LAMMPS every 1-3 weeks at a point, when the LAMMPS developers feel, that
a sufficient amount of changes have happened, and the post-merge testing
has been successful. These patch releases are marked with a
`patch_<version date>` tag and the "unstable" branch follows only these
versions (and thus is always supposed to be of production quality,
unlike "master", which may be temporary broken, in the case of larger
change sets or unexpected incompatibilities or side effects.
About 3-4 times each year, there are going to be "stable" releases
of LAMMPS. These have seen additional, manual testing and review of
results from testing with instrumented code and static code analysis.
Also, in the last 2-3 patch releases before a stable release are
"release candidate" versions which only contain bugfixes and
documentation updates. For release planning and the information of
code contributors, issues and pull requests being actively worked on
are assigned a "milestone", which corresponds to the next stable
release or the stable release after that, with a tentative release
date.

View File

@ -41,11 +41,11 @@ This is the list of packages that may require additional steps.
"USER-ATC"_#user-atc,
"USER-AWPMD"_#user-awpmd,
"USER-COLVARS"_#user-colvars,
"USER-PLUMED" _#user-plumed,
"USER-H5MD"_#user-h5md,
"USER-INTEL"_#user-intel,
"USER-MOLFILE"_#user-molfile,
"USER-NETCDF"_#user-netcdf,
"USER-PLUMED"_#user-plumed,
"USER-OMP"_#user-omp,
"USER-QMMM"_#user-qmmm,
"USER-QUIP"_#user-quip,
@ -715,57 +715,98 @@ a corresponding Makefile.lammps.machine file.
USER-PLUMED package :h4,link(user-plumed)
Before building LAMMPS with this package, you must first build PLUMED.
PLUMED can be built as part of the LAMMPS build or installed separately
from LAMMPS using the generic "plumed installation instructions"_plumedinstall.
:link(plumedinstall,http://plumed.github.io/doc-master/user-doc/html/_installation.html)
PLUMED can be linked into MD codes in three different modes: static,
shared, and runtime. With the "static" mode, all required PLUMED code
is linked statically into the MD code. The MD code is then fully
independent from the PLUMED installation, but also you have to
rebuild/relink the MD code to update the PLUMED code inside it. With
"shared" linkage mode, the MD code is linked to a shared library
containing the PLUMED code, preferably after it was installed in a
globally accessible location. This way the same installed PLUMED code
can be shared across multiple MD packages and can be updated, for as
long as the shared PLUMED library is ABI-compatible. The third linkage
mode is "runtime" which allows to switch the PLUMED kernel at runtime
between different variants through setting the PLUMED_KERNEL environment
varible, which has to point to the location of the libplumedKernel.so
dynamical shared object, which is then loaded at runtime. This is
particularly convenient for doing PLUMED development and comparing
multiple PLUMED versions without having to recompile the hosting MD
code. All three linkage modes are supported by LAMMPS on selected
operating systems (e.g. Linux) and using either CMake or traditional
make build. The "static" mode should be most portable, the "runtime"
mode support in LAMMPS makes the most assumptions about operating
system and compiler environment. If one mode does not work, try a
different one, or switch to a different build system, or consider
a global PLUMED installation or downloading it during building LAMMPS.
[CMake build]:
-D DOWNLOAD_PLUMED=value # download PLUMED for build, value = no (default) or yes
-D PLUMED_MODE=value # Linkage mode for PLUMED, value = static (default), shared, or runtime :pre
If DOWNLOAD_PLUMED is set to "yes", the PLUMED library will be
downloaded (the version of that is hardcoded to a vetted version of
PLUMED, usually a recent stable release version) and built inside the
CMake build directory. If DOWNLOAD_PLUMED is set to "no" (the default),
CMake will try to detect an installed version of PLUMED and link to
that. For this to work, the PLUMED library has to be installed into a
location where the pkg-config tool can find it or the PKG_CONFIG_PATH
environment variable has to be set up accordingly.
The PLUMED_MODE setting determines the linkage mode of the PLUMED
library. Allowed values are "static" (default), "shared", or "runtime".
For a discussion of PLUMED linkage modes, please see above. When
enabling DOWNLOAD_PLUMED, the static linkage mode is recommended.
[Traditional make]:
Before building LAMMPS with this package, you must first build
PLUMED. We recommending building PLUMED separately to LAMMPS using
the instructions that can be found at http://plumed.github.io/doc-master/user-doc/html/_installation.html.
Before compiling LAMMPS you can then install the fix plumed command
and compile LAMMPS in the usual manner:
Before installing the USER-PLUMED package, first the PLUMED library
needs to be configured so that LAMMPS can find the right settings when
compiling and linking the LAMMPS executable itself. You can either
download and build PLUMED inside the LAMMPS plumed library folder or use
a previously installed PLUMED library and point LAMMPS to its
location. You also have to choose the linkage mode: "static" (default),
"shared" or "runtime". For a discussion of PLUMED linkage modes, please
see above.
Download/compilation/configuration of the plumed library can be done
from the src folder through the following make args:
make lib-plumed # print help message
make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2
make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local
make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in
# /usr/local and use shared linkage mode
:pre
Note that 2 symbolic (soft) links, "includelink" and "liblink" are
created in lib/plumed to point into the location of the PLUMED build to
use and also a new file lib/plumed/Makefile.lammps is created with
settings suitable for LAMMPS to compile and link PLUMED in the desired
linkage mode. After this step is compleded, you can install the
USER-PLUMED package and compile LAMMPS in the usual manner:
make yes-user-plumed
make machine :pre
Once this compilation completes you should be able to run LAMMPS in the usual
way. When running LAMMPS with an input script that contains a fix
plumed command LAMMPS will try to call the PLUMED runtime library. PLUMED
must therefore be available in your path if LAMMPS is compiled in this way.
Once this compilation completes you should be able to run LAMMPS in the
usual way. For shared linkage mode, libplumed.so must be found by the
LAMMPS executable, which on many operating systems means, you have to
set the LD_LIBRARY_PATH environment variable accordingly.
On some machines it is not possible to call runtime libraries in the way described
above. When compiling on these machines it is thus better to statically link
PLUMED when compiling LAMMPS. To do this you must either download a PLUMED
tarball from http://www.plumed.org/get-it or clone it using
git clone https://github.com/plumed/plumed2.git. If you download the tarball
unpack it in the /lib/plumed directory. Similarly if you clone
it clone it to the /lib/plumed directory as if there is a version of PLUMED within
this directory LAMMPS will always try to statically link the version of PLUMED
that this directory contains instead of dynamically linking the library.
Support for the different linkage modes in LAMMPS varies for different
operating systems, using the static linkage is expected to be the most
portable, and thus set to be the default.
Once you have downloaded PLUMED into /lib/plumed you must again build the code
here by following the instructions that can be found at
http://plumed.github.io/doc-master/user-doc/html/_installation.html.
You can statically link PLUMED manually and if you want to access the full
range of PLUMED functionalities this is what you should do. If you only want the
basic range of functionalities, however, (i.e. no user contributed modules) then
you can download and compile PLUMED in one step from the lammps/src dir, using a
command like like those below:
make lib-plumed # print help message
make lib-plumed args="-b" # download and build the latest stable version of PLUMED
These commands will simply invoke the lib/plumed/Install.py script with
args specified. Furthermore, once the script has completed you should
have a compiled version of PLUMED. With this built you can install/un-install
PLUMED and build LAMMPS in the usual manner:
make yes-user-plumed
make machine :pre
make no-user-plumed
make machine :pre
If you want to change the linkage mode, you have to re-run "make
lib-plumed" with the desired settings [and] do a reinstall if the
USER-PLUMED package with "make yes-user-plumed" to update the required
makefile settings with the changes in the lib/plumed folder.
:line

View File

@ -56,6 +56,7 @@ packages:
"USER-INTEL"_Build_extras.html#user-intel,
"USER-MOLFILE"_Build_extras.html#user-molfile,
"USER-NETCDF"_Build_extras.html#user-netcdf,
"USER-PLUMED"_Build_extras.html#user-plumed,
"USER-OMP"_Build_extras.html#user-omp,
"USER-QMMM"_Build_extras.html#user-qmmm,
"USER-QUIP"_Build_extras.html#user-quip,

View File

@ -1,7 +1,7 @@
<!-- HTML_ONLY -->
<HEAD>
<TITLE>LAMMPS Users Manual</TITLE>
<META NAME="docnumber" CONTENT="9 Nov 2018 version">
<META NAME="docnumber" CONTENT="15 Nov 2018 version">
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
</HEAD>
@ -21,7 +21,7 @@
:line
LAMMPS Documentation :c,h1
9 Nov 2018 version :c,h2
15 Nov 2018 version :c,h2
"What is a LAMMPS version?"_Manual_version.html

View File

@ -89,6 +89,7 @@ as contained in the file name.
"USER-NETCDF"_#PKG-USER-NETCDF,
"USER-OMP"_#PKG-USER-OMP,
"USER-PHONON"_#PKG-USER-PHONON,
"USER-PLUMED"_#PKG-USER-PLUMED,
"USER-PTM"_#PKG-USER-PTM,
"USER-QMMM"_#PKG-USER-QMMM,
"USER-QTB"_#PKG-USER-QTB,
@ -1187,7 +1188,7 @@ the NAMD MD code, but with portability in mind. Axel Kohlmeyer
[Install:]
This package has "specific installation
instructions"_Build_extras.html#gpu on the "Build
instructions"_Build_extras.html#user-colvars on the "Build
extras"_Build_extras.html doc page.
[Supporting info:]
@ -1201,18 +1202,20 @@ examples/USER/colvars :ul
:line
USER-PLUMED package :link(USER-PLUMED),h4
USER-PLUMED package :link(PKG-USER-PLUMED),h4
[Contents:]
The fix plumed command allows you to use the plugin for molecular
dynamics PLUMED to analyse and bias your LAMMPS trajectory on the fly.
In practise PLUMED is called from within the lammps input script by using
the "fix plumed _fix_plumed.html command.
The fix plumed command allows you to use the PLUMED free energy plugin
for molecular dynamics to analyse and bias your LAMMPS trajectory on
the fly. The PLUMED library is called from within the LAMMPS input
script by using the "fix plumed _fix_plumed.html command.
[Authors:] The PLUMED library is written and maintained by
Massimilliano Bonomi, Giovanni Bussi, Carlo Camiloni and
Gareth Tribello.
[Authors:] The "PLUMED library"_#PLUMED is written and maintained by
Massimilliano Bonomi, Giovanni Bussi, Carlo Camiloni and Gareth
Tribello.
:link(PLUMED,http://www.plumed.org)
[Install:]
@ -1224,7 +1227,7 @@ extras"_Build_extras.html doc page.
src/USER-PLUMED/README
lib/plumed/README
"fix plumed "_fix_plumed.html
"fix plumed"_fix_plumed.html
examples/USER/plumed :ul
:line

View File

@ -62,6 +62,7 @@ Package, Description, Doc page, Example, Library
"USER-NETCDF"_Packages_details.html#PKG-USER-NETCDF, dump output via NetCDF,"dump netcdf"_dump_netcdf.html, n/a, ext
"USER-OMP"_Packages_details.html#PKG-USER-OMP, OpenMP-enabled styles,"Speed omp"_Speed_omp.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, no
"USER-PHONON"_Packages_details.html#PKG-USER-PHONON, phonon dynamical matrix,"fix phonon"_fix_phonon.html, USER/phonon, no
"USER-PLUMED"_Packages_details.html#PKG-USER-PLUMED, "PLUMED"_#PLUMED free energy library,"fix plumed"_fix_plumed.html, USER/plumed, ext
"USER-PTM"_Packages_details.html#PKG-USER-PTM, Polyhedral Template Matching,"compute ptm/atom"_compute_ptm_atom.html, n/a, no
"USER-QMMM"_Packages_details.html#PKG-USER-QMMM, QM/MM coupling,"fix qmmm"_fix_qmmm.html, USER/qmmm, ext
"USER-QTB"_Packages_details.html#PKG-USER-QTB, quantum nuclear effects,"fix qtb"_fix_qtb.html "fix qbmsst"_fix_qbmsst.html, qtb, no
@ -75,4 +76,6 @@ Package, Description, Doc page, Example, Library
"USER-TALLY"_Packages_details.html#PKG-USER-TALLY, pairwise tally computes,"compute XXX/tally"_compute_tally.html, USER/tally, no
"USER-UEF"_Packages_details.html#PKG-USER-UEF, extensional flow,"fix nvt/uef"_fix_nh_uef.html, USER/uef, no
"USER-VTK"_Packages_details.html#PKG-USER-VTK, dump output via VTK, "compute vtk"_dump_vtk.html, n/a, ext :tb(ea=c,ca1=l)
:link(MOFplus,https://www.mofplus.org/content/show/MOF-FF)
:link(PLUMED,http://www.plumed.org)

View File

@ -116,7 +116,8 @@ not a limitation of functionality.
[Related commands:]
"fix smd"_fix_smd.html
"fix smd"_fix_smd.html, "fix spring"_fix_spring.html,
"fix plumed"_fix_plumed.html
[Default:]
@ -126,4 +127,4 @@ and tstat = NULL.
:line
:link(Fiorin)
[(Fiorin)] Fiorin , Klein, Henin, Mol. Phys., DOI:10.1080/00268976.2013.813594
[(Fiorin)] Fiorin, Klein, Henin, Mol. Phys., DOI:10.1080/00268976.2013.813594

View File

@ -25,33 +25,32 @@ fix pl all plumed all plumed plumedfile plumed.dat outfile p.log
[Description:]
This fix instructs LAMMPS to call the PLUMED library, which allows one
to perform various forms of trajectory analysis on the fly and to also
use methods such as umbrella sampling and metadynamics to enhance the
sampling of phase space.
This fix instructs LAMMPS to call the "PLUMED"_plumedhome library, which
allows one to perform various forms of trajectory analysis on the fly
and to also use methods such as umbrella sampling and metadynamics to
enhance the sampling of phase space.
The documentation included here only describes the fix plumed command.
This command is LAMMPS specific whereas most of the functionality
implemented in PLUMED will work with a range of MD codes and also when
PLUMED is used as a stand alone code. The full documentation for PLUMED
is available at "this website"_http://www.plumed.org/documentation
The documentation included here only describes the fix plumed command
itself. This command is LAMMPS specific, whereas most of the
functionality implemented in PLUMED, however, will work with a range of
MD codes, and when PLUMED is used as a stand alone code for analysis.
The full "documentation for PLUMED"_plumeddocs is available online and
included in the PLUMED source code. The PLUMED library development is
hosted at
"https://github.com/plumed/plumed2"_https://github.com/plumed/plumed2
A detailed discussion of the code can be found in "(PLUMED)"_#PLUMED.
The PLUMED library is developed at
"https://github.com/plumed/plumed2"_https://github.com/plumed/plumed2 A
detailed discussion of the code can be found in "(PLUMED)"_#PLUMED.
There are some example scripts for using this package with LAMMPS in the
There is an example input for using this package with LAMMPS in the
examples/USER/plumed directory.
:line
The command to call PLUMED above is reasonably self explanatory. Within
the input file for lammps the user is required to specify the input file
for PLUMED and a file on which to output the PLUMED log. The user must
specify both of these arguments every time PLUMED is to be used.
Furthermore, the fix plumed command should appear in the LAMMPS input
file after the relevant input paramters (e.g. the timestep) have been
set.
The command to make LAMMPS call PLUMED during a run requires two keyword
value pairs pointing to the PLUMED input file and an output file for the
PLUMED log. The user must specify these arguments every time PLUMED is
to be used. Furthermore, the fix plumed command should appear in the
LAMMPS input file [after] relevant input paramters (e.g. the timestep)
have been set.
The {group-ID} entry is ignored. LAMMPS will always pass all the atoms
to PLUMED and there can only be one instance of the plumed fix at a
@ -64,10 +63,10 @@ functionality by only allowing only one plumed fix in the LAMMPS input.
The {plumedfile} keyword allows the user to specify the name of the
PLUMED input file. Instructions as to what should be included in a
plumed input file can be found in the "documentation for
PLUMED"_http://www.plumed.org/documentation.
PLUMED"_plumeddocs
The {outfile} keyword allows the user to specify the name of a file on
which to output the PLUMED log. This log file normally just parots the
which to output the PLUMED log. This log file normally just parrots the
information that is contained in the input file. The names of the files
on which the results from the various analyses that have been performed
using PLUMED will be specified by the user in the PLUMED input file.
@ -76,12 +75,13 @@ using PLUMED will be specified by the user in the PLUMED input file.
When performing a restart of a calculation that involves PLUMED you must
include a RESTART command in the PLUMED input file as detailed in the
"PLUMED documentation"_http://www.plumed.org/documentation. When the
restart command is found in the PLUMED input PLUMED will append to the
files that were generated in the run that was performed previously.
Furthermore, any history dependent bias potentials that were accumulated
in previous calculations will be read in when the restart command is
included in the PLUMED input.
"PLUMED documentation"_plumeddocs. When the restart command is found in
the PLUMED input PLUMED will append to the files that were generated in
the run that was performed previously. No part of the PLUMED restart
data is included in the LAMMPS restart files. Furthermore, any history
dependent bias potentials that were accumulated in previous calculations
will be read in when the RESTART command is included in the PLUMED
input.
The "fix_modify"_fix_modify.html {energy} option is not supported by
this fix.
@ -97,10 +97,7 @@ This fix is part of the USER-PLUMED package. It is only enabled if
LAMMPS was built with that package. See the "Build
package"_Build_package.html doc page for more info.
There can only be one plumed fix active at a time. Since the interface
communicates only the minimum amount of information and since the PLUMED
module itself can handle an arbitrary number of analysis and biasing
methods, this is not a limitation of functionality.
There can only be one plumed fix active at a time.
[Related commands:]
@ -115,3 +112,6 @@ The default options are plumedfile = NULL and outfile = NULL
:link(PLUMED)
[(PLUMED)] G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
:link(plumeddocs,http://www.plumed.org/documentation)
:link(plumedhome,http://www.plumed.org/)

View File

@ -137,7 +137,8 @@ package"_Build_package.html doc page for more info.
"fix drag"_fix_drag.html, "fix spring"_fix_spring.html,
"fix spring/self"_fix_spring_self.html,
"fix spring/rg"_fix_spring_rg.html
"fix spring/rg"_fix_spring_rg.html,
"fix colvars"_fix_colvars.html, "fix plumed"_fix_plumed.html
[Default:] none

View File

@ -94,8 +94,8 @@ hyper/local"_fix_hyper_local.html command specified as {fix-ID}. At
every dynamics timestep, the same fix selects one of more bonds to
apply a bias potential to.
IMPORTANT NOTE: The style of fix associated with the specified
{fix-ID} determines whether you are running the global versus local
NOTE: The style of fix associated with the specified {fix-ID}
determines whether you are running the global versus local
hyperdynamics algorithm.
Dynamics (with the bias potential) is run continuously, stopping every

View File

@ -21,10 +21,14 @@
colvar::colvar()
: prev_timestep(-1)
{
// Initialize static array once and for all
runave_os = NULL;
prev_timestep = -1;
after_restart = false;
kinetic_energy = 0.0;
potential_energy = 0.0;
init_cv_requires();
}
@ -38,6 +42,7 @@ namespace {
}
}
int colvar::init(std::string const &conf)
{
cvm::log("Initializing a new collective variable.\n");
@ -48,7 +53,7 @@ int colvar::init(std::string const &conf)
colvarmodule *cv = cvm::main();
get_keyval(conf, "name", this->name,
(std::string("colvar")+cvm::to_str(cv->variables()->size()+1)));
(std::string("colvar")+cvm::to_str(cv->variables()->size())));
if ((cvm::colvar_by_name(this->name) != NULL) &&
(cvm::colvar_by_name(this->name) != this)) {
@ -63,9 +68,6 @@ int colvar::init(std::string const &conf)
this->description = "colvar " + this->name;
kinetic_energy = 0.0;
potential_energy = 0.0;
error_code |= init_components(conf);
if (error_code != COLVARS_OK) {
return cvm::get_error();
@ -260,7 +262,6 @@ int colvar::init(std::string const &conf)
f_old.reset();
x_restart.type(value());
after_restart = false;
reset_bias_force();
@ -282,8 +283,7 @@ int colvar::init(std::string const &conf)
// Now that the children are defined we can solve dependencies
enable(f_cv_active);
if (cvm::b_analysis)
parse_analysis(conf);
error_code |= parse_analysis(conf);
if (cvm::debug())
cvm::log("Done initializing collective variable \""+this->name+"\".\n");
@ -881,19 +881,7 @@ int colvar::parse_analysis(std::string const &conf)
cvm::error("Error: runAveStride must be commensurate with the restart frequency.\n", INPUT_ERROR);
}
get_keyval(conf, "runAveOutputFile", runave_outfile,
std::string(cvm::output_prefix()+"."+
this->name+".runave.traj"));
size_t const this_cv_width = x.output_width(cvm::cv_width);
cvm::proxy->backup_file(runave_outfile);
runave_os = cvm::proxy->output_stream(runave_outfile);
*runave_os << "# " << cvm::wrap_string("step", cvm::it_width-2)
<< " "
<< cvm::wrap_string("running average", this_cv_width)
<< " "
<< cvm::wrap_string("running stddev", this_cv_width)
<< "\n";
get_keyval(conf, "runAveOutputFile", runave_outfile, runave_outfile);
}
acf_length = 0;
@ -902,7 +890,6 @@ int colvar::parse_analysis(std::string const &conf)
enable(f_cv_corrfunc);
std::string acf_colvar_name;
get_keyval(conf, "corrFuncWithColvar", acf_colvar_name, this->name);
if (acf_colvar_name == this->name) {
cvm::log("Calculating auto-correlation function.\n");
@ -918,8 +905,12 @@ int colvar::parse_analysis(std::string const &conf)
} else if (acf_type_str == to_lower_cppstr(std::string("velocity"))) {
acf_type = acf_vel;
enable(f_cv_fdiff_velocity);
if (acf_colvar_name.size())
(cvm::colvar_by_name(acf_colvar_name))->enable(f_cv_fdiff_velocity);
colvar *cv2 = cvm::colvar_by_name(acf_colvar_name);
if (cv2 == NULL) {
return cvm::error("Error: collective variable \""+acf_colvar_name+
"\" is not defined at this time.\n", INPUT_ERROR);
}
cv2->enable(f_cv_fdiff_velocity);
} else if (acf_type_str == to_lower_cppstr(std::string("coordinate_p2"))) {
acf_type = acf_p2coor;
} else {
@ -937,9 +928,7 @@ int colvar::parse_analysis(std::string const &conf)
}
get_keyval(conf, "corrFuncNormalize", acf_normalize, true);
get_keyval(conf, "corrFuncOutputFile", acf_outfile,
std::string(cvm::output_prefix()+"."+this->name+
".corrfunc.dat"));
get_keyval(conf, "corrFuncOutputFile", acf_outfile, acf_outfile);
}
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
}
@ -1389,9 +1378,9 @@ int colvar::calc_colvar_properties()
{
if (is_enabled(f_cv_fdiff_velocity)) {
// calculate the velocity by finite differences
if (cvm::step_relative() == 0)
if (cvm::step_relative() == 0) {
x_old = x;
else {
} else {
v_fdiff = fdiff_velocity(x_old, x);
v_reported = v_fdiff;
}
@ -1486,7 +1475,6 @@ cvm::real colvar::update_forces_energy()
return 0.;
}
}
prev_timestep = cvm::step_relative();
// Integrate with slow timestep (if time_step_factor != 1)
cvm::real dt = cvm::dt() * cvm::real(time_step_factor);
@ -1547,8 +1535,18 @@ cvm::real colvar::update_forces_energy()
// bypass the extended Lagrangian mass)
f += fb_actual;
if (cvm::debug())
cvm::log("Done updating colvar \""+this->name+"\".\n");
return (potential_energy + kinetic_energy);
}
int colvar::end_of_step()
{
if (cvm::debug())
cvm::log("End of step for colvar \""+this->name+"\".\n");
if (is_enabled(f_cv_fdiff_velocity)) {
// set it for the next step
x_old = x;
}
@ -1556,9 +1554,9 @@ cvm::real colvar::update_forces_energy()
f_old = f;
}
if (cvm::debug())
cvm::log("Done updating colvar \""+this->name+"\".\n");
return (potential_energy + kinetic_energy);
prev_timestep = cvm::step_relative();
return COLVARS_OK;
}
@ -1966,6 +1964,10 @@ std::ostream & colvar::write_restart(std::ostream &os) {
os << "}\n\n";
if (runave_os) {
cvm::main()->proxy->flush_output_stream(runave_os);
}
return os;
}
@ -2075,55 +2077,61 @@ std::ostream & colvar::write_traj(std::ostream &os)
return os;
}
int colvar::write_output_files()
{
if (cvm::b_analysis) {
int error_code = COLVARS_OK;
if (is_enabled(f_cv_corrfunc)) {
if (acf.size()) {
cvm::log("Writing acf to file \""+acf_outfile+"\".\n");
if (acf_outfile.size() == 0) {
acf_outfile = std::string(cvm::output_prefix()+"."+this->name+
".corrfunc.dat");
}
cvm::log("Writing correlation function to file \""+acf_outfile+"\".\n");
cvm::backup_file(acf_outfile.c_str());
std::ostream *acf_os = cvm::proxy->output_stream(acf_outfile);
if (!acf_os) return cvm::get_error();
write_acf(*acf_os);
error_code |= write_acf(*acf_os);
cvm::proxy->close_output_stream(acf_outfile);
}
if (runave_os) {
cvm::proxy->close_output_stream(runave_outfile);
runave_os = NULL;
}
}
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
return error_code;
}
// ******************** ANALYSIS FUNCTIONS ********************
void colvar::analyze()
int colvar::analyze()
{
int error_code = COLVARS_OK;
if (is_enabled(f_cv_runave)) {
calc_runave();
error_code |= calc_runave();
}
if (is_enabled(f_cv_corrfunc)) {
calc_acf();
error_code |= calc_acf();
}
return error_code;
}
inline void history_add_value(size_t const &history_length,
std::list<colvarvalue> &history,
colvarvalue const &new_value)
std::list<colvarvalue> &history,
colvarvalue const &new_value)
{
history.push_front(new_value);
if (history.size() > history_length)
history.pop_back();
}
inline void history_incr(std::list< std::list<colvarvalue> > &history,
std::list< std::list<colvarvalue> >::iterator &history_p)
std::list< std::list<colvarvalue> >::iterator &history_p)
{
if ((++history_p) == history.end())
history_p = history.begin();
@ -2133,18 +2141,21 @@ inline void history_incr(std::list< std::list<colvarvalue> > &history,
int colvar::calc_acf()
{
// using here an acf_stride-long list of vectors for either
// coordinates(acf_x_history) or velocities (acf_v_history); each vector can
// coordinates (acf_x_history) or velocities (acf_v_history); each vector can
// contain up to acf_length values, which are contiguous in memory
// representation but separated by acf_stride in the time series;
// the pointer to each vector is changed at every step
colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name);
if (cfcv == NULL) {
return cvm::error("Error: collective variable \""+acf_colvar_name+
"\" is not defined at this time.\n", INPUT_ERROR);
}
if (acf_x_history.empty() && acf_v_history.empty()) {
// first-step operations
colvar *cfcv = (acf_colvar_name.size() ?
cvm::colvar_by_name(acf_colvar_name) :
this);
if (colvarvalue::check_types(cfcv->value(), value())) {
cvm::error("Error: correlation function between \""+cfcv->name+
"\" and \""+this->name+"\" cannot be calculated, "
@ -2153,7 +2164,8 @@ int colvar::calc_acf()
}
acf_nframes = 0;
cvm::log("Colvar \""+this->name+"\": initializing ACF calculation.\n");
cvm::log("Colvar \""+this->name+"\": initializing correlation function "
"calculation.\n");
if (acf.size() < acf_length+1)
acf.resize(acf_length+1, 0.0);
@ -2182,41 +2194,31 @@ int colvar::calc_acf()
break;
}
} else {
colvar *cfcv = (acf_colvar_name.size() ?
cvm::colvar_by_name(acf_colvar_name) :
this);
} else if (cvm::step_relative() > prev_timestep) {
switch (acf_type) {
case acf_vel:
if (is_enabled(f_cv_fdiff_velocity)) {
// calc() should do this already, but this only happens in a
// simulation; better do it again in case a trajectory is
// being read
v_reported = v_fdiff = fdiff_velocity(x_old, cfcv->value());
}
calc_vel_acf((*acf_v_history_p), cfcv->velocity());
// store this value in the history
history_add_value(acf_length+acf_offset, *acf_v_history_p, cfcv->velocity());
// if stride is larger than one, cycle among different histories
history_add_value(acf_length+acf_offset, *acf_v_history_p,
cfcv->velocity());
history_incr(acf_v_history, acf_v_history_p);
break;
case acf_coor:
calc_coor_acf((*acf_x_history_p), cfcv->value());
history_add_value(acf_length+acf_offset, *acf_x_history_p, cfcv->value());
history_add_value(acf_length+acf_offset, *acf_x_history_p,
cfcv->value());
history_incr(acf_x_history, acf_x_history_p);
break;
case acf_p2coor:
calc_p2coor_acf((*acf_x_history_p), cfcv->value());
history_add_value(acf_length+acf_offset, *acf_x_history_p, cfcv->value());
history_add_value(acf_length+acf_offset, *acf_x_history_p,
cfcv->value());
history_incr(acf_x_history, acf_x_history_p);
break;
@ -2225,18 +2227,14 @@ int colvar::calc_acf()
}
}
if (is_enabled(f_cv_fdiff_velocity)) {
// set it for the next step
x_old = x;
}
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
return COLVARS_OK;
}
int colvar::calc_vel_acf(std::list<colvarvalue> &v_list,
colvarvalue const &v)
void colvar::calc_vel_acf(std::list<colvarvalue> &v_list,
colvarvalue const &v)
{
// loop over stored velocities and add to the ACF, but only the
// loop over stored velocities and add to the ACF, but only if the
// length is sufficient to hold an entire row of ACF values
if (v_list.size() >= acf_length+acf_offset) {
std::list<colvarvalue>::iterator vs_i = v_list.begin();
@ -2255,7 +2253,6 @@ int colvar::calc_vel_acf(std::list<colvarvalue> &v_list,
acf_nframes++;
}
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
}
@ -2280,7 +2277,7 @@ void colvar::calc_coor_acf(std::list<colvarvalue> &x_list,
void colvar::calc_p2coor_acf(std::list<colvarvalue> &x_list,
colvarvalue const &x)
colvarvalue const &x)
{
// same as above but with second order Legendre polynomial instead
// of just the scalar product
@ -2301,20 +2298,46 @@ void colvar::calc_p2coor_acf(std::list<colvarvalue> &x_list,
}
void colvar::write_acf(std::ostream &os)
int colvar::write_acf(std::ostream &os)
{
if (!acf_nframes)
cvm::log("Warning: ACF was not calculated (insufficient frames).\n");
if (!acf_nframes) {
return COLVARS_OK;
}
os.setf(std::ios::scientific, std::ios::floatfield);
os << "# Autocorrelation function for collective variable \""
<< this->name << "\"\n";
// one frame is used for normalization, the statistical sample is
// hence decreased
os << "# nframes = " << (acf_normalize ?
acf_nframes - 1 :
acf_nframes) << "\n";
os << "# ";
switch (acf_type) {
case acf_vel:
os << "Velocity";
break;
case acf_coor:
os << "Coordinate";
break;
case acf_p2coor:
os << "Coordinate (2nd Legendre poly)";
break;
}
if (acf_colvar_name == name) {
os << " autocorrelation function for variable \""
<< this->name << "\"\n";
} else {
os << " correlation function between variables \"" //
<< this->name << "\" and \"" << acf_colvar_name << "\"\n";
}
os << "# Number of samples = ";
if (acf_normalize) {
os << (acf_nframes-1) << " (one DoF is used for normalization)\n";
} else {
os << acf_nframes << "\n";
}
os << "# " << cvm::wrap_string("step", cvm::it_width-2) << " "
<< cvm::wrap_string("corrfunc(step)", cvm::cv_width) << "\n";
cvm::real const acf_norm = acf.front() / cvm::real(acf_nframes);
std::vector<cvm::real>::iterator acf_i;
size_t it = acf_offset;
for (acf_i = acf.begin(); acf_i != acf.end(); ++acf_i) {
@ -2325,11 +2348,15 @@ void colvar::write_acf(std::ostream &os)
(*acf_i)/(acf_norm * cvm::real(acf_nframes)) :
(*acf_i)/(cvm::real(acf_nframes)) ) << "\n";
}
return os.good() ? COLVARS_OK : FILE_ERROR;
}
void colvar::calc_runave()
int colvar::calc_runave()
{
int error_code = COLVARS_OK;
if (x_history.empty()) {
runave.type(value().type());
@ -2348,10 +2375,29 @@ void colvar::calc_runave()
} else {
if ( (cvm::step_relative() % runave_stride) == 0) {
if ( (cvm::step_relative() % runave_stride) == 0 &&
(cvm::step_relative() > prev_timestep) ) {
if ((*x_history_p).size() >= runave_length-1) {
if (runave_os == NULL) {
if (runave_outfile.size() == 0) {
runave_outfile = std::string(cvm::output_prefix()+"."+
this->name+".runave.traj");
}
size_t const this_cv_width = x.output_width(cvm::cv_width);
cvm::proxy->backup_file(runave_outfile);
runave_os = cvm::proxy->output_stream(runave_outfile);
runave_os->setf(std::ios::scientific, std::ios::floatfield);
*runave_os << "# " << cvm::wrap_string("step", cvm::it_width-2)
<< " "
<< cvm::wrap_string("running average", this_cv_width)
<< " "
<< cvm::wrap_string("running stddev", this_cv_width)
<< "\n";
}
runave = x;
std::list<colvarvalue>::iterator xs_i;
for (xs_i = (*x_history_p).begin();
@ -2370,7 +2416,7 @@ void colvar::calc_runave()
runave_variance *= 1.0 / cvm::real(runave_length-1);
*runave_os << std::setw(cvm::it_width) << cvm::step_relative()
<< " "
<< " "
<< std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width)
<< runave << " "
<< std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width)
@ -2381,6 +2427,7 @@ void colvar::calc_runave()
}
}
return error_code;
}
// Static members

View File

@ -291,6 +291,9 @@ public:
/// \brief Calculate the colvar's value and related quantities
int calc();
/// Carry out operations needed before next step is run
int end_of_step();
/// \brief Calculate a subset of the colvar components (CVCs) currently active
/// (default: all active CVCs)
/// Note: both arguments refer to the sect of *active* CVCs, not all CVCs
@ -410,8 +413,9 @@ public:
/// Read the analysis tasks
int parse_analysis(std::string const &conf);
/// Perform analysis tasks
void analyze();
int analyze();
/// Read the value from a collective variable trajectory file
@ -489,23 +493,23 @@ protected:
acf_type_e acf_type;
/// \brief Velocity ACF, scalar product between v(0) and v(t)
int calc_vel_acf(std::list<colvarvalue> &v_history,
colvarvalue const &v);
void calc_vel_acf(std::list<colvarvalue> &v_history,
colvarvalue const &v);
/// \brief Coordinate ACF, scalar product between x(0) and x(t)
/// (does not work with scalar numbers)
void calc_coor_acf(std::list<colvarvalue> &x_history,
colvarvalue const &x);
colvarvalue const &x);
/// \brief Coordinate ACF, second order Legendre polynomial between
/// x(0) and x(t) (does not work with scalar numbers)
void calc_p2coor_acf(std::list<colvarvalue> &x_history,
colvarvalue const &x);
colvarvalue const &x);
/// Calculate the auto-correlation function (ACF)
int calc_acf();
/// Save the ACF to a file
void write_acf(std::ostream &os);
int write_acf(std::ostream &os);
/// Length of running average series
size_t runave_length;
@ -521,7 +525,7 @@ protected:
cvm::real runave_variance;
/// Calculate the running average and its standard deviation
void calc_runave();
int calc_runave();
/// If extended Lagrangian active: colvar energies (kinetic and harmonic potential)
cvm::real kinetic_energy;

View File

@ -236,6 +236,12 @@ void colvarbias::communicate_forces()
}
int colvarbias::end_of_step()
{
return COLVARS_OK;
}
int colvarbias::change_configuration(std::string const &conf)
{
cvm::error("Error: change_configuration() not implemented.\n",

View File

@ -66,6 +66,9 @@ public:
/// Send forces to the collective variables
virtual void communicate_forces();
/// Carry out operations needed before next step is run
virtual int end_of_step();
/// Load new configuration - force constant and/or centers only
virtual int change_configuration(std::string const &conf);

View File

@ -567,6 +567,9 @@ void colvardeps::init_cv_requires() {
// Most features are available, so we set them so
// and list exceptions below
}
feature_states[f_cv_fdiff_velocity].available =
cvm::main()->proxy->simulation_running();
}

View File

@ -62,8 +62,6 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in)
use_scripted_forces = false;
scripting_after_biases = false;
b_analysis = false;
colvarmodule::debug_gradients_step_size = 1.0e-07;
colvarmodule::rotation::monitor_crossings = false;
@ -274,7 +272,12 @@ int colvarmodule::parse_global_params(std::string const &conf)
}
}
parse->get_keyval(conf, "analysis", b_analysis, b_analysis);
bool b_analysis = true;
if (parse->get_keyval(conf, "analysis", b_analysis, true,
colvarparse::parse_silent)) {
cvm::log("Warning: keyword \"analysis\" is deprecated: it is now set "
"to true; individual analyses are performed only if requested.");
}
parse->get_keyval(conf, "debugGradientsStepSize", debug_gradients_step_size,
debug_gradients_step_size,
@ -715,9 +718,7 @@ int colvarmodule::calc()
error_code |= calc_biases();
error_code |= update_colvar_forces();
if (cvm::b_analysis) {
error_code |= analyze();
}
error_code |= analyze();
// write trajectory files, if needed
if (cv_traj_freq && cv_traj_name.size()) {
@ -736,6 +737,8 @@ int colvarmodule::calc()
write_output_files();
}
error_code |= end_of_step();
return error_code;
}
@ -1056,6 +1059,33 @@ int colvarmodule::analyze()
}
int colvarmodule::end_of_step()
{
if (cvm::debug()) {
cvm::log("colvarmodule::end_of_step(), step = "+cvm::to_str(it)+".\n");
}
for (std::vector<colvar *>::iterator cvi = variables_active()->begin();
cvi != variables_active()->end();
cvi++) {
cvm::increase_depth();
(*cvi)->end_of_step();
cvm::decrease_depth();
}
// perform bias-specific analysis
for (std::vector<colvarbias *>::iterator bi = biases.begin();
bi != biases.end();
bi++) {
cvm::increase_depth();
(*bi)->end_of_step();
cvm::decrease_depth();
}
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
}
int colvarmodule::setup()
{
if (this->size() == 0) return cvm::get_error();
@ -1895,7 +1925,6 @@ long colvarmodule::it = 0;
long colvarmodule::it_restart = 0;
size_t colvarmodule::restart_out_freq = 0;
size_t colvarmodule::cv_traj_freq = 0;
bool colvarmodule::b_analysis = false;
bool colvarmodule::use_scripted_forces = false;
bool colvarmodule::scripting_after_biases = true;

View File

@ -422,6 +422,9 @@ public:
/// Perform analysis
int analyze();
/// Carry out operations needed before next step is run
int end_of_step();
/// \brief Read a collective variable trajectory (post-processing
/// only, not called at runtime)
int read_traj(char const *traj_filename,
@ -546,9 +549,6 @@ public:
/// Frequency for collective variables trajectory output
static size_t cv_traj_freq;
/// \brief True if only analysis is performed and not a run
static bool b_analysis;
/// Frequency for saving output restarts
static size_t restart_out_freq;
/// Output restart file name

View File

@ -1,5 +1,5 @@
#ifndef COLVARS_VERSION
#define COLVARS_VERSION "2018-10-16"
#define COLVARS_VERSION "2018-11-16"
// This file is part of the Collective Variables module (Colvars).
// The original version of Colvars and its updates are located at:
// https://github.com/colvars/colvars

View File

@ -11,27 +11,29 @@ import sys,os,re,subprocess,hashlib
help = """
Syntax from src dir: make lib-plumed args="-b"
or: make lib-plumed args="-b -v 2.4.3"
or: make lib-plumed args="-p /usr/local/plumed2-2.4.3"
or: make lib-plumed args="-p /usr/local/plumed2 -m shared"
Syntax from lib dir: python Install.py -b -v 2.4.3
or: python Install.py -b
or: python Install.py -p /usr/local/plumed2-2.4.3
or: python Install.py -p /usr/local/plumed2 -m shared
specify one or more options, order does not matter
-b = download and build the plumed2 library
-p = specify folder of existing plumed2 installation
-v = set version of plumed2 to download and build (default: 2.4.3)
-p = specify folder of existing plumed2 installation
-m = set plumed linkage mode: static (default), shared, or runtime
Example:
make lib-plumed args="-b" # download/build in lib/plumed/plumed2
make lib-plumed args="-p $HOME/plumed-2.4.3" # use existing Plumed2 installation in $HOME/plumed-2.4.3
make lib-plumed args="-p $HOME/plumed2 -m shared" # use existing Plumed2 installation in $HOME/plumed2
"""
# settings
version = "2.4.3"
mode = "static"
# known checksums for different PLUMED versions. used to validate the download.
checksums = { \
@ -40,11 +42,6 @@ checksums = { \
'2.5b' : 'e341bdef469be1da058b8a0b97a3db22', \
}
#checksums = { \
# '2.4.2' : '0f66f24b4c763ae8b2f39574113e9935', \
# '2.4.3' : 'dc38de0ffd59d13950d8f1ef1ce05574', \
# }
# print error message or help
def error(str=None):
if not str: print(help)
@ -132,6 +129,10 @@ while iarg < nargs:
plumedpath = fullpath(args[iarg+1])
pathflag = True
iarg += 2
elif args[iarg] == "-m":
if iarg+2 > nargs: error()
mode = args[iarg+1]
iarg += 2
elif args[iarg] == "-b":
buildflag = True
iarg += 1
@ -149,13 +150,14 @@ if (buildflag and pathflag):
if (not buildflag and not pathflag):
error("Have to use either -b or -p flag")
if ((mode != "static") and (mode != "shared") and (mode != "runtime")):
error("Unknown linkage mode '%s' for Plumed" % mode)
# download and unpack plumed2 tarball
if buildflag:
url = "https://github.com/plumed/plumed2/releases/download/v%s/plumed-src-%s.tgz" % (version,version)
filename = "plumed-src-%s.tar.gz" %version
#url = "https://github.com/plumed/plumed2/archive/v%s.tar.gz" % version
#filename = "v%s.tar.gz" %version
print("Downloading plumed ...")
geturl(url,filename)
@ -168,9 +170,6 @@ if buildflag:
if os.path.exists("%s/plumed-%s" % (homepath,version)):
cmd = 'rm -rf "%s/plumed-%s"' % (homepath,version)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
#if os.path.exists("%s/plumed2-%s" % (homepath,version)):
# cmd = 'rm -rf "%s/plumed2-%s"' % (homepath,version)
# subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if os.path.exists("%s/plumed2" % (homepath)):
cmd = 'rm -rf "%s/plumed2"' % (homepath)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
@ -183,7 +182,6 @@ if buildflag:
if buildflag:
print("Building plumed ...")
cmd = 'cd %s/plumed-%s; ./configure --prefix=%s/plumed2 --enable-static-patch ; make ; make install' % (homepath,version,homepath)
#cmd = 'cd %s/plumed2-%s; ./configure --prefix=%s/plumed2 --enable-static-patch ; make ; make install' % (homepath,version,homepath)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
print(txt.decode('UTF-8'))
#
@ -195,12 +193,12 @@ if linkflag:
os.remove("includelink")
if os.path.isfile("liblink") or os.path.islink("liblink"):
os.remove("liblink")
cmd = 'ln -s "%s/plumed2/include" includelink' % homepath
cmd = 'ln -s "%s/include" includelink' % homedir
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
cmd = 'ln -s "%s/plumed2/lib" liblink' % homepath
cmd = 'ln -s "%s/lib" liblink' % homedir
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if os.path.isfile("Makefile.lammps.static"):
if os.path.isfile("Makefile.lammps.%s" % mode):
print("Creating Makefile.lammps")
cmd = 'cat liblink/plumed/src/lib/Plumed.inc.static Makefile.lammps.static > Makefile.lammps'
cmd = 'echo PLUMED_LIBDIR="%s/lib" > Makefile.lammps; cat liblink/plumed/src/lib/Plumed.inc.%s Makefile.lammps.%s >> Makefile.lammps' % (homedir,mode,mode)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
plumed_SYSINC = -D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=$(PLUMED_LIBDIR)/libplumedKernel.so
plumed_SYSLIB = $(PLUMED_LOAD) -rdynamic
plumed_SYSPATH =

View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
plumed_SYSINC =
plumed_SYSLIB = $(PLUMED_LOAD)
plumed_SYSPATH =

View File

@ -1,5 +1,7 @@
# Settings that the LAMMPS build will import when this package library is used
plumed_SYSINC =
# Use statically linked C++ interface to plumed
plumed_SYSINC = -D__PLUMED_WRAPPER_CXX=1
plumed_SYSLIB = $(PLUMED_LOAD)
plumed_SYSPATH =

View File

@ -107,7 +107,7 @@ void PairBodyRoundedPolygon::compute(int eflag, int vflag)
int nei,nej,iefirst,jefirst;
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl;
double rsq,rsqinv,r,radi,radj,eradi,eradj,rradi,rradj,k_nij,k_naij;
double xi[3],xj[3],facc[3];
double facc[3];
int *ilist,*jlist,*numneigh,**firstneigh;
evdwl = 0.0;

View File

@ -274,14 +274,6 @@ double PairNMCut::init_one(int i, int j)
}
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]);
double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]);
double p1 = 1-nn[i][j];
double p2 = 1-mm[i][j];
double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]);
double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]);
double cut3 = cut[i][j]*cut[i][j]*cut[i][j];
ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut3 *
(pow(r0[i][j]/cut[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut[i][j],mm[i][j])/(mm[i][j]-3));

View File

@ -324,14 +324,6 @@ double PairNMCutCoulCut::init_one(int i, int j)
}
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]);
double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]);
double p1 = 1-nn[i][j];
double p2 = 1-mm[i][j];
double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]);
double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]);
double cut_lj3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j];
ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut_lj3 *
(pow(r0[i][j]/cut_lj[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut_lj[i][j],mm[i][j])/(mm[i][j]-3));

View File

@ -371,14 +371,6 @@ double PairNMCutCoulLong::init_one(int i, int j)
}
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]);
double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]);
double p1 = 1-nn[i][j];
double p2 = 1-mm[i][j];
double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]);
double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]);
double cut_lj3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j];
ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut_lj3 *
(pow(r0[i][j]/cut_lj[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut_lj[i][j],mm[i][j])/(mm[i][j]-3));

View File

@ -677,33 +677,33 @@ int AtomVecMolecular::unpack_exchange(double *buf)
num_bond[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_bond[nlocal]; k++) {
bond_type[nlocal][k] = (int) ubuf(buf[m++]).i;
bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i;
bond_atom[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_angle[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_angle[nlocal]; k++) {
angle_type[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
angle_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
angle_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_dihedral[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_dihedral[nlocal]; k++) {
dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_improper[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_improper[nlocal]; k++) {
improper_type[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
nspecial[nlocal][0] = (int) ubuf(buf[m++]).i;
@ -840,33 +840,33 @@ int AtomVecMolecular::unpack_restart(double *buf)
num_bond[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_bond[nlocal]; k++) {
bond_type[nlocal][k] = (int) ubuf(buf[m++]).i;
bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i;
bond_atom[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_angle[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_angle[nlocal]; k++) {
angle_type[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
angle_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
angle_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
angle_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_dihedral[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_dihedral[nlocal]; k++) {
dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i;
dihedral_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
dihedral_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
num_improper[nlocal] = (int) ubuf(buf[m++]).i;
for (k = 0; k < num_improper[nlocal]; k++) {
improper_type[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i;
improper_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i;
improper_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i;
}
nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0;

View File

@ -943,7 +943,7 @@ double FixCMAP::dihedral_angle_atan2(double fx, double fy, double fz,
{
// calculate the dihedral angle
double angle, arg1, arg2;
double angle = 0.0, arg1, arg2;
arg1 = absg*(fx*bx+fy*by+fz*bz);
arg2 = ax*bx+ay*by+az*bz;

View File

@ -748,19 +748,9 @@ void FixPOEMS::initial_integrate(int vflag)
/* ---------------------------------------------------------------------- */
void FixPOEMS::post_force(int vflag)
void FixPOEMS::post_force(int /* vflag */)
{
if (earlyflag) compute_forces_and_torques();
/*
for (int ibody = 0; ibody < nbody; ibody++) {
if (ibody == 0) {
printf("PFF %d %g %g %g\n",ibody,fcm[ibody][0],fcm[ibody][1],fcm[ibody][2]);
printf("PFT %d %g %g %g\n",ibody,
torque[ibody][0],torque[ibody][1],torque[ibody][2]);
}
}
*/
}
/* ----------------------------------------------------------------------
@ -850,7 +840,7 @@ void FixPOEMS::final_integrate()
/* ---------------------------------------------------------------------- */
void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int iloop)
void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int /* iloop */)
{
dtv = step_respa[ilevel];
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
@ -862,14 +852,14 @@ void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int iloop)
/* ---------------------------------------------------------------------- */
void FixPOEMS::post_force_respa(int vflag, int ilevel, int iloop)
void FixPOEMS::post_force_respa(int vflag, int ilevel, int /* iloop */)
{
if (ilevel == nlevels_respa-1) post_force(vflag);
}
/* ---------------------------------------------------------------------- */
void FixPOEMS::final_integrate_respa(int ilevel, int iloop)
void FixPOEMS::final_integrate_respa(int ilevel, int /* iloop */)
{
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
final_integrate();
@ -949,7 +939,7 @@ int FixPOEMS::dof(int igroup)
thus this routine does nothing for now
------------------------------------------------------------------------- */
void FixPOEMS::deform(int flag) {}
void FixPOEMS::deform(int /* flag */) {}
/* ---------------------------------------------------------------------- */
@ -1607,7 +1597,7 @@ void FixPOEMS::grow_arrays(int nmax)
copy values within local atom-based arrays
------------------------------------------------------------------------- */
void FixPOEMS::copy_arrays(int i, int j, int delflag)
void FixPOEMS::copy_arrays(int i, int j, int /* delflag */)
{
natom2body[j] = natom2body[i];
for (int k = 0; k < natom2body[j]; k++) atom2body[j][k] = atom2body[i][k];

View File

@ -716,7 +716,7 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
if (update->ntimestep % histo_print == 0) {
MPI_Allreduce(histo,allhisto,histo_count+2,MPI_LMP_BIGINT,MPI_SUM,world);
bigint total;
bigint total = 0;
for (i = 0; i < histo_count+2; i++) total += allhisto[i];
if (me == 0) {

View File

@ -87,7 +87,7 @@ class FixHyperLocal : public FixHyper {
int nevent; // # of events that trigger bond rebuild
int nevent_atom; // # of atoms that experienced an event
double cutbondsq,dcutsq;
double beta,t_hyper,invqfactorsq;
double beta,invqfactorsq;
double mybias;
double maxbondlen; // cummulative max length of any bond
double maxdriftsq; // max distance any atom drifts from original pos
@ -147,7 +147,7 @@ class FixHyperLocal : public FixHyper {
// histogramming of bond boost cooeficients
int histo_flag,histo_every,histo_count,histo_print,histo_steps;
int histo_every,histo_count,histo_print,histo_steps;
double histo_delta,invhisto_delta,histo_lo;
bigint *histo,*allhisto;
};

View File

@ -323,7 +323,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3])
double **x = atom->x;
double **sp = atom->sp;
double local_cut2;
double xi[3], rij[3];
double xi[3];
double delx,dely,delz;
double spj[3];

View File

@ -103,9 +103,9 @@ PairOxdna2Coaxstk::~PairOxdna2Coaxstk()
void PairOxdna2Coaxstk::compute(int eflag, int vflag)
{
double delf[3],delt[3],delta[3],deltb[3]; // force, torque increment;
double delf[3],delta[3],deltb[3]; // force, torque increment;
double evdwl,fpair,finc,tpair,factor_lj;
double v1tmp[3],v2tmp[3],v3tmp[3];
double v1tmp[3];
double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss;
double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st;
double theta1,theta1p,t1dir[3],cost1;
@ -114,12 +114,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag)
double theta6,theta6p,t6dir[3],cost6;
double cosphi3;
double gamma,gammacub,rinv_ss_cub,fac;
double aybx,azbx,rax,ray,raz,rbx;
double dcdr,dcdrbx;
double dcdaxbx,dcdaybx,dcdazbx;
double dcdrax,dcdray,dcdraz;
// distances COM-backbone site, COM-stacking site
double d_cs=-0.4, d_cst=+0.34;
// vectors COM-backbone site, COM-stacking site in lab frame

View File

@ -50,7 +50,7 @@ static int cmptagint(const void *p1, const void *p2)
static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me,
int np, MPI_Comm world, FILE *screen, FILE *logfile)
{
char fmt[8];
char fmt[16];
tagint *sendlist, *recvlist;
bigint num = group->count(gid);
int lnum, cols;
@ -73,7 +73,7 @@ static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me,
++i;
j /= 10;
}
sprintf(fmt,"%%%dd ", i);
snprintf(fmt,16,"%%%dd ", i);
cols = 80 / (i+1);
}

View File

@ -758,8 +758,10 @@ void FixRX::pre_force(int /*vflag*/)
memory->create( diagnosticCounterPerODE[FuncSum], nlocal, "FixRX::diagnosticCounterPerODE");
}
//#pragma omp parallel \
// reduction(+: nSteps, nIters, nFuncs, nFails )
#if 0
#pragma omp parallel \
reduction(+: nSteps, nIters, nFuncs, nFails )
#endif
{
double *rwork = new double[8*nspecies];

View File

@ -210,7 +210,7 @@ void ComputeStressMop::init()
/* ---------------------------------------------------------------------- */
void ComputeStressMop::init_list(int id, NeighList *ptr)
void ComputeStressMop::init_list(int /* id */, NeighList *ptr)
{
list = ptr;
}
@ -246,9 +246,9 @@ void ComputeStressMop::compute_vector()
void ComputeStressMop::compute_pairs()
{
int i,j,m,n,ii,jj,inum,jnum,itype,jtype;
int i,j,m,ii,jj,inum,jnum,itype,jtype;
double delx,dely,delz;
double rsq,eng,fpair,factor_coul,factor_lj;
double rsq,fpair,factor_coul,factor_lj;
int *ilist,*jlist,*numneigh,**firstneigh;
double *mass = atom->mass;
@ -363,8 +363,7 @@ void ComputeStressMop::compute_pairs()
// counts local particles transfers across the plane
if (which[m] == KIN || which[m] == TOTAL){
double vcm[3];
double masstotal,sgn;
double sgn;
for (int i = 0; i < nlocal; i++){

View File

@ -211,7 +211,7 @@ void ComputeStressMopProfile::init()
/* ---------------------------------------------------------------------- */
void ComputeStressMopProfile::init_list(int id, NeighList *ptr)
void ComputeStressMopProfile::init_list(int /* id */, NeighList *ptr)
{
list = ptr;
}
@ -253,11 +253,11 @@ void ComputeStressMopProfile::compute_array()
void ComputeStressMopProfile::compute_pairs()
{
int i,j,m,n,ii,jj,inum,jnum,itype,jtype,ibin;
int i,j,m,ii,jj,inum,jnum,itype,jtype,ibin;
double delx,dely,delz;
double rsq,eng,fpair,factor_coul,factor_lj;
double rsq,fpair,factor_coul,factor_lj;
int *ilist,*jlist,*numneigh,**firstneigh;
double pos,pos1,pos_temp;
double pos,pos1;
double *mass = atom->mass;
int *type = atom->type;
@ -385,8 +385,7 @@ void ComputeStressMopProfile::compute_pairs()
if (which[m] == KIN || which[m] == TOTAL){
double vcm[3];
double masstotal,sgn;
double sgn;
for (int i = 0; i < nlocal; i++){
@ -449,13 +448,12 @@ void ComputeStressMopProfile::compute_pairs()
void ComputeStressMopProfile::setup_bins()
{
int i,j,k,m,n;
double lo,hi,coord1,coord2;
int i,n;
double lo = 0.0, hi = 0.0;
double *boxlo,*boxhi,*prd;
double *boxlo,*boxhi;
boxlo = domain->boxlo;
boxhi = domain->boxhi;
prd = domain->prd;
if (originflag == LOWER) origin = boxlo[dir];
else if (originflag == UPPER) origin = boxhi[dir];

View File

@ -50,7 +50,6 @@ namespace LAMMPS_NS {
double **coord,**coordp;
double **values_local,**values_global;
int ndim;
double dt,nktv2p,ftm2v;
double area;
class NeighList *list;

View File

@ -108,8 +108,6 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) :
}
t_target=t_start;
const double kT = t_target * force->boltz / force->mvv2e;
// initialize Marsaglia RNG with processor-unique seed
// NB: this means runs will not be the same with different numbers of processors
@ -298,7 +296,7 @@ void FixFFL::ffl_integrate() {
}
void FixFFL::initial_integrate(int vflag) {
void FixFFL::initial_integrate(int /* vflag */) {
double dtfm;
// update v and x of atoms in group
@ -391,7 +389,7 @@ void FixFFL::final_integrate() {
}
/* ---------------------------------------------------------------------- */
void FixFFL::initial_integrate_respa(int vflag, int ilevel, int iloop) {
void FixFFL::initial_integrate_respa(int vflag, int ilevel, int /* iloop */) {
dtv = step_respa[ilevel];
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
@ -406,7 +404,7 @@ void FixFFL::initial_integrate_respa(int vflag, int ilevel, int iloop) {
}
}
void FixFFL::final_integrate_respa(int ilevel, int iloop) {
void FixFFL::final_integrate_respa(int ilevel, int /* iloop */) {
dtv = step_respa[ilevel];
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;

View File

@ -592,14 +592,13 @@ void FixFilterCorotate::pre_neighbor()
double c = (del2[0])*(del3[1]) - (del2[1])*(del3[0]);
int signum = sgn(a*(del1[0]) + b*(del1[1]) + c*(del1[2]));
if (fabs(signum)!= 1)
if (abs(signum) != 1)
error->all(FLERR,"Wrong orientation in cluster of size 4"
"in fix filter/corotate!");
clist_q0[i][8] *= signum;
clist_q0[i][11] *= signum;
} else if (N == 5)
{
} else if (N == 5) {
oxy = atom->map(shake_atom[m][0]);
atom1 = atom->map(shake_atom[m][1]);
atom2 = atom->map(shake_atom[m][2]);
@ -666,14 +665,12 @@ void FixFilterCorotate::pre_neighbor()
double c = (del2[0])*(del3[1]) - (del2[1])*(del3[0]);
int signum = sgn(a*(del1[0]) + b*(del1[1]) + c*(del1[2]));
if (fabs(signum)!= 1)
if (abs(signum)!= 1)
error->all(FLERR,"Wrong orientation in cluster of size 5"
"in fix filter/corotate!");
clist_q0[i][8] *= signum;
clist_q0[i][11] *= signum;
}
else
{
} else {
error->all(FLERR,"Fix filter/corotate cluster with size > 5"
"not yet configured...");
}

View File

@ -429,7 +429,7 @@ void AngleClass2P6::read_restart(FILE *fp)
void AngleClass2P6::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nangletypes; i++)
fprintf(fp,"%d %g %g %g %g\n",
fprintf(fp,"%d %g %g %g %g %g %g\n",
i,theta0[i]/MY_PI*180.0,k2[i],k3[i],k4[i],k5[i],k6[i]);
fprintf(fp,"\nBondBond Coeffs\n\n");

View File

@ -353,7 +353,7 @@ void AngleCosineBuck6d::read_restart(FILE *fp)
void AngleCosineBuck6d::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nangletypes; i++) {
fprintf(fp,"%d %g %d %d\n",i,k[i],multiplicity[i],th0[i]);
fprintf(fp,"%d %g %d %g\n",i,k[i],multiplicity[i],th0[i]);
}
}

View File

@ -241,8 +241,8 @@ void ImproperInversionHarmonic::invang(const int &i1,const int &i2,
f[i4][2] += f4[2];
}
double rb3x, rb3y, rb3z;
if (evflag)
if (evflag) {
double rb3x, rb3y, rb3z;
rb3x = vb1x - vb2x;
rb3y = vb1y - vb2y;
@ -252,6 +252,7 @@ void ImproperInversionHarmonic::invang(const int &i1,const int &i2,
vb3x,vb3y,vb3z,
vb2x,vb2y,vb2z,
rb3x,rb3y,rb3z);
}
}
/* ---------------------------------------------------------------------- */

View File

@ -83,7 +83,7 @@ void PairBuck6dCoulGaussDSF::compute(int eflag, int vflag)
double r,rsq,r2inv,r6inv,r14inv,rexp,forcecoul,forcebuck6d,factor_coul,factor_lj;
double term1,term2,term3,term4,term5;
double rcu,rqu,sme,smf,ebuck6d;
double prefactor,erfcc,erfcd,t,arg;
double prefactor,erfcc,erfcd,arg;
int *ilist,*jlist,*numneigh,**firstneigh;
evdwl = ecoul = 0.0;

View File

@ -85,7 +85,7 @@ void PairBuck6dCoulGaussLong::compute(int eflag, int vflag)
double grij,expm2,erf;
double term1,term2,term3,term4,term5;
double rcu,rqu,sme,smf,ebuck6d,ealpha;
double prefactor,erfa,expa,t,arg,falpha;
double prefactor,erfa,expa,arg,falpha;
int *ilist,*jlist,*numneigh,**firstneigh;
evdwl = ecoul = 0.0;

View File

@ -80,7 +80,9 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
if (nthreads < 1)
error->all(FLERR,"Illegal number of OpenMP threads requested");
#if defined(_OPENMP)
int reset_thr = 0;
#endif
if (nthreads != comm->nthreads) {
#if defined(_OPENMP)
reset_thr = 1;

View File

@ -185,6 +185,7 @@ static inline void loop_setup_thr(int &ifrom, int &ito, int &tid,
tid = 0;
ifrom = 0;
ito = inum;
nthreads = 1;
#endif
}

View File

@ -34,13 +34,14 @@
#include "modify.h"
#include "pair.h"
/*
Use statically linked C++ interface to plumed
*/
#define __PLUMED_WRAPPER_CXX 1
#include "plumed/wrapper/Plumed.h"
#if defined(__PLUMED_DEFAULT_KERNEL)
#define PLUMED_QUOTE_DIRECT(name) #name
#define PLUMED_QUOTE(macro) PLUMED_QUOTE_DIRECT(macro)
static char plumed_default_kernel[] = "PLUMED_KERNEL=" PLUMED_QUOTE(__PLUMED_DEFAULT_KERNEL);
#endif
/* -------------------------------------------------------------------- */
using namespace LAMMPS_NS;
@ -64,6 +65,11 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
error->warning(FLERR,"Fix group for fix plumed is not 'all'. "
"Group will be ignored.");
#if defined(__PLUMED_DEFAULT_KERNEL)
if (getenv("PLUMED_KERNEL") == NULL)
putenv(plumed_default_kernel);
#endif
p=new PLMD::Plumed;
// Check API version

View File

@ -66,7 +66,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
// chunk style and its args
int iarg;
int iarg = 0;
binflag = 0;
ncoord = 0;
@ -248,7 +248,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
iarg += 2;
} else if (strcmp(arg[iarg],"bound") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
int idim;
int idim = 0;
if (strcmp(arg[iarg+1],"x") == 0) idim = 0;
else if (strcmp(arg[iarg+1],"y") == 0) idim = 1;
else if (strcmp(arg[iarg+1],"z") == 0) idim = 2;

View File

@ -33,7 +33,7 @@ class ComputeDihedralLocal : public Compute {
double memory_usage();
private:
int nvalues,nvar,ncount,setflag,tflag;
int nvalues,nvar,ncount,setflag;
int pvar;
int *bstyle,*vvar;

View File

@ -54,7 +54,7 @@ void CreateBonds::command(int narg, char **arg)
int style;
int iarg;
int iarg = 0;
if (strcmp(arg[0],"many") == 0) {
style = MANY;
if (narg != 6) error->all(FLERR,"Illegal create_bonds command");

View File

@ -118,7 +118,7 @@ void DisplaceAtoms::command(int narg, char **arg)
if (style == RAMP) {
int d_dim;
int d_dim = 0;
if (strcmp(arg[2],"x") == 0) d_dim = 0;
else if (strcmp(arg[2],"y") == 0) d_dim = 1;
else if (strcmp(arg[2],"z") == 0) d_dim = 2;
@ -136,7 +136,7 @@ void DisplaceAtoms::command(int narg, char **arg)
d_hi = zscale*force->numeric(FLERR,arg[4]);
}
int coord_dim;
int coord_dim = 0;
if (strcmp(arg[5],"x") == 0) coord_dim = 0;
else if (strcmp(arg[5],"y") == 0) coord_dim = 1;
else if (strcmp(arg[5],"z") == 0) coord_dim = 2;

View File

@ -1290,7 +1290,7 @@ int DumpImage::modify_param(int narg, char **arg)
if (strcmp(arg[0],"amap") == 0) {
if (narg < 6) error->all(FLERR,"Illegal dump_modify command");
if (strlen(arg[3]) != 2) error->all(FLERR,"Illegal dump_modify command");
int factor;
int factor = 0;
if (arg[3][0] == 's') factor = 1;
else if (arg[3][0] == 'c') factor = 2;
else if (arg[3][0] == 'd') factor = 3;

View File

@ -802,7 +802,7 @@ void FixDeform::end_of_step()
// tilt_target can be large positive or large negative value
// add/subtract box lengths until tilt_target is closest to current value
int idenom;
int idenom = 0;
if (i == 5) idenom = 0;
else if (i == 4) idenom = 0;
else if (i == 3) idenom = 1;

View File

@ -68,7 +68,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
// parse args
int iarg;
int iarg = 0;
if (strcmp(arg[3],"linear") == 0) {
if (narg < 7) error->all(FLERR,"Illegal fix move command");

View File

@ -1138,7 +1138,7 @@ void Input::partition()
{
if (narg < 3) error->all(FLERR,"Illegal partition command");
int yesflag;
int yesflag = 0;
if (strcmp(arg[0],"yes") == 0) yesflag = 1;
else if (strcmp(arg[0],"no") == 0) yesflag = 0;
else error->all(FLERR,"Illegal partition command");

View File

@ -1248,7 +1248,7 @@ void ReadData::bonds(int firstpass)
int *count = NULL;
if (firstpass) {
memory->create(count,nlocal,"read_data:count");
for (int i = 0; i < nlocal; i++) count[i] = 0;
memset(count,0,nlocal*sizeof(int));
}
// read and process bonds
@ -1331,7 +1331,7 @@ void ReadData::angles(int firstpass)
int *count = NULL;
if (firstpass) {
memory->create(count,nlocal,"read_data:count");
for (int i = 0; i < nlocal; i++) count[i] = 0;
memset(count,0,nlocal*sizeof(int));
}
// read and process angles
@ -1414,7 +1414,7 @@ void ReadData::dihedrals(int firstpass)
int *count = NULL;
if (firstpass) {
memory->create(count,nlocal,"read_data:count");
for (int i = 0; i < nlocal; i++) count[i] = 0;
memset(count,0,nlocal*sizeof(int));
}
// read and process dihedrals
@ -1435,7 +1435,7 @@ void ReadData::dihedrals(int firstpass)
if (firstpass) {
int max = 0;
for (int i = 0; i < nlocal; i++) max = MAX(max,count[i]);
for (int i = nlocal_previous; i < nlocal; i++) max = MAX(max,count[i]);
int maxall;
MPI_Allreduce(&max,&maxall,1,MPI_INT,MPI_MAX,world);
if (addflag == NONE) maxall += atom->extra_dihedral_per_atom;
@ -1497,7 +1497,7 @@ void ReadData::impropers(int firstpass)
int *count = NULL;
if (firstpass) {
memory->create(count,nlocal,"read_data:count");
for (int i = 0; i < nlocal; i++) count[i] = 0;
memset(count,0,nlocal*sizeof(int));
}
// read and process impropers

View File

@ -924,11 +924,13 @@ void ReadRestart::header(int incompatible)
atom->extra_dihedral_per_atom = read_int();
} else if (flag == EXTRA_IMPROPER_PER_ATOM) {
atom->extra_improper_per_atom = read_int();
} else if (flag == EXTRA_SPECIAL_PER_ATOM) {
force->special_extra = read_int();
} else if (flag == ATOM_MAXSPECIAL) {
atom->maxspecial = read_int();
// for backward compatibility
} else if (flag == EXTRA_SPECIAL_PER_ATOM) {
force->special_extra = read_int();
} else error->all(FLERR,"Invalid flag in header section of restart file");
flag = read_int();

View File

@ -890,7 +890,7 @@ void Set::set(int keyword)
// enforce quat rotation vector in z dir for 2d systems
else if (keyword == QUAT) {
double *quat;
double *quat = NULL;
if (avec_ellipsoid && atom->ellipsoid[i] >= 0)
quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat;
else if (avec_tri && atom->tri[i] >= 0)

View File

@ -182,7 +182,7 @@ void Variable::set(int narg, char **arg)
if (find(arg[0]) >= 0) return;
if (nvar == maxvar) grow();
style[nvar] = LOOP;
int nfirst,nlast;
int nfirst = 0,nlast = 0;
if (narg == 3 || (narg == 4 && strcmp(arg[3],"pad") == 0)) {
nfirst = 1;
nlast = force->inumeric(FLERR,arg[2]);
@ -3983,7 +3983,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
strcmp(word,"max") == 0 || strcmp(word,"ave") == 0 ||
strcmp(word,"trap") == 0 || strcmp(word,"slope") == 0) {
int method;
int method = 0;
if (strcmp(word,"sum") == 0) method = SUM;
else if (strcmp(word,"min") == 0) method = XMIN;
else if (strcmp(word,"max") == 0) method = XMAX;

View File

@ -641,7 +641,7 @@ void Velocity::ramp(int /*narg*/, char **arg)
// parse args
int v_dim;
int v_dim = 0;
if (strcmp(arg[0],"vx") == 0) v_dim = 0;
else if (strcmp(arg[0],"vy") == 0) v_dim = 1;
else if (strcmp(arg[0],"vz") == 0) v_dim = 2;
@ -662,7 +662,7 @@ void Velocity::ramp(int /*narg*/, char **arg)
v_hi = zscale*force->numeric(FLERR,arg[2]);
}
int coord_dim;
int coord_dim = 0;
if (strcmp(arg[3],"x") == 0) coord_dim = 0;
else if (strcmp(arg[3],"y") == 0) coord_dim = 1;
else if (strcmp(arg[3],"z") == 0) coord_dim = 2;

View File

@ -1 +1 @@
#define LAMMPS_VERSION "9 Nov 2018"
#define LAMMPS_VERSION "15 Nov 2018"

View File

@ -45,7 +45,7 @@ void WriteDump::command(int narg, char **arg)
// create the Dump instance
// create dump command line with extra required args
Dump *dump;
Dump *dump = NULL;
char **dumpargs = new char*[modindex+2];
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id