Today, for some reason, the topic of magnets has come up several times.  I decided to take it as a sign (from the magnet aliens, perhaps) and write a bit about them.

Magnets are, indeed, magical.  The lodestone has been known for millennia, though how they actually work has only been able to be explained since the invention of quantum mechanics in the early 20th century.  The lodestone is an example of a ferromagnet, the prefix “ferro” stemming from the Latin word for iron, ferrum, since iron is abundant and the first natural magnets found, like this…

IMG_1788…are made of iron.   And when they were found, I’m sure minds were blown.  But how do they work?  By that, I mean, what is the origin of magnetism?  The answer…ATOMS!!!

A really simplistic view of an atom is the good old “solar system” model we all learned back in grade school.


You’ve got your nucleus chilling in the center and an electron cruising around along some path.  Electrons have charge and moving charge is what we call current.  Turns out that the flow of electrical current generates a magnetic field, a fact that my boy Hans Christian Ørstead accidentally found out in 1820.

Thanks, Wikipedia!
Thanks, Wikipedia!

He was running a lot of current through some wires, doing a completely unrelated thing.  Purely by coincidence, a magnetic compass happened to be sitting on the work bench near the wires.  He noticed that when the switch was flipped to let current run, the compass needle deflected.  That really started something because, until then, no one had ever thought that electricity and magnetism were related.  Guess what?!

Back to the atoms.  The electron cruising around can be thought of  kind of like a current running through a loop.  This creates a magnetic field that comes out of the loop, twists around, and goes back into the loop from the other side.



So, what we get is, basically, a little bar magnet, with a north and south pole.  The arrow represents something called the magnetic moment which is intimately related to a quantum mechanical concept called spin.  The magnetic moment points in the direction of the north pole of the magnet.  Now, in most materials, these little magnets are randomly aligned, like this…


But, in a ferromagnet, certain regions, called domains, have a collection of atoms that are all lined up.


When they’re randomized, the material on the macroscopic scale doesn’t appear magnetic, like copper or aluminum.  However, with ferromagnetic domains, the net magnetic moment of the atoms don’t cancel out and you get permanent magnet; on the macroscopic scale, the whole piece of material has a magnetic moment.

This isn’t the only way that magnetism manifests in material, though it is the most easily observable, so it’s the one we’re most familiar with.  Another common type is called antiferromagnetism.  An example of an antiferromagnetic material is common hematite.

IMG_6346In an antiferromagnet, there is no net magnetic moment because each atom is aligned such that it is opposite to its 4 nearest neighbors, like this…

IMG_5657Before you think, “well, who gives a crap about these” (if you’ve read this far, you do LOL), realize that the reading head in every hard drive…

Hard_disk_head…is an antiferromagnet.  Their structure is key to the process of reading information off of the magnetic platter, something called giant magnetoresistance , for which the Nobel Prize in physics was given out in 2007.  Go team!

The thing that makes both of these materials “do their thing”, as it were, is the idea of spin interaction.  We’ve all had the experience of setting two bar magnets next to each other.  We know that the opposite poles repel and the like poles attract.  Well, what happens if we put a bunch of them on a fixed lattice, like what you would have in a crystal of material?  What happens if you flip one of the magnets?  What do its neighbors do?  If you just assemble some atoms of, say, iron and let them sit for a while, what structure to they take?

It turns out, in physics we can write something called the Hamiltonian.  It represents the total energy of a system.  Nature, you see, is a miser and doesn’t want to use more energy than it needs to do anything.  So, things structure themselves over time to minimize this total amount of energy.  In the case of systems like ferromagnets and antiferromagnets, we can write the Hamiltonian like this (sorry for the math LOL)…

heisenbergWhat this means isn’t really important, other than the idea that you are adding up the energy for every single spin-spin interaction in the whole material…which is nuts!  The value of J is very important; this is called the interaction coupling constant.  It’s the only difference between a ferromagnet (J > 0) and an antiferromagnet (J < 0).  What the value of that is in a real material is dictated by the electronic structure of the atoms involved and various other things.  If you take some stuff, put it together and let if evolve over time, the spins will interact according to this rule until each atom is in the most energetically favorable configuration, a configuration called equilibrium.

