Grace: a Graphics Accelerated Micromagnetic Code

Download the source code and windows executable here >>

Grace is a graphics accelerated micromagnetics code, written by Dr. Ru Zhu at Graceland University, Iowa. If you are interested in using Grace or have a question while using it, just send me an email at!

It uses fast Fourier transform (FFT) method to calculate the demagnetization field, six-neighborhood scheme to calculate the exchange field. It can also assign uniaxial anisotropy to simulation particles.

Grace is implemented on Microsoft’s C++ Accelerated Massive Parallelism (C++ AMP) platform. This ensures its computing capability on any modern computer, no matter what video card it has, NVidia, AMD or Intel.

Problems solved with Grace:

mmag standard problem #3:

In this problem, the cubic particle was discretized to 10×10×10 cells, and the transition point from flower state to vortex state was found to be near, where is the edge length of the cube and is the intrinsic length scale. The magnetizations of the cubic particle before and after the transition were shown in Fig. 1 and 2.

Fig. 1 In mmag standard problem 3, the magnetization in cubic particle in flower state at l = 8.47lex.

Fig. 2 In mmag standard problem 3, the magnetization in cubic particle in vortex state at.

mmag standard problem #4:

In this problem a rectangular film sample was divided in to 500×125×3 cells, with a mesh size of 1nm × 1nm × 1nm. The exchange constant of the sample was set as, and the saturation magnetization was. There was no anisotropy present. The system was relaxed to S-state by setting a large damping constant before a switching field 1 of (-24.6 mT, 4.3 mT, 0 mT). was applied. During the switching the damping constant α is set to 0.02.

According to Fig. 3 and 4 the average magnetization results and the magnetization distribution from Grace is in good agreement with that from OOMMF.

Fig.3. Average magnetization versus time during the reversal in mmag standard problem 4, field 1. OOMMF simulation results are also presented for comparison.

Fig.4. magnetization distribution when MX first crosses zero in mmag standard problem 4, field 1. The domain wall can be clearly seen at left 1/3 and 2/3 of the sample.


M.J. Donahue, D.G. Porter, Physica B 343, 177 (2004).

M. Najafi et al., J. Appl. Phys. 105, 113914 (2009).

Zhu, Ru. "Speedup of Micromagnetic Simulations with C++ AMP On Graphics Processing Units." arXiv preprint arXiv:1406.7459 (2014).

Zhu, Ru. "Grace: a Cross-platform Micromagnetic Simulator On Graphics Processing Units." arXiv preprint arXiv:1411.2565 (2014).

Zhu, Ru. "Accelerate micromagnetic simulations with GPU programming in MATLAB." arXiv preprint arXiv:1501.07293 (2015).

Natarajarathinam, A., et al. "Perpendicular magnetic tunnel junctions based on thin CoFeB free layer and Co-based multilayer synthetic antiferromagnet pinned layers." Journal of Applied Physics 111.7 (2012): 07C918.

Zhu, Ru, and Pieter B. Visscher. "Spin torque switching in perpendicular films at finite temperature." Journal of Applied Physics 103.7 (2008): 07A722.

Visscher, Pieter B., and Ru Zhu. "Low-dimensionality energy landscapes: Magnetic switching mechanisms and rates." Physica B: Condensed Matter407.9 (2012): 1340-1344.

Zhu, Ru. Theoretical investigation of new magnetic recording media using an energy landscape method. Diss. The University of Alabama TUSCALOOSA, 2011.