1.Introduction
Magnetic materials are widely used in a diverse range of applications in modern society. In recent years, magnetic nanostructures have attracted much attention because of their promising properties that are not observed in larger structures and the miniaturization demand of magnetic devices. Properties like exchange bias and superparamagnetic behavior at room temperature make magnetic nanostructures ideal for magnetic recording media 1 and biomedical applications2, respectively.
Spin models have played an important role in understanding the magnetic behavior of magnetic materials. Specially, classical spin models bridge the gap between a full electronic description of a magnetic material and conventional micromagnetism 3. Classical spins can be represented as n dimensional vectors, such as Ising (n = 1), XY (n = 2) and Heisenberg (n = 3) spins. Because of the difficulty to solve by analytical approaches, the partition function of systems represented by classical spin models, numerical simulations employing the Monte Carlo method are usually used to estimate the thermodynamic quantities of the systems. Magnetic properties of different systems, such as thin films 4, simple and core-shell nanoparticles 5,6, mixed spin systems 7, torus nanorings 8, nanotubes 9, bit-patterned media 10 and bulk materials 11,12 have been studied by Monte Carlo simulations. These atomistic simulations allow to take into account changes in the magnetization that occur at atomic scale and the finite size effects which are considerable in magnetic nanomaterials 13.
Because of the complexity of the methods and algorithms used to perform atomistic simulation of magnetic materials, research in the area is usually restricted to experts with advanced knowledge in computer programming, where simulations are mostly based on codes developed by the researchers themselves. In view of that, different open source software packages, such as VAMPIRE 13 and ALPS 14, have been developed with the aim to make available these kind of simulations to the non-expert software developer. Furthermore, the development of new software is important to take into account improvements made to the current methods and implementations. An increase in the efficiency of the simulation and analysis processes can be achieved by the implementation of novel algorithms and the enhancement of the structure employed to describe the simulation input and output data. Besides, just part of the data is usually collected during a simulation, requiring several simulations to study distinct magnetic behavior of a given system. Taking these aspects into account, we present an open source software package, Vegas, for the static and dynamic atomistic simulation of magnetic materials.
2.VEGAS software package
The aim of Vegas is to provide the required tools to build, simulate and analyze a great variety of magnetic systems with structural and magnetic characteristics that can be set with high flexibility. The main features of Vegas are the following:
The history of the simulation is stored, i.e. the magnetization and energy of the system are stored at every Monte Carlo Step (MCS) per temperature and magnetic field step. This allows to study the dynamic behavior of the system in addition to its static behavior from results obtained in a single simulation. This way, it is possible to estimate, among other things, equilibrium and non-equilibrium correlation times which can be used to enhance the quality of the statistics of the thermal averages.
High flexibility is provided for the building and simulation of a great variety of magnetic systems. It is possible to simulate systems with different structures and magnetic phases, where the statistics of each magnetic phase can be tracked independently. Any kind of ion can be simulated by providing its atomic magnetic moment and spin.
Several spin update policies, including a highly-efficient adaptive policy, are implemented in VEGAS to simulate accurately the magnetic behavior of different magnetic systems. It is possible to simulate a material with various magnetic phases employing a different update policy for each magnetic phase, e.g. a core/shell nanoparticle where the core is updated using a random move and the shell is updated using a spin-flip move. Also, Ising and mixed spin Ising systems can be modeled using the spin-flip and qIsing update policies, respectively.
The direction of every spin moment is stored per temperature and magnetic field step at the last MCS, where the system is expected to have reached equilibrium. Hence, it is possible to visualize the temperature/field evolution of the spin moments direction, which can contribute to a better understanding of the magnetic phenomena.
An estimation of the simulation time is given during the simulation.
VEGAS does not require to be built in order to be executed, it is composed by executables that can be run directly on Linux 64 bits and Windows 8 (or later) operating systems.
3. Model and method
3.1. Classical spin Hamiltonian
The magnetic systems simulated using Vegas are described by the classical Heisenberg model. Interactions at the atomic scale between spin moments in a magnetic material are modeled by the Heisenberg spin Hamiltonian, which includes the exchange, anisotropy and applied field interactions. The Heisenberg spin Hamiltonian is given by
where J
ij
is the exchange interaction constant between sites i and j, B and n
i are the magnetic field intensity and direction of site i, respectively,
where
where
3.2. Monte Carlo Metropolis algorithm
The time evolution of a classical spin magnetic system can be given by the Monte Carlo Metropolis algorithm, where new configurations of a system are generated from a previous state using a transition probability. The algorithm is developed as follows: an initial state is chosen for the magnetic system. Then, one single spin moment is randomly chosen and its direction is changed to a new trial direction according to an update policy (trial move). The energy of the system before and after the trial move is then evaluated according to Eq. (1) and the energy change
where
For a comprehensive review of the atomistic spin model and the integration methods employed in the atomistic simulation of magnetic materials see 13.
3.3. File Formats
In order to facilitate the exchange and archiving of data, Vegas uses the standardized file formats, Json and Hdf5, for the input and output files of the simulations, respectively.
JSON uses universal data structures through which the simulation parameters can be defined using a name/value pair structure. An example of a JSON input file is shown in Fig. 1. In this file, the simulation parameters, including the temperature, magnetic field range and step, number of MCS and random number seed, for a hysteresis loop simulation are defined. Also, the material, anisotropy and initial state (if required) files, and the results output file are given. In order to take into account the atomic magnetic moment, the field input parameters corresponds to quantities of
On the other hand, Hdf5 is a data model and file format for storing and managing extremely large data, which is useful for storing and analyzing the simulation results in Vegas, specially the history of the simulation. Other input data, including the anisotropy and the material files, are given in plain text format. For these files, we designed simple data schemes to specify the anisotropy type and the magnetic and structural parameters of the material.
3.4. Vegas tools
Based on different python and C++ libraries, Vegas provides tools to build, simulate and analyze magnetic systems.
3.4.1 Material building
Vegas has a python-based tool, Vegas lattice, for building materials with different shapes, structures and magnetic properties. Vegas lattice provides the essential routines to generate regular graph lattices in linear time, as well as some cuts of those lattices for nanoparticles and randomly depleted lattices. Detailed documentation of Vegas lattice can be found at its GitHub repository 17.
It is also possible to build the material manually according to the material file format. The material file, which uses a plain text format, is essentially composed by four parts. The first part indicates the number of ions, links and ion types in the material. The second part is composed by identifiers for the different types of ions. The third part mainly corresponds to the geometric construction of the material, indicating the index, spatial coordinates, spin norm, spatial coordinates of the magnetic field axis, type and update policy of the ion. Finally, the fourth part indicates the exchange interactions between the ions. There are not limitations in terms of the size of the material; however, the time of the simulation increases linearly with the size of the material.
3.4.2.Simulation
The simulation model and methods are implemented in Vegas using C++ libraries. In order to initialize the simulation of a given magnetic material, Vegas reads the system and simulation parameters from the Json input file. Then, the simulation is carried out by routines implemented according to the classical Heisenberg model and the Monte Carlo Metropolis algorithm, while the simulation results are stored in the Hdf5 output file. During the simulation, an estimate of the simulation time is given.
3.4.3. Data analysis
Vegas has implemented multiple analyzers for the analysis and visualization of different magnetic phenomena. All the analyzers are written in PYTHON using the H5py library. The analyzers are developed based on the data structure of the simulation results, which are stored in HDF5 format. Different variables are employed to store the simulation result data, which include the temperature, magnetic field, ion positions, final states, energy and magnetization. Furthermore, the Boltzmann constant and the number of MCS are stored as attributes.
If the user requires a more specific or detailed analysis, it is possible to implement simple scripts to analyze the simulation results. Moreover, the HDF Group provides a visual tool, HDFView 18, to extract and analyze data from HDF5 files.
4.Applications
Static and dynamic magnetic properties, such as hysteresis loops, critical temperature, compensation behavior, reversal mechanisms, magnetic recording, critical exponents and correlation times, can be determined using VEGAS. In this Section, we present some examples of the applicability of Vegas to study different materials and magnetic phenomena.
4.1.Materials with different shapes and structures
Materials with simple and complex shapes, such as core/shell nanoparticles, nanotubes, nanowires, nanorings, bit patterned media, thin films, multilayers and bulk systems, and crystal structures, such as simple, body-centered and face-centered cubic, can be simulated in Vegas. Samples of some materials are shown in Fig. 2.
4.2. Thermal averages
Thermal averages can be easily extracted and visualized from the simulation results output file. Figure 3 shows the thermal dependence of the magnetization (M) and the susceptibility (X), and a hysteresis loop of a bulk material simulated using the structure and magnetic parameters of iron, namely,

