Jiale Shi
unread,Apr 27, 2026, 5:23:09 AM (2 days ago) Apr 27Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to PLUMED users
Dear PLUMED users/developers,
We are encountering a severe performance issue when using PLUMED metadynamics on two CVs derived from a 1600 x 1600 pairwise distance/contact matrix.
The CV-only PLUMED run, where we only evaluate and print the CVs, is fast. However, once we add biasing actions on the same CVs, the simulation becomes approximately 4000 times slower.
Our PLUMED input is:
```plumed
# 1600x1600 pairwise distances
R: DISTANCE_MATRIX GROUP=tip3O CUTOFF=-1
# Adjacency matrix A_ij = 1 / (1 + (r_ij/2.5)^12), with diagonal removed
A: MATHEVAL_MATRIX ARG=R FUNC=(1/(1+(x/2.5)^12))*step(x-1e-6) PERIODIC=NO
# Degree vector d_i = sum_j A_ij
ones: ONES SIZE=1600
deg: MATRIX_VECTOR_PRODUCT ARG=A,ones
# SORT_VECTOR is ascending here: degsort.1 is the smallest d_i
degsort: SORT_VECTOR ARG=deg
# CV1: mean of the largest 10 sorted d_i values
top10mean: COMBINE ARG=degsort.1591,degsort.1592,degsort.1593,degsort.1594,degsort.1595,degsort.1596,degsort.1597,degsort.1598,degsort.1599,degsort.1600 COEFFICIENTS=0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1 PERIODIC=NO
# CV2: mean of 10 sorted d_i values around rank 450
rank450mean: COMBINE ARG=degsort.446,degsort.447,degsort.448,degsort.449,degsort.450,degsort.451,degsort.452,degsort.453,degsort.454,degsort.455 COEFFICIENTS=0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1 PERIODIC=NO
LOWER_WALLS ARG=top10mean AT=1020.0 KAPPA=5000 EXP=2 EPS=1
UPPER_WALLS ARG=top10mean AT=1480.0 KAPPA=5000 EXP=2 EPS=1
LOWER_WALLS ARG=rank450mean AT=665.0 KAPPA=5000 EXP=2 EPS=1
UPPER_WALLS ARG=rank450mean AT=885.0 KAPPA=5000 EXP=2 EPS=1
metad: METAD ARG=top10mean,rank450mean PACE=1000 HEIGHT=0.12 SIGMA=2.00,1.00 BIASFACTOR=15 TEMP=278.15 GRID_MIN=1000.0,650.0 GRID_MAX=1500.0,900.0 GRID_BIN=100,50 FILE=HILLS_TIP3O_top10_r450_r25
PRINT STRIDE=1000 ARG=top10mean,rank450mean,metad.bias FILE=COLVAR_TIP3O_top10_r450_r25
FLUSH STRIDE=1000
```
Therefore, we suspect that the slowdown may be caused by the need to compute and propagate derivatives through the full matrix-based CV when a bias force is applied.
Our main question is:
Is it expected that evaluating this type of CV for printing is fast, but biasing the same CV becomes orders of magnitude slower because PLUMED must compute and propagate derivatives through the full 1600 x 1600 distance/contact matrix and the sorted-degree operation?
If this is the likely cause, what would be the recommended way to make this type of biased simulation faster?
Best,
Jiale