The function imports vector file archives from oommf [1], mumax3 [2], Boris [3] into Matlab arrays.
*with mumax3 was not tested, but should work with proper saving .ovf as a text. See comments about saving in OOMMF and Boris
The file is inspired by H. Corte and his function oommf2matlab.m
ChatGPT [4] was used also.
Main modification: fileToRead is processed with fileread function, not line-by-line. It works much faster for large files (100+Mb)
Vector files will be imported into the object "data" which will have this fields (if exist in fileToRead):
datax: component x of vector on data file
datay: component y of vector on data file
dataz: component z of vector on data file
time: total simulation time
xmin: minimum x value
xnodes: number of nodes used along x
xmax: maximum x value
ymin: minimum y value
ynodes: number of nodes used along y
ymax: maximum y value
zmin: minimum z value
znodes: number of nodes used along z
zmax: maximum z value
positionx: x positions of vectors
positiony: y positions of vectors
positionz: z positions of vectors
The number of fields could be extended easily
Basic usage:
dataOMF = oommf2matlab("your_file_name.ovf")
Mx = dataOMF.datax
Example: Plot 2D images from all files in directory:
dir_name = './DirName/';
file_extention = '*.ovf';
f_n = dir([dir_name file_extention]);
[~,idx] = sort([f_n.datenum]);
f_n = f_n(idx);
fileNames = {f_n.name};
mult = 1e6;
for ff = 1:length(fileNames)
dataOMF = omf2matlab([dir_name fileNames{ff}]);
Xvector = mult* linspace(dataOMF.xmin, dataOMF.xmax, dataOMF.xnodes);
Yvector = mult* linspace(dataOMF.ymin, dataOMF.ymax, dataOMF.ynodes);
Magn_z = dataOMF.dataz
imagesc(Xvector, Yvector, Magn_z');
drawnow;
end;
Some instrument control programs (for pump-probe measurements, imaging etc) are also on github. Thus, welome :))
The code was used for article: Khokhlov, N. E., Filatov, I. A., & Kalashnikova, A. M. Spatial asymmetry of optically excited spin waves in anisotropic ferromagnetic film. Journal of Magnetism and Magnetic Materials, 589, 171514 (2024) [https://doi.org/10.1016/j.jmmm.2023.171514] The citation is welcome
References:
[1] OOMMF: Object Oriented MicroMagnetic Framework, NIST,
[2] mumax3, a GPU-accelerated micromagnetic simulation
[3] Boris Computational Spintronics,
Multi-physics magnetisation dynamics and spin transport simulations,
This function was written by N. Khokhlov