mirror of https://github.com/lammps/lammps.git
Merge pull request #1180 from gtribello/master
Add natively supported PLUMED interface to LAMMPS
This commit is contained in:
commit
a6e9b99295
|
@ -171,8 +171,9 @@ set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR
|
||||||
USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||||
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD
|
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD
|
||||||
USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF
|
USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF
|
||||||
USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SCAFACOS USER-SMD USER-SMTBQ
|
USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC USER-SCAFACOS
|
||||||
USER-SPH USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM)
|
USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK USER-QUIP
|
||||||
|
USER-QMMM)
|
||||||
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
|
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
|
||||||
set(OTHER_PACKAGES CORESHELL QEQ)
|
set(OTHER_PACKAGES CORESHELL QEQ)
|
||||||
foreach(PKG ${DEFAULT_PACKAGES})
|
foreach(PKG ${DEFAULT_PACKAGES})
|
||||||
|
@ -528,6 +529,32 @@ if(PKG_USER-SCAFACOS)
|
||||||
include_directories(${SCAFACOS_INCLUDE_DIRS})
|
include_directories(${SCAFACOS_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(PKG_USER-PLUMED)
|
||||||
|
find_package(GSL REQUIRED)
|
||||||
|
option(DOWNLOAD_PLUMED "Download Plumed (instead of using the system's one)" OFF)
|
||||||
|
if(DOWNLOAD_PLUMED)
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(plumed_build
|
||||||
|
URL https://github.com/plumed/plumed2/releases/download/v2.4.3/plumed-src-2.4.3.tgz
|
||||||
|
URL_MD5 b1be7c48971627febc11c61b70767fc5
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||||
|
$<$<BOOL:${BUILD_SHARED_LIBS}>:--with-pic> )
|
||||||
|
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})
|
||||||
|
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)
|
||||||
|
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_LOAD})
|
||||||
|
endif()
|
||||||
|
include_directories(${PLUMED_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PKG_USER-MOLFILE)
|
if(PKG_USER-MOLFILE)
|
||||||
add_library(molfile INTERFACE)
|
add_library(molfile INTERFACE)
|
||||||
target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile)
|
target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile)
|
||||||
|
|
|
@ -41,6 +41,7 @@ This is the list of packages that may require additional steps.
|
||||||
"USER-ATC"_#user-atc,
|
"USER-ATC"_#user-atc,
|
||||||
"USER-AWPMD"_#user-awpmd,
|
"USER-AWPMD"_#user-awpmd,
|
||||||
"USER-COLVARS"_#user-colvars,
|
"USER-COLVARS"_#user-colvars,
|
||||||
|
"USER-PLUMED" _#user-plumed,
|
||||||
"USER-H5MD"_#user-h5md,
|
"USER-H5MD"_#user-h5md,
|
||||||
"USER-INTEL"_#user-intel,
|
"USER-INTEL"_#user-intel,
|
||||||
"USER-MOLFILE"_#user-molfile,
|
"USER-MOLFILE"_#user-molfile,
|
||||||
|
@ -712,6 +713,62 @@ a corresponding Makefile.lammps.machine file.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
USER-PLUMED package :h4,link(user-plumed)
|
||||||
|
|
||||||
|
[CMake build]:
|
||||||
|
|
||||||
|
[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:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
USER-H5MD package :h4,link(user-h5md)
|
USER-H5MD package :h4,link(user-h5md)
|
||||||
|
|
||||||
To build with this package you must have the HDF5 software package
|
To build with this package you must have the HDF5 software package
|
||||||
|
|
|
@ -1200,6 +1200,34 @@ examples/USER/colvars :ul
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
USER-PLUMED package :link(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.
|
||||||
|
|
||||||
|
[Authors:] The PLUMED library is written and maintained by
|
||||||
|
Massimilliano Bonomi, Giovanni Bussi, Carlo Camiloni and
|
||||||
|
Gareth Tribello.
|
||||||
|
|
||||||
|
[Install:]
|
||||||
|
|
||||||
|
This package has "specific installation
|
||||||
|
instructions"_Build_extras.html#gpu on the "Build
|
||||||
|
extras"_Build_extras.html doc page.
|
||||||
|
|
||||||
|
[Supporting info:]
|
||||||
|
|
||||||
|
src/USER-PLUMED/README
|
||||||
|
lib/plumed/README
|
||||||
|
"fix plumed "_fix_plumed.html
|
||||||
|
examples/USER/plumed :ul
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
USER-DIFFRACTION package :link(PKG-USER-DIFFRACTION),h4
|
USER-DIFFRACTION package :link(PKG-USER-DIFFRACTION),h4
|
||||||
|
|
||||||
[Contents:]
|
[Contents:]
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
|
||||||
|
|
||||||
|
:link(lws,http://lammps.sandia.gov)
|
||||||
|
:link(ld,Manual.html)
|
||||||
|
:link(lc,Commands_all.html)
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
|
fix plumed command :h3
|
||||||
|
|
||||||
|
[Syntax:]
|
||||||
|
|
||||||
|
fix ID group-ID plumed keyword value ... :pre
|
||||||
|
|
||||||
|
ID, group-ID are documented in "fix"_fix.html command :ulb,l
|
||||||
|
plumed = style name of this fix command :l
|
||||||
|
keyword = {plumedfile} or {outfile} :l
|
||||||
|
{plumedfile} arg = name of PLUMED input file to use (default: NULL)
|
||||||
|
{outfile} arg = name of file on which to write the PLUMED log (default: NULL) :pre
|
||||||
|
:ule
|
||||||
|
|
||||||
|
[Examples:]
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 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
|
||||||
|
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 {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
|
||||||
|
time. The plumed fix communicates the minimum amount of information
|
||||||
|
required and the PLUMED supports multiple, completely independent
|
||||||
|
collective variables, multiple independent biases and multiple
|
||||||
|
independent forms of analysis. There is thus really no restriction in
|
||||||
|
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.
|
||||||
|
|
||||||
|
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
|
||||||
|
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.
|
||||||
|
|
||||||
|
[Restart, fix_modify, output, run start/stop, minimize info:]
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The "fix_modify"_fix_modify.html {energy} option is not supported by
|
||||||
|
this fix.
|
||||||
|
|
||||||
|
Nothing is computed by this fix that can be accessed by any of the
|
||||||
|
"output commands"_Howto_output.html within LAMMPS. All the quantities
|
||||||
|
of interest can be output by commands that are native to PLUMED,
|
||||||
|
however.
|
||||||
|
|
||||||
|
[Restrictions:]
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
[Related commands:]
|
||||||
|
|
||||||
|
"fix smd"_fix_smd.html
|
||||||
|
"fix colvars"_fix_colvars.html
|
||||||
|
|
||||||
|
[Default:]
|
||||||
|
|
||||||
|
The default options are plumedfile = NULL and outfile = NULL
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
|
:link(PLUMED)
|
||||||
|
[(PLUMED)] G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
|
@ -117,6 +117,7 @@ Fixes :h1
|
||||||
fix_phonon
|
fix_phonon
|
||||||
fix_pimd
|
fix_pimd
|
||||||
fix_planeforce
|
fix_planeforce
|
||||||
|
fix_plumed
|
||||||
fix_poems
|
fix_poems
|
||||||
fix_pour
|
fix_pour
|
||||||
fix_precession_spin
|
fix_precession_spin
|
||||||
|
|
|
@ -337,6 +337,7 @@ fix_orient.html
|
||||||
fix_phonon.html
|
fix_phonon.html
|
||||||
fix_pimd.html
|
fix_pimd.html
|
||||||
fix_planeforce.html
|
fix_planeforce.html
|
||||||
|
fix_plumed.html
|
||||||
fix_poems.html
|
fix_poems.html
|
||||||
fix_pour.html
|
fix_pour.html
|
||||||
fix_precession_spin.html
|
fix_precession_spin.html
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
||||||
|
# Solvated 5-mer peptide
|
||||||
|
|
||||||
|
units real
|
||||||
|
atom_style full
|
||||||
|
|
||||||
|
pair_style lj/charmm/coul/long 8.0 10.0 10.0
|
||||||
|
bond_style harmonic
|
||||||
|
angle_style charmm
|
||||||
|
dihedral_style charmm
|
||||||
|
improper_style harmonic
|
||||||
|
kspace_style pppm 0.0001
|
||||||
|
|
||||||
|
read_data data.peptide
|
||||||
|
|
||||||
|
neighbor 2.0 bin
|
||||||
|
neigh_modify delay 5
|
||||||
|
|
||||||
|
timestep 2.0
|
||||||
|
|
||||||
|
group peptide type <= 12
|
||||||
|
group one id 2 4 5 6
|
||||||
|
group two id 80 82 83 84
|
||||||
|
group ref id 37
|
||||||
|
group colvar union one two ref
|
||||||
|
|
||||||
|
fix 1 all nvt temp 275.0 275.0 100.0 tchain 1
|
||||||
|
|
||||||
|
fix 2 all plumed plumedfile plumed.dat outfile p.log
|
||||||
|
fix 2a ref setforce 0.0 0.0 0.0
|
||||||
|
|
||||||
|
fix 4 all shake 0.0001 10 100 b 4 6 8 10 12 14 18 a 31
|
||||||
|
|
||||||
|
#dump 1 colvar custom 1 dump.colvar.lammpstrj id xu yu zu fx fy fz
|
||||||
|
#dump_modify 1 sort id
|
||||||
|
|
||||||
|
thermo_style custom step temp etotal pe ke epair ebond f_2
|
||||||
|
thermo 10
|
||||||
|
variable step equal step
|
||||||
|
variable pe equal pe
|
||||||
|
|
||||||
|
run 101
|
|
@ -0,0 +1,162 @@
|
||||||
|
LAMMPS (24 Oct 2018)
|
||||||
|
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:87)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
# Solvated 5-mer peptide
|
||||||
|
|
||||||
|
units real
|
||||||
|
atom_style full
|
||||||
|
|
||||||
|
pair_style lj/charmm/coul/long 8.0 10.0 10.0
|
||||||
|
bond_style harmonic
|
||||||
|
angle_style charmm
|
||||||
|
dihedral_style charmm
|
||||||
|
improper_style harmonic
|
||||||
|
kspace_style pppm 0.0001
|
||||||
|
|
||||||
|
read_data data.peptide
|
||||||
|
orthogonal box = (36.8402 41.0137 29.7681) to (64.2116 68.3851 57.1395)
|
||||||
|
1 by 1 by 1 MPI processor grid
|
||||||
|
reading atoms ...
|
||||||
|
2004 atoms
|
||||||
|
reading velocities ...
|
||||||
|
2004 velocities
|
||||||
|
scanning bonds ...
|
||||||
|
3 = max bonds/atom
|
||||||
|
scanning angles ...
|
||||||
|
6 = max angles/atom
|
||||||
|
scanning dihedrals ...
|
||||||
|
14 = max dihedrals/atom
|
||||||
|
scanning impropers ...
|
||||||
|
1 = max impropers/atom
|
||||||
|
reading bonds ...
|
||||||
|
1365 bonds
|
||||||
|
reading angles ...
|
||||||
|
786 angles
|
||||||
|
reading dihedrals ...
|
||||||
|
207 dihedrals
|
||||||
|
reading impropers ...
|
||||||
|
12 impropers
|
||||||
|
4 = max # of 1-2 neighbors
|
||||||
|
7 = max # of 1-3 neighbors
|
||||||
|
14 = max # of 1-4 neighbors
|
||||||
|
18 = max # of special neighbors
|
||||||
|
|
||||||
|
neighbor 2.0 bin
|
||||||
|
neigh_modify delay 5
|
||||||
|
|
||||||
|
timestep 2.0
|
||||||
|
|
||||||
|
group peptide type <= 12
|
||||||
|
84 atoms in group peptide
|
||||||
|
group one id 2 4 5 6
|
||||||
|
4 atoms in group one
|
||||||
|
group two id 80 82 83 84
|
||||||
|
4 atoms in group two
|
||||||
|
group ref id 37
|
||||||
|
1 atoms in group ref
|
||||||
|
group colvar union one two ref
|
||||||
|
9 atoms in group colvar
|
||||||
|
|
||||||
|
fix 1 all nvt temp 275.0 275.0 100.0 tchain 1
|
||||||
|
|
||||||
|
fix 2 all plumed plumedfile plumed.dat outfile p.log
|
||||||
|
fix 2a ref setforce 0.0 0.0 0.0
|
||||||
|
|
||||||
|
fix 4 all shake 0.0001 10 100 b 4 6 8 10 12 14 18 a 31
|
||||||
|
19 = # of size 2 clusters
|
||||||
|
6 = # of size 3 clusters
|
||||||
|
3 = # of size 4 clusters
|
||||||
|
640 = # of frozen angles
|
||||||
|
|
||||||
|
#dump 1 colvar custom 1 dump.colvar.lammpstrj id xu yu zu fx fy fz
|
||||||
|
#dump_modify 1 sort id
|
||||||
|
|
||||||
|
thermo_style custom step temp etotal pe ke epair ebond f_2
|
||||||
|
thermo 10
|
||||||
|
variable step equal step
|
||||||
|
variable pe equal pe
|
||||||
|
|
||||||
|
run 101
|
||||||
|
PPPM initialization ...
|
||||||
|
using 12-bit tables for long-range coulomb (../kspace.cpp:321)
|
||||||
|
G vector (1/distance) = 0.268725
|
||||||
|
grid = 15 15 15
|
||||||
|
stencil order = 5
|
||||||
|
estimated absolute RMS force accuracy = 0.0228209
|
||||||
|
estimated relative force accuracy = 6.87243e-05
|
||||||
|
using double precision FFTs
|
||||||
|
3d grid and FFT values/proc = 10648 3375
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 1 steps, delay 5 steps, check yes
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 12
|
||||||
|
ghost atom cutoff = 12
|
||||||
|
binsize = 6, bins = 5 5 5
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/charmm/coul/long, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
SHAKE stats (type/ave/delta) on step 0
|
||||||
|
4 1.111 1.44264e-05
|
||||||
|
6 0.996998 7.26967e-06
|
||||||
|
8 1.08 1.32536e-05
|
||||||
|
10 1.111 1.22749e-05
|
||||||
|
12 1.08 1.11767e-05
|
||||||
|
14 0.96 0
|
||||||
|
18 0.957206 4.37979e-05
|
||||||
|
31 104.519 0.00396029
|
||||||
|
Per MPI rank memory allocation (min/avg/max) = 18.7 | 18.7 | 18.7 Mbytes
|
||||||
|
Step Temp TotEng PotEng KinEng E_pair E_bond f_2
|
||||||
|
0 282.10052 -5237.458 -6372.3766 1134.9186 -6442.768 16.557152 0
|
||||||
|
10 276.9783 -5234.3057 -6348.6171 1114.3114 -6421.6171 17.024361 0.47785504
|
||||||
|
20 279.08532 -5226.4036 -6349.1917 1122.7881 -6441.0169 20.764378 0.52605302
|
||||||
|
30 282.32141 -5222.3866 -6358.1939 1135.8073 -6448.9785 22.945165 0.65106011
|
||||||
|
40 276.34173 -5218.7623 -6330.5128 1111.7504 -6423.7566 15.655345 0.23795099
|
||||||
|
50 286.12741 -5215.9248 -6367.0439 1151.1192 -6449.2655 17.420975 0.42646205
|
||||||
|
60 273.01449 -5217.7381 -6316.1026 1098.3646 -6406.4709 21.800931 0.92327815
|
||||||
|
70 274.67549 -5221.0246 -6326.0716 1105.047 -6409.7721 19.41235 0.0016975896
|
||||||
|
80 273.74824 -5224.7613 -6326.0778 1101.3165 -6418.5055 19.206793 0.48550348
|
||||||
|
90 284.32594 -5229.195 -6373.0667 1143.8717 -6461.3467 21.124789 0.5468014
|
||||||
|
SHAKE stats (type/ave/delta) on step 100
|
||||||
|
4 1.111 2.06868e-06
|
||||||
|
6 0.996999 2.09521e-06
|
||||||
|
8 1.08 1.10835e-06
|
||||||
|
10 1.111 2.46599e-06
|
||||||
|
12 1.08 8.86314e-07
|
||||||
|
14 0.959999 0
|
||||||
|
18 0.9572 9.14098e-06
|
||||||
|
31 104.52 0.000760401
|
||||||
|
100 270.40648 -5234.9604 -6322.8327 1087.8723 -6417.73 19.666404 0.0094784372
|
||||||
|
101 270.99811 -5235.8295 -6326.082 1090.2525 -6418.8974 17.285816 0.086681332
|
||||||
|
Loop time of 2.12948 on 1 procs for 101 steps with 2004 atoms
|
||||||
|
|
||||||
|
Performance: 8.196 ns/day, 2.928 hours/ns, 47.429 timesteps/s
|
||||||
|
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||||
|
|
||||||
|
MPI task timing breakdown:
|
||||||
|
Section | min time | avg time | max time |%varavg| %total
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Pair | 1.757 | 1.757 | 1.757 | 0.0 | 82.51
|
||||||
|
Bond | 0.0052233 | 0.0052233 | 0.0052233 | 0.0 | 0.25
|
||||||
|
Kspace | 0.14772 | 0.14772 | 0.14772 | 0.0 | 6.94
|
||||||
|
Neigh | 0.16455 | 0.16455 | 0.16455 | 0.0 | 7.73
|
||||||
|
Comm | 0.0083704 | 0.0083704 | 0.0083704 | 0.0 | 0.39
|
||||||
|
Output | 0.00031424 | 0.00031424 | 0.00031424 | 0.0 | 0.01
|
||||||
|
Modify | 0.044411 | 0.044411 | 0.044411 | 0.0 | 2.09
|
||||||
|
Other | | 0.001851 | | | 0.09
|
||||||
|
|
||||||
|
Nlocal: 2004 ave 2004 max 2004 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Nghost: 11134 ave 11134 max 11134 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
Neighs: 707961 ave 707961 max 707961 min
|
||||||
|
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
Total # of neighbors = 707961
|
||||||
|
Ave neighs/atom = 353.274
|
||||||
|
Ave special neighs/atom = 2.34032
|
||||||
|
Neighbor list builds = 8
|
||||||
|
Dangerous builds = 0
|
||||||
|
Total wall time: 0:00:02
|
|
@ -0,0 +1,162 @@
|
||||||
|
LAMMPS (24 Oct 2018)
|
||||||
|
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:87)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
# Solvated 5-mer peptide
|
||||||
|
|
||||||
|
units real
|
||||||
|
atom_style full
|
||||||
|
|
||||||
|
pair_style lj/charmm/coul/long 8.0 10.0 10.0
|
||||||
|
bond_style harmonic
|
||||||
|
angle_style charmm
|
||||||
|
dihedral_style charmm
|
||||||
|
improper_style harmonic
|
||||||
|
kspace_style pppm 0.0001
|
||||||
|
|
||||||
|
read_data data.peptide
|
||||||
|
orthogonal box = (36.8402 41.0137 29.7681) to (64.2116 68.3851 57.1395)
|
||||||
|
1 by 2 by 2 MPI processor grid
|
||||||
|
reading atoms ...
|
||||||
|
2004 atoms
|
||||||
|
reading velocities ...
|
||||||
|
2004 velocities
|
||||||
|
scanning bonds ...
|
||||||
|
3 = max bonds/atom
|
||||||
|
scanning angles ...
|
||||||
|
6 = max angles/atom
|
||||||
|
scanning dihedrals ...
|
||||||
|
14 = max dihedrals/atom
|
||||||
|
scanning impropers ...
|
||||||
|
1 = max impropers/atom
|
||||||
|
reading bonds ...
|
||||||
|
1365 bonds
|
||||||
|
reading angles ...
|
||||||
|
786 angles
|
||||||
|
reading dihedrals ...
|
||||||
|
207 dihedrals
|
||||||
|
reading impropers ...
|
||||||
|
12 impropers
|
||||||
|
4 = max # of 1-2 neighbors
|
||||||
|
7 = max # of 1-3 neighbors
|
||||||
|
14 = max # of 1-4 neighbors
|
||||||
|
18 = max # of special neighbors
|
||||||
|
|
||||||
|
neighbor 2.0 bin
|
||||||
|
neigh_modify delay 5
|
||||||
|
|
||||||
|
timestep 2.0
|
||||||
|
|
||||||
|
group peptide type <= 12
|
||||||
|
84 atoms in group peptide
|
||||||
|
group one id 2 4 5 6
|
||||||
|
4 atoms in group one
|
||||||
|
group two id 80 82 83 84
|
||||||
|
4 atoms in group two
|
||||||
|
group ref id 37
|
||||||
|
1 atoms in group ref
|
||||||
|
group colvar union one two ref
|
||||||
|
9 atoms in group colvar
|
||||||
|
|
||||||
|
fix 1 all nvt temp 275.0 275.0 100.0 tchain 1
|
||||||
|
|
||||||
|
fix 2 all plumed plumedfile plumed.dat outfile p.log
|
||||||
|
fix 2a ref setforce 0.0 0.0 0.0
|
||||||
|
|
||||||
|
fix 4 all shake 0.0001 10 100 b 4 6 8 10 12 14 18 a 31
|
||||||
|
19 = # of size 2 clusters
|
||||||
|
6 = # of size 3 clusters
|
||||||
|
3 = # of size 4 clusters
|
||||||
|
640 = # of frozen angles
|
||||||
|
|
||||||
|
#dump 1 colvar custom 1 dump.colvar.lammpstrj id xu yu zu fx fy fz
|
||||||
|
#dump_modify 1 sort id
|
||||||
|
|
||||||
|
thermo_style custom step temp etotal pe ke epair ebond f_2
|
||||||
|
thermo 10
|
||||||
|
variable step equal step
|
||||||
|
variable pe equal pe
|
||||||
|
|
||||||
|
run 101
|
||||||
|
PPPM initialization ...
|
||||||
|
using 12-bit tables for long-range coulomb (../kspace.cpp:321)
|
||||||
|
G vector (1/distance) = 0.268725
|
||||||
|
grid = 15 15 15
|
||||||
|
stencil order = 5
|
||||||
|
estimated absolute RMS force accuracy = 0.0228209
|
||||||
|
estimated relative force accuracy = 6.87243e-05
|
||||||
|
using double precision FFTs
|
||||||
|
3d grid and FFT values/proc = 4312 960
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 1 steps, delay 5 steps, check yes
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 12
|
||||||
|
ghost atom cutoff = 12
|
||||||
|
binsize = 6, bins = 5 5 5
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/charmm/coul/long, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
SHAKE stats (type/ave/delta) on step 0
|
||||||
|
4 1.111 1.44264e-05
|
||||||
|
6 0.996998 7.26967e-06
|
||||||
|
8 1.08 1.32536e-05
|
||||||
|
10 1.111 1.22749e-05
|
||||||
|
12 1.08 1.11767e-05
|
||||||
|
14 0.96 0
|
||||||
|
18 0.957206 4.37979e-05
|
||||||
|
31 104.519 0.00396029
|
||||||
|
Per MPI rank memory allocation (min/avg/max) = 15.65 | 15.86 | 16.05 Mbytes
|
||||||
|
Step Temp TotEng PotEng KinEng E_pair E_bond f_2
|
||||||
|
0 282.10052 -5237.458 -6372.3766 1134.9186 -6442.768 16.557152 0
|
||||||
|
10 276.9783 -5234.3057 -6348.6171 1114.3114 -6421.6171 17.024361 0.47785504
|
||||||
|
20 279.08532 -5226.4036 -6349.1917 1122.7881 -6441.0169 20.764378 0.52605302
|
||||||
|
30 282.32141 -5222.3866 -6358.1939 1135.8073 -6448.9785 22.945165 0.65106011
|
||||||
|
40 276.34173 -5218.7623 -6330.5128 1111.7504 -6423.7566 15.655345 0.23795099
|
||||||
|
50 286.12741 -5215.9248 -6367.0439 1151.1192 -6449.2655 17.420975 0.42646205
|
||||||
|
60 273.01449 -5217.7381 -6316.1026 1098.3646 -6406.4709 21.800931 0.92327815
|
||||||
|
70 274.67549 -5221.0246 -6326.0716 1105.047 -6409.7721 19.41235 0.0016975896
|
||||||
|
80 273.74824 -5224.7613 -6326.0778 1101.3165 -6418.5055 19.206793 0.48550348
|
||||||
|
90 284.32594 -5229.195 -6373.0667 1143.8717 -6461.3466 21.124789 0.5468014
|
||||||
|
SHAKE stats (type/ave/delta) on step 100
|
||||||
|
4 1.111 2.06868e-06
|
||||||
|
6 0.996999 2.09521e-06
|
||||||
|
8 1.08 1.10835e-06
|
||||||
|
10 1.111 2.46599e-06
|
||||||
|
12 1.08 8.86314e-07
|
||||||
|
14 0.959999 0
|
||||||
|
18 0.9572 9.14098e-06
|
||||||
|
31 104.52 0.000760401
|
||||||
|
100 270.40648 -5234.9604 -6322.8327 1087.8723 -6417.73 19.666404 0.009478437
|
||||||
|
101 270.99811 -5235.8295 -6326.082 1090.2525 -6418.8974 17.285816 0.086681332
|
||||||
|
Loop time of 1.16767 on 4 procs for 101 steps with 2004 atoms
|
||||||
|
|
||||||
|
Performance: 14.947 ns/day, 1.606 hours/ns, 86.497 timesteps/s
|
||||||
|
97.8% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||||
|
|
||||||
|
MPI task timing breakdown:
|
||||||
|
Section | min time | avg time | max time |%varavg| %total
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Pair | 0.84633 | 0.86651 | 0.88617 | 1.6 | 74.21
|
||||||
|
Bond | 0.0010614 | 0.0027132 | 0.004288 | 3.0 | 0.23
|
||||||
|
Kspace | 0.095008 | 0.1162 | 0.13491 | 4.3 | 9.95
|
||||||
|
Neigh | 0.07834 | 0.078424 | 0.078516 | 0.0 | 6.72
|
||||||
|
Comm | 0.03314 | 0.033299 | 0.033426 | 0.1 | 2.85
|
||||||
|
Output | 0.00036979 | 0.00076199 | 0.0019338 | 0.0 | 0.07
|
||||||
|
Modify | 0.063471 | 0.064011 | 0.065312 | 0.3 | 5.48
|
||||||
|
Other | | 0.005751 | | | 0.49
|
||||||
|
|
||||||
|
Nlocal: 501 ave 512 max 492 min
|
||||||
|
Histogram: 1 0 0 1 0 1 0 0 0 1
|
||||||
|
Nghost: 6570.25 ave 6604 max 6529 min
|
||||||
|
Histogram: 1 0 0 1 0 0 0 0 1 1
|
||||||
|
Neighs: 176990 ave 181122 max 173551 min
|
||||||
|
Histogram: 1 1 0 0 0 0 1 0 0 1
|
||||||
|
|
||||||
|
Total # of neighbors = 707961
|
||||||
|
Ave neighs/atom = 353.274
|
||||||
|
Ave special neighs/atom = 2.34032
|
||||||
|
Neighbor list builds = 8
|
||||||
|
Dangerous builds = 0
|
||||||
|
Total wall time: 0:00:01
|
|
@ -0,0 +1,4 @@
|
||||||
|
UNITS LENGTH=A ENERGY=kcal/mol
|
||||||
|
dd: DISTANCE ATOMS=45,48
|
||||||
|
RESTRAINT ARG=dd KAPPA=2000 AT=6.0
|
||||||
|
PRINT ARG=dd FILE=colvar
|
|
@ -0,0 +1,103 @@
|
||||||
|
#! FIELDS time dd
|
||||||
|
0.000000 5.985554
|
||||||
|
0.002000 6.002880
|
||||||
|
0.004000 6.022015
|
||||||
|
0.006000 6.029922
|
||||||
|
0.008000 6.020103
|
||||||
|
0.010000 5.996906
|
||||||
|
0.012000 5.972734
|
||||||
|
0.014000 5.960079
|
||||||
|
0.016000 5.963714
|
||||||
|
0.018000 5.978140
|
||||||
|
0.020000 5.991813
|
||||||
|
0.022000 5.995155
|
||||||
|
0.024000 5.987021
|
||||||
|
0.026000 5.975340
|
||||||
|
0.028000 5.971456
|
||||||
|
0.030000 5.981945
|
||||||
|
0.032000 6.003550
|
||||||
|
0.034000 6.024743
|
||||||
|
0.036000 6.032990
|
||||||
|
0.038000 6.022936
|
||||||
|
0.040000 6.000131
|
||||||
|
0.042000 5.977800
|
||||||
|
0.044000 5.968692
|
||||||
|
0.046000 5.977224
|
||||||
|
0.048000 5.996934
|
||||||
|
0.050000 6.014800
|
||||||
|
0.052000 6.019586
|
||||||
|
0.054000 6.008803
|
||||||
|
0.056000 5.989809
|
||||||
|
0.058000 5.974484
|
||||||
|
0.060000 5.971140
|
||||||
|
0.062000 5.979074
|
||||||
|
0.064000 5.989379
|
||||||
|
0.066000 5.991356
|
||||||
|
0.068000 5.980176
|
||||||
|
0.070000 5.960625
|
||||||
|
0.072000 5.944401
|
||||||
|
0.074000 5.942614
|
||||||
|
0.076000 5.958402
|
||||||
|
0.078000 5.984574
|
||||||
|
0.080000 6.007964
|
||||||
|
0.082000 6.017667
|
||||||
|
0.084000 6.011795
|
||||||
|
0.086000 5.998304
|
||||||
|
0.088000 5.989405
|
||||||
|
0.090000 5.993275
|
||||||
|
0.092000 6.008545
|
||||||
|
0.094000 6.025183
|
||||||
|
0.096000 6.031186
|
||||||
|
0.098000 6.020651
|
||||||
|
0.100000 5.997952
|
||||||
|
0.102000 5.975230
|
||||||
|
0.104000 5.964757
|
||||||
|
0.106000 5.971150
|
||||||
|
0.108000 5.988568
|
||||||
|
0.110000 6.004676
|
||||||
|
0.112000 6.008731
|
||||||
|
0.114000 5.998481
|
||||||
|
0.116000 5.981406
|
||||||
|
0.118000 5.969615
|
||||||
|
0.120000 5.971827
|
||||||
|
0.122000 5.987658
|
||||||
|
0.124000 6.007888
|
||||||
|
0.126000 6.020477
|
||||||
|
0.128000 6.018377
|
||||||
|
0.130000 6.004046
|
||||||
|
0.132000 5.987682
|
||||||
|
0.134000 5.980338
|
||||||
|
0.136000 5.986534
|
||||||
|
0.138000 6.001303
|
||||||
|
0.140000 6.013589
|
||||||
|
0.142000 6.013717
|
||||||
|
0.144000 6.000028
|
||||||
|
0.146000 5.980283
|
||||||
|
0.148000 5.966836
|
||||||
|
0.150000 5.968670
|
||||||
|
0.152000 5.985459
|
||||||
|
0.154000 6.007612
|
||||||
|
0.156000 6.022374
|
||||||
|
0.158000 6.022034
|
||||||
|
0.160000 6.008851
|
||||||
|
0.162000 5.993355
|
||||||
|
0.164000 5.987212
|
||||||
|
0.166000 5.995452
|
||||||
|
0.168000 6.013111
|
||||||
|
0.170000 6.028386
|
||||||
|
0.172000 6.030387
|
||||||
|
0.174000 6.016468
|
||||||
|
0.176000 5.994191
|
||||||
|
0.178000 5.976616
|
||||||
|
0.180000 5.973983
|
||||||
|
0.182000 5.987185
|
||||||
|
0.184000 6.007275
|
||||||
|
0.186000 6.021338
|
||||||
|
0.188000 6.020837
|
||||||
|
0.190000 6.006955
|
||||||
|
0.192000 5.989433
|
||||||
|
0.194000 5.979796
|
||||||
|
0.196000 5.983601
|
||||||
|
0.198000 5.996921
|
||||||
|
0.200000 6.009310
|
||||||
|
0.202000 6.011114
|
|
@ -0,0 +1,57 @@
|
||||||
|
PLUMED: PLUMED is starting
|
||||||
|
PLUMED: Version: 2.4.2 (git: Unknown) compiled on Jul 11 2018 at 19:09:03
|
||||||
|
PLUMED: Please cite this paper when using PLUMED [1]
|
||||||
|
PLUMED: For further information see the PLUMED web page at http://www.plumed.org
|
||||||
|
PLUMED: Root: /Users/gareth/MD_code/lammps-permanent/lammps/lib/plumed/plumed2-2.4.2/
|
||||||
|
PLUMED: For installed feature, see /Users/gareth/MD_code/lammps-permanent/lammps/lib/plumed/plumed2-2.4.2//src/config/config.txt
|
||||||
|
PLUMED: Molecular dynamics engine: LAMMPS
|
||||||
|
PLUMED: Precision of reals: 8
|
||||||
|
PLUMED: Running over 1 node
|
||||||
|
PLUMED: Number of threads: 1
|
||||||
|
PLUMED: Cache line size: 512
|
||||||
|
PLUMED: Number of atoms: 2004
|
||||||
|
PLUMED: File suffix:
|
||||||
|
PLUMED: FILE: plumed.dat
|
||||||
|
PLUMED: Action UNITS
|
||||||
|
PLUMED: with label @0
|
||||||
|
PLUMED: length: A
|
||||||
|
PLUMED: energy: kcal/mol
|
||||||
|
PLUMED: time: ps
|
||||||
|
PLUMED: charge: e
|
||||||
|
PLUMED: mass: amu
|
||||||
|
PLUMED: using physical units
|
||||||
|
PLUMED: inside PLUMED, Boltzmann constant is 0.001987
|
||||||
|
PLUMED: Action DISTANCE
|
||||||
|
PLUMED: with label dd
|
||||||
|
PLUMED: between atoms 45 48
|
||||||
|
PLUMED: using periodic boundary conditions
|
||||||
|
PLUMED: Action RESTRAINT
|
||||||
|
PLUMED: with label @2
|
||||||
|
PLUMED: with arguments dd
|
||||||
|
PLUMED: added component to this action: @2.bias
|
||||||
|
PLUMED: at 6.000000
|
||||||
|
PLUMED: with harmonic force constant 2000.000000
|
||||||
|
PLUMED: and linear force constant 0.000000
|
||||||
|
PLUMED: added component to this action: @2.force2
|
||||||
|
PLUMED: Action PRINT
|
||||||
|
PLUMED: with label @3
|
||||||
|
PLUMED: with stride 1
|
||||||
|
PLUMED: with arguments dd
|
||||||
|
PLUMED: on file colvar
|
||||||
|
PLUMED: with format %f
|
||||||
|
PLUMED: END FILE: plumed.dat
|
||||||
|
PLUMED: Timestep: 0.002000
|
||||||
|
PLUMED: KbT has not been set by the MD engine
|
||||||
|
PLUMED: It should be set by hand where needed
|
||||||
|
PLUMED: Relevant bibliography:
|
||||||
|
PLUMED: [1] Tribello, Bonomi, Branduardi, Camilloni, and Bussi, Comput. Phys. Commun. 185, 604 (2014)
|
||||||
|
PLUMED: Please read and cite where appropriate!
|
||||||
|
PLUMED: Finished setup
|
||||||
|
PLUMED: Cycles Total Average Minumum Maximum
|
||||||
|
PLUMED: 1 0.020354 0.020354 0.020354 0.020354
|
||||||
|
PLUMED: 1 Prepare dependencies 102 0.000256 0.000003 0.000001 0.000006
|
||||||
|
PLUMED: 2 Sharing data 102 0.010002 0.000098 0.000078 0.000546
|
||||||
|
PLUMED: 3 Waiting for data 102 0.001398 0.000014 0.000011 0.000072
|
||||||
|
PLUMED: 4 Calculating (forward loop) 102 0.001797 0.000018 0.000013 0.000058
|
||||||
|
PLUMED: 5 Applying (backward loop) 102 0.002666 0.000026 0.000022 0.000062
|
||||||
|
PLUMED: 6 Update 102 0.001126 0.000011 0.000007 0.000055
|
|
@ -0,0 +1,4 @@
|
||||||
|
/plumed2*
|
||||||
|
/includelink
|
||||||
|
/liblink
|
||||||
|
/plumed-*
|
|
@ -0,0 +1,206 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Install.py tool to download, unpack, build, and link to the plumed2 library
|
||||||
|
# used to automate the steps described in the README file in this dir
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
import sys,os,re,subprocess,hashlib
|
||||||
|
|
||||||
|
# help message
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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
|
||||||
|
"""
|
||||||
|
|
||||||
|
# settings
|
||||||
|
|
||||||
|
version = "2.4.3"
|
||||||
|
|
||||||
|
# known checksums for different PLUMED versions. used to validate the download.
|
||||||
|
checksums = { \
|
||||||
|
'2.4.2' : '88188743a6e03ef076e5377d03ebb0e7', \
|
||||||
|
'2.4.3' : 'b1be7c48971627febc11c61b70767fc5', \
|
||||||
|
'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)
|
||||||
|
else: print("ERROR",str)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
# expand to full path name
|
||||||
|
# process leading '~' or relative path
|
||||||
|
|
||||||
|
def fullpath(path):
|
||||||
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
def which(program):
|
||||||
|
def is_exe(fpath):
|
||||||
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
|
fpath, fname = os.path.split(program)
|
||||||
|
if fpath:
|
||||||
|
if is_exe(program):
|
||||||
|
return program
|
||||||
|
else:
|
||||||
|
for path in os.environ["PATH"].split(os.pathsep):
|
||||||
|
path = path.strip('"')
|
||||||
|
exe_file = os.path.join(path, program)
|
||||||
|
if is_exe(exe_file):
|
||||||
|
return exe_file
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def geturl(url,fname):
|
||||||
|
success = False
|
||||||
|
|
||||||
|
if which('curl') != None:
|
||||||
|
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||||
|
try:
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
success = True
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Calling curl failed with: %s" % e.output.decode('UTF-8'))
|
||||||
|
|
||||||
|
if not success and which('wget') != None:
|
||||||
|
cmd = 'wget -O "%s" %s' % (fname,url)
|
||||||
|
try:
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
success = True
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Calling wget failed with: %s" % e.output.decode('UTF-8'))
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
error("Failed to download source code with 'curl' or 'wget'")
|
||||||
|
return
|
||||||
|
|
||||||
|
def checkmd5sum(md5sum,fname):
|
||||||
|
with open(fname,'rb') as fh:
|
||||||
|
m = hashlib.md5()
|
||||||
|
while True:
|
||||||
|
data = fh.read(81920)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
m.update(data)
|
||||||
|
fh.close()
|
||||||
|
return m.hexdigest() == md5sum
|
||||||
|
|
||||||
|
# parse args
|
||||||
|
|
||||||
|
args = sys.argv[1:]
|
||||||
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
|
homepath = "."
|
||||||
|
|
||||||
|
buildflag = False
|
||||||
|
pathflag = False
|
||||||
|
suffixflag = False
|
||||||
|
linkflag = True
|
||||||
|
|
||||||
|
iarg = 0
|
||||||
|
while iarg < nargs:
|
||||||
|
if args[iarg] == "-v":
|
||||||
|
if iarg+2 > nargs: error()
|
||||||
|
version = args[iarg+1]
|
||||||
|
iarg += 2
|
||||||
|
elif args[iarg] == "-p":
|
||||||
|
if iarg+2 > nargs: error()
|
||||||
|
plumedpath = fullpath(args[iarg+1])
|
||||||
|
pathflag = True
|
||||||
|
iarg += 2
|
||||||
|
elif args[iarg] == "-b":
|
||||||
|
buildflag = True
|
||||||
|
iarg += 1
|
||||||
|
else: error()
|
||||||
|
|
||||||
|
homepath = fullpath(homepath)
|
||||||
|
|
||||||
|
if (pathflag):
|
||||||
|
if not os.path.isdir(plumedpath): error("Plumed2 path does not exist")
|
||||||
|
homedir = plumedpath
|
||||||
|
|
||||||
|
if (buildflag and pathflag):
|
||||||
|
error("Cannot use -b and -p flag at the same time")
|
||||||
|
|
||||||
|
if (not buildflag and not pathflag):
|
||||||
|
error("Have to use either -b or -p flag")
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
# verify downloaded archive integrity via md5 checksum, if known.
|
||||||
|
if version in checksums:
|
||||||
|
if not checkmd5sum(checksums[version],filename):
|
||||||
|
error("Checksum for plumed2 library does not match")
|
||||||
|
|
||||||
|
print("Unpacking plumed2 source tarball ...")
|
||||||
|
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)
|
||||||
|
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,filename)
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
os.remove("%s/%s" % (homepath,filename))
|
||||||
|
|
||||||
|
# build plumed
|
||||||
|
|
||||||
|
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'))
|
||||||
|
#
|
||||||
|
# create 2 links in lib/plumed to plumed2 installation dir
|
||||||
|
|
||||||
|
if linkflag:
|
||||||
|
print("Creating links to plumed2 include and lib files")
|
||||||
|
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
||||||
|
os.remove("includelink")
|
||||||
|
if os.path.isfile("liblink") or os.path.islink("liblink"):
|
||||||
|
os.remove("liblink")
|
||||||
|
cmd = 'ln -s "%s/plumed2/include" includelink' % homepath
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
cmd = 'ln -s "%s/plumed2/lib" liblink' % homepath
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
if os.path.isfile("Makefile.lammps.static"):
|
||||||
|
print("Creating Makefile.lammps")
|
||||||
|
cmd = 'cat liblink/plumed/src/lib/Plumed.inc.static Makefile.lammps.static > Makefile.lammps'
|
||||||
|
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
|
|
@ -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 =
|
|
@ -0,0 +1,56 @@
|
||||||
|
This directory contains links to the PLUMED library which is required
|
||||||
|
to use the PLUMED package and its fix plumed command in a
|
||||||
|
LAMMPS input script. PLUMED should only be downloaded into this directory if
|
||||||
|
you wish to statically link the library. If you wish to link PLUMED as
|
||||||
|
a dynamic library (as we recommend) then you can compile and build PLUMED
|
||||||
|
separately to LAMMPS. To use PLUMED in conjuction with LAMMPS you then simply
|
||||||
|
need to ensure that the PLUMED library is in your path at runtime.
|
||||||
|
|
||||||
|
More info about the PLUMED library can be found at http://www.plumed.org.
|
||||||
|
|
||||||
|
You can type "make lib-plumed" from the src directory to see help on
|
||||||
|
how to download, build and statically link PLUMED via make commands, or you can
|
||||||
|
do the same thing by typing "python Install.py" from within this
|
||||||
|
directory. Alternatively you can download and build PLUMED manually by following the instructions
|
||||||
|
below.
|
||||||
|
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Instructions:
|
||||||
|
|
||||||
|
1. Download PLUMED either as a 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 unpack it in this /lib/plumed directory.
|
||||||
|
Similarly if you clone it clone it to the /lib/plumed
|
||||||
|
directory.
|
||||||
|
|
||||||
|
2. Compile PLUMED from within its home directory. In the
|
||||||
|
simplest cases this be done by issuing the commands
|
||||||
|
% ./configure
|
||||||
|
% make
|
||||||
|
More detailed instructions can be found at
|
||||||
|
http://plumed.github.io/doc-master/user-doc/html/_installation.html
|
||||||
|
|
||||||
|
3. There is no need to install PLUMED if you only wish
|
||||||
|
to use it from LAMMPS. You should thus only run
|
||||||
|
make install if you want to use PLUMED as a stand-alone
|
||||||
|
code or from some other code. To install it you can
|
||||||
|
run the following commands:
|
||||||
|
a) install under the default /usr/local
|
||||||
|
% sudo make install
|
||||||
|
b) install under a user-writeable location by first
|
||||||
|
changing the PREFIX variable when running the
|
||||||
|
configure command file, then
|
||||||
|
% make install
|
||||||
|
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
When these steps are complete you can build LAMMPS
|
||||||
|
with the PLUMED package installed:
|
||||||
|
|
||||||
|
% cd lammps/src
|
||||||
|
% make yes-user-plumed
|
||||||
|
% make mpi (or whatever target you wish)
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
/colvarproxy_lammps_version.h
|
/colvarproxy_lammps_version.h
|
||||||
/fix_colvars.cpp
|
/fix_colvars.cpp
|
||||||
/fix_colvars.h
|
/fix_colvars.h
|
||||||
|
/fix_plumed.cpp
|
||||||
|
/fix_plumed.h
|
||||||
/dump_molfile.cpp
|
/dump_molfile.cpp
|
||||||
/dump_molfile.h
|
/dump_molfile.h
|
||||||
/molfile_interface.cpp
|
/molfile_interface.cpp
|
||||||
|
|
|
@ -61,21 +61,22 @@ PACKUSER = user-atc user-awpmd user-bocs user-cgdna user-cgsdk user-colvars \
|
||||||
user-diffraction user-dpd user-drude user-eff user-fep user-h5md \
|
user-diffraction user-dpd user-drude user-eff user-fep user-h5md \
|
||||||
user-intel user-lb user-manifold user-meamc user-meso \
|
user-intel user-lb user-manifold user-meamc user-meso \
|
||||||
user-mgpt user-misc user-mofff user-molfile \
|
user-mgpt user-misc user-mofff user-molfile \
|
||||||
user-netcdf user-omp user-phonon user-ptm user-qmmm user-qtb \
|
user-netcdf user-omp user-phonon user-plumed user-ptm user-qmmm \
|
||||||
user-quip user-reaxc user-scafacos user-smd user-smtbq \
|
user-qtb user-quip user-reaxc user-scafacos user-smd user-smtbq \
|
||||||
user-sph user-tally user-uef user-vtk
|
user-sph user-tally user-uef user-vtk
|
||||||
|
|
||||||
PACKLIB = compress gpu kim kokkos latte meam message mpiio mscg poems \
|
PACKLIB = compress gpu kim kokkos latte meam message mpiio mscg poems \
|
||||||
python reax voronoi \
|
python reax voronoi \
|
||||||
user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \
|
user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \
|
||||||
user-netcdf user-qmmm user-quip user-scafacos user-smd user-vtk
|
user-netcdf user-plumed user-qmmm user-quip user-scafacos \
|
||||||
|
user-smd user-vtk
|
||||||
|
|
||||||
PACKSYS = compress mpiio python user-lb
|
PACKSYS = compress mpiio python user-lb
|
||||||
|
|
||||||
PACKINT = gpu kokkos meam message poems reax user-atc user-awpmd user-colvars
|
PACKINT = gpu kokkos meam message poems reax user-atc user-awpmd user-colvars
|
||||||
|
|
||||||
PACKEXT = kim latte mscg voronoi \
|
PACKEXT = kim latte mscg voronoi \
|
||||||
user-h5md user-molfile user-netcdf user-qmmm user-quip \
|
user-h5md user-molfile user-netcdf user-plumed user-qmmm user-quip \
|
||||||
user-smd user-vtk
|
user-smd user-vtk
|
||||||
|
|
||||||
PACKALL = $(PACKAGE) $(PACKUSER)
|
PACKALL = $(PACKAGE) $(PACKUSER)
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
# Install/unInstall package files in LAMMPS
|
||||||
|
# mode = 0/1/2 for uninstall/install/update
|
||||||
|
|
||||||
|
mode=$1
|
||||||
|
|
||||||
|
# enforce using portable C locale
|
||||||
|
LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
|
# arg1 = file, arg2 = file it depends on
|
||||||
|
|
||||||
|
action () {
|
||||||
|
if (test $mode = 0) then
|
||||||
|
rm -f ../$1
|
||||||
|
elif (! cmp -s $1 ../$1) then
|
||||||
|
if (test -z "$2" || test -e ../$2) then
|
||||||
|
cp $1 ..
|
||||||
|
if (test $mode = 2) then
|
||||||
|
echo " updating src/$1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif (test -n "$2") then
|
||||||
|
if (test ! -e ../$2) then
|
||||||
|
rm -f ../$1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# all package files with no dependencies
|
||||||
|
|
||||||
|
for file in *.cpp *.h; do
|
||||||
|
test -f ${file} && action $file
|
||||||
|
done
|
||||||
|
|
||||||
|
# edit 2 Makefile.package files to include/exclude package info
|
||||||
|
|
||||||
|
if (test $1 = 1) then
|
||||||
|
|
||||||
|
if (test -e ../Makefile.package) then
|
||||||
|
sed -i -e 's/[^ \t]*plumed[^ \t]* //' ../Makefile.package
|
||||||
|
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/plumed/includelink |' ../Makefile.package
|
||||||
|
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(plumed_SYSINC) |' ../Makefile.package
|
||||||
|
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(plumed_SYSLIB) |' ../Makefile.package
|
||||||
|
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(plumed_SYSPATH) |' ../Makefile.package
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (test -e ../Makefile.package.settings) then
|
||||||
|
sed -i -e '/^include.*plumed.*$/d' ../Makefile.package.settings
|
||||||
|
# multiline form needed for BSD sed on Macs
|
||||||
|
sed -i -e '4 i \
|
||||||
|
include ..\/..\/lib\/plumed\/Makefile.lammps
|
||||||
|
' ../Makefile.package.settings
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif (test $1 = 0) then
|
||||||
|
|
||||||
|
if (test -e ../Makefile.package) then
|
||||||
|
sed -i -e 's/[^ \t]*plumed[^ \t]* //' ../Makefile.package
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (test -e ../Makefile.package.settings) then
|
||||||
|
sed -i -e '/^include.*plumed.*$/d' ../Makefile.package.settings
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
|
@ -0,0 +1,70 @@
|
||||||
|
This package implements the "fix plumed" command, which can be used
|
||||||
|
in a LAMMPS input script.
|
||||||
|
|
||||||
|
The fix allows enhanced sampling methods such as umbrella sampling and
|
||||||
|
metadynamics to be used. Furthermore, PLUMED can be used to perform a
|
||||||
|
wide range of analyses on trajectories on the fly as they are generated.
|
||||||
|
|
||||||
|
The package uses the "PLUMED" library, whose source code is not included
|
||||||
|
in the LAMMPS source code distribution. The files in the USER-PLUMED package
|
||||||
|
folder implement an interface between LAMMPS and PLUMED, that are written
|
||||||
|
and maintained by Gareth Tribello (gareth.tribello@gmail.com).
|
||||||
|
|
||||||
|
PLUMED must instead be downloaded and compiled separately to LAMMPS. This building
|
||||||
|
and compiling of PLUMED can be done before or after the building of LAMMPS as LAMMPS
|
||||||
|
can call PLUMED as a dynamic library. There is also the possibility to link PLUEMD
|
||||||
|
statically. In this case a copy of PLUMED must be downloaded into the lib/plumed
|
||||||
|
directory. This copy of PLUMED will then always be linked into the code at compile
|
||||||
|
time.
|
||||||
|
|
||||||
|
However you decide to link PLUMED (statically or dynamically) you must run the command:
|
||||||
|
|
||||||
|
make yes-user-plumed
|
||||||
|
|
||||||
|
before compiling LAMMPS in order to enable the module. In addition, if you have chosen to
|
||||||
|
link PLUMED dynamically you must ensure that PLUMED is in your
|
||||||
|
PATH when running a LAMMPS calculation that takes advantage of PLUMED. If
|
||||||
|
PLUMED is linked as a runtime library and if PLUMED is not in the PATH an error will be returned whenever LAMMPS encounters
|
||||||
|
the fix plumed command in its input. To be clear, however, a LAMMPS executable that was dynamically linked with PLUMED will run
|
||||||
|
even if PLUMED is not in the path if as long as the input does not contain a fix
|
||||||
|
plumed command.
|
||||||
|
|
||||||
|
If you wish to statically link PLUMED you must download PLUMED to the /lib/plumed directory before compiling LAMMPS. You can
|
||||||
|
download a tar ball into that directory or you can clone the plumed2 repository from github there. Once you have created a
|
||||||
|
directory containing a distribution of PLUMED within /lib/plumed you then must build PLUMED within that directory by issuing
|
||||||
|
the usual commands. It is worth noting that we have provided a script that will download and build PLUMED for you with
|
||||||
|
a minimal set of options. To run this script you need to issue the following command:
|
||||||
|
|
||||||
|
make lib-plumed args="-b"
|
||||||
|
|
||||||
|
in the src directory.
|
||||||
|
|
||||||
|
More info about the PLUMED library can be found at:
|
||||||
|
|
||||||
|
www.plumed.org
|
||||||
|
|
||||||
|
and in the reference articles:
|
||||||
|
|
||||||
|
PLUMED2: New feathers for an old bird
|
||||||
|
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi,
|
||||||
|
Comp. Phys. Comm 185, 604 (2014)
|
||||||
|
https://doi.org/10.1016/j.cpc.2013.09.018
|
||||||
|
|
||||||
|
PLUMED: a portable plugin for free energy calculations with molecular dynamics
|
||||||
|
M. Bonomi, D. Branduardi, G. Bussi, C. Camilloni, D. Provasi, P. Raiteri, D. Donadio, F. Marinelli, F. Pietrucci, R.A. Broglia and M. Parrinello
|
||||||
|
Comp. Phys. Comm. 180, 1961 (2009)
|
||||||
|
https://doi.org/10.1016/j.cpc.2009.05.011
|
||||||
|
|
||||||
|
Instructions explaining how to use PLUMED and LAMMPS in tandem can be found on the PLUMED website, which also gives
|
||||||
|
numerous example scripts for PLUMED as well as citations to articles that dcoment the various methods that are
|
||||||
|
implemented within PLUMED.
|
||||||
|
|
||||||
|
There are also example scripts for using this package in the folder
|
||||||
|
examples/USER/plumed, as well as on the GitHub page for PLUMED.
|
||||||
|
|
||||||
|
Please contact Gareth Tribello (gareth.tribello@gmail.com) for questions
|
||||||
|
regarding this package.
|
||||||
|
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
Version: 2016-12-22
|
|
@ -0,0 +1,559 @@
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing authors: Gareth Tribello (Queens U, Belfast)
|
||||||
|
Pablo Piaggi (EPFL)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "update.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "respa.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "fix_plumed.h"
|
||||||
|
#include "universe.h"
|
||||||
|
#include "compute.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "pair.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Use statically linked C++ interface to plumed
|
||||||
|
*/
|
||||||
|
#define __PLUMED_WRAPPER_CXX 1
|
||||||
|
|
||||||
|
#include "plumed/wrapper/Plumed.h"
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
using namespace FixConst;
|
||||||
|
|
||||||
|
#define INVOKED_SCALAR 1
|
||||||
|
|
||||||
|
FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Fix(lmp, narg, arg),
|
||||||
|
p(NULL), nlocal(0), gatindex(NULL), masses(NULL), charges(NULL),
|
||||||
|
id_pe(NULL), id_press(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!atom->tag_enable)
|
||||||
|
error->all(FLERR,"Fix plumed requires atom tags");
|
||||||
|
|
||||||
|
if (atom->tag_consecutive() == 0)
|
||||||
|
error->all(FLERR,"Fix plumed requires consecutive atom IDs");
|
||||||
|
|
||||||
|
if (igroup != 0 && comm->me == 0)
|
||||||
|
error->warning(FLERR,"Fix group for fix plumed is not 'all'. "
|
||||||
|
"Group will be ignored.");
|
||||||
|
|
||||||
|
p=new PLMD::Plumed;
|
||||||
|
|
||||||
|
// Check API version
|
||||||
|
|
||||||
|
int api_version;
|
||||||
|
p->cmd("getApiVersion",&api_version);
|
||||||
|
if (api_version > 6)
|
||||||
|
error->all(FLERR,"Incompatible API version for PLUMED in fix plumed");
|
||||||
|
|
||||||
|
// If the -partition option is activated then enable
|
||||||
|
// inter-partition communication
|
||||||
|
|
||||||
|
if (universe->existflag == 1) {
|
||||||
|
int me;
|
||||||
|
MPI_Comm inter_comm;
|
||||||
|
MPI_Comm_rank(world,&me);
|
||||||
|
|
||||||
|
// Change MPI_COMM_WORLD to universe->uworld which seems more appropriate
|
||||||
|
|
||||||
|
MPI_Comm_split(universe->uworld,me,0,&inter_comm);
|
||||||
|
p->cmd("GREX setMPIIntracomm",&world);
|
||||||
|
if (me == 0) {
|
||||||
|
// The inter-partition communicator is only defined for the root in
|
||||||
|
// each partition (a.k.a. world). This is due to the way in which
|
||||||
|
// it is defined inside plumed.
|
||||||
|
p->cmd("GREX setMPIIntercomm",&inter_comm);
|
||||||
|
}
|
||||||
|
p->cmd("GREX init",NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The general communicator is independent of the existence of partitions,
|
||||||
|
// if there are partitions, world is defined within each partition,
|
||||||
|
// whereas if partitions are not defined then world is equal to
|
||||||
|
// MPI_COMM_WORLD.
|
||||||
|
|
||||||
|
p->cmd("setMPIComm",&world);
|
||||||
|
|
||||||
|
// Set up units
|
||||||
|
// LAMMPS units wrt kj/mol - nm - ps
|
||||||
|
// Set up units
|
||||||
|
|
||||||
|
if(strcmp(update->unit_style,"lj") == 0) {
|
||||||
|
// LAMMPS units lj
|
||||||
|
p->cmd("setNaturalUnits");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Conversion factor from LAMMPS energy units to kJ/mol (units of PLUMED)
|
||||||
|
|
||||||
|
double energyUnits=1.0;
|
||||||
|
|
||||||
|
// LAMMPS units real :: kcal/mol;
|
||||||
|
|
||||||
|
if (strcmp(update->unit_style,"real") == 0) {
|
||||||
|
energyUnits=4.184;
|
||||||
|
|
||||||
|
// LAMMPS units metal :: eV;
|
||||||
|
|
||||||
|
} else if (strcmp(update->unit_style,"metal") == 0) {
|
||||||
|
energyUnits=96.48530749925792;
|
||||||
|
|
||||||
|
// LAMMPS units si :: Joule;
|
||||||
|
|
||||||
|
} else if (strcmp(update->unit_style,"si") == 0) {
|
||||||
|
energyUnits=0.001;
|
||||||
|
|
||||||
|
// LAMMPS units cgs :: erg;
|
||||||
|
|
||||||
|
} else if (strcmp(update->unit_style,"cgs") == 0) {
|
||||||
|
energyUnits=6.0221418e13;
|
||||||
|
|
||||||
|
// LAMMPS units electron :: Hartree;
|
||||||
|
|
||||||
|
} else if (strcmp(update->unit_style,"electron") == 0) {
|
||||||
|
energyUnits=2625.5257;
|
||||||
|
|
||||||
|
} else error->all(FLERR,"Fix plumed cannot handle your choice of units");
|
||||||
|
|
||||||
|
// Conversion factor from LAMMPS length units to nm (units of PLUMED)
|
||||||
|
|
||||||
|
double lengthUnits=0.1/force->angstrom;
|
||||||
|
|
||||||
|
// Conversion factor from LAMMPS time unit to ps (units of PLUMED)
|
||||||
|
|
||||||
|
double timeUnits=0.001/force->femtosecond;
|
||||||
|
|
||||||
|
p->cmd("setMDEnergyUnits",&energyUnits);
|
||||||
|
p->cmd("setMDLengthUnits",&lengthUnits);
|
||||||
|
p->cmd("setMDTimeUnits",&timeUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read fix parameters:
|
||||||
|
|
||||||
|
int next=0;
|
||||||
|
for (int i=3;i<narg;++i) {
|
||||||
|
if (!strcmp(arg[i],"outfile")) {
|
||||||
|
next=1;
|
||||||
|
} else if (next==1) {
|
||||||
|
if (universe->existflag == 1) {
|
||||||
|
// Each replica writes an independent log file
|
||||||
|
// with suffix equal to the replica id
|
||||||
|
char str_num[32], logFile[1024];
|
||||||
|
sprintf(str_num,".%d",universe->iworld);
|
||||||
|
strncpy(logFile,arg[i],1024-32);
|
||||||
|
strcat(logFile,str_num);
|
||||||
|
p->cmd("setLogFile",logFile);
|
||||||
|
next=0;
|
||||||
|
} else {
|
||||||
|
// partition option not used
|
||||||
|
p->cmd("setLogFile",arg[i]);
|
||||||
|
next=0;
|
||||||
|
}
|
||||||
|
} else if (!strcmp(arg[i],"plumedfile")) {
|
||||||
|
next=2;
|
||||||
|
} else if (next==2) {
|
||||||
|
p->cmd("setPlumedDat",arg[i]);
|
||||||
|
next=0;
|
||||||
|
} else error->all(FLERR,"Syntax error - use 'fix <fix-ID> plumed "
|
||||||
|
"plumedfile plumed.dat outfile plumed.out' ");
|
||||||
|
}
|
||||||
|
if (next==1) error->all(FLERR,"missing argument for outfile option");
|
||||||
|
if (next==2) error->all(FLERR,"missing argument for plumedfile option");
|
||||||
|
|
||||||
|
p->cmd("setMDEngine","LAMMPS");
|
||||||
|
|
||||||
|
if (atom->natoms > MAXSMALLINT)
|
||||||
|
error->all(FLERR,"Fix plumed can only handle up to 2.1 billion atoms");
|
||||||
|
|
||||||
|
natoms=int(atom->natoms);
|
||||||
|
p->cmd("setNatoms",&natoms);
|
||||||
|
|
||||||
|
double dt=update->dt;
|
||||||
|
p->cmd("setTimestep",&dt);
|
||||||
|
|
||||||
|
virial_flag=1;
|
||||||
|
thermo_virial=1;
|
||||||
|
scalar_flag = 1;
|
||||||
|
|
||||||
|
// This is the real initialization:
|
||||||
|
|
||||||
|
p->cmd("init");
|
||||||
|
|
||||||
|
// Define compute to calculate potential energy
|
||||||
|
|
||||||
|
id_pe = new char[7];
|
||||||
|
id_pe = (char *) "plmd_pe";
|
||||||
|
char **newarg = new char*[3];
|
||||||
|
newarg[0] = id_pe;
|
||||||
|
newarg[1] = (char *) "all";
|
||||||
|
newarg[2] = (char *) "pe";
|
||||||
|
modify->add_compute(3,newarg);
|
||||||
|
delete [] newarg;
|
||||||
|
int ipe = modify->find_compute(id_pe);
|
||||||
|
c_pe = modify->compute[ipe];
|
||||||
|
|
||||||
|
// Define compute to calculate pressure tensor
|
||||||
|
id_press = new char[9];
|
||||||
|
id_press = (char *) "plmd_press";
|
||||||
|
newarg = new char*[5];
|
||||||
|
newarg[0] = id_press;
|
||||||
|
newarg[1] = (char *) "all";
|
||||||
|
newarg[2] = (char *) "pressure";
|
||||||
|
newarg[3] = (char *) "NULL";
|
||||||
|
newarg[4] = (char *) "virial";
|
||||||
|
modify->add_compute(5,newarg);
|
||||||
|
delete [] newarg;
|
||||||
|
int ipress = modify->find_compute(id_press);
|
||||||
|
c_press = modify->compute[ipress];
|
||||||
|
|
||||||
|
for (int i = 0; i < modify->nfix; i++) {
|
||||||
|
const char * const check_style = modify->fix[i]->style;
|
||||||
|
|
||||||
|
// There must be only one
|
||||||
|
|
||||||
|
if (strcmp(check_style,"plumed") == 0)
|
||||||
|
error->all(FLERR,"There must be only one instance of fix plumed");
|
||||||
|
|
||||||
|
// Avoid conflict with fixes that define internal pressure computes.
|
||||||
|
// See comment in the setup method
|
||||||
|
|
||||||
|
if ((strncmp(check_style,"nph",3) == 0) ||
|
||||||
|
(strncmp(check_style,"npt",3) == 0) ||
|
||||||
|
(strncmp(check_style,"rigid/nph",9) == 0) ||
|
||||||
|
(strncmp(check_style,"rigid/npt",9) == 0) ||
|
||||||
|
(strncmp(check_style,"msst",4) == 0) ||
|
||||||
|
(strncmp(check_style,"nphug",5) == 0) ||
|
||||||
|
(strncmp(check_style,"ipi",3) == 0) ||
|
||||||
|
(strncmp(check_style,"press/berendsen",15) == 0) ||
|
||||||
|
(strncmp(check_style,"qbmsst",6) == 0))
|
||||||
|
error->all(FLERR,"Fix plumed must be defined before any other fixes, "
|
||||||
|
"that compute pressure internally");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FixPlumed::~FixPlumed()
|
||||||
|
{
|
||||||
|
delete p;
|
||||||
|
modify->delete_compute(id_pe);
|
||||||
|
modify->delete_compute(id_press);
|
||||||
|
delete[] masses;
|
||||||
|
delete[] charges;
|
||||||
|
delete[] gatindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FixPlumed::setmask()
|
||||||
|
{
|
||||||
|
// set with a bitmask how and when apply the force from plumed
|
||||||
|
int mask = 0;
|
||||||
|
mask |= POST_FORCE;
|
||||||
|
mask |= THERMO_ENERGY;
|
||||||
|
mask |= POST_FORCE_RESPA;
|
||||||
|
mask |= MIN_POST_FORCE;
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::init()
|
||||||
|
{
|
||||||
|
if (strcmp(update->integrate_style,"respa") == 0)
|
||||||
|
nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
||||||
|
|
||||||
|
// This avoids nan pressure if compute_pressure is called
|
||||||
|
// in a setup method
|
||||||
|
|
||||||
|
for (int i=0;i<6;i++) virial[i] = 0.;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::setup(int vflag)
|
||||||
|
{
|
||||||
|
// Here there is a crucial issue connected to constant pressure
|
||||||
|
// simulations. The fix_nh will call the compute_pressure inside
|
||||||
|
// the setup method, that is executed once and for all at the
|
||||||
|
// beginning of the simulation. Since our fix has a contribution
|
||||||
|
// to the virial, when this happens the variable virial must have
|
||||||
|
// been calculated. In other words, the setup method of fix_plumed
|
||||||
|
// has to be executed first. This creates a race condition with the
|
||||||
|
// setup method of fix_nh. This is why in the constructor I check if
|
||||||
|
// nh fixes have already been called.
|
||||||
|
if (strcmp(update->integrate_style,"verlet") == 0)
|
||||||
|
post_force(vflag);
|
||||||
|
else {
|
||||||
|
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
|
||||||
|
post_force_respa(vflag,nlevels_respa-1,0);
|
||||||
|
((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::min_setup(int vflag)
|
||||||
|
{
|
||||||
|
// This has to be checked.
|
||||||
|
// For instance it might have problems with fix_box_relax
|
||||||
|
post_force(vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::post_force(int /* vflag */)
|
||||||
|
{
|
||||||
|
|
||||||
|
int update_gatindex=0;
|
||||||
|
|
||||||
|
if (natoms != int(atom->natoms))
|
||||||
|
error->all(FLERR,"Fix plumed does not support simulations with varying "
|
||||||
|
"numbers of atoms");
|
||||||
|
|
||||||
|
// Try to find out if the domain decomposition has been updated:
|
||||||
|
|
||||||
|
if (nlocal != atom->nlocal) {
|
||||||
|
|
||||||
|
if (charges) delete [] charges;
|
||||||
|
if (masses) delete [] masses;
|
||||||
|
if (gatindex) delete [] gatindex;
|
||||||
|
|
||||||
|
nlocal=atom->nlocal;
|
||||||
|
gatindex=new int [nlocal];
|
||||||
|
masses=new double [nlocal];
|
||||||
|
charges=new double [nlocal];
|
||||||
|
update_gatindex=1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (int i=0;i<nlocal;i++) {
|
||||||
|
if (gatindex[i]!=atom->tag[i]-1) {
|
||||||
|
update_gatindex=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MPI_Allreduce(MPI_IN_PLACE,&update_gatindex,1,MPI_INT,MPI_SUM,world);
|
||||||
|
|
||||||
|
// In case it has been updated, rebuild the local mass/charges array
|
||||||
|
// and tell plumed about the change:
|
||||||
|
|
||||||
|
if (update_gatindex) {
|
||||||
|
for (int i=0;i<nlocal;i++) gatindex[i]=atom->tag[i]-1;
|
||||||
|
// Get masses
|
||||||
|
if (atom->rmass_flag) {
|
||||||
|
for (int i=0;i<nlocal;i++) masses[i]=atom->rmass[i];
|
||||||
|
} else {
|
||||||
|
for (int i=0;i<nlocal;i++) masses[i]=atom->mass[atom->type[i]];
|
||||||
|
}
|
||||||
|
// Get charges
|
||||||
|
if (atom->q_flag) {
|
||||||
|
for (int i=0;i<nlocal;i++) charges[i]=atom->q[i];
|
||||||
|
} else {
|
||||||
|
for (int i=0;i<nlocal;i++) charges[i]=0.0;
|
||||||
|
}
|
||||||
|
p->cmd("setAtomsNlocal",&nlocal);
|
||||||
|
p->cmd("setAtomsGatindex",gatindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// set up local virial/box. plumed uses full 3x3 matrices
|
||||||
|
double plmd_virial[3][3];
|
||||||
|
for (int i=0;i<3;i++) for (int j=0;j<3;j++) plmd_virial[i][j]=0.0;
|
||||||
|
double box[3][3];
|
||||||
|
for (int i=0;i<3;i++) for (int j=0;j<3;j++) box[i][j]=0.0;
|
||||||
|
box[0][0]=domain->h[0];
|
||||||
|
box[1][1]=domain->h[1];
|
||||||
|
box[2][2]=domain->h[2];
|
||||||
|
box[2][1]=domain->h[3];
|
||||||
|
box[2][0]=domain->h[4];
|
||||||
|
box[1][0]=domain->h[5];
|
||||||
|
|
||||||
|
// Make initial of virial of this fix zero
|
||||||
|
// The following line is very important, otherwise
|
||||||
|
// the compute pressure will include
|
||||||
|
for (int i=0;i<6;++i) virial[i] = 0.;
|
||||||
|
|
||||||
|
// local variable with timestep:
|
||||||
|
if (update->ntimestep > MAXSMALLINT)
|
||||||
|
error->all(FLERR,"Fix plumed can only handle up to 2.1 billion timesteps");
|
||||||
|
int step=int(update->ntimestep);
|
||||||
|
|
||||||
|
// pass all pointers to plumed:
|
||||||
|
p->cmd("setStep",&step);
|
||||||
|
p->cmd("setPositions",&atom->x[0][0]);
|
||||||
|
p->cmd("setBox",&box[0][0]);
|
||||||
|
p->cmd("setForces",&atom->f[0][0]);
|
||||||
|
p->cmd("setMasses",&masses[0]);
|
||||||
|
p->cmd("setCharges",&charges[0]);
|
||||||
|
p->cmd("getBias",&bias);
|
||||||
|
|
||||||
|
// Pass virial to plumed
|
||||||
|
// If energy is needed virial_plmd is equal to Lammps' virial
|
||||||
|
// If energy is not needed virial_plmd is initialized to zero
|
||||||
|
// In the first case the virial will be rescaled and an extra term will be added
|
||||||
|
// In the latter case only an extra term will be added
|
||||||
|
p->cmd("setVirial",&plmd_virial[0][0]);
|
||||||
|
p->cmd("prepareCalc");
|
||||||
|
|
||||||
|
plumedNeedsEnergy=0;
|
||||||
|
p->cmd("isEnergyNeeded",&plumedNeedsEnergy);
|
||||||
|
|
||||||
|
// Pass potential energy and virial if needed
|
||||||
|
double *virial_lmp;
|
||||||
|
if (plumedNeedsEnergy) {
|
||||||
|
// Error if tail corrections are included
|
||||||
|
if (force->pair && force->pair->tail_flag && comm->me == 0)
|
||||||
|
error->warning(FLERR,"Tail corrections to the pair potential included."
|
||||||
|
" The energy cannot be biased correctly in this case."
|
||||||
|
" Remove the tail corrections by removing the"
|
||||||
|
" command: pair_modify tail yes");
|
||||||
|
|
||||||
|
// compute the potential energy
|
||||||
|
double pot_energy = 0.;
|
||||||
|
c_pe->compute_scalar();
|
||||||
|
pot_energy = c_pe->scalar;
|
||||||
|
|
||||||
|
// Divide energy by number of processes
|
||||||
|
// Plumed wants it this way
|
||||||
|
int nprocs;
|
||||||
|
MPI_Comm_size(world,&nprocs);
|
||||||
|
pot_energy /= nprocs;
|
||||||
|
p->cmd("setEnergy",&pot_energy);
|
||||||
|
|
||||||
|
// Compute pressure due to the virial (no kinetic energy term!)
|
||||||
|
c_press->compute_vector();
|
||||||
|
virial_lmp = c_press->vector;
|
||||||
|
|
||||||
|
// Check if pressure is finite
|
||||||
|
if (!std::isfinite(virial_lmp[0]) || !std::isfinite(virial_lmp[1])
|
||||||
|
|| !std::isfinite(virial_lmp[2]) || !std::isfinite(virial_lmp[3])
|
||||||
|
|| !std::isfinite(virial_lmp[4]) || !std::isfinite(virial_lmp[5]))
|
||||||
|
error->all(FLERR,"Non-numeric virial - Plumed cannot work with that");
|
||||||
|
|
||||||
|
// Convert pressure to virial per number of MPI processes
|
||||||
|
// From now on all virials are divided by the number of MPI processes
|
||||||
|
|
||||||
|
double nktv2p = force->nktv2p;
|
||||||
|
double inv_volume;
|
||||||
|
if (domain->dimension == 3) {
|
||||||
|
inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd);
|
||||||
|
} else {
|
||||||
|
inv_volume = 1.0 / (domain->xprd * domain->yprd);
|
||||||
|
}
|
||||||
|
for (int i=0;i<6;i++) virial_lmp[i] /= (inv_volume * nktv2p * nprocs);
|
||||||
|
// Convert virial from lammps to plumed representation
|
||||||
|
plmd_virial[0][0]=-virial_lmp[0];
|
||||||
|
plmd_virial[1][1]=-virial_lmp[1];
|
||||||
|
plmd_virial[2][2]=-virial_lmp[2];
|
||||||
|
plmd_virial[0][1]=-virial_lmp[3];
|
||||||
|
plmd_virial[0][2]=-virial_lmp[4];
|
||||||
|
plmd_virial[1][2]=-virial_lmp[5];
|
||||||
|
} else {
|
||||||
|
virial_lmp = new double[6];
|
||||||
|
for (int i=0;i<6;i++) virial_lmp[i] = 0.;
|
||||||
|
}
|
||||||
|
// do the real calculation:
|
||||||
|
p->cmd("performCalc");
|
||||||
|
|
||||||
|
// retransform virial to lammps representation and assign it to this
|
||||||
|
// fix's virial. Plumed is giving back the full virial and therefore
|
||||||
|
// we have to subtract the initial virial i.e. virial_lmp.
|
||||||
|
// The vector virial contains only the contribution added by plumed.
|
||||||
|
// The calculation of the pressure will be done by a compute pressure
|
||||||
|
// and will include this contribution.
|
||||||
|
virial[0] = -plmd_virial[0][0]-virial_lmp[0];
|
||||||
|
virial[1] = -plmd_virial[1][1]-virial_lmp[1];
|
||||||
|
virial[2] = -plmd_virial[2][2]-virial_lmp[2];
|
||||||
|
virial[3] = -plmd_virial[0][1]-virial_lmp[3];
|
||||||
|
virial[4] = -plmd_virial[0][2]-virial_lmp[4];
|
||||||
|
virial[5] = -plmd_virial[1][2]-virial_lmp[5];
|
||||||
|
|
||||||
|
// Ask for the computes in the next time step
|
||||||
|
// such that the virial and energy are tallied.
|
||||||
|
// This should be changed to something that triggers the
|
||||||
|
// calculation only if plumed needs it.
|
||||||
|
c_pe->addstep(update->ntimestep+1);
|
||||||
|
c_press->addstep(update->ntimestep+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::post_force_respa(int vflag, int ilevel, int /* iloop */)
|
||||||
|
{
|
||||||
|
if (ilevel == nlevels_respa-1) post_force(vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::min_post_force(int vflag)
|
||||||
|
{
|
||||||
|
post_force(vflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixPlumed::reset_dt()
|
||||||
|
{
|
||||||
|
error->all(FLERR,"Cannot change the time step when fix plumed is active");
|
||||||
|
}
|
||||||
|
|
||||||
|
double FixPlumed::compute_scalar()
|
||||||
|
{
|
||||||
|
return bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FixPlumed::modify_param(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (strcmp(arg[0],"pe") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
modify->delete_compute(id_pe); delete [] id_pe;
|
||||||
|
int n = strlen(arg[1]) + 1;
|
||||||
|
id_pe = new char[n];
|
||||||
|
strcpy(id_pe,arg[1]);
|
||||||
|
|
||||||
|
int icompute = modify->find_compute(arg[1]);
|
||||||
|
if (icompute < 0) error->all(FLERR,"Could not find fix_modify potential energy ID");
|
||||||
|
c_pe = modify->compute[icompute];
|
||||||
|
|
||||||
|
if (c_pe->peflag == 0)
|
||||||
|
error->all(FLERR,"Fix_modify plmd_pe ID does not compute potential energy");
|
||||||
|
if (c_pe->igroup != 0 && comm->me == 0)
|
||||||
|
error->warning(FLERR,"Potential for fix PLUMED is not for group all");
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
} else if (strcmp(arg[0],"press") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||||
|
modify->delete_compute(id_press); delete [] id_press;
|
||||||
|
int n = strlen(arg[1]) + 1;
|
||||||
|
id_press = new char[n];
|
||||||
|
strcpy(id_press,arg[1]);
|
||||||
|
|
||||||
|
int icompute = modify->find_compute(arg[1]);
|
||||||
|
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID");
|
||||||
|
c_press = modify->compute[icompute];
|
||||||
|
|
||||||
|
if (c_press->pressflag == 0)
|
||||||
|
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
||||||
|
if (c_press->igroup != 0 && comm->me == 0)
|
||||||
|
error->warning(FLERR,"Virial for fix PLUMED is not for group all");
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double FixPlumed::memory_usage()
|
||||||
|
{
|
||||||
|
return double((8+8+4)*atom->nlocal);
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
|
FixStyle(plumed,FixPlumed)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_FIX_PLUMED_H
|
||||||
|
#define LMP_FIX_PLUMED_H
|
||||||
|
|
||||||
|
#include "fix.h"
|
||||||
|
|
||||||
|
// forward declaration
|
||||||
|
namespace PLMD {
|
||||||
|
class Plumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class FixPlumed : public Fix {
|
||||||
|
public:
|
||||||
|
FixPlumed(class LAMMPS *, int, char **);
|
||||||
|
~FixPlumed();
|
||||||
|
int setmask();
|
||||||
|
void init();
|
||||||
|
void setup(int);
|
||||||
|
void min_setup(int);
|
||||||
|
void post_force(int);
|
||||||
|
void post_force_respa(int, int, int);
|
||||||
|
void min_post_force(int);
|
||||||
|
double compute_scalar();
|
||||||
|
void reset_dt();
|
||||||
|
int modify_param(int narg, char **arg);
|
||||||
|
double memory_usage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
PLMD::Plumed *p; // pointer to plumed object
|
||||||
|
int nlocal; // number of atoms local to this process
|
||||||
|
int natoms; // total number of atoms
|
||||||
|
int *gatindex; // array of atom indexes local to this process
|
||||||
|
double *masses; // array of masses for local atoms
|
||||||
|
double *charges; // array of charges for local atoms
|
||||||
|
int nlevels_respa; // this is something to enable respa
|
||||||
|
double bias; // output bias potential
|
||||||
|
class Compute *c_pe; // Compute for the energy
|
||||||
|
class Compute *c_press; // Compute for the pressure
|
||||||
|
int plumedNeedsEnergy; // Flag to trigger calculation of the
|
||||||
|
// energy and virial
|
||||||
|
char *id_pe, *id_press; // ID for potential energy and pressure compute
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
Reference in New Issue