nvalchemi.dynamics.LBFGSVariableCell#

class nvalchemi.dynamics.LBFGSVariableCell(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, *, cell_force_scale=1.0, **kwargs)[source]#

Variable-cell L-BFGS geometry optimizer.

Relaxes atomic coordinates and the cell together, driven by the model’s stress. Cells must be aligned: install AlignCellHook (frequency=1) on this optimizer or its FusedStage, or pass pre-aligned cells. by_group=True is unsupported because cell degrees of freedom remain graph-level.

Parameters:
  • model (BaseModelMixin) – The neural network potential model. Must produce "stress".

  • 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.

  • cell_force_scale (float) – Fixed once state is allocated — unlike FIRE2VariableCell’s cell_force_scale, which is a plain mutable attribute read every step; the two share a name and purpose but not a mutability contract. Multiplier on the atom count normalizing stress-derived cell forces; raise it to move the cell less per step. Default 1.0.

  • **kwargs – Forwarded to BaseDynamics.

__needs_keys__#

{"forces", "stress"}.

Type:

set[str]

__provides_keys__#

{"positions", "cell"}.

Type:

set[str]

property cell_force_scale: float#

Cell-force normalization multiplier; fixed once state is allocated.

pre_update(batch)[source]#

Full L-BFGS variable-cell step using current forces and stress.

Parameters:

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

Return type:

None

samples_equilibrium: ClassVar[bool] = False#

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