FIGURE 3 a) Thermal dependence of the magnetization and susceptibility, and b) hysteresis loop at 10 K of an iron bulk material. Inset in Fig. 3a) shows the BCC crystal structure of iron.
The hard disk space required for a simulation depends on parameters as the size of the system and the number of Monte Carlo, temperature, and field steps of the simulation. For instance, the simulation of the thermal dependence of M and X (see Fig. 3a) was made considering a system with N=2000 sites with 8 nearest neighbors each one, BCC structure and uniaxial anisotropy. The temperature was varied from a high to a low value with a total of 200 temperature steps, while the magnetic field was set to a single value of 0 T. 20000 MCS were performed at each temperature step. For this simulation, the size of the Hdf5 file, which stores the history of the simulation, is approximately 209 MB. The running time, in a Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80 GHz with an x86_64 architecture, was 1.31 hours ± 24.48 seconds. All the information, including the thermal averages, magnetization states and dynamic data of the system, is extracted from this single file.
4.3. Dynamic behavior
Besides the static magnetic properties, the dynamic properties of a magnetic system can be extracted from a single simulation 19. Figure 4 shows the equilibrium correlation times (τ) for a ferromagnetic bulk material with generic parameters. The correlation times were computed for some of the different spin update policies implemented in Vegas. Overall, the adaptive policy produces the lowest correlation times at all temperatures, indicating that it is a very efficient update policy for this kind of system.

