frechet_cell_fire¶
- torch_sim.optimizers.frechet_cell_fire(model, *, dt_max=1.0, dt_start=0.1, n_min=5, f_inc=1.1, f_dec=0.5, alpha_start=0.1, f_alpha=0.99, cell_factor=None, hydrostatic_strain=False, constant_volume=False, scalar_pressure=0.0, max_step=0.2, md_flavor=ase_fire_key)[source]¶
Initialize a batched FIRE optimization with Frechet cell parameterization.
Creates an optimizer that performs FIRE optimization on both atomic positions and unit cell parameters using matrix logarithm parameterization for cell degrees of freedom. This parameterization provides forces consistent with numerical derivatives of the potential energy with respect to cell variables, resulting in more robust cell optimization.
- Parameters:
model (Module) – Model that computes energies, forces, and stress.
dt_max (float) – Maximum allowed timestep
dt_start (float) – Initial timestep
n_min (int) – Minimum steps before timestep increase
f_inc (float) – Factor for timestep increase when power is positive
f_dec (float) – Factor for timestep decrease when power is negative
alpha_start (float) – Initial velocity mixing parameter
f_alpha (float) – Factor for mixing parameter decrease
cell_factor (float | None) – Scaling factor for cell optimization. If None, defaults to number of atoms per batch
hydrostatic_strain (bool) – Whether to only allow hydrostatic deformation (isotropic scaling)
constant_volume (bool) – Whether to maintain constant volume during optimization
scalar_pressure (float) – Applied external pressure in GPa
max_step (float) – Maximum allowed step size for ase_fire
md_flavor ("vv_fire" | "ase_fire") – Optimization flavor. Default is “ase_fire”.
- Returns:
- A pair of functions:
Initialization function that creates a FrechetCellFIREState
Update function that performs one FIRE step with Frechet derivatives
- Return type:
Notes
md_flavor=”vv_fire” follows the original paper closely, including integration with Velocity Verlet steps. See https://doi.org/10.1103/PhysRevLett.97.170201 and https://github.com/Radical-AI/torch-sim/issues/90#issuecomment-2826179997 for details.
md_flavor=”ase_fire” mimics the implementation in ASE, which differs slightly in the update steps and does not explicitly use atomic masses in the velocity update step. See https://gitlab.com/ase/ase/-/blob/66963e6e38/ase/optimize/fire.py#L164-214 for details.
Frechet cell parameterization uses matrix logarithm to represent cell deformations, which provides improved numerical properties for cell optimization
This method generally performs better than standard unit cell optimization for cases with large cell deformations
To fix the cell and only optimize atomic positions, set both constant_volume=True and hydrostatic_strain=True