Ray-tracing Simulations and Spectral Models of X-Ray Radiation in Dusty Media

Dust can play an important role in shaping the X-ray spectra and images of astrophysical sources. In this work we report on the implementation of dust in the ray-tracing platform RefleX. We illustrate the different effects associated with the interaction between X-ray photons and dust grains, such as dust scattering, near-edge X-ray absorption fine structures, and shielding. We show how the cross sections of the photon–gas interaction change depending on the fraction of metals in dust grains (i.e., the dust depletion factor). We compare RefleX simulations to the most widely used absorption model that includes dust and show how X-ray spectra are affected by the presence of dust in the absorbing/reprocessing medium for different geometries. We also show how RefleX can be used to reproduce the dust scattering halos observed in Galactic sources, and we release the first torus X-ray spectral model that considers dust absorption and scattering (RXTorusD), to reproduce the spectra of active galactic nuclei (AGNs). RXTorusD also considers other physical processes that are not included in the most widely used AGN torus models, such as Rayleigh scattering and scattering on molecular gas, which can lead to remarkable differences in the predicted X-ray spectra for the same set of geometrical and physical parameters.


INTRODUCTION
X-ray emission is an ubiquitous signature of accretion, and can be observed in a wide range of astrophysical phenomena, from protoplanetary disks (e.g., Feigelson & Montmerle 1999;Kastner et al. 2002), to Xray binaries (e.g., Remillard & McClintock 2006) and massive black holes (e.g., Rees 1984;Mushotzky et al. 1993).This X-ray radiation can be strongly affected by the interstellar medium (ISM; e.g., Ryter et al. 1975;Schattenburg & Canizares 1986;Willingale et al. 2013), and a good understanding of the effect of the ISM on the X-ray spectra of cosmic sources is crucial to both accurately constrain their intrinsic X-ray properties and to shed light on the characteristics of the ISM itself.
The ISM is composed by material in different phases: atomic, molecular and dust (e.g., Wilms et al. 2000), and its cross-section is the sum of these three components: σ ISM = σ atomic + σ molecular + σ dust .Depending Corresponding author: Claudio Ricci & Stéphane Paltani claudio.ricci@mail.udp.cl;stephane.paltani@unige.chon its phase, the gas can have different effects on the Xray radiation.About half of the hydrogen in the Galaxy is in atomic form, but it is not uniformly distributed (Shull & Beckwith 1982), and typically a molecular gas fraction of f H2 ≃ 20% is assumed (e.g., Wilms et al. 2000), although in some clouds this value could be significantly higher (e.g., f H2 ≃ 50 − 70%; Shull et al. 2021).In the Milky Way about 1% of the mass of the ISM is in form of dust (e.g., Bohlin et al. 1978), a similar value is found in other galaxies with consistent metallicity (e.g., Rémy-Ruyer et al. 2014).Dust grains form from metals in the ISM, depleting them from the gas phase (e.g., Savage & Sembach 1996).Depletion can be inverted when dust is destroyed, for example by blast waves from supernovae (e.g., Jones et al. 1994) or by dust sublimation (e.g., Suganuma et al. 2006).Dust participates in the different phases of the galaxy growth process.Dust grains are fundamental for gas cooling (e.g., Schneider et al. 2002;Omukai et al. 2005), which is a crucial step in the process of stellar and planet formation.Dust is also very important for the feedback process in galaxies, allowing the ISM to react to the ra-diation emitted by star-forming regions (Murray et al. 2005) or by accreting supermassive black holes (SMBHs) at relatively low values of the Eddington ratio (e.g., Fabian et al. 2008Fabian et al. , 2009;;Ricci et al. 2017aRicci et al. , 2022)).
Dust can play an important role in the X-rays (e.g., Wilms et al. 2000;Draine 2003a; Lee et al. 2009;Costantini & Corrales 2022), absorbing and scattering X-ray photons.Since photoelectric absorption in the X-rays is associated to metals, having ∼ 70% or more of the metals locked into the dust grains (e.g., Wilms et al. 2000) can strongly affect the absorption process.Dust scattering is preferentially in the forward direction, which can lead to the production of diffuse halos around X-ray sources (e.g., Rolf 1983).These halos have been routinely studied over the past two decades in X-ray binaries (e.g., Costantini et al. 2005;Corrales & Paerels 2015), and have also been proposed as a tool to test dust models (e.g., Smith et al. 2006;Seward & Smith 2013) and to measure distance of nearby galaxies (e.g., Draine & Bond 2004).The presence of dust in the ISM can also leave a clear imprint on X-ray spectra, particularly around some of the main edges.The interference pattern created by the photoelectron waves during the absorption of a X-ray photon in dust grains can in fact give rise to X-ray absorption fine structures (XAFS).These features are expected to be commonly associated to Mg, Si and O (e.g., Costantini et al. 2019;Rogantini et al. 2019Rogantini et al. , 2020;;Psaradaki et al. 2020;Zeegers et al. 2017Zeegers et al. , 2019)), and have been identified in the X-ray spectra of X-ray bright Galactic sources thanks to high-resolution XMM-Newton and Chandra observations (e.g., Lee et al. 2002;Lee 2010;Ueda et al. 2005;de Vries & Costantini 2009;Kaastra et al. 2009;Pinto et al. 2010Pinto et al. , 2013;;Costantini et al. 2012;Valencic & Smith 2013;Psaradaki et al. 2022).The presence of dust in the ISM could lead to significant biases when measuring the column density in the direction of X-ray sources with models that do not consider dust absorption and scattering (Corrales et al. 2016;Smith et al. 2016).
Most of the current X-ray models do not include dust.Notable exceptions are the widely used tbabs family of models (Wilms et al. 2000), which however do not consider scattered radiation, and the amol (Pinto et al. 2010), dabs (Wilms et al. 2000;Kaastra et al. 2009) and dust (Draine 2003a) models, that are part of the SPEX package (Kaastra et al. 1996).The SPEX models are based on a large effort to measure the main X-ray properties of dust in the X-ray band (Costantini & de Vries 2013), and currently represent the state-of-the-art.However, these absorption models do not allow for complex geometries, which are of-ten needed to reproduce all the complex features observed in the X-ray spectra of astrophysical sources.The advent of the high spectral resolution instruments on-board XRISM (Resolve, XRISM Science Team 2020) and Athena (X-IFU, Barret et al. 2016) will require improved models, which include all the relevant physical processes, taking into account reprocessed radiation as well as absorbed emission, and that consider realistic geometries of the material around X-ray sources.In this work we report on the implementation of dust absorption and scattering in the ray-tracing platform Re-fleX1 (Paltani & Ricci 2017), which allows to create self-consistent physical models of the environment of Xray sources including dusty gas.

