desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
27 stars 12 forks source link

NaN appearing in gradient when initializing magnet strength to zero #79

Closed cr-xu closed 9 months ago

cr-xu commented 9 months ago

In the example notebook, if one set quadrupole strenght to zero, gradient will have NaNs and the optimisation fails

This is likely due to the if-statement in the base_rmatrix