Replica exchange exchanging biases
Currently, we only support replica exchange where coordinates are exchanged. This is necessary to avoid the need to "transfer the plumed object" to a different replica.
There's one special case however that could be straightforward to implement namely:
- all plumed files are identical to each other, except for a replica-dependent scaling factor applied in front of the bias
- there's no history dependence (e.g. no METAD)
In this case, it is conceivable to have an action like this:
EXCHANGEABLE_BIASVALUE ARG=bb FACTORS={0.0 0.2 0.4 0.6 0.8 1.0} PACE=1000 HISTORY=exchanges.dat
This action would store the current permutation of factors and, instantaneously, apply a the corresponding factor to the current replica. It would then try an exchange every 1000 paces, and append the permutation to the exchange.dat file, so that it can be read when restarting.
To have slightly more flexibility, we could have an array of arguments, e.g.
EXCHANGEABLE_BIASVALUE ...
ARG=bb1,bb2
FACTORS={{0.0 1.0} {0.2 0.8} {0.4 0.6} {0.6 0.4} {0.8 0.2} {1.0 0.0}}
# this would interpolate between bb1 and bb2 across six replicas
PACE=1000 HISTORY=exchanges.dat
...
This could even enable replica exchange umbrella sampling
c1: CUSTOM ARG=d FUNC=x^2 PERIODIC=NO
c2: CUSTOM ARG=d FUNC=(x-0.1)^2 PERIODIC=NO
c3: CUSTOM ARG=d FUNC=(x-0.2)^2 PERIODIC=NO
c4: CUSTOM ARG=d FUNC=(x-0.3)^2 PERIODIC=NO
c5: CUSTOM ARG=d FUNC=(x-0.4)^2 PERIODIC=NO
c6: CUSTOM ARG=d FUNC=(x-0.5)^2 PERIODIC=NO
EXCHANGEABLE_BIASVALUE ...
ARG=c1,c2,c3,c4,c5,c6
FACTORS={
{1 0 0 0 0 0}
{0 1 0 0 0 0}
{0 0 1 0 0 0}
{0 0 0 1 0 0}
{0 0 0 0 1 0}
{0 0 0 0 0 1}
}
PACE=1000 HISTORY=exchanges.dat
...
Nicely, this would work with all codes that support multiple replicas (including the vanilla gromacs versions, when this will be merged).
Any comments on the syntax/usability?
Some suggestions on the syntax:
- Use
FILEinstead ofHISTORYfor consistency with, e.g,METAD -
EXCHANGEABLE_BIASVALUEsounds a bit verbose, I wonder ifBIASEXCHANGEcould do the job - also maybe
COEFFICIENTSinstead ofFACTORSfor consistency withCOMBINE
Is there a specific reason to choose the {a b c} notation instead of the usual a,b,c (also consistent with the @replicas syntax)?
I would maybe argue that intuitively this
EXCHANGEABLE_BIASVALUE ...
ARG=c1,c2,c3,c4,c5,c6
FACTORS={
{1 0 0 0 0 0}
{0 1 0 0 0 0}
{0 0 1 0 0 0}
{0 0 0 1 0 0}
{0 0 0 0 1 0}
{0 0 0 0 0 1}
}
PACE=1000 HISTORY=exchanges.dat
...
could be the implied default to
EXCHANGEABLE_BIASVALUE ...
ARG=c1,c2,c3,c4,c5,c6
PACE=1000 HISTORY=exchanges.dat
...
equivalent to
EXCHANGEABLE_BIASVALUE ...
ARG=c1,c2,c3,c4,c5,c6
FACTORS=1,1,1,1,1,1
PACE=1000 HISTORY=exchanges.dat
...
It makes sense to me intuitively that each "ARG" is interpreted as one "exchangeable bias". With this perspective
EXCHANGEABLE_BIASVALUE ARG=bb FACTORS={0.0 0.2 0.4 0.6 0.8 1.0} PACE=1000 HISTORY=exchanges.dat
can be rewritten
EXCHANGEABLE_BIASVALUE ARG=bb,bb,bb,bb,bb,bb FACTORS=0.0,0.2,0.4,0.6,0.8,1.0 PACE=1000 HISTORY=exchanges.dat
Though the repetition may be undesirable… But the case where we are using different scalings of the same bias seems more like a special case than the general case. What do you think?
Thanks @ollyfutur !
Use FILE instead of HISTORY for consistency with, e.g, METAD
Good point
EXCHANGEABLE_BIASVALUE sounds a bit verbose, I wonder if BIASEXCHANGE could do the job
I agree EXCHANGEABLE_BIASVALUE is quite verbose. But I would avoid BIASEXCHANGE or people will associate it immediately with bias exchange metadynamics.
also maybe COEFFICIENTS instead of FACTORS for consistency with COMBINE
Good point
Is there a specific reason to choose the {a b c} notation instead of the usual a,b,c
Both are possible (comma separated or space separated), and equivalent. I prefer to use space separated when there are matrices involved.
About the default COEFFICIENTS, I have to think about it. In the most general case:
-
ARGhas L elements -
COEFFICIENTShas M x N elements
Then, perhaps:
- an empty COEFFICIENTS argument could implicitly be set to an NxN identity matrix.
- a vector COEFFICIENTS argument (with N elements) could implicitly be set to an 1xN matrix
The result would be:
For replica exchange umbrella sampling
EXCHANGEABLE_BIASVALUE ARG=c1,c2,c3,c4,c5,c6 PACE=10000 FILE=exchanges.dat
# equivalent to:
EXCHANGEABLE_BIASVALUE ...
ARG=c1,c2,c3,c4,c5,c6
COEFFICIENTS={
{1 0 0 0 0 0}
{0 1 0 0 0 0}
{0 0 1 0 0 0}
{0 0 0 1 0 0}
{0 0 0 0 1 0}
{0 0 0 0 0 1}
}
PACE=10000 FILE=exchanges.dat
...
For interpolation between two potentials
EXCHANGEABLE_BIASVALUE ...
ARG=bb1,bb2
COMPONENTS={{0.0 1.0} {0.2 0.8} {0.4 0.6} {0.6 0.4} {0.8 0.2} {1.0 0.0}}
# this would interpolate between bb1 and bb2 across six replicas
PACE=1000 FILE=exchanges.dat
...
For scaling across replicas*
EXCHANGEABLE_BIASVALUE ...
ARG=bb
COMPONENTS={0.0 0.2 0.4 0.6 0.8 1.0}
PACE=1000 FILE=exchanges.dat
...
Un
Another suggestion is REPLEX_BIASVALUE
So these "broadcasting rules" for $N$ input CVs and $M$ replicas:
| ARG | COEFFICIENTS | IMPLIED BIASES |
|---|---|---|
| ($1$) $a$ | ($M$) $c_1,c_2,…,c_M$ | $[c_1a\ c_2a\ …\ c_Ma]$ |
| ($M$) $a_1,…,a_M$ | — (default: $1,…,1$) | $[a_1\ …\ a_M]$ |
| ($M$) $a_1,…,a_M$ | ($M$) $c_1,c_2,…,c_M$ | $[c_1a_1\ …\ c_Ma_M]$ |
| ($N$) $a_1,…,a_N$ | ($M×N$) $[[c_{11}\ …\ c_{1N}] … [c_{M1}\ …\ c_{MN}]]$ | $[\sum_n^Nc_{1n}a_n\ …\ \sum_n^Nc_{Mn}a_n]$ |
| ($N$) $a_1,…,a_N$ | ($M$) $c_1,c_2,…,c_M$ | error |
| ($1$) $a$ | — | error |