One of the things that made me decide to write this post in the first place was the fact that I was tasked with writing a program that would simulate this interaction.  As you can imagine, simulating every single interaction of every atom in a material just isn’t possible.  So, the program I created makes a few concessions.

First off, I only deal with a lattice of atoms that is 50×50 (so 2500 atoms).  To put that in perspective, there are on the order of 10^23 atoms of iron in one gram (that piece of lodestone above is about 2.5 kilograms).  But, this small system’s behavior is indicative of a much larger system.  I’ll test that when I get a supercomputer…

Secondly, the program only considers interaction with the four nearest atoms, since they dominate the process.  In reality, the other atoms contribute as well, but the further away they are, the less influence they have, so we are safe to ignore them.  In physics, we call this first approximation.

Finally, the system is only two-dimensional.  Matter of fact, whoever figures out how to solve the three-dimensional system is totally winning a Nobel Prize.  That’s how it goes down in physics…turns out the universe is SUPER complicated LOL.

Here’s how it works.  First, it generates a random array of spins, like this.


Here, the red squares are spins pointing “up” and the black squares are spins pointing “down”.  The program then runs in a series of steps.  On each step, one of the 2500 atoms is randomly selected.  Then, the program makes the decision to flip it or not based on what is more energetically favorable given its neighbors configuration and it’s coupling constant.  The more energy it would take to flip a spin, the less likely it is to occur.

So, you give the program a value for that interaction constant J, let it go for a few hundred thousand step, and see how the system evolves.  If you let J be positive, then you have a ferromagnet.  After a buttload of steps (buttload = 100,000), that lattice of atoms turns into this…

FM_end They arrange themselves to the most stable state.  As you can see, those domains that I was talking about before readily form because that’s what the interaction constant dictates should happen.  This is the natural state for a ferromagnet!  Sweet!!

What about an anitferromagnet?  Well, we start with a random array again…

AFM_start…and let it arrange itself, this time letting that constant be negative.  That’s the ONLY difference between these two systems.  Do that, and you get this after a bunch of steps…

AFM_endOh SNAP!  Even this simple model (known as the 2D Ising model, btw) gives rise to the structures of both ferromagnets AND antiferromagnets as a natural progression that arises simply when you put these atoms together and let them do their thing.

For your amusement, I created two videos of these processes happening; they are linked below (as Quicktime files).  Not real great quality, but you get the idea.  They ping-pong back and forth, going from order to disorder.

Ferromagnet Ordering

Antiferromagnet Ordering

Indeed, if you started with an ordered system, like a magnetized piece of iron, and heated it up, it would break down like the video shows in reverse.  At low temperatures, the system orders itself, but at high temperatures, the energy being put into the system flips the spins and creates disorder.  If you put a bar magnet in the freezer, it will strengthen it.  Conversely, if you put it in boiling water, you will weaken it.

Different materials have different characteristic temperatures where the material changes from ordered to disordered; it turns our that iron’s is pretty high, which is why iron magnets are literally just lying around the surface of the Earth.

A completely trippy thing that you can try for yourself to in force this idea is listening to a bar magnet with a stethoscope.  The flipping of spins releases energy, which manifests as sound waves; if you listen to a bar magnet with a stethoscope, you will hear a kind of tinkling sound as the spins reorder themselves like the video show.

If you put these things IN a magnetic field, you influence the process.  Some of you may have wrapped a wire around a piece on metal, ran current through it, and magnetized the bar.  In that case, you are causing the magnetic moments of the atoms to align with the external field inside the coil of wire.  In a ferromagnet, the coupling constant says “that’s cool” and stays that after you remove the wire; that state has less energy.  If it’s a weakly magnetic material, the heat of the atmosphere will gradually cause chaos in the spin structure and cause the material to become demagnetized.

In a material like copper, the coupling constant is 0.  So, if you order them, they pretty much immediately become randomized again.  That’s why those materials can’t be permanent magnets.

That, in a nutshell, is how magnets work…well, the most common kinds, anyway.  Science rules.



  1. peter

    Without an insane clown posse reference, I cannot take this article seriously.

Leave a Reply

Your email address will not be published. Required fields are marked *