nvalchemi.enhanced_sampling.UpperWall#

class nvalchemi.enhanced_sampling.UpperWall(cv, threshold, stiffness=10.0, *, name='upper_wall', exponent=2.0, compute_stress=True)[source]#

Penalise the CV for rising above a threshold.

\[E_b = \frac{k}{p}\,\max(s - s_0,\,0)^p\]
Parameters:
  • cv (Callable[[Batch], Tensor]) – Differentiable cv(batch) -> Tensor[B, D].

  • threshold (Tensor | float) – Upper bound s_0.

  • stiffness (Tensor | float) – Penalty prefactor k. Default 10.0.

  • name (str) – Unique bias identifier. Default "upper_wall".

  • exponent (float) – Power p. Default 2.0.

  • compute_stress (bool) – Passed through to ConservativeBias.

Examples

>>> import torch
>>> from nvalchemi.enhanced_sampling import UpperWall, pair_distance
>>> idx = torch.tensor([0, 1])
>>> wall = UpperWall(cv=lambda b: pair_distance(b, idx), threshold=5.0)
>>> wall.name
'upper_wall'
extra_repr()#

Format the model config for nn.Module.__repr__.

Parameters:

self (Any)

Return type:

str