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.
- Get linux: https://learn.microsoft.com/en-us/windows/wsl/install
- Follow the steps above.
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:
- The
x
andy
dimensions are unchunked ( set as 1 in Chunk() ) - The
z
dimension will have as many chunks as cells across the thickness ( 10 in this case ) mz
,my
andmz
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 they
component of the magnetization, in this case, loading the data from disk will be around 30 times faster.
- Remove the Google trackers in the GUI.
- Add saving as zarr
- Rename the functions to save
.ovf
files asSaveOvf
andSaveOvfAs
. You cannot autosave ovf files anymore. - Add progress bar for
run
, can be turned off with-magnets=false
- Reorder GUI elements
- Dark mode GUI
- Check and warns the user for unoptimized mesh
AutoMeshx = True
,AutoMeshy = True
andAutoMeshz = 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)- Add chunking support as per the zarr documentation with the functions:
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 requested- Add the
ShapeFromRegion
function - Add new shapes :
squircle
,triangle
,rtriangle
,diamond
andhexagon
- Add the
AutoSaveAs
function - Add the
Round
function from the math library - Add metadata saving : root_path, start_time, dx, dy, dz, Nx, Ny, Nz, Tx, Ty, Tz, StartTime, EndTime, TotalTime, PBC, Gpu, Host
- Add
MinimizeMaxSteps
andMinimizeMaxTimeSeconds
to timeout longMinimize()
runs. - Everytime the function
Save
is used (fromAutoSave
for example), the current simulation timet
is saved too as a zarray attribute - Save compressed arrays (zstd) by default
ext_makegrains
now also takes a new argumentminRegion
. ext_makegrains(grainsize, minRegion, maxRegion, seed)- Add colors for terminal logs
nix run .#git
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.
- Calculate the mesh when enough arguments are given instead of when
SetGeom
is called