### Wave Function Evolver – Episode 9

hello and welcome back to let’s code physics we have had some pretty good success with our wave function evolver so far we have extended it to two dimensions and again two dimensions can mean you’ve got a single particle moving up down and left right or it can mean you’ve got two particles that are free to move along a one-dimensional axis so we took a look at last time was two charged particles moving along sort of like a one-dimensional rod so you might imagine you’ve got two electrons trapped in a carbon nanotube or some kind of one dimensional structure and what we saw was that they they’re there the expectation value of their other positions kind of tracked along with each other to maintain this almost constant separation distance the the wavefunction had this interesting shape where it shifted to wait back and forth was kind of this Canyon in between where the two were not allowed to be because there was this electronic repulsion and that was really cool but the Coulomb repulsion excuse me the Coulomb potential energy only gives you repulsion between like charges or it only gives you attraction between opposite charges so it’s it’s either going infinitely high or it’s going infinitely low depending on whether you’ve got attraction or repulsion a more sophisticated potential energy is when we use for is when we use for molecules so for example if you wanted to model protein folding one of the ways you might do that would be through this thing called the lennard-jones potential which models neutral particles or neutral molecules clusters of pollock clusters of particles Paula cules clusters of particles we’re at a distance they they they will a very far distance they’re not going to have any effect on each other but as they get closer they start to attract each other when they get too close they repel each other so interesting thing I learned about protein folding so mad cow disease which has been you know of concern recently in the last you know decade or so is actually transmitted by a Miss folded protein so it’s a disease that is not transmitted by a bacteria or a virus because in school I was taught that diseases are caused by bacteria or viruses or least infections are but now this is literally a protein that is Miss folded that when it goes into another life-form it causes the other well folded proteins to miss fold in the same way and it causes this cascade reaction that causes the disease it’s it’s really I it’s scientifically speaking it’s it’s it’s really interesting it’s horrible obviously but it’s it’s a really interesting problem to to have to try to solve and so one way you can model this interaction between molecules in a protein is the lennard-jones potential energy and the lennard-jones is interesting because it can be both attractive and repulsive depending on the relative distance of the two particles so what we’ve got here is we’ve got set up the the lennard-jones potential energy again we’re putting in a cap of 500 just to keep it from you know causing the thing to to you know sort of go off the rails as it were so we are putting a cap at 500 we’ll take a look in just second at whether that’s reasonable but in order to define the lennard-jones potential you’ve got to define two parameters so when you graph this thing it ends up looking like this so this is the potential energy versus the separation distance between the two particles so again very far out you’ve got this attraction right so when you think of a potential energy graph you want to think of things as tending to roll downhill so in this case if the two particles are very far apart they’re going to tend to roll downhill toward each other until you reach this minimum and then there’s this very very sharp uptake here really an asymptote as you approach separation equals zero and so they’re going to roll back very quickly so they’re going to slowly approach there and then you know sort of knock back away so the two things you have to specify for the lennard-jones potential energy is the depth of the minimum you’ve got to specify how deep this dip is from zero and you’ve got to specify where the dip is on the horizontal axis so that’s what we’ve got specified by eamonn and armed here we’ve got a depth of negative Tim that’s what good on this graph is a depth of negative 10 and a location along the our axis of one so it’s at negative 10 and one there and basically once you specify those two everything else is taken care of because the way the potential energy works is that you’ve got e minimums so that sort of scales the whole thing vertically and then our minimum scales the whole thing horizontally because you’ve got our minimum / r and r minimum / r and there’s the first piece that’s that fraction getting raised to the 12th

