## The Stoner-Wohlfarth Model

The Stoner-Wohlfarth model for an isolated, single domain, ferromagnetic domain was a breakthrough in magnetics because of its simplicity and explanatory power. It successfully predicts hysteresis and the equilibrium state of the system (i.e. the direction of the magnetic moment vector in thermal equilibrium).

Here, in my first post using the brilliant IPython notebook, I have summarised some of the theory for the Stoner-Wohlfarth model to visualise the free energy of a magnetic nanoparticle in different states. The notebook is interactive and lets you play around with the external magnetic field and see the effect on the energy landscape.

I actually developed this tool for my own research, it helped me to validate that my calculations of the easy and hard axes were correct in my more complex models and also served as a quick tool for seeing the effects of varying an external magnetic field.

Having tidied it up a bit, I hope it proves useful to somebody else. This also marks the opening of the corresponding code repository for this blog. I'll use this space for any source code related to tutorials, and hopefully a few more notebooks.

## View the notebook online

You can view the notebook right here!

However, the interactive figures won't work in this static version.

## or Download and run the notebook

In order to use the interactive part of the notebook, you must download and run it, which requires you to be able to run IPython notebooks (requires python, IPython); you must have the numpy, scipy and matplotlib python libraries; finally you need to grab a copy of my helper functions which are available at the repository.

Once you've installed everything necessary, just make sure that the
`blogres.py` file is in the same directory as the notebook file
(both available from the repository), open a terminal and execute:

```
$ cd /path/to/SWModelNotebook.ipynb
$ ipython notebook
```

Enjoy learning about nano-magnetism through the brilliant medium of the IPython notebook!

## Comments

comments powered by Disqus