proteneer / timemachine

Differentiate all the things!
Other
138 stars 17 forks source link

Reduce cost of u_kl computation in HREX #1309

Closed mcwitt closed 2 months ago

mcwitt commented 2 months ago

Builds on #1308, using Potential::execute_batch_sparse introduced in the latter to avoid computing (very likely) unused elements of $u_{kl}$ corresponding to far-away states for a given replica. This introduces a new parameter ~n_neighbor_states~ max_delta_states controlling the number of neighbors on either side of a replica's current state for which to evaluate the potential; 4 seems to be a reasonable value empirically. With 48 windows, this would result in 1/6th of the potential evaluations we do currently, potentially yielding a significant speed boost.

With current defaults, distribution of the number of states a given replica is displaced during a single HREX permutation move (consisting of $K^3$ swap attempts). The probability mass outside the interval [-4, +4] is insignificant:

image

Note: only n_neighbors >= 1 is needed for correctness; as long as this is satisfied, choosing a number that significantly truncates the distributions above will result in slower mixing, but still asymptotically correct sampling.

Benchmarks

image