power so that is this piece right here where it is repelling as you get closer and closer to 0 and then you have a negative r n over R to the six powers x 2 to take care of scaling and everything but this is being raised to the sixth power and it’s a negative so that’s what’s producing this tail right here so at very low separations the art of the 12th is dominating at very high separations the negative R to the negative 6 is dominating and in between their meeting and creating this minimum by the way if that looks familiar it’s because that’s the same general shape that we got back when we were constructing the route finder in space where you had the the attractive gravitational potential energy that the real potential energy and then you had this effective centrifugal potential energy that causes the two things to to repel each other it’s not the same math because the other one was to the second power n to the first power but this one is now to the urge give me to the negative 2 power in the negative 1 power but this one’s to the negative 12 into the negative 6 but again it’s this negative in the middle that’s producing that minimum there at our minimum so again we put the we put the cap at 500 so if i change my scale here again i’m in the new plot which is pretty handy you can see it took me several tries to get this to plot correctly if i put this thing at 500 so you see the minimum kind of vanishes so 500 is definitely you know high enough to go and if i take a look at the location down here i see that i reached the 500 ma work at right around point seven so at seventy percent of the our minimum separation which I think it’s going to be pretty good you know so that means we can get you know thirty percent off of this thing and still be tracking the the correct potential before we flatten it off so you imagine the red curve here just flattening off right there that’s what’s going to happen in our our approximation of the potential energy here that the computer can handle and that’s all I really have to change I think I’ll leave the initial wave function the same so again it’s this it’s this it’s this Gaussian this double gals here this two dimensional Gaussian that’s been displaced a little bit along the the second particle axis is that the red one of the green but I think that’s the green one and so what I’m going to do now is I’m going to run this we should see kind of similar behavior to what we saw last time only now again there’s this minimum so they’re not going to get too close to each other so again along the x equals y there’s going to be this huge divide where they’re not allowed to go but they’re not only going to be repelled from so they’re also going to be attracted by the attractive part of the potential energy so i’m just going to run this thing initially and if it goes well then i’ll let it run overnight and then again I’ll speed it up for you just like we did last time oh dear overflow error result too large okay and when are you getting this result too large it looks like it’s in line 161 I may need to decrease the potential energy a little bit let’s go to line 161 i’m guessing that’ll be in the code itself ok so then here’s my question is it thus I current squared that’s two large this sy real current squared the 20 to the side fact that’s too large surely if the sife act were too large oh you know what the sife act isn’t that scaled by max do I didn’t need that anymore huertas I fact get determined so I fact his ex mex my sex men / Simon okay so no that’s not the term about you max that was previously was I was doing it that way um let’s see well the you max is a problem right oh you know what that is a problem because i was only dealing with at it this is the minimum of the two that should still be the minimum so why is you maximum why is you max turning out so large if it’s being capped at 500 hmm all right so where does you max get determined new max equals zero you max equals maximum you max in the absolute value of you I don’t think I want that to be absolute value anymore although that shouldn’t be making it difference

let’s see ok well the you max got better behaved uh I’m wondering ok let me double check my potential is you now because my potential energy shouldn’t be going higher than 500 and it shouldn’t be going lower than 10 or the negative 10 oh you know what let’s do that let’s check you min as well let’s check the minimum of you so let’s do the same thing here we’re going to say you min equals zero point zero oh no actually let’s make you men equal to 500 since I know that’ll be the maximum value and you max equals this and so will copy this one I had a shift in a page up or something all right try that again you max you max all right home copy paste go so let’s try this you men equals this and the beautiful thing is the minimum will work if it’s negative it’ll just keep going more negative of oh but I need to print you man or else calculating it doesn’t do me much good now does it let’s do you max comma you min min 5 okay so that’s disturbing because that should not be getting that low that should be getting a minimum of I should be getting a minimum of negative 10 right all right let’s check what I’m doing here versus what I’m graphing that is not my code screen that is my code screen all right let’s go up to here ah it never goes right the first time does it um minimum between that and okay okay so it is let’s double check what we got here okay so what I’m plotting here is 10 oh whoops I set my e min to be negative 10 I flip that thing upside down oops save oh there we go why I put a negative on that why did you let me put a negative on that all right let’s try that again okay cool so that worked out better yes max 500 a negative of negative 10 you know what it was I was thinking the negative the minimum needs to be negative 10 I wasn’t thinking that the minimum needs to be 10 below zero and that’s what I was doing there okay well all is right with the world now I think so there is our Gaussian again we’ve got our rift kind of developing along the y equals x line or along the red equals green line now that’s kind of cool we’re getting these little ripples there the supposed to be like that oh no we’re getting we’re getting a little bit of wave motion over there okay well cool this seems to be behaving properly again I’ve pinned things down along the side here actually one of my one of my alumni who’s currently getting his PhD and is has far surpassed me in terms of computational prowess offered thought about why was getting those ripples off of the edge there he said well because it’s a symmetric second order differential equation you’re going to get in the the solution you don’t want which is the the you know the exponential growth but then I pointed out right but it’s only coming on one side that one he didn’t know how to do so krupa still waiting on on an explanation for that one okay so this seems to be behaving pretty well so I’m going to keep an eye on this for another you know like a couple minutes and if all goes well i will let this run overnight and then speed it up again and we’ll get to watch it unfold the gutters okay so I’ve reviewed the video and the results come out very interesting and in come out very well one of the first things to notice is that the wave function very quickly distributes itself primarily between quadrants to and quadrants for the the significance of that again is that those correspond to the red particle and the green particle being on opposite sides of the of the one dimensional structure that we’ve got in place so if you imagine this as a carbon nanotube they’re on opposite sides of the carbon nanotubes and they kind of quickly become you know kind of uniform across them so I won’t be commenting too much on the wave function itself and actually that’s a good thing because as we’ll talk about in a couple minutes I actually want to be able to get rid of that in the next next

