-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remaining issues in the GeometryEngine stuff #49
Comments
Why use a rejection sampler here? If we have computed the probability vector |
|
For speeding things up, we have a few possibilities: Compile a list of all torsions and angles and vectorize computations with numpyThis is a bit tricky, but should be straightforward given that all the other positions are fixed. Code the energy terms in CythonThis might be the most straightforward way to recode the existing code. Construct a minimum OpenMM system containing only the relevant atoms, bonds, and torsionsThe trick here is to keep track of the atom mapping and compute the Cartesian positions for rotation around the single torsion, but it could also allow us to do more sophisticated things in the future. |
You might want to return |
We can also refine your For example, the k_eq = bond.type.k*units.kilocalories_per_mole/(units.angstrom**2)
r0 = bond.type.req*units.nanometers
sigma = beta*2.0/np.sqrt(2.0*k_eq/k_eq.unit)
logp = stats.distributions.norm.logpdf(r/r.unit, r0/r0.unit, sigma)
return logp We can use the fact that the reduced potential is k_eq = bond.type.k*units.kilocalories_per_mole/(units.angstrom**2)
r0 = bond.type.req*units.nanometers
return -beta*(k_eq/2.0)*(r-r0)**2 Does ParmEd store If you need k_eq = bond.type.k*units.kilocalories_per_mole/(units.angstrom**2)
r0 = bond.type.req*units.nanometers
sigma = unit.sqrt(1.0 / (beta * k_eq))
return -beta*(k_eq/2.0)*(r-r0)**2 - np.log(np.sqrt(2*pi)*sigma / base_distance_unit) though note that you need this with reference to an arbitrary |
Also, there is a bit of confusion between whether you want the log normalized probability density Here, you seem to be accumulating reduced potentials as |
I would carefully check all your
|
You are returning q = np.exp(-beta*(V/2.0)*(1+np.cos(n*internal_coordinates[2]-gamma)))
return q |
Good point. I had originally done that because I was imagining sampling from a continuous distribution, but it works just as well and is simpler to just treat it as a categorical variable.
I needed to attach units, and I found those units in the documentation. Thanks for the rest of the pointers--you're right, those are errors. I think this code is fairly disorganized and difficult to test, as you've pointed out. I think from your suggestions, the idea of using OpenMM to calculate these potentials is my favorite in the end (it enables a lot of extra stuff, and outsources calculation of the potential). |
Let's not do this quite yet, but thinking ahead to what we would do if we wanted to do this in OpenMM: I bet the easiest way to do this is to use ParmEd where we keep the Topology object (and hence atom numbers) the same, but only include a subset of the force term definitions:
|
It's a bit scattered in terms of what units are in play, but looking at the length_conv = u.angstroms.conversion_factor_to(u.nanometers)
_ambfrc = u.kilocalorie_per_mole/u.angstrom**2
_ommfrc = u.kilojoule_per_mole/u.nanometer**2
frc_conv = _ambfrc.conversion_factor_to(_ommfrc) More generally, I believe AMBER uses
I wonder if there is a way to retrieve parameters with units attached automatically... |
The refactors that are pending are covered in other issues. |
Currently, there are a couple issues with the GeometryEngine, in particular relating to the implementation that uses all angle and torsion potentials when choosing a torsion.
nan
s somehow making their way to the rejection sampler. When a uniform random number is drawn withnan
as the upper limit,numpy
throws an exception. Looking into why this is still happening despite replacingnan
s withinf
.The text was updated successfully, but these errors were encountered: