nvalchemi.dynamics.LBFGS#

class nvalchemi.dynamics.LBFGS(model, history_size=_LBFGS_DEFAULTS['history_size'], curvature_eps=_LBFGS_DEFAULTS['curvature_eps'], maxstep=_LBFGS_DEFAULTS['maxstep'], n_steps=None, hooks=None, convergence_hook=None, **kwargs)[source]#

Fixed-cell L-BFGS geometry optimizer.

Parameters:
  • model (BaseModelMixin) – The neural network potential model.

  • history_size (int) – Stored curvature pairs. Must be a positive int; checked at construction. Fixed once state is allocated. Default 6.

  • curvature_eps (float, optional) – Curvature-pair acceptance floor. Default None (by dtype).

  • maxstep (float) – Maximum displacement per step. Not validated: maxstep <= 0 disables the trust region (unbounded step length per nvalchemiops.dynamics.optimizers.lbfgs._alpha_cap()), which is occasionally useful but easy to trigger by accident (e.g. a stray negative sign) since nothing raises. Default 0.2.

  • n_steps (int, optional) – Total steps for run().

  • hooks (list[Hook], optional) – Initial hooks.

  • convergence_hook (ConvergenceHook or dict, optional) – Convergence criterion.

  • by_group (bool, optional) – If True, update each group of graphs as a single unit, sharing curvature history and step scaling across the graphs in that group. Requires a valid layout set with batch.set_group_layout(). A configured convergence hook must use the same by_group setting. Grouped sampling and refill are unsupported. Default False. Forwarded through **kwargs to BaseDynamics.

  • **kwargs – Forwarded to BaseDynamics.

__needs_keys__#

{"forces"}.

Type:

set[str]

__provides_keys__#

{"positions"}.

Type:

set[str]

pre_update(batch)[source]#

Full L-BFGS step using current forces.

Parameters:

batch (Batch) – Current batch; positions updated in-place.

Return type:

None

samples_equilibrium: ClassVar[bool] = False#

A relaxation descends to a minimum rather than sampling an ensemble.