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:
OptimStateState 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:
positions (Tensor)
masses (Tensor)
cell (Tensor)
atomic_numbers (Tensor)
charge (Tensor | None)
spin (Tensor | None)
system_idx (Tensor | None)
_constraints (list[Constraint])
forces (Tensor)
energy (Tensor)
stress (Tensor)
hessian (Tensor)
prev_forces (Tensor)
prev_positions (Tensor)
alpha (Tensor)
max_step (Tensor)
n_iter (Tensor)
atom_idx_in_system (Tensor)
max_atoms (Tensor)