Colvars / colvars

Collective variables library for molecular simulation and analysis programs
http://colvars.github.io/
GNU Lesser General Public License v3.0
208 stars 57 forks source link

Why does the harmonicWalls restraint apply on actual CVs instead of extended CVs? #245

Closed HanatoK closed 5 years ago

HanatoK commented 5 years ago

I am a little curious about the harmonic walls implementation with extended Lagrangian dynamics. Is applying the wall potential to actual CVs theoretically better than to extended CVs?

jhenin commented 5 years ago

Very good question. The reason is that is makes it easier to use a histogram-based estimator after eABF. Such estimators (like CZAR) rely on the histogram of the actual CV. If the wall potential is applied to the extended coordinate, then it "bleeds" into the distribution of the actual CV, giving a wrong free energy gradient near the wall.

HanatoK commented 5 years ago

@jhenin Thanks for your answer!

fhh2626 commented 5 years ago

Very good question. The reason is that is makes it easier to use a histogram-based estimator after eABF. Such estimators (like CZAR) rely on the histogram of the actual CV. If the wall potential is applied to the extended coordinate, then it "bleeds" into the distribution of the actual CV, giving a wrong free energy gradient near the wall.

@jhenin What about letting CZAR support the "expandBoundaries" ? Occationally I found adding wall potential on the actual CV leads to strange performance in meta-eABF and extended-Lagrangian-based metadynamics.

giacomofiorin commented 5 years ago

@jhenin can reply on whether it's appropriate to port expandBoundaries to ABF: right now, it's pretty much contained in colvarbias_meta::update_grid_params().

However, I'm missing the connection with the wall potentials.

jhenin commented 5 years ago

I think the problem with expandBoundaries is that it would make the sampling histogram decay to zero at the boundaries, which is acceptable for single-window sampling but not really for stratified sampling, where you want accurate free energy derivatives all the way to the boundaries.