  This paper presents the muon momentum calibration and performance studies for
the ATLAS detector based on the $pp$ collisions data sample produced at
$\sqrt{s}$=13 TeV at the LHC during Run 2 and corresponding to an integrated
luminosity of 139 fb$^{-1}$. An innovative approach is used to correct for
potential charge-dependent momentum biases related to the knowledge of the
detector geometry, using the $Z \rightarrow \mu^{+}\mu^{-}$ resonance. The muon
momentum scale and resolution are measured using samples of $J/\psi \rightarrow
\mu^{+}\mu^{-}$ and $Z \rightarrow \mu^{+}\mu^{-}$ events. A calibration
procedure is defined and applied to simulated data to match the performance
measured in real data. The calibration is validated using an independent sample
of $\Upsilon \rightarrow \mu^{+}\mu^{-}$ events. At the $Z$ ($J/\psi$) peak,
the momentum scale is measured with an uncertainty at the 0.05% (0.1%) level,
and the resolution is measured with an uncertainty at the 1.5% (2%) level. The
charge-dependent bias is removed with a dedicated {\em in situ} correction for
momenta up to 450 GeV with a precision better than 0.03 TeV$^{-1}$.
