Post

OOMMF Tutorial Part 9: OOMMF Matlab Import

How to work with OOMMF files in Matlab

OOMMF can output both scalar and vector data. It’s easy enough to view this data using the built in programs in OOMMF, but what if you want to process or analyse your data further. This post shows you how to convert OOMMF vector files into a format that you can import into matlab for further processing.

Convert to a .mat file with OOMMFTools

The first step to working with OOMMF files in matlab is to convert them into a ‘.mat’ file that matlab can read. To do this I like to use the command line version of OOMMFTools. With this we can just run

1
omf2mat.py my_oommf_vector_file.omf

Although I’ve used a .omf file in this example, the same method works with any OOMMF vector file. This will generate a .mat file containing this information:

GridSize; % cell size used in simulation (x,y,z)
Iteration; % iteration number of this omf file
MIFSource; % The mif file that generated this omf file
OOMMFData; % Actual vector data (x_slice, y_slice, z_slice, (x,y,z))
SimTime; % simulation time of this omf file
Stage; % simulation stage of this file

 

The vector data

The vector information is stored in the .mat file as ‘OOMMFData’. This is a 3-dimensional grid, representing the simulated geometry, with a (1x3) vector at each point representing the OOMMF vector values themselves. See the OOMMFTools Readme for further discussion of the .mat data. Once you have the data in this format, you can just use normal matlab array commands to access and manipulate the data.

OOMMF Tutorial

This post is licensed under CC BY 4.0 by the author.