THE NEW VERSION OF REFLEX
RefleX (Paltani & Ricci 2017) is a versatile raytracing code that allows to perform X-ray simulations over a wide range of energies (0.1 keV-1 MeV), considering quasi-arbitrary geometries that can be set by the user.RefleX allows to create complex models, that can be applied to a variety of astrophysical phenomena (e.g., Liu et al. 2019;Andonie et al. 2022;McKaig et al. 2022).In the first two releases, RefleX included most of the physical processes relevant to radiation in the Xray band, such as photoelectric absorption, fluorescence, Compton scattering on free electrons, Rayleigh scattering, Compton scattering on bound electrons and polarization.

Dusty gas in RefleX
The new version of the code (RefleX 3.0) includes the propagation of X-ray photons in a dusty medium.The parameters defining dust are however even more numerous than those defining the properties of the gas phase.Indeed dust is not only defined by the densities of the different atoms, but also by the types of molecules and crystalline structures, as well as the full distribution of grain sizes.Recent analyses (Hensley & Draine 2021) point towards extremely complex dust compositions in our galaxy.It would however be pointless to implement such a huge complexity in RefleX, considering that the parameter space is too large to allow us to have meaningful constraints outside of the Milky Way.For this reason, only a simple, fixed dust model is considered within RefleX, which includes nevertheless all the physical processes associated to the presence of dust.

Element
aneb angr aspl feld grsa lodd lpgp lpgs wilm  (Draine 2003a).The grain size distributions for graphite and olivine adopted in Draine (2003a) have been derived by Weingartner & Draine (2001) for the Milky Way.These distributions are in the form of a power law with indices −1.54 for graphite and −2.21 for olivine starting at 3.5 Å with a modified cut-off at 0.01 and 0.164 µm, respectively.In addition, the graphite distribution presents two additional log-normal components centered at 3.5 and 30 Å respectively.The adopted densities of graphite and silicate grains are 2.24 and 3.5 g cm −3 , respectively.In RefleX, dust is governed by a single parameter (dust) that provides the fraction of iron in the dust phase compared to the total number of iron atoms.We will refer to this parameter as dust depletion in the following.dust 1 means that all iron atoms are in the dust phase, so that none remains in the gas phase.We note that compositions in RefleX can be set arbitrarily, and for certain abundances dust cannot reach one because some of the elements in the dust are fully depleted.For example, the maximum value allowed by RefleX for abundances from Anders & Grevesse (1989) and Wilms et al. (2000) is dust 0.759 and dust 0.691, respectively, for which Silicon is fully depleted.
For an Iron depletion of 0.7, the depletion of Silicon is 0.9 in Wilms et al. (2000), while it is one in our dust model; this is due to a larger fraction of Fe 2 SiO 4 compared to Mg 2 SiO 4 in our dust with respect to the model of Wilms et al. (2000).It should be noted that RefleX calculates the maximum dust depletion, and will not allow the user to set a higher value of the dust parameter.
Unless stated otherwise, throughout the paper we will use the proto-solar abundances of Lodders et al. (2009;lpgs).With these abundances, Carbon, Oxygen, Magnesium, and Silicon are abundant enough that all Iron atoms can be put in the dust phase (dust 1).This is in agreement with recent observational studies, which found that most of the iron in the ISM is found in dust (e.g., Psaradaki et al. 2022).The depletion of the different elements found in the dust grains considered here, for different abundances and for the maximum values of dust allowed, are reported in Table 1.

New physical processes included
Three physical processes are specific to the presence of dust in the X-rays, and are implemented in RefleX: • Scattering on dust grains.While Rayleigh scattering can be considered as scattering on particles of sizes of the same order of magnitude as, or smaller than, the wavelength of the incoming photon, dust particles are significantly larger than the photon wavelength, but not so large that scattering becomes normal optical reflection.Scattering on dust is described by Mie (Wiscombe 1980) and anomalous diffraction (ADT; van de Hulst 1957) theory.For dust grains of radii a, Mie theory is used for 2πa/λ < 2×10 4 , while ADT is considered for 2πa/λ > 2 × 10 4 .Dust scattering is elastic, and mostly forward, with the median scattering angle decreasing as the photon energy increases (Eq.1).The cross-sections and differential crosssection used here are taken from Draine (2003a).
• NEXAFS (Near-Edge X-ray Absorption Fine Structure).The crystalline arrangement of the atoms in dust grains affects the photo-ionization absorption cross-sections near the X-ray edges 2).Photons coming from the right are more likely to be absorbed in the part of the grain shown in blue, which represents schematically the mean free path for these photons.Both photons (γ1 and γ2) are absorbed (green stars) and fluorescence photons ϕ1 and ϕ2 are emitted in both cases in random directions.Photon ϕ1 crosses more material than ϕ2, and is more likely to be absorbed in the dust grain.Similarly, the sketch also illustrates the process of shielding ( §2.2), in which low-energy photons that hit a dust grain are absorbed in the outer part of the grain, and do not "see" the atoms in the center or the other side of the grain.
very close to the transition energy.The precise cross-sections can be computed using the GGADT code (Hoffman & Draine 2016) for any dust composition, shape and size, and could constitute a diagnostic of the precise dust content using very sensitive X-ray spectrometers, like the X-IFU instrument (Barret et al. 2018) on the future X-ray mission Athena (Barcons et al. 2017).The photoionization absorption cross-sections in dust used in RefleX are also obtained from Draine (2003a), which includes the effect of NEXAFS.
Self-shielding is another process that affects the photo-ionization absorption crosssections of dust, and is the effect by which some atoms are hidden from X-ray radiation.This is due to the fact that atoms in dust are very strongly clustered in grains.Therefore, low-energy photons that hit a dust grain will be absorbed in the front part of the grain, and will never "see" the atoms on the other side of the grain (see Fig. 1).The effect of shielding is to decrease the photo-ionization absorption cross-sections at low energies ( 3 keV); at higher energies ( 3 keV), for the dust grain sizes considered here, shielding is minimal (e.g., Wilms et al. 2000).Shielding is implemented in the cross-sections of Draine (2003a) that are used in RefleX.
Dust could also affect the process of fluorescence.Fluorescence from dusty gas could be expected in different astrophysical environments around bright X-ray sources, such as for example a torus around accreting supermassive black holes (e.g., Antonucci 1993;Netzer 2013;Ramos Almeida & Ricci 2017).When a photon is absorbed in an optically-thick grain, absorption will not occur uniformly in the grain, but it will happen more likely close to the surface of the grain.Fluorescent photons are emitted isotropically.However, when a fluorescence photon is created inside a dust grain, the path length through the grain will depend on the direction of the reemitted photon, and there would some directions where the fluorescence photon has more chance of being reabsorbed immediately, which would affect the observed angular distribution of fluorescent photons.This is illustrated in Fig. 1.The effect depends on the size of the grain and the energy of the photons, and will be negligible for the smallest grains.In order to establish the importance of this effect, we simulated using Re-fleX a single grain that we illuminate with X-rays, and checked the direction of outgoing fluorescence photons.We performed a number of simulations of single Carbon and Silicon grains with different photon energies and grain sizes.Figure 2 shows the angular distributions of fluorescence photons (mostly C Kα and Si Kα) in the case of grains illuminated by 0.3 keV (C) or 2 keV (Si) photons for spherical grains with radius 0.1 µm, 1 µm, and 5 µm, respectively.Here we focus primarily on dust grain in the ISM and, at sizes of the order of the maximum grain size in our adopted distribution, no deviation from an isotropic distribution is observed; however, for larger grains, the vast majority of photons are emitted backwards, as expected.We conclude that, for the ISM grains considered here, this effect is insignificant, and thus it is not implemented in RefleX.We point out that this result is not unexpected, as the fluorescence photons are emitted below their respective edge energies, and encounter therefore significantly lower photoelectric cross-sections.We discuss in detail in §4.1 the relation between dust depletion and the production of fluorescent lines.

Cross sections of dusty gas
We illustrate in Fig. 3 the cross-sections of gas for different dust depletions.In the top left panel we show the photo-electric cross-section, which decreases as the dust depletion increases because of the increasing amount of metals in the dust grains.This effect is clearly illustrated in the top left panel of Fig. 4, which shows the   Top left panel: ratio between the photoelectric cross section assuming different dust depletion and that of non-dusty gas.Top right panel: ratio between the scattering cross-section (i.e., Rayleigh, Compton and dust) of dusty and non-dusty gas.Bottom right panel: ratio between the total cross-section of dusty gas and that of non-dusty gas.Bottom left panel: ratio between the total cross-section of dusty gas without dust scattering and that of non-dusty gas.The proto-solar abundances of Lodders et al. (2009) were considered to calculate the cross-sections.The spectral resolution was set to 10 eV.
Figure 5. RefleX simulations versus the two most commonly used absorption models available in xspec.The simulations were carried out assuming that the absorbing material is distributed in a slab, considering different line-of-sight column densities (10 22 , 10 23 and 10 24 cm −2 ), and a spectral resolution of 5 eV.Left panel: RefleX simulations (red lines) versus phabs (grey lines).For consistency, in our simulations dust was not considered, the molecular gas fraction was set to zero, and we turned off fluorescence, Rayleigh and Compton scattering.Right panel: RefleX simulations (red lines) versus tbabs (grey lines).For consistency, dust depletion was set to dust 0.7, while the molecular gas fraction to fH2 = 20%, and the simulations ignored fluorescence, Compton scattering, as well as dust scattering.
ratio between the photoelectric cross-section of dusty and non-dusty gas, for different depletions.At the maximum dust depletion, the photoelectric cross-section decreases up to a factor ∼ 4 with respect to the nondusty gas case.The cross-section of dust is shown in the top-right panel of Fig. 3 for three values of depletion, while in the bottom-left panel we show the dust cross-section without scattering.As expected, the crosssection increase with the dust depletion, as more metals are found in dust grains.Comparing the two figures it is clear that dust scattering contributes significantly to the overall dust cross-section.In the bottom-right panel we show the total cross section of dusty gas for dust 1 (black solid line), together with the contribution of different cross-sections (i.e., photoelectric, Rayleigh, Compton and dust), over a broad range of energies (0.3-200 keV).Dust plays a strong effect below 10 keV (see also top right panel of Fig. 4), and dominates the overall cross-section in the ∼ 3 − 10 keV range.Above ∼10 keV Compton scattering dominates the interaction between photons and gas.
In the bottom right panel of Fig. 4 we show the ratio between the total cross-section of dusty gas and that of non-dusty gas [σ/σ(dust 0)].The strong increase in the cross-section of dusty gas, with the ratio reaching ∼ 2.5 around the Fe edge at ∼ 7 keV, is driven by the contribution of dust scattering.Since dust scattering is preferentially forward, and the scattering angles are typically rather small, this process does not lead to strong changes in the X-ray spectra, although some photons could be lost, while it could give rise to scattering halos (see §4.3).The very large contribution of dust grains to the overall scattering cross section is shown in the top right panel of Fig. 4. To better assess the effect of dust we show, in the bottom left panel of Fig. 4, σ/σ(dust 0) when excluding dust scattering.The figure illustrates clearly the effect of shielding ( §2.2), which can lead to σ/σ(dust 0) < 1, particularly at energies 3 keV.This effect produces a decrease in the number of photons that are absorbed at low energy by dusty gas with respect to non-dusty gas.Another effect that is clear from the figure is the strong increase of the cross-section around the edges of elements that are found in dust (i.e., C, O, Si, Fe), due to the presence of NEXAFS ( §2.2).

COMPARISON WITH PHOTOELECTRIC ABSORPTION MODELS
RefleX was thoroughly tested in Paltani & Ricci (2017), where we compared the results of our simulations to several existing X-ray spectral models, considering different geometries of the reprocessing material, and discussed about the differences, which are due to the larger number of physical processes included into RefleX.In order to further validate this new version of the code, we briefly compare here the new version of RefleX to two of the most-used existing photoelectric absorption models within XSPEC (Arnaud 1996): phabs ( §3.1) ad tbabs ( §3.2).In these simulations we assume a primary X-ray continuum in the form of a power-law with a photon index of Γ = 1.9.

PHABS
We start by benchmarking our simulations with phabs, which considers photoelectric absorption from neutral gas.Therefore, in our RefleX simulations dust was not considered (dust 0), and the molecular gas fraction was set to zero (h2fraction 0).Moreover, to be consistent with the model, our simulations ignored fluorescence, Rayleigh and Compton scattering, which are otherwise included by default in RefleX.This was done by using a functionality of RefleX that allows to turn off some of the physical processes2 .The abundance was set to be the same in both the RefleX simulations and the xspec model (wilm; Wilms et al. 2000).The results of our simulations (red line), together with those obtained using phabs (grey line), are shown in the left panel of Fig. 5 for three different values of column density: N H = 10 22 , 10 23 and 10 24 cm −2 .The agreement between the RefleX simulations and the spectral model is perfect, regardless of the column density.

TBABS
tbabs (Wilms et al. 2000) considers absorption by dust grains, and therefore dust depletion was set to dust 0.7 in our RefleX simulations.To be consistent with the assumption of the model, we set the molecular gas fraction to f H2 = 20%, and used the abundances from Wilms et al. (2000).Since tbabs does not consider fluorescence, Compton and dust scattering, we turned off all these physical processes3 .The comparison between our simulations and tbabs is shown in the right panel of Fig. 5 for three different values of column density.While at N H ∼ 10 23 − 10 24 cm −2 there is an excellent agreement, our RefleX simulations show weaker absorption at 10 22 cm −2 .This difference is associated to the different grain sizes considered in the two codes, which results in a different impact of shielding ( §2.2).The grain size adopted in RefleX follows Draine (2003a; see also Weingartner & Draine 2001; §2.1), while that of tbabs assumes grains with a size distribution following a power law with an index of −3.5 in the 0.025 − 0.25µm size range (Mathis et al. 1977;Draine & Lee 1984).Our choice to use the grain size distribution of Weingartner & Draine (2001) is due to the fact that their model is consistent with several different observables, such as i) the infrared emission from interstellar dust (e.g., Li & Draine 2001), ii) X-ray scattering halos (e.g., Rolf 1983), and iii) optical and UV scattered light (e.g., Draine 2003b).

The effect of dust on fluorescence lines
We examine here the effect of dust on some fluorescence lines that are typically observed in astrophysical sources.We focus on lines that are produced by elements found in the dust grains we considered: oxygen (0.525 keV), magnesium (1.25 keV), silicon (1.74 keV) and iron (6.391 keV and 6.404 keV).We started by assuming a simple scenario with a point-like X-ray source located at 10 17 cm from a slab with a length of 2×10 25 cm and a width of 10 3 cm.This configuration is used to reproduce a situation in which the X-ray source is located close to an extended cloud of dusty gas, and is similar to that assumed in the pexrav model (Magdziarz & Zdziarski 1995) that has been widely used for active galactic nuclei (AGN).We considered two different densities of the slab (5 × 10 19 cm −3 and 10 21 cm −3 ), which resulted into vertical column densities of the disk (i.e., along its shorter side) of 5 × 10 22 cm −2 and 10 24 cm −2 , respectively.The X-ray continuum was generated to have a power-law spectrum with Γ = 1.8 and a cutoff energy of 200 keV (cutoff in Re-fleX), consistent with the typical spectrum of nearby AGN (e.g., Winter et al. 2009;Ricci et al. 2017bRicci et al. , 2018;;Baloković et al. 2020).We considered only photons that underwent at least one fluorescence event in the simulations, selected those observed with an inclination angle of 30 − 35 • with respect to the normal to the slab, and integrated the flux around the emission lines.In the case of the Fe Kα photons we integrated in the range between 6.38 and 6.41 keV to exclude photons that are down-scattered from the Fe Kα doublet into the Compton shoulder.In all simulations we used the abundance table of Wilms et al. (2000;wilm in RefleX).The results are shown in the top and middle panels of Fig. 6, and highlight the small effect of dust on the flux of the fluorescence lines, with the difference with respect to the dust-free simulations being at most ∼ 5%.In particular, the difference is 1% for iron and oxygen.
We also tested a different scenario, in which the X-ray source is surrounded by a torus with an equatorial col-Figure 6. Ratio between the flux of fluorescence lines for RefleX simulations of dusty and non-dusty gas for different dust depletions, geometries and inclination angles.Fluorescence lines from some of the elements contained in the dust grains implemented in the latest version of RefleX are shown: oxygen (0.525 keV), magnesium (1.25 keV), silicon (1.74 keV) and iron (6.391 keV and 6.404 keV).Only photons that underwent at least a fluorescence were selected.Top panel: simulations for a slab with a vertical (i.e.along the shorter side) column density of NH = 5 × 10 22 cm −2 observed at an inclination angle of 30 • with respect to the normal to the slab.Middle panel: same as the top panel for NH = 10 24 cm −2 .Bottom panel: ratio between the flux of Fe produced in dusty and non-dusty gas for different values of dust depletion, assuming a torus with a column density NH = 10 24 cm −2 observed edge-on (80 • ).umn density of N H = 10 24 cm −2 , a covering factor of 0.7 and observed edge-on.This was done collecting photons in the 80 − 85 • range, and applying the same selection criteria we used for the slab, collecting both absorbed and reflected X-ray photons.The results are shown for the Fe Kα line in the bottom panel of Fig. 6.In Fig. 7 we illustrate the X-ray spectra around the Fe Kα line (top panel) and Fe K edge (bottom panel) for different values of the dust parameter.No clear difference is observed in the Fe Kα doublet, nor in its Compton shoulder.On the other hand, a clear difference between the X-ray emission produced in dusty and dust-free gas is found around the Fe K edge, due to the strong effect of the NEXAFS (see §2.2).As expected, the difference increases with the dust depletion, since more iron atoms are found in dust.
Figure 8. Ratio between our RefleX simulations with and without dust, for different dust depletions: 0.5 (green dotdot-dashed lines) and 0.7 (red continuous lines).The spectral resolution was set to 20 eV.The geometrical setup of these simulations includes a torus plus a hollow cone (top three panels) and a sphere (bottom panel).For the torus plus hollow cone geometry the spectra were obtained considering different inclinations: pole-one (0 − 5 • ), intermediate (60 − 65 • ) and edge-on (85 − 90 • ).For the spherical geometry the photons were also selected considering an angle of 5 • .The simulations with dust 1 were shifted by 80 eV for visual clarity.

Comparison with spectroscopical simulations ignoring dust
Here we examine the effect on the broad-band Xray spectra of astrophysical sources of considering or not dusty gas, by simulating complex geometries with RefleX.We explored a few different geometries that are very relevant to AGN, but our results can be extended to any type of source of X-ray radiation.In the simulations we considered the same parameters for the X-ray continuum (i.e., photon index and high-energy cutoff) reported in §4.1, and a molecular fraction of f H2 = 20%.We tested also larger values of the molecular fraction (f H2 = 80%; Willingale et al. 2013) and found that this has only a marginal effect on our simulations.We started by considering a geometry that includes a torus and a hollow cone, i.e. the dusty components used by Andonie et al. (2022) for the ad-hoc X-ray spectral model built with RefleX for the AGN in the Circinus Galaxy, based on high-resolution mid-IR observations (Stalevski et al. 2017(Stalevski et al. , 2019)).The column density of the torus was set to 1.5 × 10 24 cm −2 , while the covering factor to 70%, consistent with what is typically found in local AGN (e.g., Burlon et al. 2011;Ricci et al. 2015Ricci et al. , 2017b)).The hollow cone extends from 0.1 to 40 pc, and has a maximum column density of 3 × 10 22 cm −2 .The ratios between simulations performed assuming this geometry and considering dusty and non-dusty gas are shown in Fig. 8 for different inclination angles and dust depletions.For unobscured lines-of-sight (top panel), the simulations produce consistent results for dusty and non-dusty gas.A clear difference emerges for obscured lines-of-sight (middle panels), particularly around the Fe K edge, and it increases with the line-of-sight N H .For the most obscured and inclined scenarios the ratio between the X-ray spectra of dusty and non-dusty gas shows a dip at ∼ 60% and an excess of up to ∼ 10%.
We also explored a different scenario, in which an Xray source is surrounded by a dense sphere of dusty gas.Such a situation can be found at the center of Luminous and Ultra-luminous IR galaxies (U/LIRGs), where accreting SMBHs are typically completely embedded in a large amount of dusty gas (e.g., Koss et al. 2016;Ricci et al. 2017cRicci et al. , 2021;;Yamada et al. 2021), and possibly in Compact Nuclei (e.g., Aalto et al. 2015Aalto et al. , 2019;;Falstad et al. 2021).We considered that the material is distributed homogeneously in a sphere with a radius of 10 17 cm and a density of 1.5 × 10 7 cm −3 , which results in a column density of 1.5 × 10 24 cm −2 .We selected photons in an interval of 5 • and the results are illustrated in the bottom panel of Fig. 8.The ratio shows the same features observed for the edge-on case of the torus plus hollow cone geometry.

