Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

Fidimag -- a finite difference atomistic and micromagnetic simulation package

Fidimag -- a finite difference atomistic and micromagnetic simulation package Bisotti, M-A, et al. 2018 Fidimag – A Finite Difference Atomistic Journal of and Micromagnetic Simulation Package. Journal of Open Research open research software Software, 6: 22. DOI: https://doi.org/10.5334/jors.223 SOFTWARE METAPAPER Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package 1 1 1 2 Marc-Antonio Bisotti , David Cortés-Ortuño , Ryan Pepper , Weiwei Wang , Marijan 3 1,3 1,3 Beg , Thomas Kluyver and Hans Fangohr Faculty of Engineering and the Environment, University of Southampton, Southampton, SO17 1BJ, UK Department of Physics, Ningbo University, Ningbo, 315211, CN European XFEL, 22869 Schenefeld, DE Corresponding author: Marc-Antonio Bisotti (mb8g11@soton.ac.uk) Fidimag is an open-source scientific code for the study of magnetic materials at the nano- or micro- scale using either atomistic or finite difference micromagnetic simulations, which are based on solving the Landau-Lifshitz-Gilbert equation. In addition, it implements simple procedures for calculating energy barriers in the magnetisation through variants of the nudged elastic band method. This computer software has been developed with the aim of creating a simple code structure that can be readily installed, tested, and extended. An agile development approach was adopted, with a strong emphasis on automated builds and tests, and reproducibility of results. The main code and interface to specify simulations are written in Python, which allows simple and readable simulation and analysis configuration scripts. Computationally costly calculations are written in C and exposed to the Python interface as Cython extensions. Docker containers are shipped for a convenient setup experience. The code is freely available on GitHub and includes documentation and examples in the form of Jupyter notebooks. Keywords: Python; Cython; finite differences; nanomaterials; micromagnetism; Landau-Lifshitz-Gilbert; LLG; spin-transfer torque; micromagnetic simulations; domain walls; skyrmions; vortex; vortices Funding Statement: We acknowledge financial support from EPSRC’s Centre for Doctoral Training in Next Generation Computational Modelling, (EP/L015382/1), EPSRC’s Doctoral Training Centre in Complex System Simulation (EP/G03690X/1), CONICYT Chilean scholarship programme Becas Chile (72140061), Horizon 2020 European Research Infrastructure project OpenDreamKit (676541), National Natural Science Foundation of China (11604169), and the Gordon and Betty Moore Foundation through Grant GBMF #4856, by the Alfred P. Sloan Foundation and by the Helmsley Trust. (1) Overview Heisenberg and micromagnetic models. Users of the Introduction software provide the magnetic parameters of the material The simulation of magnetic materials falls into several under study, the system geometry, and a set of initial paradigms, depending on the length scales, materials and conditions. The simulation can occur under different phenomena of interest. For many materials, the spin of kind of dynamics, with Fidimag implementing the atoms can be assumed to be localised around the atom, Landau-Lifshitz-Gilbert (LLG), the stochastic LLG (SLLG), and a classical approximation can be made in which and several spin-transfer torque variations of the LLG the atomic spin is treated as a point dipole – this is the equation. From this initial setup, the user can then choose classical Heisenberg model. Because the atomic crystal to evolve the system either through time, and hence study lattice of the material is considered, this discrete spin the magnetisation dynamics, or to “relax” the system to model is commonly referred to as atomistic [1], even find its metastable energy states. In addition, the software though a semi-classical magnetic moment is assumed per implements the nudged elastic band method to find lattice site. The continuum limit of this theory, known as minimum energy paths and the size of energy barriers micromagnetism, allows the computational treatment between different configuration states. of much larger systems, though this excludes the study Fidimag has been used to obtain the results in several of materials which exhibit antiferromagnetism and scientific publications [2, 3, 4, 5]. The supplementary data ferrimagnetism. to ref. [4] demonstrates that with Docker, the process of Fidimag is a software library which allows researchers correctly reproducing the results can be simplified to a to model magnetic materials using both the classical single, reliable Makefile instruction [6]. Art. 22, page 2 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Standard Problem 4 dynamics of a bar of Permalloy with the dimensions The Micromagnetic Modeling Activity Group μmag has 500 × 125 × 3 nm are computed. First, a relaxed ‘s-state’ defined a number of Standard Problems for the validation is obtained in the absence of an applied magnetic and comparison of micromagnetic simulation software field. It is plotted in Figure 1a. In a second simulation, [7]. The definitions of the problems and solutions from a Zeeman field is applied that causes a reversal of different research groups have been published on its the average magnetisation direction over the span website, and aim to show differences in approach between of a few hundred picoseconds. Figure 1b shows the different computational micromagnetic software. To this magnetisation configuration when the z-component of end, we have compared Fidimag to the published results, the spatially averaged magnetisation direction crosses and these problems are also given as examples in the 0. The system can be considered in equilibrium after Fidimag documentation. a nanosecond and the corresponding magnetisation For illustration, we show here the solution of Standard state is plotted in Figure 1c. The code used is printed Problem #4. In this example, the magnetisation reversal in Listing 1. import os import matplotlib.pyplot as plt import numpy as np from fidimag.micro import Sim, UniformExchange, Demag, Zeeman from fidimag.common import CuboidMesh from fidimag.common.constant import mu_0 mesh = CuboidMesh(nx=200, ny=50, nz=1, dx=2.5, dy=2.5, dz=3, unit_length=1e-9) A = 1.3e-11 Ms = 8.0e5 alpha = 0.02 gamma = 2.211e5 mT = 0.001 / mu_0 def compute_initial_magnetisation(): sim = Sim(mesh, name=‘problem4_init’) sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = 0.5 sim.driver.gamma = gamma sim.Ms = Ms sim.do_precession = False # saves time - not interested in dynamics here sim.set_m((1, 0.25, 0.1)) sim.add(UniformExchange(A)) sim.add(Demag()) sim.relax(dt=1e-13, stopping_dmdt=0.01, max_steps=5000, save_m_steps=None, save_vtk_steps=None) return sim.spin def compute_dynamics(initial_magnetisation): sim = Sim(mesh, name=‘problem4_dynamics’) sim.set_m(initial_magnetisation) sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = alpha sim.driver.gamma = gamma sim.Ms = Ms sim.add(UniformExchange(A)) sim.add(Demag()) sim.add(Zeeman([-24.6 * mT, 4.3 * mT, 0], name=‘H’), save_field=True) crossed_zero = False ts = np.linspace(0, 1e-9, 201) for t in ts: sim.driver.run_until(t) mx, my, mz = sim.compute_average() print(“t = {:.3} ns\t mx = {:.3}”.format(t*1e9, mx)) if mx <= 0 and not crossed_zero: print(“Crossed zero!”) np.save(“problem4_m_when_mz_0.npy”, sim.spin) crossed_zero = True return sim.spin def plot_quiver(m, filename): m.shape = (50, 200, 3) skip = 5 m = m[1::skip, 1::skip] xyz = mesh.coordinates xyz.shape = (50, 200, 3) xyz = xyz[1::skip, 1::skip] Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 3 of 11 plt.figure(figsize=(12, 3)) plt.axes().set_aspect(‘equal’) plt.quiver(xyz[:,:,0], xyz[:,:,1], m[:,:,0], m[:,:,1], m[:,:,1], pivot=‘mid’, scale=45, cmap=plt.get_cmap(‘jet’), edgecolors=‘None’) c = plt.colorbar() plt.xlabel(“x (nm)”) plt.ylabel(“y (nm)”) c.set_label(“$m_\mathrm{y}$ (1)”) plt.clim([0, 1]) plt.xlim([0, 500]) plt.ylim([0, 125]) plt.savefig(filename) if __name__ == ‘__main__’: m0_file = “problem4_m0.npy” if not os.path.exists(m0_file): m0 = compute_initial_magnetisation() np.save(m0_file, m0) else: m0 = np.load(m0_file) mf_file = “problem4_mf.npy” if not os.path.exists(mf_file): mf = compute_dynamics(m0) np.save(mf_file, mf) else: mf = np.load(mf_file) plot_quiver(m0, “problem4_m0.pdf”) plot_quiver(np.load(“problem4_m_when_mz_0.npy”), “problem4_m_when_mz_0.pdf”) plot_quiver(mf, “problem4_mf.pdf”) Listing 1: Solution to the standard problem #4. The simulation defined in the function compute_initial_ magnetisation returns the relaxed magnetisation configuration in absence of an applied magnetic field. In the function compute_dynamics that makes up the second simulation, the magnetic field that causes the magnetisation reversal is added on line 42. The snapshots in Figure 1 were made using the code in the function plot_quiver. (a) (b) (c) Figure 1: Snapshots of the unit magnetisation. The plots were created with the code in the function plot_quiver of listing 1. (a) The initial unit magnetisation of the bar of Permalloy described in standard problem #4. (b) The magnetisation conguration at the moment of the reversal of the average magnetisation. (c) The magnetisation after a nanosecond of simulation time has elapsed. Art. 22, page 4 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Figure 2: The components of the average magnetisation over time as computed with Fidimag and by OOMMF. The evolution of the spatially averaged magnetisation To describe a magnetic system, we firstly specify its is shown in Figure 2 with a comparison with the same geometry. If we simulate this system using a discrete spin simulation run with OOMMF. This comparison is performed model, we have to generate a lattice of magnetic moments regularly as part of Fidimag’s automated testing. with a specific arrangement of atoms (according to the crystal symmetry) such that they describe this geometry. Computational simulations of magnetic materials In the case of micromagnetics we use the finite differences At the atomic level, the magnetic effects in magnetic numerical technique, thus the sample is discretised into materials originate from two angular momentum terms cuboids and each one of them represents a volume with from electrons: their orbital motion around the nucleus uniform magnetisation inside that volume. and, mainly, from a quantum property of electrons called spin. Within a semi-classical model, the sum of their Dynamics contributions can be described by a three dimensional Magnetic phenomena emerge from the interactions vector S = μ s representing a magnetic moment (a magne- between magnetic moments and their interaction with i i i tic dipole) μ for every atom i, with a specific direction s . external and internal magnetic fields, the later including i i This idea originates from Heisenberg’s model Hamiltonian dipolar interactions and anisotropic interactions, among to describe magnetic interactions [8, 9]. In magnetic solids, others. These interactions depend on the material and atoms arrange in a lattice with a specific periodic crystal specify the total energy of the system. In general, the geometry. For example, a cubic lattice is made of repeated spins perform a precessional motion following directions cells where atoms and their corresponding magnetic set by the magnetic interaction. The dynamics of the moments lie at the corners of this cubic cell. magnetic moments is given by the Landau-Lifshitz-Gilbert An atom is at the scale of a few Angstrom, thus in large (LLG) equation [8, 9]. Within the discrete spin model this systems, which are at the nano-scale, it would be necessary dynamical equation for a single spin s, reads: to describe the system using thousands of spins, which s  is computationally expensive. Therefore, it is possible to sH   s sH , (1) eff eff t approximate the material as a continuum, where the field from discrete magnetic moments turns into a continuum at zero temperature, where H is an effective field that eff field called magnetisation that depends on the space contains the sum of every magnetic interaction present in coordinates r, assuming that neighbouring spins do not the system, γ is the Gilbert gyromagnetic ratio constant, change drastically in direction [8, 9]. This means the which sets the time scale of the spin motion, and limit from the discrete atoms into the space dependent 0 ≤ a ≤ 1 is the Gilbert damping. The first term in equation field s → M(r)/M = m(r). The magnitude of the field i s 1 describes a precessional motion of spins around the is measured through the saturation magnetisation M , effective field and the second term is a dissipative term which is defined as a magnetic moment per unit volume, that make spins follow the effective field direction. i.e. M = μ/ΔV, with ΔV as the volume of a unit cell of In micromagnetics this equation has the same structure: the discrete crystal lattice. This theory of magnetism in the continuum limit is known as micromagnetics.  M MH   M MH. (2) eff eff Numerically, the magnetisation field can be discretised  t into a mesh of magnetic moments M . i Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 5 of 11 Fidimag can solve the non-linear differential equations it is less than the unit and makes it decrease otherwise. 1 and 2, depending on the specified theoretical model. For time integration, Fidimag can use the CVODE solver Accordingly, it is necessary to specify an initial magnetic of the SUNDIALS suite [14] (wrapped via Cython) or the configuration for the spin directions, and the magnetic Fortran codes bundled in Scipy’s [15] integrate.ode. interactions involved in the system. Currently, Fidimag Fidimag also implements Heun’s method and the classic has the following interactions implemented in the code, fourth-order Runge-Kutta method. Because the time integrators will need a varying amount of evaluations of Exchange Favours the parallel or anti-parallel align- the right hand side function, i.e. the equation of motion ment of neighbouring spins. The exchange can be chosen in the last paragraph, it makes sense to partly computed using nearest neighbour approximations in relinquish runtime control from the user to the time the classical Heisenberg case. The continuum micro- integration. A so-called driver is in charge of coordinating magnetic model only allows parallel alignment. time integration and user needs. Time integration runs Dipolar interactions Product of the interaction of a uninterrupted for a specified amount of (simulated) time, spin with the field generated from the other spins in after which arbitrary code can be executed. the system. Dzyaloshinskii-Moriya Favours a canted alignment Nudged Elastic Band Method between neighbouring spins. Finding the lowest energy cost to drive a magnetic system Anisotropy Sets directions along which the system from one equilibrium state towards another, also known energy decreases when spins align towards them. as energy barrier, has become a relevant problem for Zeeman Product of the interaction of spins with an the analysis of the stability of magnetic structures. An external magnetic field. energy barrier is then associated to the transition path, between two states, that requires the least energy. This is The underlying equations that were used to implement important, for example, for the potential application of these interactions can be found in Ref. [10]. a magnetic structure in a technological device since an One method for finding energy minima in the system’s energy barrier can be used to estimate the lifetime of the energy landscape, which is implemented in the code, is to structure against energy fluctuations from excitations evolve the system with the LLG equation, since the spins such as thermal noise, present at finite temperatures. The will precess until a stable configuration is attained, i.e. a nudged elastic band method (NEBM) is a technique for the local or global minimum of energy, that depends on the calculation of minimum energy paths, and hence energy initial magnetic configuration. We refer to this process as barriers. It was first used in chemistry to study molecular relaxation. transitions [16]. It is based on fixing two equilibrium states, Dynamical effects such as the generation of spin waves, which can be local or global minima, and making copies, ferromagnetic resonance, domain wall motion, among called images, of the system in different configurations other multiple magnetism related phenomena, are also between these extrema. This sets a band of images and given by the evolution of spins with the LLG equation. each one of the images will have a different energy in the Variations of this equation are obtained when applying energy landscape associated to the system. The algorithm electric currents or temperature, which can also be will iteratively find a path in the energy landscape that specified in the code. Fidimag supports the inclusion decreases the energy cost of the band, trying to keep the of stochastic terms and spin-polarised currents in the images equally spaced in the energy landscape using an equation of motion. The terms and their corresponding inter-image spring force, to avoid images move towards equations are shown in Ref. [11]. the minima at the extremes of the band. After relaxation, At zero temperature the length of the magnetic the minimum energy path will cross one or more maxima moments and the magnetisation vector is fixed. This of energy, which set the energy barrier magnitude. An condition must be specified in the equation of motion of optimisation of the original algorithm has recently been spins explained in the last section, which sets a constraint published by Bessarab et al. [17], where geodesic distances to the spin length. Multiple magnetic phenomena can are defined in the energy landscape. We have implemented be explained at a zero-temperature formalism thus the the NEBM in Fidimag, which can be used both within majority of Fidimag’s equations are implemented in this micromagnetics and a discrete spin model. The optimised regime. version, called Geodesic NEBM is the one that performs Although this constraint is implicit in the LLG equation, more efficiently, and combines Cartesian coordinates for numerically the spin length varies when integrated. To the description of the spins and geodesic distances in address this problem, a correction term is added to the the energy landscape. Original versions of the algorithm, right hand side of equations 1 and 2 in Fidimag (equation which only use Cartesian or spherical coordinates, can 4 in Ref. [12]) [13]. It is proportional to: present convergence issues for systems with more complex magnetic configurations, such as vortices. To run a NEBM simulation, it is necessary to specify two equilibrium s   1ss. (3)     states, the number of images in between, and an initial t   state for the internal images. This initial configuration can and similar in the micromagnetic model, by setting be set by either manually creating a series of images in s → m. This term makes the spin length increase when different magnetic states or by using a linear interpolation Art. 22, page 6 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package for the spin directions, which is implemented in the code Finding the cube size of equal energies called single_ to generate the configurations automatically. domain_limit then involves nothing more than A detailed review of the method can be found in Ref. another function call, this time to a bisection method [17]. A study of the thermal stability of skyrmions, which called bisect provided by SciPy [15]. are vortex-like magnetic configurations, that uses the A similar approach had been used in Nmag, where it NEBM implemented in Fidimag, can be found in [4]. In has proven to be successful [13]. Unlike nmag however, addition, we tested our code with the skyrmions example Fidimag doesn’t require bundling the software with a from [17], making a repository with the simulation details modified Python binary. The approach is now seen in other in [18]. micromagnetic packages, for example micromagnum [23]. The Jupyter/OOMMF project follows a hybrid approach Implementation and architecture and harnesses the proven capabilities of the OOMMF Fidimag provides both micromagnetic and atomistic binary with a Python interface optimised for Jupyter simulation capabilities and is the only software that notebooks [24]. allows switching between the two modelling paradigms. Vampire is a performant atomistic code that defines The most notable micromagnetic code is OOMMF, which its own declarative syntax [1]. It comes in two versions, had its alpha release in 1998. OOOMMF is written in either a binary with an installation script or the code C++ and Tcl/Tk. Fidimag is mostly implemented in which needs to be compiled from source. In contrast, the Python programming language, with performance while the traditional installation methods are available, critical parts realised in C and linked in via Cython. The installing Fidimag with Docker is as easy as docker code base consists of roughly 5000 lines of Python code pull fidimag/notebook . and 4000 lines of C code and cython extensions. The Best practices recommend using version control for any tests and examples add another 5500 lines of Python. As kind of computational endeavours [25]. The code is stored Python is well established in the scientific community, it using the distributed version control system git and new presents a lower barrier to entry for programmers [19]. features are developed in branches. Automated testing Further, Python has a reputation for being easy to learn and builds of the software were priorities from the start. for beginners [20, 21]. This has informed the decision Because there are no command line parameters to record to build Fidimag as a software library instead of a GUI- or options set in a GUI program Fidimag offers a one-to- driven program. Indeed, Fidimag respects best practices one mapping of the simulation code to its result. This is a for Python’s module and namespacing system. boon for the goal of reproducibility that can’t be overstated. This library model of execution, where Fidimag is For example, Fidimag plays well with Sumatra [26] which imported into the namespace of a Python program allows for the automatic tracking of the computations empowers the user to deal with the complexity of the run. Jupyter Notebooks [27] are used for interactive batch processing of simulations in a more easily tested and tutorials and included in the extensive documentation reproducible way compared to ad-hoc shell commands [28]. There are tests that ensure that these notebooks and specialised batch modes in software with graphical are executing consistently, without errors, and that the user interfaces [22]. execution of the stored inputs match the stored outputs. The standard problem #3 especially examplifies how For this, a py.test plugin called nbval was developed and naturally Fidimag allows higher order logic thanks to made available to the open source community [29]. these choices. In it, two possible magnetic configurations Fidimag has an automated testing procedure that runs in cubes of increasing sizes are to be studied to determine on a public continuous integration system [30]. Fidimag’s when they are equally energetically favourable. In simple installation procedure via Docker, the extensive Listing  2 the logic of setting up and running the documentation including interactive tutorials stored in simulations, as well as comparing the total energies of the Jupyter notebooks and the accessible interface have made magnetisation in the two possible configurations has been it not only a useful tool for research as stated before, but abstracted into a function called energy_difference. also for teaching [31]. ””” Solution to μmag standard problem #3 with fidimag. http://www.ctcms.nist.gov/~rdm/mumag.org.html ””” from .cube_sim import energy_difference from scipy.optimize import bisect single_domain_limit = bisect(energy_difference, 8, 8.5, xtol=0.1) print(“L = {:.2} nm.”.format(str(single_domain_limit)) Listing 2: Solution to the standard problem #3. The code that computes the energy difference between the two possible magnetic configurations has been abstracted into the function energy_difference in the module cube_sim that is imported in line 6. The function energy_difference can then be handed off to a bisect method provided by SciPy to find the cube size for which both configurations have the same energy. Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 7 of 11 fidimag common atomistic micro defines time integration input/output common NEB method ... uses Anisotropy mesh Sim energies ... Zeeman uses user Figure 3: Architecture of Fidimag as reflected by the directory structure and Python modules. Code useful to micromagnetic and atomistic simulations was extracted into a common namespace. The red arrows point to user- facing parts of the system. The source code is split into three major sections Within the continuum approximation, Fidimag uses – ‘atomistic’, ‘micro’ and ‘common’ which contain finite differences which means dividing the sample into a code specifically for classical Heisenberg simulations, mesh of cubes, as shown in Figure 4a, where each cuboid micromagnetic simulations, and for both respectively, as centre represents the position of a magnetic moment can be seen in Figure 3. vector. Accordingly, derivatives for the calculation of There are many common components which can be magnetic interactions and energies are discretised using shared between both types of simulation. The primary differences between neighbouring mesh sites. The cuboid data in both atomistic and micromagnetics is stored in mesh is coded in the CuboidMesh class located in vector fields, and the mechanisms for passing this data Fidimag’s common directory. Distance between the centres through the simulation are kept in a common base and the number of cuboids in the three spatial directions ‘Sim’ class. This allows, for example, the saving of the are specified by the user. The indexes of every mesh site magnetisation progressive steps in the simulations to be are labelled following the x → y → z direction, as shown in handled identically for both types of simulation. Fidimag Figure 4a. To keep track of the neighbouring sites of every comes with visualisation and data saving utilities out of mesh site, the mesh class has a neighbours method the box. defined as an N × 6 array, where N is the total number of cuboids, that stores the indexes of nearest neighbours, Mesh and lattices with the value −1 for non-material sites. Correspondingly, As we mentioned earlier, we define a magnetic system by every row represents the 6 nearest neighbours in the setting its geometry. How the geometry is approximated (−x, +x, −y, +y, −z, +z) order. For instance, for the mesh depends on the chosen model. of Figure 4a and site 0 the neighbours array is [−1, Art. 22, page 8 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Figure 4: Cuboid mesh and hexagonal lattice labelled according to the index of the sites. 1, −1, 3, −1, 9]. This helps to easily implement directory. Another atomistic lattice implemented in interactions in Fidimag’s C functions. Fidimag is a two dimensional hexagonal lattice that can For the calculation of the demagnetising field, Fidimag be aligned along the x or y axis. The former is shown in uses a fast-Fourier-transform method that requires a Figure 4b. This lattice is defined in the HexagonalMesh uniform grid, hence for complex geometries, such as class in Fidimag’s atomistic directory. As in the curved samples, Fidimag still defines a cuboid mesh but CuboidMesh, a neighbours array keeps track of the boundaries or specific mesh sites without material are neighbours indexes, which are defined in the x → y order. approximated by setting the magnetisation as zero, M = 0. In Figure 4b we highlight, for example, the 6 neighbours Thus to obtain a better approximation it is necessary of the lattice site with index 12. to define a large number of cuboids and decrease the Using as a base the class structure of the meshes distance between their centres. In order to set a null currently implemented in Fidimag, it is possible to magnetisation, the user can specify a Python function that define and implement other crystal lattices such as body- has as an input the position vector and that returns M centered-cubic or face-centered-cubic arrangements. according to the sample geometry [13]. Besides scalars, most of the physical quantities involved In Listing 3 we set a 2 nm diameter sphere using a in micromagnetic computations are fields and vector 6 × 6 × 6 cuboid mesh with elements of 1nm × 1nm × 1nm fields. In Fidimag, they are represented with numpy arrays size. To simplify the dimensions scaling we set a unit [32]. There are utilities to instantiate them from point- length in the mesh definition. wise expressions. These fields are the objects the physical interactions in the simulations deal with. A quantity import fidimag import numpy as np central to the solution of the initial value problem given by the micromagnetic approach is the effective field, mesh = fidimag.common.CuboidMesh(nx=6, ny=6, nz=6, dx=1, dy=1, dz=1, which is itself a sum of smaller fields. Each of the smaller unit_length=1e-9) fields is the result of a separate computation which sim = fidimag.micro.Sim(mesh) represents the influence of an interaction present in the Ms = 1e6 # A / m system, like the exchange energy or the Dzyaloshinski- def sphere(r): Moriya interaction. For the dipolar field, we accelerate x, y, z = r the calculation using a convolution done in Fourier space if x ** 2 + y ** 2 <= 2 ** 2: [33, 34, 35], accelerated using the library FFTW. It is in return Ms else: the computation of the interactions where the differences return 0 between the micromagnetic and the atomistic approach sim.set_Ms(sphere) become the most apparent. Consequently, some energy terms are represented twice in the codebase – once for Listing 3: Definition of a 2 nm wide sphere geometry each model. With the effective field computed for a given using micromagnetics. state of the magnetisation the next step is solving the In the case of discrete spin simulations, atoms order equation of motion for the system, which is the Landau- in a lattice according to different crystallographic Lifshitz-Gilbert equation or one of its many variants. arrangements. The most simple ordering is the simple cubic lattice (SC), where atoms centres lie at the centre Quality control of cubes separated by the same distance in the three Testing small chunks of code and preferably isolated spatial dimensions. Since this follows the same principle pieces of the system is unit testing. In Fidimag, most of as the finite differences cuboid mesh, Fidimag uses the the unit tests compute and check the physical quantities same CuboidMesh class as the one for micromagnetic involved in succesfully running a simulation. Besides simulations, thus it is defined in Fidimag’s common giving helpful feedback during development, the unit tests Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 9 of 11 def test_save_scalar_field_hexagonal_mesh(tmpdir): mesh = HexagonalMesh(radius=1, nx=3, ny=3) s = scalar_field(mesh, lambda r: r[0] + r[1]) vtk = VTK(mesh, directory=str(tmpdir), filename=”scalar_hexagonal”) vtk.save_scalar(s, name=”s”) assert same_as_ref(vtk.write_file(), REF_DIR) Listing 4: A unit test in which a scalar field s is created on a hexagonal mesh, saved to a VTK file and compared to a reference file. Programming language were a factor in increasing confidence to edit, enhance or Python version 3, C, cython. refactor the code, resulting in the improved decoupling and maintainability of it. The coverage of Fidimag’s code Additional system requirements base with unit tests is monitored using codecov [36]. At E.g. memory, disk space, processor, input devices, output the time of writing, it reports 73% coverage. devices. Functional testing then examines a slice of the system. For example, one of the test cases covering the saving of Dependencies scalar fields on hexagonal meshes to a VTK file in Fidimag E.g. libraries, frameworks, incl. minimum version is shown in Listing 4. compatibility. Finally, system tests use Fidimag as a black box and compare simulation output to known good values. These 1. Numpy ≥ 1.10 values are obtained from problems that have analytical 2. SciPy ≥ 1.0.0 solutions like the macrospin or domain walls. As we saw 3. SUNDIALS ≥ 2.7.0 earlier, the μmag standard problems are another good 4. FFTW ≥ 3.3.4 source of testing data. So are other finite difference codes, like the aforementioned OOMMF. Fidimag builds using the OpenMP versions of these Fidimag is also tested against the output of earlier libraries for multiprocessing purposes. versions of itself by storing some simulation results in the repository. This is a form of regression testing, and since no List of contributors external software or potentially long-running simulations Please list anyone who helped to create the software (who are involved the fastest way to check if a changeset has may also not be an author of this paper), including their affected the computational parts in a tangible way. The roles and affiliations. design choices discussed in the introduction and the focus on testing continue to provide tangible benefits 1. Bisotti, Marc-Antonio to the collaborators working on the software, as well as 2. Wang, Weiwei the software itself, as shown above. They also increase 3. Cortés-Ortuño, David the confidence in Fidimag›s results since unlike users, 4. Fangohr, Hans automated tests don›t distinguish between new and 5. Pepper, Ryan old code and test potentially seldom-used parts of the 6. Kluyver, Thomas software just as often as the commonly used functions. 7. Vousden, Mark For maximum value, the tests need to be run often and 8. Beg, Marijan ideally without manual intervention. This is why a test cycle is triggered on the continuous integration platform Software location Travis CI [30] on every push to the Github repository. First, Archive Fidimag’s C code and cython extensions are compiled. (e.g. institutional repository, general repository) (required Then the tests are run. Finally the Jupyter notebooks are please see instructions on journal website for depositing run and tested and the documentation is built. archive copy of software in a suitable repository) To quickly check if Fidimag is installed and working on Name: Fidimag a machine, a user can launch an interactive Python shell Persistentidentifier: https://zenodo.org/record/841113 and execute import fidimag . This command should not Licence: BSD output any text. Afterwards, the user may chose to follow Publisher: Hans Fangohr along with the tutorial called A Basic Simulation [37] or Version published: 2.5 launch the provided examples. If Fidimag was installed Date published: 10/08/17 from source, make test-basic will run a selection of tests that completes in under a minute, which is also Code repository helpful for smoke testing purposes during development (e.g. SourceForge, GitHub etc.) (required) on Fidimag. Name: Fidimag Persistent identifier: https://github.com/ (2) Availability computationalmodelling/fidimag Operating system Licence: BSD GNU/Linux, Mac OS X and on any platform supported by Date published: August 8, 2018 Docker, like Azure and AWS. Art. 22, page 10 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Emulation environment 7. Micromagnetic Modeling Activity Group. μMAG (if appropriate) micromagnetics website. http://www.ctcms.nist. Name: The name of the archive. gov/ rdm/mumag.org.html. Accessed: 2017-09-25. Persistentidentifier: e.g. DOI, handle, PURL, etc. 8. Aharoni, A 2000 Introduction to the Theory of Licence: Open license under which the software is Ferromagnetism, second edition, 109. Oxford University licensed. Press. Date published: dd/mm/yy 9. Chikazumi, S 2009 Physics of Ferromagnetism, volume 94 of International Series of Monographs on Language Physics, second edition. Oxford University Press. Language of repository, software and supporting files. 10. Fidimag Documentation – core equations. https:// English. fidimag.readthedocs.io/en/latest/core_eqs.html. Accessed: 2018-02-06. (3) Reuse potential 11. Fidimag Documentation – extended equations. The simulations are written in Python and use Fidimag https://fidimag.readthedocs.io/en/latest/extended_ as a library to be imported. Fidimag has been used to eqs.html. Accessed: 2018-02-06. gather results for a number of scientific publications [2, 12. Fischbacher, T and Fangohr, H July 2009 Continuum 3, 4, 5] in the field of micromagnetics. It can be extended multi-physics modeling with scripting languages: The to account for other energy terms, to support more time Nsim simulation compiler prototype for classical field integration methods or other variants of the equation of theory. ArXiv e-prints. motion, as well as other drivers. Users can get in touch 13. Fischbacher, T, Franchin, M, Bordignon, G and with the development team on Fidimag’s issue page on Fangohr, H June 2007 A systematic approach to GitHub [38]. multiphysics extensions of finite-element-based micromagnetic simulations: Nmag. IEEE Transactions Notes on Magnetics, 43(6): 2896–2898. DOI: https://doi. For this reason when we mention spins we strictly refer org/10.1109/TMAG.2007.893843 to the total angular momentum or magnetic moments. 14. Hindmarsh, A C, Brown, P N, Grant, K E, Lee, S L, Numbers obtained with cloc version 1.60. Serban, R, Shumaker, D E and Woodward, C S 2005 SUNDIALS: Suite of nonlinear and differential/algebraic Competing Interests equation solvers. ACM Transactions on Mathematical The authors have no competing interests to declare. Software (TOMS), 31(3): 363–396. 15. Jones, E, Oliphant, T, Peterson, P, et al. 2001 SciPy: References Open source scientific tools for Python. http://www. 1. Evans, R F L, Fan, W J, Chureemart, P, Ostler, T scipy.org. Accessed: 2017-01-22. A, Ellis, M O A and Chantrell, R W 2014 Atomistic 16. Henkelman, G, Uberuaga, B P and Jónsson, H 2000 spin model simulations of magnetic nanomaterials. A climbing image nudged elastic band method for Journal of Physics: Condensed Matter, 26(10): finding saddle points and minimum energy paths. The 103202. DOI: https://doi.org/10.1088/0953- Journal of Chemical Physics, 113(22): 9901–9904. DOI: 8984/26/10/103202 https://doi.org/10.1063/1.1329672 2. Wang, W, Albert, M, Beg, M, Bisotti, M-A, 17. Bessarab, P F, Uzdin, V M and Jónsson, H 2015 Chernyshenko, D, Cortés-Ortuño, D, Hawke, I and Method for finding mechanism and activation Fangohr, H Feb 2015 Magnon-driven domain-wall energy of magnetic transitions, applied to skyrmion motion with the dzyaloshinskii-moriya interaction. and antivortex annihilation. Computer Physics Phys. Rev. Lett., 114: 087203. DOI: https://doi. Communications, 196(Supplement C): 335–347. DOI: org/10.1103/PhysRevLett.114.087203 https://doi.org/10.1016/j.cpc.2015.07.001 3. Wang, W, Beg, M, Zhang, B, Kuch, W and Fangohr H 18. Cortés-Ortuño, D and Fangohr, H Nov 2016 Test Jul 2015 Driving magnetic skyrmions with microwave system for nudged elastic band method in nanoscale fields. Phys. Rev. B, 92: 020403. DOI: https://doi. magnetism. org/10.1103/PhysRevB.92.020403 19. Beazley, D M 2000 Scientific Computing with 4. Cortés-Ortuño, D, Wang W, Beg, M, Pepper, R Python. In: Manset, N, Veillet, C and Crabtree, D (eds.), A, Bisotti, M-A, Carey, R, Vousden, M, Kluyver, T, Astronomical Data Analysis Software and Systems IX, Hovorka, O and Fangohr, H 2017 Thermal stability Astronomical Society of the Pacific Conference Series , and topological protection of skyrmions in nanotracks. 216: 49. Scientific Reports , 7(1): 4060. DOI: https://doi. 20. Fangohr, H 2004 A comparison of C, Matlab, and org/10.1038/s41598-017-03391-8 Python as teaching languages in engineering. In: 5. Wang, W, Zhang, C, Pepper, R, Mu, C, Zhou, Y Bubak, M, van Albada, G D, Sloot, P M A and Dongarra, J and Fangohr, H 2017 Current-induced instability (eds.), Computational Science – ICCS 2004, 1210–1217. of domain walls in cylindrical nanowires. Journal of Berlin, Heidelberg. Springer Berlin Heidelberg. DOI: Physics: Condensed Matter. https://doi.org/10.1007/978-3-540-25944-2_157 6. Cortés-Ortuño, D and Fangohr, H November 2016 21. Fangohr, H, Albert, M and Franchin, M 2016 Nmag Thermal stability and topological protection of micromagnetic simulation tool: Software engineering skyrmions: Supplementary data. lessons learned. In: Proceedings of the International Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 11 of 11 Workshop on Software Engineering for Science, 30. Travis CI GmbH computationalmodelling/fidimag SE4Science ’16, 1–7. New York, NY, USA. ACM. – travis ci. https://travis-ci.org/computational 22. Beg, M, Pepper, R A and Fangohr, H 2017 User modelling/fidimag. Accessed: 2017-10-04. interfaces for computational science: A domain 31. Schrefl, T Private communication. specific language for oommf embedded in python. 32. van der Walt, S, Colbert, S C and Varoquaux, AIP Advances, 7(5): 056025. DOI: https://doi. G March 2011 The numpy array: A structure for org/10.1063/1.4977225 efficient numerical computation. Computing in 23. MicroMagnum http://micromagnum.informatik.uni- Science Engineering, 13(2): 22–30. DOI: https://doi. hamburg.de. Accessed: 2017-10-12. org/10.1109/MCSE.2011.37 24. Beg, M, Pepper, R A and Fangohr, H 2017 User 33. Yuan, S W and Bertram, H N Sept 1992 Fast adaptive interfaces for computational science: A domain algorithms for micromagnetics. IEEE Transactions specific language for oommf embedded in python. on Magnetics, 28(5): 2031–2036. DOI: https://doi. AIP Advances, 7(5): 056025. DOI: https://doi. org/10.1109/20.179394 org/10.1063/1.4977225 34. Hayashi, N, Saito, K and Nakatani, Y 1996 25. Fowler, M 1999 Refactoring: Improving the Design of Calculation of demagnetizing field distribution based Existing Code. Addison-Wesley, Boston, MA, USA. on fast fourier transform of convolution. Japanese 26. Davison, A 2012 Automated capture of experiment Journal of Applied Physics, 35(12R): 6065. DOI: https:// context for easier reproducibility in computational doi.org/10.1143/JJAP.35.6065 research. Computing in Science & Engineering, 14: 48– 35. Hinzke, D and Nowak, U 2000 Magnetization 56. DOI: https://doi.org/10.1109/MCSE.2012.41 switching in nanowires: Monte carlo study with fast 27. Kluyver, T, Ragan-Kelley, B, Pérez, F, Granger, B, fourier transformation for dipolar fields. Journal Bussonnier, M, Frederic, J, Kelley, K, Hamrick, of Magnetism and Magnetic Materials, 221(3): J, Grout, J, Corlay, S, Ivanov, P, Avila, D, Abdalla, 365–372. DOI: https://doi.org/10.1016/S0304- S, Willing, C and Jupyter development team 8853(00)00516-3 [Unknown] 2016 Jupyter notebooks – a publishing 36. Codecov LLC Dashboard computational format for reproducible computational workflows. modelling/fidimag. https://codecov.io/gh/comp 28. Fidimag Documentation. http://fidimag.readthedocs. utationalmodelling/fidimag. Accessed: 2017-10-04. io/en/latest/. Accessed: 2017-10-12. 37. Fidimag Tutorial: A basic simulation. http://fidimag. 29. Cortés-Ortuño, D, Laslett, O, Kluyver, T, Fauske, V, readthedocs.io/en/latest/ipynb/tutorial-basics.html. Albert, M, Min, RK, Hovorka, O and Fangohr, H 2014 Accessed: 2017-11-29. nbval: a py.test plugin for validating jupyter notebooks. 38. Fidimag Issue page on github. https://github.com/ https://github.com/computationalmodelling/nbval. computationalmodelling/fidimag/issues. Accessed: Accessed: 2017-09-25. 2018-02-13. How to cite this article: Bisotti, M-A, Cortés-Ortuño, D, Pepper, R, Wang, W, Beg, M, Kluyver, T and Fangohr, H 2018 Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package. Journal of Open Research Software, 6: 22. DOI: https://doi.org/10.5334/jors.223 Submitted: 14 February 2018 Accepted: 15 August 2018 Published: 06 September 2018 Copyright: © 2018 The Author(s). This is an open-access article distributed under the terms of the Creative Commons Attribution 4.0 International License (CC-BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. See http://creativecommons.org/licenses/by/4.0/. Journal of Open Research Software is a peer-reviewed open access journal published by OPEN ACCESS Ubiquity Press http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Condensed Matter arXiv (Cornell University)

