# how to mathematically predict reaction results

I've been trying to computationally achieve the following (I have no lab, I'm 14 years old, and I want to make a Minecraft mod to teach real Chemistry):

I want to mathematically predict the range of temperature and pressure (if the reaction is between gases) or temperature and concentration (if the reaction is in a solution) in which a given chemical reaction can happen, and the rate at which it happens, with the variation of those two arguments.

EDIT 1:

Regarding the first part of @sixtytrees answer I suppose I must calculate $K$.

I assume $\Delta G$ would be:

\begin{align}\Delta G &= \Delta G_\mathrm f^°{_\text{methanol}} - \Delta G_\mathrm f^°{_\text{carbon monoxide}} - 2 \Delta G_\mathrm f^°{_\text{hydrogen}}\\[6pt] &= -162.5 - 137.3 - 0\\[6pt] &= -299.8\ \mathrm{\frac{kJ}{mol}}\end{align}

Now to solve for $K$:

(I believe $R$ must be $0.0083144598\ \mathrm{\frac{kJ}{mol\ K}}$, because $\Delta G$ is in $\mathrm{\frac{kJ}{mol}}$
Also, I think we have to take $25\ \mathrm{^\circ C}$ as the temperature which is $298\ \mathrm K$)

\begin{align}\ln K &= \frac{\Delta G}{-RT}\\[6pt] &= \frac{-299.8}{-0.0083144598 \cdot 298}\\[6pt] &= \frac{-299.8}{-2.4777090204}\\[6pt] &= 120.99887336713996006405304847878\\[6pt] K &= \mathrm e^{120.99887336713996006405304847878}\end{align}

And now I realize I must have made some mistake because this number will be too big.

EDIT 2:

I just woke up and I noticed I miscalculated $\Delta G$, because I added them together when I should be subtracting. Let's see how it goes now.

\begin{align}\Delta G &= \Delta G_\mathrm f^°{_\text{methanol}} - \Delta G_\mathrm f^°{_\text{carbon monoxide}} - 2 \Delta G_\mathrm f^°{_\text{hydrogen}}\\[6pt] &= -162.5 - (-137.3 - 0)\\[6pt] &= -25.2\ \mathrm{\frac{kJ}{mol}}\end{align}

Now $K$ will be:

\begin{align}\ln K &= \frac{\Delta G}{-RT}\\[6pt] &= \frac{-25.2}{-0.0083144598 \cdot 298}\\[6pt] &= \frac{-25.2}{-2.4777090204}\\[6pt] &= 10.170685820053125395644218884808\\[6pt] K &= \mathrm e^{10.170685820053125395644218884808}\\[6pt] &= 26126\end{align}

Still not as small as 10 that @sixtytrees predicted.

$$26126 = \frac{[\ce{CH3OH}]^1}{[\ce{H}]^2[\ce{CO}]^1}$$

What now?

EDIT 3:

I've been thinking, and decided Chemical Equilibrium is not something I need to bother with, because as the reaction progresses, it is assumed that the final products are drained out as they are formed, and additional pressure is added to account for the reduction of total molarity. This way I don't need to distinguish between reversible reactions, irreversible reactions, and virtually irreversible reactions (when there are trace amounts of the reactants in the final products).

This only works if the reactants are gases, I don't know how to sustain the rate of the reaction if I take away the products from a solution.

The original question remains, now that equilibrium is irrelevant, is it possible to predict the temperature and pressure/concentration range of the reactants in which the reaction can occur?

I downloaded Orca, by the way. No idea how to use it.

EDIT 4:

Ok, so let´s say this is all happening in a sealed container with 1L of volume, so

\begin{align} 26126 &= \frac{[CH_3OH]}{2^2 \cdot 1^1}\\ [CH_3OH] &= 26126 \cdot 4 = 104,504 \end{align}

What does this mean? It can't mean I end up with more than one hundred moles in 1 liter. It makes no sense, I don't have enough reactants to get so much product. So, I am clearly doing it all wrong, can someone explain it to me?

• Have a look at wikipedia pages on rate equations. There are many solved equations for simple reactions but complex equations have to be solved numerically using standard numerical methods, Euler to Runge-Kutta etc. – porphyrin Jul 22 '16 at 7:36
• @FinnTheHuman, describe, what do you want to include in your engine and we might suggest what is doable and what is not. Keep in mind that scientists cannot model a single cell from the first principles. Currently they are modelling a small section of mouse brain in real time, but they model individual cells. Computational study is the future of science, so you are looking in the right direction. – sixtytrees Jul 22 '16 at 14:09
• Ignore downvoters - you are here to find answers to your valid questions, not to win the popularity contest. – sixtytrees Jul 22 '16 at 14:11
• @sixtytrees I tried to follow your answer to find K so I could calculate the rest, but K ended up being an extremely huge number, so something must be wrong with my calculations – FinnTheHuman Jul 23 '16 at 3:00
• @ChildishJack Thank you very much. The idea started as just a new energy system based in real physics and chemistry, but now I want to have a "Chemistry Workbench" in my mod, where people can make chemical reactions happen. I'm still not sure about how it will work. I know there will be input and output valves for gases/solutions (the input for the reactants, the output for the products), there will be slots for catalysts, but I won't think about that for now, and there will be a way to fine tune temperature and pressure (at the expense of the energy your engines will be generating) – FinnTheHuman Jul 23 '16 at 3:17

There are two parts to quantification of reactions:

(1) How far it goes? (Thermodynamics, equilibrium). This all is dictated by ground state energy.

(2) How fast it goes? (Kinetics, reaction rates). This is dictated by transition state energy vs ground state energy.

Equilibrium is much easier to understand. Let [Y] be concentration of reagent Y. You say that for 2A + B = C+3D +4E you have:

K = [C]$^1$[D]$^3$[E]$^4$/([A]$^2$* [B]$^1$)

Note how powers are equal to coefficients in the equation.

$\Delta$G= -RT*ln(K)

$\Delta$G is Gibbs energy (measured and tabulated for all of inorganic chemicals from school textbook). R is a constant (Universal gas constant) T is temperature.

How to use it? Well, imagine that you have

2*H2+ CO <-> MeOH

Lets say that K=10 under that conditions. I am sure I am off. Correcr way to find it is to use $\Delta$G= -RT*ln(K). You know T, R is constant. $\Delta$G is known for MeOH, H2 and CO. Calculate the difference to find $\Delta$G. You will need to find $\Delta$G for methanol vapor or take it for liquid MeOH and add $\Delta$G of evaporation.

You start with 1M of CO ( atm at 273C) and 1.5M of H2 (67.2 atm at 273C). Total pressure 112 atm. (Mol to pressure conversion using ideal gas law). What will be the equilibrium amount of MeOH if ? You say that

Let x be the amount of product at equilibrium. H2 = 1.5 M - 2*x and CO = 1-x.

x/(1.5-2*x)$^2$*(1-x)=10=K

Now you have a cubic equation to solve (1.5-2x)$^2$*(1-x)*10 - x = 0;

With more reagents you have algebraic equation of higher power, but there are methods to solve those numerically and the idea is simple enough to explain.

This gets a bit more complicated when you have multiple reactions going. But This is the basis. When system gets complex you start ignoring some small members to simplify it. (1.0001)$^5$ ~ 1.0005 (reasonably accurate). YOu do the same in chemistry.

Kinetics is trickier. For A+ 2B -> C the first approximation is that

rate = k*[A]*[B]$^2$.

Also "k often increases by a factor of 2-4 per 10C of increase in temperature".

Now to treat it accurately you need to solve a system of equations. each equation is either

r$_i$ = $\delta$[A$_i$]/$\delta$t

or

r$_i$ = ($\delta$[A$_i$]*$\delta$[B$_i$])/$\delta$t

Rate if i$^{th}$ reaction = change of concentration of i$^{th}$ reagent per time period as the period goes to zero).

You end up with a system of ordinary differential equations. But don't get tricked by the word "ordinary". Most of them don't even have solutions in "elementary functions" (functions that you study in school or university as a chemist.

To understand what is a differential equation you would need to know what is an integral. We study differential equations in second year of university and that probably the most difficult subject in university.

Predicting reaction results does not necessarily have to be so complicated. Consider a simple system of reactants - for example if you made esters from alcohols and acids (example: ethyl alcohol plus acetic acid -> ethyl acetate) you could predict the products (and their relative amounts) from a given set of reactants in different quantities, because formation of an ester bond is pretty much the same energetically, regardless of which acids and alcohols you use. If you started with three alcohols and three acids, there are 9 possible esters. It gets more interesting when you add in difunctional acids and alcohols - then you start to get polymer chains. This kind of system can be simulated using a simple computer program.

You can start with a rough model and then gradually improve it. Doctors start with frogs in their carrier, then remove appendix, then do hart surgery. You should do the same. Choose 30 chemicals. Record properties of each chemical (melting/boiling point, density, molecular weight, color, solubility in (or reaction with) water. Now for each pair of chemicals for (30*15 combinations) record if they react with each other in dry state, in water, in acidified water and in basic water, the rate of the reaction, the products (gas/precipitate/color change). 1000 conditions is a lot of typing, but it is worth it. Besides, most of the cases will be "no visible reaction". You need a good reference book to get most of the data. For the rest of the reactions we can help. You can see what reaction looks like on youtube to know what to show in your mod. You will have your virtual lab where you can set stuff on fire or blow up things. Include this in your mod and see how it goes. Do people play it, do they ask "give us more explosions, we don't want precipitates? Expand the mod as needed.

• But is my Edit 2 correct so far? – FinnTheHuman Jul 23 '16 at 15:22

Judging by your attempts it looks like you haven't learnt about thermodynamics yet nor calculus nor advanced probability. The fundamental problem in your attempts is that you don't take in account the energy transfers, activation energy, etc. These energy changes that occur are scientifically represented in curves, you are trying to solve a certain part of that curve. Therefore, you would use a combination of differentiation and integration to do that. Secondly, you see if reactions were mathematically deterministic then there would be no use for a different language for chemistry (I assume you know basic chem). Finally, chemistry is not structured as maths, in other words it is just a hodgepodge of substance that react under the right circumstances.