Dust scattering halos
Dust grains strongly increase the scattering cross section of gas (see the top right panel of Fig. 4).The smallangle scatter of X-ray photons off dust in the ISM can produce diffuse emission around a X-ray source (e.g., Overbeck 1965;Hayakawa 1970;Martin & Sciama 1970;Martin 1970).The first of such halos was detected by Rolf (1983) studying Einstein Observatory observations of GX339−4.Further observations, carried out with the Einstein Observatory detected scattering halos around several additional X-ray sources (e.g., Catura 1983;Mauche & Gorenstein 1986, 1989).Following observations with ROSAT (e.g., Predehl & Schmitt 1995), XMM-Newton (e.g., Costantini et al. 2005;Tiengo et al. 2010;Pintore et al. 2017;Jin et al. 2017) and Chandra (e.g., Tan & Draine 2004;Corrales & Paerels 2015;Corrales et al. 2017) detected several more dust scattering halos around Galactic sources.Dust scattering was also recently observed around the brightest gammaray burst detected so far (GRB 221009A; Tiengo et al. 2022).In some variable X-ray sources, the interaction between X-ray photons produced in repeated bursts of radiation and the dust grains can give rise to scattering echoes, that can be observed as rings (e.g., Corrales et al. 2019;Lamer et al. 2021).Such structures have been found around variable Galactic sources (e.g., Heinz et al. 2015).A rapid and strong decrease of the X-ray flux in AGN could give rise to "ghost halos" (Corrales 2015), with the dust scattering halo becoming detectable in the X-rays.These halos typically contain few tens of percent of X-ray flux at a few keV (Predehl & Schmitt 1995), and could be used to infer some fundamental properties of dust in the ISM (e.g., Mauche & Gorenstein 1986;Mathis & Lee 1991;Corrales 2015).
The imaging capabilities of RefleX allow the user to create images of dust scattering halos around astrophysical sources, and the comparison of RefleX simulated X-ray images with observations could be used to improve our understanding of the ISM responsible for the scattering halos (e.g., Draine & Allaf-Akbari 2006;Xiang et al. 2011).While currently RefleX only considers one dust size distribution, it allows the user to set complex geometrical configurations of the dusty gas.As an example of the imaging capabilities of RefleX in the top and middle panel of Fig. 9 we show two images produced assuming a point-like X-ray source absorbed by a slab of dusty gas with a column density of N H = 10 22 cm −2 , considering the abundances of Lodders et al. (2009), dust 1 and a molecular fraction of f H2 = 20%.The scattered photons were selected in the 1-2 keV and 5-10 keV range for the top and bottom panel, respectively.Figure 9. Simulations of a dust scattering halo around an X-ray source.The simulations consider a mono-directional X-ray source and slab of dusty gas (NH = 10 22 cm −2 ; dust 0.7), and have a resolution of 0.54 ′′ .The top and middle panel show images obtained in the 1-2 keV and 5-10 keV range, respectively.Only scattered photons were selected.
The bottom panel shows the spectra extracted using different apertures centered on the source.The spectral simulation was set to 30 eV.
The figures show the scattering halos, that can extend to several hundreds arcseconds from the X-ray source, and the remarkable difference in the size of the scattering halos, which decreases with increasing energy.This is consistent with what expected, according to Draine (2003a), for E 0.5 keV the median scattering angle can be approximated, for the Weingartner & Draine (2001) dust, by: θ s,50 ∼ 360 ′′ keV E . (1) Simulated images using the same configuration, but assuming a dust-free ISM, would show almost no scattered photon around the X-ray source.This is due to the smaller values of the Compton and Rayleigh crosssections (see top right panel of Fig. 4), and to the fact that the angular distributions of Compton and Rayleigh scattering are more isotropic than that of Mie scattering.In the bottom panel of Fig. 9 we show the spectra obtained by extracting the flux using annuli centred on the X-ray source with different apertures.For the annuli with the smallest radii (2−5 ′′ and 10−15 ′′ , black dotted and blue dashed lines, respectively) the spectral shape is very similar to that of the X-ray source (grey continuous line).At larger radii instead the spectral shape starts to deviate from that of the X-ray continuum, becoming increasingly softer as the distance increases (green dot-dashed, red dot-dot-dashed and purple dashed lines for 50 − 60 ′′ , 100 − 200 ′′ and 500 − 1000 ′′ , respectively).
The change in the spectral shape is due to the relation between the median scattering angle and the energy (Eq.1), with softer photons being more easily scattered at larger angles.This softening of the dust-scattered radiation has been observed in X-ray binaries: for the giant dust ring found at ∼ 1 • from MAXI J1348−630, Lamer et al. (2021) inferred a much softer spectrum (Γ ≃ 4) with respect to that expected for the source during the high/soft state (Γ ≃ 2).Thanks to its new functionalities, RefleX could be used to produce X-ray spectral models for a given aperture to fully reproduce the emission of astrophysical sources (see Corrales et al. 2016;Smith et al. 2016).Moreover, RefleX could also be used to reproduce dust rings around variable X-ray sources, and to infer the spectral properties of the emission during the outbursts that give rise to the dust rings.RXTorusD assumes a geometry similar to that of the widely-used MYTorus model, but allowing the covering factor to vary (left panel of Fig. 10), and including more physical processes and more realistic crosssections ( §4.4.2) with respect to current X-ray models (e.g., Murphy & Yaqoob 2009;Baloković et al. 2018;Tanimoto et al. 2019).
RXTorusD was generated by running a grid of simulations with varying parameters, generating 10 10 photons per simulations.We considered that the X-ray source is pointlike and emits isotropically.The primary X-ray continuum was assumed to have the form of a cutoff power-law, with the photon index Γ varying between 1.0 and 3.0, while the cutoff energy was fixed to E C = 200 keV (Ricci et al. 2018).The maximum energy of the photons was set to be 500 keV (i.e., no photon was produced above this energy).The inclination angle between the observer and the normal to the plane of the torus (i) covers the range 0 − 90 • , with a 3 • interval.Similarly to what was done for RXTorus (Paltani & Ricci 2017), in order to consider the whole range of inclination angles we assumed that the first and last bin are be centred at 0 • and 90 • , respectively.The equatorial column density of the torus, i.e. the maximum column density that can be observed for a given configuration [N H (max) = N H (i = 90 • )], covered the range 10 22 − 10 25.5 cm −2 .The variable covering factor in the model is given by the varying ratio between the minor and major axis (CF = r/R), and varies between 0.01 and 1.For a given r/R and i, the line-of-sight column density is given by 2) The gas in the torus was set to be neutral (temperature 0 in RefleX), dusty and to have a molecular fraction of f H2 = 20% (H2fraction 0.2).We consider two dust depletions: dust 0.5 and dust 1 (i.e. the case in which iron is fully depleted).We used the proto-solar abundances from Lodders et al. (2009) and assumed three different metallicities (0.3, 1=Solar, 2).The simulations were carried out using a resolution of 20 eV in the 0.3-8 keV range.Above 8 keV, given the lack of narrow spectral features, we used a logarithmic step of ∆E/E = 0.001.
In order to allow for flexibility, besides including a table that contains all simulations, the model is divided into different components: i) the transmitted contin-uum, containing only photons that did not undergo any interaction with the surrounding medium; ii) the scattered continuum, which includes all photons that underwent scattering, but neither photoionization nor fluorescence; iii) the fluorescence, which contains photons that underwent at least one photoionization and fluorescence event.The free parameters of the model are the photon index (Γ) and normalization (n) of the primary X-ray emission, the covering factor (r/R) and equatorial column density [N H (max)] of the torus, and the inclination angle between the observer and the normal to the plane of the torus (i).Following this new release of Re-fleX, the other RXTorus models have been updated to include the proto-solar abundances of Lodders et al. (2009) and to increase the number of photons per simulation.

