kups.relaxation.transforms.fire2
¶
Per-system FIRE 2.0 / ABC-FIRE optimizer transform.
Per-system port of the LAMMPS-style FIRE 2.0 algorithm
(Guénolé et al. 2020) with optional ABC-FIRE bias correction
(Echeverri Restrepo & Andric 2023). Every tree reduction (F·v,
v·v, F·F and the dmax ∞-norm) is taken per-system, and the
adaptive dt / alpha / n_pos state is stored as a
Table[K, Array] — one entry per system. Running batched independent
systems through this transform is bit-identical to running them one at a
time.
API convention¶
Following the optax composability pattern, the updates argument to
:meth:ScaleByFire2.update is the descent direction (force
F = -∇L), not the raw gradient. The transform integrates updates
as a force and emits a position step Δx such that
apply_updates(x, Δx) = x + Δx descends.
Convert a raw gradient with a sign-flip transform at the head of the
chain. Per-system L2 clipping on the input force and per-particle Δx
clipping on the output both compose around FIRE 2.0 — the built-in
LAMMPS dmax (max_step) is independent of these:
.. code-block:: python
from kups.relaxation.optimizer import chain
from kups.relaxation.transforms import (
ClipByGlobalNorm, MaxStepSize, ScaleByFire2,
)
import optax
optimizer = chain(
optax.scale(-1.0), # ∇L → F = -∇L
ScaleByFire2(dt_start=0.1), # built-in dmax also active
ClipByGlobalNorm(max_norm=10.0), # per-system L2 force cap
MaxStepSize(max_step_size=0.05), # extra per-particle Δx cap
)
ScaleByFire2
¶
Bases: Optimizer[Params, ScaleByFire2State]
FIRE 2.0 (with optional ABC-FIRE) with per-system block-diagonal state.
Per-system port of the LAMMPS-style FIRE 2.0 integrator described in
Guénolé et al. 2020, with the ABC-FIRE bias correction
(use_abc=True) of Echeverri Restrepo & Andric 2023. With a single
system this reduces to the algorithm from
kups.relaxation.optax.scale_by_fire2; with multiple systems each
system independently adapts its own dt / alpha / n_pos
and sees its own per-system power, norms and dmax.
The transform follows the optax convention: updates passed to
:meth:update is interpreted as the force F = -∇L (the descent
direction). Sign conversion from a raw gradient and any external
clipping live in the surrounding
:func:kups.relaxation.optimizer.chain — see the module docstring
for a worked example. The LAMMPS-style dmax clip configured via
:attr:max_step is internal to FIRE 2.0 and applies on top of any
composed clipping.
Attributes:
| Name | Type | Description |
|---|---|---|
dt_start |
float
|
Initial timestep. |
dt_max |
float
|
Maximum timestep (LAMMPS |
dt_min |
float
|
Minimum timestep (LAMMPS |
max_step |
float | None
|
Per-step displacement bound |
f_inc |
float
|
Factor to grow |
f_dec |
float
|
Factor to shrink |
alpha_start |
float
|
Initial velocity-mixing parameter (LAMMPS |
f_alpha |
float
|
Factor to decay |
n_min |
int
|
Minimum positive-power steps before |
use_abc |
bool
|
If True, apply ABC-FIRE bias correction to the mixing. |
halfstepback |
bool
|
If True, apply |
delaystep_start |
bool
|
If True, suppress |
References
- Guénolé et al., Comput. Mater. Sci. 175, 109584 (2020).
- Echeverri Restrepo & Andric, Comput. Mater. Sci. 218, 111978 (2023).
- LAMMPS
src/min_fire.cpp(develop branch).
Source code in src/kups/relaxation/transforms/fire2.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
ScaleByFire2State
¶
Optimizer state for the per-system FIRE 2.0 transform.
Attributes:
| Name | Type | Description |
|---|---|---|
velocity |
PyTree
|
Velocity estimate, pytree matching the parameters. |
dt |
Table[Any, Array]
|
Per-system adaptive timestep. |
alpha |
Table[Any, Array]
|
Per-system velocity-mixing parameter. |
n_pos |
Table[Any, Array]
|
Per-system count of consecutive positive-power steps
(LAMMPS |
n_total |
Array
|
Scalar — total update steps taken so far (drives
|
index_prefix |
PyTree
|
Tree prefix of the parameter pytree whose leaves are
|