I'm trying to approximate the mass of the atmosphere. I'm treating it as an ideal gas and therefore its density follows:

$$\rho(z) = \rho(0)e^{(\frac{-mgz}{k\_BT})}$$

Where I'm using $m=4.2122\cdot10^{-26}$ kg as a weighted average taking into account the nitrogen and oxygen portions of the atmosphere; $T=288.15$ K as the average temperature of the atmosphere. We also need the density at sea leve, $\rho(R\_T)=1.225$ kgm^-3 Then, making use of spherical coordinates, where the $z$ coordinate is $r$ (upper and lower limits are $R\_T + H$ and $R\_T$ respectively, with $H=10^5$ m):

$$m=\int dm = \int\rho dv= \int\_{0}^{2\pi}\int\_{0}^{\pi}\int\_{R\_T}^{R\_T+H}r^2 \sin\theta e^{(\frac{-mgz}{k\_BT})}drd\theta d\phi=4\pi\int\_{R\_T}^{R\_T+H}\rho(R\_T)r^2 e^{(\frac{-mgz}{k\_BT})}dr=-4\pi\rho(R\_T)(\frac{k\_BT}{mg})^3[e^\frac{-mgr}{k\_BT}((\frac{mgr}{k\_BT})^2-2(\frac{mgr}{k\_BT})+2)]\_{R\_T}^{R\_T + H}$$

Which I inputted into Matlab, and then into my calculator, getting a result which is basically zero in both. What am I doing wrong here?

EDIT: As was brought up in the comments, if we take the relative distance from the ground so that the exponential in the lower limit results in 1 (so the lower limit is $0$ and the upper limit is $H$), the resulting value is much closer to the correct $5\cdot10^{18}$ kg result. However it's in the $10^{13}$ order, so it's rather far still.