Improvements with respect to commonly-used AGN torus spectral models
The main novelty of RXTorusD is that it considers a wide variety of physical processes, which make our simulations extremely realistic.None of the physical X-ray spectral models used to reproduce the emission of AGN currently considers dusty gas.Moreover, some of the most-commonly used models applied to the X-ray spectra of obscured AGN, such as MYTorus (Murphy & Yaqoob 2009), Borus (Baloković et al. 2018), UxClumpy (Buchner et al. 2019) assume that Compton scattering takes places on free electrons.This assumption is not realistic for cold reprocessing material, such as the circumnuclear dusty medium that surrounds AGN.Our simulations, on the other hand, consider the incoherent scattering functions of Hubbell et al. (1975), which provide Z-and energydependent multiplicative terms to the Klein-Nishina cross-section.The result of these corrections is a reduction of the Compton cross section at low energies, which is more than compensated by the addition of Rayleigh scattering (see Paltani & Ricci 2017 for further details).Moreover, our simulations also consider coherent and incoherent scattering on molecular hydrogen.All this can result in large differences in the observed X-ray spectra, particularly below 10 keV.This is clearly illustrated in the right panel of Fig. 10, which shows the ratio between two spectra from the RXTorusD model and two spectra obtained by considering the same geometrical and physical configuration but ignoring dust, molecular gas and Rayleigh scattering.For the simulations we assumed N H (max) = 4 × 10 24 cm −2 , a covering factor of r/R = 0.7, and considered two inclination angles: 60 − 65 • (red continous line) and 85 − 90 • (black dotdot-dashed line).The model assumes that the isotropic X-ray source (red star) is surrounded by a torus with a major axis R and a minor axis r.The covering factor of this obscurer is given by the ratio between the two axis (r/R).The inclination angle i is the angle between the observer and the normal to the plane of the torus.Two column densities can be defined, the line-of-sight column density [NH(i)] (see Eq. 2) and the equatorial or maximum column density [NH(max) = NH(90 • )].Right panel: ratio between the spectra of the RXTorusD model (for dust 1) and those obtained using the same geometry but considering the physical assumption of some of the most-commonly used torus model (i.e., ignoring dust, molecular gas and Rayleigh scattering).All simulations assume an equatorial column density of NH(max) = 4 × 10 24 cm −2 , a covering factor of 70% and two different inclination angles: 60 − 65 • (red continous line) and 85 − 90 • (black dot-dot-dashed line).The spectral resolution was set to 50 eV.

