proteneer / timemachine

Differentiate all the things!
Other
138 stars 17 forks source link

Improvements for chiral restraints and various bugfixes #1255

Closed proteneer closed 8 months ago

proteneer commented 8 months ago

This PR addresses #1243 to more robustly handle the initialization and interpolation of angle terms in dummy atoms. Three big changes:

1) If a dummy angle term is involved in a chiral restraint, it is weakened to a force constant of 10 kJ/mol at the dummy end-state 2) Chiral restraints are turned on, log linearly, from lambda=0.0 to 0.2 3) The angle terms are staggered to be turned on from lambda=0.2 to 0.7 as opposed to lambda=0.0 to lambda=0.7 4) Stagger bond/angle/chiral_atoms/torsions to be turned on properly

Misc changes: 1) Fixed a plotting bug in detail_overlap where the first window was shoved to the end and mislabelled as -1 -> 0. (plot_axis was off by 1) 2) Improve histogram range and bins for the detail_overlap 3) Fix dummy group improper torsion bug, no idea how this code ever worked

TBD:

1) To address the [Maybe] above, investigate how strong a chiral restraint has to be to flip over a mis-initialized geometry. 2) Decide if we should leave chiral restraints that are defined purely over dummy atoms to always be turned on. Right now all dummy atom chiral restraints are turned off.

Todo:

proteneer commented 8 months ago

(requested a preliminary review before adding more extensive tests)

proteneer commented 8 months ago

"chiral atom restraints may not win if in conflict with harmonic angle terms"

To be clear, I'm not actually sure if our current force constants, when fully turned on, will or will not win over the angle terms.

The problem is slightly more subtle and pertains specifically to interpolation:

In master, for the CH3 moeity in the test case, at the lambda=0 state, the harmonic angle terms are fully turned on, and the chiral volumes are fully turned off. The initialization of the hydrogens surrounding the CH3 is arbitrary in the absence of chiral restraints, when the angle terms are fully turned on, we cannot sample between the different chiral states.

"bad interactions between angle terms and chiral volume terms"

I don't think there are bad interactions between angle terms and chiral volume terms that are fully turned on. But again, I need to verify that chiral volumes, parameterized at k=1000 can always win over angle terms under typical MD settings (for vacuum), and win over intermolecular nonbonded terms (for complex/solvent).

proteneer commented 8 months ago

Some more things I want to address:

Leave on more chiral restraint terms between dummy atoms, and dummy-core atoms that do not affect factorizability. I think it's always safe to leave a chiral restraint term turned on if it involves exactly a single anchoring core atom. Not sure about the other situations.

proteneer commented 8 months ago

Fixed a ton of random bugs Reworked the logic for rescaling dummy group angles Added some simple tests

proteneer commented 8 months ago

(Merging this monstrosity in - will submit another PR with various improvements)