  By taking into account the magnetic field in the extended quantum molecular
dynamics model (EQMD), we analyzed its effects on giant dipole resonance (GDR)
by studying the responses and strengths of the dipole moments. The selected
system is the $^{40}$Ca nucleus which is excited through the Coulomb
interaction by $^{16}$O. Particle acceleration term in Li\'enard-Wiechert
potential is discussed which, however, has small impact on magnetic field. The
peak energy, strength and width of GDR, temperature, and angular momentum of
$^{40}$Ca as a function of beam energy are investigated. It is found that the
magnetic field enhances the peak energy, strength and width of GDR which is not
only due to the temperature effects but also due to the enhancement of the
angular momentum of nucleus. At beam energy {E} $>$ 200 MeV/nucleon, magnetic
field maintains a constant value for the strength of GDR. The work sheds light
on examining important roles of the magnetic field on nuclear structure in
low-intermediate energy heavy-ion collisions.