SUMMARY AND CONCLUSIONS
In this work we have reported on the implementation of dust in the ray-tracing platform RefleX (Paltani & Ricci 2017).We have discussed how dusty gas is treated within our simulations, and how it is controlled by a single parameter, dust, which regulates the fraction of metals in dust grains (i.e. the dust depletion).We have discussed the different effects associated to the interaction between X-ray photons and dust grains, such as dust scattering, near-edge X-ray absorption fine structures and shielding ( §2.2), which are all included in RefleX.We have shown how the cross-sections of the photon-gas interaction change depending on the dust depletion factor ( §2.3 and Figs. 3,4).Our simulations were tested using some of the most-commonly used Xray photoelectric absorption models, such as phabs and tbabs ( §3 and Fig. 5).We have discussed the small effect of dust on the fluorescence lines ( §4.1, Fig. 6 and top panel of Fig. 7), and showed the imprint left by the presence of dust on the X-ray spectra assuming different geometries ( §4.2), which is particularly important below 10 keV and around the edges (bottom panel of Fig. 7 and Fig. 8).We have shown how RefleX can be used to reproduce the X-ray dust scattering halos that are often observed around Galactic sources ( §4.3 and Fig. 9).In the future RefleX could be used to create spectral models for X-ray binaries considering different apertures, taking into account dust-scattered radi-ation.Finally, we released a new X-ray spectral model (RXTorusD), which is the first torus model that considers dust absorption and scatter, and could be used reproduce the X-ray spectra of obscured active galactic nuclei ( §4.4).RXTorusD considers physical process that are not included in the most widely-used physical models, such as Rayleigh scattering and scattering on molecular gas, which can lead to strong differences in the predicted X-ray spectra for the same set of geometrical and physical parameters (right panel of Fig. 10).The realistic X-ray spectral models that can be created with RefleX will allow us to fully exploit the nextgeneration of X-ray facilities, and in particular with the advent of the high spectral resolution instruments on-board XRISM (Resolve, XRISM Science Team 2020) and Athena (X-IFU, Barret et al. 2016).

Figure 1 .
Figure1.Sketch of the process of self-absorption of fluorescence emitted in a large grain (see §2.2).Photons coming from the right are more likely to be absorbed in the part of the grain shown in blue, which represents schematically the mean free path for these photons.Both photons (γ1 and γ2) are absorbed (green stars) and fluorescence photons ϕ1 and ϕ2 are emitted in both cases in random directions.Photon ϕ1 crosses more material than ϕ2, and is more likely to be absorbed in the dust grain.Similarly, the sketch also illustrates the process of shielding ( §2.2), in which low-energy photons that hit a dust grain are absorbed in the outer part of the grain, and do not "see" the atoms in the center or the other side of the grain.

Figure 2 .
Figure 2. Angular distributions of fluorescence photons emitted by Carbon (left panel) and Silicon (right panel) in a dust grain illuminated by 0.3 keV (C) or 2 keV (Si) photons for different grain radii: 0.1µm (red line), 1µm (purple line) and 5µm(blue line).The black line shows the angular distribution for an isotropic source of radiation.An angle of −90 • means that the photon direction is opposite to that of the incoming photons.The histograms are normalised to peak at unity.

Figure 3 .
Figure3.Different cross-sections of gas used in RefleX.Top left panel: photoelectric cross-section for gas with no dust (continuous grey line), and dust depletion 0.3 (green dot-dot-dashed line), 0.5 (blue dashed line) and 1 (red dotted line).Top right panel: same as the top left panel for the dust cross section.Bottom left panel: same as the top right panel excluding dust scattering.Bottom right panel: Total cross section of dusty gas for dust 1 (black solid line), together with the contribution of photoelectric absorption (long-dashed green line), Rayleigh scattering (dashed cyan line), Compton scattering (dotted red line), and dust (dot-dot-dashed orange line).The proto-solar abundances ofLodders et al. (2009) were considered to calculate the cross-sections.The spectral resolution was set to 10 eV.

Figure 4 .
Figure4.Ratio of the cross-sections with and without dust used in RefleX considering different dust depletions.Top left panel: ratio between the photoelectric cross section assuming different dust depletion and that of non-dusty gas.Top right panel: ratio between the scattering cross-section (i.e., Rayleigh, Compton and dust) of dusty and non-dusty gas.Bottom right panel: ratio between the total cross-section of dusty gas and that of non-dusty gas.Bottom left panel: ratio between the total cross-section of dusty gas without dust scattering and that of non-dusty gas.The proto-solar abundances ofLodders et al. (2009) were considered to calculate the cross-sections.The spectral resolution was set to 10 eV.

Figure 7 .
Figure7.RefleX simulations around the Fe Kα line and its Compton shoulder (6.0 − 6.5 keV; top panel), and around the Fe K edge (7.0 − 7.2 keV; bottom panel) for four different dust depletions assuming a torus geometry with a column density of 10 24 cm −2 observed edge-on (85 − 90 • ), and considering a spectral resolution of 5 eV.

4. 4 .
RXTorusD: a dusty torus model 4.4.1.The model With the first version of RefleX (Paltani & Ricci 2017) we released a spectral model to reproduce the X-ray emission of AGN, RXTorus, which considered reprocessed radiation produced in a torus with variable covering factor and column density.With this paper we release a new version of the model, RXTorusD, i.e. the first torus model which considers dusty gas.

Figure 10 .
Figure10.Left panel: schematic representation of the RXTorusD model.The model assumes that the isotropic X-ray source (red star) is surrounded by a torus with a major axis R and a minor axis r.The covering factor of this obscurer is given by the ratio between the two axis (r/R).The inclination angle i is the angle between the observer and the normal to the plane of the torus.Two column densities can be defined, the line-of-sight column density [NH(i)] (see Eq. 2) and the equatorial or maximum column density [NH(max) = NH(90 • )].Right panel: ratio between the spectra of the RXTorusD model (for dust 1) and those obtained using the same geometry but considering the physical assumption of some of the most-commonly used torus model (i.e., ignoring dust, molecular gas and Rayleigh scattering).All simulations assume an equatorial column density of NH(max) = 4 × 10 24 cm −2 , a covering factor of 70% and two different inclination angles: 60 − 65 • (red continous line) and 85 − 90 • (black dot-dot-dashed line).The spectral resolution was set to 50 eV.