{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 4 Energy transfer. Autocatalytic reaction and spreading of fires"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"from sympy import *\n",
"init_printing() # allows printing of SymPy results in typeset maths format\n",
"import matplotlib.pyplot as plt\n",
"plt.rcParams.update({'font.size': 16}) # set font size for plots"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4.1 Forster or dipole-dipole energy transfer\n",
"\n",
"Forster, also called dipole - dipole or resonance energy transfer is a vital process in photosynthesis as it is the mechanism by which energy is transported in the antenna and then to the reaction centre. The same process is used in FRET, which is widely used in the biosciences as a 'spectroscopic ruler' to measure how close one molecule is to another. In this process an excited state of a molecule D* can, non-radiatively, transfer energy to a nearby acceptor molecule A, provided energy is conserved, which means that the donor's emission spectrum overlaps with the acceptor's absorption;\n",
"\n",
"$$\\displaystyle \\mathrm{A + D} \\overset{h\\nu}\\longrightarrow \\mathrm{A + D^*} \\overset{k(R)} \\longrightarrow \\mathrm{A^* + D}$$\n",
"\n",
"The rate constant $k(R)$ varies as the inverse sixth power of the separation between donor and acceptor; therefore, the rate constant is distance dependent. Calculating the decay of the donor's excited state, therefore necessitates summing over acceptors at all distances, not just the donor's nearest neighbours; see Figure 15. In solution the acceptors surround the donor and each other at random, rather like the currants in a cake and to simplify a calculation it is normally assumed that no diffusion of the molecules takes place on the timescale of energy transfer.\n",
"\n",
"If the donor has a lifetime $\\tau = 1/k_f$ when no acceptors are present, the rate constant for Forster, or dipole - dipole, transfer to an acceptor at a distance $R$ nm away from the donor is\n",
"\n",
"$$k(R)= \\frac{\\chi^2}{\\tau}\\left( \\frac{R_0}{R} \\right)^6$$\n",
"\n",
"and consequently the excited state decays with a distance dependent rate constant \n",
"\n",
"$$\\displaystyle k = \\frac{1}{\\tau} + k(R)$$\n",
"\n",
"As some acceptors will be closer than others to the donor, these will interact more rapidly because of the $1/R^6$ distance dependence. This means that the rate constant of energy transfer is not a constant, but depends upon time! This arises because the few nearby acceptors interact faster on average than those far away and, even though there are far more of them farther away, they do not fully counteract this rapid quenching. Overall this leads to faster than expected quenching at short times and therefore to a non-exponential decay. A similar effect occurs in the diffusion quenching of molecules in solution.\n",
"\n",
"The constant $R_0$ is the critical transfer distance at which the rate constant of fluorescence equals the rate constant of transfer to the donor and is calculated from the overlap of the donor's emission spectrum, fluorescence or phosphorescence, with the acceptor's absorption spectrum; see Turro (1978). This is usually a number that is large compared to the dimensions of a molecule, a typical value of $R_0$ being 3 nm but can be twice this for some molecules such as the Chlorophyll's, and this greatly aid the light - harvesting process in photosynthesis. The parameter $\\chi^2$ describes the orientation of the donor to acceptor transition dipoles, the average value in solution is $\\chi^2 = 2/3$.\n",
"\n",
"By calculating the chance of energy transfer at some distance $R$, the decay of the fluorescence intensity of the excited molecules is described by\n",
"\n",
"$$I(t) = I_0\\exp(-k_ft-\\alpha \\sqrt{k_ft}) \\qquad\\tag{14}$$\n",
"\n",
"which means that the energy transfer rate constant varies as $t^{-1/2}$ and so produces a non-exponential decay at short times. This can be seen by rewriting the intensity as \n",
"\n",
"$$I(t)=I_0\\exp(-k(t)) ; \\qquad k(t)=k_f\\left( 1+\\alpha\\sqrt{\\frac{1}{k_ft}} \\right)$$\n",
"\n",
"This behaviour is shown in Figure 13 and is a direct consequence of the spatial arrangement of several acceptors around a donor. It has been confirmed by numerous experiments.\n",
"\n",
"![Drawing](monte-carlo-fig12.png)\n",
"\n",
"Figure 12. Donor (centre) surrounded by acceptors at different distances. The transfer rate and hence excited state decay of the donor depends upon how far away the acceptors are.|\n",
"____\n",
"\n",
"To calculate the decay of the excited donor using a Monte Carlo method, the donor is placed at the origin. Initially, it might seem to be a good idea to place molecules at random on a grid, record the numbers in an array, and work out the rate constant for transfer for each of them. However, only the distance from the donor is needed, not the coordinates, and each randomly chosen distribution of molecules is only needed once; therefore, the distance can be calculated 'on the fly' by guessing x-, y-, and z-values, but not saving them, and calculating the distance from the origin using Pythagoras' theorem. Only distances up to a certain value are used, so that the enclosed volume is a sphere of radius $6R_0$, this being large enough to give a negligible contribution to the total rate constant. The sum of all these rate constants plus that for fluorescence is added up to give the total chance of transferring energy or fluorescing. Because the transfer rate goes to infinity at zero separation, a minimum separation of donor an acceptor has to be determined. This is chosen to be 1 nm, which is only slightly larger than the typical centre to centre separation on contact, of two large aromatic molecules. \n",
"\n",
"The constant $R_0 = 3$ nm, and the cut-off sphere $6R_0$. If the concentration is chosen to be 0.002 M, this corresponds to \n",
"\n",
"$$\\displaystyle 0.002 \\times 6.022 \\times 1023/(0.1 \\times 10^9)^3 = 1.204 10^{−3}\\quad\\text{ molecules } \\mathrm{nm^{−3}}$$\n",
"\n",
"or 29 molecules in a sphere of radius $6R_0 = 18$ nm. The maximum rate is set at $χ^2k_f R_0^6$ at a distance of 1 nm. This is arbitrary but reasonable for a molecule with a diameter of 0.5 nm. The minimum rate is $1/6^6$ or 46656 times smaller and is so small that distant molecules make an insignificant contribution to the sum of the rate constants. To speed the calculation, the rate constant calculation is simplified to remove repeated unnecessary arithmetic;\n",
"\n",
"$$k(R)=\\frac{\\chi^2}{\\tau}\\left( \\frac{R_0}{R} \\right)^6=\\frac{2}{3}\\frac{1}{10}\\frac{R_0^6}{d^6R_0^6}\\left( \\frac{1}{\\sqrt{x^2+y^2+z^2}}\\right)^6 = s \\left( x^2+y^2+z^2 \\right)^{-3} $$\n",
"\n",
"where $d$ is the distance scale chosen, the limit being $6R_0$ with $d = 6$ and where $x, \\; y$, and $z$ are chosen from a uniform distribution to be in the range -1/2 to 1/2. It may seem rather finicky simplifying the rate constant $k$, but this is in the innermost part of the calculation. If there are 20 acceptors and 5000 repeats this means evaluating exactly the same multiplication, division, square root and power, $10^5$ times rather than just once. The calculation is run for 50 ns, and the data put into 150 bins."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Algorithm: Forster Energy Transfer by monte-carlo simulation\n",
"\n",
"#-----------------------------------\n",
"def ForsterET():\n",
" Acount= np.zeros(bins,dtype=int) # define arrays\n",
" dtime = np.zeros(bins,dtype=float)\n",
" \n",
" for i in range(bins):\n",
" dtime[i]= i*maxt/bins \n",
" \n",
" s = 0.6667*kf/d**6 # constants for rate \n",
" for k in range( reps): # start calc loop\n",
" a0 = kf # fluorescence rate\n",
" for i in range(n):\n",
" x = np.random.ranf() - 0.5 # choose acceptors\n",
" y = np.random.ranf() - 0.5 # x,y,z coordinates\n",
" z = np.random.ranf() - 0.5 \n",
" rate = s/(x**2 + y**2 + z**2)**3 # 2/3*kf*(R0/R)**6\n",
" if rate > Rmax : rate = Rmax\n",
" a0 = a0 + rate # sum rate\n",
" pass\n",
" t = -np.log( np.random.ranf() )/a0 # calc time eqn (12.11)\n",
" indx = int(np.round(t*bins/maxt) ) # make index\n",
" if indx < bins-1 :\n",
" Acount[indx]= Acount[indx] + 1 # histogram\n",
" pass\n",
" pass \n",
" # end reps loop\n",
" return dtime,Acount\n",
"#----------------------------------\n",
"\n",
"kf = 1/10.0 # 10 ns lifetime\n",
"c = 0.002 # conc mol/dm3\n",
"R0 = 3.0 # R0 in nm\n",
"d = 8.0 # sphere radius d*R0\n",
"Avog= 6.023e23/1e24 # num molecs / nm3\n",
"n = int(np.round( c*Avog*4/3*np.pi*(d*R0)**3) ) # integer number molecs\n",
"Rmax = (2/3)*kf*(R0/1)**6 # maximum rate\n",
"reps = 20000 # repeat calc’n\n",
"bins = 150 # size of histogram\n",
"maxt = 50.0 # maximum time\n",
"Acount= np.zeros(bins,dtype=int) # define arrays\n",
"dtime = np.zeros(bins,dtype=float) \n",
"\n",
"#dtime,Acount = ForsterET() # remove # to calculate\n",
"\n",
"#plt.plot(dtime,Acount)\n",
"#plt.ylim([1,1e4])\n",
"#plt.yscale('log')\n",
"#plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Drawing](monte-carlo-fig13.png)\n",
"\n",
"Figure 13. Decay of a donor surrounded by many acceptors and a theoretical fit to equation 14 with $\\alpha = 1.25$.\n",
"____\n",
"A log plot of the data fitted to the theoretical equation (12.14) is shown in Fig. 13. The fit is good but not exact. At small times, the calculated curve does not match the simulation that well. This may be due to the small number of calculation performed, 20000 only, but it is more likely to be due to the fact that the theoretical curve is only an approximation and clearly not exact at very small times because at time zero the rate constant tends to infinity.\n",
"\n",
"It is surprising at first to see that the decay is not exponential. The reason for this is, as explained above, that the few nearby acceptors quench the donor preferentially compared to the more distant ones, which although more numerous, quench with ever decreasing rate constants. Fluorescence and phosphorescence decays measured by many donor - acceptor pairs confirm this type of decay (Birks 1970; Lacowicz 2004)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 5 Autocatalytic reaction on a surface and the spreading of fires\n",
"\n",
"The spatial arrangement of molecules or other objects can have a special effect on their behaviour. As a molecular example, suppose that a nanoscale device consisting of a small reactive surface of limited area is covered with a monolayer of type A molecules. A single reactive molecule B is now introduced, which can diffuse around and catalyse other molecules from type A to itself, the reactive form B; the reaction is autocatalytic, \n",
"\n",
"$$\\displaystyle \\mathrm{A + B} \\to \\mathrm{2B}$$\n",
"\n",
"However, during the manufacturing process, the surface is poisoned by impurities and these displace type A molecules. These impurities clearly limit the ability of the catalyst to work but are difficult to control, and so it is important to discover what level of impurity can be tolerated. \n",
"\n",
"Using a Monte Carlo method, the number of molecules catalysed as a function of impurity level can be calculated by assuming, for example, that a molecule of type B can only catalyse the four molecules adjacent to it on a square grid. The number of molecules reacted vs fraction of impurities $x$, can be plotted and analysed.\n",
"\n",
"A similar problem, but on an entirely different scale, could be a fire in a block of forest in which trees are spaced regularly on a square grid. In the UK, Forestry Commission planted forests are often of this type. Over the years, trees have either been felled or have blown down in storms, and consequently spaces exist at random places between the trees. Should a forest fire break out, the extent to which the spreading fire is sensitive to the number of these gaps. The gaps are equivalent to impurities in the chemical model. The results show that the extent of the reaction and of the spreading of a fire depends non-linearly on the impurity concentration or gaps between trees. A certain level of impurity only can be tolerated; a slight fraction more and the reaction rate dramatically falls. This is behaviour typical of *percolation*. There is a distinction to be made between percolation and diffusion. In the diffusion of, say, milk in a cup of tea, the random motion of the molecules is governed by the laws of diffusion and the medium (the tea) in which diffusion occurs is uniform. In percolation, the randomness is inherent in the medium in which a fluid finds itself. Thus a solid, such as a sinter glass filter, which is full of randomly interconnected channels exhibits percolation. A fluid will pass through the larger channels but surface tension restricts flow in smaller ones. The manner in which electrons flow through amorphous films can also be described as percolation.\n",
"\n",
"The computational strategy is to represent the surface monolayer as a matrix in which each matrix element is one of three integers to represent A and B molecules and impurity. It does not much matter what these integers are, so zero is chosen for the impurity, 1 for type A and 2 for type B molecules. In the case of the forest, the number 2 can represent the burning trees, 1 those that can catch fire, and 0 the areas with no trees. The initial tree that catches fire or the initial position of molecule B is chosen at random, as are the impurities. The matrix is searched sequentially and the neighbours of each molecule are tested. If a neighbour is of type A, then it is converted into type B. This is repeated until no more can be converted and the number changed is counted. The calculation is then repeated several times with atoms/trees at different random positions. After repeating the calculation at different impurity concentrations, the number of A type molecules converted to B vs the fraction of impurities is plotted.\n",
"\n",
"![Drawing](monte-carlo-fig14.png)\n",
"\n",
"Figure 14. The array dimensions are made larger than the reaction area to avoid edge effects.\n",
"____\n",
"The algorithm is similar to that used for SIR disease propagation, but now a two - dimensional array (matrix) is used. The algorithm is split into parts: \n",
"\n",
"(a) defining constants and initial values, \n",
"\n",
"(b) filling the matrix with the different type of molecules, and \n",
"\n",
"(c) running the calculation with the restriction that only adjacent molecules can react and are those whose index is $\\pm 1$ in each of the x- and y-directions, making four possibilities. \n",
"\n",
"The calculation is continued until the number of changes can go no further, rather than for a number of days, as in the disease propagation problem. This is done in a 'while' loop; see the code below. A counter $\\mathtt{c}$ is used and one added to it each time the matrix has a value of $2$. The 'while' loop continues to operate until the number of type B molecules are unchanged, and then the loop is left when the condition $\\mathtt{b \\gt c}$ is met. \n",
"In each iteration, the whole array is searched.\n",
"\n",
"The data arrays are made $2$ numbers larger in each direction than the true size, so that when the calculation reaches the edge of the array, the array bounds are not exceeded. These points around the edge of the array are ignored in the calculation; the 'for' loops start at $1$ and extend to $n$ for this reason, see sketch Fig. 14. The arrows show how a site is connected to another.\n",
"\n",
"The numbers used in the following calculation are only indicative. The grid is relatively small, with $20$ units on each side; increasing this will significantly slow down the calculation as will increasing the number of repeats, presently set at $10$, or the number of fractions to be calculated between $0$ and $1$.\n",
"\n",
"![Drawing](monte-carlo-fig15.png)\n",
"\n",
"Figure 15. Left: The percentage of molecules reacted (or trees burning) as a percentage of impurities (or gaps between trees). The sudden fall off is a sign of the connectivity ending in the spatial arrangement. The straight line shows what would be expected if the number of reacted molecules were directly proportional to the number of impurities. Right: The relative reaction rate vs. percentage of impurity.\n",
"____\n",
"\n",
"A typical set of data is shown in Figure 15. The right-hand graph shows the relative reaction rate vs percentage of impurity. The sudden fall off in the number of molecules reacted is a sign of percolation. The left-hand graph shows the percentage of A molecules that have reacted vs the percentage of impurities, $x$. The straight line in this graph is $100 - x$, and shows what would be expected if the number of reacted molecules were linearly proportional to the number of impurities present. Clearly, linearity is not the case. The reason for this behaviour has to do with the connectivity of the array when impurities or gaps are present. In two dimensions, islands of potentially reactive molecules can become isolated by impurities and this limits B type molecules from reaching these molecules. Similarly, gaps between burning trees prevent others from catching fire. The right-hand graph shows that $\\lt 30$% impurity can be tolerated without affecting the reaction rate by very much, but a $\\gt 45$% impurity almost stops the reaction. The maps, Figure.19, show a typical pattern of molecules or trees at different percentages of impurity or gaps. The change from almost complete connectivity to almost none is quite dramatic and typical of percolation; see Sahimi (1994) for a discussion of percolation.\n",
"\n",
"![Drawing](monte-carlo-fig16.png)\n",
"\n",
"Figure 16. Maps of the amount of B molecules (yellow), A type molecules (blue-green), and impurity (black), with different a percentage of impurity, from top left, top row 10% & 30%, and bottom row 50% & 70%. Alternatively, the picture shows the number of burning trees (yellow) the number not burning (blue-green), and the number of gaps (black). The change from 30% to 50% impurity (or gaps) is quite dramatic, the fire being severely limited in the latter. \n",
"____"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Algorithm: Effect of impurity\n",
"# P[,]>= 1 = A molecs, 2 = B molecs, 0 = impurity.\n",
"\n",
"n = 20 # size of grid side\n",
"reps = 100 # repeat calc’n\n",
"num_fract = 10 # number of fractions calc’d\n",
"delta_fract= 0.1 # increment fraction\n",
"\n",
"data = np.zeros(num_fract,dtype=float) # array for results (y axis)\n",
"fdata= np.zeros(num_fract,dtype=float) # fractions (x axis)\n",
"\n",
"def Impurity():\n",
" fract = 0.0 # initial fraction impurity\n",
" for L in range(num_fract): # fraction loop to end\n",
" asum = 0 \n",
" for k in range(reps): # repeat loop\n",
" P = np.ones((n+2,n+2),dtype = int) # matrix of molecs/ trees all 1\n",
" \n",
" fn = int(np.trunc(fract*n*n) ) # make into integer\n",
" # part b make fraction of impurities\n",
" num = 0\n",
" while num < fn : # exactly fract impurity\n",
" ra = np.random.randint(1,n+1) \n",
" rb = np.random.randint(1,n+1)\n",
" if P[ra,rb] != 0:\n",
" P[ra,rb] = 0 \n",
" num = num + 1 \n",
" pass\n",
" pass\n",
" num = 0\n",
" # choose one type B molecule\n",
" while num < 1 : \n",
" ra = np.random.randint(1,n+1) # in range 1 to n+1\n",
" rb = np.random.randint(1,n+1) \n",
" if P[ra,rb] == 1 :\n",
" P[ra,rb] = 2\n",
" num = 1 \n",
" pass\n",
" pass # end while num\n",
" # part c main calculation starts ###\n",
" b = -1 \n",
" c = 0\n",
" while c > b : # check if calc ended\n",
" b = c # store old value in b \n",
" c = 0 # reset c\n",
" for i in range(1,n+1):\n",
" for j in range(1,n+1):\n",
" if P[i,j] == 2 : # search array\n",
" if P[i,j-1] == 1 : P[i,j-1] = 2 \n",
" if P[i,j+1] == 1 : P[i,j+1] = 2 \n",
" if P[i-1,j] == 1 : P[i-1,j] = 2 \n",
" if P[i+1,j] == 1 : P[i+1,j] = 2 \n",
" c = c + 1\n",
" pass\n",
" pass # end while C\n",
" asum = asum + c\n",
" pass # end reps\n",
" # make results\n",
" av = asum/reps\n",
" fdata[L] = fract*100 \n",
" data[L] = av/n**2*100.0 \n",
" fract = fract + delta_fract \n",
" print('results',L, fdata[L],data[L])\n",
" pass # end L loop\n",
" return fdata,data\n",
"#-------------------------------------\n",
"\n",
"#fdata,data = Impurity()\n",
"#print('finished')\n",
"# plot data and fdata to give fig 18.\n",
"#plt.scatter(fdata,data)\n",
"#plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}