fork of mumax3 meant to increase the integration with a python processing workflow. I made my own wrapper around zarr called pyzfn which leverages the mumax data in the zarr format.
The solvers ( and results ) are unchanged, this is just list of massive quality of life improvements making working with the output data much more efficient and convenient.
It's not 100% compatible with the original .mx3
files. See changes below.
Don't just run an script on the internet. Read it, check what it does and then you can run this command to install amumax:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/MathieuMoalic/amumax/main/install.sh)"
Download cufft and curand, unpack and add the shared objects to $PATH, or just install the full CUDA suite with your package manager. Download the latest release:
curl -L https://github.com/mathieumoalic/amumax/releases/latest/download/amumax > amumax
amumax -v
libcurand.so
and libcufft.so
must either be in the same folder as amumax
or on $PATH.
Tx
,Ty
,Tz
,Nx
,Ny
,Nz
,dx
,dy
,dz
,PBCx
,PBCy
,PBCz
are now predefined variables. You define the Mesh through them. You don't need to call a function to initiate the Mesh, it is automatically done the first time you run a solver but you can't redefine the Mesh after that !
Tx
is the total size along the x axis. Nx
is the number of cells along the x axis. dx
is the number of cells along the x axis. Keep in mind that variables in mx3 script files aren't case sensitive so tx
is like Tx
for example.
old:
SetGridSize(256,256,10)
SetCellSize(1e-9,1e-9,1e-9)
SetPBC(32,32,0)
new:
Nx = 256
Ny = 256
Nz = 10
dx = 1e-9
dy = 1e-9
dz = 1e-9
PBCx = 32 // Optionnal
PBcy = 32 // Optionnal
PBCz = 0 // Optionnal
new (alternative but equivalent):
Nx = 256
Ny = 256
Nz = 10
Tx = 256e-9
Ty = 256e-9
Tz = 10e-9
PBCx = 32 // Optionnal
PBcy = 32 // Optionnal
lattice_constant := 500e-9
ref_paper := "X et al. (2023)"
You can access it in the file .zattrs
. Or using pyzfn:
print(job.lattice_constant)
print(job.ref_paper)
Nx = 16
Ny = 32
Nz = 10
Tx = 16e-9
Ty = 32e-9
Tz = 10e-9
SetGeom(Universe())
sampling_interval = 5e-12
AutoSaveAsChunk(m,"m_chunked", sampling_interval, Chunk(1, 1, Nz, 3))
Run(1e-9)
This code will save the magnetization as chunks:
x
and y
dimensions are unchunked ( set as 1 in Chunk() )z
dimension will have as many chunks as cells across the thickness ( 10 in this case )mz
, my
and mz
will be also chunked, saved separately.
Why would you want it? Because it makes loading the data from disk MUCH faster if you chunk in a smart way.
Say you want to calculate the FFT of the top layer of the y
component of the magnetization, in this case, loading the data from disk will be around 30 times faster..ovf
files as SaveOvf
and SaveOvfAs
. You cannot autosave ovf files anymore.run
, can be turned off with -magnets=false
AutoMeshx = True
,AutoMeshy = True
and AutoMeshz = True
will optimize the corresponding mesh axis for you (this function slightly changes the size and number of cells while keeping the total size of the system constant)SaveAsChunk(q Quantity, name string, rchunks RequestedChunking)
AutoSaveAsChunk(q Quantity, name string, period float64, rchunks RequestedChunking)
Chunk(x, y, z, c int) -> RequestedChunking
chunks must fit an integer number of times along the axes. The chunks will be modified to be valid and as closed as the chunks you requestedShapeFromRegion
functionsquircle
, triangle
, rtriangle
, diamond
and hexagon
AutoSaveAs
functionRound
function from the math libraryMinimizeMaxSteps
and MinimizeMaxTimeSeconds
to timeout long Minimize()
runs.Save
is used (from AutoSave
for example), the current simulation time t
is saved too as a zarray attributeext_makegrains
now also takes a new argument minRegion
. ext_makegrains(grainsize, minRegion, maxRegion, seed)nix
:nix run .#git
podman
or docker
:git clone https://github.com/MathieuMoalic/amumax
cd amumax
podman run --rm -v $PWD:/src docker.io/oven/bun:1.1.27 bash -c "cd /src/frontend && bun run build && mv /src/frontend/dist /src/api/static"
podman build -t matmoa/amumax:build .
podman run --rm -v $PWD:/src matmoa/amumax:build
./build/amumax -v
The amumax binary and cuda libraries are then found in build
.
You need to install git
, bun
, go
, cuda
. Then
git clone https://github.com/MathieuMoalic/amumax
cd frontend
bun install
bun run build
cd ..
mv frontend/dist api/static
export CGO_LDFLAGS="-lcufft -lcuda -lcurand -L/usr/local/cuda/lib64/stubs/ -Wl,-rpath -Wl,\$ORIGIN"
export CGO_CFLAGS_ALLOW='(-fno-schedule-insns|-malign-double|-ffast-math)'
go build -v .
I'm happy to consider any feature request. Don't hesitate to submit issues or PRs.
SetGeom
is called