BFEE2.postTreatment

exception BFEE2.postTreatment.RStarTooLargeError(arg)[source]

Bases: RuntimeError

class BFEE2.postTreatment.postTreatment(temperature, unit, jobType='geometric')[source]

Bases: object

the post-treatment of BFEE outputs

LDDMBindingFreeEnergy(colvars_tmp_path, cvtrj_path, step1_fepout_path, steps_per_window, equilbration_steps_per_window, num_windows, step3_fepout_path, temperature=300, jobType='fep')[source]

calculate binding free energy for LDDM

Parameters:
  • colvars_tmp_path (str) – path to colvars tmp file of step 1

  • cvtrj_path (str) – path to colvars.traj file of step 1

  • step1_fepout_path (str) – path to fepout file of step 1

  • steps_per_window (int) – steps per FEP window of step 1

  • equilbration_steps_per_window (int) – equilibration steps per FEP window of step 1

  • num_windows (int) – number of windows of step 1

  • step3_fepout_path (str) – path to fepout file of step 3

  • temperature (float) – temperature of the simulation, defaults to 300

  • jobType (str, optional) – Type of the post-treatment method. ‘fep’ or ‘bar’. Defaults to ‘fep’.

Returns:

np.array, float, 2: (contributions for step1, and step 3) np.array, float, 2: errors corresponding each contribution

Return type:

tuple

alchemicalBindingFreeEnergy(filePathes, parameters, temperature=300, jobType='fep', rigidLigand=False)[source]

calculate binding free energy for alchemical route

Parameters:
  • filePathes (list of strings, 8) – pathes of alchemical output files (step1-forward, step1-backward, step2-forward …)

  • parameters (np.array, floats, 9) – (eulerTheta, polarTheta, r, forceConstant1, FC2, FC3, FC4, FC5, FC6)

  • temperature (float) – temperature of the simulation

  • jobType (str, optional) – Type of the post-treatment method. ‘fep’, ‘bar’ or ‘pmf’. Defaults to ‘fep’.

  • rigidLigand (bool) – whether dealing with a rigid ligand. Default to False.

Returns:

np.array, float, 6: (contributions for step1, 2, 3, 4, bulk restraining contribution, free energy) np.array, float, 6: errors corresponding each contribution

Return type:

tuple

alchemicalFreeEnergy(forwardFilePath, backwardFilePath='', temperature=300, jobType='fep')[source]

parse a pair of fepout file, or a single double-wide file using the py_bar library

Parameters:
  • forwardFilePath (str) – path to the forward fepout file

  • backwardFilePath (str) – path to the backward fepout file. Empty string corresponds to a double-wide simulation

  • temperature (float) – temperature of the simulation

  • jobType (str, optional) – Type of the post-treatment method. ‘fep’, ‘bar’ or ‘pmf’. Defaults to ‘fep’.

Returns:

free-energy change, error

Return type:

tuple[float, float]

alchemicalFreeEnergyPMF(PMFfile)[source]

parse a .hist.pmf file, and return the free energy change

The hist.pmf file contains multiple PMF snapshots at different times, separated by comment lines starting with ‘#’. Each snapshot has two columns: lambda value and free energy.

The free energy is calculated from the last snapshot (G_end = last_value - first_value). The error is estimated using extrapolation from the middle snapshot: error = std([G_1/2, 2*G_end - G_1/2])

Parameters:

PMFfile (str) – path to the .hist.pmf file

Returns:

free-energy change, error

Return type:

tuple[float, float]

geometricBindingFreeEnergy(filePathes, parameters)[source]

calculate binding free energy for geometric route

Parameters:
  • filePathes (list of strings, 8) – pathes of PMF files for step1 - step8. PMFs for steps 1 and 8 can be omitted, which indicates the investication of a rigid ligand.

  • parameters (np.array, floats, 8) – (forceConstant1, FC2, FC3, FC4, FC5, FC6, r*, FC8)

Returns:

(contributions for step1, 2, 3, 4 … 8, bulk restraining contribution, free energy)

Return type:

np.array, float, 10

geometricBindingFreeEnergyHistPMF(filePathes, parameters)[source]

calculate binding free energy and errors for geometric route using History PMFs

The free energy is calculated from the last frame of each History PMF. The error for each step is estimated using: np.std([G_1/2, G_1 * 2 - G_1/2]) where G_1/2 is the result from the middle frame and G_1 is from the last frame. The total error is computed using error propagation: sqrt(sum of squared errors).

Parameters:
  • filePathes (list of strings, 8) – pathes of History PMF files for step1 - step8. PMFs for steps 1 and 8 can be omitted, which indicates the investication of a rigid ligand.

  • parameters (np.array, floats, 8) – (forceConstant1, FC2, FC3, FC4, FC5, FC6, r*, FC8)

Returns:

np.array, float, 10: (contributions for step1, 2, 3, 4 … 8, bulk restraining contribution, free energy) np.array, float, 10: errors corresponding to each contribution

Return type:

tuple