(this is a repost from another thread, just figured it's useful and comes up enough to have its own thread).
Atmosphere retention depends on the Luminosity of the star, the distance of the planet from the star, the mass of the planet, and the radius of the planet (the last two essentially can be combined into "the surface gravity of the planet"). The exact relationship is somewhat fuzzy and recursive though, since it technically really depends on the top of the planet's exosphere (from which gaseous molecules can escape) - which is in part influenced by the atmospheric gases that it holds - and also on things like whether the planet has a magnetic field and how effectively the solar wind coming in from the star can break up molecules and strip atoms away from the atmosphere.
But the "simple" way to do it is to use the following equation:
mmw = 150*0.0001322*((T*r)/M))
mmw = minimum molecular weight retained
M = mass of the planet ([b]in EARTH MASSES[/b]) (1 earth mass = 5.9742e24 kg)
T = blackbody temperature of planet (Kelvin)
r = radius of the planet ([b]in EARTH RADII[/b]) (1 earth radius = 6,378 km)
Addendum (from a later post):
I guess using units of km might be more intuitive, since not everyone's going to figure out the radius of their planet in earth radii... So here's an equation with more sensible units to use:
mmw = 150 * (2.074e-8) * [(T*r)/M]
150 = atmospheric retention constant (explained below)
T = blackbody temperature in Kelvin
r = radius of planet in km
M = mass of the planet in Earth masses.
(If you're not familiar with scientific notation, 2.074e-8 is 0.00000002074).
Or if you just want everything in metric units (which is the safest way to do it, IMO):
mmw = (150*k*T*r)/(G*M*h)
150 = atmosphere retention constant
k (the Boltzman constant) = 1.38E-23 J/K
T = blackbody temperature in Kelvin
r = radius of planet in [b]metres[/b] (1 earth radius = 6378000 m)
M = mass of planet in kg (1 earth mass = 5.9742e24 kg)
G (Gravitational Constant) = 0.00000000006672559 N (m/kg)²
h (mass of a hydrogen atom in kg) = 1.67e-27 kg
The minimum molecular weight (m) retained is determined by the ratio of the thermal escape velocity (Vt) of a gas to the gravitational escape velocity of the planet (Vg). If Vg < Vt, the gas is energetic enough to escape from the planet and be lost into space over some timescale. If Vg > Vt then it becomes harder for the gas as the ratio between the two velocities increases, until the gas cannot escape at all. This is because distribution of molecular velocities of the gas follows a Maxwellian distribution - it’s not that all the gas particles may have velocities less than the gravitational escape velocity, it’s just that the average velocity is less. This means that the fastest particles will have velocities greater than Vg, and so will be lost into space - so in practice, Vg has to be considerably greater than Vt in order to retain the gas over billions of years.
Most of the texts suggest that Vg > 6Vt would be fine to use for a gas to be retained for billions of years:
Vg > 6Vt: gas retained for billions of years.
Vg > 5Vt: gas retained for tens of millenia/a million years.
Vg > 4Vt: gas retained for decades/millennia.
Vg > 3Vt: gas retained for weeks/months.
Vg > 2Vt: gas is retained for hours/days.
The 150 in the equation I gave is related to this ratio, and assumes that Vg > 10Vt, but that's just my own preference, to be really conservative about it. If you want to calculate alternate constants then you just square the number before Vt and multiply that by 1.5 (10²*1.5=100*1.5=15, so if you use the 6Vt then you should get use 54 as the constant (6²*1.5=36*1.5=54).
The 0.0001322 in the equation is what the other constants (the Boltzmann constant k, the gravitational constant G, and the mass of the hydrogen atom) simplify to.
So that gives you an m value, which you then compare with the values on the table below for the molecular weights of the gas molecules:
Gas Molecular Weight
Molecular Hydrogen (H2) 2.00
Helium (He) 4.00
Methane (CH4) 14.00
Ammonia (NH3) 17.00
Water Vapour (H2O) 18.00*
Molecular Nitrogen (N2) 28.00*
Carbon Monoxide (CO) 28.00*
Molecular Oxygen (O2) 32.00
Hydrogen Sulphide (H2S) 34.10
Hydrogen Chloride (HCl) 36.50
Argon (Ar) 39.00
Carbon Dioxide (CO2) 44.00*
Ozone (O3) 48.00
Sulphur Dioxide (SO2) 64.10*
Chlorine (Cl2) 71.00
Sulphur Trioxide (SO3) 80.10
Xenon (Xe) 131.30
So let's say you get a result of m=30 for your planet, assuming you're looking at a timescale of billions of years (which is what you want for a long term atmosphere). That means that the lightest gas that it can retain has a molecular weight of 30 - anything with less than that will not be retained over that timescale (if you change the 150 constant in the equation to a smaller value and compare the results, you can use that to find out how quickly it will take gases to be lost to space). So with m= 30, the planet can retain molecular oxygen, carbon dioxide, sulphur dioxoide, etc.
Also, just because an atmosphere can hold onto a gas, doesn't mean it necessary HAS that gas in it. The gases with * next to them are common atmospheric gases, generally produced by volcanism. Things like oxygen and methane are generally reactive and tend to be actively produced (e.g. by life, or photolysis), so you have to be sure that the gases will not all react with eachother and get used up or turned into other gases.
It all gets rather complicated when you get in depth on the subject, but what I've describe here is a reasonable approximation to reality.