  Rapidity-odd directed flow in heavy ion collisions can originate from two
very distinct sources in the collision dynamics i. an initial tilt of the
fireball in the reaction plane that generates directed flow of the constituents
independent of their charges, and ii. the Lorentz force due to the strong
primordial electromagnetic field that drives the flow in opposite directions
for constituents carrying unlike sign charges. We study the directed flow of
open charm mesons $D^0$ and $\overline{D^0}$ in the presence of both these
sources of directed flow. The drag from the tilted matter dominates over the
Lorentz force resulting in same sign flow for both $D^0$ and $\overline{D^0}$,
albeit of different magnitudes. Their average directed flow is about ten times
larger than their difference. This charge splitting in the directed flow is a
sensitive probe of the electrical conductivity of the produced medium. We
further study their beam energy dependence; while the average directed flow
shows a decreasing trend, the charge splitting remains flat from
$\sqrt{s_{NN}}=60$ GeV to $5$ TeV.
