Added code to measure() to actually calculate the magnetization density.