BFGSState

class torch_sim.optimizers.state.BFGSState(positions, masses, cell, pbc, atomic_numbers, charge=None, spin=None, system_idx=None, _constraints=<factory>, *, forces, energy, stress, hessian, prev_forces, prev_positions, alpha, max_step, n_iter, atom_idx_in_system, max_atoms)[source]

Bases: OptimState

State for batched BFGS optimization.

Stores the state needed to run a batched BFGS optimizer that maintains an approximate Hessian matrix.

Variables:
  • hessian (Tensor) – Hessian matrix [n_systems, dim, dim] where dim = 3*max_atoms for position-only or 3*max_atoms + 9 with cell filter. May be padded when systems have different sizes.

  • prev_forces (Tensor) – Previous-step forces [n_atoms, 3]. For cell filter, these are scaled forces (forces @ deform_grad) for ASE compatibility.

  • prev_positions (Tensor) – Previous-step positions [n_atoms, 3]. For cell filter, these are fractional coordinates for ASE compatibility.

  • alpha (Tensor) – Initial Hessian scale (stiffness) [n_systems]

  • max_step (Tensor) – Maximum step size per atom [n_systems]

  • n_iter (Tensor) – Per-system iteration counter [n_systems] (int32)

  • atom_idx_in_system (Tensor) – Index of each atom within its system [n_atoms]

  • max_atoms (Tensor) – Atoms per system [n_systems] - used for size-binned eigendecomp

Parameters: