Skip to content

API reference

The names below are available directly from the fepcert package.

Functions

fepcert.calculate_overlap_matrix(energy_differences_list=None, min_pass_overlap=0.08, min_warn_overlap=0.03, forward_work_list=None, reverse_work_list=None, temperature_k=298.15, unit='kcal/mol')

Overlap between neighbouring lambda states.

Parameters:

Name Type Description Default
energy_differences_list list of np.ndarray

dH/dlambda samples per window. Accepted for backward compatibility only: they do not determine phase-space overlap, and on their own the result is NOT_APPLICABLE.

None
forward_work_list list of np.ndarray

For each neighbouring pair k, k+1: U_{k+1} - U_k on samples of state k, and U_k - U_{k+1} on samples of state k+1, in unit.

None
reverse_work_list list of np.ndarray

For each neighbouring pair k, k+1: U_{k+1} - U_k on samples of state k, and U_k - U_{k+1} on samples of state k+1, in unit.

None
temperature_k float
298.15
unit kcal / mol or kJ / mol
'kcal/mol'
min_pass_overlap float

Thresholds on the smallest neighbouring-pair overlap (0.03 after Klimovich et al. 2015).

0.08
min_warn_overlap float

Thresholds on the smallest neighbouring-pair overlap (0.03 after Klimovich et al. 2015).

0.08

fepcert.calculate_ti_free_energy(lambda_values, gradients_list, unit='kcal/mol')

Computes free energy difference using Thermodynamic Integration (TI) with trapezoidal quadrature.

Parameters:

Name Type Description Default
lambda_values list of float

Sorted lambda schedule from 0.0 to 1.0.

required
gradients_list list of np.ndarray

List of dH/dlambda time-series samples for each lambda window.

required
unit str
'kcal/mol'

Returns:

Name Type Description
result FreeEnergyResult

Total Delta G, error, and cumulative integration curve.

fepcert.calculate_bar_free_energy(lambda_values, forward_work_list, reverse_work_list, temperature_k=298.15, unit='kcal/mol')

Computes free energy differences between adjacent lambda states using Bennett Acceptance Ratio (BAR).

Parameters:

Name Type Description Default
lambda_values list of float

Sorted lambda schedule.

required
forward_work_list list of np.ndarray

Forward Delta U_{k -> k+1} sampled at state k.

required
reverse_work_list list of np.ndarray

Reverse Delta U_{k+1 -> k} sampled at state k+1.

required
temperature_k float
298.15
unit str
'kcal/mol'

Returns:

Name Type Description
result FreeEnergyResult

fepcert.evaluate_time_convergence(lambda_values, gradients_time_series, n_fractions=10, max_pass_hysteresis=0.4, max_warn_hysteresis=0.8, unit='kcal/mol')

Evaluates cumulative forward and reverse TI convergence as a function of simulation time.

Parameters:

Name Type Description Default
lambda_values list of float

Sorted lambda schedule.

required
gradients_time_series list of np.ndarray

Time series arrays of dH/dlambda for each state.

required
n_fractions int

Number of time evaluation checkpoints (10%, 20%, ..., 100%).

10
max_pass_hysteresis float
0.40 kcal/mol
max_warn_hysteresis float

Thresholds are always in kcal/mol; they are converted when the gradients are in kJ/mol.

0.80 kcal/mol
unit str

Unit of the gradients ('kcal/mol' or 'kJ/mol').

'kcal/mol'

Returns:

Name Type Description
result ConvergenceAnalysisResult

fepcert.evaluate_cycle_closure(edges, max_pass_rmse=0.5, max_warn_rmse=0.8, max_length=4)

Evaluates thermodynamic cycle closure errors in a relative binding affinity network.

Parameters:

Name Type Description Default
edges list of dict

{'ligand_a': 'L1', 'ligand_b': 'L2', 'delta_g': 1.25, 'error': 0.15}; 'error' is optional.

required
max_pass_rmse (float, kcal / mol)
0.5
max_warn_rmse (float, kcal / mol)
0.5
max_length int

Longest cycle (number of edges) enumerated.

4
Notes

Repeated edges between the same pair of ligands are combined by inverse-variance weighting when errors are given (by a plain mean otherwise) and counted in n_duplicate_edges.

fepcert.assess_fep_quality(metadata, lambda_values, gradients_list=None, forward_work_list=None, reverse_work_list=None, network_edges=None, temperature_k=298.15, unit='kcal/mol', multi_component=None)

Evaluates alchemical free energy simulation convergence, lambda overlap, and cycle closure.

Parameters:

Name Type Description Default
metadata dict

System description, perturbation (e.g. L1 -> L2), simulation engine (GROMACS, AMBER, OpenMM).

required
lambda_values list of float

Sorted lambda schedule.

required
gradients_list list of np.ndarray

dH/dlambda samples per window for TI.

None
forward_work_list list of np.ndarray

Forward work samples for BAR/MBAR.

None
reverse_work_list list of np.ndarray

Reverse work samples for BAR/MBAR.

None
network_edges list of dict

Edges in chemical perturbation network for cycle analysis.

None
temperature_k float
298.15
unit str
'kcal/mol'
multi_component dict

{'lambda_matrix', 'gradients_by_component', 'components'} for TI along a path in which several lambda components change (as returned by parse_gromacs_dhdl_directory). When both dH/dlambda and work values are given, TI is the reported estimate and the BAR estimate is added to the metadata as a cross-check.

None

Returns:

Name Type Description
report FEPValidationReport

Comprehensive certification report.

Result classes

fepcert.OverlapAnalysisResult dataclass

fepcert.FreeEnergyResult dataclass

fepcert.ConvergenceAnalysisResult dataclass

fepcert.CycleClosureResult dataclass

fepcert.FEPValidationReport dataclass