pyrevs.strategies.gktl.extension

An extension class for the GKTL strategy.

Classes

GKTLDatabaseExtension

An extension class for the GKTL strategy.

Module Contents

class GKTLDatabaseExtension[source]

Bases: pyrevs.database.StrategyDatabaseExtension

An extension class for the GKTL strategy.

An extension of the database to store GKTL-specific data. To be able to checkpoint a sampling run with GKTL, and to compute unbiased estimates from the biased ensemble, one need to store/read the following attributes.

At each resampling step n, the clone weights are W_i = exp(k * dA_i) and the normalization factor is R_n = mean(W_i). The (unbiased) estimate of the expectation of an observable O of the trajectories is then:

E[O] = 1/N sum_i O_i exp(-log_tilt_i) prod_n R_n

where log_tilt_i = k * sum_n dA_i,n along the ancestry of clone i.

Variables:
  • _iteration_count – number of completed resampling steps

  • _cur_time – time of the last resampling step

  • _k – the bias amplitude

  • _log_norm – log of the normalization factor R_n of each resampling step

  • _log_tilt – accumulated log-tilt of each clone along its ancestry

  • _window_start – start time of the current resampling interval for each clone

  • _ancestors – parent index of each clone, for each resampling step

  • _times – time of each resampling step

initialize(tdb: pyrevs.database.Database, k: float) → None[source]

Initialize the GKTL database extension.

If an on-disk database with GKTL metadata already exists, the extension state is read from disk to enable restarts.

Parameters:
  • tdb – the core trajectory database

  • k – the bias amplitude

initialize_from_database(tdb: pyrevs.database.Database) → None[source]

Initialize the GKTL database extension from an existing database.

Parameters:

tdb – the core trajectory database

serialize() → None[source]

Serialize the extension.

deserialize() → None[source]

Deserialize the extension.

iteration_count() → int[source]

Return the number of completed resampling steps.

current_time() → float[source]

Return the time of the last resampling step.

window_start() → list[float][source]

Return the start time of the current resampling interval for each clone.

ancestors() → list[list[int]][source]

Return the parent index of each clone, for each resampling step.

log_normalization() → list[float][source]

Return the log of the normalization factor of each resampling step.

record_resampling(delta_a: numpy.typing.NDArray[numpy.number], parents: list[int], window_start: list[float], time: float) → None[source]

Record a resampling step and update the clones tilt.

Parameters:
  • delta_a – the observable increment of each clone over the interval (before resampling)

  • parents – the parent index of each clone after resampling

  • window_start – the start time of the next interval for each clone

  • time – the time of the resampling step

clone_weights() → numpy.typing.NDArray[numpy.number][source]

Return the estimator weight of each clone in the current ensemble.

The weights sum to one in expectation (exactly for k = 0).

get_exceedance_probability(threshold: float) → float[source]

Return the probability that the score maximum exceeds a threshold.

Parameters:

threshold – the score threshold

Returns:

the unbiased estimate of P(max score >= threshold)

get_event_probability() → float[source]

Return the event probability.

The event is the convergence of the trajectory (i.e. reaching the target score) within the sampling end time. Without a target score, trajectories never converge and the probability is zero.