Output and analysis¶
fes_ml.output
¶
Window output files.
Each window of a run writes one HDF5 file, <output_prefix>_window_<k>.h5. It holds:
reduced_potentials: an array of shape (states, samples). Column n is the reduced potential u = U / kT of sample n of this window, evaluated in every state. A column is added and written to disk at each iteration.provenance: the provenance records of the window (JSON text, see :mod:fes_ml.provenance).- attributes:
format,window,temperature_K,state_labelsandlambda_schedule(JSON text).
:mod:fes_ml.analysis reads these files.
WindowData
dataclass
¶
The content of a window output file.
WindowWriter
¶
Write the output file of one window, one sample at a time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The file to write. |
required |
window
|
int
|
The index of the window. |
required |
temperature_K
|
float
|
The temperature of the window, in kelvin. |
required |
state_labels
|
list of str
|
One label for each state in which the samples are evaluated. |
required |
lambda_schedule
|
dict
|
The lambda schedule of the run. |
None
|
keep_samples
|
int
|
None starts a new file. A number continues the existing file after its first
|
None
|
window_file(output_prefix, window)
¶
The path of the output file of window.
read_window(path)
¶
Read a window output file.
fes_ml.analysis
¶
Free energies from the window outputs, with MBAR.
:func:load_windows reads the output files of the windows and checks that they belong to one run:
one file for each window, the same states, the same temperature and lambda schedule, and the same
setup in the provenance. :func:mbar gives the free energies. The fes-ml-analyse command does
both::
fes-ml-analyse OUTPUT_*/fes_window_*.h5
It also reads the .npy files of fes-ml 0.3 and earlier: one file of shape (states, samples)
for each window, in window order, or one file of shape (windows, states, samples). These files
have no temperature, so give it with temperature_K.
Windows
dataclass
¶
The samples of all the windows of a run.
MBARResult
dataclass
¶
The result of :func:mbar.
delta_f[i, j] is the free energy of state j minus that of state i, in kT, and
d_delta_f[i, j] its statistical uncertainty.
load_windows(paths, temperature_K=None, strict=True)
¶
Read the output files of the windows of a run, and check that they belong together.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
list of str
|
Window output files ( |
required |
temperature_K
|
float
|
The temperature. Needed for |
None
|
strict
|
bool
|
Raise a |
True
|
Returns:
| Type | Description |
|---|---|
Windows
|
|
select_samples(windows, discard=0, stride=1, decorrelate=False)
¶
The samples of each window that go to MBAR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
discard
|
int
|
Remove the first |
0
|
stride
|
int
|
Then keep every |
1
|
decorrelate
|
bool
|
Then find the equilibrated part of each window and keep uncorrelated samples, with
|
False
|
mbar(windows, discard=0, stride=1, decorrelate=False)
¶
The free energies of the states, with MBAR (pymbar).
The samples are chosen with :func:select_samples. Window k must sample state k.
main(argv=None)
¶
The fes-ml-analyse command.