Skip to content

Commit

Permalink
WIP: MetaD NEIGHBOR list option to sum gaussians (#639)
Browse files Browse the repository at this point in the history
* MetaD: this commits add the neighbor list option to sum hills
this can be usefull with many cvs where grids are either too memory consuming
and/or too slow. I was playing with this idea with OPES and it actually works
pretty well. The neighbor list update at the moment is only openMP parallelised.
this commits add also the openMP parallelisation to the cycle over the gaussians

* MetaD: some fixes for the OMP implementation

* MetaD NL, not use mpi for the neighbor list update

* MetaD: split getBiasDer and not Der

* MetaD: more cleaning and NEIGHBOR restart

* MetaD: added missing components in doc

* MetaD: some reorganisation and fix

* MetaD: added control for too few hills and openMP

* MetaD: take also into account mpi threads to avoid the use of too many
threads for few hills

* increased the number of gaussians in two regtest to cover better the
parallelism

* Fixed grids

* Metad: cleaning

* MetaD: performanaces and cleaning

* more std

* added back std::time

* Metad: fix thread safety without loss of performances

* MetaD: some cleaning in the initialisation

* METAD: regtest for CALC_WORK and NLIST

* Metad: added checks that RESTART and WALKERS_MPI
behave consistently among the walkers

* Metad: cleaning

* Metad: updated documentation and added
NLIST_PARAMETERS to modify the neighbor list rules

* Metad: slightly improved performances of GRID and more docs

* MetaD: moved a line in nlistUpdate

* Metad: spelling

* MetaD: in case of WALKERS_MPI the root replica will set the folder
from which reading GRID or HILLS files upon RESTART

* doc

* Metad
- restart stops if hills not found
- broadcasting avoided if absolute path provided

* Metad: restart with hills give error if not already restarted from grid

* fixes for new METAD restart checks

* fixed regteast

* Metad: removed unused headers added two missing std
  • Loading branch information
carlocamilloni committed Nov 19, 2020
1 parent ae3edb1 commit 190093f
Show file tree
Hide file tree
Showing 25 changed files with 897 additions and 609 deletions.
8 changes: 8 additions & 0 deletions CHANGES/v2.8.md
Expand Up @@ -4,6 +4,14 @@

This page contains changes that will end up in 2.8

- Changes leading to differences with previous versions
- in \ref METAD if possible the root walker in WALKERS_MPI will set the folder from which reading the GRID/HILLS file upon restart
- in \ref METAD work is not calculated by default anymore, if needed it can be obtained using CALC_WORK

- Other improvements
- in \ref METAD a new keyword NLIST has been added to use a neighbor list for bias evaluation, this should be faster than grids with many CVs
- in \ref METAD there are more checks that a restart of WALKERS_MPI is working consistently among walkers

- Changes in the OPES module
- new action \ref OPES_EXPANDED
- various new actions of type \ref EXPANSION_CV to be used with \ref OPES_EXPANDED
Expand Down
1 change: 0 additions & 1 deletion regtest/basic/rt-mpi7/gridx.0.reference
@@ -1,4 +1,3 @@
# this is to test restart
#! FIELDS d1 d2 meta2.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
Expand Down
2 changes: 2 additions & 0 deletions regtest/basic/rt-mpi7/plumed.dat
Expand Up @@ -9,6 +9,7 @@ METAD ...
GRID_MIN=0,0 GRID_MAX=2,2 GRID_BIN=4,4
GRID_WFILE=grid GRID_WSTRIDE=2
LABEL=meta1
RESTART=NO
...

METAD ...
Expand All @@ -18,6 +19,7 @@ METAD ...
GRID_WFILE=gridx GRID_WSTRIDE=2 STORE_GRIDS
FILE=HILLSX
LABEL=meta2
RESTART=NO
...

METAD ...
Expand Down
2 changes: 1 addition & 1 deletion regtest/basic/rt-mpi7b/grid.0.reference
@@ -1,4 +1,4 @@
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! FIELDS d1 d2 @2.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
2 changes: 1 addition & 1 deletion regtest/basic/rt-mpi7b/grid.1.reference
@@ -1,4 +1,4 @@
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! FIELDS d1 d2 @2.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
2 changes: 1 addition & 1 deletion regtest/basic/rt-mpi7b/grid.2.reference
@@ -1,4 +1,4 @@
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! FIELDS d1 d2 @2.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
11 changes: 5 additions & 6 deletions regtest/basic/rt-mpi7b/gridx.0.reference
@@ -1,5 +1,4 @@
# this is to test restart
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -37,7 +36,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -75,7 +74,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -113,7 +112,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -151,7 +150,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
10 changes: 5 additions & 5 deletions regtest/basic/rt-mpi7b/gridx.1.reference
@@ -1,4 +1,4 @@
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -36,7 +36,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -74,7 +74,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -112,7 +112,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -150,7 +150,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
10 changes: 5 additions & 5 deletions regtest/basic/rt-mpi7b/gridx.2.reference
@@ -1,4 +1,4 @@
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -36,7 +36,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -74,7 +74,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -112,7 +112,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down Expand Up @@ -150,7 +150,7 @@
1.000000000 2.000000000 0.000000000 0.000000000 0.000000000
1.500000000 2.000000000 0.000000000 0.000000000 0.000000000
2.000000000 2.000000000 0.000000000 0.000000000 0.000000000
#! FIELDS d1 d2 @4.bias der_d1 der_d2
#! FIELDS d1 d2 @3.bias der_d1 der_d2
#! SET min_d1 0
#! SET max_d1 2
#! SET nbins_d1 5
Expand Down
2 changes: 0 additions & 2 deletions regtest/basic/rt-mpi7b/plumed.dat
@@ -1,5 +1,3 @@
RESTART

d1: DISTANCE ATOMS=1,2
d2: DISTANCE ATOMS=3,4

Expand Down
2 changes: 2 additions & 0 deletions regtest/basic/rt-mpi9/plumed.dat
Expand Up @@ -8,6 +8,7 @@ METAD ...
FMT=%6.2f
GRID_MIN=0,0 GRID_MAX=2,2 GRID_BIN=4,4
GRID_WFILE=grid GRID_WSTRIDE=2
RESTART=NO
...

METAD ...
Expand All @@ -16,6 +17,7 @@ METAD ...
GRID_MIN=0,0 GRID_MAX=2,2 GRID_BIN=4,4
GRID_WFILE=gridx GRID_WSTRIDE=2 STORE_GRIDS
FILE=HILLSX
RESTART=NO
...


Expand Down
2 changes: 1 addition & 1 deletion regtest/basic/rt10-mpi/plumed.dat
@@ -1,7 +1,7 @@
mu1: DISTANCE ATOMS=1,10
vol: VOLUME

METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=10 LABEL=md FMT=%14.6f
METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=2 LABEL=md FMT=%14.6f

PRINT ...
STRIDE=1
Expand Down
12 changes: 6 additions & 6 deletions regtest/basic/rt10-restart/COLVAR.reference
Expand Up @@ -4,9 +4,9 @@
0.100000 1.098 127.933 1.759
0.150000 1.080 127.933 2.578
0.200000 1.087 127.933 3.651
#! FIELDS time mu1 vol md.bias
0.000000 1.163 127.933 4.223
0.050000 1.131 127.933 4.688
0.100000 1.098 127.933 5.686
0.150000 1.080 127.933 6.441
0.200000 1.087 127.933 7.552
#! FIELDS time mu1 vol md.work md.bias md1.bias md2.bias md2.nlker md2.nlsteps
0.000000 1.163 127.933 0.000 4.223 0.000 0.000 9.000 1.000
0.050000 1.131 127.933 0.000 4.688 0.000 0.000 9.000 1.000
0.100000 1.098 127.933 1.000 5.686 0.000 0.000 10.000 2.000
0.150000 1.080 127.933 2.000 6.441 0.000 0.000 11.000 1.000
0.200000 1.087 127.933 3.000 7.552 0.000 0.000 12.000 1.000
13 changes: 13 additions & 0 deletions regtest/basic/rt10-restart/H2
@@ -0,0 +1,13 @@
#! FIELDS time mu1 vol sigma_mu1 sigma_vol height biasf
#! SET multivariate false
0 1.162646040831079 127.932640011072 0.1 0.2 0 1
0.05 1.130546273059004 127.932640011072 0.1 0.2 0 1
0.1 1.097928292824707 127.932640011072 0.1 0.2 0 1
0.15 1.080244153391634 127.932640011072 0.1 0.2 0 1
0.2 1.086854650075657 127.932640011072 0.1 0.2 0 1
#! FIELDS time mu1 vol sigma_mu1 sigma_vol height biasf
#! SET multivariate false
0.050000 1.130546 127.932640 0.100000 0.200000 0.000000 1.000000
0.100000 1.097928 127.932640 0.100000 0.200000 0.000000 1.000000
0.150000 1.080244 127.932640 0.100000 0.200000 0.000000 1.000000
0.200000 1.086855 127.932640 0.100000 0.200000 0.000000 1.000000
6 changes: 4 additions & 2 deletions regtest/basic/rt10-restart/plumed.dat
Expand Up @@ -2,15 +2,17 @@ RESTART
mu1: DISTANCE ATOMS=1,10
vol: VOLUME

METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=10 LABEL=md FMT=%14.6f
METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=10 LABEL=md FMT=%14.6f CALC_WORK

# this is to check RESTART.
# since here restart is disabled, the hills in H1 should not be read
METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=0.0 PACE=10 LABEL=md1 FMT=%14.6f FILE=H1 RESTART=NO

METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=0.0 PACE=10 LABEL=md2 FMT=%14.6f NLIST FILE=H2

PRINT ...
STRIDE=1
ARG=mu1,vol,md.bias
ARG=mu1,vol,md.work,md.bias,md1.bias,md2.*
FILE=COLVAR FMT=%6.3f
... PRINT

Expand Down
6 changes: 3 additions & 3 deletions regtest/basic/rt10/COLVAR.reference
@@ -1,6 +1,6 @@
#! FIELDS time mu1 vol md.bias
0.000000 1.163 127.933 0.000
0.050000 1.131 127.933 0.000
0.100000 1.098 127.933 0.948
0.150000 1.080 127.933 1.866
0.200000 1.087 127.933 2.901
0.100000 1.098 127.933 0.000
0.150000 1.080 127.933 0.984
0.200000 1.087 127.933 0.994
2 changes: 0 additions & 2 deletions regtest/basic/rt10/HILLS.reference
@@ -1,7 +1,5 @@
#! FIELDS time mu1 vol sigma_mu1 sigma_vol height biasf
#! SET multivariate false
#! SET kerneltype gaussian
0.050000 1.130546 127.932640 0.100000 0.200000 1.000000 -1.000000
0.100000 1.097928 127.932640 0.100000 0.200000 1.000000 -1.000000
0.150000 1.080244 127.932640 0.100000 0.200000 1.000000 -1.000000
0.200000 1.086855 127.932640 0.100000 0.200000 1.000000 -1.000000
18 changes: 9 additions & 9 deletions regtest/basic/rt10/forces.reference
Expand Up @@ -219,8 +219,9 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
108
1.498973 0.002364 1.894352
X 2.054883 -0.081609 -2.310045
0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand All @@ -229,7 +230,6 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X -2.054883 0.081609 2.310045
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand Down Expand Up @@ -329,8 +329,8 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
108
2.617465 0.034167 4.017150
X 3.867602 -0.441880 -4.791378
0.738158 0.009635 1.132887
X 1.090712 -0.124616 -1.351229
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand All @@ -339,7 +339,7 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X -3.867602 0.441880 4.791378
X -1.090712 0.124616 1.351229
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand Down Expand Up @@ -439,8 +439,8 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
108
1.570522 0.052663 3.172461
X 2.525074 -0.462386 -3.588808
0.391738 0.013136 0.791313
X 0.629834 -0.115334 -0.895163
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand All @@ -449,7 +449,7 @@ X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X -2.525074 0.462386 3.588808
X -0.629834 0.115334 0.895163
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
X 0.000000 0.000000 0.000000
Expand Down
3 changes: 1 addition & 2 deletions regtest/basic/rt10/plumed.dat
@@ -1,8 +1,7 @@
mu1: DISTANCE ATOMS=1,10
vol: VOLUME

METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=5*2 LABEL=md FMT=%14.6f

METAD ARG=mu1,vol SIGMA=0.1,0.2 HEIGHT=1.0 PACE=2*2 LABEL=md FMT=%14.6f
PRINT ...
STRIDE=1
ARG=mu1,vol,md.bias
Expand Down
2 changes: 1 addition & 1 deletion regtest/basic/rt81/plumed.dat
@@ -1,7 +1,7 @@
d: DISTANCE ATOMS=1,10
c: COORDINATION GROUPA=1-108 GROUPB=1-108 R_0=0.5

fg: METAD ARG=c,d SIGMA=0.1,0.2 HEIGHT=5.0 PACE=1 FMT=%14.6f WALKERS_MPI FILE=HILLS_multi FLYING_GAUSSIAN RESTART=YES
fg: METAD ARG=c,d SIGMA=0.1,0.2 HEIGHT=5.0 PACE=1 FMT=%14.6f WALKERS_MPI FILE=HILLS_multi FLYING_GAUSSIAN

PRINT ARG=fg.bias FILE=colvar

1 comment on commit 190093f

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_MEMETIC_SAMPLING.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_RANDOM_WALK.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.