Skip to content

Conversation

@dwhswenson
Copy link
Member

For a very long time, OPS has had the ability to use a Gaussian bias in shooting point selection. That is, given a CV f, the probability of selecting a shooting point x within a given trajectory is proportional to np.exp(-a*(f(x)-x0)**2), where a and x0 are parameters set by the user.

There is no reason for this to be restricted to Gaussians. This PR introduces a BiasedSelector, which allows one to use any function (wrapped in an OPS CV) as the bias function. The only reason this didn't exist before is because when we were writing shooting point selectors, I don't think we understood the flexibility that OPS CVs would have.

Now, for example, the GaussianBiasSelector could be implemented as:

def gaussian(snapshot, cv, a, x0):
    return np.exp(-a * (cv(snapshot)-x0)**2)

cv_gaussian = paths.FunctionCV('shooting_bias', gaussian, cv=my_cv, a=2.0, x0=0.25)
selector = paths.BiasedSelector(cv_gaussian)

But similarly, one could use any other function.

Copy link
Member

@sroet sroet left a comment

Choose a reason for hiding this comment

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

LGTM (assuming codecov is happy)

@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #1024 (d5f1c58) into master (8910ac3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1024   +/-   ##
=======================================
  Coverage   81.17%   81.18%           
=======================================
  Files         139      139           
  Lines       15143    15149    +6     
=======================================
+ Hits        12292    12298    +6     
  Misses       2851     2851           
Impacted Files Coverage Δ
openpathsampling/__init__.py 100.00% <ø> (ø)
openpathsampling/shooting.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8910ac3...d5f1c58. Read the comment docs.

@dwhswenson
Copy link
Member Author

This is ready for review and comment. I will leave it open for at least 24 hours, merging no earlier than Fri 14 May 18:00 GMT (20:00 local).

@dwhswenson dwhswenson merged commit af6be69 into openpathsampling:master May 14, 2021
@dwhswenson dwhswenson deleted the biased-selector branch May 14, 2021 19:34
@dwhswenson dwhswenson mentioned this pull request Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants