Open zhang-ivy opened 2 years ago
Note that Iván generated htfs using the vanilla HybridTopologyFactory
for CCC->CCCC and the energy validation test yields the following results:
with dispersion correction off:
zero state error: 1.96084504011651e-05, one state error: 0.0005264199693243432
with dispersion correction on:
zero state error: -0.8331827929622193, one state error: -0.6370180463873197
so I think the dispersion correction energy discrepancy is likely a problem in the HybridTopologyFactory
as well, since there are two forces handling steric interactions as well.
We discussed this at the perses dev sync 9/6/22 and we decided that we should keep this issue open to address this discrepancy in the future.
When helping @ijpulidos with https://github.com/choderalab/perses/pull/1065, we noted that when generating a
RESTCapableHybridTopologyFactory
for CCC->CCCC or CCCC->CCC, the endstate energy validation test (validate_endstate_energy_point
) was failing due to an energy mismatch in the nonbonded energies:I investigated and found that the energy mismatch comes from the dispersion/long range correction. If I turn the dispersion correction off in the old and new systems (before generating the htf), then the test passes.
I next wondered whether the energy mismatch arises because I split up the steric interactions into separate forces -- one for scaled interactions (
CustomNonbondedForce_sterics
) and one for nonscaled interactions (NonbondedForce_sterics
). Splitting up the interactions across two forces could cause the long range correction to be computed slightly differently than if all interactions were computed in one force.To test this, I commented out these lines that add interaction groups to the CustomNonbondedForce_sterics so that the
CustomNonbondedForce_sterics
now contains all scaled and nonscaled interactions. I then generated a htf, deleted theNonbondedForce_sterics
(previously used for nonscaled steric interactions), and then ran the energy validation test and it passed.Note that this long range correction energy discrepancy only seems to affect the solvent phase for small molecules, not the complex phase. For example, if I run bace2 with ligands 9 and 15 (in data/bace_example/Bace_ligands_shifted.sdf), the test passes:
The nonbonded energies are large enough here that the long range correction discrepancy isn't noticeable, so the test passes.
However, the energy discrepancy is present when I run solvent phase for the same Bace2 ligands:
I am raising this issue so that we can discuss this at the next dev sync. I'm not sure if we want to avoid running small molecule transformations with the
RESTCapableHybridTopologyFactory
in the future, or if we just want to make a note in the docstring of the class / in the tests that this is a known problem.