Compare commits
111 Commits
patch_13De
...
patch_6Jan
| Author | SHA1 | Date | |
|---|---|---|---|
| 51fa33a407 | |||
| 142770cb2a | |||
| 63f202501b | |||
| 83da5d3b5d | |||
| ebbf60b112 | |||
| 12c4fa25e8 | |||
| 3ac58452de | |||
| 9b348d567b | |||
| 467377094a | |||
| 5656e90b78 | |||
| 41a6a3076e | |||
| d4e8d47387 | |||
| f6a819580c | |||
| 6af56e686d | |||
| eb1c6a225c | |||
| 4d0a6d83bd | |||
| 958722573f | |||
| 9d46670972 | |||
| 1a9f2df3d0 | |||
| 1310438c8b | |||
| 9bf771207d | |||
| b9144d6332 | |||
| 267f05e5ca | |||
| aebc8ea826 | |||
| 53a1de1d40 | |||
| d059b5d334 | |||
| 7cff343680 | |||
| a1ac861084 | |||
| 17bdb57bb4 | |||
| fe14158c10 | |||
| 0bcbcca140 | |||
| 4cfe122ac6 | |||
| b46629ee39 | |||
| 42bbeb3f16 | |||
| 933b288ce9 | |||
| a7c5905ca4 | |||
| 37d5567f6d | |||
| b10d0c17ec | |||
| 4f45d39ac7 | |||
| 7d057d4c83 | |||
| 4f096dbad5 | |||
| 18b12efc9f | |||
| 2c7fea1e0d | |||
| 4d98bbdfa5 | |||
| 391ab761a4 | |||
| b0ebd3ef4e | |||
| 94c4f8fe5f | |||
| aa146e9b38 | |||
| eca9539f84 | |||
| 27172c4a55 | |||
| 4f195254af | |||
| 9a0007a13f | |||
| 994f36bc6f | |||
| b3557bfbf5 | |||
| 371df8ea72 | |||
| 06ae2804f6 | |||
| 68814d4fc8 | |||
| 616ca1de03 | |||
| b0263e87bb | |||
| 925f42727f | |||
| f553e230db | |||
| 6ab716164b | |||
| 7a45c72b97 | |||
| 634eb357d2 | |||
| a1036f2d74 | |||
| c301d70333 | |||
| 781daad2a0 | |||
| 3faa57a413 | |||
| fa435fb514 | |||
| ba96fcc15a | |||
| 304f65b164 | |||
| 4c33f31265 | |||
| ae8d882b03 | |||
| 7559bc9c5f | |||
| 62dea1bb63 | |||
| 800ff43413 | |||
| 9161bd98bf | |||
| f3327ca214 | |||
| 54963ba7da | |||
| ea76041803 | |||
| 7fb4faa439 | |||
| 41c9357dde | |||
| d1a55ad2e0 | |||
| d9a0f575f6 | |||
| 01e3a31639 | |||
| 992becc75f | |||
| 8b5e15e979 | |||
| b2b33cca16 | |||
| 2ceee6b9be | |||
| 386c12c970 | |||
| 590f317550 | |||
| c4e02a5d2b | |||
| c7ac9e79cb | |||
| 2ba424e1a3 | |||
| ca30c1ec88 | |||
| a1b441a71f | |||
| f6f2170369 | |||
| 81a2db8a0c | |||
| 0a176841e7 | |||
| 3027ac9250 | |||
| fc54ab5cea | |||
| e364b80724 | |||
| 830c9e8661 | |||
| 4907b29ad2 | |||
| eff7238ff2 | |||
| 126fb22e93 | |||
| 0a90492c44 | |||
| fed629c23e | |||
| 925481c3f4 | |||
| da2ad5b6e0 | |||
| bfcab72268 |
BIN
doc/src/JPG/tutorial_additional_changes.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
doc/src/JPG/tutorial_automated_checks.png
Normal file
|
After Width: | Height: | Size: 99 KiB |
BIN
doc/src/JPG/tutorial_automated_checks_passed.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 16 KiB |
BIN
doc/src/JPG/tutorial_changes_others.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
doc/src/JPG/tutorial_create_new_pull_request1.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
doc/src/JPG/tutorial_create_new_pull_request2.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
doc/src/JPG/tutorial_edits_maintainers.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 70 KiB |
BIN
doc/src/JPG/tutorial_new_pull_request.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request2.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request3.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request4.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request5.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
doc/src/JPG/tutorial_reverse_pull_request6.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
doc/src/JPG/tutorial_steve_assignee.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
@ -1,7 +1,7 @@
|
||||
<!-- HTML_ONLY -->
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="13 Dec 2016 version">
|
||||
<META NAME="docnumber" CONTENT="6 Jan 2017 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 @@
|
||||
<H1></H1>
|
||||
|
||||
LAMMPS Documentation :c,h3
|
||||
13 Dec 2016 version :c,h4
|
||||
6 Jan 2017 version :c,h4
|
||||
|
||||
Version info: :h4
|
||||
|
||||
|
||||
@ -581,7 +581,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
|
||||
"indent"_fix_indent.html,
|
||||
"langevin (k)"_fix_langevin.html,
|
||||
"lineforce"_fix_lineforce.html,
|
||||
"momentum"_fix_momentum.html,
|
||||
"momentum (k)"_fix_momentum.html,
|
||||
"move"_fix_move.html,
|
||||
"msst"_fix_msst.html,
|
||||
"neb"_fix_neb.html,
|
||||
@ -702,6 +702,7 @@ package"_Section_start.html#start_3.
|
||||
"manifoldforce"_fix_manifoldforce.html,
|
||||
"meso/stationary"_fix_meso_stationary.html,
|
||||
"nve/manifold/rattle"_fix_nve_manifold_rattle.html,
|
||||
"nvk"_fix_nvk.html,
|
||||
"nvt/manifold/rattle"_fix_nvt_manifold_rattle.html,
|
||||
"nph/eff"_fix_nh_eff.html,
|
||||
"npt/eff"_fix_nh_eff.html,
|
||||
|
||||
@ -31,21 +31,19 @@ fix abf all colvars colvars.inp tstat 1 :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
This fix interfaces LAMMPS to a "collective variables" or "colvars"
|
||||
module library which allows to calculate potentials of mean force
|
||||
This fix interfaces LAMMPS to the collective variables "Colvars"
|
||||
library, which allows to calculate potentials of mean force
|
||||
(PMFs) for any set of colvars, using different sampling methods:
|
||||
currently implemented are the Adaptive Biasing Force (ABF) method,
|
||||
metadynamics, Steered Molecular Dynamics (SMD) and Umbrella Sampling
|
||||
(US) via a flexible harmonic restraint bias. The colvars library is
|
||||
hosted at "http://colvars.github.io/"_http://colvars.github.io/
|
||||
(US) via a flexible harmonic restraint bias.
|
||||
|
||||
This documentation describes only the fix colvars command itself and
|
||||
LAMMPS specific parts of the code. The full documentation of the
|
||||
colvars library is available as "this supplementary PDF document"_PDF/colvars-refman-lammps.pdf
|
||||
|
||||
A detailed discussion of the implementation of the portable collective
|
||||
variable library is in "(Fiorin)"_#Fiorin. Additional information can
|
||||
be found in "(Henin)"_#Henin.
|
||||
The Colvars library is developed at "https://github.com/colvars/colvars"_https://github.com/colvars/colvars
|
||||
A detailed discussion of its implementation is in "(Fiorin)"_#Fiorin.
|
||||
|
||||
There are some example scripts for using this package with LAMMPS in the
|
||||
examples/USER/colvars directory.
|
||||
@ -129,8 +127,3 @@ and tstat = NULL.
|
||||
|
||||
:link(Fiorin)
|
||||
[(Fiorin)] Fiorin , Klein, Henin, Mol. Phys., DOI:10.1080/00268976.2013.813594
|
||||
|
||||
:link(Henin)
|
||||
[(Henin)] Henin, Fiorin, Chipot, Klein, J. Chem. Theory Comput., 6,
|
||||
35-47 (2010)
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ fix eos/table/rx command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
fix ID group-ID eos/table/rx style file1 N keyword file2 :pre
|
||||
fix ID group-ID eos/table/rx style file1 N keyword ... :pre
|
||||
|
||||
ID, group-ID are documented in "fix"_fix.html command
|
||||
eos/table/rx = style name of this fix command
|
||||
@ -18,11 +18,16 @@ style = {linear} = method of interpolation
|
||||
file1 = filename containing the tabulated equation of state
|
||||
N = use N values in {linear} tables
|
||||
keyword = name of table keyword correponding to table file
|
||||
file2 = filename containing the heats of formation of each species :ul
|
||||
file2 = filename containing the heats of formation of each species (optional)
|
||||
deltaHf = heat of formation for a single species in energy units (optional)
|
||||
energyCorr = energy correction in energy units (optional)
|
||||
tempCorrCoeff = temperature correction coefficient (optional) :ul
|
||||
|
||||
[Examples:]
|
||||
|
||||
fix 1 all eos/table/rx linear eos.table 10000 KEYWORD thermo.table :pre
|
||||
fix 1 all eos/table/rx linear eos.table 10000 KEYWORD thermo.table
|
||||
fix 1 all eos/table/rx linear eos.table 10000 KEYWORD 1.5
|
||||
fix 1 all eos/table/rx linear eos.table 10000 KEYWORD 1.5 0.025 0.0 :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
@ -39,7 +44,15 @@ where {m} is the number of species, {c_i,j} is the concentration of
|
||||
species {j} in particle {i}, {u_j} is the internal energy of species j,
|
||||
{DeltaH_f,j} is the heat of formation of species {j}, N is the number of
|
||||
molecules represented by the coarse-grained particle, kb is the
|
||||
Boltzmann constant, and T is the temperature of the system.
|
||||
Boltzmann constant, and T is the temperature of the system. Additionally,
|
||||
it is possible to modify the concentration-dependent particle internal
|
||||
energy relation by adding an energy correction, temperature-dependent
|
||||
correction, and/or a molecule-dependent correction. An energy correction can
|
||||
be specified as a constant (in energy units). A temperature correction can be
|
||||
specified by multiplying a temperature correction coefficient by the
|
||||
internal temperature. A molecular correction can be specified by
|
||||
by multiplying a molecule correction coefficient by the average number of
|
||||
product gas particles in the coarse-grain particle.
|
||||
|
||||
Fix {eos/table/rx} creates interpolation tables of length {N} from {m}
|
||||
internal energy values of each species {u_j} listed in a file as a
|
||||
@ -58,6 +71,14 @@ file is described below.
|
||||
The second filename specifies a file containing heat of formation
|
||||
{DeltaH_f,j} for each species.
|
||||
|
||||
In cases where the coarse-grain particle represents a single molecular
|
||||
species (i.e., no reactions occur and fix {rx} is not present in the input file),
|
||||
fix {eos/table/rx} can be applied in a similar manner to fix {eos/table}
|
||||
within a non-reactive DPD simulation. In this case, the heat of formation
|
||||
filename is replaced with the heat of formation value for the single species.
|
||||
Additionally, the energy correction and temperature correction coefficients may
|
||||
also be specified as fix arguments.
|
||||
|
||||
:line
|
||||
|
||||
The format of a tabulated file is as follows (without the
|
||||
@ -116,6 +137,19 @@ Note that the species can be listed in any order. The tag that is
|
||||
used as the species name must correspond with the tags used to define
|
||||
the reactions with the "fix rx"_fix_rx.html command.
|
||||
|
||||
Alternatively, corrections to the EOS can be included by specifying
|
||||
three additional columns that correspond to the energy correction,
|
||||
the temperature correction coefficient and molecule correction
|
||||
coefficient. In this case, the format of the file is as follows:
|
||||
|
||||
# HEAT OF FORMATION TABLE (one or more comment or blank lines) :pre
|
||||
(blank)
|
||||
h2 0.00 1.23 0.025 0.0 (species name, heat of formation, energy correction, temperature correction coefficient, molecule correction coefficient)
|
||||
no2 0.34 0.00 0.000 -1.76
|
||||
n2 0.00 0.00 0.000 -1.76
|
||||
...
|
||||
no 0.93 0.00 0.000 -1.76 :pre
|
||||
|
||||
:line
|
||||
|
||||
[Restrictions:]
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
:line
|
||||
|
||||
fix momentum command :h3
|
||||
fix momentum/kk command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
@ -55,6 +56,29 @@ of atoms by rescaling the velocities after the momentum was removed.
|
||||
Note that the "velocity"_velocity.html command can be used to create
|
||||
initial velocities with zero aggregate linear and/or angular momentum.
|
||||
|
||||
:line
|
||||
|
||||
Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are
|
||||
functionally the same as the corresponding style without the suffix.
|
||||
They have been optimized to run faster, depending on your available
|
||||
hardware, as discussed in "Section 5"_Section_accelerate.html
|
||||
of the manual. The accelerated styles take the same arguments and
|
||||
should produce the same results, except for round-off and precision
|
||||
issues.
|
||||
|
||||
These accelerated styles are part of the GPU, USER-INTEL, KOKKOS,
|
||||
USER-OMP and OPT packages, respectively. They are only enabled if
|
||||
LAMMPS was built with those packages. See the "Making
|
||||
LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
You can specify the accelerated styles explicitly in your input script
|
||||
by including their suffix, or you can use the "-suffix command-line
|
||||
switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can
|
||||
use the "suffix"_suffix.html command in your input script.
|
||||
|
||||
See "Section 5"_Section_accelerate.html of the manual for
|
||||
more instructions on how to use the accelerated styles effectively.
|
||||
|
||||
[Restart, fix_modify, output, run start/stop, minimize info:]
|
||||
|
||||
No information about this fix is written to "binary restart
|
||||
|
||||
71
doc/src/fix_nvk.txt
Normal file
@ -0,0 +1,71 @@
|
||||
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
|
||||
|
||||
:link(lws,http://lammps.sandia.gov)
|
||||
:link(ld,Manual.html)
|
||||
:link(lc,Section_commands.html#comm)
|
||||
|
||||
:line
|
||||
|
||||
fix nvk command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
fix ID group-ID nvk :pre
|
||||
|
||||
ID, group-ID are documented in "fix"_fix.html command
|
||||
nvk = style name of this fix command :ul
|
||||
|
||||
[Examples:]
|
||||
|
||||
fix 1 all nvk :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
Perform constant kinetic energy integration using the Gaussian
|
||||
thermostat to update position and velocity for atoms in the group each
|
||||
timestep. V is volume; K is kinetic energy. This creates a system
|
||||
trajectory consistent with the isokinetic ensemble.
|
||||
|
||||
The equations of motion used are those of Minary et al in
|
||||
"(Minary)"_#nvk-Minary, a variant of those initially given by Zhang in
|
||||
"(Zhang)"_#nvk-Zhang.
|
||||
|
||||
The kinetic energy will be held constant at its value given when fix
|
||||
nvk is initiated. If a different kinetic energy is desired, the
|
||||
"velocity"_velocity.html command should be used to change the kinetic
|
||||
energy prior to this fix.
|
||||
|
||||
:line
|
||||
|
||||
[Restart, fix_modify, output, run start/stop, minimize info:]
|
||||
|
||||
No information about this fix is written to "binary restart
|
||||
files"_restart.html. None of the "fix_modify"_fix_modify.html options
|
||||
are relevant to this fix. No global or per-atom quantities are stored
|
||||
by this fix for access by various "output
|
||||
commands"_Section_howto.html#howto_15. No parameter of this fix can
|
||||
be used with the {start/stop} keywords of the "run"_run.html command.
|
||||
This fix is not invoked during "energy minimization"_minimize.html.
|
||||
|
||||
[Restrictions:]
|
||||
|
||||
The Gaussian thermostat only works when it is applied to all atoms in
|
||||
the simulation box. Therefore, the group must be set to all.
|
||||
|
||||
This fix has not yet been implemented to work with the RESPA integrator.
|
||||
|
||||
This fix is part of the USER-MISC package. It is only enabled if LAMMPS
|
||||
was built with that package. See the "Making
|
||||
LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
[Related commands:] none
|
||||
|
||||
[Default:] none
|
||||
|
||||
:line
|
||||
|
||||
:link(nvk-Minary)
|
||||
[(Minary)] Minary, Martyna, and Tuckerman, J Chem Phys, 18, 2510 (2003).
|
||||
|
||||
:link(nvk-Zhang)
|
||||
[(Zhang)] Zhang, J Chem Phys, 106, 6102 (1997).
|
||||
@ -90,6 +90,7 @@ Fixes :h1
|
||||
fix_nve_noforce
|
||||
fix_nve_sphere
|
||||
fix_nve_tri
|
||||
fix_nvk
|
||||
fix_nvt_asphere
|
||||
fix_nvt_body
|
||||
fix_nvt_manifold_rattle
|
||||
|
||||
@ -214,6 +214,7 @@ fix_nve_manifold_rattle.html
|
||||
fix_nve_noforce.html
|
||||
fix_nve_sphere.html
|
||||
fix_nve_tri.html
|
||||
fix_nvk.html
|
||||
fix_nvt_asphere.html
|
||||
fix_nvt_body.html
|
||||
fix_nvt_manifold_rattle.html
|
||||
|
||||
@ -10,16 +10,21 @@ pair_style exp6/rx command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
pair_style exp6/rx cutoff :pre
|
||||
pair_style exp6/rx cutoff ... :pre
|
||||
|
||||
cutoff = global cutoff for DPD interactions (distance units) :ul
|
||||
cutoff = global cutoff for DPD interactions (distance units)
|
||||
weighting = fractional or molecular (optional) :ul
|
||||
|
||||
[Examples:]
|
||||
|
||||
pair_style exp6/rx 10.0
|
||||
pair_coeff * * exp6.params h2o h2o 1.0 1.0 10.0
|
||||
pair_coeff * * exp6.params h2o 1fluid 1.0 1.0 10.0
|
||||
pair_coeff * * exp6.params 1fluid 1fluid 1.0 1.0 10.0 :pre
|
||||
pair_style exp6/rx 10.0 fractional
|
||||
pair_style exp6/rx 10.0 molecular
|
||||
pair_coeff * * exp6.params h2o h2o exponent 1.0 1.0 10.0
|
||||
pair_coeff * * exp6.params h2o 1fluid exponent 1.0 1.0 10.0
|
||||
pair_coeff * * exp6.params 1fluid 1fluid exponent 1.0 1.0 10.0
|
||||
pair_coeff * * exp6.params 1fluid 1fluid none 10.0
|
||||
pair_coeff * * exp6.params 1fluid 1fluid polynomial filename 10.0 :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
@ -50,14 +55,36 @@ defined in the reaction kinetics files specified with the "fix
|
||||
rx"_fix_rx.html command or they must correspond to the tag "1fluid",
|
||||
signifying interaction with a product species mixture determined
|
||||
through a one-fluid approximation. The interaction potential is
|
||||
weighted by the geometric average of the concentrations of the two
|
||||
species. The coarse-grained potential is stored before and after the
|
||||
weighted by the geometric average of either the mole fraction concentrations
|
||||
or the number of molecules associated with the interacting coarse-grained
|
||||
particles (see the {fractional} or {molecular} weighting pair style options).
|
||||
The coarse-grained potential is stored before and after the
|
||||
reaction kinetics solver is applied, where the difference is defined
|
||||
to be the internal chemical energy (uChem).
|
||||
|
||||
The fourth and fifth arguments specify the {Rm} and {epsilon} scaling exponents.
|
||||
The fourth argument specifies the type of scaling that will be used
|
||||
to scale the EXP-6 paramters as reactions occur. Currently, there
|
||||
are three scaling options: {exponent}, {polynomial} and {none}.
|
||||
|
||||
The final argument specifies the interaction cutoff.
|
||||
Exponent scaling requires two additional arguments for scaling
|
||||
the {Rm} and {epsilon} parameters, respectively. The scaling factor
|
||||
is computed by phi^exponent, where phi is the number of molecules
|
||||
represented by the coarse-grain particle and exponent is specified
|
||||
as a pair coefficient argument for {Rm} and {epsilon}, respectively.
|
||||
The {Rm} and {epsilon} parameters are multiplied by the scaling
|
||||
factor to give the scaled interaction paramters for the CG particle.
|
||||
|
||||
Polynomial scaling requires a filename to be specified as a pair
|
||||
coeff argument. The file contains the coefficients to a fifth order
|
||||
polynomial for the {alpha}, {epsilon} and {Rm} parameters that depend
|
||||
upon phi (the number of molecules represented by the CG particle).
|
||||
The format of a polynomial file is provided below.
|
||||
|
||||
The {none} option to the scaling does not have any additional pair coeff
|
||||
arguments. This is equivalent to specifying the {exponent} option with
|
||||
{Rm} and {epsilon} exponents of 0.0 and 0.0, respectively.
|
||||
|
||||
The final argument specifies the interaction cutoff (optional).
|
||||
|
||||
:line
|
||||
|
||||
@ -70,6 +97,19 @@ no2 exp6 13.60 0.01 3.70
|
||||
...
|
||||
co2 exp6 13.00 0.03 3.20 :pre
|
||||
|
||||
The format of the polynomial scaling file as follows (without the
|
||||
parenthesized comments):
|
||||
|
||||
# POLYNOMIAL FILE (one or more comment or blank lines) :pre
|
||||
# General Functional Form:
|
||||
# A*phi^5 + B*phi^4 + C*phi^3 + D*phi^2 + E*phi + F
|
||||
#
|
||||
# Parameter A B C D E F
|
||||
(blank)
|
||||
alpha 0.0000 0.00000 0.00008 0.04955 -0.73804 13.63201
|
||||
epsilon 0.0000 0.00478 -0.06283 0.24486 -0.33737 2.60097
|
||||
rm 0.0001 -0.00118 -0.00253 0.05812 -0.00509 1.50106 :pre
|
||||
|
||||
A section begins with a non-blank line whose 1st character is not a
|
||||
"#"; blank lines or lines starting with "#" can be used as comments
|
||||
between sections.
|
||||
@ -117,4 +157,4 @@ LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
"pair_coeff"_pair_coeff.html
|
||||
|
||||
[Default:] none
|
||||
[Default:] fractional weighting
|
||||
|
||||
@ -13,11 +13,14 @@ pair_style multi/lucy/rx command :h3
|
||||
pair_style multi/lucy/rx style N keyword ... :pre
|
||||
|
||||
style = {lookup} or {linear} = method of interpolation
|
||||
N = use N values in {lookup}, {linear} tables :ul
|
||||
N = use N values in {lookup}, {linear} tables
|
||||
weighting = fractional or molecular (optional) :ul
|
||||
|
||||
[Examples:]
|
||||
|
||||
pair_style multi/lucy/rx linear 1000
|
||||
pair_style multi/lucy/rx linear 1000 fractional
|
||||
pair_style multi/lucy/rx linear 1000 molecular
|
||||
pair_coeff * * multibody.table ENTRY1 h2o h2o 7.0
|
||||
pair_coeff * * multibody.table ENTRY1 h2o 1fluid 7.0 :pre
|
||||
|
||||
@ -94,8 +97,10 @@ tags must either correspond to the species defined in the reaction
|
||||
kinetics files specified with the "fix rx"_fix_rx.html command or they
|
||||
must correspond to the tag "1fluid", signifying interaction with a
|
||||
product species mixture determined through a one-fluid approximation.
|
||||
The interaction potential is weighted by the geometric average of the
|
||||
concentrations of the two species. The coarse-grained potential is
|
||||
The interaction potential is weighted by the geometric average of
|
||||
either the mole fraction concentrations or the number of molecules
|
||||
associated with the interacting coarse-grained particles (see the
|
||||
{fractional} or {molecular} weighting pair style options). The coarse-grained potential is
|
||||
stored before and after the reaction kinetics solver is applied, where
|
||||
the difference is defined to be the internal chemical energy (uChem).
|
||||
|
||||
@ -205,7 +210,7 @@ LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
"pair_coeff"_pair_coeff.html
|
||||
|
||||
[Default:] none
|
||||
[Default:] fractional weighting
|
||||
|
||||
:line
|
||||
|
||||
|
||||
@ -10,16 +10,17 @@ pair_style table/rx command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
pair_style table style N :pre
|
||||
pair_style table style N ... :pre
|
||||
|
||||
style = {lookup} or {linear} or {spline} or {bitmap} = method of interpolation
|
||||
N = use N values in {lookup}, {linear}, {spline} tables
|
||||
N = use 2^N values in {bitmap} tables
|
||||
weighting = fractional or molecular (optional) :ul
|
||||
|
||||
[Examples:]
|
||||
|
||||
pair_style table/rx linear 1000
|
||||
pair_style table/rx bitmap 12
|
||||
pair_style table/rx linear 1000 fractional
|
||||
pair_style table/rx linear 1000 molecular
|
||||
pair_coeff * * rxn.table ENTRY1 h2o h2o 10.0
|
||||
pair_coeff * * rxn.table ENTRY1 1fluid 1fluid 10.0
|
||||
pair_coeff * 3 rxn.table ENTRY1 h2o no2 10.0 :pre
|
||||
@ -84,8 +85,10 @@ tags must either correspond to the species defined in the reaction
|
||||
kinetics files specified with the "fix rx"_fix_rx.html command or they
|
||||
must correspond to the tag "1fluid", signifying interaction with a
|
||||
product species mixture determined through a one-fluid approximation.
|
||||
The interaction potential is weighted by the geometric average of the
|
||||
concentrations of the two species. The coarse-grained potential is
|
||||
The interaction potential is weighted by the geometric average of
|
||||
either the mole fraction concentrations or the number of molecules
|
||||
associated with the interacting coarse-grained particles (see the
|
||||
{fractional} or {molecular} weighting pair style options). The coarse-grained potential is
|
||||
stored before and after the reaction kinetics solver is applied, where
|
||||
the difference is defined to be the internal chemical energy (uChem).
|
||||
|
||||
@ -230,7 +233,7 @@ LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
"pair_coeff"_pair_coeff.html
|
||||
|
||||
[Default:] none
|
||||
[Default:] fractional weighting
|
||||
|
||||
:line
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ python func keyword args ... :pre
|
||||
|
||||
func = name of Python function :ulb,l
|
||||
one or more keyword/args pairs must be appended :l
|
||||
keyword = {invoke} or {input} or {return} or {format} or {file} or {here} or {exists}
|
||||
keyword = {invoke} or {input} or {return} or {format} or {length} or {file} or {here} or {exists}
|
||||
{invoke} arg = none = invoke the previously defined Python function
|
||||
{input} args = N i1 i2 ... iN
|
||||
N = # of inputs to function
|
||||
@ -29,6 +29,8 @@ keyword = {invoke} or {input} or {return} or {format} or {file} or {here} or {ex
|
||||
M = N+1 if there is a return value
|
||||
fstring = each character (i,f,s,p) corresponds in order to an input or return value
|
||||
'i' = integer, 'f' = floating point, 's' = string, 'p' = SELF
|
||||
{length} arg = Nlen
|
||||
Nlen = max length of string returned from Python function
|
||||
{file} arg = filename
|
||||
filename = file of Python code, which defines func
|
||||
{here} arg = inline
|
||||
@ -165,6 +167,17 @@ equal-style variable as an argument, but only if the output of the
|
||||
Python function is flagged as a numeric value ("i" or "f") via the
|
||||
{format} keyword.
|
||||
|
||||
If the {return} keyword is used and the {format} keyword specifies the
|
||||
output as a string, then the default maximum length of that string is
|
||||
63 characters (64-1 for the string terminator). If you want to return
|
||||
a longer string, the {length} keyword can be specified with its {Nlen}
|
||||
value set to a larger number (the code allocates space for Nlen+1 to
|
||||
include the string terminator). If the Python function generates a
|
||||
string longer than the default 63 or the specified {Nlen}, it will be
|
||||
trunctated.
|
||||
|
||||
:line
|
||||
|
||||
Either the {file}, {here}, or {exists} keyword must be used, but only
|
||||
one of them. These keywords specify what Python code to load into the
|
||||
Python interpreter. The {file} keyword gives the name of a file,
|
||||
|
||||
@ -11,10 +11,22 @@ LAMMPS GitHub tutorial :h3
|
||||
|
||||
:line
|
||||
|
||||
This document briefly describes how to use GitHub to merge changes you
|
||||
make into LAMMPS, using GitHub. It assumes that you are familiar with
|
||||
git. You may want to have a look at the "Git
|
||||
book"_http://git-scm.com/book/ to reacquaint yourself.
|
||||
This document describes the process of how to use GitHub to integrate
|
||||
changes or additions you have made to LAMMPS into the official LAMMPS
|
||||
distribution. It uses the process of updating this very tutorial as
|
||||
an example to describe the individual steps and options. You need to
|
||||
be familiar with git and you may want to have a look at the
|
||||
"Git book"_http://git-scm.com/book/ to reacquaint yourself with some
|
||||
of the more advanced git features used below.
|
||||
|
||||
As of fall 2016, submitting contributions to LAMMPS via pull requests
|
||||
on GitHub is the preferred option for integrating contributed features
|
||||
or improvements to LAMMPS, as it significantly reduces the amount of
|
||||
work required by the LAMMPS developers. Consequently, creating a pull
|
||||
request will increase your chances to have your contribution included
|
||||
and will reduce the time until the integration is complete. For more
|
||||
information on the requirements to have your code included into LAMMPS
|
||||
please see "Section 10.15"_Section_modify.html#mod_15
|
||||
|
||||
:line
|
||||
|
||||
@ -30,106 +42,121 @@ username or e-mail address and password.
|
||||
|
||||
[Forking the repository]
|
||||
|
||||
To get changes into LAMMPS, you need to first fork the repository. At
|
||||
the time of writing, LAMMPS-ICMS is the preferred fork. Go to "LAMMPS
|
||||
on GitHub"_https://github.com/lammps/lammps and make sure branch is
|
||||
set to "lammps-icms", see the figure below.
|
||||
To get changes into LAMMPS, you need to first fork the `lammps/lammps`
|
||||
repository on GitHub. At the time of writing, {master} is the preferred
|
||||
target branch. Thus go to "LAMMPS on GitHub"_https://github.com/lammps/lammps
|
||||
and make sure branch is set to "master", as shown in the figure below.
|
||||
|
||||
:c,image(JPG/tutorial_branch.png)
|
||||
|
||||
Now, click on fork in the top right corner:
|
||||
If it is not, use the button to change it to {master}. Once it is, use the
|
||||
fork button to create a fork.
|
||||
|
||||
:c,image(JPG/tutorial_fork.png)
|
||||
|
||||
This will create your own fork of the LAMMPS repository. You can make
|
||||
changes in this fork and later file {pull requests} to allow the
|
||||
upstream repository to merge changes from your own fork into the one
|
||||
we just forked from. At the same time, you can set things up, so you
|
||||
can include changes from upstream into your repository.
|
||||
|
||||
This will create a fork (which is essentially a copy, but uses less
|
||||
resources) of the LAMMPS repository under your own GitHub account. You
|
||||
can make changes in this fork and later file {pull requests} to allow
|
||||
the upstream repository to merge changes from your own fork into the one
|
||||
we just forked from (or others that were forked from the same repository).
|
||||
At the same time, you can set things up, so you can include changes from
|
||||
upstream into your repository and thus keep it in sync with the ongoing
|
||||
LAMMPS development.
|
||||
|
||||
:line
|
||||
|
||||
[Adding changes to your own fork]
|
||||
|
||||
Before adding changes, it is better to first create a new branch that
|
||||
will contain these changes, a so-called feature branch.
|
||||
Additions to the upstream version of LAMMPS are handled using {feature
|
||||
branches}. For every new feature, a so-called feature branch is
|
||||
created, which contains only those modification relevant to one specific
|
||||
feature. For example, adding a single fix would consist of creating a
|
||||
branch with only the fix header and source file and nothing else. It is
|
||||
explained in more detail here: "feature branch
|
||||
workflow"_https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow.
|
||||
|
||||
[Feature branches]
|
||||
|
||||
Since LAMMPS is such a big project and most user contributions come in
|
||||
small portions, the most ideal workflow for LAMMPS is the so-called
|
||||
"Feature branch" workflow. It is explained in great detail here:
|
||||
"feature branch
|
||||
workflow"_https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow.
|
||||
First of all, create a clone of your version on github on your local
|
||||
machine via HTTPS:
|
||||
|
||||
The idea is that every new feature for LAMMPS gets its own
|
||||
branch. This way, it is fairly painless to incorporate new features
|
||||
into the upstream repository. I will explain briefly here how to do
|
||||
it. In this feature branch, I will add a USER-package.
|
||||
$ git clone https://github.com/<your user name>/lammps.git <some name> :pre
|
||||
|
||||
I assume that git is installed on the local machine and you know how
|
||||
to use a command line.
|
||||
or, if you have set up your GitHub account for using SSH keys, via SSH:
|
||||
|
||||
First of all, you need to clone your own fork of LAMMPS:
|
||||
|
||||
$ git clone https://github.com/<your user name>/lammps.git :pre
|
||||
|
||||
You can find the proper url to the right of the "HTTPS" block, see figure.
|
||||
$ git clone git@github.com:<your user name>/lammps.git :pre
|
||||
|
||||
You can find the proper URL by clicking the "Clone or download"-button:
|
||||
|
||||
:c,image(JPG/tutorial_https_block.png)
|
||||
|
||||
The above command copies ("clones") the git repository to your local
|
||||
machine. You can use this local clone to make changes and test them
|
||||
without interfering with the repository on github. First, however, it
|
||||
is recommended to make a new branch for a particular feature you would
|
||||
like added to LAMMPS. In this example, I will try adding a new
|
||||
USER-package called USER-MANIFOLD.
|
||||
machine to a directory with the name you chose. If none is given, it will
|
||||
default to "lammps". Typical names are "mylammps" or something similar.
|
||||
|
||||
To create a new branch, run the following git command in your repository:
|
||||
You can use this local clone to make changes and
|
||||
test them without interfering with the repository on Github.
|
||||
|
||||
$ git checkout -b add-user-manifold :pre
|
||||
To pull changes from upstream into this copy, you can go to the directory
|
||||
and use git pull:
|
||||
|
||||
The name of this new branch is "add-user-manifold" in my case. Just
|
||||
name it after something that resembles the feature you want added to
|
||||
LAMMPS.
|
||||
$ cd mylammps
|
||||
$ git checkout master
|
||||
$ git pull https://github.com/lammps/lammps :pre
|
||||
|
||||
Now that you've changed branches, you can edit the files as you see
|
||||
fit, add new files, and commit as much as you would like. Just
|
||||
remember that if halfway you decide to add another, unrelated feature,
|
||||
you should switch branches!
|
||||
You can also add this URL as a remote:
|
||||
|
||||
$ git remote add lammps_upstream https://www.github.com/lammps/lammps :pre
|
||||
|
||||
At this point, you typically make a feature branch from the updated master
|
||||
branch for the feature you want to work on. This tutorial contains the
|
||||
workflow that updated this tutorial, and hence we will call the branch
|
||||
"github-tutorial-update":
|
||||
|
||||
$ git checkout -b github-tutorial-update master :pre
|
||||
|
||||
Now that we have changed branches, we can make our changes to our local
|
||||
repository. Just remember that if you want to start working on another,
|
||||
unrelated feature, you should switch branches!
|
||||
|
||||
[After changes are made]
|
||||
|
||||
After everything is done, add the files to the branch and commit them:
|
||||
|
||||
$ git add src/USER-MANIFOLD examples/USER/manifold/
|
||||
$ git add doc/fix_nv\{t,e\}_manifold_rattle.txt
|
||||
$ git add doc/fix_manifoldforce.txt doc/user_manifolds.txt :pre
|
||||
$ git add doc/src/tutorial_github.txt
|
||||
$ git add doc/src/JPG/tutorial*.png :pre
|
||||
|
||||
After the files are added, the change should be comitted:
|
||||
IMPORTANT NOTE: Do not use {git commit -a} (or {git add -A}). The -a
|
||||
flag (or -A flag) will automatically include _all_ modified or new files
|
||||
and that is rarely the behavior you want. It can easily lead to
|
||||
accidentally adding unrelated and unwanted changes into the repository.
|
||||
Instead it is preferable to explicitly use {git add}, {git rm}, {git mv}
|
||||
for adding, removing, renaming individual files, respectively, and then
|
||||
{git commit} to finalize the commit. Carefully check all pending
|
||||
changes with {git status} before committing them. If you find doing
|
||||
this on the command line too tedious, consider using a GUI, for example
|
||||
the one included in git distributions written in Tk, i.e. use {git gui}
|
||||
(on some Linux distributions it may be required to install an additional
|
||||
package to use it).
|
||||
|
||||
$ git commit -m 'Added user-manifold package' :pre
|
||||
After adding all files, the change set can be committed with some
|
||||
useful message that explains the change.
|
||||
|
||||
The "-m" switch is used to add a message to the commit. Use this to
|
||||
indicate what type of change was commited.
|
||||
|
||||
[Wisdom by Axel]
|
||||
|
||||
{"Do not use "git commit -a". the -a flag will automatically include
|
||||
*all* modified or new files. mercurial does that and it find it
|
||||
hugely annoying and often leading to accidental commits of files you
|
||||
don't want. use git add, git rm, git mv for adding, removing,
|
||||
renaming and then git commit to finalize the commit. personally, i
|
||||
find it very convenient to use the bundled gui for commits, i.e. git
|
||||
gui. typically, i will do git add and other operations, but then
|
||||
verify and review them with git gui. git gui also allows to do
|
||||
line-by-line unstaging and other convenient operations."}
|
||||
$ git commit -m 'Finally updated the github tutorial' :pre
|
||||
|
||||
After the commit, the changes can be pushed to the same branch on GitHub:
|
||||
|
||||
$ git push :pre
|
||||
|
||||
Git will ask you for your user name and password on GitHub if you have
|
||||
not configured anything. If you correctly type your user name and
|
||||
password, the change should be added to your fork on GitHub.
|
||||
not configured anything. If your local branch is not present on Github yet,
|
||||
it will ask you to add it by running
|
||||
|
||||
$ git push --set-upstream origin github-tutorial-update :pre
|
||||
|
||||
If you correctly type your user name and
|
||||
password, the feature branch should be added to your fork on GitHub.
|
||||
|
||||
If you want to make really sure you push to the right repository
|
||||
(which is good practice), you can provide it explicitly:
|
||||
@ -140,16 +167,20 @@ or using an explicit URL:
|
||||
|
||||
$ git push git@github.com:Pakketeretet2/lammps.git :pre
|
||||
|
||||
After that, you can file a new pull request based on this
|
||||
branch. GitHub will now look like this:
|
||||
:line
|
||||
|
||||
:c,image(JPG/tutorial_pull_request_feature_branch1.png)
|
||||
[Filing a pull request]
|
||||
|
||||
Up to this point in the tutorial, all changes were to {your} clones of
|
||||
LAMMPS. Eventually, however, you want this feature to be included into
|
||||
the official LAMMPS version. To do this, you will want to file a pull
|
||||
request by clicking on the "New pull request" button:
|
||||
|
||||
:c,image(JPG/tutorial_new_pull_request.png)
|
||||
|
||||
Make sure that the current branch is set to the correct one, which, in
|
||||
this case, is "add-user-manifold". Now click "New pull request". If
|
||||
done correctly, the only changes you will see are those that were made
|
||||
on this branch, so in my case, I will see nothing related to
|
||||
$\mathrm{pair\_dzugatov}.$
|
||||
this case, is "github-tutorial-update". If done correctly, the only
|
||||
changes you will see are those that were made on this branch.
|
||||
|
||||
This will open up a new window that lists changes made to the
|
||||
repository. If you are just adding new files, there is not much to do,
|
||||
@ -158,36 +189,159 @@ changes in existing files. If all changes can automatically be merged,
|
||||
green text at the top will say so and you can click the "Create pull
|
||||
request" button, see image.
|
||||
|
||||
:c,image(JPG/tutorial_pull_request2.png)
|
||||
:c,image(JPG/tutorial_create_new_pull_request1.png)
|
||||
|
||||
After this you have to specify a short title and a comment with
|
||||
details about your pull request. I guess here you write what your
|
||||
modifications do and why they should be incorporated upstream. After
|
||||
that, click the "Create pull request" button, see image below.
|
||||
Before creating the pull request, make sure the short title is accurate
|
||||
and add a comment with details about your pull request. Here you write
|
||||
what your modifications do and why they should be incorporated upstream.
|
||||
|
||||
:c,image(JPG/tutorial_pull_request3.png)
|
||||
Note the checkbox that says "Allow edits from maintainers".
|
||||
This is checked by default checkbox (although in my version of Firefox, only the checkmark is visible):
|
||||
|
||||
Now just write some nice comments, click "Comment", and that is it. It
|
||||
is now up to the maintainer(s) of the upstream repository to
|
||||
incorporate the changes into the repository and to close the pull
|
||||
request.
|
||||
:c,image(JPG/tutorial_edits_maintainers.png)
|
||||
|
||||
:c,image(JPG/tutorial_pull_request4.png)
|
||||
If it is checked, maintainers can immediately add their own edits to the
|
||||
pull request. This helps the inclusion of your branch significantly, as
|
||||
simple/trivial changes can be added directly to your pull request branch
|
||||
by the LAMMPS maintainers. The alternative would be that they make
|
||||
changes on their own version of the branch and file a reverse pull
|
||||
request to you. Just leave this box checked unless you have a very good
|
||||
reason not to.
|
||||
|
||||
Now just write some nice comments and click on "Create pull request".
|
||||
|
||||
:c,image(JPG/tutorial_create_new_pull_request2.png)
|
||||
|
||||
:line
|
||||
|
||||
[After filing a pull request]
|
||||
|
||||
NOTE: When you submit a pull request (or ask for a pull request) for the
|
||||
first time, you will receive an invitation to become a LAMMPS project
|
||||
collaborator. Please accept this invite as being a collaborator will
|
||||
simplify certain administrative tasks and will probably speed up the
|
||||
merging of your feature, too.
|
||||
|
||||
You will notice that after filing the pull request, some checks are
|
||||
performed automatically:
|
||||
|
||||
:c,image(JPG/tutorial_automated_checks.png)
|
||||
|
||||
If all is fine, you will see this:
|
||||
|
||||
:c,image(JPG/tutorial_automated_checks_passed.png)
|
||||
|
||||
If any of the checks are failing, your pull request will not be
|
||||
processed, as your changes may break compilation for certain
|
||||
configurations or may not merge cleanly. It is your responsibility
|
||||
to remove the reason(s) for the failed test(s). If you need help
|
||||
with this, please contact the LAMMPS developers by adding a comment
|
||||
explaining your problems with resolving the failed tests.
|
||||
|
||||
A few further interesting things (can) happen to pull requests before
|
||||
they are included.
|
||||
|
||||
[Additional changes]
|
||||
|
||||
Before the pull request is accepted, any additional changes you push
|
||||
into your repository will automatically become part of the pull
|
||||
request.
|
||||
First of all, any additional changes you push into your branch in your
|
||||
repository will automatically become part of the pull request:
|
||||
|
||||
:c,image(JPG/tutorial_additional_changes.png)
|
||||
|
||||
This means you can add changes that should be part of the feature after
|
||||
filing the pull request, which is useful in case you have forgotten
|
||||
them, or if a developer has requested that something needs to be changed
|
||||
before the feature can be accepted into the official LAMMPS version.
|
||||
After each push, the automated checks are run again.
|
||||
|
||||
[Assignees]
|
||||
|
||||
There is an assignee label for pull requests. If the request has not
|
||||
been reviewed by any developer yet, it is not assigned to anyone. After
|
||||
revision, a developer can choose to assign it to either a) you, b) a
|
||||
LAMMPS developer (including him/herself) or c) Steve Plimpton (sjplimp).
|
||||
|
||||
Case a) happens if changes are required on your part :ulb,l
|
||||
Case b) means that at the moment, it is being tested and reviewed by a
|
||||
LAMMPS developer with the expectation that some changes would be required.
|
||||
After the review, the developer can choose to implement changes directly
|
||||
or suggest them to you. :l
|
||||
Case c) means that the pull request has been assigned to the lead
|
||||
developer Steve Plimpton and means it is considered ready for merging. :ule,l
|
||||
|
||||
In this case, Axel assigned the tutorial to Steve:
|
||||
|
||||
:c,image(JPG/tutorial_steve_assignee.png)
|
||||
|
||||
[Edits from LAMMPS maintainers]
|
||||
|
||||
If you allowed edits from maintainers (the default), any LAMMPS
|
||||
maintainer can add changes to your pull request. In this case, both
|
||||
Axel and Richard made changes to the tutorial:
|
||||
|
||||
:c,image(JPG/tutorial_changes_others.png)
|
||||
|
||||
[Reverse pull requests]
|
||||
|
||||
Sometimes, however, you might not feel comfortable having other people
|
||||
push changes into your own branch, or maybe the maintainers are not sure
|
||||
their idea was the right one. In such a case, they can make changes,
|
||||
reassign you as the assignee, and file a "reverse pull request", i.e.
|
||||
file a pull request in your GitHub repository to include changes in the
|
||||
branch, that you have submitted as a pull request yourself. In that
|
||||
case, you can choose to merge their changes back into your branch,
|
||||
possibly make additional changes or corrections and proceed from there.
|
||||
It looks something like this:
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request.png)
|
||||
|
||||
For some reason, the highlighted button didn't work in my case, but I
|
||||
can go to my own repository and merge the pull request from there:
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request2.png)
|
||||
|
||||
Be sure to check the changes to see if you agree with them by clicking
|
||||
on the tab button:
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request3.png)
|
||||
|
||||
In this case, most of it is changes in the markup and a short rewrite of
|
||||
Axel's explanation of the "git gui" and "git add" commands.
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request4.png)
|
||||
|
||||
Because the changes are OK with us, we are going to merge by clicking on
|
||||
"Merge pull request". After a merge it looks like this:
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request5.png)
|
||||
|
||||
Now, since in the meantime our local text for the tutorial also changed,
|
||||
we need to pull Axel's change back into our branch, and merge them:
|
||||
|
||||
$ git add tutorial_github.txt
|
||||
$ git add JPG/tutorial_reverse_pull_request*.png
|
||||
$ git commit -m "Updated text and images on reverse pull requests"
|
||||
$ git pull :pre
|
||||
|
||||
In this case, the merge was painless because git could auto-merge:
|
||||
|
||||
:c,image(JPG/tutorial_reverse_pull_request6.png)
|
||||
|
||||
With Axel's changes merged in and some final text updates, our feature
|
||||
branch is now perfect as far as we are concerned, so we are going to
|
||||
commit and push again:
|
||||
|
||||
$ git add tutorial_github.txt
|
||||
$ git add JPG/tutorial_reverse_pull_request6.png
|
||||
$ git commit -m "Merged Axel's suggestions and updated text"
|
||||
$ git push git@github.com:Pakketeretet2/lammps :pre
|
||||
|
||||
|
||||
:line
|
||||
|
||||
[After a merge]
|
||||
|
||||
When everything is fine the feature branch is merged into the LAMMPS
|
||||
repositories:
|
||||
When everything is fine, the feature branch is merged into the master branch.
|
||||
|
||||
:c,image(JPG/tutorial_merged.png)
|
||||
|
||||
@ -198,17 +352,29 @@ It is in principle safe to delete them from your own fork. This helps
|
||||
keep it a bit more tidy. Note that you first have to switch to another
|
||||
branch!
|
||||
|
||||
$ git checkout lammps-icms
|
||||
$ git pull lammps-icms
|
||||
$ git branch -d add-user-manifold :pre
|
||||
$ git checkout master
|
||||
$ git pull master
|
||||
$ git branch -d github-tutorial-update :pre
|
||||
|
||||
If you do not pull first, it is not really a problem but git will warn
|
||||
you at the next statement that you are deleting a local branch that
|
||||
was not yet fully merged into HEAD. This is because git does not yet
|
||||
know your branch just got merged into lammps-icms upstream. If you
|
||||
know your branch just got merged into LAMMPS upstream. If you
|
||||
first delete and then pull, everything should still be fine.
|
||||
|
||||
Finally, if you delete the branch locally, you might want to push this
|
||||
to your remote(s) as well:
|
||||
|
||||
$ git push origin :add-user-manifold :pre
|
||||
$ git push origin :github-tutorial-update :pre
|
||||
|
||||
[Recent changes in the workflow]
|
||||
|
||||
Some changes to the workflow are not captured in this tutorial. For
|
||||
example, in addition to the master branch, to which all new features
|
||||
should be submitted, there is now also an "unstable" and a "stable"
|
||||
branch; these have the same content as "master", but are only updated
|
||||
after a patch release or stable release was made.
|
||||
Furthermore, the naming of the patches now follow the pattern
|
||||
"patch_<Day><Month><Year>" to simplify comparisons between releases.
|
||||
Finally, all patches and submissions are subject to automatic testing
|
||||
and code checks to make sure they at the very least compile.
|
||||
|
||||
@ -35,129 +35,133 @@ thermo_modify format float %24.16f
|
||||
|
||||
run 1000
|
||||
Neighbor list info ...
|
||||
1 neighbor list requests
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 10.6
|
||||
ghost atom cutoff = 10.6
|
||||
binsize = 5.3 -> bins = 25 25 25
|
||||
Memory usage per processor = 3.36353 Mbytes
|
||||
binsize = 5.3, bins = 25 25 25
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair dpd/fdt/energy, perpetual
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
Memory usage per processor = 4.28221 Mbytes
|
||||
Step Temp Press PotEng KinEng c_dpdU[1] c_dpdU[2] v_totEnergy c_dpdU[4]
|
||||
0 301.4391322267262012 1636.1776395935085020 1188.6488072196075336 394.4722035796053206 7852.5601874986105031 7852.5601874986105031 17288.2413857964347699 299.9999999999841407
|
||||
10 301.4791572483523510 1486.4422375141198245 1188.7147620806101713 394.5245815119678241 7852.5601874999802021 7852.3731942333779443 17288.1727253259377903 299.9960221120699089
|
||||
20 301.4275643919337426 1677.9356110821624952 1188.7839634625399867 394.4570655673388728 7852.5601874999938445 7852.3711851933012440 17288.1724017231754260 299.9955485734552099
|
||||
30 301.2240988054542186 1452.7304951528931269 1188.8550809767796181 394.1908044563202225 7852.5601875000002110 7852.5679666239848302 17288.1740395570850524 299.9988968405210130
|
||||
40 301.1023506886409677 1527.9758363521380033 1188.9264527568634549 394.0314812537677653 7852.5601874999947540 7852.6574764573806533 17288.1755979680056043 300.0001694462812338
|
||||
50 301.0409654880461972 1597.1737251233498682 1188.9944523606982330 393.9511507566391515 7852.5601875000029395 7852.6700547249911324 17288.1758453423317405 299.9999653064982681
|
||||
60 301.2904978886139133 1610.8630327676828529 1189.0651026961211301 394.2776962691256131 7852.5601874999829306 7852.2734988976435488 17288.1764853628737910 299.9919857290491905
|
||||
70 300.8575037843163500 1489.3259312130880971 1189.1295686642290548 393.7110673208616731 7852.5601874999856591 7852.7707182199101226 17288.1715417049854295 300.0010992278233175
|
||||
80 300.5955830326474825 1449.3896097889587509 1189.1880764967559116 393.3683100440913449 7852.5601875000411383 7853.0484238882281716 17288.1649979291178170 300.0059513551503301
|
||||
90 301.0092332775843147 1553.9266324350364812 1189.2470037925052111 393.9096250433288446 7852.5601875000420478 7852.4452067113825251 17288.1620230472581170 299.9940347326859182
|
||||
100 301.0478004479094238 1539.2270336322194453 1189.3010269201699884 393.9600951881690207 7852.5601875000074870 7852.3416236045995902 17288.1629332129450631 299.9916385566916119
|
||||
110 300.9609384905550087 1500.0429484565006533 1189.3524514939088021 393.8464250502817663 7852.5601874999983920 7852.4114980357189779 17288.1705620799075405 299.9925626482005327
|
||||
120 300.9625536631411933 1630.5065919443034090 1189.4006029528841282 393.8485387131115658 7852.5601875000575092 7852.3600810123671181 17288.1694101784196391 299.9911580775880680
|
||||
130 301.0373750247310340 1539.2267307640183844 1189.4426173625224692 393.9464521696795032 7852.5601874999993015 7852.2178388309775983 17288.1670958631802932 299.9879581026651749
|
||||
140 300.7465104415114752 1550.8353679735087098 1189.4887352231000932 393.5658181350791551 7852.5601874999920256 7852.5559582333216895 17288.1706990914935886 299.9939749909034958
|
||||
150 300.6667173911141617 1634.8987162883277051 1189.5368575067818711 393.4613985788388959 7852.5601874999920256 7852.6079668015609059 17288.1664103871735279 299.9946423938895350
|
||||
160 300.4684731724562425 1462.9400882126803936 1189.5825022927965620 393.2019703048678707 7852.5601874999847496 7852.8265187980177870 17288.1711788956672535 299.9983600613423960
|
||||
170 300.1439323338466920 1510.2352578813552100 1189.6305700279478970 392.7772665220106774 7852.5601874999802021 7853.2009671047335360 17288.1689911546709482 300.0051118582463232
|
||||
180 300.1074244553407198 1529.6307083879951279 1189.6764977580119194 392.7294912276224181 7852.5601874999729262 7853.2047509722533505 17288.1709274578606710 300.0047089238623812
|
||||
190 300.4193298066089142 1546.3205495807171701 1189.7172820166240399 393.1376598363699486 7852.5601874999847496 7852.7461854379371289 17288.1613147909156396 299.9954451643528728
|
||||
200 300.3353919251508728 1532.5496449337254035 1189.7600175880224924 393.0278162310690391 7852.5601874999683787 7852.8107089913455638 17288.1587303104060993 299.9962707550171785
|
||||
210 300.3276568499739483 1504.8178651700843602 1189.7998299597820733 393.0176938818990493 7852.5601875000156724 7852.7810130200659842 17288.1587243617614149 299.9953436245502871
|
||||
220 300.5768315696971626 1592.5896084568344122 1189.8391466344742184 393.3437713226064716 7852.5601875000329528 7852.4205574703573802 17288.1636629274726147 299.9880321846658831
|
||||
230 300.6587445618569063 1672.3049358942289473 1189.8766340798690635 393.4509650976162334 7852.5601874999847496 7852.2733199687863817 17288.1611066462573945 299.9848228571166828
|
||||
240 300.7517707836825025 1527.1722267937811921 1189.9126240081129708 393.5727019751183207 7852.5601875000065775 7852.1160682173085661 17288.1615817005440476 299.9814952182625802
|
||||
250 300.8473715548367409 1589.1847713095248764 1189.9441342461948352 393.6978079843565865 7852.5601875000047585 7851.9625847797888127 17288.1647145103452203 299.9782210858571148
|
||||
260 300.8450266408960942 1623.1896863377055524 1189.9636161513917614 393.6947393603111891 7852.5601874999820211 7851.9471828473988353 17288.1657258590821584 299.9775302202895659
|
||||
270 300.6663619570709898 1564.5160171187899323 1189.9764081239700317 393.4609334472908131 7852.5601875000193104 7852.1708276117251444 17288.1683566830033669 299.9812899253168439
|
||||
280 300.7668534205726019 1618.5400526904263643 1189.9872008155405183 393.5924395618274048 7852.5601875000184009 7852.0271568534708422 17288.1669847308585304 299.9781169783826158
|
||||
290 300.8462727198648849 1562.6765776748122789 1189.9918265985252219 393.6963700162682471 7852.5601875000211294 7851.9189772084127981 17288.1673613232269417 299.9756806168044250
|
||||
300 300.8095414073812890 1525.1785808192844343 1189.9873922767767453 393.6483023295390922 7852.5601875000020300 7851.9657301693578120 17288.1616122756749974 299.9761279889730758
|
||||
310 300.9496330741350221 1566.5597234051326723 1189.9752299662607129 393.8316304464934774 7852.5601875000056680 7851.7898117189633922 17288.1568596317229094 299.9723726900590464
|
||||
320 301.2370566356515837 1513.6869483705047514 1189.9626455872523820 394.2077614578674343 7852.5601874999929350 7851.4248466706330873 17288.1554412157456682 299.9650543775110236
|
||||
330 301.3279721508968692 1549.0667862452519330 1189.9513389477854162 394.3267362020337146 7852.5601874999929350 7851.3129955581916875 17288.1512582080031279 299.9625537201162615
|
||||
340 301.1145736537583844 1414.7930515101759283 1189.9408691169965095 394.0474765890400590 7852.5601874999993015 7851.6028846074832472 17288.1514178135184920 299.9677356565828745
|
||||
350 301.1651600907370039 1529.8016115175887535 1189.9314470205476937 394.1136755032911196 7852.5601874999929350 7851.5441417268757505 17288.1494517507089768 299.9662576716461331
|
||||
360 301.0550563185083206 1536.7721716375504002 1189.9200519814730796 393.9695904359920178 7852.5601875000074870 7851.7101209691463737 17288.1599508866202086 299.9690811750865009
|
||||
370 301.1008976932964742 1522.3385843459479929 1189.9109162496640693 394.0295798208944120 7852.5601875000211294 7851.6603423306560217 17288.1610259012340975 299.9677565060027860
|
||||
380 301.1656898730700505 1505.0548721701993600 1189.9005648244351505 394.1143687921909304 7852.5601875000056680 7851.5816827598300733 17288.1568038764598896 299.9659906785156522
|
||||
390 300.8379322662876802 1740.9151205755624687 1189.8851457594087151 393.6854554509390596 7852.5601875000238579 7852.0268864110385039 17288.1576751214088290 299.9741278188615752
|
||||
400 300.8663790447546376 1564.9461156870302148 1189.8690133470408909 393.7226817503372445 7852.5601875000411383 7852.0043792319993372 17288.1562618294192362 299.9732593416579789
|
||||
410 300.6263441860635908 1564.2840871092373618 1189.8566574093877080 393.4085650033033517 7852.5601874999892971 7852.3284491703725507 17288.1538590830532485 299.9792095875052951
|
||||
420 300.5302259436974168 1438.1569922368764765 1189.8406936554465574 393.2827818158641549 7852.5601875000302243 7852.4696075433648730 17288.1532705147074012 299.9815165752025337
|
||||
430 300.5877786105220935 1503.3641639033023694 1189.8251514530138593 393.3580969454444016 7852.5601874999802021 7852.4023373559457468 17288.1457732543858583 299.9798346272511935
|
||||
440 300.7289160804472772 1689.2527029957295781 1189.8035410609209066 393.5427936314976591 7852.5601875000029395 7852.2436462415198548 17288.1501684339418716 299.9764596782897570
|
||||
450 300.9487198282456575 1497.3668092174791582 1189.7808137689632986 393.8304353457919547 7852.5601874999938445 7851.9788323927432430 17288.1502690074921702 299.9710227473042323
|
||||
460 300.9359942496024587 1625.1573864018491804 1189.7615359247627111 393.8137822755282400 7852.5601875000147629 7852.0165192783370003 17288.1520249786408385 299.9713565393226986
|
||||
470 301.0000133856357252 1486.1561922844011860 1189.7439269526955741 393.8975596188205941 7852.5601874999656502 7851.9561324572268859 17288.1578065287103527 299.9697143418395626
|
||||
480 300.8568627175957886 1535.6080526199095857 1189.7237810071801505 393.7102284019063063 7852.5601874999601932 7852.1697010727630186 17288.1638979818089865 299.9732503057674080
|
||||
490 301.0608040775520067 1497.3221544489886128 1189.7062242497636362 393.9771121242308709 7852.5601874999974825 7851.9258988739011329 17288.1694227478947141 299.9682362511933320
|
||||
500 301.0232592587148019 1517.5854528541199215 1189.6911287485861521 393.9279798589197981 7852.5601875000247674 7851.9823225510326665 17288.1616186585633841 299.9690333355835037
|
||||
510 300.7038579923685120 1420.2615974401142012 1189.6747661513456933 393.5100018730125839 7852.5601874999674692 7852.4114869568047652 17288.1564424811294884 299.9768186576545759
|
||||
520 300.5917863355052759 1537.4862082427132464 1189.6604754398756540 393.3633415734188361 7852.5601875000029395 7852.5789017095057716 17288.1629062228021212 299.9795694302102333
|
||||
530 300.4751352158502868 1481.1071694751799441 1189.6453243069925065 393.2106884527691477 7852.5601874999811116 7852.7451655714066874 17288.1613658311471227 299.9823181268525900
|
||||
540 300.5380123640739498 1547.3461372766389559 1189.6261485232855648 393.2929713568877332 7852.5601875000375003 7852.6850583598352387 17288.1643657400454686 299.9808112190538623
|
||||
550 300.4253885005187499 1544.3485889749692888 1189.6033595464525661 393.1455884232119047 7852.5601874999756546 7852.8598718466746504 17288.1690073163154011 299.9835860164698147
|
||||
560 300.3263552442093101 1556.5150300058251105 1189.5759163336824713 393.0159905619273673 7852.5601875000111249 7853.0148613782675966 17288.1669557738860021 299.9861837797674866
|
||||
570 300.1977324643196425 1511.2320626303917379 1189.5441090918316149 392.8476709710407704 7852.5601875000102154 7853.2098259401755058 17288.1617935030590161 299.9896761688499964
|
||||
580 300.3543631005173893 1588.9566243200433746 1189.5094471319721379 393.0526424747489500 7852.5601875000156724 7853.0374555421631158 17288.1597326488990802 299.9859298211933378
|
||||
590 300.5019108864805730 1504.4406939723214691 1189.4809412920112663 393.2457278908070748 7852.5601874999874781 7852.8704277855340479 17288.1572844683396397 299.9823573257917815
|
||||
600 300.4791158523048011 1540.4690749004150803 1189.4551948503105905 393.2158976318902432 7852.5601875000220389 7852.9312239063838206 17288.1625038886049879 299.9832002920041987
|
||||
610 300.5939139841889869 1368.0565839211087678 1189.4252547652590692 393.3661258776944578 7852.5601874999574648 7852.8130977336286378 17288.1646658765384927 299.9807742697515778
|
||||
620 300.7674247480806002 1483.2566452708945235 1189.3941250938435132 393.5931872179773450 7852.5601875000193104 7852.6187967208716145 17288.1662965327122947 299.9766963671718258
|
||||
630 300.7920034341021278 1543.0699124130637756 1189.3598279316649950 393.6253516166882491 7852.5601875000302243 7852.6219971866230480 17288.1673642350069713 299.9762538437230432
|
||||
640 300.8032734267029014 1423.2549819291616586 1189.3293074476885067 393.6400998638143278 7852.5601874999847496 7852.6384826097782934 17288.1680774212654796 299.9762118202994543
|
||||
650 300.7516995878241346 1542.6559695158523482 1189.3021161045705867 393.5726088061030055 7852.5601874999720167 7852.7361949473242930 17288.1711073579681397 299.9775656396505497
|
||||
660 300.8699697098109596 1675.5121937767839881 1189.2687179804190691 393.7273806013013768 7852.5601874999802021 7852.6179739687149777 17288.1742600504148868 299.9750492262036801
|
||||
670 301.0255004186900578 1520.7397686587873977 1189.2284265783687260 393.9309127074437242 7852.5601874999847496 7852.4592279727157802 17288.1787547585117863 299.9715123049731460
|
||||
680 301.1071983488760679 1651.9751417063259851 1189.1858967311386550 394.0378250459656329 7852.5601875000002110 7852.3982826328638112 17288.1821919099675142 299.9699481289110850
|
||||
690 301.0027086454253435 1496.1607274163641250 1189.1436949551202815 393.9010867158519886 7852.5601875000293148 7852.5788938360938118 17288.1838630070960789 299.9731939774295597
|
||||
700 300.9009090279179759 1551.8182127127668082 1189.0993919251338866 393.7678687121208441 7852.5601875000102154 7852.7513665452252098 17288.1788146824910655 299.9761043445071209
|
||||
710 301.2325536720837817 1678.1546953970853338 1189.0528341066981284 394.2018687459686817 7852.5601874999956635 7852.3633298995819132 17288.1782202522445004 299.9683013583347133
|
||||
720 301.2122298224125529 1524.1415452491430642 1189.0046957644285612 394.1752723525083866 7852.5601875000093059 7852.4351629896145823 17288.1753186065616319 299.9693315350040734
|
||||
730 301.0763282392692304 1547.1987029633166912 1188.9602551214045434 393.9974275034455218 7852.5601874999883876 7852.6518053705112834 17288.1696754953518393 299.9732715774841267
|
||||
740 301.3262401480515109 1544.7045314021493141 1188.9131307177485724 394.3244696516559884 7852.5601874999965730 7852.3694201272974169 17288.1672079966992897 299.9674666811455950
|
||||
750 301.5740779122830304 1591.1785078054851965 1188.8637580645938669 394.6487975126887022 7852.5601875000029395 7852.0919529470393172 17288.1646960243233480 299.9616008527094095
|
||||
760 301.4385361878654521 1547.3218422039201414 1188.8113669183098864 394.4714235854450521 7852.5601874999838401 7852.3161911124070684 17288.1591691161447670 299.9656339783694534
|
||||
770 301.6110125684814420 1494.5039561806622714 1188.7581685915934031 394.6971313010439530 7852.5601875000083965 7852.1351720579104949 17288.1506594505553949 299.9619855799395509
|
||||
780 301.8360352039435384 1588.1458619705292676 1188.7039178696472845 394.9916026067776329 7852.5601874999956635 7851.9015195838428554 17288.1572275602629816 299.9572350302977952
|
||||
790 302.1008324754310479 1545.4409171812178556 1188.6491103416560691 395.3381241828382144 7852.5601875000138534 7851.6150048936624444 17288.1624269181702402 299.9513959104631340
|
||||
800 301.9660372380565718 1563.9565804790736365 1188.5964649891604950 395.1617271307158035 7852.5601874999874781 7851.8461249560614306 17288.1645045759250934 299.9555810527747326
|
||||
810 302.0507207347627627 1511.4560763489957935 1188.5468477146612258 395.2725464702810996 7852.5601875000120344 7851.7904104899025697 17288.1699921748586348 299.9541551776504775
|
||||
820 302.4700213214911741 1458.5135514273570152 1188.4981381693974072 395.8212556746473751 7852.5601875000202199 7851.2935886962204677 17288.1731700402851857 299.9441803241180651
|
||||
830 302.2853997979337350 1496.2544527963129894 1188.4496917372191547 395.5796544641875698 7852.5601875000447762 7851.5862641793482908 17288.1757978808018379 299.9494768794835977
|
||||
840 302.0840465730901201 1518.8301331998704882 1188.3994383226176978 395.3161576523596636 7852.5601875000038490 7851.8962146812327774 17288.1719981562127941 299.9550476592922337
|
||||
850 301.8910942560261788 1469.8827850510901953 1188.3489956121345585 395.0636545180261692 7852.5601874999829306 7852.2025804631493884 17288.1754180932912277 299.9606927700139067
|
||||
860 301.7284384160519153 1657.6802015862324424 1188.3052233777652873 394.8507982536594341 7852.5601875000093059 7852.4644669022691232 17288.1806760337058222 299.9652835238809985
|
||||
870 301.6331619894115192 1501.5829953208524330 1188.2628815714097072 394.7261166912876433 7852.5601875000202199 7852.6378180648598573 17288.1870038275774277 299.9682811831179379
|
||||
880 301.3703918424367316 1499.1595903074553462 1188.2195190931643083 394.3822478705861272 7852.5601874999956635 7853.0266423250832304 17288.1885967888301820 299.9755099056966401
|
||||
890 301.4157954313303662 1598.8758859042511631 1188.1845892608291706 394.4416643558612918 7852.5601875000065775 7853.0036606192506952 17288.1901017359487014 299.9745322513492738
|
||||
900 301.4752150615485675 1621.2148728756822038 1188.1517520946135846 394.5194226492019993 7852.5601874999711072 7852.9579580608560718 17288.1893203046420240 299.9733125337182287
|
||||
910 301.4308816315938770 1538.4823217911632582 1188.1159856659232901 394.4614066057066566 7852.5601875000002110 7853.0558695713261841 17288.1934493429580471 299.9748317405193916
|
||||
920 301.4323110133492492 1594.7193046491217956 1188.0835779842032025 394.4632771371357762 7852.5601875000202199 7853.0942701464364291 17288.2013127677964803 299.9751127806911200
|
||||
930 301.4801256941950101 1387.6885377097617038 1188.0464206196895702 394.5258488489681099 7852.5601875000229484 7853.0656502842994087 17288.1981072529815719 299.9740698440909910
|
||||
940 301.8075611840245074 1534.2487040663793323 1188.0124217312886685 394.9543406584059539 7852.5601874999701977 7852.6729444202819650 17288.1998943099461030 299.9660570413493588
|
||||
950 301.6915970126173647 1567.7725992489238251 1187.9790455470049437 394.8025864986412898 7852.5601875000274958 7852.8619557087595240 17288.2037752544347313 299.9694678653150959
|
||||
960 301.6392594677008105 1504.8502165144939227 1187.9439133338105421 394.7340960325207675 7852.5601874999711072 7852.9728807988849439 17288.2110776651898050 299.9711546356286362
|
||||
970 301.6049535791644303 1514.0198965433548892 1187.9094123369413865 394.6892023276233772 7852.5601874999765641 7853.0497909819878259 17288.2085931465298927 299.9722547114341751
|
||||
980 301.2982841679705643 1634.1208149125807267 1187.8768454876480973 394.2878856256063500 7852.5601874999856591 7853.4862008383515786 17288.2111194515891839 299.9802110109069986
|
||||
990 301.2573007350166563 1489.7316698898257528 1187.8432331161868660 394.2342534877078606 7852.5601875000047585 7853.5840096862748396 17288.2216837901723920 299.9819468620868292
|
||||
1000 301.3195135766228532 1562.6587211933920116 1187.8034267774903583 394.3156670604516307 7852.5601874999356369 7853.5372636956635688 17288.2165450335414789 299.9807651637231629
|
||||
Loop time of 21.3308 on 1 procs for 1000 steps with 10125 atoms
|
||||
0 301.4391322267262012 1636.1776395935080473 1188.6488072196075336 394.4722035796053206 0.0000000000000000 15705.1203749972210062 17288.2413857964347699 299.9999999999841407
|
||||
10 301.4791572483523510 1486.4422375141214161 1188.7147620806101713 394.5245815119678241 0.0000000000000000 15704.9333817333845218 17288.1727253259632562 299.9960221120699089
|
||||
20 301.4275643919337995 1677.9356110821622678 1188.7839634625399867 394.4570655673389865 -0.0000000000000000 15704.9313726932996360 17288.1724017231790640 299.9955485734552667
|
||||
30 301.2240988054542186 1452.7304951528922174 1188.8550809767796181 394.1908044563202225 -0.0000000000000000 15705.1281541239713988 17288.1740395570705005 299.9988968405209562
|
||||
40 301.1023506886409109 1527.9758363521384581 1188.9264527568634549 394.0314812537677085 -0.0000000000000000 15705.2176639573335706 17288.1755979679655866 300.0001694462812907
|
||||
50 301.0409654880461972 1597.1737251233505503 1188.9944523606984603 393.9511507566391515 -0.0000000000000000 15705.2302422249904339 17288.1758453423281026 299.9999653064982112
|
||||
60 301.2904978886138565 1610.8630327676828529 1189.0651026961211301 394.2776962691255562 -0.0000000000000000 15704.8336863976528548 17288.1764853628992569 299.9919857290491905
|
||||
70 300.8575037843164068 1489.3259312130892340 1189.1295686642290548 393.7110673208617300 0.0000000000000000 15705.3309057198275696 17288.1715417049199459 300.0010992278232607
|
||||
80 300.5955830326474825 1449.3896097889576140 1189.1880764967559116 393.3683100440913449 -0.0000000000000000 15705.6086113882302016 17288.1649979290777992 300.0059513551502164
|
||||
90 301.0092332775843147 1553.9266324350371633 1189.2470037925056658 393.9096250433288446 -0.0000000000000000 15705.0053942113881931 17288.1620230472217372 299.9940347326859182
|
||||
100 301.0478004479094238 1539.2270336322201274 1189.3010269201699884 393.9600951881690207 -0.0000000000000000 15704.9018111045588739 17288.1629332128977694 299.9916385566916119
|
||||
110 300.9609384905550655 1500.0429484565015628 1189.3524514939088021 393.8464250502818231 -0.0000000000000000 15704.9716855356964516 17288.1705620798857126 299.9925626482006464
|
||||
120 300.9625536631413070 1630.5065919443020448 1189.4006029528841282 393.8485387131116795 0.0000000000000000 15704.9202685123345873 17288.1694101783286897 299.9911580775880680
|
||||
130 301.0373750247309772 1539.2267307640188392 1189.4426173625224692 393.9464521696794463 -0.0000000000000000 15704.7780263310032751 17288.1670958632057591 299.9879581026650044
|
||||
140 300.7465104415114183 1550.8353679735089372 1189.4887352231000932 393.5658181350790983 0.0000000000000000 15705.1161457332873397 17288.1706990914681228 299.9939749909034958
|
||||
150 300.6667173911142186 1634.8987162883267956 1189.5368575067818711 393.4613985788390096 0.0000000000000000 15705.1681543015274656 17288.1664103871480620 299.9946423938894213
|
||||
160 300.4684731724561857 1462.9400882126797114 1189.5825022927965620 393.2019703048678139 0.0000000000000000 15705.3867062980680203 17288.1711788957327371 299.9983600613422254
|
||||
170 300.1439323338466920 1510.2352578813547552 1189.6305700279476696 392.7772665220106774 -0.0000000000000000 15705.7611546046609874 17288.1689911546200165 300.0051118582463232
|
||||
180 300.1074244553407766 1529.6307083879964921 1189.6764977580119194 392.7294912276225318 -0.0000000000000000 15705.7649384723172261 17288.1709274579516205 300.0047089238623812
|
||||
190 300.4193298066088573 1546.3205495807169427 1189.7172820166242673 393.1376598363698349 0.0000000000000000 15705.3063729379555298 17288.1613147909483814 299.9954451643527022
|
||||
200 300.3353919251508728 1532.5496449337249487 1189.7600175880224924 393.0278162310690391 -0.0000000000000000 15705.3708964914076205 17288.1587303105006868 299.9962707550172922
|
||||
210 300.3276568499739483 1504.8178651700850423 1189.7998299597820733 393.0176938818990493 0.0000000000000000 15705.3412005200552812 17288.1587243617359491 299.9953436245502871
|
||||
220 300.5768315696972195 1592.5896084568353217 1189.8391466344739911 393.3437713226065284 -0.0000000000000000 15704.9807449702821032 17288.1636629273634753 299.9880321846658262
|
||||
230 300.6587445618569063 1672.3049358942282652 1189.8766340798690635 393.4509650976162334 0.0000000000000000 15704.8335074687693123 17288.1611066462537565 299.9848228571169102
|
||||
240 300.7517707836825025 1527.1722267937814195 1189.9126240081131982 393.5727019751183207 -0.0000000000000000 15704.6762557172896777 17288.1615817005222198 299.9814952182625802
|
||||
250 300.8473715548367409 1589.1847713095232848 1189.9441342461948352 393.6978079843565865 0.0000000000000000 15704.5227722798481409 17288.1647145103997900 299.9782210858571148
|
||||
260 300.8450266408959806 1623.1896863377055524 1189.9636161513917614 393.6947393603110186 0.0000000000000000 15704.5073703474117792 17288.1657258591149002 299.9775302202894522
|
||||
270 300.6663619570710466 1564.5160171187892502 1189.9764081239700317 393.4609334472908699 0.0000000000000000 15704.7310151116998895 17288.1683566829597112 299.9812899253167302
|
||||
280 300.7668534205727155 1618.5400526904256822 1189.9872008155405183 393.5924395618275184 0.0000000000000000 15704.5873443533891987 17288.1669847307566670 299.9781169783825590
|
||||
290 300.8462727198648281 1562.6765776748138705 1189.9918265985252219 393.6963700162681334 0.0000000000000000 15704.4791647084566648 17288.1673613232487696 299.9756806168042544
|
||||
300 300.8095414073812890 1525.1785808192844343 1189.9873922767767453 393.6483023295390922 0.0000000000000000 15704.5259176693853078 17288.1616122757004632 299.9761279889731327
|
||||
310 300.9496330741349652 1566.5597234051326723 1189.9752299662607129 393.8316304464933637 0.0000000000000000 15704.3499992189717887 17288.1568596317265474 299.9723726900589327
|
||||
320 301.2370566356514132 1513.6869483705036146 1189.9626455872523820 394.2077614578672069 0.0000000000000000 15703.9850341706151085 17288.1554412157347542 299.9650543775107394
|
||||
330 301.3279721508969260 1549.0667862452526151 1189.9513389477854162 394.3267362020338282 0.0000000000000000 15703.8731830581982649 17288.1512582080176799 299.9625537201162615
|
||||
340 301.1145736537582707 1414.7930515101757010 1189.9408691169962822 394.0474765890398885 0.0000000000000000 15704.1630721074998291 17288.1514178135366819 299.9677356565827040
|
||||
350 301.1651600907369470 1529.8016115175894356 1189.9314470205474663 394.1136755032910628 0.0000000000000000 15704.1043292268568621 17288.1494517506944248 299.9662576716459625
|
||||
360 301.0550563185083206 1536.7721716375513097 1189.9200519814730796 393.9695904359920178 0.0000000000000000 15704.2703084691693221 17288.1599508866347605 299.9690811750866146
|
||||
370 301.1008976932965311 1522.3385843459491298 1189.9109162496640693 394.0295798208944689 0.0000000000000000 15704.2205298306434997 17288.1610259012013557 299.9677565060027860
|
||||
380 301.1656898730701073 1505.0548721701995873 1189.9005648244356053 394.1143687921909873 -0.0000000000000000 15704.1418702597857191 17288.1568038764125959 299.9659906785157091
|
||||
390 300.8379322662877371 1740.9151205755633782 1189.8851457594089425 393.6854554509391164 -0.0000000000000000 15704.5870739109432179 17288.1576751212924137 299.9741278188614046
|
||||
400 300.8663790447545239 1564.9461156870302148 1189.8690133470406636 393.7226817503371308 0.0000000000000000 15704.5645667319495260 17288.1562618293282867 299.9732593416576947
|
||||
410 300.6263441860637045 1564.2840871092375892 1189.8566574093874806 393.4085650033035222 -0.0000000000000000 15704.8886366703736712 17288.1538590830641624 299.9792095875053519
|
||||
420 300.5302259436973031 1438.1569922368769312 1189.8406936554461026 393.2827818158640412 0.0000000000000000 15705.0297950433650840 17288.1532705146746594 299.9815165752024768
|
||||
430 300.5877786105221503 1503.3641639033021420 1189.8251514530136319 393.3580969454445153 -0.0000000000000000 15704.9625248558968451 17288.1457732543567545 299.9798346272512504
|
||||
440 300.7289160804472772 1689.2527029957295781 1189.8035410609209066 393.5427936314976591 -0.0000000000000000 15704.8038337415237038 17288.1501684339418716 299.9764596782894728
|
||||
450 300.9487198282456006 1497.3668092174784761 1189.7808137689632986 393.8304353457918978 -0.0000000000000000 15704.5390198927143501 17288.1502690074703423 299.9710227473042323
|
||||
460 300.9359942496024019 1625.1573864018473614 1189.7615359247631659 393.8137822755281263 0.0000000000000000 15704.5767067783035600 17288.1520249785935448 299.9713565393225849
|
||||
470 301.0000133856357252 1486.1561922844020955 1189.7439269526958014 393.8975596188205941 0.0000000000000000 15704.5163199572089070 17288.1578065287249046 299.9697143418395058
|
||||
480 300.8568627175958454 1535.6080526199100404 1189.7237810071803779 393.7102284019064200 -0.0000000000000000 15704.7298885727686866 17288.1638979818562802 299.9732503057675785
|
||||
490 301.0608040775520067 1497.3221544489890675 1189.7062242497640909 393.9771121242308709 -0.0000000000000000 15704.4860863739140768 17288.1694227479092660 299.9682362511933889
|
||||
500 301.0232592587148019 1517.5854528541185573 1189.6911287485863795 393.9279798589197981 -0.0000000000000000 15704.5425100510510674 17288.1616186585561081 299.9690333355832195
|
||||
510 300.7038579923685120 1420.2615974401142012 1189.6747661513456933 393.5100018730125839 -0.0000000000000000 15704.9716744568013382 17288.1564424811585923 299.9768186576548032
|
||||
520 300.5917863355052759 1537.4862082427125642 1189.6604754398761088 393.3633415734188361 -0.0000000000000000 15705.1390892093895673 17288.1629062226857059 299.9795694302102902
|
||||
530 300.4751352158504574 1481.1071694751785799 1189.6453243069920518 393.2106884527693751 -0.0000000000000000 15705.3053530714041699 17288.1613658311653126 299.9823181268525900
|
||||
540 300.5380123640739498 1547.3461372766387285 1189.6261485232855648 393.2929713568877332 0.0000000000000000 15705.2452458598490921 17288.1643657400236407 299.9808112190538623
|
||||
550 300.4253885005187499 1544.3485889749688340 1189.6033595464525661 393.1455884232119047 0.0000000000000000 15705.4200593467012368 17288.1690073163663328 299.9835860164698147
|
||||
560 300.3263552442091395 1556.5150300058239736 1189.5759163336820166 393.0159905619271399 0.0000000000000000 15705.5750488783432957 17288.1669557739514858 299.9861837797674298
|
||||
570 300.1977324643196994 1511.2320626303924200 1189.5441090918316149 392.8476709710408272 0.0000000000000000 15705.7700134401693504 17288.1617935030408262 299.9896761688500533
|
||||
580 300.3543631005173893 1588.9566243200420104 1189.5094471319723652 393.0526424747489500 -0.0000000000000000 15705.5976430422142585 17288.1597326489354600 299.9859298211932810
|
||||
590 300.5019108864805730 1504.4406939723210144 1189.4809412920112663 393.2457278908070748 -0.0000000000000000 15705.4306152855297114 17288.1572844683469157 299.9823573257918952
|
||||
600 300.4791158523048011 1540.4690749004137160 1189.4551948503108179 393.2158976318902432 0.0000000000000000 15705.4914114063831221 17288.1625038885831600 299.9832002920041418
|
||||
610 300.5939139841890437 1368.0565839211083130 1189.4252547652597514 393.3661258776945715 0.0000000000000000 15705.3732852337052464 17288.1646658766585460 299.9807742697515209
|
||||
620 300.7674247480806002 1483.2566452708929319 1189.3941250938437406 393.5931872179773450 0.0000000000000000 15705.1789842209145718 17288.1662965327341226 299.9766963671719395
|
||||
630 300.7920034341022415 1543.0699124130630935 1189.3598279316649950 393.6253516166883628 -0.0000000000000000 15705.1821846865786938 17288.1673642349305737 299.9762538437231001
|
||||
640 300.8032734267029014 1423.2549819291609765 1189.3293074476887341 393.6400998638143278 -0.0000000000000000 15705.1986701098048798 17288.1680774213091354 299.9762118202993975
|
||||
650 300.7516995878240209 1542.6559695158514387 1189.3021161045703593 393.5726088061028349 0.0000000000000000 15705.2963824473390559 17288.1711073580117954 299.9775656396504360
|
||||
660 300.8699697098108459 1675.5121937767842155 1189.2687179804192965 393.7273806013012063 0.0000000000000000 15705.1781614686860848 17288.1742600504076108 299.9750492262035095
|
||||
670 301.0255004186899441 1520.7397686587889893 1189.2284265783694082 393.9309127074436105 0.0000000000000000 15705.0194154727287241 17288.1787547585408902 299.9715123049731460
|
||||
680 301.1071983488761248 1651.9751417063253029 1189.1858967311388824 394.0378250459656897 0.0000000000000000 15704.9584701329349627 17288.1821919100402738 299.9699481289110281
|
||||
690 301.0027086454255141 1496.1607274163641250 1189.1436949551202815 393.9010867158522160 0.0000000000000000 15705.1390813360922039 17288.1838630070633371 299.9731939774292755
|
||||
700 300.9009090279178622 1551.8182127127668082 1189.0993919251338866 393.7678687121206735 -0.0000000000000000 15705.3115540452217829 17288.1788146824765136 299.9761043445070641
|
||||
710 301.2325536720837817 1678.1546953970841969 1189.0528341066981284 394.2018687459686817 0.0000000000000000 15704.9235173995584773 17288.1782202522263105 299.9683013583346565
|
||||
720 301.2122298224125529 1524.1415452491437463 1189.0046957644283339 394.1752723525083866 0.0000000000000000 15704.9953504895402148 17288.1753186064779584 299.9693315350040734
|
||||
730 301.0763282392692304 1547.1987029633176007 1188.9602551214045434 393.9974275034455218 0.0000000000000000 15705.2119928705469647 17288.1696754953954951 299.9732715774840699
|
||||
740 301.3262401480515109 1544.7045314021493141 1188.9131307177485724 394.3244696516559884 0.0000000000000000 15704.9296076272603386 17288.1672079966665478 299.9674666811455950
|
||||
750 301.5740779122830872 1591.1785078054849691 1188.8637580645940943 394.6487975126887591 0.0000000000000000 15704.6521404470349808 17288.1646960243160720 299.9616008527092959
|
||||
760 301.4385361878655658 1547.3218422039212783 1188.8113669183098864 394.4714235854451658 0.0000000000000000 15704.8763786124927719 17288.1591691162466304 299.9656339783693966
|
||||
770 301.6110125684815557 1494.5039561806624988 1188.7581685915934031 394.6971313010441236 0.0000000000000000 15704.6953595579507237 17288.1506594505881367 299.9619855799396646
|
||||
780 301.8360352039435384 1588.1458619705304045 1188.7039178696477393 394.9916026067776329 0.0000000000000000 15704.4617070838321524 17288.1572275602593436 299.9572350302976247
|
||||
790 302.1008324754310479 1545.4409171812180830 1188.6491103416560691 395.3381241828382144 0.0000000000000000 15704.1751923936917592 17288.1624269181847922 299.9513959104630771
|
||||
800 301.9660372380565718 1563.9565804790738639 1188.5964649891604950 395.1617271307158035 0.0000000000000000 15704.4063124560707365 17288.1645045759469212 299.9555810527747326
|
||||
810 302.0507207347627059 1511.4560763489960209 1188.5468477146607711 395.2725464702810427 0.0000000000000000 15704.3505979898400255 17288.1699921747822373 299.9541551776507617
|
||||
820 302.4700213214913447 1458.5135514273563331 1188.4981381693974072 395.8212556746476025 0.0000000000000000 15703.8537761962070363 17288.1731700402524439 299.9441803241177809
|
||||
830 302.2853997979336214 1496.2544527963145811 1188.4496917372191547 395.5796544641873993 0.0000000000000000 15704.1464516793694202 17288.1757978807763720 299.9494768794834840
|
||||
840 302.0840465730901201 1518.8301331998702608 1188.3994383226179252 395.3161576523596636 0.0000000000000000 15704.4564021812439023 17288.1719981562200701 299.9550476592922337
|
||||
850 301.8910942560260082 1469.8827850510904227 1188.3489956121347859 395.0636545180259986 0.0000000000000000 15704.7627679631386854 17288.1754180932985037 299.9606927700136794
|
||||
860 301.7284384160518016 1657.6802015862315329 1188.3052233777652873 394.8507982536592635 0.0000000000000000 15705.0246544022065791 17288.1806760336330626 299.9652835238807711
|
||||
870 301.6331619894114624 1501.5829953208508414 1188.2628815714099346 394.7261166912875865 0.0000000000000000 15705.1980055648327834 17288.1870038275301340 299.9682811831179947
|
||||
880 301.3703918424367316 1499.1595903074555736 1188.2195190931643083 394.3822478705861272 0.0000000000000000 15705.5868298250898079 17288.1885967888410960 299.9755099056964127
|
||||
890 301.4157954313303662 1598.8758859042509357 1188.1845892608291706 394.4416643558612918 0.0000000000000000 15705.5638481192290783 17288.1901017359195976 299.9745322513492738
|
||||
900 301.4752150615486812 1621.2148728756842502 1188.1517520946144941 394.5194226492021699 0.0000000000000000 15705.5181455608308170 17288.1893203046492999 299.9733125337182287
|
||||
910 301.4308816315937634 1538.4823217911621214 1188.1159856659228353 394.4614066057064861 0.0000000000000000 15705.6160570713091147 17288.1934493429398572 299.9748317405192779
|
||||
920 301.4323110133492492 1594.7193046491240693 1188.0835779842032025 394.4632771371357762 0.0000000000000000 15705.6544576464475540 17288.2013127677855664 299.9751127806913473
|
||||
930 301.4801256941949532 1387.6885377097596574 1188.0464206196900250 394.5258488489680531 0.0000000000000000 15705.6258377843460039 17288.1981072530033998 299.9740698440912183
|
||||
940 301.8075611840245074 1534.2487040663797870 1188.0124217312888959 394.9543406584059539 0.0000000000000000 15705.2331319202457962 17288.1998943099388271 299.9660570413491882
|
||||
950 301.6915970126175353 1567.7725992489226883 1187.9790455470049437 394.8025864986415172 0.0000000000000000 15705.4221432087451831 17288.2037752543910756 299.9694678653152096
|
||||
960 301.6392594677008105 1504.8502165144939227 1187.9439133338107695 394.7340960325207675 0.0000000000000000 15705.5330682989206252 17288.2110776652516506 299.9711546356285226
|
||||
970 301.6049535791644871 1514.0198965433535250 1187.9094123369409317 394.6892023276234909 0.0000000000000000 15705.6099784820144123 17288.2085931465771864 299.9722547114341751
|
||||
980 301.2982841679706780 1634.1208149125800446 1187.8768454876478700 394.2878856256065205 0.0000000000000000 15706.0463883383199573 17288.2111194515746320 299.9802110109068849
|
||||
990 301.2573007350166563 1489.7316698898262075 1187.8432331161866387 394.2342534877078606 0.0000000000000000 15706.1441971863041545 17288.2216837901978579 299.9819468620868292
|
||||
1000 301.3195135766228532 1562.6587211933931485 1187.8034267774903583 394.3156670604516307 0.0000000000000000 15706.0974511956701463 17288.2165450336106005 299.9807651637235040
|
||||
Loop time of 17.0881 on 1 procs for 1000 steps with 10125 atoms
|
||||
|
||||
Performance: 4.050 ns/day, 5.925 hours/ns, 46.880 timesteps/s
|
||||
99.8% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
Performance: 5.056 ns/day, 4.747 hours/ns, 58.520 timesteps/s
|
||||
100.0% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 10.099 | 10.099 | 10.099 | 0.0 | 47.34
|
||||
Neigh | 10.145 | 10.145 | 10.145 | 0.0 | 47.56
|
||||
Comm | 0.49807 | 0.49807 | 0.49807 | 0.0 | 2.33
|
||||
Output | 0.011203 | 0.011203 | 0.011203 | 0.0 | 0.05
|
||||
Modify | 0.28296 | 0.28296 | 0.28296 | 0.0 | 1.33
|
||||
Other | | 0.295 | | | 1.38
|
||||
Pair | 8.0541 | 8.0541 | 8.0541 | 0.0 | 47.13
|
||||
Neigh | 8.1306 | 8.1306 | 8.1306 | 0.0 | 47.58
|
||||
Comm | 0.39415 | 0.39415 | 0.39415 | 0.0 | 2.31
|
||||
Output | 0.01103 | 0.01103 | 0.01103 | 0.0 | 0.06
|
||||
Modify | 0.24061 | 0.24061 | 0.24061 | 0.0 | 1.41
|
||||
Other | | 0.2576 | | | 1.51
|
||||
|
||||
Nlocal: 10125 ave 10125 max 10125 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
@ -170,4 +174,4 @@ Total # of neighbors = 114682
|
||||
Ave neighs/atom = 11.3266
|
||||
Neighbor list builds = 1000
|
||||
Dangerous builds not checked
|
||||
Total wall time: 0:00:21
|
||||
Total wall time: 0:00:17
|
||||
|
||||
@ -37,7 +37,7 @@ timestep 0.001
|
||||
|
||||
pair_style hybrid/overlay dpd/fdt/energy 16.00 234324 exp6/rx 16.00
|
||||
pair_coeff * * dpd/fdt/energy 0.0 0.05 10.0 16.00
|
||||
pair_coeff * * exp6/rx params.exp6 1fluid 1fluid 1.0 1.0 16.00
|
||||
pair_coeff * * exp6/rx params.exp6 1fluid 1fluid exponent 1.0 1.0 16.00
|
||||
|
||||
fix 1 all shardlow
|
||||
fix 2 all nve
|
||||
|
||||
@ -48,7 +48,7 @@ timestep 0.001
|
||||
|
||||
pair_style hybrid/overlay dpd/fdt/energy 16.00 234324 exp6/rx 16.00
|
||||
pair_coeff * * dpd/fdt/energy 0.0 0.05 10.0 16.00
|
||||
pair_coeff * * exp6/rx params.exp6 1fluid 1fluid 1.0 1.0 16.00
|
||||
pair_coeff * * exp6/rx params.exp6 1fluid 1fluid exponent 1.0 1.0 16.00
|
||||
|
||||
fix 1 all shardlow
|
||||
fix 2 all nve
|
||||
@ -69,39 +69,51 @@ dump_modify 2 sort id
|
||||
|
||||
run 10
|
||||
Neighbor list info ...
|
||||
2 neighbor list requests
|
||||
update every 1 steps, delay 10 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 18
|
||||
ghost atom cutoff = 18
|
||||
binsize = 9 -> bins = 8 8 5
|
||||
Memory usage per processor = 6.52436 Mbytes
|
||||
binsize = 9, bins = 8 8 5
|
||||
3 neighbor lists, perpetual/occasional/extra = 3 0 0
|
||||
(1) pair dpd/fdt/energy, perpetual
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
(2) pair exp6/rx, perpetual, copy from (1)
|
||||
pair build: copy
|
||||
stencil: none
|
||||
bin: none
|
||||
(3) fix shardlow, perpetual, ssa
|
||||
pair build: half/bin/newton/ssa
|
||||
stencil: half/bin/3d/newton/ssa
|
||||
bin: ssa
|
||||
Memory usage per processor = 8.39564 Mbytes
|
||||
Step Temp Press Volume PotEng KinEng c_dpdU[1] c_dpdU[2] c_dpdU[3] v_totEnergy c_dpdU[4]
|
||||
0 2065.00000000 1368.17463335 179834.51777865 0.00000000 230.35385810 3841.42393279 3841.42393279 0.00000000 7682.84786557 2065.00000000
|
||||
1 2064.93210437 1368.12964881 179834.51777865 0.00000000 230.34628424 3841.42393279 3841.43150665 0.00000000 7682.85543943 2065.20275230
|
||||
2 2067.82089565 1370.04362990 179834.51777865 -0.00000000 230.66853326 3841.42393279 3841.10925763 0.00000000 7682.53319042 2065.32453473
|
||||
3 2070.45225169 1371.78704616 179834.51777865 -0.00000000 230.96206499 3841.42393279 3840.81572590 0.00000000 7682.23965869 2065.45336917
|
||||
4 2075.00241157 1374.80177416 179834.51777865 -0.00000000 231.46964217 3841.42393279 3840.30814872 0.00000000 7681.73208151 2065.52973333
|
||||
5 2073.96509212 1374.11449370 179834.51777865 -0.00000000 231.35392762 3841.42393279 3840.42386327 0.00000000 7681.84779605 2065.76011517
|
||||
6 2074.26516936 1374.31331117 179834.51777865 -0.00000000 231.38740169 3841.42393279 3840.39038920 0.00000000 7681.81432198 2065.95399323
|
||||
7 2071.41069700 1372.42206822 179834.51777865 -0.00000000 231.06898100 3841.42393279 3840.70880989 0.00000000 7682.13274267 2066.23407076
|
||||
8 2071.35844957 1372.38745146 179834.51777865 -0.00000000 231.06315272 3841.42393279 3840.71463817 0.00000000 7682.13857095 2066.43766287
|
||||
9 2071.35676496 1372.38633532 179834.51777865 -0.00000000 231.06296480 3841.42393279 3840.71482609 0.00000000 7682.13875887 2066.64001166
|
||||
10 2066.53172340 1369.18948328 179834.51777865 -0.00000000 230.52472415 3841.42393279 3841.25306673 0.00000000 7682.67699952 2066.97516855
|
||||
Loop time of 0.289778 on 1 procs for 10 steps with 864 atoms
|
||||
0 2065.00000000 1368.17463335 179834.51777865 0.00000000 230.35385810 0.00000000 7682.84786557 0.00000000 7682.84786557 2065.00000000
|
||||
1 2064.93210437 1368.12964881 179834.51777865 0.00000000 230.34628424 0.00000000 7682.85543943 0.00000000 7682.85543943 2065.20275230
|
||||
2 2067.82089565 1370.04362990 179834.51777865 -0.00000000 230.66853326 0.00000000 7682.53319042 0.00000000 7682.53319042 2065.32453473
|
||||
3 2070.45225169 1371.78704616 179834.51777865 -0.00000000 230.96206499 0.00000000 7682.23965869 0.00000000 7682.23965869 2065.45336917
|
||||
4 2075.00241157 1374.80177416 179834.51777865 -0.00000000 231.46964217 0.00000000 7681.73208151 0.00000000 7681.73208151 2065.52973333
|
||||
5 2073.96509212 1374.11449370 179834.51777865 -0.00000000 231.35392762 -0.00000000 7681.84779605 0.00000000 7681.84779605 2065.76011517
|
||||
6 2074.26516936 1374.31331117 179834.51777865 -0.00000000 231.38740169 -0.00000000 7681.81432198 0.00000000 7681.81432198 2065.95399323
|
||||
7 2071.41069700 1372.42206822 179834.51777865 -0.00000000 231.06898100 -0.00000000 7682.13274267 0.00000000 7682.13274267 2066.23407076
|
||||
8 2071.35844957 1372.38745146 179834.51777865 -0.00000000 231.06315272 0.00000000 7682.13857095 0.00000000 7682.13857095 2066.43766287
|
||||
9 2071.35676496 1372.38633532 179834.51777865 -0.00000000 231.06296480 0.00000000 7682.13875887 0.00000000 7682.13875887 2066.64001166
|
||||
10 2066.53172340 1369.18948328 179834.51777865 -0.00000000 230.52472415 0.00000000 7682.67699952 0.00000000 7682.67699952 2066.97516855
|
||||
Loop time of 0.611304 on 1 procs for 10 steps with 864 atoms
|
||||
|
||||
Performance: 2.982 ns/day, 8.049 hours/ns, 34.509 timesteps/s
|
||||
99.4% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
Performance: 1.413 ns/day, 16.981 hours/ns, 16.358 timesteps/s
|
||||
98.2% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.16405 | 0.16405 | 0.16405 | 0.0 | 56.61
|
||||
Pair | 0.34177 | 0.34177 | 0.34177 | 0.0 | 55.91
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0.00066328 | 0.00066328 | 0.00066328 | 0.0 | 0.23
|
||||
Output | 0.037718 | 0.037718 | 0.037718 | 0.0 | 13.02
|
||||
Modify | 0.087281 | 0.087281 | 0.087281 | 0.0 | 30.12
|
||||
Other | | 7.057e-05 | | | 0.02
|
||||
Comm | 0.0013342 | 0.0013342 | 0.0013342 | 0.0 | 0.22
|
||||
Output | 0.083583 | 0.083583 | 0.083583 | 0.0 | 13.67
|
||||
Modify | 0.18451 | 0.18451 | 0.18451 | 0.0 | 30.18
|
||||
Other | | 0.0001087 | | | 0.02
|
||||
|
||||
Nlocal: 864 ave 864 max 864 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
119
lib/colvars/Makefile.colvars
Normal file
@ -0,0 +1,119 @@
|
||||
# library build -*- makefile -*- for colvars module
|
||||
|
||||
# which file will be copied to Makefile.lammps
|
||||
|
||||
EXTRAMAKE = Makefile.lammps.empty
|
||||
|
||||
# ------ SETTINGS ------
|
||||
|
||||
CXX = g++
|
||||
CXXFLAGS = -O2 -g -Wall -fPIC -funroll-loops # -DCOLVARS_DEBUG
|
||||
ARCHIVE = ar
|
||||
ARCHFLAG = -rscv
|
||||
SHELL = /bin/sh
|
||||
|
||||
# ------ DEFINITIONS ------
|
||||
|
||||
SRC = colvaratoms.cpp colvarbias_abf.cpp colvarbias_alb.cpp colvarbias.cpp \
|
||||
colvarbias_histogram.cpp colvarbias_meta.cpp colvarbias_restraint.cpp \
|
||||
colvarcomp_angles.cpp colvarcomp_coordnums.cpp colvarcomp.cpp \
|
||||
colvarcomp_distances.cpp colvarcomp_protein.cpp colvarcomp_rotations.cpp \
|
||||
colvardeps.cpp colvar.cpp colvargrid.cpp colvarmodule.cpp colvarparse.cpp \
|
||||
colvarscript.cpp colvartypes.cpp colvarvalue.cpp
|
||||
|
||||
LIB = libcolvars.a
|
||||
OBJ = $(SRC:.cpp=.o)
|
||||
EXE = #colvars_standalone
|
||||
|
||||
# ------ MAKE PROCEDURE ------
|
||||
|
||||
default: $(LIB) $(EXE) Makefile.lammps
|
||||
|
||||
Makefile.lammps:
|
||||
@cp $(EXTRAMAKE) Makefile.lammps
|
||||
|
||||
$(LIB): $(OBJ)
|
||||
$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
|
||||
|
||||
colvars_standalone: colvars_main.o colvarproxy_standalone.o $(LIB)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $^
|
||||
|
||||
# ------ MAKE FLAGS ------
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .o
|
||||
|
||||
.PHONY: default clean
|
||||
|
||||
# ------ COMPILE RULES ------
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
# ------ DEPENDENCIES ------
|
||||
#
|
||||
colvaratoms.o: colvaratoms.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvaratoms.h
|
||||
colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarbias_abf.h colvarbias.h colvargrid.h
|
||||
colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarbias_alb.h colvar.h colvarparse.h \
|
||||
colvardeps.h colvarbias_restraint.h colvarbias.h
|
||||
colvarbias.o: colvarbias.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarbias_histogram.o: colvarbias_histogram.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvardeps.h colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvarbias_meta.o: colvarbias_meta.cpp colvar.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvarbias_meta.h colvarbias.h colvargrid.h
|
||||
colvarbias_restraint.o: colvarbias_restraint.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias_restraint.h \
|
||||
colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarcomp_angles.o: colvarcomp_angles.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_coordnums.o: colvarcomp_coordnums.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvaratoms.h colvar.h colvarcomp.h
|
||||
colvarcomp.o: colvarcomp.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvardeps.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvar.o: colvar.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvarscript.h colvarbias.h
|
||||
colvardeps.o: colvardeps.cpp colvardeps.h colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h
|
||||
colvargrid.o: colvargrid.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvargrid.h
|
||||
colvarmodule.o: colvarmodule.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarbias.h colvarbias_abf.h colvargrid.h colvarbias_alb.h \
|
||||
colvarbias_restraint.h colvarbias_histogram.h colvarbias_meta.h \
|
||||
colvarscript.h
|
||||
colvarparse.o: colvarparse.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarscript.o: colvarscript.cpp colvarscript.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias.h colvar.h \
|
||||
colvarparse.h colvardeps.h
|
||||
colvartypes.o: colvartypes.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarvalue.o: colvarvalue.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h
|
||||
|
||||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
-rm *.o *~ $(LIB)
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarvalue.h"
|
||||
#include "colvarparse.h"
|
||||
@ -163,38 +170,38 @@ colvar::colvar(std::string const &conf)
|
||||
}
|
||||
feature_states[f_cv_homogeneous]->enabled = homogeneous;
|
||||
}
|
||||
// Colvar is deemed periodic iff:
|
||||
|
||||
// Colvar is deemed periodic if:
|
||||
// - it is homogeneous
|
||||
// - all cvcs are periodic
|
||||
// - all cvcs have the same period
|
||||
|
||||
b_periodic = cvcs[0]->b_periodic && is_enabled(f_cv_homogeneous);
|
||||
period = cvcs[0]->period;
|
||||
for (i = 1; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->b_periodic || cvcs[i]->period != period) {
|
||||
b_periodic = false;
|
||||
period = 0.0;
|
||||
if (cvcs[0]->b_periodic) { // TODO make this a CVC feature
|
||||
bool b_periodic = true;
|
||||
period = cvcs[0]->period;
|
||||
for (i = 1; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->b_periodic || cvcs[i]->period != period) {
|
||||
b_periodic = false;
|
||||
period = 0.0;
|
||||
cvm::log("Warning: although one component is periodic, this colvar will "
|
||||
"not be treated as periodic, either because the exponent is not "
|
||||
"1, or because components of different periodicity are defined. "
|
||||
"Make sure that you know what you are doing!");
|
||||
}
|
||||
}
|
||||
feature_states[f_cv_periodic]->enabled = b_periodic;
|
||||
}
|
||||
feature_states[f_cv_periodic]->enabled = b_periodic;
|
||||
|
||||
// check that cvcs are compatible
|
||||
|
||||
for (i = 0; i < cvcs.size(); i++) {
|
||||
if ((cvcs[i])->b_periodic && !b_periodic) {
|
||||
cvm::log("Warning: although this component is periodic, the colvar will "
|
||||
"not be treated as periodic, either because the exponent is not "
|
||||
"1, or because multiple components are present. Make sure that "
|
||||
"you know what you are doing!");
|
||||
}
|
||||
|
||||
// components may have different types only for scripted functions
|
||||
if (!is_enabled(f_cv_scripted) && (colvarvalue::check_types(cvcs[i]->value(),
|
||||
cvcs[0]->value())) ) {
|
||||
cvcs[0]->value())) ) {
|
||||
cvm::error("ERROR: you are definining this collective variable "
|
||||
"by using components of different types. "
|
||||
"You must use the same type in order to "
|
||||
" sum them together.\n", INPUT_ERROR);
|
||||
"sum them together.\n", INPUT_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -207,16 +214,15 @@ colvar::colvar(std::string const &conf)
|
||||
// at this point, the colvar's type is defined
|
||||
f.type(value());
|
||||
f_accumulated.type(value());
|
||||
fb.type(value());
|
||||
|
||||
reset_bias_force();
|
||||
|
||||
get_keyval(conf, "width", width, 1.0);
|
||||
if (width <= 0.0) {
|
||||
cvm::error("Error: \"width\" must be positive.\n", INPUT_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: not porting wall stuff to new deps, as this will change to a separate bias
|
||||
// the grid functions will wait a little as well
|
||||
|
||||
lower_boundary.type(value());
|
||||
lower_wall.type(value());
|
||||
|
||||
@ -308,6 +314,9 @@ colvar::colvar(std::string const &conf)
|
||||
enable(f_cv_extended_Lagrangian);
|
||||
provide(f_cv_Langevin);
|
||||
|
||||
// The extended mass will apply forces
|
||||
enable(f_cv_gradient);
|
||||
|
||||
xr.type(value());
|
||||
vr.type(value());
|
||||
fr.type(value());
|
||||
@ -400,6 +409,9 @@ colvar::colvar(std::string const &conf)
|
||||
f_old.type(value());
|
||||
f_old.reset();
|
||||
|
||||
x_restart.type(value());
|
||||
after_restart = false;
|
||||
|
||||
if (cvm::b_analysis)
|
||||
parse_analysis(conf);
|
||||
|
||||
@ -761,9 +773,13 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs)
|
||||
return error_code;
|
||||
}
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
// Total force depends on Jacobian derivative from previous timestep
|
||||
error_code |= calc_cvc_total_force(first_cvc, num_cvcs);
|
||||
}
|
||||
// atom coordinates are updated by the next line
|
||||
error_code |= calc_cvc_values(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_gradients(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_total_force(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_Jacobians(first_cvc, num_cvcs);
|
||||
|
||||
if (cvm::debug())
|
||||
@ -780,9 +796,12 @@ int colvar::collect_cvc_data()
|
||||
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
// Total force depends on Jacobian derivative from previous timestep
|
||||
error_code |= collect_cvc_total_forces();
|
||||
}
|
||||
error_code |= collect_cvc_values();
|
||||
error_code |= collect_cvc_gradients();
|
||||
error_code |= collect_cvc_total_forces();
|
||||
error_code |= collect_cvc_Jacobians();
|
||||
error_code |= calc_colvar_properties();
|
||||
|
||||
@ -872,6 +891,22 @@ int colvar::collect_cvc_values()
|
||||
cvm::log("Colvar \""+this->name+"\" has value "+
|
||||
cvm::to_str(x, cvm::cv_width, cvm::cv_prec)+".\n");
|
||||
|
||||
if (after_restart) {
|
||||
after_restart = false;
|
||||
if (cvm::proxy->simulation_running()) {
|
||||
cvm::real const jump2 = dist2(x, x_restart) / (width*width);
|
||||
if (jump2 > 0.25) {
|
||||
cvm::error("Error: the calculated value of colvar \""+name+
|
||||
"\":\n"+cvm::to_str(x)+"\n differs greatly from the value "
|
||||
"last read from the state file:\n"+cvm::to_str(x_restart)+
|
||||
"\nPossible causes are changes in configuration, "
|
||||
"wrong state file, or how PBC wrapping is handled.\n",
|
||||
INPUT_ERROR);
|
||||
return INPUT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
@ -979,22 +1014,17 @@ int colvar::calc_cvc_total_force(int first_cvc, size_t num_cvcs)
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating total force of colvar \""+this->name+"\".\n");
|
||||
|
||||
// if (!tasks[task_extended_lagrangian] && (cvm::step_relative() > 0)) {
|
||||
// Disabled check to allow for explicit total force calculation
|
||||
// even with extended Lagrangian
|
||||
cvm::increase_depth();
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
cvm::increase_depth();
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
cvc_count++;
|
||||
(cvcs[i])->calc_force_invgrads();
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
cvc_count++;
|
||||
(cvcs[i])->calc_force_invgrads();
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Done calculating total force of colvar \""+this->name+"\".\n");
|
||||
@ -1013,6 +1043,11 @@ int colvar::collect_cvc_total_forces()
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
if (cvm::debug())
|
||||
cvm::log("Colvar component no. "+cvm::to_str(i+1)+
|
||||
" within colvar \""+this->name+"\" has total force "+
|
||||
cvm::to_str((cvcs[i])->total_force(),
|
||||
cvm::cv_width, cvm::cv_prec)+".\n");
|
||||
// linear combination is assumed
|
||||
ft += (cvcs[i])->total_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
}
|
||||
@ -1056,6 +1091,11 @@ int colvar::collect_cvc_Jacobians()
|
||||
fj.reset();
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
if (cvm::debug())
|
||||
cvm::log("Colvar component no. "+cvm::to_str(i+1)+
|
||||
" within colvar \""+this->name+"\" has Jacobian derivative"+
|
||||
cvm::to_str((cvcs[i])->Jacobian_derivative(),
|
||||
cvm::cv_width, cvm::cv_prec)+".\n");
|
||||
// linear combination is assumed
|
||||
fj += (cvcs[i])->Jacobian_derivative() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
}
|
||||
@ -1085,7 +1125,7 @@ int colvar::calc_colvar_properties()
|
||||
// TODO: put it in the restart information
|
||||
if (cvm::step_relative() == 0) {
|
||||
xr = x;
|
||||
vr = 0.0; // (already 0; added for clarity)
|
||||
vr.reset(); // (already 0; added for clarity)
|
||||
}
|
||||
|
||||
// report the restraint center as "value"
|
||||
@ -1128,15 +1168,16 @@ cvm::real colvar::update_forces_energy()
|
||||
if (is_enabled(f_cv_Jacobian)) {
|
||||
// the instantaneous Jacobian force was not included in the reported total force;
|
||||
// instead, it is subtracted from the applied force (silent Jacobian correction)
|
||||
// This requires the Jacobian term for the *current* timestep
|
||||
if (is_enabled(f_cv_hide_Jacobian))
|
||||
f -= fj;
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_lower_wall) || is_enabled(f_cv_upper_wall)) {
|
||||
// Wall force
|
||||
colvarvalue fw(x);
|
||||
fw.reset();
|
||||
|
||||
// Wall force
|
||||
colvarvalue fw(x);
|
||||
fw.reset();
|
||||
if (is_enabled(f_cv_lower_wall) || is_enabled(f_cv_upper_wall)) {
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating wall forces for colvar \""+this->name+"\".\n");
|
||||
@ -1144,12 +1185,11 @@ cvm::real colvar::update_forces_energy()
|
||||
// For a periodic colvar, both walls may be applicable at the same time
|
||||
// in which case we pick the closer one
|
||||
if ( (!is_enabled(f_cv_upper_wall)) ||
|
||||
(this->dist2(x_reported, lower_wall) < this->dist2(x_reported, upper_wall)) ) {
|
||||
(this->dist2(x, lower_wall) < this->dist2(x, upper_wall)) ) {
|
||||
|
||||
cvm::real const grad = this->dist2_lgrad(x_reported, lower_wall);
|
||||
cvm::real const grad = this->dist2_lgrad(x, lower_wall);
|
||||
if (grad < 0.0) {
|
||||
fw = -0.5 * lower_wall_k * grad;
|
||||
f += fw;
|
||||
if (cvm::debug())
|
||||
cvm::log("Applying a lower wall force("+
|
||||
cvm::to_str(fw)+") to \""+this->name+"\".\n");
|
||||
@ -1157,10 +1197,9 @@ cvm::real colvar::update_forces_energy()
|
||||
|
||||
} else {
|
||||
|
||||
cvm::real const grad = this->dist2_lgrad(x_reported, upper_wall);
|
||||
cvm::real const grad = this->dist2_lgrad(x, upper_wall);
|
||||
if (grad > 0.0) {
|
||||
fw = -0.5 * upper_wall_k * grad;
|
||||
f += fw;
|
||||
if (cvm::debug())
|
||||
cvm::log("Applying an upper wall force("+
|
||||
cvm::to_str(fw)+") to \""+this->name+"\".\n");
|
||||
@ -1168,17 +1207,26 @@ cvm::real colvar::update_forces_energy()
|
||||
}
|
||||
}
|
||||
|
||||
// At this point f is the force f from external biases that will be applied to the
|
||||
// extended variable if there is one
|
||||
|
||||
if (is_enabled(f_cv_extended_Lagrangian)) {
|
||||
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Updating extended-Lagrangian degrees of freedom.\n");
|
||||
}
|
||||
|
||||
cvm::real dt = cvm::dt();
|
||||
cvm::real f_ext;
|
||||
colvarvalue f_ext(fr.type());
|
||||
f_ext.reset();
|
||||
|
||||
// the total force is applied to the fictitious mass, while the
|
||||
// atoms only feel the harmonic force
|
||||
// atoms only feel the harmonic force + wall force
|
||||
// fr: bias force on extended variable (without harmonic spring), for output in trajectory
|
||||
// f_ext: total force on extended variable (including harmonic spring)
|
||||
// f: - initially, external biasing force (including wall forces)
|
||||
// - after this code block, colvar force to be applied to atomic coordinates, ie. spring force
|
||||
// f: - initially, external biasing force
|
||||
// - after this code block, colvar force to be applied to atomic coordinates
|
||||
// ie. spring force + wall force
|
||||
fr = f;
|
||||
f_ext = f + (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x);
|
||||
f = (-0.5 * ext_force_k) * this->dist2_rgrad(xr, x);
|
||||
@ -1200,15 +1248,24 @@ cvm::real colvar::update_forces_energy()
|
||||
potential_energy = 0.5 * ext_force_k * this->dist2(xr, x);
|
||||
// leap to v_(i+1/2)
|
||||
if (is_enabled(f_cv_Langevin)) {
|
||||
vr -= dt * ext_gamma * vr.real_value;
|
||||
vr += dt * ext_sigma * cvm::rand_gaussian() / ext_mass;
|
||||
vr -= dt * ext_gamma * vr;
|
||||
colvarvalue rnd(x);
|
||||
rnd.set_random();
|
||||
vr += dt * ext_sigma * rnd / ext_mass;
|
||||
}
|
||||
vr += (0.5 * dt) * f_ext / ext_mass;
|
||||
xr += dt * vr;
|
||||
xr.apply_constraints();
|
||||
if (this->b_periodic) this->wrap(xr);
|
||||
if (this->is_enabled(f_cv_periodic)) this->wrap(xr);
|
||||
}
|
||||
|
||||
// TODO remove the wall force
|
||||
f += fw;
|
||||
// Now adding the force on the actual colvar (for those biases who
|
||||
// bypass the extended Lagrangian mass)
|
||||
f += fb_actual;
|
||||
|
||||
// Store force to be applied, possibly summed over several timesteps
|
||||
f_accumulated += f;
|
||||
|
||||
if (is_enabled(f_cv_fdiff_velocity)) {
|
||||
@ -1425,14 +1482,15 @@ std::istream & colvar::read_restart(std::istream &is)
|
||||
}
|
||||
}
|
||||
|
||||
if ( !(get_keyval(conf, "x", x,
|
||||
colvarvalue(x.type()), colvarparse::parse_silent)) ) {
|
||||
if ( !(get_keyval(conf, "x", x, x, colvarparse::parse_silent)) ) {
|
||||
cvm::log("Error: restart file does not contain "
|
||||
"the value of the colvar \""+
|
||||
name+"\" .\n");
|
||||
} else {
|
||||
cvm::log("Restarting collective variable \""+name+"\" from value: "+
|
||||
cvm::to_str(x)+"\n");
|
||||
x_restart = x;
|
||||
after_restart = true;
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_extended_Lagrangian)) {
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVAR_H
|
||||
#define COLVAR_H
|
||||
|
||||
@ -170,6 +177,9 @@ public:
|
||||
/// the biases are updated
|
||||
colvarvalue fb;
|
||||
|
||||
/// \brief Bias force to the actual value (only useful with extended Lagrangian)
|
||||
colvarvalue fb_actual;
|
||||
|
||||
/// \brief Total \em applied force; fr (if extended_lagrangian
|
||||
/// is defined), fb (if biases are applied) and the walls' forces
|
||||
/// (if defined) contribute to it
|
||||
@ -183,13 +193,9 @@ public:
|
||||
colvarvalue ft;
|
||||
|
||||
|
||||
/// Period, if it is a constant
|
||||
/// Period, if this variable is periodic
|
||||
cvm::real period;
|
||||
|
||||
/// \brief Same as above, but also takes into account components
|
||||
/// with a variable period, such as distanceZ
|
||||
bool b_periodic;
|
||||
|
||||
|
||||
/// \brief Expand the boundaries of multiples of width, to keep the
|
||||
/// value always within range
|
||||
@ -290,6 +296,9 @@ public:
|
||||
/// Add to the total force from biases
|
||||
void add_bias_force(colvarvalue const &force);
|
||||
|
||||
/// Apply a force to the actual value (only meaningful with extended Lagrangian)
|
||||
void add_bias_force_actual_value(colvarvalue const &force);
|
||||
|
||||
/// \brief Collect all forces on this colvar, integrate internal
|
||||
/// equations of motion of internal degrees of freedom; see also
|
||||
/// colvar::communicate_forces()
|
||||
@ -386,6 +395,12 @@ protected:
|
||||
/// Previous value (to calculate velocities during analysis)
|
||||
colvarvalue x_old;
|
||||
|
||||
/// Value read from the most recent state file (if any)
|
||||
colvarvalue x_restart;
|
||||
|
||||
/// True if a state file was just read
|
||||
bool after_restart;
|
||||
|
||||
/// Time series of values and velocities used in correlation
|
||||
/// functions
|
||||
std::list< std::list<colvarvalue> > acf_x_history, acf_v_history;
|
||||
@ -577,9 +592,20 @@ inline void colvar::add_bias_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
inline void colvar::add_bias_force_actual_value(colvarvalue const &force)
|
||||
{
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Adding biasing force "+cvm::to_str(force)+" to colvar \""+name+"\".\n");
|
||||
}
|
||||
fb_actual += force;
|
||||
}
|
||||
|
||||
|
||||
inline void colvar::reset_bias_force() {
|
||||
fb.type(value());
|
||||
fb.reset();
|
||||
fb_actual.type(value());
|
||||
fb_actual.reset();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarparse.h"
|
||||
#include "colvaratoms.h"
|
||||
@ -171,7 +178,10 @@ int cvm::atom_group::remove_atom(cvm::atom_iter ai)
|
||||
|
||||
int cvm::atom_group::init()
|
||||
{
|
||||
if (!key.size()) key = "atoms";
|
||||
if (!key.size()) key = "unnamed";
|
||||
description = "atom group " + key;
|
||||
// These will be overwritten by parse(), if initializing from a config string
|
||||
|
||||
atoms.clear();
|
||||
|
||||
// TODO: check with proxy whether atom forces etc are available
|
||||
@ -179,6 +189,7 @@ int cvm::atom_group::init()
|
||||
|
||||
index = -1;
|
||||
|
||||
b_dummy = false;
|
||||
b_center = false;
|
||||
b_rotate = false;
|
||||
b_user_defined_fit = false;
|
||||
@ -440,6 +451,7 @@ int cvm::atom_group::parse(std::string const &conf)
|
||||
|
||||
if (b_print_atom_ids) {
|
||||
cvm::log("Internal definition of the atom group:\n");
|
||||
cvm::log(print_atom_ids());
|
||||
}
|
||||
|
||||
cvm::decrease_depth();
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARATOMS_H
|
||||
#define COLVARATOMS_H
|
||||
|
||||
@ -64,7 +71,7 @@ public:
|
||||
|
||||
/// \brief Initialize an atom for collective variable calculation
|
||||
/// and get its internal identifier \param atom_number Atom index in
|
||||
/// the system topology (starting from 1)
|
||||
/// the system topology (1-based)
|
||||
atom(int atom_number);
|
||||
|
||||
/// \brief Initialize an atom for collective variable calculation
|
||||
@ -453,6 +460,8 @@ public:
|
||||
/// are not used, either because they were not defined (e.g because
|
||||
/// the colvar has not a scalar value) or the biases require to
|
||||
/// micromanage the force.
|
||||
/// This function will be phased out eventually, in favor of
|
||||
/// apply_colvar_force() once that is implemented for non-scalar values
|
||||
void apply_force(cvm::rvector const &force);
|
||||
|
||||
};
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarvalue.h"
|
||||
#include "colvarbias.h"
|
||||
@ -29,6 +36,7 @@ colvarbias::colvarbias(char const *key)
|
||||
has_data = false;
|
||||
b_output_energy = false;
|
||||
reset();
|
||||
state_file_step = 0;
|
||||
|
||||
// Start in active state by default
|
||||
enable(f_cvb_active);
|
||||
@ -141,20 +149,25 @@ int colvarbias::clear()
|
||||
int colvarbias::add_colvar(std::string const &cv_name)
|
||||
{
|
||||
if (colvar *cv = cvm::colvar_by_name(cv_name)) {
|
||||
// Removed this as nor all biases apply forces eg histogram
|
||||
// cv->enable(colvar::task_gradients);
|
||||
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Applying this bias to collective variable \""+
|
||||
cv->name+"\".\n");
|
||||
}
|
||||
|
||||
colvars.push_back(cv);
|
||||
|
||||
colvar_forces.push_back(colvarvalue());
|
||||
colvar_forces.back().type(cv->value()); // make sure each force is initialized to zero
|
||||
colvar_forces.back().is_derivative(); // colvar constraints are not applied to the force
|
||||
colvar_forces.back().reset();
|
||||
|
||||
cv->biases.push_back(this); // add back-reference to this bias to colvar
|
||||
|
||||
if (is_enabled(f_cvb_apply_force)) {
|
||||
cv->enable(f_cv_gradient);
|
||||
}
|
||||
|
||||
// Add dependency link.
|
||||
// All biases need at least the value of each colvar
|
||||
// although possibly not at all timesteps
|
||||
@ -165,6 +178,7 @@ int colvarbias::add_colvar(std::string const &cv_name)
|
||||
cv_name+"\".\n", INPUT_ERROR);
|
||||
return INPUT_ERROR;
|
||||
}
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
@ -190,16 +204,19 @@ void colvarbias::communicate_forces()
|
||||
}
|
||||
|
||||
|
||||
void colvarbias::change_configuration(std::string const &conf)
|
||||
int colvarbias::change_configuration(std::string const &conf)
|
||||
{
|
||||
cvm::error("Error: change_configuration() not implemented.\n");
|
||||
cvm::error("Error: change_configuration() not implemented.\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvarbias::energy_difference(std::string const &conf)
|
||||
{
|
||||
cvm::error("Error: energy_difference() not implemented.\n");
|
||||
return 0.;
|
||||
cvm::error("Error: energy_difference() not implemented.\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
@ -225,6 +242,118 @@ int colvarbias::replica_share()
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
std::string const colvarbias::get_state_params() const
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "step " << cvm::step_absolute() << "\n"
|
||||
<< "name " << this->name << "\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
int colvarbias::set_state_params(std::string const &conf)
|
||||
{
|
||||
std::string new_name = "";
|
||||
if (colvarparse::get_keyval(conf, "name", new_name,
|
||||
std::string(""), colvarparse::parse_silent) &&
|
||||
(new_name != this->name)) {
|
||||
cvm::error("Error: in the state file, the "
|
||||
"\""+bias_type+"\" block has a different name, \""+new_name+
|
||||
"\": different system?\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (name.size() == 0) {
|
||||
cvm::error("Error: \""+bias_type+"\" block within the restart file "
|
||||
"has no identifiers.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
colvarparse::get_keyval(conf, "step", state_file_step,
|
||||
cvm::step_absolute(), colvarparse::parse_silent);
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias::write_state(std::ostream &os)
|
||||
{
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Writing state file for bias \""+name+"\"\n");
|
||||
}
|
||||
os.setf(std::ios::scientific, std::ios::floatfield);
|
||||
os.precision(cvm::cv_prec);
|
||||
os << bias_type << " {\n"
|
||||
<< " configuration {\n";
|
||||
std::istringstream is(get_state_params());
|
||||
std::string line;
|
||||
while (std::getline(is, line)) {
|
||||
os << " " << line << "\n";
|
||||
}
|
||||
os << " }\n";
|
||||
write_state_data(os);
|
||||
os << "}\n\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias::read_state(std::istream &is)
|
||||
{
|
||||
size_t const start_pos = is.tellg();
|
||||
|
||||
std::string key, brace, conf;
|
||||
if ( !(is >> key) || !(key == bias_type) ||
|
||||
!(is >> brace) || !(brace == "{") ||
|
||||
!(is >> colvarparse::read_block("configuration", conf)) ||
|
||||
(set_state_params(conf) != COLVARS_OK) ) {
|
||||
cvm::error("Error: in reading state configuration for \""+bias_type+"\" bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n", INPUT_ERROR);
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
if (!read_state_data(is)) {
|
||||
cvm::error("Error: in reading state data for \""+bias_type+"\" bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n", INPUT_ERROR);
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
|
||||
is >> brace;
|
||||
if (brace != "}") {
|
||||
cvm::error("Error: corrupt restart information for \""+bias_type+"\" bias \""+
|
||||
this->name+"\": no matching brace at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias::read_state_data_key(std::istream &is, char const *key)
|
||||
{
|
||||
size_t const start_pos = is.tellg();
|
||||
std::string key_in;
|
||||
if ( !(is >> key_in) ||
|
||||
!(key_in == to_lower_cppstr(std::string(key))) ) {
|
||||
cvm::error("Error: in reading restart configuration for "+
|
||||
bias_type+" bias \""+this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n", INPUT_ERROR);
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::ostream & colvarbias::write_traj_label(std::ostream &os)
|
||||
{
|
||||
os << " ";
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_H
|
||||
#define COLVARBIAS_H
|
||||
|
||||
@ -9,7 +16,8 @@
|
||||
|
||||
|
||||
/// \brief Collective variable bias, base class
|
||||
class colvarbias : public colvarparse, public colvardeps {
|
||||
class colvarbias
|
||||
: public virtual colvarparse, public virtual colvardeps {
|
||||
public:
|
||||
|
||||
/// Name of this bias
|
||||
@ -24,6 +32,12 @@ public:
|
||||
/// Add a new collective variable to this bias
|
||||
int add_colvar(std::string const &cv_name);
|
||||
|
||||
/// Add a new collective variable to this bias
|
||||
size_t number_of_colvars() const
|
||||
{
|
||||
return colvars.size();
|
||||
}
|
||||
|
||||
/// Retrieve colvar values and calculate their biasing forces
|
||||
/// Return bias energy
|
||||
virtual int update();
|
||||
@ -31,7 +45,7 @@ public:
|
||||
// TODO: move update_bias here (share with metadynamics)
|
||||
|
||||
/// Load new configuration - force constant and/or centers only
|
||||
virtual void change_configuration(std::string const &conf);
|
||||
virtual int change_configuration(std::string const &conf);
|
||||
|
||||
/// Calculate change in energy from using alternate configuration
|
||||
virtual cvm::real energy_difference(std::string const &conf);
|
||||
@ -49,7 +63,7 @@ public:
|
||||
virtual void analyze() {}
|
||||
|
||||
/// Send forces to the collective variables
|
||||
void communicate_forces();
|
||||
virtual void communicate_forces();
|
||||
|
||||
/// \brief Constructor
|
||||
colvarbias(char const *key);
|
||||
@ -60,13 +74,11 @@ public:
|
||||
/// \brief Set to zero all mutable data
|
||||
virtual int reset();
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
/// Default constructor
|
||||
colvarbias();
|
||||
|
||||
private:
|
||||
|
||||
/// Copy constructor
|
||||
colvarbias(colvarbias &);
|
||||
|
||||
@ -78,28 +90,59 @@ public:
|
||||
/// Destructor
|
||||
virtual ~colvarbias();
|
||||
|
||||
/// Read the bias configuration from a restart file
|
||||
virtual std::istream & read_restart(std::istream &is) = 0;
|
||||
/// Write the values of specific mutable properties to a string
|
||||
virtual std::string const get_state_params() const;
|
||||
|
||||
/// Write the bias configuration to a restart file
|
||||
virtual std::ostream & write_restart(std::ostream &os) = 0;
|
||||
/// Read the values of specific mutable properties from a string
|
||||
virtual int set_state_params(std::string const &state_conf);
|
||||
|
||||
/// Write all mutable data not already written by get_state_params()
|
||||
virtual std::ostream & write_state_data(std::ostream &os)
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
/// Read all mutable data not already set by set_state_params()
|
||||
virtual std::istream & read_state_data(std::istream &is)
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
/// Read a keyword from the state data (typically a header)
|
||||
std::istream & read_state_data_key(std::istream &is, char const *key);
|
||||
|
||||
/// Write the bias configuration to a restart file or other stream
|
||||
virtual std::ostream & write_state(std::ostream &os);
|
||||
|
||||
/// Read the bias configuration from a restart file or other stream
|
||||
virtual std::istream & read_state(std::istream &is);
|
||||
|
||||
/// Write a label to the trajectory file (comment line)
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
|
||||
/// (Re)initialize the output files (does not write them yet)
|
||||
virtual int setup_output() { return COLVARS_OK; }
|
||||
|
||||
/// Output quantities such as the bias energy to the trajectory file
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
/// Write output files (if defined, e.g. in analysis mode)
|
||||
/// (Re)initialize the output files (does not write them yet)
|
||||
virtual int setup_output()
|
||||
{
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
/// Write any output files that this bias may have (e.g. PMF files)
|
||||
virtual int write_output_files()
|
||||
{
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
inline cvm::real get_energy() {
|
||||
/// If this bias is communicating with other replicas through files, send it to them
|
||||
virtual int write_state_to_replicas()
|
||||
{
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
inline cvm::real get_energy()
|
||||
{
|
||||
return bias_energy;
|
||||
}
|
||||
|
||||
@ -107,9 +150,11 @@ public:
|
||||
static std::vector<feature *> cvb_features;
|
||||
|
||||
/// \brief Implementation of the feature list accessor for colvarbias
|
||||
virtual std::vector<feature *> &features() {
|
||||
virtual std::vector<feature *> &features()
|
||||
{
|
||||
return cvb_features;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Pointers to collective variables to which the bias is
|
||||
@ -130,6 +175,9 @@ protected:
|
||||
/// (for history-dependent biases)
|
||||
bool has_data;
|
||||
|
||||
/// \brief Step number read from the last state file
|
||||
size_t state_file_step;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvar.h"
|
||||
#include "colvarbias_abf.h"
|
||||
@ -23,6 +30,8 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_scalar_variables);
|
||||
enable(f_cvb_scalar_variables);
|
||||
provide(f_cvb_history_dependent);
|
||||
|
||||
// TODO relax this in case of VMD plugin
|
||||
@ -590,16 +599,10 @@ void colvarbias_abf::read_gradients_samples()
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_abf::write_restart(std::ostream& os)
|
||||
std::ostream & colvarbias_abf::write_state_data(std::ostream& os)
|
||||
{
|
||||
|
||||
std::ios::fmtflags flags(os.flags());
|
||||
|
||||
os << "abf {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n";
|
||||
os << " }\n";
|
||||
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield); // default floating-point format
|
||||
os << "\nsamples\n";
|
||||
samples->write_raw(os, 8);
|
||||
@ -617,117 +620,47 @@ std::ostream & colvarbias_abf::write_restart(std::ostream& os)
|
||||
z_gradients->write_raw(os, 8);
|
||||
}
|
||||
|
||||
os << "}\n\n";
|
||||
|
||||
os.flags(flags);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_abf::read_restart(std::istream& is)
|
||||
std::istream & colvarbias_abf::read_state_data(std::istream& is)
|
||||
{
|
||||
if ( input_prefix.size() > 0 ) {
|
||||
cvm::error("ERROR: cannot provide both inputPrefix and a colvars state file.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
size_t const start_pos = is.tellg();
|
||||
|
||||
cvm::log("Restarting ABF bias \""+
|
||||
this->name+"\".\n");
|
||||
std::string key, brace, conf;
|
||||
|
||||
if ( !(is >> key) || !(key == "abf") ||
|
||||
!(is >> brace) || !(brace == "{") ||
|
||||
!(is >> colvarparse::read_block("configuration", conf)) ) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
std::string name = "";
|
||||
if ( (colvarparse::get_keyval(conf, "name", name, std::string(""), colvarparse::parse_silent)) &&
|
||||
(name != this->name) )
|
||||
cvm::error("Error: in the restart file, the "
|
||||
"\"abf\" block has wrong name(" + name + ")\n");
|
||||
if ( name == "" ) {
|
||||
cvm::error("Error: \"abf\" block in the restart file has no name.\n");
|
||||
}
|
||||
|
||||
if ( !(is >> key) || !(key == "samples")) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
if (! read_state_data_key(is, "samples")) {
|
||||
return is;
|
||||
}
|
||||
if (! samples->read_raw(is)) {
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
if ( !(is >> key) || !(key == "gradient")) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
if (! read_state_data_key(is, "gradient")) {
|
||||
return is;
|
||||
}
|
||||
if (! gradients->read_raw(is)) {
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
if (z_gradients) {
|
||||
if ( !(is >> key) || !(key == "z_samples")) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
|
||||
if (! read_state_data_key(is, "z_samples")) {
|
||||
return is;
|
||||
}
|
||||
if (! z_samples->read_raw(is)) {
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
if ( !(is >> key) || !(key == "z_gradient")) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
if (! read_state_data_key(is, "z_gradient")) {
|
||||
return is;
|
||||
}
|
||||
if (! z_gradients->read_raw(is)) {
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
}
|
||||
is >> brace;
|
||||
if (brace != "}") {
|
||||
cvm::error("Error: corrupt restart information for ABF bias \""+
|
||||
this->name+"\": no matching brace at position "+
|
||||
cvm::to_str(is.tellg())+" in the restart file.\n");
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_ABF_H
|
||||
#define COLVARBIAS_ABF_H
|
||||
|
||||
@ -107,8 +114,8 @@ private:
|
||||
/// Read human-readable FE gradients and sample count (if not using restart)
|
||||
void read_gradients_samples();
|
||||
|
||||
std::istream& read_restart(std::istream&);
|
||||
std::ostream& write_restart(std::ostream&);
|
||||
std::istream& read_state_data(std::istream&);
|
||||
std::ostream& write_state_data(std::ostream&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@ -33,6 +40,9 @@ int colvarbias_alb::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_scalar_variables);
|
||||
enable(f_cvb_scalar_variables);
|
||||
|
||||
provide(f_cvb_history_dependent);
|
||||
|
||||
size_t i;
|
||||
@ -239,37 +249,8 @@ int colvarbias_alb::update()
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_alb::read_restart(std::istream &is)
|
||||
int colvarbias_alb::set_state_params(std::string const &conf)
|
||||
{
|
||||
size_t const start_pos = is.tellg();
|
||||
|
||||
cvm::log("Restarting adaptive linear bias \""+
|
||||
this->name+"\".\n");
|
||||
|
||||
std::string key, brace, conf;
|
||||
if ( !(is >> key) || !(key == "ALB") ||
|
||||
!(is >> brace) || !(brace == "{") ||
|
||||
!(is >> colvarparse::read_block("configuration", conf)) ) {
|
||||
|
||||
cvm::log("Error: in reading restart configuration for restraint bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
std::string name = "";
|
||||
if ( (colvarparse::get_keyval(conf, "name", name, std::string(""), colvarparse::parse_silent)) &&
|
||||
(name != this->name) )
|
||||
cvm::fatal_error("Error: in the restart file, the "
|
||||
"\"ALB\" block has a wrong name\n");
|
||||
if (name.size() == 0) {
|
||||
cvm::fatal_error("Error: \"ALB\" block in the restart file "
|
||||
"has no identifiers.\n");
|
||||
}
|
||||
|
||||
if (!get_keyval(conf, "setCoupling", set_coupling))
|
||||
cvm::fatal_error("Error: current setCoupling is missing from the restart.\n");
|
||||
|
||||
@ -299,23 +280,13 @@ std::istream & colvarbias_alb::read_restart(std::istream &is)
|
||||
if (!get_keyval(conf, "b_equilibration", b_equilibration))
|
||||
cvm::fatal_error("Error: current updateCalls is missing from the restart.\n");
|
||||
|
||||
is >> brace;
|
||||
if (brace != "}") {
|
||||
cvm::fatal_error("Error: corrupt restart information for adaptive linear bias \""+
|
||||
this->name+"\": no matching brace at position "+
|
||||
cvm::to_str(is.tellg())+" in the restart file.\n");
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
|
||||
return is;
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_alb::write_restart(std::ostream &os)
|
||||
std::string const colvarbias_alb::get_state_params() const
|
||||
{
|
||||
os << "ALB {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n";
|
||||
std::ostringstream os;
|
||||
os << " setCoupling ";
|
||||
size_t i;
|
||||
for (i = 0; i < colvars.size(); i++) {
|
||||
@ -358,10 +329,7 @@ std::ostream & colvarbias_alb::write_restart(std::ostream &os)
|
||||
else
|
||||
os << " b_equilibration no\n";
|
||||
|
||||
os << " }\n"
|
||||
<< "}\n\n";
|
||||
|
||||
return os;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,18 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_ALB_H
|
||||
#define COLVARBIAS_ALB_H
|
||||
|
||||
#include "colvar.h"
|
||||
#include "colvarbias_restraint.h"
|
||||
#include "colvarbias.h"
|
||||
|
||||
|
||||
class colvarbias_alb : public colvarbias {
|
||||
|
||||
@ -15,8 +23,8 @@ public:
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int update();
|
||||
|
||||
virtual std::istream & read_restart(std::istream &is);
|
||||
virtual std::ostream & write_restart(std::ostream &os);
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvar.h"
|
||||
#include "colvarbias_histogram.h"
|
||||
@ -17,6 +24,9 @@ int colvarbias_histogram::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_scalar_variables);
|
||||
enable(f_cvb_scalar_variables);
|
||||
|
||||
provide(f_cvb_history_dependent);
|
||||
enable(f_cvb_history_dependent);
|
||||
|
||||
@ -196,78 +206,25 @@ int colvarbias_histogram::write_output_files()
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_histogram::read_restart(std::istream& is)
|
||||
std::istream & colvarbias_histogram::read_state_data(std::istream& is)
|
||||
{
|
||||
size_t const start_pos = is.tellg();
|
||||
|
||||
cvm::log("Restarting collective variable histogram \""+
|
||||
this->name+"\".\n");
|
||||
std::string key, brace, conf;
|
||||
|
||||
if ( !(is >> key) || !(key == "histogram") ||
|
||||
!(is >> brace) || !(brace == "{") ||
|
||||
!(is >> colvarparse::read_block("configuration", conf)) ) {
|
||||
cvm::log("Error: in reading restart configuration for histogram \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
int id = -1;
|
||||
std::string name = "";
|
||||
if ( (colvarparse::get_keyval(conf, "name", name, std::string(""), colvarparse::parse_silent)) &&
|
||||
(name != this->name) )
|
||||
cvm::error("Error: in the restart file, the "
|
||||
"\"histogram\" block has a wrong name: different system?\n");
|
||||
if ( (id == -1) && (name == "") ) {
|
||||
cvm::error("Error: \"histogram\" block in the restart file "
|
||||
"has no name.\n");
|
||||
}
|
||||
|
||||
if ( !(is >> key) || !(key == "grid")) {
|
||||
cvm::error("Error: in reading restart configuration for histogram \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
if (! read_state_data_key(is, "grid")) {
|
||||
return is;
|
||||
}
|
||||
if (! grid->read_raw(is)) {
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
is >> brace;
|
||||
if (brace != "}") {
|
||||
cvm::error("Error: corrupt restart information for ABF bias \""+
|
||||
this->name+"\": no matching brace at position "+
|
||||
cvm::to_str(is.tellg())+" in the restart file.\n");
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
std::ostream & colvarbias_histogram::write_restart(std::ostream& os)
|
||||
|
||||
std::ostream & colvarbias_histogram::write_state_data(std::ostream& os)
|
||||
{
|
||||
std::ios::fmtflags flags(os.flags());
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield);
|
||||
|
||||
os << "histogram {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n";
|
||||
os << " }\n";
|
||||
|
||||
os << "grid\n";
|
||||
grid->write_raw(os, 8);
|
||||
|
||||
os << "}\n\n";
|
||||
|
||||
os.flags(flags);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_HISTOGRAM_H
|
||||
#define COLVARBIAS_HISTOGRAM_H
|
||||
|
||||
@ -35,8 +42,8 @@ protected:
|
||||
/// If colvar_array_size is larger than 1, weigh each one by this number before accumulating the histogram
|
||||
std::vector<cvm::real> weights;
|
||||
|
||||
virtual std::istream& read_restart(std::istream&);
|
||||
virtual std::ostream& write_restart(std::ostream&);
|
||||
virtual std::istream & read_state_data(std::istream &is);
|
||||
virtual std::ostream & write_state_data(std::ostream &os);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
@ -26,10 +33,9 @@
|
||||
|
||||
|
||||
colvarbias_meta::colvarbias_meta(char const *key)
|
||||
: colvarbias(key),
|
||||
new_hills_begin(hills.end()),
|
||||
state_file_step(0)
|
||||
: colvarbias(key)
|
||||
{
|
||||
new_hills_begin = hills.end();
|
||||
}
|
||||
|
||||
|
||||
@ -164,11 +170,32 @@ int colvarbias_meta::init(std::string const &conf)
|
||||
target_dist = NULL;
|
||||
get_keyval(conf, "ebMeta", ebmeta, false);
|
||||
if(ebmeta){
|
||||
if (use_grids && expand_grids) {
|
||||
cvm::fatal_error("Error: expandBoundaries is not supported with "
|
||||
"ebMeta please allocate wide enough boundaries for "
|
||||
"each colvar ahead of time and set targetdistfile "
|
||||
"accordingly. \n");
|
||||
}
|
||||
target_dist = new colvar_grid_scalar();
|
||||
target_dist->init_from_colvars(colvars);
|
||||
get_keyval(conf, "targetdistfile", target_dist_file);
|
||||
std::ifstream targetdiststream(target_dist_file.c_str());
|
||||
target_dist->read_multicol(targetdiststream);
|
||||
cvm::real min_val = target_dist->minimum_value();
|
||||
if(min_val<0){
|
||||
cvm::error("Error: Target distribution of ebMeta "
|
||||
"has negative values!.\n", INPUT_ERROR);
|
||||
}
|
||||
cvm::real min_pos_val = target_dist->minimum_pos_value();
|
||||
if(min_pos_val<=0){
|
||||
cvm::error("Error: Target distribution of ebMeta has negative "
|
||||
"or zero minimum positive value!.\n", INPUT_ERROR);
|
||||
}
|
||||
if(min_val==0){
|
||||
cvm::log("WARNING: Target distribution has zero values.\n");
|
||||
cvm::log("Zeros will be converted to the minimum positive value.\n");
|
||||
target_dist->remove_zeros(min_pos_val);
|
||||
}
|
||||
// normalize target distribution and multiply by effective volume = exp(differential entropy)
|
||||
target_dist->multiply_constant(1.0/target_dist->integral());
|
||||
cvm::real volume = std::exp(target_dist->entropy());
|
||||
@ -404,8 +431,10 @@ int colvarbias_meta::update()
|
||||
|
||||
if (ebmeta) {
|
||||
hills_scale *= 1.0/target_dist->value(target_dist->get_colvars_index());
|
||||
if(cvm::step_absolute() <= ebmeta_equil_steps) {
|
||||
cvm::real const hills_lambda=(cvm::real(ebmeta_equil_steps - cvm::step_absolute()))/(cvm::real(ebmeta_equil_steps));
|
||||
if(cvm::step_absolute() <= long(ebmeta_equil_steps)) {
|
||||
cvm::real const hills_lambda =
|
||||
(cvm::real(long(ebmeta_equil_steps) - cvm::step_absolute())) /
|
||||
(cvm::real(ebmeta_equil_steps));
|
||||
hills_scale = hills_lambda + (1-hills_lambda)*hills_scale;
|
||||
}
|
||||
}
|
||||
@ -972,7 +1001,7 @@ void colvarbias_meta::read_replica_files()
|
||||
(replicas[ir])->replica_state_file+"\".\n");
|
||||
|
||||
std::ifstream is((replicas[ir])->replica_state_file.c_str());
|
||||
if (! (replicas[ir])->read_restart(is)) {
|
||||
if (! (replicas[ir])->read_state(is)) {
|
||||
cvm::log("Reading from file \""+(replicas[ir])->replica_state_file+
|
||||
"\" failed or incomplete: will try again in "+
|
||||
cvm::to_str(replica_update_freq)+" steps.\n");
|
||||
@ -1068,63 +1097,24 @@ void colvarbias_meta::read_replica_files()
|
||||
}
|
||||
|
||||
|
||||
// **********************************************************************
|
||||
// input functions
|
||||
// **********************************************************************
|
||||
|
||||
|
||||
std::istream & colvarbias_meta::read_restart(std::istream& is)
|
||||
int colvarbias_meta::set_state_params(std::string const &state_conf)
|
||||
{
|
||||
size_t const start_pos = is.tellg();
|
||||
|
||||
if (comm == single_replica) {
|
||||
// if using a multiple replicas scheme, output messages
|
||||
// are printed before and after calling this function
|
||||
cvm::log("Restarting metadynamics bias \""+this->name+"\""+
|
||||
".\n");
|
||||
}
|
||||
std::string key, brace, conf;
|
||||
if ( !(is >> key) || !(key == "metadynamics") ||
|
||||
!(is >> brace) || !(brace == "{") ||
|
||||
!(is >> colvarparse::read_block("configuration", conf)) ) {
|
||||
|
||||
if (comm == single_replica)
|
||||
cvm::log("Error: in reading restart configuration for metadynamics bias \""+
|
||||
this->name+"\""+
|
||||
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
|
||||
(replica_state_file_in_sync ? ("at position "+
|
||||
cvm::to_str(start_pos)+
|
||||
" in the state file") : "")+".\n");
|
||||
is.clear();
|
||||
is.seekg(start_pos, std::ios::beg);
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
std::string new_replica = "";
|
||||
if (colvarparse::get_keyval(state_conf, "replicaID", new_replica,
|
||||
std::string(""), colvarparse::parse_silent) &&
|
||||
(new_replica != this->replica_id)) {
|
||||
cvm::error("Error: in the state file, the "
|
||||
"\"metadynamics\" block has a different replicaID: different system?\n",
|
||||
INPUT_ERROR);
|
||||
return INPUT_ERROR;
|
||||
}
|
||||
|
||||
std::string name = "";
|
||||
if ( colvarparse::get_keyval(conf, "name", name,
|
||||
std::string(""), colvarparse::parse_silent) &&
|
||||
(name != this->name) )
|
||||
cvm::fatal_error("Error: in the restart file, the "
|
||||
"\"metadynamics\" block has a different name: different system?\n");
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
if (name.size() == 0) {
|
||||
cvm::fatal_error("Error: \"metadynamics\" block within the restart file "
|
||||
"has no identifiers.\n");
|
||||
}
|
||||
|
||||
if (comm != single_replica) {
|
||||
std::string replica = "";
|
||||
if (colvarparse::get_keyval(conf, "replicaID", replica,
|
||||
std::string(""), colvarparse::parse_silent) &&
|
||||
(replica != this->replica_id))
|
||||
cvm::fatal_error("Error: in the restart file, the "
|
||||
"\"metadynamics\" block has a different replicaID: different system?\n");
|
||||
|
||||
colvarparse::get_keyval(conf, "step", state_file_step,
|
||||
cvm::step_absolute(), colvarparse::parse_silent);
|
||||
}
|
||||
|
||||
std::istream & colvarbias_meta::read_state_data(std::istream& is)
|
||||
{
|
||||
bool grids_from_restart_file = use_grids;
|
||||
|
||||
if (use_grids) {
|
||||
@ -1155,6 +1145,7 @@ std::istream & colvarbias_meta::read_restart(std::istream& is)
|
||||
}
|
||||
|
||||
size_t const hills_energy_pos = is.tellg();
|
||||
std::string key;
|
||||
if (!(is >> key)) {
|
||||
if (hills_energy_backup != NULL) {
|
||||
delete hills_energy;
|
||||
@ -1316,17 +1307,6 @@ std::istream & colvarbias_meta::read_restart(std::istream& is)
|
||||
}
|
||||
}
|
||||
|
||||
is >> brace;
|
||||
if (brace != "}") {
|
||||
cvm::log("Incomplete restart information for metadynamics bias \""+
|
||||
this->name+"\""+
|
||||
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
|
||||
": no closing brace at position "+
|
||||
cvm::to_str(is.tellg())+" in the file.\n");
|
||||
is.setstate(std::ios::failbit);
|
||||
return is;
|
||||
}
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("colvarbias_meta::read_restart() done\n");
|
||||
|
||||
@ -1424,13 +1404,6 @@ std::istream & colvarbias_meta::read_hill(std::istream &is)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// **********************************************************************
|
||||
// output functions
|
||||
// **********************************************************************
|
||||
|
||||
|
||||
int colvarbias_meta::setup_output()
|
||||
{
|
||||
|
||||
@ -1537,16 +1510,17 @@ int colvarbias_meta::setup_output()
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_meta::write_restart(std::ostream& os)
|
||||
std::string const colvarbias_meta::get_state_params() const
|
||||
{
|
||||
os << "metadynamics {\n"
|
||||
<< " configuration {\n"
|
||||
<< " step " << cvm::step_absolute() << "\n"
|
||||
<< " name " << this->name << "\n";
|
||||
std::ostringstream os;
|
||||
if (this->comm != single_replica)
|
||||
os << " replicaID " << this->replica_id << "\n";
|
||||
os << " }\n\n";
|
||||
os << "replicaID " << this->replica_id << "\n";
|
||||
return (colvarbias::get_state_params() + os.str());
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_meta::write_state_data(std::ostream& os)
|
||||
{
|
||||
if (use_grids) {
|
||||
|
||||
// this is a very good time to project hills, if you haven't done
|
||||
@ -1578,8 +1552,12 @@ std::ostream & colvarbias_meta::write_restart(std::ostream& os)
|
||||
}
|
||||
}
|
||||
|
||||
os << "}\n\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
int colvarbias_meta::write_state_to_replicas()
|
||||
{
|
||||
if (comm != single_replica) {
|
||||
write_replica_state_file();
|
||||
// schedule to reread the state files of the other replicas (they
|
||||
@ -1588,12 +1566,16 @@ std::ostream & colvarbias_meta::write_restart(std::ostream& os)
|
||||
(replicas[ir])->replica_state_file_in_sync = false;
|
||||
}
|
||||
}
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
int colvarbias_meta::write_output_files()
|
||||
{
|
||||
if (dump_fes) {
|
||||
write_pmf();
|
||||
}
|
||||
|
||||
return os;
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -1665,53 +1647,67 @@ void colvarbias_meta::write_pmf()
|
||||
|
||||
|
||||
|
||||
void colvarbias_meta::write_replica_state_file()
|
||||
int colvarbias_meta::write_replica_state_file()
|
||||
{
|
||||
// write down also the restart for the other replicas: TODO: this
|
||||
// is duplicated code, that could be cleaned up later
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Writing replica state file for bias \""+name+"\"\n");
|
||||
}
|
||||
// write down also the restart for the other replicas
|
||||
cvm::backup_file(replica_state_file.c_str());
|
||||
cvm::ofstream rep_state_os(replica_state_file.c_str());
|
||||
if (!rep_state_os.is_open())
|
||||
cvm::fatal_error("Error: in opening file \""+
|
||||
replica_state_file+"\" for writing.\n");
|
||||
|
||||
rep_state_os.setf(std::ios::scientific, std::ios::floatfield);
|
||||
rep_state_os << "\n"
|
||||
<< "metadynamics {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n"
|
||||
<< " step " << cvm::step_absolute() << "\n";
|
||||
if (this->comm != single_replica) {
|
||||
rep_state_os << " replicaID " << this->replica_id << "\n";
|
||||
}
|
||||
rep_state_os << " }\n\n";
|
||||
rep_state_os << " hills_energy\n";
|
||||
rep_state_os << std::setprecision(cvm::cv_prec)
|
||||
<< std::setw(cvm::cv_width);
|
||||
hills_energy->write_restart(rep_state_os);
|
||||
rep_state_os << " hills_energy_gradients\n";
|
||||
rep_state_os << std::setprecision(cvm::cv_prec)
|
||||
<< std::setw(cvm::cv_width);
|
||||
hills_energy_gradients->write_restart(rep_state_os);
|
||||
|
||||
if ( (!use_grids) || keep_hills ) {
|
||||
// write all hills currently in memory
|
||||
for (std::list<hill>::const_iterator h = this->hills.begin();
|
||||
h != this->hills.end();
|
||||
h++) {
|
||||
rep_state_os << *h;
|
||||
}
|
||||
} else {
|
||||
// write just those that are near the grid boundaries
|
||||
for (std::list<hill>::const_iterator h = this->hills_off_grid.begin();
|
||||
h != this->hills_off_grid.end();
|
||||
h++) {
|
||||
rep_state_os << *h;
|
||||
}
|
||||
std::ostream *rep_state_os = cvm::proxy->output_stream(replica_state_file);
|
||||
if (rep_state_os == NULL) {
|
||||
cvm::error("Error: in opening file \""+
|
||||
replica_state_file+"\" for writing.\n", FILE_ERROR);
|
||||
return FILE_ERROR;
|
||||
}
|
||||
|
||||
rep_state_os << "}\n\n";
|
||||
rep_state_os.close();
|
||||
rep_state_os->setf(std::ios::scientific, std::ios::floatfield);
|
||||
|
||||
if (!write_state(*rep_state_os)) {
|
||||
cvm::error("Error: in writing to file \""+
|
||||
replica_state_file+"\".\n", FILE_ERROR);
|
||||
cvm::proxy->close_output_stream(replica_state_file);
|
||||
return FILE_ERROR;
|
||||
}
|
||||
|
||||
cvm::proxy->close_output_stream(replica_state_file);
|
||||
|
||||
// rep_state_os.setf(std::ios::scientific, std::ios::floatfield);
|
||||
// rep_state_os << "\n"
|
||||
// << "metadynamics {\n"
|
||||
// << " configuration {\n"
|
||||
// << " name " << this->name << "\n"
|
||||
// << " step " << cvm::step_absolute() << "\n";
|
||||
// if (this->comm != single_replica) {
|
||||
// rep_state_os << " replicaID " << this->replica_id << "\n";
|
||||
// }
|
||||
// rep_state_os << " }\n\n";
|
||||
// rep_state_os << " hills_energy\n";
|
||||
// rep_state_os << std::setprecision(cvm::cv_prec)
|
||||
// << std::setw(cvm::cv_width);
|
||||
// hills_energy->write_restart(rep_state_os);
|
||||
// rep_state_os << " hills_energy_gradients\n";
|
||||
// rep_state_os << std::setprecision(cvm::cv_prec)
|
||||
// << std::setw(cvm::cv_width);
|
||||
// hills_energy_gradients->write_restart(rep_state_os);
|
||||
|
||||
// if ( (!use_grids) || keep_hills ) {
|
||||
// // write all hills currently in memory
|
||||
// for (std::list<hill>::const_iterator h = this->hills.begin();
|
||||
// h != this->hills.end();
|
||||
// h++) {
|
||||
// rep_state_os << *h;
|
||||
// }
|
||||
// } else {
|
||||
// // write just those that are near the grid boundaries
|
||||
// for (std::list<hill>::const_iterator h = this->hills_off_grid.begin();
|
||||
// h != this->hills_off_grid.end();
|
||||
// h++) {
|
||||
// rep_state_os << *h;
|
||||
// }
|
||||
// }
|
||||
// rep_state_os << "}\n\n";
|
||||
// rep_state_os.close();
|
||||
|
||||
// reopen the hills file
|
||||
replica_hills_os.close();
|
||||
@ -1721,8 +1717,11 @@ void colvarbias_meta::write_replica_state_file()
|
||||
cvm::fatal_error("Error: in opening file \""+
|
||||
replica_hills_file+"\" for writing.\n");
|
||||
replica_hills_os.setf(std::ios::scientific, std::ios::floatfield);
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
std::string colvarbias_meta::hill::output_traj()
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_META_H
|
||||
#define COLVARBIAS_META_H
|
||||
|
||||
@ -31,10 +38,16 @@ public:
|
||||
virtual int init(std::string const &conf);
|
||||
virtual ~colvarbias_meta();
|
||||
virtual int update();
|
||||
virtual std::istream & read_restart(std::istream &is);
|
||||
virtual std::ostream & write_restart(std::ostream &os);
|
||||
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &state_conf);
|
||||
virtual std::ostream & write_state_data(std::ostream &os);
|
||||
virtual std::istream & read_state_data(std::istream &os);
|
||||
|
||||
virtual int setup_output();
|
||||
virtual int write_output_files();
|
||||
virtual void write_pmf();
|
||||
virtual int write_state_to_replicas();
|
||||
|
||||
class hill;
|
||||
typedef std::list<hill>::iterator hill_iter;
|
||||
@ -77,13 +90,6 @@ protected:
|
||||
/// Read a hill from a file
|
||||
std::istream & read_hill(std::istream &is);
|
||||
|
||||
/// \brief step present in a state file
|
||||
///
|
||||
/// When using grids and reading state files containing them
|
||||
/// (multiple replicas), this is used to check whether a hill is
|
||||
/// newer or older than the grids
|
||||
size_t state_file_step;
|
||||
|
||||
/// \brief Add a new hill; if a .hills trajectory is written,
|
||||
/// write it there; if there is more than one replica, communicate
|
||||
/// it to the others
|
||||
@ -187,7 +193,7 @@ protected:
|
||||
virtual void read_replica_files();
|
||||
|
||||
/// \brief Write data to other replicas
|
||||
virtual void write_replica_state_file();
|
||||
virtual int write_replica_state_file();
|
||||
|
||||
/// \brief Additional, "mirror" metadynamics biases, to collect info
|
||||
/// from the other replicas
|
||||
|
||||
@ -1,36 +1,43 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARBIAS_RESTRAINT_H
|
||||
#define COLVARBIAS_RESTRAINT_H
|
||||
|
||||
#include "colvarbias.h"
|
||||
|
||||
/// \brief Bias restraint, optionally moving towards a target
|
||||
/// \brief Most general definition of a colvar restraint:
|
||||
/// see derived classes for specific types
|
||||
/// (implementation of \link colvarbias \endlink)
|
||||
class colvarbias_restraint : public colvarbias {
|
||||
class colvarbias_restraint
|
||||
: public virtual colvarbias
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Retrieve colvar values and calculate their biasing forces
|
||||
virtual int update();
|
||||
|
||||
// TODO the following can be supplanted by a new call to init()
|
||||
/// Load new configuration - force constant and/or centers only
|
||||
virtual void change_configuration(std::string const &conf);
|
||||
virtual int change_configuration(std::string const &conf) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
/// Calculate change in energy from using alternate configuration
|
||||
virtual cvm::real energy_difference(std::string const &conf);
|
||||
virtual cvm::real energy_difference(std::string const &conf) { return 0.0; }
|
||||
|
||||
/// Read the bias configuration from a restart file
|
||||
virtual std::istream & read_restart(std::istream &is);
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
// virtual std::ostream & write_state_data(std::ostream &os);
|
||||
// virtual std::istream & read_state_data(std::istream &os);
|
||||
virtual std::ostream & write_state(std::ostream &os);
|
||||
virtual std::istream & read_state(std::istream &is);
|
||||
|
||||
/// Write the bias configuration to a restart file
|
||||
virtual std::ostream & write_restart(std::ostream &os);
|
||||
|
||||
/// Write a label to the trajectory file (comment line)
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
|
||||
/// Output quantities such as the bias energy to the trajectory file
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
/// \brief Constructor
|
||||
@ -42,26 +49,110 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Potential function
|
||||
virtual cvm::real restraint_potential(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const = 0;
|
||||
/// \brief Potential function for the i-th colvar
|
||||
virtual cvm::real restraint_potential(size_t i) const = 0;
|
||||
|
||||
/// \brief Force function
|
||||
virtual colvarvalue restraint_force(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const = 0;
|
||||
/// \brief Force function for the i-th colvar
|
||||
virtual colvarvalue const restraint_force(size_t i) const = 0;
|
||||
|
||||
///\brief Unit scaling
|
||||
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const = 0;
|
||||
/// \brief Derivative of the potential function with respect to the force constant
|
||||
virtual cvm::real d_restraint_potential_dk(size_t i) const = 0;
|
||||
};
|
||||
|
||||
|
||||
/// Definition and parsing of the restraint centers
|
||||
class colvarbias_restraint_centers
|
||||
: public virtual colvarbias_restraint
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_centers(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int change_configuration(std::string const &conf);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Restraint centers
|
||||
std::vector<colvarvalue> colvar_centers;
|
||||
|
||||
/// \brief Restraint centers without wrapping or constraints applied
|
||||
/// \brief Restraint centers outside the domain of the colvars (no wrapping or constraints applied)
|
||||
std::vector<colvarvalue> colvar_centers_raw;
|
||||
};
|
||||
|
||||
|
||||
/// Definition and parsing of the force constant
|
||||
class colvarbias_restraint_k
|
||||
: public virtual colvarbias_restraint
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_k(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int change_configuration(std::string const &conf);
|
||||
|
||||
protected:
|
||||
/// \brief Restraint force constant
|
||||
cvm::real force_k;
|
||||
};
|
||||
|
||||
|
||||
/// Options to change the restraint configuration over time (shared between centers and k moving)
|
||||
class colvarbias_restraint_moving
|
||||
: public virtual colvarparse {
|
||||
public:
|
||||
|
||||
colvarbias_restraint_moving(char const *key);
|
||||
// Note: despite the diamond inheritance, most of this function gets only executed once
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int update() { return COLVARS_OK; }
|
||||
virtual int change_configuration(std::string const &conf) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Moving target?
|
||||
bool b_chg_centers;
|
||||
|
||||
/// \brief Changing force constant?
|
||||
bool b_chg_force_k;
|
||||
|
||||
/// \brief Number of stages over which to perform the change
|
||||
/// If zero, perform a continuous change
|
||||
int target_nstages;
|
||||
|
||||
/// \brief Number of current stage of the perturbation
|
||||
int stage;
|
||||
|
||||
/// \brief Lambda-schedule for custom varying force constant
|
||||
std::vector<cvm::real> lambda_schedule;
|
||||
|
||||
/// \brief Number of steps required to reach the target force constant
|
||||
/// or restraint centers
|
||||
long target_nsteps;
|
||||
};
|
||||
|
||||
|
||||
/// Options to change the restraint centers over time
|
||||
class colvarbias_restraint_centers_moving
|
||||
: public virtual colvarbias_restraint_centers,
|
||||
public virtual colvarbias_restraint_moving
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_centers_moving(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int update();
|
||||
virtual int change_configuration(std::string const &conf) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief New restraint centers
|
||||
std::vector<colvarvalue> target_centers;
|
||||
|
||||
@ -78,11 +169,29 @@ protected:
|
||||
/// \brief Accumulated work
|
||||
cvm::real acc_work;
|
||||
|
||||
/// \brief Restraint force constant
|
||||
cvm::real force_k;
|
||||
/// Update the accumulated work
|
||||
int update_acc_work();
|
||||
};
|
||||
|
||||
/// \brief Changing force constant?
|
||||
bool b_chg_force_k;
|
||||
|
||||
/// Options to change the restraint force constant over time
|
||||
class colvarbias_restraint_k_moving
|
||||
: public virtual colvarbias_restraint_k,
|
||||
public virtual colvarbias_restraint_moving
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_k_moving(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int update();
|
||||
virtual int change_configuration(std::string const &conf) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Restraint force constant (target value)
|
||||
cvm::real target_force_k;
|
||||
@ -90,9 +199,6 @@ protected:
|
||||
/// \brief Restraint force constant (starting value)
|
||||
cvm::real starting_force_k;
|
||||
|
||||
/// \brief Lambda-schedule for custom varying force constant
|
||||
std::vector<cvm::real> lambda_schedule;
|
||||
|
||||
/// \brief Exponent for varying the force constant
|
||||
cvm::real force_k_exp;
|
||||
|
||||
@ -100,71 +206,91 @@ protected:
|
||||
/// (in TI, would be the accumulating FE derivative)
|
||||
cvm::real restraint_FE;
|
||||
|
||||
|
||||
/// \brief Equilibration steps for restraint FE calculation through TI
|
||||
cvm::real target_equil_steps;
|
||||
|
||||
/// \brief Number of stages over which to perform the change
|
||||
/// If zero, perform a continuous change
|
||||
int target_nstages;
|
||||
|
||||
/// \brief Number of current stage of the perturbation
|
||||
int stage;
|
||||
|
||||
/// \brief Number of steps required to reach the target force constant
|
||||
/// or restraint centers
|
||||
long target_nsteps;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Harmonic bias restraint
|
||||
/// (implementation of \link colvarbias_restraint \endlink)
|
||||
class colvarbias_restraint_harmonic : public colvarbias_restraint {
|
||||
|
||||
class colvarbias_restraint_harmonic
|
||||
: public colvarbias_restraint_centers_moving,
|
||||
public colvarbias_restraint_k_moving
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_harmonic(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
// no additional members, destructor not needed
|
||||
virtual int update();
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
virtual int change_configuration(std::string const &conf);
|
||||
virtual cvm::real energy_difference(std::string const &conf);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Potential function
|
||||
virtual cvm::real restraint_potential(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const;
|
||||
virtual cvm::real restraint_potential(size_t i) const;
|
||||
virtual colvarvalue const restraint_force(size_t i) const;
|
||||
virtual cvm::real d_restraint_potential_dk(size_t i) const;
|
||||
};
|
||||
|
||||
/// \brief Force function
|
||||
virtual colvarvalue restraint_force(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const;
|
||||
|
||||
///\brief Unit scaling
|
||||
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
|
||||
/// \brief Wall restraint
|
||||
/// (implementation of \link colvarbias_restraint \endlink)
|
||||
class colvarbias_restraint_harmonic_walls
|
||||
: public colvarbias_restraint_k_moving
|
||||
{
|
||||
public:
|
||||
|
||||
colvarbias_restraint_harmonic_walls(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
virtual int update();
|
||||
virtual void communicate_forces();
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Location of the lower walls
|
||||
std::vector<colvarvalue> lower_walls;
|
||||
|
||||
/// \brief Location of the upper walls
|
||||
std::vector<colvarvalue> upper_walls;
|
||||
|
||||
virtual cvm::real colvar_distance(size_t i) const;
|
||||
virtual cvm::real restraint_potential(size_t i) const;
|
||||
virtual colvarvalue const restraint_force(size_t i) const;
|
||||
virtual cvm::real d_restraint_potential_dk(size_t i) const;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Linear bias restraint
|
||||
/// (implementation of \link colvarbias_restraint \endlink)
|
||||
class colvarbias_restraint_linear : public colvarbias_restraint {
|
||||
class colvarbias_restraint_linear
|
||||
: public colvarbias_restraint_centers_moving,
|
||||
public colvarbias_restraint_k_moving
|
||||
{
|
||||
|
||||
public:
|
||||
colvarbias_restraint_linear(char const *key);
|
||||
virtual int init(std::string const &conf);
|
||||
// no additional members, destructor not needed
|
||||
virtual int update();
|
||||
virtual int change_configuration(std::string const &conf);
|
||||
virtual cvm::real energy_difference(std::string const &conf);
|
||||
|
||||
virtual std::string const get_state_params() const;
|
||||
virtual int set_state_params(std::string const &conf);
|
||||
virtual std::ostream & write_traj_label(std::ostream &os);
|
||||
virtual std::ostream & write_traj(std::ostream &os);
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Potential function
|
||||
virtual cvm::real restraint_potential(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const;
|
||||
|
||||
/// \brief Force function
|
||||
virtual colvarvalue restraint_force(cvm::real k, colvar const *x,
|
||||
colvarvalue const &xcenter) const;
|
||||
|
||||
///\brief Unit scaling
|
||||
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
|
||||
|
||||
virtual cvm::real restraint_potential(size_t i) const;
|
||||
virtual colvarvalue const restraint_force(size_t i) const;
|
||||
virtual cvm::real d_restraint_potential_dk(size_t i) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarvalue.h"
|
||||
#include "colvar.h"
|
||||
@ -154,15 +161,17 @@ void colvar::cvc::read_data()
|
||||
|
||||
void colvar::cvc::calc_force_invgrads()
|
||||
{
|
||||
cvm::fatal_error("Error: calculation of inverse gradients is not implemented "
|
||||
"for colvar components of type \""+function_type+"\".\n");
|
||||
cvm::error("Error: calculation of inverse gradients is not implemented "
|
||||
"for colvar components of type \""+function_type+"\".\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
void colvar::cvc::calc_Jacobian_derivative()
|
||||
{
|
||||
cvm::fatal_error("Error: calculation of inverse gradients is not implemented "
|
||||
"for colvar components of type \""+function_type+"\".\n");
|
||||
cvm::error("Error: calculation of inverse gradients is not implemented "
|
||||
"for colvar components of type \""+function_type+"\".\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
@ -281,6 +290,33 @@ void colvar::cvc::debug_gradients(cvm::atom_group *group)
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvar::cvc::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.dist2(x2);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::cvc::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.dist2_grad(x2);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::cvc::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x2.dist2_grad(x1);
|
||||
}
|
||||
|
||||
|
||||
void colvar::cvc::wrap(colvarvalue &x) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Static members
|
||||
|
||||
std::vector<colvardeps::feature *> colvar::cvc::cvc_features;
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARCOMP_H
|
||||
#define COLVARCOMP_H
|
||||
|
||||
@ -105,8 +112,8 @@ public:
|
||||
/// options from the provided configuration string
|
||||
/// Returns reference to new group
|
||||
cvm::atom_group *parse_group(std::string const &conf,
|
||||
char const *group_key,
|
||||
bool optional = false);
|
||||
char const *group_key,
|
||||
bool optional = false);
|
||||
|
||||
/// \brief Parse options pertaining to total force calculation
|
||||
virtual int init_total_force_params(std::string const &conf);
|
||||
@ -130,7 +137,7 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Obtain data needed for the calculation for the backend
|
||||
void read_data();
|
||||
virtual void read_data();
|
||||
|
||||
/// \brief Calculate the variable
|
||||
virtual void calc_value() = 0;
|
||||
@ -151,17 +158,14 @@ public:
|
||||
|
||||
|
||||
/// \brief Return the previously calculated value
|
||||
virtual colvarvalue const & value() const;
|
||||
|
||||
// /// \brief Return const pointer to the previously calculated value
|
||||
// virtual const colvarvalue *p_value() const;
|
||||
colvarvalue const & value() const;
|
||||
|
||||
/// \brief Return the previously calculated total force
|
||||
virtual colvarvalue const & total_force() const;
|
||||
colvarvalue const & total_force() const;
|
||||
|
||||
/// \brief Return the previously calculated divergence of the
|
||||
/// inverse atomic gradients
|
||||
virtual colvarvalue const & Jacobian_derivative() const;
|
||||
colvarvalue const & Jacobian_derivative() const;
|
||||
|
||||
/// \brief Apply the collective variable force, by communicating the
|
||||
/// atomic forces to the simulation program (\b Note: the \link ft
|
||||
@ -247,52 +251,24 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
inline colvarvalue const & colvar::cvc::value() const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
// inline const colvarvalue * colvar::cvc::p_value() const
|
||||
// {
|
||||
// return &x;
|
||||
// }
|
||||
|
||||
inline colvarvalue const & colvar::cvc::total_force() const
|
||||
{
|
||||
return ft;
|
||||
}
|
||||
|
||||
|
||||
inline colvarvalue const & colvar::cvc::Jacobian_derivative() const
|
||||
{
|
||||
return jd;
|
||||
}
|
||||
|
||||
|
||||
inline cvm::real colvar::cvc::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.dist2(x2);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::cvc::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.dist2_grad(x2);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::cvc::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x2.dist2_grad(x1);
|
||||
}
|
||||
|
||||
inline void colvar::cvc::wrap(colvarvalue &x) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Colvar component: distance between the centers of mass of
|
||||
/// two groups (colvarvalue::type_scalar type, range [0:*))
|
||||
@ -312,7 +288,7 @@ protected:
|
||||
public:
|
||||
distance(std::string const &conf);
|
||||
distance();
|
||||
virtual inline ~distance() {}
|
||||
virtual ~distance() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -327,6 +303,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// \brief Colvar component: distance vector between centers of mass
|
||||
// of two groups (\link colvarvalue::type_3vector \endlink type,
|
||||
// range (-*:*)x(-*:*)x(-*:*))
|
||||
@ -336,7 +313,7 @@ class colvar::distance_vec
|
||||
public:
|
||||
distance_vec(std::string const &conf);
|
||||
distance_vec();
|
||||
virtual inline ~distance_vec() {}
|
||||
virtual ~distance_vec() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -352,6 +329,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: distance unit vector (direction) between
|
||||
/// centers of mass of two groups (colvarvalue::type_unit3vector type,
|
||||
/// range [-1:1]x[-1:1]x[-1:1])
|
||||
@ -361,19 +339,14 @@ class colvar::distance_dir
|
||||
public:
|
||||
distance_dir(std::string const &conf);
|
||||
distance_dir();
|
||||
virtual inline ~distance_dir() {}
|
||||
virtual ~distance_dir() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
virtual cvm::real dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: projection of the distance vector along
|
||||
/// an axis(colvarvalue::type_scalar type, range (-*:*))
|
||||
class colvar::distance_z
|
||||
@ -399,7 +372,7 @@ protected:
|
||||
public:
|
||||
distance_z(std::string const &conf);
|
||||
distance_z();
|
||||
virtual inline ~distance_z() {}
|
||||
virtual ~distance_z() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -416,6 +389,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: projection of the distance vector on a
|
||||
/// plane (colvarvalue::type_scalar type, range [0:*))
|
||||
class colvar::distance_xy
|
||||
@ -429,7 +403,7 @@ protected:
|
||||
public:
|
||||
distance_xy(std::string const &conf);
|
||||
distance_xy();
|
||||
virtual inline ~distance_xy() {}
|
||||
virtual ~distance_xy() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -444,6 +418,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: average distance between two groups of atoms, weighted as the sixth power,
|
||||
/// as in NMR refinements(colvarvalue::type_scalar type, range (0:*))
|
||||
class colvar::distance_inv
|
||||
@ -455,7 +430,7 @@ protected:
|
||||
public:
|
||||
distance_inv(std::string const &conf);
|
||||
distance_inv();
|
||||
virtual inline ~distance_inv() {}
|
||||
virtual ~distance_inv() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -468,6 +443,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: N1xN2 vector of pairwise distances
|
||||
/// (colvarvalue::type_vector type, range (0:*) for each component)
|
||||
class colvar::distance_pairs
|
||||
@ -483,16 +459,10 @@ protected:
|
||||
public:
|
||||
distance_pairs(std::string const &conf);
|
||||
distance_pairs();
|
||||
virtual inline ~distance_pairs() {}
|
||||
virtual ~distance_pairs() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
virtual cvm::real dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
@ -509,7 +479,7 @@ public:
|
||||
/// Constructor
|
||||
gyration(std::string const &conf);
|
||||
gyration();
|
||||
virtual inline ~gyration() {}
|
||||
virtual ~gyration() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -524,6 +494,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: moment of inertia of an atom group
|
||||
/// (colvarvalue::type_scalar type, range [0:*))
|
||||
class colvar::inertia
|
||||
@ -533,7 +504,7 @@ public:
|
||||
/// Constructor
|
||||
inertia(std::string const &conf);
|
||||
inertia();
|
||||
virtual inline ~inertia() {}
|
||||
virtual ~inertia() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -546,6 +517,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: moment of inertia of an atom group
|
||||
/// around a user-defined axis (colvarvalue::type_scalar type, range [0:*))
|
||||
class colvar::inertia_z
|
||||
@ -558,7 +530,7 @@ public:
|
||||
/// Constructor
|
||||
inertia_z(std::string const &conf);
|
||||
inertia_z();
|
||||
virtual inline ~inertia_z() {}
|
||||
virtual ~inertia_z() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -571,6 +543,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: projection of 3N coordinates onto an
|
||||
/// eigenvector(colvarvalue::type_scalar type, range (-*:*))
|
||||
class colvar::eigenvector
|
||||
@ -597,7 +570,7 @@ public:
|
||||
|
||||
/// Constructor
|
||||
eigenvector(std::string const &conf);
|
||||
virtual inline ~eigenvector() {}
|
||||
virtual ~eigenvector() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -645,7 +618,7 @@ public:
|
||||
/// \brief Initialize the three groups after three atoms
|
||||
angle(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3);
|
||||
angle();
|
||||
virtual inline ~angle() {}
|
||||
virtual ~angle() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -659,6 +632,8 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: angle between the dipole of a molecule and an axis
|
||||
/// formed by two groups of atoms(colvarvalue::type_scalar type, range [0:PI])
|
||||
class colvar::dipole_angle
|
||||
@ -691,7 +666,7 @@ public:
|
||||
/// \brief Initialize the three groups after three atoms
|
||||
dipole_angle (cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3);
|
||||
dipole_angle();
|
||||
virtual inline ~dipole_angle() {}
|
||||
virtual ~dipole_angle() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force (colvarvalue const &force);
|
||||
@ -703,6 +678,8 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: dihedral between the centers of mass of
|
||||
/// four groups (colvarvalue::type_scalar type, range [-PI:PI])
|
||||
class colvar::dihedral
|
||||
@ -732,7 +709,7 @@ public:
|
||||
/// \brief Initialize the four groups after four atoms
|
||||
dihedral(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3, cvm::atom const &a4);
|
||||
dihedral();
|
||||
virtual inline ~dihedral() {}
|
||||
virtual ~dihedral() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -753,6 +730,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: coordination number between two groups
|
||||
/// (colvarvalue::type_scalar type, range [0:N1*N2])
|
||||
class colvar::coordnum
|
||||
@ -781,7 +759,7 @@ public:
|
||||
/// Constructor
|
||||
coordnum(std::string const &conf);
|
||||
coordnum();
|
||||
virtual inline ~coordnum() {}
|
||||
virtual ~coordnum() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -812,6 +790,8 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: self-coordination number within a group
|
||||
/// (colvarvalue::type_scalar type, range [0:N*(N-1)/2])
|
||||
class colvar::selfcoordnum
|
||||
@ -830,7 +810,7 @@ public:
|
||||
/// Constructor
|
||||
selfcoordnum(std::string const &conf);
|
||||
selfcoordnum();
|
||||
virtual inline ~selfcoordnum() {}
|
||||
virtual ~selfcoordnum() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -852,6 +832,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: coordination number between two groups
|
||||
/// (colvarvalue::type_scalar type, range [0:N1*N2])
|
||||
class colvar::groupcoordnum
|
||||
@ -873,7 +854,7 @@ public:
|
||||
/// Constructor
|
||||
groupcoordnum(std::string const &conf);
|
||||
groupcoordnum();
|
||||
virtual inline ~groupcoordnum() {}
|
||||
virtual ~groupcoordnum() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -896,6 +877,7 @@ public:
|
||||
static cvm::real switching_function(cvm::rvector const &r0_vec,
|
||||
int const &exp_num, int const &exp_den,
|
||||
cvm::atom &A1, cvm::atom &A2);
|
||||
*/
|
||||
|
||||
virtual cvm::real dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
@ -903,10 +885,10 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const;
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: hydrogen bond, defined as the product of
|
||||
/// a colvar::coordnum and 1/2*(1-cos((180-ang)/ang_tol))
|
||||
/// (colvarvalue::type_scalar type, range [0:1])
|
||||
@ -941,6 +923,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: alpha helix content of a contiguous
|
||||
/// segment of 5 or more residues, implemented as a sum of phi/psi
|
||||
/// dihedral angles and hydrogen bonds (colvarvalue::type_scalar type,
|
||||
@ -969,7 +952,7 @@ public:
|
||||
|
||||
// alpha_dihedrals (std::string const &conf);
|
||||
// alpha_dihedrals();
|
||||
// virtual inline ~alpha_dihedrals() {}
|
||||
// virtual ~alpha_dihedrals() {}
|
||||
// virtual void calc_value();
|
||||
// virtual void calc_gradients();
|
||||
// virtual void apply_force (colvarvalue const &force);
|
||||
@ -982,6 +965,7 @@ public:
|
||||
// };
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: alpha helix content of a contiguous
|
||||
/// segment of 5 or more residues, implemented as a sum of Ca-Ca-Ca
|
||||
/// angles and hydrogen bonds (colvarvalue::type_scalar type, range
|
||||
@ -1022,6 +1006,8 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: dihedPC
|
||||
/// Projection of the config onto a dihedral principal component
|
||||
/// See e.g. Altis et al., J. Chem. Phys 126, 244111 (2007)
|
||||
@ -1050,6 +1036,8 @@ public:
|
||||
colvarvalue const &x2) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: orientation in space of an atom group,
|
||||
/// with respect to a set of reference coordinates
|
||||
/// (colvarvalue::type_quaternion type, range
|
||||
@ -1078,7 +1066,7 @@ public:
|
||||
|
||||
orientation(std::string const &conf);
|
||||
orientation();
|
||||
virtual inline ~orientation() {}
|
||||
virtual ~orientation() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1091,6 +1079,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: angle of rotation with respect to a set
|
||||
/// of reference coordinates (colvarvalue::type_scalar type, range
|
||||
/// [0:PI))
|
||||
@ -1101,7 +1090,7 @@ public:
|
||||
|
||||
orientation_angle(std::string const &conf);
|
||||
orientation_angle();
|
||||
virtual inline ~orientation_angle() {}
|
||||
virtual ~orientation_angle() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1114,6 +1103,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: cosine of the angle of rotation with respect to a set
|
||||
/// of reference coordinates (colvarvalue::type_scalar type, range
|
||||
/// [-1:1])
|
||||
@ -1124,7 +1114,7 @@ public:
|
||||
|
||||
orientation_proj(std::string const &conf);
|
||||
orientation_proj();
|
||||
virtual inline ~orientation_proj() {}
|
||||
virtual ~orientation_proj() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1137,6 +1127,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Colvar component: projection of the orientation vector onto
|
||||
/// a predefined axis (colvarvalue::type_scalar type, range [-1:1])
|
||||
class colvar::tilt
|
||||
@ -1150,7 +1141,7 @@ public:
|
||||
|
||||
tilt(std::string const &conf);
|
||||
tilt();
|
||||
virtual inline ~tilt() {}
|
||||
virtual ~tilt() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1177,7 +1168,7 @@ public:
|
||||
|
||||
spin_angle(std::string const &conf);
|
||||
spin_angle();
|
||||
virtual inline ~spin_angle() {}
|
||||
virtual ~spin_angle() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1215,7 +1206,7 @@ public:
|
||||
|
||||
/// Constructor
|
||||
rmsd(std::string const &conf);
|
||||
virtual inline ~rmsd() {}
|
||||
virtual ~rmsd() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void calc_force_invgrads();
|
||||
@ -1230,6 +1221,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// \brief Colvar component: flat vector of Cartesian coordinates
|
||||
// Mostly useful to compute scripted colvar values
|
||||
class colvar::cartesian
|
||||
@ -1243,7 +1235,7 @@ protected:
|
||||
public:
|
||||
cartesian(std::string const &conf);
|
||||
cartesian();
|
||||
virtual inline ~cartesian() {}
|
||||
virtual ~cartesian() {}
|
||||
virtual void calc_value();
|
||||
virtual void calc_gradients();
|
||||
virtual void apply_force(colvarvalue const &force);
|
||||
@ -1260,255 +1252,26 @@ public:
|
||||
|
||||
#define simple_scalar_dist_functions(TYPE) \
|
||||
\
|
||||
inline cvm::real colvar::TYPE::dist2(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
\
|
||||
cvm::real colvar::TYPE::dist2(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
{ \
|
||||
return (x1.real_value - x2.real_value)*(x1.real_value - x2.real_value); \
|
||||
} \
|
||||
\
|
||||
inline colvarvalue colvar::TYPE::dist2_lgrad(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
\
|
||||
colvarvalue colvar::TYPE::dist2_lgrad(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
{ \
|
||||
return 2.0 * (x1.real_value - x2.real_value); \
|
||||
} \
|
||||
\
|
||||
inline colvarvalue colvar::TYPE::dist2_rgrad(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
\
|
||||
colvarvalue colvar::TYPE::dist2_rgrad(colvarvalue const &x1, \
|
||||
colvarvalue const &x2) const \
|
||||
{ \
|
||||
return this->dist2_lgrad(x2, x1); \
|
||||
} \
|
||||
\
|
||||
|
||||
simple_scalar_dist_functions(distance)
|
||||
// NOTE: distance_z has explicit functions, see below
|
||||
simple_scalar_dist_functions(distance_xy)
|
||||
simple_scalar_dist_functions(distance_inv)
|
||||
simple_scalar_dist_functions(angle)
|
||||
simple_scalar_dist_functions(dipole_angle)
|
||||
simple_scalar_dist_functions(coordnum)
|
||||
simple_scalar_dist_functions(selfcoordnum)
|
||||
simple_scalar_dist_functions(h_bond)
|
||||
simple_scalar_dist_functions(gyration)
|
||||
simple_scalar_dist_functions(inertia)
|
||||
simple_scalar_dist_functions(inertia_z)
|
||||
simple_scalar_dist_functions(rmsd)
|
||||
simple_scalar_dist_functions(orientation_angle)
|
||||
simple_scalar_dist_functions(orientation_proj)
|
||||
simple_scalar_dist_functions(tilt)
|
||||
simple_scalar_dist_functions(eigenvector)
|
||||
// simple_scalar_dist_functions (alpha_dihedrals)
|
||||
simple_scalar_dist_functions(alpha_angles)
|
||||
simple_scalar_dist_functions(dihedPC)
|
||||
|
||||
|
||||
// metrics functions for cvc implementations with a periodicity
|
||||
|
||||
inline cvm::real colvar::dihedral::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::dihedral::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::dihedral::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
inline void colvar::dihedral::wrap(colvarvalue &x) const
|
||||
{
|
||||
if ((x.real_value - wrap_center) >= 180.0) {
|
||||
x.real_value -= 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x.real_value - wrap_center) < -180.0) {
|
||||
x.real_value += 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
inline cvm::real colvar::spin_angle::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::spin_angle::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::spin_angle::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
inline void colvar::spin_angle::wrap(colvarvalue &x) const
|
||||
{
|
||||
if ((x.real_value - wrap_center) >= 180.0) {
|
||||
x.real_value -= 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x.real_value - wrap_center) < -180.0) {
|
||||
x.real_value += 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Projected distance
|
||||
// Differences should always be wrapped around 0 (ignoring wrap_center)
|
||||
inline cvm::real colvar::distance_z::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (period != 0.0) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_z::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (period != 0.0) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_z::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (period != 0.0) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
inline void colvar::distance_z::wrap(colvarvalue &x) const
|
||||
{
|
||||
if (! this->b_periodic) {
|
||||
// don't wrap if the period has not been set
|
||||
return;
|
||||
}
|
||||
|
||||
cvm::real shift = std::floor((x.real_value - wrap_center) / period + 0.5);
|
||||
x.real_value -= shift * period;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// distance between three dimensional vectors
|
||||
//
|
||||
// TODO apply PBC to distance_vec
|
||||
// Note: differences should be centered around (0, 0, 0)!
|
||||
|
||||
inline cvm::real colvar::distance_vec::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return cvm::position_dist2(x1.rvector_value, x2.rvector_value);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_vec::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_vec::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value);
|
||||
}
|
||||
|
||||
inline cvm::real colvar::distance_dir::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return (x1.rvector_value - x2.rvector_value).norm2();
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_dir::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return colvarvalue((x1.rvector_value - x2.rvector_value), colvarvalue::type_unit3vector);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_dir::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return colvarvalue((x2.rvector_value - x1.rvector_value), colvarvalue::type_unit3vector);
|
||||
}
|
||||
|
||||
inline cvm::real colvar::distance_pairs::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return (x1.vector1d_value - x2.vector1d_value).norm2();
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_pairs::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return colvarvalue((x1.vector1d_value - x2.vector1d_value), colvarvalue::type_vector);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::distance_pairs::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return colvarvalue((x2.vector1d_value - x1.vector1d_value), colvarvalue::type_vector);
|
||||
}
|
||||
|
||||
|
||||
// distance between quaternions
|
||||
|
||||
inline cvm::real colvar::orientation::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.quaternion_value.dist2(x2);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::orientation::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.quaternion_value.dist2_grad(x2);
|
||||
}
|
||||
|
||||
inline colvarvalue colvar::orientation::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x2.quaternion_value.dist2_grad(x1);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvar.h"
|
||||
#include "colvarcomp.h"
|
||||
@ -7,6 +14,7 @@
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
colvar::angle::angle(std::string const &conf)
|
||||
: cvc(conf)
|
||||
{
|
||||
@ -85,6 +93,7 @@ void colvar::angle::calc_gradients()
|
||||
group3->set_weighted_gradient(dxdr3);
|
||||
}
|
||||
|
||||
|
||||
void colvar::angle::calc_force_invgrads()
|
||||
{
|
||||
// This uses a force measurement on groups 1 and 3 only
|
||||
@ -107,6 +116,7 @@ void colvar::angle::calc_force_invgrads()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void colvar::angle::calc_Jacobian_derivative()
|
||||
{
|
||||
// det(J) = (2 pi) r^2 * sin(theta)
|
||||
@ -129,6 +139,8 @@ void colvar::angle::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(angle)
|
||||
|
||||
|
||||
|
||||
colvar::dipole_angle::dipole_angle(std::string const &conf)
|
||||
@ -235,6 +247,8 @@ void colvar::dipole_angle::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(dipole_angle)
|
||||
|
||||
|
||||
|
||||
colvar::dihedral::dihedral(std::string const &conf)
|
||||
@ -453,3 +467,46 @@ void colvar::dihedral::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
// metrics functions for cvc implementations with a periodicity
|
||||
|
||||
cvm::real colvar::dihedral::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::dihedral::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::dihedral::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
|
||||
void colvar::dihedral::wrap(colvarvalue &x) const
|
||||
{
|
||||
if ((x.real_value - wrap_center) >= 180.0) {
|
||||
x.real_value -= 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x.real_value - wrap_center) < -180.0) {
|
||||
x.real_value += 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "colvarmodule.h"
|
||||
@ -13,10 +20,10 @@
|
||||
|
||||
template<bool calculate_gradients>
|
||||
cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
|
||||
int const &en,
|
||||
int const &ed,
|
||||
cvm::atom &A1,
|
||||
cvm::atom &A2)
|
||||
int const &en,
|
||||
int const &ed,
|
||||
cvm::atom &A1,
|
||||
cvm::atom &A2)
|
||||
{
|
||||
cvm::rvector const diff = cvm::position_distance(A1.pos, A2.pos);
|
||||
cvm::real const l2 = diff.norm2()/(r0*r0);
|
||||
@ -42,10 +49,10 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
|
||||
|
||||
template<bool calculate_gradients>
|
||||
cvm::real colvar::coordnum::switching_function(cvm::rvector const &r0_vec,
|
||||
int const &en,
|
||||
int const &ed,
|
||||
cvm::atom &A1,
|
||||
cvm::atom &A2)
|
||||
int const &en,
|
||||
int const &ed,
|
||||
cvm::atom &A1,
|
||||
cvm::atom &A2)
|
||||
{
|
||||
cvm::rvector const diff = cvm::position_distance(A1.pos, A2.pos);
|
||||
cvm::rvector const scal_diff(diff.x/r0_vec.x, diff.y/r0_vec.y, diff.z/r0_vec.z);
|
||||
@ -190,6 +197,7 @@ void colvar::coordnum::calc_gradients()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::coordnum::apply_force(colvarvalue const &force)
|
||||
{
|
||||
if (!group1->noforce)
|
||||
@ -200,6 +208,9 @@ void colvar::coordnum::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(coordnum)
|
||||
|
||||
|
||||
|
||||
// h_bond member functions
|
||||
|
||||
@ -252,6 +263,7 @@ colvar::h_bond::h_bond(cvm::atom const &acceptor,
|
||||
atom_groups[0]->add_atom(donor);
|
||||
}
|
||||
|
||||
|
||||
colvar::h_bond::h_bond()
|
||||
: cvc()
|
||||
{
|
||||
@ -284,6 +296,8 @@ void colvar::h_bond::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(h_bond)
|
||||
|
||||
|
||||
|
||||
colvar::selfcoordnum::selfcoordnum(std::string const &conf)
|
||||
@ -339,6 +353,9 @@ void colvar::selfcoordnum::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(selfcoordnum)
|
||||
|
||||
|
||||
// groupcoordnum member functions
|
||||
colvar::groupcoordnum::groupcoordnum(std::string const &conf)
|
||||
: distance(conf), b_anisotropic(false)
|
||||
@ -448,7 +465,6 @@ cvm::real colvar::groupcoordnum::switching_function(cvm::rvector const &r0_vec,
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void colvar::groupcoordnum::calc_value()
|
||||
{
|
||||
|
||||
@ -460,7 +476,6 @@ void colvar::groupcoordnum::calc_value()
|
||||
|
||||
x.real_value = coordnum::switching_function<false>(r0, en, ed,
|
||||
group1_com_atom, group2_com_atom);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -486,3 +501,6 @@ void colvar::groupcoordnum::apply_force(colvarvalue const &force)
|
||||
if (!group2->noforce)
|
||||
group2->apply_colvar_force(force.real_value);
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(groupcoordnum)
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "colvarmodule.h"
|
||||
@ -91,6 +98,9 @@ void colvar::distance::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(distance)
|
||||
|
||||
|
||||
|
||||
colvar::distance_vec::distance_vec(std::string const &conf)
|
||||
: distance(conf)
|
||||
@ -138,6 +148,27 @@ void colvar::distance_vec::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvar::distance_vec::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return cvm::position_dist2(x1.rvector_value, x2.rvector_value);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::distance_vec::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::distance_vec::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
colvar::distance_z::distance_z(std::string const &conf)
|
||||
: cvc(conf)
|
||||
@ -191,6 +222,7 @@ colvar::distance_z::distance_z(std::string const &conf)
|
||||
|
||||
}
|
||||
|
||||
|
||||
colvar::distance_z::distance_z()
|
||||
{
|
||||
function_type = "distance_z";
|
||||
@ -200,6 +232,7 @@ colvar::distance_z::distance_z()
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::calc_value()
|
||||
{
|
||||
if (fixed_axis) {
|
||||
@ -227,6 +260,7 @@ void colvar::distance_z::calc_value()
|
||||
this->wrap(x);
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::calc_gradients()
|
||||
{
|
||||
main->set_weighted_gradient( axis );
|
||||
@ -248,6 +282,7 @@ void colvar::distance_z::calc_gradients()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::calc_force_invgrads()
|
||||
{
|
||||
main->read_total_forces();
|
||||
@ -260,11 +295,13 @@ void colvar::distance_z::calc_force_invgrads()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::calc_Jacobian_derivative()
|
||||
{
|
||||
jd.real_value = 0.0;
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::apply_force(colvarvalue const &force)
|
||||
{
|
||||
if (!ref1->noforce)
|
||||
@ -278,6 +315,56 @@ void colvar::distance_z::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
// Differences should always be wrapped around 0 (ignoring wrap_center)
|
||||
cvm::real colvar::distance_z::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (b_periodic) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::distance_z::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (b_periodic) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::distance_z::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
if (b_periodic) {
|
||||
cvm::real shift = std::floor(diff/period + 0.5);
|
||||
diff -= shift * period;
|
||||
}
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_z::wrap(colvarvalue &x) const
|
||||
{
|
||||
if (!b_periodic) {
|
||||
// don't wrap if the period has not been set
|
||||
return;
|
||||
}
|
||||
|
||||
cvm::real shift = std::floor((x.real_value - wrap_center) / period + 0.5);
|
||||
x.real_value -= shift * period;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
colvar::distance_xy::distance_xy(std::string const &conf)
|
||||
: distance_z(conf)
|
||||
@ -289,6 +376,7 @@ colvar::distance_xy::distance_xy(std::string const &conf)
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
colvar::distance_xy::distance_xy()
|
||||
: distance_z()
|
||||
{
|
||||
@ -299,6 +387,7 @@ colvar::distance_xy::distance_xy()
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_xy::calc_value()
|
||||
{
|
||||
if (b_no_PBC) {
|
||||
@ -321,6 +410,7 @@ void colvar::distance_xy::calc_value()
|
||||
x.real_value = dist_v_ortho.norm();
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_xy::calc_gradients()
|
||||
{
|
||||
// Intermediate quantity (r_P3 / r_12 where P is the projection
|
||||
@ -348,6 +438,7 @@ void colvar::distance_xy::calc_gradients()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_xy::calc_force_invgrads()
|
||||
{
|
||||
main->read_total_forces();
|
||||
@ -360,11 +451,13 @@ void colvar::distance_xy::calc_force_invgrads()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_xy::calc_Jacobian_derivative()
|
||||
{
|
||||
jd.real_value = x.real_value ? (1.0 / x.real_value) : 0.0;
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_xy::apply_force(colvarvalue const &force)
|
||||
{
|
||||
if (!ref1->noforce)
|
||||
@ -378,6 +471,9 @@ void colvar::distance_xy::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(distance_xy)
|
||||
|
||||
|
||||
|
||||
colvar::distance_dir::distance_dir(std::string const &conf)
|
||||
: distance(conf)
|
||||
@ -403,7 +499,7 @@ void colvar::distance_dir::calc_value()
|
||||
dist_v = group2->center_of_mass() - group1->center_of_mass();
|
||||
} else {
|
||||
dist_v = cvm::position_distance(group1->center_of_mass(),
|
||||
group2->center_of_mass());
|
||||
group2->center_of_mass());
|
||||
}
|
||||
x.rvector_value = dist_v.unit();
|
||||
}
|
||||
@ -460,6 +556,7 @@ colvar::distance_inv::distance_inv(std::string const &conf)
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
colvar::distance_inv::distance_inv()
|
||||
{
|
||||
function_type = "distance_inv";
|
||||
@ -467,6 +564,7 @@ colvar::distance_inv::distance_inv()
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_inv::calc_value()
|
||||
{
|
||||
x.real_value = 0.0;
|
||||
@ -504,6 +602,7 @@ void colvar::distance_inv::calc_value()
|
||||
x.real_value = std::pow(x.real_value, -1.0/(cvm::real(exponent)));
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_inv::calc_gradients()
|
||||
{
|
||||
cvm::real const dxdsum = (-1.0/(cvm::real(exponent))) * std::pow(x.real_value, exponent+1) / cvm::real(group1->size() * group2->size());
|
||||
@ -515,6 +614,7 @@ void colvar::distance_inv::calc_gradients()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_inv::apply_force(colvarvalue const &force)
|
||||
{
|
||||
if (!group1->noforce)
|
||||
@ -525,6 +625,9 @@ void colvar::distance_inv::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(distance_inv)
|
||||
|
||||
|
||||
|
||||
colvar::distance_pairs::distance_pairs(std::string const &conf)
|
||||
: cvc(conf)
|
||||
@ -579,11 +682,13 @@ void colvar::distance_pairs::calc_value()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_pairs::calc_gradients()
|
||||
{
|
||||
// will be calculated on the fly in apply_force()
|
||||
}
|
||||
|
||||
|
||||
void colvar::distance_pairs::apply_force(colvarvalue const &force)
|
||||
{
|
||||
if (b_no_PBC) {
|
||||
@ -608,6 +713,7 @@ void colvar::distance_pairs::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
|
||||
colvar::gyration::gyration(std::string const &conf)
|
||||
: cvc(conf)
|
||||
{
|
||||
@ -621,6 +727,7 @@ colvar::gyration::gyration(std::string const &conf)
|
||||
} else {
|
||||
atoms->b_center = true;
|
||||
atoms->ref_pos.assign(1, cvm::atom_pos(0.0, 0.0, 0.0));
|
||||
atoms->fit_gradients.assign(atoms->size(), cvm::rvector(0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
x.type(colvarvalue::type_scalar);
|
||||
@ -681,6 +788,9 @@ void colvar::gyration::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(gyration)
|
||||
|
||||
|
||||
|
||||
colvar::inertia::inertia(std::string const &conf)
|
||||
: gyration(conf)
|
||||
@ -721,6 +831,10 @@ void colvar::inertia::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(inertia_z)
|
||||
|
||||
|
||||
|
||||
colvar::inertia_z::inertia_z(std::string const &conf)
|
||||
: inertia(conf)
|
||||
{
|
||||
@ -771,6 +885,10 @@ void colvar::inertia_z::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(inertia)
|
||||
|
||||
|
||||
|
||||
|
||||
colvar::rmsd::rmsd(std::string const &conf)
|
||||
: cvc(conf)
|
||||
@ -970,6 +1088,8 @@ void colvar::rmsd::calc_Jacobian_derivative()
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(rmsd)
|
||||
|
||||
|
||||
|
||||
colvar::eigenvector::eigenvector(std::string const &conf)
|
||||
@ -1254,6 +1374,10 @@ void colvar::eigenvector::calc_Jacobian_derivative()
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(eigenvector)
|
||||
|
||||
|
||||
|
||||
colvar::cartesian::cartesian(std::string const &conf)
|
||||
: cvc(conf)
|
||||
{
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "colvarmodule.h"
|
||||
@ -119,6 +126,7 @@ colvar::alpha_angles::alpha_angles()
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
colvar::alpha_angles::~alpha_angles()
|
||||
{
|
||||
while (theta.size() != 0) {
|
||||
@ -131,6 +139,7 @@ colvar::alpha_angles::~alpha_angles()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void colvar::alpha_angles::calc_value()
|
||||
{
|
||||
x.real_value = 0.0;
|
||||
@ -222,6 +231,10 @@ void colvar::alpha_angles::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(alpha_angles)
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// dihedral principal component
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -337,14 +350,22 @@ colvar::dihedPC::dihedPC(std::string const &conf)
|
||||
for (size_t i = 0; i < residues.size()-1; i++) {
|
||||
// Psi
|
||||
theta.push_back(new colvar::dihedral(cvm::atom(r[i ], "N", sid),
|
||||
cvm::atom(r[i ], "CA", sid),
|
||||
cvm::atom(r[i ], "C", sid),
|
||||
cvm::atom(r[i+1], "N", sid)));
|
||||
cvm::atom(r[i ], "CA", sid),
|
||||
cvm::atom(r[i ], "C", sid),
|
||||
cvm::atom(r[i+1], "N", sid)));
|
||||
atom_groups.push_back(theta.back()->atom_groups[0]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[1]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[2]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[3]);
|
||||
// Phi (next res)
|
||||
theta.push_back(new colvar::dihedral(cvm::atom(r[i ], "C", sid),
|
||||
cvm::atom(r[i+1], "N", sid),
|
||||
cvm::atom(r[i+1], "CA", sid),
|
||||
cvm::atom(r[i+1], "C", sid)));
|
||||
cvm::atom(r[i+1], "N", sid),
|
||||
cvm::atom(r[i+1], "CA", sid),
|
||||
cvm::atom(r[i+1], "C", sid)));
|
||||
atom_groups.push_back(theta.back()->atom_groups[0]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[1]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[2]);
|
||||
atom_groups.push_back(theta.back()->atom_groups[3]);
|
||||
}
|
||||
|
||||
if (cvm::debug())
|
||||
@ -400,3 +421,6 @@ void colvar::dihedPC::apply_force(colvarvalue const &force)
|
||||
coeffs[2*i+1] * dsindt) * force);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(dihedPC)
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "colvarmodule.h"
|
||||
@ -123,6 +130,27 @@ void colvar::orientation::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvar::orientation::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.quaternion_value.dist2(x2);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::orientation::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x1.quaternion_value.dist2_grad(x2);
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::orientation::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
return x2.quaternion_value.dist2_grad(x1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
colvar::orientation_angle::orientation_angle(std::string const &conf)
|
||||
: orientation(conf)
|
||||
@ -176,6 +204,9 @@ void colvar::orientation_angle::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(orientation_angle)
|
||||
|
||||
|
||||
|
||||
colvar::orientation_proj::orientation_proj(std::string const &conf)
|
||||
: orientation(conf)
|
||||
@ -220,6 +251,9 @@ void colvar::orientation_proj::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(orientation_proj)
|
||||
|
||||
|
||||
|
||||
colvar::tilt::tilt(std::string const &conf)
|
||||
: orientation(conf)
|
||||
@ -278,6 +312,9 @@ void colvar::tilt::apply_force(colvarvalue const &force)
|
||||
}
|
||||
|
||||
|
||||
simple_scalar_dist_functions(tilt)
|
||||
|
||||
|
||||
|
||||
colvar::spin_angle::spin_angle(std::string const &conf)
|
||||
: orientation(conf)
|
||||
@ -339,3 +376,46 @@ void colvar::spin_angle::apply_force(colvarvalue const &force)
|
||||
atoms->apply_colvar_force(fw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvar::spin_angle::dist2(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return diff * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::spin_angle::dist2_lgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return 2.0 * diff;
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvar::spin_angle::dist2_rgrad(colvarvalue const &x1,
|
||||
colvarvalue const &x2) const
|
||||
{
|
||||
cvm::real diff = x1.real_value - x2.real_value;
|
||||
diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
|
||||
return (-2.0) * diff;
|
||||
}
|
||||
|
||||
|
||||
void colvar::spin_angle::wrap(colvarvalue &x) const
|
||||
{
|
||||
if ((x.real_value - wrap_center) >= 180.0) {
|
||||
x.real_value -= 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x.real_value - wrap_center) < -180.0) {
|
||||
x.real_value += 360.0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
|
||||
#include "colvardeps.h"
|
||||
|
||||
|
||||
@ -219,6 +229,9 @@ void colvardeps::init_cvb_requires() {
|
||||
|
||||
f_description(f_cvb_history_dependent, "history-dependent");
|
||||
|
||||
f_description(f_cvb_scalar_variables, "require scalar variables");
|
||||
f_req_children(f_cvb_scalar_variables, f_cv_scalar);
|
||||
|
||||
// Initialize feature_states for each instance
|
||||
feature_states.reserve(f_cvb_ntot);
|
||||
for (i = 0; i < f_cvb_ntot; i++) {
|
||||
@ -229,6 +242,9 @@ void colvardeps::init_cvb_requires() {
|
||||
|
||||
// some biases are not history-dependent
|
||||
feature_states[f_cvb_history_dependent]->available = false;
|
||||
|
||||
// by default, biases should work with vector variables, too
|
||||
feature_states[f_cvb_scalar_variables]->available = false;
|
||||
}
|
||||
|
||||
|
||||
@ -321,6 +337,7 @@ void colvardeps::init_cv_requires() {
|
||||
// The features below are set programmatically
|
||||
f_description(f_cv_scripted, "scripted");
|
||||
f_description(f_cv_periodic, "periodic");
|
||||
f_req_self(f_cv_periodic, f_cv_homogeneous);
|
||||
f_description(f_cv_scalar, "scalar");
|
||||
f_description(f_cv_linear, "linear");
|
||||
f_description(f_cv_homogeneous, "homogeneous");
|
||||
@ -407,6 +424,11 @@ void colvardeps::init_cvc_requires() {
|
||||
// Each cvc specifies what other features are available
|
||||
feature_states[f_cvc_active]->available = true;
|
||||
feature_states[f_cvc_gradient]->available = true;
|
||||
|
||||
// Features that are implemented by default if their requirements are
|
||||
feature_states[f_cvc_one_site_total_force]->available = true;
|
||||
|
||||
// Features That are implemented only for certain simulation engine configurations
|
||||
feature_states[f_cvc_scalable_com]->available = (cvm::proxy->scalable_group_coms() == COLVARS_OK);
|
||||
feature_states[f_cvc_scalable]->available = feature_states[f_cvc_scalable_com]->available;
|
||||
}
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARDEPS_H
|
||||
#define COLVARDEPS_H
|
||||
|
||||
@ -157,6 +164,7 @@ public:
|
||||
f_cvb_apply_force, // will apply forces
|
||||
f_cvb_get_total_force, // requires total forces
|
||||
f_cvb_history_dependent, // depends on simulation history
|
||||
f_cvb_scalar_variables, // requires scalar colvars
|
||||
f_cvb_ntot
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarvalue.h"
|
||||
#include "colvarparse.h"
|
||||
@ -73,6 +80,21 @@ cvm::real colvar_grid_scalar::minimum_value() const
|
||||
return min;
|
||||
}
|
||||
|
||||
cvm::real colvar_grid_scalar::minimum_pos_value() const
|
||||
{
|
||||
cvm::real minpos = data[0];
|
||||
size_t i;
|
||||
for (i = 0; i < nt; i++) {
|
||||
if(data[i] > 0) {
|
||||
minpos = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nt; i++) {
|
||||
if (data[i] > 0 && data[i] < minpos) minpos = data[i];
|
||||
}
|
||||
return minpos;
|
||||
}
|
||||
|
||||
cvm::real colvar_grid_scalar::integral() const
|
||||
{
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARGRID_H
|
||||
#define COLVARGRID_H
|
||||
|
||||
@ -378,6 +385,13 @@ public:
|
||||
return value_to_bin_scalar(actual_value[i] ? cv[i]->actual_value() : cv[i]->value(), i);
|
||||
}
|
||||
|
||||
/// \brief Report the bin corresponding to the current value of variable i
|
||||
/// and assign first or last bin if out of boundaries
|
||||
inline int current_bin_scalar_bound(int const i) const
|
||||
{
|
||||
return value_to_bin_scalar_bound(actual_value[i] ? cv[i]->actual_value() : cv[i]->value(), i);
|
||||
}
|
||||
|
||||
/// \brief Report the bin corresponding to the current value of item iv in variable i
|
||||
inline int current_bin_scalar(int const i, int const iv) const
|
||||
{
|
||||
@ -393,6 +407,16 @@ public:
|
||||
return (int) std::floor( (value.real_value - lower_boundaries[i].real_value) / widths[i] );
|
||||
}
|
||||
|
||||
/// \brief Use the lower boundary and the width to report which bin
|
||||
/// the provided value is in and assign first or last bin if out of boundaries
|
||||
inline int value_to_bin_scalar_bound(colvarvalue const &value, const int i) const
|
||||
{
|
||||
int bin_index = std::floor( (value.real_value - lower_boundaries[i].real_value) / widths[i] );
|
||||
if (bin_index < 0) bin_index=0;
|
||||
if (bin_index >=int(nx[i])) bin_index=int(nx[i])-1;
|
||||
return (int) bin_index;
|
||||
}
|
||||
|
||||
/// \brief Same as the standard version, but uses another grid definition
|
||||
inline int value_to_bin_scalar(colvarvalue const &value,
|
||||
colvarvalue const &new_offset,
|
||||
@ -514,6 +538,13 @@ public:
|
||||
data[i] *= a;
|
||||
}
|
||||
|
||||
/// \brief Assign all zero elements a scalar constant (fast loop)
|
||||
inline void remove_zeros(cvm::real const &a)
|
||||
{
|
||||
for (size_t i = 0; i < nt; i++)
|
||||
if(data[i]==0) data[i] = a;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Get the bin indices corresponding to the provided values of
|
||||
/// the colvars
|
||||
@ -537,6 +568,17 @@ public:
|
||||
return index;
|
||||
}
|
||||
|
||||
/// \brief Get the bin indices corresponding to the provided values of
|
||||
/// the colvars and assign first or last bin if out of boundaries
|
||||
inline std::vector<int> const get_colvars_index_bound() const
|
||||
{
|
||||
std::vector<int> index = new_index();
|
||||
for (size_t i = 0; i < nd; i++) {
|
||||
index[i] = current_bin_scalar_bound(i);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
/// \brief Get the minimal distance (in number of bins) from the
|
||||
/// boundaries; a negative number is returned if the given point is
|
||||
/// off-grid
|
||||
@ -1071,7 +1113,7 @@ public:
|
||||
{
|
||||
// write the header
|
||||
os << "object 1 class gridpositions counts";
|
||||
int icv;
|
||||
size_t icv;
|
||||
for (icv = 0; icv < number_of_colvars(); icv++) {
|
||||
os << " " << number_of_points(icv);
|
||||
}
|
||||
@ -1166,45 +1208,49 @@ public:
|
||||
|
||||
/// \brief Return the log-gradient from finite differences
|
||||
/// on the *same* grid for dimension n
|
||||
inline const cvm::real log_gradient_finite_diff( const std::vector<int> &ix0,
|
||||
int n = 0)
|
||||
inline cvm::real log_gradient_finite_diff(const std::vector<int> &ix0,
|
||||
int n = 0)
|
||||
{
|
||||
cvm::real A0, A1;
|
||||
std::vector<int> ix;
|
||||
|
||||
// factor for mesh width, 2.0 for central finite difference
|
||||
// but only 1.0 on edges for non-PBC coordinates
|
||||
cvm::real factor;
|
||||
int A0, A1, A2;
|
||||
std::vector<int> ix = ix0;
|
||||
|
||||
if (periodic[n]) {
|
||||
factor = 2.;
|
||||
ix = ix0;
|
||||
ix[n]--; wrap(ix);
|
||||
A0 = data[address(ix)];
|
||||
ix = ix0;
|
||||
ix[n]++; wrap(ix);
|
||||
A1 = data[address(ix)];
|
||||
} else {
|
||||
factor = 0.;
|
||||
ix = ix0;
|
||||
if (ix[n] > 0) { // not left edge
|
||||
ix[n]--;
|
||||
factor += 1.;
|
||||
if (A0 * A1 == 0) {
|
||||
return 0.; // can't handle empty bins
|
||||
} else {
|
||||
return (std::log((cvm::real)A1) - std::log((cvm::real)A0))
|
||||
/ (widths[n] * 2.);
|
||||
}
|
||||
} else if (ix[n] > 0 && ix[n] < nx[n]-1) { // not an edge
|
||||
ix[n]--;
|
||||
A0 = data[address(ix)];
|
||||
ix = ix0;
|
||||
if (ix[n]+1 < nx[n]) { // not right edge
|
||||
ix[n]++;
|
||||
factor += 1.;
|
||||
}
|
||||
ix[n]++;
|
||||
A1 = data[address(ix)];
|
||||
}
|
||||
if (A0 == 0 || A1 == 0) {
|
||||
// can't handle empty bins
|
||||
return 0.;
|
||||
if (A0 * A1 == 0) {
|
||||
return 0.; // can't handle empty bins
|
||||
} else {
|
||||
return (std::log((cvm::real)A1) - std::log((cvm::real)A0))
|
||||
/ (widths[n] * 2.);
|
||||
}
|
||||
} else {
|
||||
return (std::log((cvm::real)A1) - std::log((cvm::real)A0))
|
||||
/ (widths[n] * factor);
|
||||
// edge: use 2nd order derivative
|
||||
int increment = (ix[n] == 0 ? 1 : -1);
|
||||
// move right from left edge, or the other way around
|
||||
A0 = data[address(ix)];
|
||||
ix[n] += increment; A1 = data[address(ix)];
|
||||
ix[n] += increment; A2 = data[address(ix)];
|
||||
if (A0 * A1 * A2 == 0) {
|
||||
return 0.; // can't handle empty bins
|
||||
} else {
|
||||
return (-1.5 * std::log((cvm::real)A0) + 2. * std::log((cvm::real)A1)
|
||||
- 0.5 * std::log((cvm::real)A2)) * increment / widths[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1322,6 +1368,9 @@ public:
|
||||
/// \brief Return the lowest value
|
||||
cvm::real minimum_value() const;
|
||||
|
||||
/// \brief Return the lowest positive value
|
||||
cvm::real minimum_pos_value() const;
|
||||
|
||||
/// \brief Calculates the integral of the map (uses widths if they are defined)
|
||||
cvm::real integral() const;
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
|
||||
@ -296,6 +303,9 @@ int colvarmodule::parse_biases(std::string const &conf)
|
||||
/// initialize harmonic restraints
|
||||
parse_biases_type<colvarbias_restraint_harmonic>(conf, "harmonic", n_rest_biases);
|
||||
|
||||
/// initialize harmonic walls restraints
|
||||
parse_biases_type<colvarbias_restraint_harmonic_walls>(conf, "harmonicWalls", n_rest_biases);
|
||||
|
||||
/// initialize histograms
|
||||
parse_biases_type<colvarbias_histogram>(conf, "histogram", n_histo_biases);
|
||||
|
||||
@ -562,7 +572,6 @@ int colvarmodule::calc_colvars()
|
||||
colvars_smp_items.reserve(colvars.size());
|
||||
|
||||
// set up a vector containing all components
|
||||
size_t num_colvar_items = 0;
|
||||
cvm::increase_depth();
|
||||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
|
||||
@ -576,8 +585,6 @@ int colvarmodule::calc_colvars()
|
||||
colvars_smp.push_back(*cvi);
|
||||
colvars_smp_items.push_back(icvc);
|
||||
}
|
||||
|
||||
num_colvar_items += num_items;
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
|
||||
@ -641,7 +648,7 @@ int colvarmodule::calc_biases()
|
||||
for (bi = biases.begin(); bi != biases.end(); bi++) {
|
||||
error_code |= (*bi)->update();
|
||||
if (cvm::get_error()) {
|
||||
return COLVARS_ERROR;
|
||||
return error_code;
|
||||
}
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
@ -1007,7 +1014,7 @@ std::istream & colvarmodule::read_restart(std::istream &is)
|
||||
for (std::vector<colvarbias *>::iterator bi = biases.begin();
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
if (!((*bi)->read_restart(is))) {
|
||||
if (!((*bi)->read_state(is))) {
|
||||
cvm::error("Error: in reading restart configuration for bias \""+
|
||||
(*bi)->name+"\".\n",
|
||||
INPUT_ERROR);
|
||||
@ -1070,15 +1077,15 @@ continue the previous simulation.\n\n");
|
||||
cvm::log(cvm::line_marker);
|
||||
|
||||
// update this ahead of time in this special case
|
||||
output_prefix = proxy->output_prefix();
|
||||
output_prefix = proxy->input_prefix();
|
||||
cvm::log("All output files will now be saved with the prefix \""+output_prefix+".tmp.*\".\n");
|
||||
output_prefix = output_prefix+".tmp";
|
||||
write_output_files();
|
||||
cvm::log(cvm::line_marker);
|
||||
cvm::log("Please review the important warning above. After that, you may rename:\n\
|
||||
\""+output_prefix+".tmp.colvars.state\"\n\
|
||||
to:\n\
|
||||
\""+output_prefix+".colvars.state\"\n");
|
||||
\""+ proxy->input_prefix()+".colvars.state\"\n");
|
||||
output_prefix = output_prefix+".tmp";
|
||||
write_output_files();
|
||||
cvm::error("Exiting with error until issue is addressed.\n", FATAL_ERROR);
|
||||
}
|
||||
|
||||
@ -1120,6 +1127,7 @@ int colvarmodule::write_output_files()
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
(*bi)->write_output_files();
|
||||
(*bi)->write_state_to_replicas();
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
|
||||
@ -1212,20 +1220,30 @@ std::ostream & colvarmodule::write_restart(std::ostream &os)
|
||||
<< " version " << std::string(COLVARS_VERSION) << "\n"
|
||||
<< "}\n\n";
|
||||
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
cvm::increase_depth();
|
||||
for (std::vector<colvar *>::iterator cvi = colvars.begin();
|
||||
cvi != colvars.end();
|
||||
cvi++) {
|
||||
(*cvi)->write_restart(os);
|
||||
error_code |= (*cvi)->write_output_files();
|
||||
}
|
||||
|
||||
for (std::vector<colvarbias *>::iterator bi = biases.begin();
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
(*bi)->write_restart(os);
|
||||
(*bi)->write_state(os);
|
||||
error_code |= (*bi)->write_state_to_replicas();
|
||||
error_code |= (*bi)->write_output_files();
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
|
||||
if (error_code != COLVARS_OK) {
|
||||
// TODO make this function return an int instead
|
||||
os.setstate(std::ios::failbit);
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,17 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARMODULE_H
|
||||
#define COLVARMODULE_H
|
||||
|
||||
#ifndef COLVARS_VERSION
|
||||
#define COLVARS_VERSION "2016-10-21"
|
||||
#define COLVARS_VERSION "2016-12-27"
|
||||
#endif
|
||||
|
||||
#ifndef COLVARS_DEBUG
|
||||
@ -198,7 +205,7 @@ public:
|
||||
}
|
||||
|
||||
/// \brief How many objects are configured yet?
|
||||
inline size_t const size() const
|
||||
inline size_t size() const
|
||||
{
|
||||
return colvars.size() + biases.size();
|
||||
}
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARPARSE_H
|
||||
#define COLVARPARSE_H
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARPROXY_H
|
||||
#define COLVARPROXY_H
|
||||
|
||||
@ -24,11 +31,18 @@ public:
|
||||
/// Pointer to the main object
|
||||
colvarmodule *colvars;
|
||||
|
||||
/// Default constructor
|
||||
inline colvarproxy() : script(NULL), b_smp_active(true) {}
|
||||
/// Constructor
|
||||
colvarproxy()
|
||||
{
|
||||
colvars = NULL;
|
||||
b_simulation_running = true;
|
||||
b_smp_active = true;
|
||||
script = NULL;
|
||||
}
|
||||
|
||||
/// Default destructor
|
||||
virtual ~colvarproxy() {}
|
||||
/// Destructor
|
||||
virtual ~colvarproxy()
|
||||
{}
|
||||
|
||||
/// (Re)initialize required member data after construction
|
||||
virtual int setup()
|
||||
@ -104,6 +118,19 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// Whether a simulation is running (and try to prevent irrecovarable errors)
|
||||
bool b_simulation_running;
|
||||
|
||||
public:
|
||||
|
||||
/// Whether a simulation is running (and try to prevent irrecovarable errors)
|
||||
virtual bool simulation_running() const
|
||||
{
|
||||
return b_simulation_running;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// \brief Currently opened output files: by default, these are ofstream objects.
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARSCRIPT_H
|
||||
#define COLVARSCRIPT_H
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARTYPES_H
|
||||
#define COLVARTYPES_H
|
||||
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
@ -70,45 +77,30 @@ void colvarvalue::set_elem(int const icv, colvarvalue const &x)
|
||||
}
|
||||
|
||||
|
||||
colvarvalue colvarvalue::inverse() const
|
||||
void colvarvalue::set_random()
|
||||
{
|
||||
switch (value_type) {
|
||||
size_t ic;
|
||||
switch (this->type()) {
|
||||
case colvarvalue::type_scalar:
|
||||
return colvarvalue(1.0/real_value);
|
||||
this->real_value = cvm::rand_gaussian();
|
||||
break;
|
||||
case colvarvalue::type_3vector:
|
||||
case colvarvalue::type_unit3vector:
|
||||
case colvarvalue::type_unit3vectorderiv:
|
||||
return colvarvalue(cvm::rvector(1.0/rvector_value.x,
|
||||
1.0/rvector_value.y,
|
||||
1.0/rvector_value.z));
|
||||
this->rvector_value.x = cvm::rand_gaussian();
|
||||
this->rvector_value.y = cvm::rand_gaussian();
|
||||
this->rvector_value.z = cvm::rand_gaussian();
|
||||
break;
|
||||
case colvarvalue::type_quaternion:
|
||||
case colvarvalue::type_quaternionderiv:
|
||||
return colvarvalue(cvm::quaternion(1.0/quaternion_value.q0,
|
||||
1.0/quaternion_value.q1,
|
||||
1.0/quaternion_value.q2,
|
||||
1.0/quaternion_value.q3));
|
||||
this->quaternion_value.q0 = cvm::rand_gaussian();
|
||||
this->quaternion_value.q1 = cvm::rand_gaussian();
|
||||
this->quaternion_value.q2 = cvm::rand_gaussian();
|
||||
this->quaternion_value.q3 = cvm::rand_gaussian();
|
||||
break;
|
||||
case colvarvalue::type_vector:
|
||||
{
|
||||
cvm::vector1d<cvm::real> result(vector1d_value);
|
||||
if (elem_types.size() > 0) {
|
||||
// if we have information about non-scalar types, use it
|
||||
size_t i;
|
||||
for (i = 0; i < elem_types.size(); i++) {
|
||||
result.sliceassign(elem_indices[i], elem_indices[i]+elem_sizes[i],
|
||||
cvm::vector1d<cvm::real>((this->get_elem(i)).inverse()));
|
||||
}
|
||||
} else {
|
||||
size_t i;
|
||||
for (i = 0; i < result.size(); i++) {
|
||||
if (result[i] != 0.0) {
|
||||
result = 1.0/result[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return colvarvalue(result, type_vector);
|
||||
for (ic = 0; ic < this->vector1d_value.size(); ic++) {
|
||||
this->vector1d_value[ic] = cvm::rand_gaussian();
|
||||
}
|
||||
break;
|
||||
case colvarvalue::type_notset:
|
||||
@ -116,7 +108,6 @@ colvarvalue colvarvalue::inverse() const
|
||||
undef_op();
|
||||
break;
|
||||
}
|
||||
return colvarvalue();
|
||||
}
|
||||
|
||||
|
||||
@ -288,7 +279,7 @@ colvarvalue colvarvalue::dist2_grad(colvarvalue const &x2) const
|
||||
(-1.0) * sin_t * v2.z +
|
||||
cos_t/sin_t * (v1.z - cos_t*v2.z)
|
||||
),
|
||||
colvarvalue::type_unit3vector );
|
||||
colvarvalue::type_unit3vectorderiv );
|
||||
}
|
||||
case colvarvalue::type_quaternion:
|
||||
case colvarvalue::type_quaternionderiv:
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
// -*- c++ -*-
|
||||
|
||||
// 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
|
||||
// Please update all Colvars source files before making any changes.
|
||||
// If you wish to distribute your changes, please submit them to the
|
||||
// Colvars repository at GitHub.
|
||||
|
||||
#ifndef COLVARVALUE_H
|
||||
#define COLVARVALUE_H
|
||||
|
||||
@ -128,30 +135,23 @@ public:
|
||||
{}
|
||||
|
||||
/// \brief Copy constructor from rvector base type (Note: this sets
|
||||
/// automatically a type \link type_3vector \endlink , if you want a
|
||||
/// by default a type \link type_3vector \endlink , if you want a
|
||||
/// \link type_unit3vector \endlink you must set it explicitly)
|
||||
inline colvarvalue(cvm::rvector const &v)
|
||||
: value_type(type_3vector), rvector_value(v)
|
||||
{}
|
||||
|
||||
/// \brief Copy constructor from rvector base type (additional
|
||||
/// argument to make possible to choose a \link type_unit3vector
|
||||
/// \endlink
|
||||
inline colvarvalue(cvm::rvector const &v, Type const &vti)
|
||||
inline colvarvalue(cvm::rvector const &v, Type vti = type_3vector)
|
||||
: value_type(vti), rvector_value(v)
|
||||
{}
|
||||
|
||||
/// \brief Copy constructor from quaternion base type
|
||||
inline colvarvalue(cvm::quaternion const &q)
|
||||
: value_type(type_quaternion), quaternion_value(q)
|
||||
inline colvarvalue(cvm::quaternion const &q, Type vti = type_quaternion)
|
||||
: value_type(vti), quaternion_value(q)
|
||||
{}
|
||||
|
||||
/// Copy constructor from vector1d base type
|
||||
colvarvalue(cvm::vector1d<cvm::real> const &v, Type vti = type_vector);
|
||||
|
||||
/// Copy constructor from another \link colvarvalue \endlink
|
||||
colvarvalue(colvarvalue const &x);
|
||||
|
||||
/// Copy constructor from vector1d base type
|
||||
colvarvalue(cvm::vector1d<cvm::real> const &v, Type const &vti);
|
||||
|
||||
|
||||
/// Set to the null value for the data type currently defined
|
||||
void reset();
|
||||
@ -211,10 +211,6 @@ public:
|
||||
return std::sqrt(this->norm2());
|
||||
}
|
||||
|
||||
/// \brief Return the value whose scalar product with this value is
|
||||
/// 1
|
||||
inline colvarvalue inverse() const;
|
||||
|
||||
/// Square distance between this \link colvarvalue \endlink and another
|
||||
cvm::real dist2(colvarvalue const &x2) const;
|
||||
|
||||
@ -297,6 +293,9 @@ public:
|
||||
/// Set elements of the vector from a single colvarvalue
|
||||
void set_elem(int const i_begin, int const i_end, colvarvalue const &x);
|
||||
|
||||
/// Make each element a random number in N(0,1)
|
||||
void set_random();
|
||||
|
||||
/// Get a single colvarvalue out of elements of the vector
|
||||
colvarvalue const get_elem(int const icv) const;
|
||||
|
||||
@ -533,7 +532,7 @@ inline colvarvalue::colvarvalue(colvarvalue const &x)
|
||||
}
|
||||
}
|
||||
|
||||
inline colvarvalue::colvarvalue(cvm::vector1d<cvm::real> const &v, Type const &vti)
|
||||
inline colvarvalue::colvarvalue(cvm::vector1d<cvm::real> const &v, Type vti)
|
||||
{
|
||||
if ((vti != type_vector) && (v.size() != num_dimensions(vti))) {
|
||||
cvm::error("Error: trying to initialize a variable of type \""+type_desc(vti)+
|
||||
@ -617,11 +616,22 @@ inline int colvarvalue::check_types_assign(colvarvalue::Type const &vt1,
|
||||
}
|
||||
|
||||
if (vt1 != type_notset) {
|
||||
if (vt1 != vt2) {
|
||||
cvm::error("Trying to assign a colvar value with type \""+
|
||||
type_desc(vt2)+"\" to one with type \""+
|
||||
type_desc(vt1)+"\".\n");
|
||||
return COLVARS_ERROR;
|
||||
if (((vt1 == type_unit3vector) &&
|
||||
(vt2 == type_unit3vectorderiv)) ||
|
||||
((vt2 == type_unit3vector) &&
|
||||
(vt1 == type_unit3vectorderiv)) ||
|
||||
((vt1 == type_quaternion) &&
|
||||
(vt2 == type_quaternionderiv)) ||
|
||||
((vt2 == type_quaternion) &&
|
||||
(vt1 == type_quaternionderiv))) {
|
||||
return COLVARS_OK;
|
||||
} else {
|
||||
if (vt1 != vt2) {
|
||||
cvm::error("Trying to assign a colvar value with type \""+
|
||||
type_desc(vt2)+"\" to one with type \""+
|
||||
type_desc(vt1)+"\".\n");
|
||||
return COLVARS_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return COLVARS_OK;
|
||||
|
||||
1
src/.gitignore
vendored
@ -24,6 +24,7 @@
|
||||
/kokkos.cpp
|
||||
/kokkos.h
|
||||
/kokkos_type.h
|
||||
/kokkos_few.h
|
||||
|
||||
/manifold*.cpp
|
||||
/manifold*.h
|
||||
|
||||
@ -91,6 +91,8 @@ action fix_reaxc_species_kokkos.cpp fix_reaxc_species.cpp
|
||||
action fix_reaxc_species_kokkos.h fix_reaxc_species.h
|
||||
action fix_setforce_kokkos.cpp
|
||||
action fix_setforce_kokkos.h
|
||||
action fix_momentum_kokkos.cpp
|
||||
action fix_momentum_kokkos.h
|
||||
action fix_wall_reflect_kokkos.cpp
|
||||
action fix_wall_reflect_kokkos.h
|
||||
action gridcomm_kokkos.cpp gridcomm.cpp
|
||||
@ -100,6 +102,7 @@ action improper_harmonic_kokkos.h improper_harmonic.h
|
||||
action kokkos.cpp
|
||||
action kokkos.h
|
||||
action kokkos_type.h
|
||||
action kokkos_few.h
|
||||
action memory_kokkos.h
|
||||
action modify_kokkos.cpp
|
||||
action modify_kokkos.h
|
||||
|
||||
@ -1593,7 +1593,7 @@ int AtomVecAngleKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -1232,7 +1232,7 @@ int AtomVecAtomicKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -1460,7 +1460,7 @@ int AtomVecBondKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -1314,7 +1314,7 @@ int AtomVecChargeKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -1936,7 +1936,7 @@ int AtomVecFullKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -1850,7 +1850,7 @@ int AtomVecMolecularKokkos::unpack_restart(double *buf)
|
||||
|
||||
double **extra = atom->extra;
|
||||
if (atom->nextra_store) {
|
||||
int size = static_cast<int> (ubuf(buf[m++]).i) - m;
|
||||
int size = static_cast<int> (buf[0]) - m;
|
||||
for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++];
|
||||
}
|
||||
|
||||
|
||||
@ -262,5 +262,5 @@ void CommTiledKokkos::forward_comm_array(int nsize, double **array)
|
||||
|
||||
int CommTiledKokkos::exchange_variable(int n, double *inbuf, double *&outbuf)
|
||||
{
|
||||
CommTiled::exchange_variable(n,inbuf,outbuf);
|
||||
}
|
||||
return CommTiled::exchange_variable(n,inbuf,outbuf);
|
||||
}
|
||||
|
||||
@ -45,14 +45,13 @@ namespace LAMMPS_NS {
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
volatile s_CTEMP& operator+=(const volatile s_CTEMP &rhs) volatile {
|
||||
void operator+=(const volatile s_CTEMP &rhs) volatile {
|
||||
t0 += rhs.t0;
|
||||
t1 += rhs.t1;
|
||||
t2 += rhs.t2;
|
||||
t3 += rhs.t3;
|
||||
t4 += rhs.t4;
|
||||
t5 += rhs.t5;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
typedef s_CTEMP CTEMP;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "domain.h"
|
||||
#include "kokkos_type.h"
|
||||
#include "kokkos_few.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
@ -35,6 +36,10 @@ class DomainKokkos : public Domain {
|
||||
void image_flip(int, int, int);
|
||||
void x2lamda(int);
|
||||
void lamda2x(int);
|
||||
// these lines bring in the x2lamda signatures from Domain
|
||||
// that are not overloaded here
|
||||
using Domain::x2lamda;
|
||||
using Domain::lamda2x;
|
||||
|
||||
int closest_image(const int, int) const;
|
||||
|
||||
@ -50,6 +55,10 @@ class DomainKokkos : public Domain {
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagDomain_x2lamda, const int&) const;
|
||||
|
||||
static KOKKOS_INLINE_FUNCTION
|
||||
Few<double,3> unmap(Few<double,3> prd, Few<double,6> h, int triclinic,
|
||||
Few<double,3> x, imageint image);
|
||||
|
||||
private:
|
||||
double lo[3],hi[3],period[3];
|
||||
int n_flip, m_flip, p_flip;
|
||||
@ -57,6 +66,26 @@ class DomainKokkos : public Domain {
|
||||
ArrayTypes<LMPDeviceType>::t_imageint_1d image;
|
||||
};
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
Few<double,3> DomainKokkos::unmap(Few<double,3> prd, Few<double,6> h,
|
||||
int triclinic, Few<double,3> x, imageint image)
|
||||
{
|
||||
int xbox = (image & IMGMASK) - IMGMAX;
|
||||
int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int zbox = (image >> IMG2BITS) - IMGMAX;
|
||||
Few<double,3> y;
|
||||
if (triclinic == 0) {
|
||||
y[0] = x[0] + xbox*prd[0];
|
||||
y[1] = x[1] + ybox*prd[1];
|
||||
y[2] = x[2] + zbox*prd[2];
|
||||
} else {
|
||||
y[0] = x[0] + h[0]*xbox + h[5]*ybox + h[4]*zbox;
|
||||
y[1] = x[1] + h[1]*ybox + h[3]*zbox;
|
||||
y[2] = x[2] + h[2]*zbox;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
204
src/KOKKOS/fix_momentum_kokkos.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "fix_momentum_kokkos.h"
|
||||
#include "atom_kokkos.h"
|
||||
#include "atom_masks.h"
|
||||
#include "domain.h"
|
||||
#include "domain_kokkos.h"
|
||||
#include "group.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "kokkos_few.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: Dan Ibanez (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
FixMomentumKokkos<DeviceType>::FixMomentumKokkos(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixMomentum(lmp, narg, arg)
|
||||
{
|
||||
kokkosable = 1;
|
||||
atomKK = (AtomKokkos *) atom;
|
||||
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||
datamask_read = EMPTY_MASK;
|
||||
datamask_modify = EMPTY_MASK;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
static double get_kinetic_energy(
|
||||
AtomKokkos* atomKK,
|
||||
MPI_Comm world,
|
||||
int groupbit,
|
||||
int nlocal,
|
||||
typename ArrayTypes<DeviceType>::t_v_array_randomread v,
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread mask)
|
||||
{
|
||||
using AT = ArrayTypes<DeviceType>;
|
||||
auto execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||
double ke=0.0;
|
||||
if (atomKK->rmass) {
|
||||
atomKK->sync(execution_space, RMASS_MASK);
|
||||
typename AT::t_float_1d_randomread rmass = atomKK->k_rmass.view<DeviceType>();
|
||||
Kokkos::parallel_reduce(nlocal, LAMMPS_LAMBDA(int i, double& update) {
|
||||
if (mask(i) & groupbit)
|
||||
update += rmass(i) *
|
||||
(v(i,0)*v(i,0) + v(i,1)*v(i,1) + v(i,2)*v(i,2));
|
||||
}, ke);
|
||||
} else {
|
||||
// D.I. : why is there no MASS_MASK ?
|
||||
atomKK->sync(execution_space, TYPE_MASK);
|
||||
typename AT::t_int_1d_randomread type = atomKK->k_type.view<DeviceType>();
|
||||
typename AT::t_float_1d_randomread mass = atomKK->k_mass.view<DeviceType>();
|
||||
Kokkos::parallel_reduce(nlocal, LAMMPS_LAMBDA(int i, double& update) {
|
||||
if (mask(i) & groupbit)
|
||||
update += mass(type(i)) *
|
||||
(v(i,0)*v(i,0) + v(i,1)*v(i,1) + v(i,2)*v(i,2));
|
||||
}, ke);
|
||||
}
|
||||
double ke_total;
|
||||
MPI_Allreduce(&ke,&ke_total,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
return ke_total;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
void FixMomentumKokkos<DeviceType>::end_of_step()
|
||||
{
|
||||
atomKK->sync(execution_space, V_MASK | MASK_MASK);
|
||||
|
||||
typename AT::t_v_array v = atomKK->k_v.view<DeviceType>();
|
||||
typename AT::t_int_1d_randomread mask = atomKK->k_mask.view<DeviceType>();
|
||||
|
||||
const int nlocal = atom->nlocal;
|
||||
double ekin_old,ekin_new;
|
||||
ekin_old = ekin_new = 0.0;
|
||||
|
||||
if (dynamic)
|
||||
masstotal = group->mass(igroup); // change once Group is ported to Kokkos
|
||||
|
||||
// do nothing if group is empty, i.e. mass is zero;
|
||||
|
||||
if (masstotal == 0.0) return;
|
||||
|
||||
// compute kinetic energy before momentum removal, if needed
|
||||
|
||||
if (rescale) {
|
||||
ekin_old = get_kinetic_energy<DeviceType>(atomKK, world, groupbit, nlocal, v, mask);
|
||||
}
|
||||
|
||||
auto groupbit2 = groupbit;
|
||||
if (linear) {
|
||||
/* this is needed because Group is not Kokkos-aware ! */
|
||||
atomKK->sync(ExecutionSpaceFromDevice<LMPHostType>::space,
|
||||
V_MASK | MASK_MASK | TYPE_MASK | RMASS_MASK);
|
||||
Few<double, 3> vcm;
|
||||
group->vcm(igroup,masstotal,&vcm[0]);
|
||||
|
||||
// adjust velocities by vcm to zero linear momentum
|
||||
// only adjust a component if flag is set
|
||||
|
||||
auto xflag2 = xflag;
|
||||
auto yflag2 = yflag;
|
||||
auto zflag2 = zflag;
|
||||
|
||||
Kokkos::parallel_for(nlocal, LAMMPS_LAMBDA(int i) {
|
||||
if (mask(i) & groupbit2) {
|
||||
if (xflag2) v(i,0) -= vcm[0];
|
||||
if (yflag2) v(i,1) -= vcm[1];
|
||||
if (zflag2) v(i,2) -= vcm[2];
|
||||
}
|
||||
});
|
||||
atomKK->modified(execution_space, V_MASK);
|
||||
}
|
||||
|
||||
if (angular) {
|
||||
Few<double, 3> xcm, angmom, omega;
|
||||
double inertia[3][3];
|
||||
/* syncs for each Kokkos-unaware Group method */
|
||||
atomKK->sync(ExecutionSpaceFromDevice<LMPHostType>::space,
|
||||
X_MASK | MASK_MASK | TYPE_MASK | IMAGE_MASK | RMASS_MASK);
|
||||
group->xcm(igroup,masstotal,&xcm[0]);
|
||||
atomKK->sync(ExecutionSpaceFromDevice<LMPHostType>::space,
|
||||
X_MASK | V_MASK | MASK_MASK | TYPE_MASK | IMAGE_MASK | RMASS_MASK);
|
||||
group->angmom(igroup,&xcm[0],&angmom[0]);
|
||||
atomKK->sync(ExecutionSpaceFromDevice<LMPHostType>::space,
|
||||
X_MASK | MASK_MASK | TYPE_MASK | IMAGE_MASK | RMASS_MASK);
|
||||
group->inertia(igroup,&xcm[0],inertia);
|
||||
group->omega(&angmom[0],inertia,&omega[0]);
|
||||
|
||||
// adjust velocities to zero omega
|
||||
// vnew_i = v_i - w x r_i
|
||||
// must use unwrapped coords to compute r_i correctly
|
||||
|
||||
atomKK->sync(execution_space, X_MASK | IMAGE_MASK);
|
||||
typename AT::t_x_array_randomread x = atomKK->k_x.view<DeviceType>();
|
||||
typename AT::t_imageint_1d_randomread image = atomKK->k_image.view<DeviceType>();
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
auto prd = Few<double,3>(domain->prd);
|
||||
auto h = Few<double,6>(domain->h);
|
||||
auto triclinic = domain->triclinic;
|
||||
Kokkos::parallel_for(nlocal, LAMMPS_LAMBDA(int i) {
|
||||
if (mask[i] & groupbit2) {
|
||||
Few<double,3> x_i;
|
||||
x_i[0] = x(i,0);
|
||||
x_i[1] = x(i,1);
|
||||
x_i[2] = x(i,2);
|
||||
auto unwrap = DomainKokkos::unmap(prd,h,triclinic,x_i,image(i));
|
||||
auto dx = unwrap[0] - xcm[0];
|
||||
auto dy = unwrap[1] - xcm[1];
|
||||
auto dz = unwrap[2] - xcm[2];
|
||||
v(i,0) -= omega[1]*dz - omega[2]*dy;
|
||||
v(i,1) -= omega[2]*dx - omega[0]*dz;
|
||||
v(i,2) -= omega[0]*dy - omega[1]*dx;
|
||||
}
|
||||
});
|
||||
atomKK->modified(execution_space, V_MASK);
|
||||
}
|
||||
|
||||
// compute kinetic energy after momentum removal, if needed
|
||||
|
||||
if (rescale) {
|
||||
|
||||
ekin_new = get_kinetic_energy<DeviceType>(atomKK, world, groupbit, nlocal, v, mask);
|
||||
|
||||
double factor = 1.0;
|
||||
if (ekin_new != 0.0) factor = sqrt(ekin_old/ekin_new);
|
||||
Kokkos::parallel_for(nlocal, LAMMPS_LAMBDA(int i) {
|
||||
if (mask(i) & groupbit2) {
|
||||
v(i,0) *= factor;
|
||||
v(i,1) *= factor;
|
||||
v(i,2) *= factor;
|
||||
}
|
||||
});
|
||||
atomKK->modified(execution_space, V_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class FixMomentumKokkos<LMPDeviceType>;
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
template class FixMomentumKokkos<LMPHostType>;
|
||||
#endif
|
||||
}
|
||||
|
||||
46
src/KOKKOS/fix_momentum_kokkos.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* -*- 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(momentum/kk,FixMomentumKokkos<LMPDeviceType>)
|
||||
FixStyle(momentum/kk/device,FixMomentumKokkos<LMPDeviceType>)
|
||||
FixStyle(momentum/kk/host,FixMomentumKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_MOMENTUM_KOKKOS_H
|
||||
#define LMP_FIX_MOMENTUM_KOKKOS_H
|
||||
|
||||
#include "fix_momentum.h"
|
||||
#include "kokkos_type.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<class DeviceType>
|
||||
class FixMomentumKokkos : public FixMomentum {
|
||||
public:
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
|
||||
FixMomentumKokkos(class LAMMPS *, int, char **);
|
||||
void end_of_step();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -43,11 +43,10 @@ struct s_double_3 {
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
volatile s_double_3& operator+=(const volatile s_double_3 &rhs) volatile {
|
||||
void operator+=(const volatile s_double_3 &rhs) volatile {
|
||||
d0 += rhs.d0;
|
||||
d1 += rhs.d1;
|
||||
d2 += rhs.d2;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
typedef s_double_3 double_3;
|
||||
|
||||
68
src/KOKKOS/kokkos_few.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef KOKKOS_FEW_H
|
||||
#define KOKKOS_FEW_H
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
|
||||
template <typename T, std::size_t n>
|
||||
class Few {
|
||||
alignas(T) char array_[n * sizeof(T)];
|
||||
|
||||
public:
|
||||
enum { size = n };
|
||||
Few(std::initializer_list<T> l) {
|
||||
std::size_t i = 0;
|
||||
for (auto it = l.begin(); it != l.end(); ++it) {
|
||||
new (data() + (i++)) T(*it);
|
||||
}
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION Few(T const a[]) {
|
||||
for (std::size_t i = 0; i < n; ++i) new (data() + i) T(a[i]);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION Few() {
|
||||
for (std::size_t i = 0; i < n; ++i) new (data() + i) T();
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION ~Few() {
|
||||
for (std::size_t i = 0; i < n; ++i) (data()[i]).~T();
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION Few(Few<T, n> const& rhs) {
|
||||
for (std::size_t i = 0; i < n; ++i) new (data() + i) T(rhs[i]);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION Few(Few<T, n> const volatile& rhs) {
|
||||
for (std::size_t i = 0; i < n; ++i) new (data() + i) T(rhs[i]);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION void operator=(Few<T, n> const& rhs) volatile {
|
||||
for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION void operator=(Few<T, n> const& rhs) {
|
||||
for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION void operator=(Few<T, n> const volatile& rhs) {
|
||||
for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T* data() {
|
||||
return reinterpret_cast<T*>(array_);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T const* data() const {
|
||||
return reinterpret_cast<T const*>(array_);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T volatile* data() volatile {
|
||||
return reinterpret_cast<T volatile*>(array_);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T const volatile* data() const volatile {
|
||||
return reinterpret_cast<T const volatile*>(array_);
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T& operator[](std::size_t i) {
|
||||
return data()[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T const& operator[](std::size_t i) const {
|
||||
return data()[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T volatile& operator[](std::size_t i) volatile {
|
||||
return data()[i];
|
||||
}
|
||||
KOKKOS_INLINE_FUNCTION T const volatile& operator[](std::size_t i) const volatile {
|
||||
return data()[i];
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -920,4 +920,10 @@ void memset_kokkos (ViewType &view) {
|
||||
#define ISFINITE(x) std::isfinite(x)
|
||||
#endif
|
||||
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
#define LAMMPS_LAMBDA [=] __device__
|
||||
#else
|
||||
#define LAMMPS_LAMBDA [=]
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -81,7 +81,7 @@ void ModifyKokkos::setup_pre_exchange()
|
||||
atomKK->sync(fix[list_min_pre_exchange[i]]->execution_space,
|
||||
fix[list_min_pre_exchange[i]]->datamask_read);
|
||||
if (!fix[list_min_pre_exchange[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_min_pre_exchange[i]]->min_setup_pre_exchange();
|
||||
fix[list_min_pre_exchange[i]]->setup_pre_exchange();
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_min_pre_exchange[i]]->execution_space,
|
||||
fix[list_min_pre_exchange[i]]->datamask_modify);
|
||||
@ -110,7 +110,7 @@ void ModifyKokkos::setup_pre_neighbor()
|
||||
atomKK->sync(fix[list_min_pre_neighbor[i]]->execution_space,
|
||||
fix[list_min_pre_neighbor[i]]->datamask_read);
|
||||
if (!fix[list_min_pre_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_min_pre_neighbor[i]]->min_setup_pre_neighbor();
|
||||
fix[list_min_pre_neighbor[i]]->setup_pre_neighbor();
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_min_pre_neighbor[i]]->execution_space,
|
||||
fix[list_min_pre_neighbor[i]]->datamask_modify);
|
||||
@ -139,13 +139,42 @@ void ModifyKokkos::setup_pre_force(int vflag)
|
||||
atomKK->sync(fix[list_min_pre_force[i]]->execution_space,
|
||||
fix[list_min_pre_force[i]]->datamask_read);
|
||||
if (!fix[list_min_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_min_pre_force[i]]->min_setup_pre_force(vflag);
|
||||
fix[list_min_pre_force[i]]->setup_pre_force(vflag);
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_min_pre_force[i]]->execution_space,
|
||||
fix[list_min_pre_force[i]]->datamask_modify);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
setup pre_reverse call, only for fixes that define pre_reverse
|
||||
called from Verlet, RESPA, Min
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ModifyKokkos::setup_pre_reverse(int eflag, int vflag)
|
||||
{
|
||||
if (update->whichflag == 1)
|
||||
for (int i = 0; i < n_pre_reverse; i++) {
|
||||
atomKK->sync(fix[list_pre_reverse[i]]->execution_space,
|
||||
fix[list_pre_reverse[i]]->datamask_read);
|
||||
if (!fix[list_pre_reverse[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_pre_reverse[i]]->setup_pre_reverse(eflag,vflag);
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_pre_reverse[i]]->execution_space,
|
||||
fix[list_pre_reverse[i]]->datamask_modify);
|
||||
}
|
||||
else if (update->whichflag == 2)
|
||||
for (int i = 0; i < n_min_pre_reverse; i++) {
|
||||
atomKK->sync(fix[list_min_pre_reverse[i]]->execution_space,
|
||||
fix[list_min_pre_reverse[i]]->datamask_read);
|
||||
if (!fix[list_min_pre_reverse[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_min_pre_reverse[i]]->setup_pre_reverse(eflag,vflag);
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_min_pre_reverse[i]]->execution_space,
|
||||
fix[list_min_pre_reverse[i]]->datamask_modify);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
1st half of integrate call, only for relevant fixes
|
||||
------------------------------------------------------------------------- */
|
||||
@ -231,6 +260,23 @@ void ModifyKokkos::pre_force(int vflag)
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pre_reverse call, only for relevant fixes
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ModifyKokkos::pre_reverse(int eflag, int vflag)
|
||||
{
|
||||
for (int i = 0; i < n_pre_reverse; i++) {
|
||||
atomKK->sync(fix[list_pre_reverse[i]]->execution_space,
|
||||
fix[list_pre_reverse[i]]->datamask_read);
|
||||
if (!fix[list_pre_reverse[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_pre_reverse[i]]->pre_reverse(eflag,vflag);
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_pre_reverse[i]]->execution_space,
|
||||
fix[list_pre_reverse[i]]->datamask_modify);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
post_force call, only for relevant fixes
|
||||
------------------------------------------------------------------------- */
|
||||
@ -476,6 +522,23 @@ void ModifyKokkos::min_pre_force(int vflag)
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
minimizer pre-reverse call, only for relevant fixes
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ModifyKokkos::min_pre_reverse(int eflag, int vflag)
|
||||
{
|
||||
for (int i = 0; i < n_min_pre_reverse; i++) {
|
||||
atomKK->sync(fix[list_min_pre_reverse[i]]->execution_space,
|
||||
fix[list_min_pre_reverse[i]]->datamask_read);
|
||||
if (!fix[list_min_pre_reverse[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||
fix[list_min_pre_reverse[i]]->min_pre_reverse(eflag,vflag);
|
||||
lmp->kokkos->auto_sync = 0;
|
||||
atomKK->modified(fix[list_min_pre_reverse[i]]->execution_space,
|
||||
fix[list_min_pre_reverse[i]]->datamask_modify);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
minimizer force adjustment call, only for relevant fixes
|
||||
------------------------------------------------------------------------- */
|
||||
@ -658,4 +721,3 @@ int ModifyKokkos::min_reset_ref()
|
||||
}
|
||||
return itmpall;
|
||||
}
|
||||
|
||||
|
||||
@ -26,12 +26,14 @@ class ModifyKokkos : public Modify {
|
||||
void setup_pre_exchange();
|
||||
void setup_pre_neighbor();
|
||||
void setup_pre_force(int);
|
||||
void setup_pre_reverse(int, int);
|
||||
void initial_integrate(int);
|
||||
void post_integrate();
|
||||
void pre_decide();
|
||||
void pre_exchange();
|
||||
void pre_neighbor();
|
||||
void pre_force(int);
|
||||
void pre_reverse(int,int);
|
||||
void post_force(int);
|
||||
void final_integrate();
|
||||
void end_of_step();
|
||||
@ -48,6 +50,7 @@ class ModifyKokkos : public Modify {
|
||||
void min_pre_exchange();
|
||||
void min_pre_neighbor();
|
||||
void min_pre_force(int);
|
||||
void min_pre_reverse(int,int);
|
||||
void min_post_force(int);
|
||||
|
||||
double min_energy(double *);
|
||||
|
||||
@ -75,7 +75,7 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut {
|
||||
Kokkos::DualView<params_buck_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
@ -76,7 +76,7 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong {
|
||||
Kokkos::DualView<params_buck_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
@ -68,7 +68,7 @@ class PairBuckKokkos : public PairBuck {
|
||||
|
||||
Kokkos::DualView<params_buck**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_buck m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
params_buck m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 12 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
typename ArrayTypes<DeviceType>::t_x_array c_x;
|
||||
|
||||
@ -81,7 +81,7 @@ class PairCoulCutKokkos : public PairCoulCut {
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
@ -79,7 +79,7 @@ class PairCoulDebyeKokkos : public PairCoulDebye {
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
@ -80,7 +80,7 @@ class PairCoulLongKokkos : public PairCoulLong {
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
@ -490,14 +490,11 @@ double PairLJCharmmCoulCharmmImplicitKokkos<DeviceType>::init_one(int i, int j)
|
||||
m_cut_coulsq[j][i] = m_cut_coulsq[i][j] = cut_coulsqm;
|
||||
}
|
||||
|
||||
k_cutsq.h_view(i,j) = cutone*cutone;
|
||||
k_cutsq.h_view(j,i) = k_cutsq.h_view(i,j);
|
||||
k_cutsq.h_view(i,j) = k_cutsq.h_view(j,i) = cutone*cutone;
|
||||
k_cutsq.template modify<LMPHostType>();
|
||||
k_cut_ljsq.h_view(i,j) = cut_ljsqm;
|
||||
k_cut_ljsq.h_view(j,i) = k_cut_ljsq.h_view(i,j);
|
||||
k_cut_ljsq.h_view(i,j) = k_cut_ljsq.h_view(j,i) = cut_ljsqm;
|
||||
k_cut_ljsq.template modify<LMPHostType>();
|
||||
k_cut_coulsq.h_view(i,j) = cut_coulsqm;
|
||||
k_cut_coulsq.h_view(j,i) = k_cut_coulsq.h_view(i,j);
|
||||
k_cut_coulsq.h_view(i,j) = k_cut_coulsq.h_view(j,i) = cut_coulsqm;
|
||||
k_cut_coulsq.template modify<LMPHostType>();
|
||||
k_params.template modify<LMPHostType>();
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
// hardwired to space for 12 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||