FIGURE 4 Equilibrium correlation times for a bulk material using adaptive, Hinzke-Nowak combinational 16 (for a small-step opening angle of 15 and 30±) and random update policies.
4.4. Critical exponents
Phase transitions can be characterized by simulating the critical behavior of the magnetic systems. Using the finite size scaling method, it is possible to extract values for critical exponents by observing the variation of the thermal averages with the system size 19,20. Figure 5 shows log-log plots of the maxima of the susceptibility (
4.5. Magnetization switching processes
Simulation of magnetization switching processes are of great importance for the development of recording devices based on magnetic nanoparticles. Figures 6a and 6b show cross-sectional views of magnetization states in a ferromagnetic torus nanoring. Two magnetization states, vortex (see Fig. 6a) and reverse vortex (see Fig. 6) states, can be formed in the torus nanoring and convenientbly employed to represent the bits 0 and 1. Figure 6c shows the temperature dependence of the magnetization in the
4.6. Histogram and multiple histogram methods
From results obtained using Vegas, it is also possible to apply data analysis techniques such as the single and multiple histogram method. These methods allow to take a single simulation performed at some temperature and extrapolate or interpolate results to give predictions of observable quantities at other temperatures 20. Figure 7 show histograms of the energy per ion site (E/N) obtained at different temperatures in a ferromagnetic 2D Ising system with generic parameters. Using the multiple histogram method, it is possible to interpolate observable quantities, such as the energy and magnetization, at other temperatures with high accuracy.
4.7. Identification of magnetization states
The feature of Vegas that allows to store the direction of every spin moment at the last MCS is very useful to identify different magnetization states, which is difficult from the thermal average quantities alone. Figure 8 shows a cross-sectional view of different magnetization states produced in a spherical ferromagnetic nanoparticle with core

FIGURE 8 a) “Collinear”, b) “throttled”, c) “hedgehog” and d) “artichoke” magnetization states produced in a ferromagnetic spherical nanoparticle with core and Néel surface anisotropy.
Figures 2, 6a, 6b, 8 and the inset in Fig. 3a were generated using POV-Ray 21.
Worked examples, tutorials and a detailed description of the use of Vegas can be found at its web page https://pcm-ca.github.io/vegas/.
5. Perspectives
VEGAS is a software package under active development. Important improvements are planned for the sample building and data analysis libraries, increasing the flexibility in the construction of complex magnetic systems and providing different tools for the analysis and visualization of all kind of simulation results. Addition of new Hamiltonian terms, such as the dipolar and Dzyaloshinskii-Moriya interactions, are expected to be included in the Hamiltonian. Parallelization techniques are also planned to be applied to the Monte Carlo Metropolis algorithm to reduce simulation times. Because the storing of the history of the simulation generates significantly long files, and for some applications this information is not necessary, it is planned to introduce an input parameter to set the frequency of the storing of the data. This could also enhance the efficiency of the simulation by avoiding the storing of correlated data. Furthermore, it is expected to develop a functionality to resume a simulation, that has crashed for an external factor, from the data stored before the crash. Finally, in order to complement the dynamic study of a system, a functionality will be developed to allow the visualization of the time evolution of the system spin configuration. This can be achieved by storing the spin moments direction every given number of MCS at a specific temperature/field. Researchers are encouraged to contribute to the development of Vegas at its GitHub repository 22.