How can you calculate the atmospheric layers on another planet? I'm working on a program that procedurally generates planets, and I'd like to make a realistic atmosphere with realistic pressures at different altitudes. I know that for earth we have 7 layers to our atmosphere, each with a different static pressure, standard temperature, temperature lapse rate and height, and I know the values on earth are as follows (from https://en.wikipedia.org/wiki/Barometric_formula):
[
  {
    name: "Troposphere",
    staticPressure: 101325,
    standardTemperature: 288.15,
    temperatureLapseRate: -0.0065,
    heightAtBottomOfLayer: 0
  },
  {
    name: "Tropopause",
    staticPressure: 22632.1,
    standardTemperature: 216.65,
    temperatureLapseRate: 0,
    heightAtBottomOfLayer: 11000
  },
  {
    name: "Stratosphere",
    staticPressure: 5474.89,
    standardTemperature: 216.65,
    temperatureLapseRate: 0.001,
    heightAtBottomOfLayer: 20000
  },
  {
    name: "Stratopause",
    staticPressure: 868.02,
    standardTemperature: 228.65,
    temperatureLapseRate: 0.0028,
    heightAtBottomOfLayer: 32000
  },
  {
    name: "Mesosphere",
    staticPressure: 110.91,
    standardTemperature: 270.65,
    temperatureLapseRate: 0,
    heightAtBottomOfLayer: 47000
  },
  {
    name: "Mesopause",
    staticPressure: 66.94,
    standardTemperature: 270.65,
    temperatureLapseRate: -0.0028,
    heightAtBottomOfLayer: 51000
  },
  {
    name: "Mesopause",
    staticPressure: 3.96,
    standardTemperature: 214.65,
    temperatureLapseRate: -0.002,
    heightAtBottomOfLayer: 71000
  },
]

Is there a formula to derive these layers on another planet with a different atmosphere, gravitational acceleration and temperature?
 A: I can only answer half of your question:
The pressure at any given altitude can be derived from the surface pressure, the average molecular weight and the temperature.  Look up "scale height" for more information.
I can't help you on identifying the layers, I wouldn't be surprised if not all worlds have exactly the same layers anyway.
A: The same procedure as the one for deriving the barometric equation could be followed. Most important is that you should know (if you are working on some knownw plants) some details of (the atmpsphere of) the planet, such as density (for pressure estimation/calculation), mass of the planet (for calculating the gravitational acceleration) and so on. 
Now the divisiton of Earth's atmosphere is based on the peculiar change of temperature along the vertical axis, in contrary that pressure changes are rather linear. Thus, one should know how the temperature changes over a planet to formulate the different atmospheric layers of the planet. This (most probably) non-linear behaviour is a function of multiple factors which should be measured and not assumed for real planets. But since you are trying to generate a program for planets produced by you, you can nicely assume such factors as mass of the planet and density of the atmosphere and so on. For realistic assumption you can look into these factors of the solar system planets for example. 
All in all, using the barometric equation is a good start after assumptions. The barometric equation and its thermodynamic variables are presented in Air Pressure in a Mine
