Welcome back in the previous lecture, we ended up with this nice result of a fairer mechanism, but
to be honest, it was pretty difficult and we had to play with the sample size, with the temperature
with a number of steps.
And another reason besides the local energy benchmark that leads to a problem in the convergence is
that the energy minimum is actually not well defined.
So here it is really a coincidence that all the magnetic moments point roughly along the out of clean
direction along Z.
They could point really in any direction, every so so as long as all moments point along the same direction,
as long as they are parallel.
This would give the same energy for the system.
And so all of these states are equal and they are equally likely to occur as the result of the simulation.
For example, they could all point downwards.
They could all point along the X direction, they could all point along any direction as long as they
are parallel.
So this also hinders a bit the convergence and makes everything more difficult.
So as an update, what I will do next is I will include another energy term here, and this will be
the so-called Zeeman energy or the interaction with an external magnetic field B. So there is a prefect
here, but we don't really care about prefectures.
We just take the dimensionless units, dimensionless quantities.
So I will just write mu is equal to one and then we define our magnetic fields, which is in the radio.
So I write B is equal to and got Perry.
And then we have here B x, y z.
And from the beginning, let's consider a B field along the X direction.
So, for example, like this, it has a strength one and it points along the X direction.
So now we can define our energy terms in a very similar way, as is done here.
So I start with the lower one, a right energy for kinetic.
So for magnetic field.
So you could give it really any name you want.
And all right, energy is equal to energy plus energy, kinetic contribution and then the magnetic contribution
it will bend will then be dysfunction here, and it will be the term as shown here on the right.
So it will this time not be a sum over pairs of moments, but just a single moment.
And then the scalar product with the magnetic field itself will just be minus New Times and P Dot Dot.
And then we arrived the B comma Mac and then all three components x y zero.
OK, so this is now our new energy and we can run this, and here I will update now.
Also, the step change sort of metropolis step because I will now include here the new energy term.
So he will write.
Of the two, we include the energy corresponding to the interaction with the magnetic fields, and here
are basically two just a copy of this cell, and we call this new step just step T. Because this will
be an hour or final solution.
And here I just have to add 40 energy terms to new one I right here, plus energy magnetic contribution
and my x y is correct.
And here I will do the same thing.
And that's really it.
So the thing is here we needed to two and now we don't need the two.
And this is because we have here a sum of pairs.
So this means AJ and GI give the same result, which is why we needed the factor of two.
And here we don't have this.
We just have a sum over I.
So really every interaction is only counted once, so we don't need the two here.
It's not.
Let's go ahead.
And maybe the magnetic field is a bit strong here.
Let's make it maybe a bit larger, a bit smaller, zero point one and let's run it and takes, of course,
a bit of time because I run it four or five million steps.
As before, and I will get back to you with the solution.
Just one thing I just noticed is that I did not update this cell.
So of course, we have to do this as well.
So let me do this real quickly.
So this would be here what we did previously, and now we need update to.
Ad interaction with magnetic fields.
And here the routine is just called Step T..
So now finally, I can see and I can rerun everything and I'll get back to you in a few seconds.
So I've increased the magnetic field here a bit to 0.5 along the X direction, and this is what we get
a pretty nice furrow magnet along the X direction.
So all the moments are parallel to each other, basically due to exchange, but also due to the magnetic
interaction.
And they prefer now this particular orientation.
So no, let me scroll back up and let me change this to the magnetic fields along the Z direction and
let me rerun the code and show you what happens then.
And this time, the result looks like a fairer magnet once again, but the moments really point along
the out of plain z direction.
Okay, so now with the magnetic field, we have a tool to really dictate the global orientation of all
the magnetic moments.
And this was just a generalization of the energy term where we have now not only the exchange interaction,
but also the Zeeman interaction, which is the interaction with the magnetic field.