regular octahedron

40 views
Skip to first unread message

HUAN LEI

unread,
Aug 9, 2025, 10:57:49 AMAug 9
to mumax2
I am currently conducting a Mumax3 simulation of the regular octahedron. However, I am unable to achieve this simulation using Mumax3 at the moment. I attempted to create an STL file using Blender and then import it into Mumax3 for simulation calculations, but it seems that it does not support this. I would like to ask if anyone has any methods to simulate the regular octahedron.

Josh Lauzier

unread,
Aug 19, 2025, 3:10:15 AMAug 19
to mumax2
Hi,

In order to load it into mumax, you would first need to convert the STL file into the OVF format, and then load it in using regions.loadfile(). You would need to write a script in something like Matlab or Python.

There are 2 alternatives to form the geometry in mumax. You could try to build the octahedron from simpler shapes (mumax has a bunch of primitive shapes like cuboids etc, as listed on the example and API pages. These shapes can be manipulated with rotations, translations, etc). If you take a cube and intersect it with xrange's and yrange's (or the triangle shape) that are appropriately rotated/translated, you should be able to form a pyramid fairly easily. And then copy and rotate that pyramid. Something like:

SetGridsize(100, 100, 100)
SetCellsize(1e-6/100, 1e-6/100, 1e-6/100)

a:=cuboid(500e-9, 500e-9, 500e-9).intersect(xrange(-inf,0).transl(250e-9,0,0).roty(-45*pi/180).transl(0,0,-250e-9) )
b:=cuboid(500e-9, 500e-9, 500e-9).intersect(xrange(0,inf).transl(-250e-9,0,0).roty(45*pi/180).transl(0,0,-250e-9) )
c:=cuboid(500e-9, 500e-9, 500e-9).intersect(yrange(-inf,0).transl(0,250e-9,0).rotx(45*pi/180).transl(0,0,-250e-9) )
d:=cuboid(500e-9, 500e-9, 500e-9).intersect(yrange(0,inf).transl(0,-250e-9,0).rotx(-45*pi/180).transl(0,0,-250e-9) )

ff:=a.intersect(b)
gg:=ff.intersect(c)
hh:=gg.intersect(d)
ii:=hh.intersect(zrange(-125e-9,inf))
jj:=ii.roty(180*pi/180).transl(0,0,1e-6/100)
kk:=ii.intersect(jj)
setgeom( kk)
m=uniform(1,0,0)
save(m)

I'm not sure if that's exactly right, so please double check it. But that should at least give you a good idea.

A third method would be to use the equation for the regular octohedron. It is defined as abs(x)+abs(y)+abs(z)=1 . You can use the index2coord function for each cell, you can define if something is inside or outside of the object. This is not a particularly pretty/efficient example, but something like:

Nx := 32
Ny := 32
Nz := 32
c := 5e-9

setgridsize(Nx, Ny, Nz)
setcellsize(c, c, c)
for i:=0; i<Nx; i++{
for j:=0; j<Ny; j++{
for k:=0; k<Nz; k++{
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()

if (abs(x)+abs(y)+abs(z)) < 5e-8  {
regions.setcell(i,j,k,1)
}else {regions.setcell(i,j,k,0)}
}}}

m.setregion(1, uniform(1,0,0))
m.setregion(0, uniform(0,0,-1))
OutputFormat = OVF2_TEXT
save(regions)

This will probably be very slow for large values, but you get the idea. (also, you only need to do it once. Once you have the OVF from doing save(regions), in future scripts you can just use regions.Loadfile(), instead of recalculating it from scratch again). There's probably a faster method than using regions.setcell in a loop, which is rather slow, using masks and then regions.Evalto(mask), but it's not coming to mind right now.

Best,
Josh L.

Ian Lateur

unread,
Aug 20, 2025, 11:19:53 AMAug 20
to mum...@googlegroups.com
Hi,

If you're comfortable compiling mumax3, the master branch of the github repository contains a new "Superball" shape. This yields an octahedron if the second parameter p is set to 0.5, but this is not in any compiled version yet. Otherwise, I would follow Josh's advice.

Best regards,
Ian

Op di 19 aug 2025 om 09:10 schreef Josh Lauzier <joshl...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "mumax2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mumax2/8dc0a947-5bc7-4cd7-a618-44a4816d847en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages