 So, we are lecture 23 in the series. In these lectures, for past two lectures, I have been discussing neutron reflectometry, specifically polarized neutron reflectometry for thin film characterization. And in this lecture, I will discuss the data analysis techniques for neutron reflectometry. I will familiarize you with reflectometry instruments, one which is there at Dhruva and few more from the best sources to give a general idea about the kind of instrument that are available. And then I will deal with examples or studies that have been done using these instruments. So, with this, I am starting today's lecture, first the data analysis part. I had introduced you to paired formalism, which can give you the model reflectivity for a model structure in real space. So, this is, if you remember it, I wrote it for you an expression like this, where this was a, I can say layers, I can say layers of non-refractive index, that means they have their densities, thicknesses all embedded in this model. And for this model, if I want to calculate the reflective reflectivity index, which is r n comma n plus 1, where I wrote it as a n square, if I remember it correct. So, this is the reflectivity for the nth and n plus 1th layer at the nth layer boundary between n minus 1th and nth layer. So, this is the reflectivity at the boundary of n and, sorry, this is between n minus 1 and nth layer. So, this is the reflectivity at the boundary, but as I mentioned earlier that to calculate this reflectivity, I need the reflectivity at the next boundary, which is n and n plus 1th layer, number of layers are going up. And then this becomes the recursion formula. So, to know r n n minus 1, I need r n n plus 1, so on and so forth, if n minus 1 n, n was q n minus 1 minus q n, q n minus 1 plus q n, which is a reflected amplitude between n minus 1 and nth layer if no other layers were present. So, here to find out r n minus 1 n, I need r n n plus 1 and this series was truncated, I mentioned to earlier that r n n plus 1, n was the final layer, n plus 1th layer is equal to 0, this is the substrate and whatever goes into the substrate, we say nothing comes back and starting from this, given a structure, I can calculate the reflectivity at the air fill interface. So, this is the handle for our model fitting. Now, once I have a structure, I can find out the reflectivity using parent formalism. So, the first step that if I have a sample, for example, let me just consider a single layer, suppose I have got a single nickel layer, I am using this example because I will show you the data for the same thing, single nickel layer on a substrate and there is a nickel layer over here, this is basically a nickel film which is also used as a mirror in our experiment. Now, in this case, I can represent this nickel layer, let us say from my common sense, I might say that there is a thin layer at the substrate film interface which will have a different density, then a bulk of the layer which will have another density and then there is the air film interface, there is a thin layer. So, this single layer, for the purpose of fitting the data, I might break it up into a tri-layer, into a tri-layer and when I make it into a tri-layer, then for this tri-layer, I start with some assumed values of densities, thicknesses, interface roughnesses, so that means I represent these layers as a histogram, as a histogram of densities, histogram of densities and also the refractive index. Once I have this histogram, I have shown here as an example, as a schematic that if this is the true density pattern, it is possible to represent it in a discrete histogram like this and for this histogram, I can use Parrot's Formalism to calculate the reflectivity index. Now, in this case, suppose I have got a tri-layer, now I keep playing this game of chi-square minimization, as I have written here, chi-square in this case is the experimental data log of that, calculated data for this assumed model, log of that and comparison between them at each and every point, so it will be R i experimental, R i calculated, or sorry, here it is J, so I should make a mistake, I should J and J sum over all the major points, 1 by N minus 1, so this is the chi-square value and I have to minimize this chi-square to fit this model, so I started, please remember, I started with an assumed model which gives me a histogram for the given sample, here it is a single layer, I broke it up just to as an example into 3 layers, that means my histogram will have only 3 layers, for all 3 layers I have an assumed density, thickness and then I fit the model and keep up doing it, I just give an example of this nickel film, nickel multi-layer actually, this is a nickel titanium multi-layer, you can see the experimental data and you can see the fits, so it was a nickel titanium multi-layer, it was unpolarized due to reflectivity, the experimental data has been fitted using this chi-square minimization technique, so let me repeat, parent formalism is the starting point of model building, using parent formalism I can find out the reflectivity of a model structure and I keep changing it till I get a good fit with the experimental data and that will be my result or the fitted values in the real space given this reflectivity pattern, so in real space I will get the results in terms of density, thickness, interface roughness etc etc, now these chi-square minimization processes are also varied and today for reflectometry data each major source possibly will have its own optimization software available to you, so like NIST does provide, NIST means NIST neutron source NCNR, NIST Center for Neutron Research, if you go to their online site you will get a program to fit your reflectometry data and in this fit this is an unpolarized reflectometry and as I told you earlier for the total thickness of the film we have got KZ oscillations and this was a multi-layer periodic bilayer, so a periodic bilayer will act like a one-dimensional crystal and for which I had this bright peak from this synthetic crystal or artificial crystal like just like actual crystallographic bright peak this is a bright peak only the number of layers are small, so this is a finite number of planes it is a one-dimensional crystal then because this mesoscopic lens scale the bright peak appears at a much lower cube at 0.06 here for example around 0.05 in this experimental result, so now let me repeat parameters of thickness density interface roughness and magnetic moment density or direction in case of polarized neutron reflectometry we have to search in the parameter space we know that this is important that we get the global minimum in the parameter space which is actually the true solution for the problem given problem true solution means the parameters are the true parameters of the sample which you do not know actually, so we are looking for a global minimum in parameter space starting from some assumed structure, so there are several techniques well known in this chi-square minimization process one is steepest gradient otherwise conjugate gradient in case of steepest gradient at one point in parameter space that means it is a multi-dimensional parameter space with parameters like thickness, density, roughness and etc. if we assume that they are independent of each other we can for this tree we can have a three-dimensional parameter space and one point means a particular thickness, particular density, particular roughness to start from there calculate the gradient at this point by slight changing of the parameters and then move in this direction where the fall is the fastest in two-dimension there will be several directions but we move in that direction where the fall is fastest I have used genetic algorithm which is slightly different from these and I would like to discuss briefly with you what is genetic algorithm technique and I have found that one can reach solutions physically reasonable solutions in a much faster time, so it is a random search technique in the parameter space and it mimics Darwin's survival of the fittest principle, so to start with the population of chromosomes the chromosomes I will show you what they are built usually with binary strings similar to a chromosome and made with parameters and we make a mating pool where we made the chromosomes get new chromosomes and each chromosome has a fitness function and from this we get a new pool of chromosomes which will have their own fitness functions let me explain to you let me take two parameters just two parameters of a film let us say thickness d and roughness sigma as an example let us consider that thickness is 10 angstrom and roughness is 5 angstrom as an initial case and another case let us say thickness is 8 angstrom and roughness is 4 angstrom now if I use a 4 bit byte 1 2 3 4 so I said thickness 10 10 so it will be 0 into 2 to the power 0 plus 1 into 2 to the power 1 plus 0 1 0 into 2 to the power 2 plus 1 into 2 to the power 3 8 plus 2 10 so this is 1 0 1 0 so this is represent 1 0 1 0 let us consider the roughness as 5 angstrom again if I use a 4 bit representation I can increase the number of bits to get more resolution just as an example I have taken 4 bits then this 5 angstrom will be represented as 1 1 0 0 2 to the power sorry this 0 1 2 so it is 0 1 0 1 this is the representation now with these two I can build a chromosome which is 8 bit long this is I call a chromosome let me reduce it from here sorry 7 8 so this will be 1 0 1 0 0 1 0 1 now this thickness and roughness together forms a chromosome chromosome for my genetic algorithm simulation now I can also take another one another set of parameters for example thickness 8 angstrom and roughness 4 angstrom so 8 angstrom will be 8 sorry I did it 9 angstrom so call it thickness 9 angstrom let us say 9 angstrom so it will be 1 this is 8 this is 1 8 plus 1 9 and 4 angstrom means this is actually 0 1 this is 0 this is not 4 angstrom this is this is this is 2 angstrom so excuse me I was slightly wrong so thickness 8 angstrom and roughness 2 angstrom is another chromosome so one chromosome I created 10 angstrom thickness and 5 angstrom interface roughness another one I have created 9 angstrom thickness and not 5 angstrom 4 angstrom but 2 angstrom interface roughness so now between these two chromosomes I will be meeting these two chromosomes just like real life the chromosomes are made in genetic algorithm and how do we do the meeting so first I have got a pool of such chromosomes I showed you two such chromosomes in this two such chromosomes but you can make a pool of these chromosomes so 1 2 3 4 7 8 and I have written it down the two chromosomes 1 0 1 0 1 and then yes this is a 0 0 1 1 so it was by mistake it was 0 0 1 1 0 0 0 1 1 this was one and this is the other chromosome and here I randomly choose a particular site and then I cut this part bring it here and cut this part and take it there this is known as crossover operation there is a crossover operation so now with this crossover operation from this point so that means 1 0 1 remains next part will be after 1 0 1 it will be 1 0 0 1 0 this is a crossover similarly this part goes on added there so here it is cross it will be 1 0 1 and then 0 0 1 1 so this will be the 2 2 new chromosomes so after crossover there will be 2 new chromosomes now I choose one of any one of them and at a random site I switch in this binary representation so switch means if it was 0 I have made it 1 so now I get after crossover and mutation a new value of parameters given by triple 1 0 1 0 1 0 so I have used four bits to represent my parameters and I have explained to you the genetic algorithm operations that I will carry out and I will get from this gene I get a new this chromosome one point is the gene and one chromosome gives me a new chromosome after crossover and mutation so this pool now we will have new 8 chromosomes from the previous generation once I get this so generally we usually choose a range of parameters in form of binary sequence so it depends what is the upper limit of parameters what is the lower limit of parameters suppose I have thickness in the range of let us say 10 to angstrom to 100 angstrom and I want to write them as 4 bit 4 bit chromosomes then the value will be XIL will be 10 then XI upper minus XI 10 will be 90 and then gives you 2 to the power L minus 1 means 2 to the power 4 minus 1 so much is the gap so there are 15 gaps so basically I left 16 starting from the lowest to the highest 16 values of thickness similarly I can generate the gene the chromosome for the roughness depending on the length I choose and the lower and upper values now when I am looking for a solution in parameter space say for thickness in case of which is XI let us say I will be looking for bit solution in XIL and XIH for each parameter so here the previous case I described you the parameters thickness and roughness they can be more if it is a multilayer sample there will be many many many thicknesses so what length will be large and depending on the chromosome length will be large and for each parameter depending on how much resolution you want the length the bite number of bits in the bite will increase and after crossover and mutation we will have a new set of chromosomes with a new set of parameters so again from this pool we choose chromosomes depending on their fitness now Darwinian fitness is biological fitness in our case the fitness is the chi-square so we evaluate chi-square for the new parameters and then from them we choose the more fit ones that means lower value of chi-squares and this we can design in our way we choose we chose an exponential way of choosing this chi-square values from the range of parameters but that can be there are several techniques I don't want to give you any specific technique but the fact is that from the new pool we choose chi-square values depending on the fitness so then this process goes on this search once we have got a new pool we choose parameters choose the chromosomes which have got better fitness then between them we carry on again mating and mating means crossover and mutation again we get a new set so we can start with a large number of parameter chromosomes and keep on coming down to smaller and smaller values and hopefully we'll hit the global minima or the actual solution of the in the parameter space the advantage of genetic algorithm is the following the biggest is advantage is that unlike any other optimization technique the genetic algorithm process starts with a large set of parameters or multiple starting points in parameter space as I told you earlier steepest gradient or conjugate gradient techniques they start with only one point and there's a good chance that it will get stuck in a local minima there are can assume that the local minima in parameter space but here in this particular search technique because we start with many points I have just an example I use that it is like a set of blind persons in a field which is a parameter space I have shown here a square parameter space with the lower limit and upper limit in one parameter lower limit and upper limit one parameter has two independent axes and they're looking for the global minima in a blind manner they are blind people but every time they reach a new parameter set we choose their lower chi square values and that's how they're approaching this global minima and because I'm starting from multiple points multiple number of you can say blind people then I have a better chance of missing this local minima and reaching the global minima so this is about genetic algorithm and I just use one example we have fitted using genetic algorithm it was again that nickel titanium bilayer which we I showed you sometimes back and you can see that I had minimized the chi square and the fit quality is evident from the plot using genetic algorithm for neutron reflectivity unpolarized neutron reflectivity as well as extra reflectivity here actually interestingly as I told you that XRR and unpolarized neutron reflectometry both of them give structure of the film so in this case these two experimental data are fitted independently and we've and sorry fitted together with relative weightage decided by us depending on their experimental errors and the fit you can see that we have got thickness and roughness of average roughness of nickel thickness of the nickel layer titanium layer and their corresponding roughness is using genetic algorithm so usually the data that I will be showing for our experiments we use the genetic algorithm technique but there is no restriction and other techniques are equally good and available but biggest advantage of genetic algorithm that you start from multiple points in the parameter space and have a better chance of reaching the global minima unlike other techniques