Fidimag -- a finite difference atomistic and micromagnetic simulation package

Loading next page...
 
/lp/arxiv-cornell-university/fidimag-a-finite-difference-atomistic-and-micromagnetic-simulation-s0Au10G85X
ISSN
2049-9647
eISSN
ARCH-3331
DOI
10.5334/jors.223
Publisher site
See Article on Publisher Site

Abstract

Bisotti, M-A, et al. 2018 Fidimag – A Finite Difference Atomistic Journal of and Micromagnetic Simulation Package. Journal of Open Research open research software Software, 6: 22. DOI: https://doi.org/10.5334/jors.223 SOFTWARE METAPAPER Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package 1 1 1 2 Marc-Antonio Bisotti , David Cortés-Ortuño , Ryan Pepper , Weiwei Wang , Marijan 3 1,3 1,3 Beg , Thomas Kluyver and Hans Fangohr Faculty of Engineering and the Environment, University of Southampton, Southampton, SO17 1BJ, UK Department of Physics, Ningbo University, Ningbo, 315211, CN European XFEL, 22869 Schenefeld, DE Corresponding author: Marc-Antonio Bisotti (mb8g11@soton.ac.uk) Fidimag is an open-source scientific code for the study of magnetic materials at the nano- or micro- scale using either atomistic or finite difference micromagnetic simulations, which are based on solving the Landau-Lifshitz-Gilbert equation. In addition, it implements simple procedures for calculating energy barriers in the magnetisation through variants of the nudged elastic band method. This computer software has been developed with the aim of creating a simple code structure that can be readily installed, tested, and extended. An agile development approach was adopted, with a strong emphasis on automated builds and tests, and reproducibility of results. The main code and interface to specify simulations are written in Python, which allows simple and readable simulation and analysis configuration scripts. Computationally costly calculations are written in C and exposed to the Python interface as Cython extensions. Docker containers are shipped for a convenient setup experience. The code is freely available on GitHub and includes documentation and examples in the form of Jupyter notebooks. Keywords: Python; Cython; finite differences; nanomaterials; micromagnetism; Landau-Lifshitz-Gilbert; LLG; spin-transfer torque; micromagnetic simulations; domain walls; skyrmions; vortex; vortices Funding Statement: We acknowledge financial support from EPSRC’s Centre for Doctoral Training in Next Generation Computational Modelling, (EP/L015382/1), EPSRC’s Doctoral Training Centre in Complex System Simulation (EP/G03690X/1), CONICYT Chilean scholarship programme Becas Chile (72140061), Horizon 2020 European Research Infrastructure project OpenDreamKit (676541), National Natural Science Foundation of China (11604169), and the Gordon and Betty Moore Foundation through Grant GBMF #4856, by the Alfred P. Sloan Foundation and by the Helmsley Trust. (1) Overview Heisenberg and micromagnetic models. Users of the Introduction software provide the magnetic parameters of the material The simulation of magnetic materials falls into several under study, the system geometry, and a set of initial paradigms, depending on the length scales, materials and conditions. The simulation can occur under different phenomena of interest. For many materials, the spin of kind of dynamics, with Fidimag implementing the atoms can be assumed to be localised around the atom, Landau-Lifshitz-Gilbert (LLG), the stochastic LLG (SLLG), and a classical approximation can be made in which and several spin-transfer torque variations of the LLG the atomic spin is treated as a point dipole – this is the equation. From this initial setup, the user can then choose classical Heisenberg model. Because the atomic crystal to evolve the system either through time, and hence study lattice of the material is considered, this discrete spin the magnetisation dynamics, or to “relax” the system to model is commonly referred to as atomistic [1], even find its metastable energy states. In addition, the software though a semi-classical magnetic moment is assumed per implements the nudged elastic band method to find lattice site. The continuum limit of this theory, known as minimum energy paths and the size of energy barriers micromagnetism, allows the computational treatment between different configuration states. of much larger systems, though this excludes the study Fidimag has been used to obtain the results in several of materials which exhibit antiferromagnetism and scientific publications [2, 3, 4, 5]. The supplementary data ferrimagnetism. to ref. [4] demonstrates that with Docker, the process of Fidimag is a software library which allows researchers correctly reproducing the results can be simplified to a to model magnetic materials using both the classical single, reliable Makefile instruction [6]. Art. 22, page 2 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Standard Problem 4 dynamics of a bar of Permalloy with the dimensions The Micromagnetic Modeling Activity Group μmag has 500 × 125 × 3 nm are computed. First, a relaxed ‘s-state’ defined a number of Standard Problems for the validation is obtained in the absence of an applied magnetic and comparison of micromagnetic simulation software field. It is plotted in Figure 1a. In a second simulation, [7]. The definitions of the problems and solutions from a Zeeman field is applied that causes a reversal of different research groups have been published on its the average magnetisation direction over the span website, and aim to show differences in approach between of a few hundred picoseconds. Figure 1b shows the different computational micromagnetic software. To this magnetisation configuration when the z-component of end, we have compared Fidimag to the published results, the spatially averaged magnetisation direction crosses and these problems are also given as examples in the 0. The system can be considered in equilibrium after Fidimag documentation. a nanosecond and the corresponding magnetisation For illustration, we show here the solution of Standard state is plotted in Figure 1c. The code used is printed Problem #4. In this example, the magnetisation reversal in Listing 1. import os import matplotlib.pyplot as plt import numpy as np from fidimag.micro import Sim, UniformExchange, Demag, Zeeman from fidimag.common import CuboidMesh from fidimag.common.constant import mu_0 mesh = CuboidMesh(nx=200, ny=50, nz=1, dx=2.5, dy=2.5, dz=3, unit_length=1e-9) A = 1.3e-11 Ms = 8.0e5 alpha = 0.02 gamma = 2.211e5 mT = 0.001 / mu_0 def compute_initial_magnetisation(): sim = Sim(mesh, name=‘problem4_init’) sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = 0.5 sim.driver.gamma = gamma sim.Ms = Ms sim.do_precession = False # saves time - not interested in dynamics here sim.set_m((1, 0.25, 0.1)) sim.add(UniformExchange(A)) sim.add(Demag()) sim.relax(dt=1e-13, stopping_dmdt=0.01, max_steps=5000, save_m_steps=None, save_vtk_steps=None) return sim.spin def compute_dynamics(initial_magnetisation): sim = Sim(mesh, name=‘problem4_dynamics’) sim.set_m(initial_magnetisation) sim.driver.set_tols(rtol=1e-10, atol=1e-10) sim.driver.alpha = alpha sim.driver.gamma = gamma sim.Ms = Ms sim.add(UniformExchange(A)) sim.add(Demag()) sim.add(Zeeman([-24.6 * mT, 4.3 * mT, 0], name=‘H’), save_field=True) crossed_zero = False ts = np.linspace(0, 1e-9, 201) for t in ts: sim.driver.run_until(t) mx, my, mz = sim.compute_average() print(“t = {:.3} ns\t mx = {:.3}”.format(t*1e9, mx)) if mx <= 0 and not crossed_zero: print(“Crossed zero!”) np.save(“problem4_m_when_mz_0.npy”, sim.spin) crossed_zero = True return sim.spin def plot_quiver(m, filename): m.shape = (50, 200, 3) skip = 5 m = m[1::skip, 1::skip] xyz = mesh.coordinates xyz.shape = (50, 200, 3) xyz = xyz[1::skip, 1::skip] Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 3 of 11 plt.figure(figsize=(12, 3)) plt.axes().set_aspect(‘equal’) plt.quiver(xyz[:,:,0], xyz[:,:,1], m[:,:,0], m[:,:,1], m[:,:,1], pivot=‘mid’, scale=45, cmap=plt.get_cmap(‘jet’), edgecolors=‘None’) c = plt.colorbar() plt.xlabel(“x (nm)”) plt.ylabel(“y (nm)”) c.set_label(“$m_\mathrm{y}$ (1)”) plt.clim([0, 1]) plt.xlim([0, 500]) plt.ylim([0, 125]) plt.savefig(filename) if __name__ == ‘__main__’: m0_file = “problem4_m0.npy” if not os.path.exists(m0_file): m0 = compute_initial_magnetisation() np.save(m0_file, m0) else: m0 = np.load(m0_file) mf_file = “problem4_mf.npy” if not os.path.exists(mf_file): mf = compute_dynamics(m0) np.save(mf_file, mf) else: mf = np.load(mf_file) plot_quiver(m0, “problem4_m0.pdf”) plot_quiver(np.load(“problem4_m_when_mz_0.npy”), “problem4_m_when_mz_0.pdf”) plot_quiver(mf, “problem4_mf.pdf”) Listing 1: Solution to the standard problem #4. The simulation defined in the function compute_initial_ magnetisation returns the relaxed magnetisation configuration in absence of an applied magnetic field. In the function compute_dynamics that makes up the second simulation, the magnetic field that causes the magnetisation reversal is added on line 42. The snapshots in Figure 1 were made using the code in the function plot_quiver. (a) (b) (c) Figure 1: Snapshots of the unit magnetisation. The plots were created with the code in the function plot_quiver of listing 1. (a) The initial unit magnetisation of the bar of Permalloy described in standard problem #4. (b) The magnetisation conguration at the moment of the reversal of the average magnetisation. (c) The magnetisation after a nanosecond of simulation time has elapsed. Art. 22, page 4 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Figure 2: The components of the average magnetisation over time as computed with Fidimag and by OOMMF. The evolution of the spatially averaged magnetisation To describe a magnetic system, we firstly specify its is shown in Figure 2 with a comparison with the same geometry. If we simulate this system using a discrete spin simulation run with OOMMF. This comparison is performed model, we have to generate a lattice of magnetic moments regularly as part of Fidimag’s automated testing. with a specific arrangement of atoms (according to the crystal symmetry) such that they describe this geometry. Computational simulations of magnetic materials In the case of micromagnetics we use the finite differences At the atomic level, the magnetic effects in magnetic numerical technique, thus the sample is discretised into materials originate from two angular momentum terms cuboids and each one of them represents a volume with from electrons: their orbital motion around the nucleus uniform magnetisation inside that volume. and, mainly, from a quantum property of electrons called spin. Within a semi-classical model, the sum of their Dynamics contributions can be described by a three dimensional Magnetic phenomena emerge from the interactions vector S = μ s representing a magnetic moment (a magne- between magnetic moments and their interaction with i i i tic dipole) μ for every atom i, with a specific direction s . external and internal magnetic fields, the later including i i This idea originates from Heisenberg’s model Hamiltonian dipolar interactions and anisotropic interactions, among to describe magnetic interactions [8, 9]. In magnetic solids, others. These interactions depend on the material and atoms arrange in a lattice with a specific periodic crystal specify the total energy of the system. In general, the geometry. For example, a cubic lattice is made of repeated spins perform a precessional motion following directions cells where atoms and their corresponding magnetic set by the magnetic interaction. The dynamics of the moments lie at the corners of this cubic cell. magnetic moments is given by the Landau-Lifshitz-Gilbert An atom is at the scale of a few Angstrom, thus in large (LLG) equation [8, 9]. Within the discrete spin model this systems, which are at the nano-scale, it would be necessary dynamical equation for a single spin s, reads: to describe the system using thousands of spins, which s  is computationally expensive. Therefore, it is possible to sH   s sH , (1) eff eff t approximate the material as a continuum, where the field from discrete magnetic moments turns into a continuum at zero temperature, where H is an effective field that eff field called magnetisation that depends on the space contains the sum of every magnetic interaction present in coordinates r, assuming that neighbouring spins do not the system, γ is the Gilbert gyromagnetic ratio constant, change drastically in direction [8, 9]. This means the which sets the time scale of the spin motion, and limit from the discrete atoms into the space dependent 0 ≤ a ≤ 1 is the Gilbert damping. The first term in equation field s → M(r)/M = m(r). The magnitude of the field i s 1 describes a precessional motion of spins around the is measured through the saturation magnetisation M , effective field and the second term is a dissipative term which is defined as a magnetic moment per unit volume, that make spins follow the effective field direction. i.e. M = μ/ΔV, with ΔV as the volume of a unit cell of In micromagnetics this equation has the same structure: the discrete crystal lattice. This theory of magnetism in the continuum limit is known as micromagnetics.  M MH   M MH. (2) eff eff Numerically, the magnetisation field can be discretised  t into a mesh of magnetic moments M . i Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 5 of 11 Fidimag can solve the non-linear differential equations it is less than the unit and makes it decrease otherwise. 1 and 2, depending on the specified theoretical model. For time integration, Fidimag can use the CVODE solver Accordingly, it is necessary to specify an initial magnetic of the SUNDIALS suite [14] (wrapped via Cython) or the configuration for the spin directions, and the magnetic Fortran codes bundled in Scipy’s [15] integrate.ode. interactions involved in the system. Currently, Fidimag Fidimag also implements Heun’s method and the classic has the following interactions implemented in the code, fourth-order Runge-Kutta method. Because the time integrators will need a varying amount of evaluations of Exchange Favours the parallel or anti-parallel align- the right hand side function, i.e. the equation of motion ment of neighbouring spins. The exchange can be chosen in the last paragraph, it makes sense to partly computed using nearest neighbour approximations in relinquish runtime control from the user to the time the classical Heisenberg case. The continuum micro- integration. A so-called driver is in charge of coordinating magnetic model only allows parallel alignment. time integration and user needs. Time integration runs Dipolar interactions Product of the interaction of a uninterrupted for a specified amount of (simulated) time, spin with the field generated from the other spins in after which arbitrary code can be executed. the system. Dzyaloshinskii-Moriya Favours a canted alignment Nudged Elastic Band Method between neighbouring spins. Finding the lowest energy cost to drive a magnetic system Anisotropy Sets directions along which the system from one equilibrium state towards another, also known energy decreases when spins align towards them. as energy barrier, has become a relevant problem for Zeeman Product of the interaction of spins with an the analysis of the stability of magnetic structures. An external magnetic field. energy barrier is then associated to the transition path, between two states, that requires the least energy. This is The underlying equations that were used to implement important, for example, for the potential application of these interactions can be found in Ref. [10]. a magnetic structure in a technological device since an One method for finding energy minima in the system’s energy barrier can be used to estimate the lifetime of the energy landscape, which is implemented in the code, is to structure against energy fluctuations from excitations evolve the system with the LLG equation, since the spins such as thermal noise, present at finite temperatures. The will precess until a stable configuration is attained, i.e. a nudged elastic band method (NEBM) is a technique for the local or global minimum of energy, that depends on the calculation of minimum energy paths, and hence energy initial magnetic configuration. We refer to this process as barriers. It was first used in chemistry to study molecular relaxation. transitions [16]. It is based on fixing two equilibrium states, Dynamical effects such as the generation of spin waves, which can be local or global minima, and making copies, ferromagnetic resonance, domain wall motion, among called images, of the system in different configurations other multiple magnetism related phenomena, are also between these extrema. This sets a band of images and given by the evolution of spins with the LLG equation. each one of the images will have a different energy in the Variations of this equation are obtained when applying energy landscape associated to the system. The algorithm electric currents or temperature, which can also be will iteratively find a path in the energy landscape that specified in the code. Fidimag supports the inclusion decreases the energy cost of the band, trying to keep the of stochastic terms and spin-polarised currents in the images equally spaced in the energy landscape using an equation of motion. The terms and their corresponding inter-image spring force, to avoid images move towards equations are shown in Ref. [11]. the minima at the extremes of the band. After relaxation, At zero temperature the length of the magnetic the minimum energy path will cross one or more maxima moments and the magnetisation vector is fixed. This of energy, which set the energy barrier magnitude. An condition must be specified in the equation of motion of optimisation of the original algorithm has recently been spins explained in the last section, which sets a constraint published by Bessarab et al. [17], where geodesic distances to the spin length. Multiple magnetic phenomena can are defined in the energy landscape. We have implemented be explained at a zero-temperature formalism thus the the NEBM in Fidimag, which can be used both within majority of Fidimag’s equations are implemented in this micromagnetics and a discrete spin model. The optimised regime. version, called Geodesic NEBM is the one that performs Although this constraint is implicit in the LLG equation, more efficiently, and combines Cartesian coordinates for numerically the spin length varies when integrated. To the description of the spins and geodesic distances in address this problem, a correction term is added to the the energy landscape. Original versions of the algorithm, right hand side of equations 1 and 2 in Fidimag (equation which only use Cartesian or spherical coordinates, can 4 in Ref. [12]) [13]. It is proportional to: present convergence issues for systems with more complex magnetic configurations, such as vortices. To run a NEBM simulation, it is necessary to specify two equilibrium s   1ss. (3)     states, the number of images in between, and an initial t   state for the internal images. This initial configuration can and similar in the micromagnetic model, by setting be set by either manually creating a series of images in s → m. This term makes the spin length increase when different magnetic states or by using a linear interpolation Art. 22, page 6 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package for the spin directions, which is implemented in the code Finding the cube size of equal energies called single_ to generate the configurations automatically. domain_limit then involves nothing more than A detailed review of the method can be found in Ref. another function call, this time to a bisection method [17]. A study of the thermal stability of skyrmions, which called bisect provided by SciPy [15]. are vortex-like magnetic configurations, that uses the A similar approach had been used in Nmag, where it NEBM implemented in Fidimag, can be found in [4]. In has proven to be successful [13]. Unlike nmag however, addition, we tested our code with the skyrmions example Fidimag doesn’t require bundling the software with a from [17], making a repository with the simulation details modified Python binary. The approach is now seen in other in [18]. micromagnetic packages, for example micromagnum [23]. The Jupyter/OOMMF project follows a hybrid approach Implementation and architecture and harnesses the proven capabilities of the OOMMF Fidimag provides both micromagnetic and atomistic binary with a Python interface optimised for Jupyter simulation capabilities and is the only software that notebooks [24]. allows switching between the two modelling paradigms. Vampire is a performant atomistic code that defines The most notable micromagnetic code is OOMMF, which its own declarative syntax [1]. It comes in two versions, had its alpha release in 1998. OOOMMF is written in either a binary with an installation script or the code C++ and Tcl/Tk. Fidimag is mostly implemented in which needs to be compiled from source. In contrast, the Python programming language, with performance while the traditional installation methods are available, critical parts realised in C and linked in via Cython. The installing Fidimag with Docker is as easy as docker code base consists of roughly 5000 lines of Python code pull fidimag/notebook . and 4000 lines of C code and cython extensions. The Best practices recommend using version control for any tests and examples add another 5500 lines of Python. As kind of computational endeavours [25]. The code is stored Python is well established in the scientific community, it using the distributed version control system git and new presents a lower barrier to entry for programmers [19]. features are developed in branches. Automated testing Further, Python has a reputation for being easy to learn and builds of the software were priorities from the start. for beginners [20, 21]. This has informed the decision Because there are no command line parameters to record to build Fidimag as a software library instead of a GUI- or options set in a GUI program Fidimag offers a one-to- driven program. Indeed, Fidimag respects best practices one mapping of the simulation code to its result. This is a for Python’s module and namespacing system. boon for the goal of reproducibility that can’t be overstated. This library model of execution, where Fidimag is For example, Fidimag plays well with Sumatra [26] which imported into the namespace of a Python program allows for the automatic tracking of the computations empowers the user to deal with the complexity of the run. Jupyter Notebooks [27] are used for interactive batch processing of simulations in a more easily tested and tutorials and included in the extensive documentation reproducible way compared to ad-hoc shell commands [28]. There are tests that ensure that these notebooks and specialised batch modes in software with graphical are executing consistently, without errors, and that the user interfaces [22]. execution of the stored inputs match the stored outputs. The standard problem #3 especially examplifies how For this, a py.test plugin called nbval was developed and naturally Fidimag allows higher order logic thanks to made available to the open source community [29]. these choices. In it, two possible magnetic configurations Fidimag has an automated testing procedure that runs in cubes of increasing sizes are to be studied to determine on a public continuous integration system [30]. Fidimag’s when they are equally energetically favourable. In simple installation procedure via Docker, the extensive Listing  2 the logic of setting up and running the documentation including interactive tutorials stored in simulations, as well as comparing the total energies of the Jupyter notebooks and the accessible interface have made magnetisation in the two possible configurations has been it not only a useful tool for research as stated before, but abstracted into a function called energy_difference. also for teaching [31]. ””” Solution to μmag standard problem #3 with fidimag. http://www.ctcms.nist.gov/~rdm/mumag.org.html ””” from .cube_sim import energy_difference from scipy.optimize import bisect single_domain_limit = bisect(energy_difference, 8, 8.5, xtol=0.1) print(“L = {:.2} nm.”.format(str(single_domain_limit)) Listing 2: Solution to the standard problem #3. The code that computes the energy difference between the two possible magnetic configurations has been abstracted into the function energy_difference in the module cube_sim that is imported in line 6. The function energy_difference can then be handed off to a bisect method provided by SciPy to find the cube size for which both configurations have the same energy. Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 7 of 11 fidimag common atomistic micro defines time integration input/output common NEB method ... uses Anisotropy mesh Sim energies ... Zeeman uses user Figure 3: Architecture of Fidimag as reflected by the directory structure and Python modules. Code useful to micromagnetic and atomistic simulations was extracted into a common namespace. The red arrows point to user- facing parts of the system. The source code is split into three major sections Within the continuum approximation, Fidimag uses – ‘atomistic’, ‘micro’ and ‘common’ which contain finite differences which means dividing the sample into a code specifically for classical Heisenberg simulations, mesh of cubes, as shown in Figure 4a, where each cuboid micromagnetic simulations, and for both respectively, as centre represents the position of a magnetic moment can be seen in Figure 3. vector. Accordingly, derivatives for the calculation of There are many common components which can be magnetic interactions and energies are discretised using shared between both types of simulation. The primary differences between neighbouring mesh sites. The cuboid data in both atomistic and micromagnetics is stored in mesh is coded in the CuboidMesh class located in vector fields, and the mechanisms for passing this data Fidimag’s common directory. Distance between the centres through the simulation are kept in a common base and the number of cuboids in the three spatial directions ‘Sim’ class. This allows, for example, the saving of the are specified by the user. The indexes of every mesh site magnetisation progressive steps in the simulations to be are labelled following the x → y → z direction, as shown in handled identically for both types of simulation. Fidimag Figure 4a. To keep track of the neighbouring sites of every comes with visualisation and data saving utilities out of mesh site, the mesh class has a neighbours method the box. defined as an N × 6 array, where N is the total number of cuboids, that stores the indexes of nearest neighbours, Mesh and lattices with the value −1 for non-material sites. Correspondingly, As we mentioned earlier, we define a magnetic system by every row represents the 6 nearest neighbours in the setting its geometry. How the geometry is approximated (−x, +x, −y, +y, −z, +z) order. For instance, for the mesh depends on the chosen model. of Figure 4a and site 0 the neighbours array is [−1, Art. 22, page 8 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Figure 4: Cuboid mesh and hexagonal lattice labelled according to the index of the sites. 1, −1, 3, −1, 9]. This helps to easily implement directory. Another atomistic lattice implemented in interactions in Fidimag’s C functions. Fidimag is a two dimensional hexagonal lattice that can For the calculation of the demagnetising field, Fidimag be aligned along the x or y axis. The former is shown in uses a fast-Fourier-transform method that requires a Figure 4b. This lattice is defined in the HexagonalMesh uniform grid, hence for complex geometries, such as class in Fidimag’s atomistic directory. As in the curved samples, Fidimag still defines a cuboid mesh but CuboidMesh, a neighbours array keeps track of the boundaries or specific mesh sites without material are neighbours indexes, which are defined in the x → y order. approximated by setting the magnetisation as zero, M = 0. In Figure 4b we highlight, for example, the 6 neighbours Thus to obtain a better approximation it is necessary of the lattice site with index 12. to define a large number of cuboids and decrease the Using as a base the class structure of the meshes distance between their centres. In order to set a null currently implemented in Fidimag, it is possible to magnetisation, the user can specify a Python function that define and implement other crystal lattices such as body- has as an input the position vector and that returns M centered-cubic or face-centered-cubic arrangements. according to the sample geometry [13]. Besides scalars, most of the physical quantities involved In Listing 3 we set a 2 nm diameter sphere using a in micromagnetic computations are fields and vector 6 × 6 × 6 cuboid mesh with elements of 1nm × 1nm × 1nm fields. In Fidimag, they are represented with numpy arrays size. To simplify the dimensions scaling we set a unit [32]. There are utilities to instantiate them from point- length in the mesh definition. wise expressions. These fields are the objects the physical interactions in the simulations deal with. A quantity import fidimag import numpy as np central to the solution of the initial value problem given by the micromagnetic approach is the effective field, mesh = fidimag.common.CuboidMesh(nx=6, ny=6, nz=6, dx=1, dy=1, dz=1, which is itself a sum of smaller fields. Each of the smaller unit_length=1e-9) fields is the result of a separate computation which sim = fidimag.micro.Sim(mesh) represents the influence of an interaction present in the Ms = 1e6 # A / m system, like the exchange energy or the Dzyaloshinski- def sphere(r): Moriya interaction. For the dipolar field, we accelerate x, y, z = r the calculation using a convolution done in Fourier space if x ** 2 + y ** 2 <= 2 ** 2: [33, 34, 35], accelerated using the library FFTW. It is in return Ms else: the computation of the interactions where the differences return 0 between the micromagnetic and the atomistic approach sim.set_Ms(sphere) become the most apparent. Consequently, some energy terms are represented twice in the codebase – once for Listing 3: Definition of a 2 nm wide sphere geometry each model. With the effective field computed for a given using micromagnetics. state of the magnetisation the next step is solving the In the case of discrete spin simulations, atoms order equation of motion for the system, which is the Landau- in a lattice according to different crystallographic Lifshitz-Gilbert equation or one of its many variants. arrangements. The most simple ordering is the simple cubic lattice (SC), where atoms centres lie at the centre Quality control of cubes separated by the same distance in the three Testing small chunks of code and preferably isolated spatial dimensions. Since this follows the same principle pieces of the system is unit testing. In Fidimag, most of as the finite differences cuboid mesh, Fidimag uses the the unit tests compute and check the physical quantities same CuboidMesh class as the one for micromagnetic involved in succesfully running a simulation. Besides simulations, thus it is defined in Fidimag’s common giving helpful feedback during development, the unit tests Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 9 of 11 def test_save_scalar_field_hexagonal_mesh(tmpdir): mesh = HexagonalMesh(radius=1, nx=3, ny=3) s = scalar_field(mesh, lambda r: r[0] + r[1]) vtk = VTK(mesh, directory=str(tmpdir), filename=”scalar_hexagonal”) vtk.save_scalar(s, name=”s”) assert same_as_ref(vtk.write_file(), REF_DIR) Listing 4: A unit test in which a scalar field s is created on a hexagonal mesh, saved to a VTK file and compared to a reference file. Programming language were a factor in increasing confidence to edit, enhance or Python version 3, C, cython. refactor the code, resulting in the improved decoupling and maintainability of it. The coverage of Fidimag’s code Additional system requirements base with unit tests is monitored using codecov [36]. At E.g. memory, disk space, processor, input devices, output the time of writing, it reports 73% coverage. devices. Functional testing then examines a slice of the system. For example, one of the test cases covering the saving of Dependencies scalar fields on hexagonal meshes to a VTK file in Fidimag E.g. libraries, frameworks, incl. minimum version is shown in Listing 4. compatibility. Finally, system tests use Fidimag as a black box and compare simulation output to known good values. These 1. Numpy ≥ 1.10 values are obtained from problems that have analytical 2. SciPy ≥ 1.0.0 solutions like the macrospin or domain walls. As we saw 3. SUNDIALS ≥ 2.7.0 earlier, the μmag standard problems are another good 4. FFTW ≥ 3.3.4 source of testing data. So are other finite difference codes, like the aforementioned OOMMF. Fidimag builds using the OpenMP versions of these Fidimag is also tested against the output of earlier libraries for multiprocessing purposes. versions of itself by storing some simulation results in the repository. This is a form of regression testing, and since no List of contributors external software or potentially long-running simulations Please list anyone who helped to create the software (who are involved the fastest way to check if a changeset has may also not be an author of this paper), including their affected the computational parts in a tangible way. The roles and affiliations. design choices discussed in the introduction and the focus on testing continue to provide tangible benefits 1. Bisotti, Marc-Antonio to the collaborators working on the software, as well as 2. Wang, Weiwei the software itself, as shown above. They also increase 3. Cortés-Ortuño, David the confidence in Fidimag›s results since unlike users, 4. Fangohr, Hans automated tests don›t distinguish between new and 5. Pepper, Ryan old code and test potentially seldom-used parts of the 6. Kluyver, Thomas software just as often as the commonly used functions. 7. Vousden, Mark For maximum value, the tests need to be run often and 8. Beg, Marijan ideally without manual intervention. This is why a test cycle is triggered on the continuous integration platform Software location Travis CI [30] on every push to the Github repository. First, Archive Fidimag’s C code and cython extensions are compiled. (e.g. institutional repository, general repository) (required Then the tests are run. Finally the Jupyter notebooks are please see instructions on journal website for depositing run and tested and the documentation is built. archive copy of software in a suitable repository) To quickly check if Fidimag is installed and working on Name: Fidimag a machine, a user can launch an interactive Python shell Persistentidentifier: https://zenodo.org/record/841113 and execute import fidimag . This command should not Licence: BSD output any text. Afterwards, the user may chose to follow Publisher: Hans Fangohr along with the tutorial called A Basic Simulation [37] or Version published: 2.5 launch the provided examples. If Fidimag was installed Date published: 10/08/17 from source, make test-basic will run a selection of tests that completes in under a minute, which is also Code repository helpful for smoke testing purposes during development (e.g. SourceForge, GitHub etc.) (required) on Fidimag. Name: Fidimag Persistent identifier: https://github.com/ (2) Availability computationalmodelling/fidimag Operating system Licence: BSD GNU/Linux, Mac OS X and on any platform supported by Date published: August 8, 2018 Docker, like Azure and AWS. Art. 22, page 10 of 11 Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Emulation environment 7. Micromagnetic Modeling Activity Group. μMAG (if appropriate) micromagnetics website. http://www.ctcms.nist. Name: The name of the archive. gov/ rdm/mumag.org.html. Accessed: 2017-09-25. Persistentidentifier: e.g. DOI, handle, PURL, etc. 8. Aharoni, A 2000 Introduction to the Theory of Licence: Open license under which the software is Ferromagnetism, second edition, 109. Oxford University licensed. Press. Date published: dd/mm/yy 9. Chikazumi, S 2009 Physics of Ferromagnetism, volume 94 of International Series of Monographs on Language Physics, second edition. Oxford University Press. Language of repository, software and supporting files. 10. Fidimag Documentation – core equations. https:// English. fidimag.readthedocs.io/en/latest/core_eqs.html. Accessed: 2018-02-06. (3) Reuse potential 11. Fidimag Documentation – extended equations. The simulations are written in Python and use Fidimag https://fidimag.readthedocs.io/en/latest/extended_ as a library to be imported. Fidimag has been used to eqs.html. Accessed: 2018-02-06. gather results for a number of scientific publications [2, 12. Fischbacher, T and Fangohr, H July 2009 Continuum 3, 4, 5] in the field of micromagnetics. It can be extended multi-physics modeling with scripting languages: The to account for other energy terms, to support more time Nsim simulation compiler prototype for classical field integration methods or other variants of the equation of theory. ArXiv e-prints. motion, as well as other drivers. Users can get in touch 13. Fischbacher, T, Franchin, M, Bordignon, G and with the development team on Fidimag’s issue page on Fangohr, H June 2007 A systematic approach to GitHub [38]. multiphysics extensions of finite-element-based micromagnetic simulations: Nmag. IEEE Transactions Notes on Magnetics, 43(6): 2896–2898. DOI: https://doi. For this reason when we mention spins we strictly refer org/10.1109/TMAG.2007.893843 to the total angular momentum or magnetic moments. 14. Hindmarsh, A C, Brown, P N, Grant, K E, Lee, S L, Numbers obtained with cloc version 1.60. Serban, R, Shumaker, D E and Woodward, C S 2005 SUNDIALS: Suite of nonlinear and differential/algebraic Competing Interests equation solvers. ACM Transactions on Mathematical The authors have no competing interests to declare. Software (TOMS), 31(3): 363–396. 15. Jones, E, Oliphant, T, Peterson, P, et al. 2001 SciPy: References Open source scientific tools for Python. http://www. 1. Evans, R F L, Fan, W J, Chureemart, P, Ostler, T scipy.org. Accessed: 2017-01-22. A, Ellis, M O A and Chantrell, R W 2014 Atomistic 16. Henkelman, G, Uberuaga, B P and Jónsson, H 2000 spin model simulations of magnetic nanomaterials. A climbing image nudged elastic band method for Journal of Physics: Condensed Matter, 26(10): finding saddle points and minimum energy paths. The 103202. DOI: https://doi.org/10.1088/0953- Journal of Chemical Physics, 113(22): 9901–9904. DOI: 8984/26/10/103202 https://doi.org/10.1063/1.1329672 2. Wang, W, Albert, M, Beg, M, Bisotti, M-A, 17. Bessarab, P F, Uzdin, V M and Jónsson, H 2015 Chernyshenko, D, Cortés-Ortuño, D, Hawke, I and Method for finding mechanism and activation Fangohr, H Feb 2015 Magnon-driven domain-wall energy of magnetic transitions, applied to skyrmion motion with the dzyaloshinskii-moriya interaction. and antivortex annihilation. Computer Physics Phys. Rev. Lett., 114: 087203. DOI: https://doi. Communications, 196(Supplement C): 335–347. DOI: org/10.1103/PhysRevLett.114.087203 https://doi.org/10.1016/j.cpc.2015.07.001 3. Wang, W, Beg, M, Zhang, B, Kuch, W and Fangohr H 18. Cortés-Ortuño, D and Fangohr, H Nov 2016 Test Jul 2015 Driving magnetic skyrmions with microwave system for nudged elastic band method in nanoscale fields. Phys. Rev. B, 92: 020403. DOI: https://doi. magnetism. org/10.1103/PhysRevB.92.020403 19. Beazley, D M 2000 Scientific Computing with 4. Cortés-Ortuño, D, Wang W, Beg, M, Pepper, R Python. In: Manset, N, Veillet, C and Crabtree, D (eds.), A, Bisotti, M-A, Carey, R, Vousden, M, Kluyver, T, Astronomical Data Analysis Software and Systems IX, Hovorka, O and Fangohr, H 2017 Thermal stability Astronomical Society of the Pacific Conference Series , and topological protection of skyrmions in nanotracks. 216: 49. Scientific Reports , 7(1): 4060. DOI: https://doi. 20. Fangohr, H 2004 A comparison of C, Matlab, and org/10.1038/s41598-017-03391-8 Python as teaching languages in engineering. In: 5. Wang, W, Zhang, C, Pepper, R, Mu, C, Zhou, Y Bubak, M, van Albada, G D, Sloot, P M A and Dongarra, J and Fangohr, H 2017 Current-induced instability (eds.), Computational Science – ICCS 2004, 1210–1217. of domain walls in cylindrical nanowires. Journal of Berlin, Heidelberg. Springer Berlin Heidelberg. DOI: Physics: Condensed Matter. https://doi.org/10.1007/978-3-540-25944-2_157 6. Cortés-Ortuño, D and Fangohr, H November 2016 21. Fangohr, H, Albert, M and Franchin, M 2016 Nmag Thermal stability and topological protection of micromagnetic simulation tool: Software engineering skyrmions: Supplementary data. lessons learned. In: Proceedings of the International Bisotti et al: Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package Art. 22, page 11 of 11 Workshop on Software Engineering for Science, 30. Travis CI GmbH computationalmodelling/fidimag SE4Science ’16, 1–7. New York, NY, USA. ACM. – travis ci. https://travis-ci.org/computational 22. Beg, M, Pepper, R A and Fangohr, H 2017 User modelling/fidimag. Accessed: 2017-10-04. interfaces for computational science: A domain 31. Schrefl, T Private communication. specific language for oommf embedded in python. 32. van der Walt, S, Colbert, S C and Varoquaux, AIP Advances, 7(5): 056025. DOI: https://doi. G March 2011 The numpy array: A structure for org/10.1063/1.4977225 efficient numerical computation. Computing in 23. MicroMagnum http://micromagnum.informatik.uni- Science Engineering, 13(2): 22–30. DOI: https://doi. hamburg.de. Accessed: 2017-10-12. org/10.1109/MCSE.2011.37 24. Beg, M, Pepper, R A and Fangohr, H 2017 User 33. Yuan, S W and Bertram, H N Sept 1992 Fast adaptive interfaces for computational science: A domain algorithms for micromagnetics. IEEE Transactions specific language for oommf embedded in python. on Magnetics, 28(5): 2031–2036. DOI: https://doi. AIP Advances, 7(5): 056025. DOI: https://doi. org/10.1109/20.179394 org/10.1063/1.4977225 34. Hayashi, N, Saito, K and Nakatani, Y 1996 25. Fowler, M 1999 Refactoring: Improving the Design of Calculation of demagnetizing field distribution based Existing Code. Addison-Wesley, Boston, MA, USA. on fast fourier transform of convolution. Japanese 26. Davison, A 2012 Automated capture of experiment Journal of Applied Physics, 35(12R): 6065. DOI: https:// context for easier reproducibility in computational doi.org/10.1143/JJAP.35.6065 research. Computing in Science & Engineering, 14: 48– 35. Hinzke, D and Nowak, U 2000 Magnetization 56. DOI: https://doi.org/10.1109/MCSE.2012.41 switching in nanowires: Monte carlo study with fast 27. Kluyver, T, Ragan-Kelley, B, Pérez, F, Granger, B, fourier transformation for dipolar fields. Journal Bussonnier, M, Frederic, J, Kelley, K, Hamrick, of Magnetism and Magnetic Materials, 221(3): J, Grout, J, Corlay, S, Ivanov, P, Avila, D, Abdalla, 365–372. DOI: https://doi.org/10.1016/S0304- S, Willing, C and Jupyter development team 8853(00)00516-3 [Unknown] 2016 Jupyter notebooks – a publishing 36. Codecov LLC Dashboard computational format for reproducible computational workflows. modelling/fidimag. https://codecov.io/gh/comp 28. Fidimag Documentation. http://fidimag.readthedocs. utationalmodelling/fidimag. Accessed: 2017-10-04. io/en/latest/. Accessed: 2017-10-12. 37. Fidimag Tutorial: A basic simulation. http://fidimag. 29. Cortés-Ortuño, D, Laslett, O, Kluyver, T, Fauske, V, readthedocs.io/en/latest/ipynb/tutorial-basics.html. Albert, M, Min, RK, Hovorka, O and Fangohr, H 2014 Accessed: 2017-11-29. nbval: a py.test plugin for validating jupyter notebooks. 38. Fidimag Issue page on github. https://github.com/ https://github.com/computationalmodelling/nbval. computationalmodelling/fidimag/issues. Accessed: Accessed: 2017-09-25. 2018-02-13. How to cite this article: Bisotti, M-A, Cortés-Ortuño, D, Pepper, R, Wang, W, Beg, M, Kluyver, T and Fangohr, H 2018 Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package. Journal of Open Research Software, 6: 22. DOI: https://doi.org/10.5334/jors.223 Submitted: 14 February 2018 Accepted: 15 August 2018 Published: 06 September 2018 Copyright: © 2018 The Author(s). This is an open-access article distributed under the terms of the Creative Commons Attribution 4.0 International License (CC-BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. See http://creativecommons.org/licenses/by/4.0/. Journal of Open Research Software is a peer-reviewed open access journal published by OPEN ACCESS Ubiquity Press

Journal

Condensed MatterarXiv (Cornell University)

Published: Feb 11, 2020

References