Skip to content

Commit c3fc080

Browse files
author
davidcorteso
committed
Merge branch 'master' of github.com:computationalmodelling/fidimag into minimiser_sd
2 parents 3224c12 + 02c060c commit c3fc080

File tree

5 files changed

+104
-58
lines changed

5 files changed

+104
-58
lines changed

LICENSE.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2222
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2323
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2424
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25-
26-
27-
If you use or extend this software, we encourage you to acknowledge
28-
this by citing
29-
30-
Weiwei Wang, Marc-Antonio Bisotti, David Cortes, Hans Fangohr.
31-
Fidimag, https://github.com/fangohr/fidimag (2015)
32-
33-
and by informing us by email ([email protected])
34-

README.md

Lines changed: 78 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,94 @@
1-
FIDIMAG
2-
=======
1+
# Fidimag
2+
33

44
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/computationalmodelling/fidimag/master)
55
[![Build Status](https://travis-ci.org/computationalmodelling/fidimag.svg?branch=master)](https://travis-ci.org/computationalmodelling/fidimag)
66
[![Documentation Status](https://readthedocs.org/projects/fidimag/badge/?version=latest)](http://fidimag.readthedocs.org/en/latest/?badge=latest)
77
[![codecov](https://codecov.io/gh/computationalmodelling/fidimag/branch/master/graph/badge.svg)](https://codecov.io/gh/computationalmodelling/fidimag)
88
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.167858.svg)](https://doi.org/10.5281/zenodo.167858)
9-
10-
FIDIMAG - a FInite DIfference microMAGnetic simulation environment
11-
12-
Fidimag solves finite-difference micromagnetic problems and
13-
supports atomistic simulations, using Python interface.
14-
15-
The webpage of the project is http://computationalmodelling.github.io/fidimag/
16-
17-
The GitHub page of the project is https://github.com/computationalmodelling/fidimag
18-
19-
The documentation is available at http://fidimag.readthedocs.io/en/latest/?badge=latest. Within the documentation are details on how to install Fidimag, and some example simulations are provided.
20-
21-
Various options of installation are described in the documentation, mostly by compiling from source. If you decide to install from source, you will need to add the path to this file is in to your $PYTHONPATH. Check the [documentation](http://fidimag.readthedocs.org) for more
22-
detailed installation help. The Virtual Micromagnetics project at http://virtualmicromagnetics.org provides virtual machines and Docker containers in which Fidimag can be executed.
23-
9+
[![Website](https://img.shields.io/website-up-down-green-red/http/shields.io.svg?label=Fidimag-Website)](http://computationalmodelling.github.io/fidimag/)
10+
11+
<img src="http://computationalmodelling.github.io/fidimag/figs/skyrmion.jpg" alt="Fidimag Image" width="400" align="right">
12+
13+
Fidimag solves finite-difference micromagnetic problems and supports atomistic simulations, using Python interface. The interface to both types of simulation is similar.
14+
15+
### Features
16+
* Offers LLG and LLG with spin torque terms (Zhang-Li and Sloncewski)
17+
* Calculations using the Nudged-Elastic-Band method to compute energy barriers.
18+
* Exchange, Zeeman, Demagnetising, Uniaxial Anisotropy energy classes.
19+
* Parallelised using OpenMP.
20+
* Easily extensible to add new features.
21+
* Cubic and Hexagonal Meshes in atomistic simulations.
22+
* Open-source under the 2-clause BSD Licence.
23+
24+
### Example
25+
Here we show how to relax a nanodisk system from an initial state. We have many more examples in the [documentation](http://fidimag.readthedocs.io/en/latest/?badge=latest)!
26+
27+
```python
28+
import fidimag
29+
from fidimag.common import CuboidMesh
30+
from fidimag.micro import Sim, UniformExchange, Demag, DMI, UniaxialAnisotropy
31+
mesh = CuboidMesh(nx=60, ny=60, nz=1, dx=2.0, dy=2.0, dz=2.0, unit_length=1e-9)
32+
33+
def Ms_init(position):
34+
"""
35+
Set where the system has magnetic material
36+
Form a nanodisk shape
37+
"""
38+
Ms = 8.6e5
39+
x, y, z = position
40+
if (x - 60)**2 + (y - 60)**2 < 60**2:
41+
return Ms
42+
else:
43+
return 0
44+
45+
def m_init(position):
46+
"""
47+
Approximate skyrmion profile
48+
"""
49+
x, y, z = position
50+
if (x - 60)**2 + (y - 60)**2 < 40**2:
51+
return (0, 0, 1)
52+
else:
53+
return (0, 0, -1)
54+
55+
sim = Sim(mesh, name='target_skyrmion')
56+
sim.set_Ms(Ms_init)
57+
sim.set_m(m_init)
58+
sim.add(Demag())
59+
sim.add(UniformExchange(A=1e-11))
60+
sim.add(DMI(D=3e-3))
61+
sim.add(UniaxialAnisotropy(Ku=4e5, axis=(0, 0, 1)))
62+
sim.relax()
63+
sim.save_vtk()
64+
```
65+
The results can be straightforwardly visualised from the outputted VTK files using programs such as Paraview:
66+
<p align="center">
67+
<img src="http://computationalmodelling.github.io/fidimag/figs/target.png" alt="Target Skyrmion State" width="250">
68+
</p>
69+
70+
71+
72+
73+
### Attributions
2474
The code is developed by Weiwei Wang, Marc-Antonio Bisotti, David Cortes, Thomas Kluyver, Mark Vousden, Ryan Pepper, Oliver Laslett, Rebecca Carey, and Hans Fangohr at the University of Southampton.
2575

2676
This is an early experimental version; contributions and pull requests to both the code and documentation are welcome.
77+
If you use Fidimag, please cite as:
78+
79+
David Cortés-Ortuño, Weiwei Wang, Ryan Pepper, Marc-Antonio Bisotti, Thomas Kluyver, Mark Vousden, & Hans Fangohr. (2016). Fidimag v2.0 [Data set]. Zenodo. http://doi.org/10.5281/zenodo.167858A bib file is provided in the repository.
2780

28-
# How to cite Fidimag
81+
### Publications
2982

30-
David Cortés-Ortuño, Weiwei Wang, Ryan Pepper, Marc-Antonio Bisotti, Thomas Kluyver, Mark Vousden, & Hans Fangohr. (2016). Fidimag v2.0 [Data set]. Zenodo. http://doi.org/10.5281/zenodo.167858
83+
The following publications, in reverse chronological order, have used Fidimag:
3184

32-
BibTeX:
85+
[1] [Thermal stability and topological protection of skyrmions in nanotracks](https://www.nature.com/articles/s41598-017-03391-8), D. Cortés-Ortuño, W. Wang, M. Beg, R.A. Pepper, M-A. Bisotti, R. Carey, M. Vousden, T. Kluyver, O. Hovorka & H. Fangohr, Scientific Reports 7, 4060 (2017)
3386

34-
<pre>
35-
@misc{htt&#8203;ps://doi.org/10.5281/zenodo.167858,
36-
doi = {10.5281/zenodo.167858},
37-
url = {ht&#8203;tps://doi.org/10.5281/zenodo.167858},
38-
author = {David Cort{\'e}s-Ortu{\~n}o and Weiwei Wang and Ryan Pepper and Marc-Antonio Bisotti and
39-
Thomas Kluyver and Mark Vousden and Hans Fangohr},
40-
publisher = {Zenodo},
41-
title = {Fidimag V2.0},
42-
year = {2016}
43-
}
44-
</pre>
87+
[2] [Current-induced instability of domain walls in cylindrical nanowires](http://iopscience.iop.org/article/10.1088/1361-648X/aa9698/meta), W. Wang, Z. Zhang, R.A. Pepper, C. Mu, Y. Zhou & Hans Fangohr, Journal of Physics: Condensed Matter, 30, 1 (2017)
4588

46-
# Acknowledgements
89+
[3] [Magnonic analog of relativistic Zitterbewegung in an antiferromagnetic spin chain](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.96.024430), W. Wang, C. Gu, Y. Zhou & H. Fangohr, Phys. Rev. B 96 (2017)
4790

48-
We acknowledge financial support from
91+
[4] [Magnon-Driven Domain-Wall Motion with the Dzyaloshinskii-Moriya Interaction](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.087203) W. Wang, M. Albert, M. Beg, M-A. Bisotti, D. Chernyshenko, D. Cortés-Ortuño, I. Hawke & H. Fangohr, Phys. Rev. Lett. 114, 087203 (2015)
4992

50-
- EPSRC’s Centre for Doctoral Training in Next Generation
51-
Computational Modelling, (EP/L015382/1)
52-
53-
- EPSRC’s Doctoral Training Centre in Complex System Simulation
54-
(EP/G03690X/1)
93+
### Acknowledgements
94+
We acknowledge financial support from EPSRC’s Centre for Doctoral Training in Next Generation Computational Modelling (EP/L015382/1) and EPSRC’s Doctoral Training Centre in Complex System Simulation (EP/G03690X/1)

fidimag/common/dipolar/demag.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "demagcoef.h"
66

77

8-
double Nxxdipole(double x, double y, double z) {
8+
inline double Nxxdipole(double x, double y, double z) {
99
double x2 = x * x;
1010
double y2 = y * y;
1111
double z2 = z * z;
@@ -16,7 +16,7 @@ double Nxxdipole(double x, double y, double z) {
1616
return -(2 * x2 - y2 - z2) / (R * R * r);
1717
}
1818

19-
double Nxydipole(double x, double y, double z) {
19+
inline double Nxydipole(double x, double y, double z) {
2020
double R = x * x + y * y + z * z;
2121
if (R == 0)
2222
return 0.0;
@@ -54,9 +54,16 @@ void compute_dipolar_tensors(fft_demag_plan *plan) {
5454
int lenx = plan->lenx;
5555
int leny = plan->leny;
5656
int lenz = plan->lenz;
57-
int lenxy = lenx * leny;
58-
59-
57+
int lenxy = lenx * leny;
58+
// Parallelising this like this
59+
// means that z should be the largest index
60+
// in order to get better performance from threading.
61+
// The data writing is not very clever here; we're
62+
// going to be invalidating the cache a lot. It would be better
63+
// maybe to split this into six seperate loops for each component
64+
// of the tensor in order that each thread is working on a smaller
65+
// memory address range
66+
#pragma omp parallel for private(j, i, x, y, z, id) schedule(dynamic, 32)
6067
for (k = 0; k < lenz; k++) {
6168
for (j = 0; j < leny; j++) {
6269
for (i = 0; i < lenx; i++) {
@@ -81,7 +88,7 @@ void compute_dipolar_tensors(fft_demag_plan *plan) {
8188
void compute_demag_tensors(fft_demag_plan *plan) {
8289

8390
int i, j, k, id;
84-
double x, y, z;
91+
double x, y, z, radius_sq;
8592

8693
int nx = plan->nx;
8794
int ny = plan->ny;
@@ -97,7 +104,7 @@ void compute_demag_tensors(fft_demag_plan *plan) {
97104

98105
double length = pow(dx*dy*dz, 1/3.0);
99106
double asymptotic_radius_sq = pow(26.0*length,2.0);
100-
107+
#pragma omp parallel for private(j, i, id, x, y, z, radius_sq) schedule(dynamic, 32)
101108
for (k = 0; k < lenz; k++) {
102109
for (j = 0; j < leny; j++) {
103110
for (i = 0; i < lenx; i++) {
@@ -107,7 +114,7 @@ void compute_demag_tensors(fft_demag_plan *plan) {
107114
y = (j - ny + 1) * dy;
108115
z = (k - nz + 1) * dz;
109116

110-
double radius_sq = x*x+y*y+z*z;
117+
radius_sq = x*x+y*y+z*z;
111118

112119
if (radius_sq>asymptotic_radius_sq){
113120
//printf("%g %g %g %g %g %g\n",x,y,z,dx,dy,dz);
@@ -338,7 +345,7 @@ void compute_fields(fft_demag_plan *plan, double *spin, double *mu_s, double *fi
338345
//print_r("hz", plan->hz, plan->total_length);
339346

340347
double scale = -1.0 / plan->total_length;
341-
348+
#pragma omp parallel for private(j, i, id1, id2) schedule(dynamic, 32)
342349
for (k = 0; k < nz; k++) {
343350
for (j = 0; j < ny; j++) {
344351
for (i = 0; i < nx; i++) {

fidimag/micro/dmi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class DMI(Energy):
5252
5353
D :: DMI vector norm which can be specified as an int, float, (X * n)
5454
array (X=6 for bulk DMI and X=4 for interfacial DMI), (n) array
55-
or spatially dependent scalar field function.
55+
or spatially dependent scalar field function. The units are
56+
Joules / ( meter **2 ).
5657
5758
int, float: D will have the same magnitude for every NN of the
5859
spins at every mesh node, given by this magnitude

fidimag/micro/exchange.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
class UniformExchange(Energy):
77

88
"""
9+
UniformExchange(A, name='UniformExchange')
10+
911
Compute the exchange field in micromagnetics.
12+
13+
Inputs:
14+
A: float
15+
A is the exchange stiffness constant measured in
16+
Joules / Meter (J / M)
17+
1018
"""
1119

1220
def __init__(self, A, name='UniformExchange'):

0 commit comments

Comments
 (0)