  We calculate the electromagnetic fields generated in small systems by using a
multiphase transport (AMPT) model. Compared to $A+A$ collisions, we find that
the absolute electric and magnetic fields are not small in $p$+Au and $d$+Au
collisions at energies available at the BNL Relativistic Heavy Ion Collider and
in $p$+Pb collisions at energies available at the CERN Large Hadron Collider.
We study the centrality dependencies and the spatial distributions of
electromagnetic fields. We further investigate the azimuthal fluctuations of
the magnetic field and its correlation with the fluctuating geometry using
event-by-event simulations. We find that the azimuthal correlation
$\left\langle \cos2(\Psi_B - \Psi_{2}) \right\rangle$ between the magnetic
field direction and the second harmonic participant plane is almost zero in
small systems with high multiplicities, but not in those with low
multiplicities. This indicates that the charge azimuthal correlation,
$\left\langle \cos(\phi_{\alpha}+\phi_{\beta} - 2\Psi_{RP}) \right\rangle$, is
not a valid probe to study the chiral magnetic effect (CME) in small systems
with high multiplicities. However, we suggest searching for possible CME
effects in small systems with low multiplicities.