simulation that we run what you see again just like we saw with the Coulomb potential energy results these two expectation values track each other pretty well in fact they track each other more closely than they did for the Coulomb x for the Coulomb potential energy remember with a Coulomb potential energy we got all this noise in both of them and we have some noise in these as well so we’ve got some you know some local jail I goodness but for the Coulomb potential energy those were we’re pretty independent of each other on the red curve another green curve what we’re going to see on the expectation values here is that they they track pretty closely you know when one tends to curve up where the other one’s going to tend to curve upward and and vice versa so if you were to graph the difference between the two expectation values you get a pretty flattish line it seems to be a difference of pretty consistently about point zero eight I think it is let me double check on the scale yeah yeah excuse me uh so about point O 2 4 6 8 excuse me excuse me about a point 01 of shooting about a point one difference scuze me so you get a pretty consistent difference of about 0.1 what we’re also going to see is that they form a pretty regularly repeating pattern of course any wave function is going to be composed of sines and cosines in a Fourier series if you need to review for what a Fourier series is go check out my light saber Fourier series video from just a couple weeks ago but but even in a Fourier series you’re going to have an overall period to the motion and if you take a look at sort of the major peaks and major troughs of these expectation values you end up with a period of about 1.1 seconds on the horizontal axis they’re not 1.1 seconds in video time because the video time is going to take nine minutes to go about two and a half seconds on the wave function and of course it really took it nine hours to record speeding this up 64 times I mean you get this nice regular period looking back at the looking back at the Coulomb potential energy results it’s a lot more regular it’s a lot more repeatable which you know of course also goes along with the fact that the two expectation values track with each other so closely I there see there’s probably two reasons for that looking at the differences between the Coulomb potential energy and the lennard-jones potential energy one is that the the repulsive part of the lennard-jones potential energy is a lot stronger than the Coulomb potential energy the Coulomb potential energy grows like one over the distance between the particles as they get closer together and the lennard-jones potential energy grows like one over the distance to the 12th power so if you were to graph those you know on a logarithmic scale in terms of power the the lennard-jones potential energy grows 12 times faster than the Coulomb potential energy so you know that that means that there’s a lot stronger of a restorative force between the two but also there’s this attractive portion to the lennard-jones potential energy the art of the minus 6 that is not present in the Coulomb potential energy which of course is what gives you that minimum and so I’m inclined to think that the that that minimum that the fact that that an equal that a system is going to tend toward its equilibrium point which is a minimum and the potential energy I’m inclined to think that that’s the reason these two tracks so well together except for the fact that their distance average distance between each other is about a 0.1 and i set the equilibrium distance to be 1.0 so it’s a full order of magnitude lower than the natural length scale in the problem you know if i had set the distance to be 1.0 and the distance between them ended up being an average of about let’s say about you know 0.92 0.75 or even 0.5 I could say okay there’s probably you know a to that gets divided in there somewhere or three-quarters or or you know rounding error or something but this is this is a factor of 10 this is a full order of magnitude different and that’s kind of bugging me because I know that it should be uh you know proportional to the equilibrium value now of course another thing that could be causing that is the the

initial distance between them it was about a 0.2 in the initial wave function the the red particle is not displaced i’m looking it up now to make sure that I’m saying something that makes sense yeah yeah the red particle the X is not this place whereas the Y is displaced by 0.2 so that’s probably what’s contributing to this just based on the numerology of matching up the orders of magnitude and so what I’d like to do next we got about three minutes left on this video so I’d like to talk about what we’re going to do next is investigate this distance between them so we’re not learning a whole lot from the wave function anymore and we really don’t learn a lot by looking at the red expectation value and the green expectation value what we’re really interested in is the difference and so what I’m going to do on the next episode is i’m going to set up the code to calculate just the expectation value of the disk difference between the red and the green so red expectation value minus screen expert to earth excuse me green expectation value minus red expectation about your green is one on top and that way it’ll produce just a single graph we won’t be worried about the red and the green and it’ll be a roughly flattish graph right just like these two are roughly consistently different from each other this is going to be a roughly flattish graph and I want to iterate that over a couple things I want to produce a family of curves for that over a couple things one is I want to change the the are men that equilibrium distance and see whether the difference in expectation value scales with the are minimum that difference i also want to change the amount by which the initial wave function is displaced so that zero point to change that to some different values and see how the the expectation value different changes with that and so if if I’m right about the are minimum we should see a significant change there if I’m right about the the wave function displacement we should see a difference there if I’m wrong about one of them then we won’t see a difference if I’m wrong about both of them then I really have to go back to the drawing board you know what else do you think I should try what else do you think I should try changing to look at different outcomes of the graph and so all we’re going to have on that you let me know in the comments below all we’re going to have in that video is going to be the I’ll be setting up the code and then the expectation value graph I’m not going to sit there animating wave function after wave function because number one that’s not going to be that interesting to watch but also you know hopefully then I can get the whole thing done running over one night instead of running over an entire week because I do kind of need my laptop for other purposes you know like doing ticket to ride route generators now i’m referring to another currently ongoing series on fridays on this channel so this video’s got about 30 seconds left on it i do want to thank you for watching i will close out with with the last little bit of animation there you can you know take whatever measurements you want off the graphs again thank you very much for watching I will see you next time bye

## Recent Comments