  Cosmic rays can interact with the solar atmosphere and produce a slew of
secondary messengers, making the Sun a bright gamma-ray source in the sky.
Detailed observations with Fermi-LAT have shown that these interactions must be
strongly affected by solar magnetic fields in order to produce the wide range
of observational features, such as high flux and hard spectrum. However, the
detailed mechanisms behind these features are still a mystery. In this work, we
tackle this problem by performing particle interaction simulations in the solar
atmosphere in the presence of coronal magnetic fields modelled using the
potential field source surface (PFSS) model. We find that the low-energy (~GeV)
gamma-ray production is significantly enhanced by the coronal magnetic fields,
but the enhancement decreases rapidly with energy. The enhancement is directly
correlated with the production of gamma rays with large deviation angles
relative to the input cosmic-ray direction. We conclude that coronal magnetic
fields are essential for correctly modeling solar disk gamma rays below 10GeV,
but above that the effect of coronal magnetic fields diminishes. Other magnetic
field structures are needed to explain the high-energy disk emission.
