  We explain the algorithm employed in SHADOW4 to generate bending magnet
sources. We provide an overview of the fundamental equations used to calculate
the spectral and angular distributions of synchrotron emission from bending
magnets. We outline the procedures for ray sampling. We present examples for
intensity and polarization of the bending magnet at the old ESRF1 storage ring,
and phase spaces for the bending magnet of the upcoming ALSU ring. Finally, we
discuss the calculation of the effective source size and compare it with ray
tracing.
