quantity.observables.init_traj_mean_fn

quantity.observables.init_traj_mean_fn#

init_traj_mean_fn(quantity_key)[source]#

Initialize the computation of a (perturbed) ensemble average.

This function builds the 'traj_fn' of the DiffTRe target dict for the common case of target observables that simply consist of a trajectory-average of instantaneous quantities, such as RDF, ADF, pressure or density.

\[\begin{split}a = \left\langle w(\mathbf r) a(\mathbf r)\right\rangle_{\tilde U},\quad \text{where} \\ w(\mathbf r) = \frac{e^{-\beta (U(\mathbf r) - \tilde U(\mathbf r))}}{\left\langle e^{-\beta (U(\mathbf r) - \tilde U(\mathbf r))}\right\rangle}\end{split}\]
Parameters:

quantity_key – Key referencing the quantity in the computed snapshots.

Return type:

TrajFn

Returns:

Returns a function to compute an ensemble average when given a dictionary of snapshots. Returns a perturbed ensemble average if weights are provided.