OpenFreeEnergy / feflow

Recipes and protocols for molecular free energy calculations using the openmmtools/perses and Open Free Energy toolkits
MIT License
13 stars 1 forks source link

Create test TestNonequilibriumCyclingProtocol that uses Gaussian random numbers to quickly generate analyzable test data #67

Open jchodera opened 1 week ago

jchodera commented 1 week ago

In order to test our workflows, we might want to implement a very fast Protocol that generates valid nonequilibrium cycling data with analytically known results and very fast execution times.

To do this, we can sample from two harmonic oscillators with a specific free energy difference and transformation difficulty (which arises from the stddev of work values).

We can use HarmonicOscillatorsTestCase from pymbar.testsystems to do this, using code like this:

    # Generate analytical samples
    >>> testcase = HarmonicOscillatorsTestCase(O_k=[0, 1], K_k=[1, 2])
    >>> w_F, w_R, N_k = testcase.sample(N_k=[40, 50], mode='wFwR')
    # Get true free energies
    >>> analytical_free_energies = testcase.analytical_free_energies()

To make sure the free energies are reproducible, we could extract the dimensionless harmonic oscillator centers (O_k) and spring constants (K_k) for each harmonic oscillator from the transformation inputs so that they are deterministic and depend on the inputs for each ligand.