# Using minimum distance for umbrella sampling

**URL:** <https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149>\
**Category:** User discussions\
**Tags:** umbrella-sampling\
**Created:** [May 25, 2025, 11:47pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149 "2025-05-25T23:47:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [May 25, 2025, 11:47pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/1 "2025-05-25T23:47:53Z")

</div>

GROMACS version:  
GROMACS modification: No  
Hi everyone,

Is it possible to **logically use the minimum distance** between two groups as the **pulling coordinate** for **umbrella sampling**? Also, if yes, is it possible to use gmx wham for these simulations?

I ran stationary umbrella sampling simulations with the minimum distance as pulling coordinate between two groups with PLUMED, but now, when I want to calculate the PMF, I get this:

Command line: gmx\_mpi wham -ix metadata.dat -o pmf\_output.xvg -it tpr-files.dat  
**Fatal error: This is not a tpr with COM pulling**

I am not sure now if using minimum distance as the coordinate was right in the first place. I appreciate your help and insight.

Best,

---

<div class="post-metadata">

**Author:** ![lmullender](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lmullender](https://gromacs.bioexcel.eu/u/lmullender)\
**Post date:** [May 27, 2025, 9:42am UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/2 "2025-05-27T09:42:42Z")

</div>

Hi!  
I haven’t tried running umbrella sampling simulations with PLUMED, but it seems like you’re mixing a couple things up here.  
It would be helpful to see your `.mdp` and `plumed.dat` files to see exactly where your misunderstanding lies, but in any case, a minimum distance is **not** a valid pull coordinate. At least I can’t think of a case where it would be. A _distance_ is, though! Think about what you’re trying to do here: you want to calculate the PMF/free energy profile _along_ a given reaction coordinate. How would that work for just one (local) minimum along a distance measure? But even calculating the minimum of your pulling coordinate in your simulation is not meaningful, because that depends entirely on where you positioned your umbrella potentials. A more meaningful quantity would be the distance at which the PMF assumes its minimum, for example.

Regarding the actual error you’re getting, I would think this is because you performed the umbrella sampling with PLUMED, so GROMACS doesn’t know anything about how it’s set up. You don’t need PLUMED to perform umbrella sampling in GROMACS, but if you want to I would suggest looking at one of their tutorials. Here’s a link to a [GROMACS tutorial on umbrella sampling](https://tutorials.gromacs.org/umbrella-sampling.html).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [May 27, 2025, 2:38pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/3 "2025-05-27T14:38:23Z")

</div>

Hi,

Thanks a lot. I appreciate your help. My umbrella sampling simulations are stationary and independent. I then want to combine them with WHAM to calculate their PMF.

The reason we considered using the minimum distance was that it would provide more informative insights into the binding properties in my system and yield more accurate windows. However, as our system was very slow, we ultimately decided on the stationary US.

**plumed.dat** :

backbone: GROUP ATOMS=\<backbone\_atoms\>

mindist: ZDISTANCES GROUPA=backbone GROUPB=\<one\_ref\_atom\> MIN={BETA=100.0}

RESTRAINT ARG=mindist.min AT=3.3 KAPPA=1000.0

PRINT ARG=mindist.min FILE=COLVAR STRIDE=1000

And this is my **mdp file** :  
title = Umbrella sampling  
; Run parameters  
integrator = md  
dt = 0.002  
tinit = 0  
nsteps = 10000000  
nstcomm = 5000  
; Output parameters  
nstxout-compressed = 5000  
nstenergy = 5000  
; Bond parameters  
constraint\_algorithm = lincs  
constraints = h-bonds  
continuation = yes  
; Single-range cutoff scheme  
cutoff-scheme = Verlet  
nstlist = 10  
ns\_type = grid  
rlist = 1.2  
rcoulomb = 1.2  
rvdw = 1.0  
; PME electrostatics parameters  
coulombtype = PME  
fourierspacing = 0.12  
fourier\_nx = 0  
fourier\_ny = 0  
fourier\_nz = 0  
pme\_order = 4  
ewald\_rtol = 1e-5  
Tcoupl = Nose-Hoover  
tc\_grps = Protein Non-Protein  
tau\_t = 1.0 1.0  
ref\_t = 277 277  
gen\_vel = no  
pbc = xyz  
DispCorr = EnerPres  
freezegrps = ice\_slab  
freezedim = Y Y Y  
**; Pull code**  
**plumed = yes**

All the best,

---

<div class="post-metadata">

**Author:** ![lmullender](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lmullender](https://gromacs.bioexcel.eu/u/lmullender)\
**Post date:** [May 27, 2025, 7:43pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/4 "2025-05-27T19:43:35Z")

</div>

Ah sorry, I misunderstood what you meant by minimum distance, I see how this could be useful now.  
If the `ZDISTANCES` function is differentiable (which I think it should be, looking at the documentation), then this could indeed be meaningful.  
However, it seems like `gmx wham` will only work on tpr files where pulling is active (i.e. `pull=yes` is specified in the map), as would be the case for a purely GROMACS umbrella sampling simulation. You’ll have to combine your simulation using an implementation of WHAM e.g. in Python.

---

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [May 27, 2025, 7:46pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/5 "2025-05-27T19:46:20Z")

</div>

Apologies for the confusion.

Sounds good. Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [May 28, 2025, 7:21am UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/6 "2025-05-28T07:21:46Z")

</div>

Hello,

I think you are right as probably the .tpr is used to get the information of the systems, length of simulations, and position of starting windows?

One thing you can try, @kimiasnn , is to compile those tpr files and pass them to `gmx wham`. So, if window i of a PLUMED simulation starts at position z\_i, use the starting frame to compile the corresponding tpr file with a mdp that has the pull code active with the same biasing potential as PLUMED (`umbrella` with the same `k` for the spring) so you pass the information to `gmx grompp` about the restraint in place and then try to use these tpr files to run `gmx wham`.

---

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [June 1, 2025, 8:12pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/7 "2025-06-01T20:12:36Z")

</div>

Hi,  
Thanks a lot.

So if I understood right, you mean I can once generate the .tpr files with the umbrella.mdp file using the conf0. But then, what would happen to my minimum distance for my reaction coordinate? Would it generate the right windows?

I am obtaining WHAM from [Alan Grossfield’s site](http://membrane.urmc.rochester.edu/?page_id=126). I am testing it now, and I will get back if it works.

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [June 4, 2025, 7:42am UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/8 "2025-06-04T07:42:32Z")

</div>

In theory the `grompp` command writes the distances of the groups when you pass an mdp file with the pull code on, so you should be able to verify that the distances are correct. But there are too many ifs, I would say go ahead with the script, as it might be safer in terms of analysis.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [June 4, 2025, 8:03am UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/9 "2025-06-04T08:03:49Z")

</div>

You need to use tools from PLUMED, not GROMACS, to analyze PLUMED output.

I don’t know if using the minimum distance is a good reaction coordinate. I would think that that leads to large degeneracy.

---

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [June 4, 2025, 5:15pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/10 "2025-06-04T17:15:46Z")

</div>

Thanks a lot. In what sense do you think using minimum distance would cause degeneracy as a good reaction coordinate?  
We were thinking for understanding binding/unbinding to a surface, the minimum distance would be more informative.

I appreciate your insight.

---

<div class="post-metadata">

**Author:** ![kimiasnn](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kimiasnn](https://gromacs.bioexcel.eu/u/kimiasnn)\
**Post date:** [June 4, 2025, 5:18pm UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/11 "2025-06-04T17:18:27Z")

</div>

It seems to be working. I created a metadata file to calculate the PMF where it has the address to the COLVAR files (time vs min distance), restraint position and spring constant.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [June 5, 2025, 8:30am UTC](https://gromacs.bioexcel.eu/t/using-minimum-distance-for-umbrella-sampling/12149/12 "2025-06-05T08:30:43Z")

</div>

Taking the minimum distance to the surface would make sense. I would need to think more about the implications of taking the minimum distance over atoms in the molecule.

But I would think that using the minimum distance as a reaction coordinate in biased simulations would be problematic, as the force only works between the closest atoms and would instantaneously jump from one atom to another when the distances change slightly. This will lead to extreme jump in forces and bad integration.
