Magnetoelastic extension

1,888 views
Skip to first unread message

soura...@gmail.com

unread,
May 27, 2021, 7:10:05 AM5/27/21
to mumax2
Hi,
Magnetoelastic extension for MuMax3 has been demonstrated in this article - 
Can you suggest to me how to incorporate the extension in the MuMax3 code?
Thanks in advance.
With regards,
Sourav

Frederic Vanderveken

unread,
May 27, 2021, 9:46:28 AM5/27/21
to mumax2
Dear Sourav,

You can download the extension from the following repository: https://github.com/Fredericvdv/Magnetoelasticity_MuMax3. The installation and compilation are exactly the same as for the regular mumax3 and is explained here: https://github.com/mumax/3#building-from-source-for-linux

I hope this helps. 

Kind regards,
Frederic

Sourav Sahoo

unread,
May 27, 2021, 10:25:22 AM5/27/21
to mum...@googlegroups.com
Dear Frederic,
Thanks for your suggestions.
I am using the Windows system. 
Can you help me to install it in Windows?

With best regards,
Sourav

--
Sourav Sahoo
Senior Research Fellow (SRF)
Department of Condensed Matter Physics and Material Sciences
S.N. Bose National Centre For Basic Sciences
Block - JD, Sector-III, Salt Lake City
Kolkata - 700106, INDIA


--
You received this message because you are subscribed to a topic in the Google Groups "mumax2" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mumax2/vJ6flBOmBrY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mumax2+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mumax2/3f2235ea-737a-4233-abfa-1c5f54c8957bn%40googlegroups.com.
Message has been deleted

jpla...@rams.colostate.edu

unread,
May 27, 2021, 7:48:26 PM5/27/21
to mumax2
Hello Sourav and Frederic,

I was able to get it to compile for Windows, following the instructions by Mykola here . The only major change was to change the line  'go get -u -v github.com/mumax/3/...' to  'go get -u -v github.com/Fredericvdv/Magnetoelasticity_MuMax3/...'  . (Note that by default Mykola means your CUDA should be installed in C:\ , so that it's C:\cuda\bin etc. You need to set this on the CUDA installer, I don't believe this is was the default last time i installed, i changed it manually during the CUDA install)

Alternatively, follow the steps by Mykola up to step d (to install golang and mingw). Instead of using git, navigate to your GOPATH,and download Frederic's repository zip file. Unzip it, and move the unzipped version to GOPATH\src\github.com\ . Then navigate to the make file (It should be something like C:\Go\src\github.com\Magnetoelasticity_MuMax3-magnetoelastic\cmd\mumax3   ) , and in a command prompt, type 'go install'.

The binary should then be located in C:\Go\bin\bin or C:\Go\bin, depending on the method.

This seems to give a working install of Mumax3. However, I don't seem to have the magnetoelastic parts, so perhaps Frederic could elaborate if another step is needed? It is definitely downloading from the ME repository (screenshot attached). Alternatively, if someone could generate a Windows binary as is the case for mumax 3.10 that would be appreciated.

Best,
Josh L.
magnetoelastic.jpg

st.wi...@gmail.com

unread,
Sep 8, 2021, 5:31:59 AM9/8/21
to mumax2
Hello together,
Did anyone succeed getting the module to run on a Windows system?
Some hints would be highly appreciated.
Best,
Steffen

jpla...@rams.colostate.edu

unread,
Sep 8, 2021, 8:09:49 PM9/8/21
to mumax2
Hello,

I was able to get it working, with some slight modifications to the above procedure. I will try to describe the issue, and my fix (which is a messy kludge). If you just want the binary, I uploaded it here . It was compiled with go version 1.10.8, and cuda 11.3. You will need a matching cuda version to be compatible with running it.

There are two major issues:

1- the paths in all the .go files needed to be updated. When you run 'go get', it downloads both the ME version, and normal mumax, and the paths inside the ME files point to normal mumax. That's why it defaults to building without the ME extension, despite downloading the files. For example, if you look inside main.go for the ME version, it imports "github.com/mumax/3/engine" when it really should look to "github.com/Fredericvdv/Magnetoelasticity_MuMax3/engine"

To get around this, i downloaded a local copy, and built it using "go install" instead of "go get" command. In principle, if you update all the paths yourself in the .go files (there are not many, maybe 10 or so, most of which are similar to "github.com/mumax/3/engine"), this should be sufficient. I was not able to get the paths to format correctly (I am not sure why, i tried both windows/linux syntax, however I am not very familiar with Go/git). For example, naively replacing "github.com/mumax/3/engine" -> "github.com/Fredericvdv/Magnetoelasticity_MuMax3/engine" in the .go files did not work.

As a workaround, what i did was delete the normal mumax files, and renamed the ME folder to the normal mumax folder names (this renaming should be done inside git using mv command, not just using windows). This requires only 2 folder name changes "Fredericvdv"->"mumax" and "Magnetoelasticity_Mumax"->"3". So now when it looks to import "github.com/mumax/3/engine", it is tricked to looking to the ME engine.

If you do this properly, inside git you should be able to cd to a path that looks like "~\go\src\github.com\mumax\3\cmd\mumax3" , where ~ is your GOPATH (by default, something like "C:\Users\Josh"). In this directory, run "go mod init", and then "go install".

2- The second major issue is the go version. In addition to the above, you need an updated version of go, but not the most recent versions. The version mykola lists (1.4.2) does not work for the ME version. However, it also needs to be before version 1.11, as there was a change in go convention for path variables, where it switched to modules. This also breaks the compile. There is an environment variable called GO111MODULE you can set =off that is supposed to disable the modules and revert to the old GOPATH method for versions of go >1.11 , but I couldn't get it to work. I ended up using version 1.10.8 .

The full procedure is thus:

(a) install CUDA into default location; (for windows, default is "C:\cuda\")
(b) install golang version 10.8 https://golang.org/dl/; (under archived versions)
(c) make sure GOROOT and GOPATH environment variable are set according to your needs (see more at https://golang.org/doc/code.html, the installer should set GOROOT automatically);
(d) install msysgit https://msysgit.github.io/; (i don't think it matters, but my git is version 2.32)
(e) open msysgit command prompt;
(f) type "go env" (it will show your GOROOT and GOPATH. GOROOT by default should be "C:\Go". My GOPATH was "C:\Users\Josh\go")
(f) type 'go version'
(g) if it says 'go version go1.10.8 ...' then type 'go get -u -v github.com/Fredericvdv/Magnetoelasticity_MuMax3/...' ; ( this will fail, but it will download the files to the appropriate place for you. alternatively you can just download the files off github and place them in "C:\Users\Josh\go\src\github.com" , where "C:\Users\Josh\" is replaced by your GOPATH )
(h) type 'cd go/src/github.com'
(i) type 'ls'   (there should be 2 folders. one named mumax, and one named Fredericvdv)
(j) type 'rm -r mumax'
(k) type 'mv Fredericvdv mumax'
(l) type 'cd mumax'
(m) type 'mv Magnetoelasticity_MuMax3 3'
(n) type 'cd 3/cmd/mumax3/'
(o) type "go mod init"
(p) type "go install"
(q) if (p) is successful, then type 'mumax3 -i' and the interactive session should emerge in your default web browser;

Let me know if you have any questions, or run into trouble. It took me a few days to finally troubleshoot each step, the error messages are not intuitive, and the above is the result of several days of trial and error. It's also possible some steps are redundant/unnecessary. 

Best,
Josh L.

st.wi...@gmail.com

unread,
Sep 10, 2021, 1:54:28 PM9/10/21
to mumax2
Hi Josh,
Thanks a lot for the detailed description and the effort you made. Might be of general interest having a workaround on this.
I will try your points within the next couple of days and let you know if I get it to run properly.
Best,
Steffen

st.wi...@gmail.com

unread,
Sep 15, 2021, 1:37:22 PM9/15/21
to mumax2
Yeah, I got it running with your description, Josh. Thanks a lot for sharing such detailed steps!

rachit...@gmail.com

unread,
Sep 20, 2021, 4:54:43 AM9/20/21
to mumax2
Hi Josh,

Do you happen to have the binary file of magnetoelastic extention( for ubuntu)?

Thanks and regards,
Rachit Raghav Pandey

Message has been deleted

Haruki EGUCHI

unread,
Nov 1, 2022, 11:42:14 PM11/1/22
to mumax2
Dear Josh,

>The full procedure is thus:
>
>(a) install CUDA into default location; (for windows, default is "C:\cuda\")
>(b) install golang version 10.8 https://golang.org/dl/; (under archived versions)
>(c) make sure GOROOT and GOPATH environment variable are set according to your needs (see more at https://golang.org/doc/code.html, the installer should set >GOROOT automatically);
>(d) install msysgit https://msysgit.github.io/; (i don't think it matters, but my git is version 2.32)
>(e) open msysgit command prompt;
>(f) type "go env" (it will show your GOROOT and GOPATH. GOROOT by default should be "C:\Go". My GOPATH was "C:\Users\Josh\go")
>(f) type 'go version'
>(g) if it says 'go version go1.10.8 ...' then type 'go get -u -v github.com/Fredericvdv/Magnetoelasticity_MuMax3/...' ; ( this will fail, but it will download the files to the appropriate place for you. alternatively you can just download the files off github and place them in "C:\Users\Josh\go\src\github.com" , where "C:\Users\Josh\" is replaced by your GOPATH )
>(h) type 'cd go/src/github.com'
>(i) type 'ls'   (there should be 2 folders. one named mumax, and one named Fredericvdv)
>(j) type 'rm -r mumax'
>(k) type 'mv Fredericvdv mumax'
>(l) type 'cd mumax'
>(m) type 'mv Magnetoelasticity_MuMax3 3'
>(n) type 'cd 3/cmd/mumax3/'
>(o) type "go mod init"
>(p) type "go install"
>(q) if (p) is successful, then type 'mumax3 -i' and the interactive session should emerge in your default web browser;

I have completed step (o) of the installation method described above. However, when I performed "go install" in step (p), I got the following error message.

can't load package: package GitHub.com/mumax/3/cmd/mumax3: unknown import path "github.com/mumax/3/cmd/mumax3": ambiguous import: found github.com/mumax/3/cmd/mumax3 in multiple modules:
  
   github.com/mumax/3 v3.9.3+incompatible (/home/eguchi/go/pkg/mod/github.com/mumax/3...@v3.9.3+incompaatible/cmd/mumax3)

I would appreciate if you could advise how to resolve the error.

Thank you very much,

Best regards,

Haruki
2021年9月20日月曜日 17:54:43 UTC+9 rachit...@gmail.com:

Haruki EGUCHI

unread,
Nov 2, 2022, 10:25:53 PM11/2/22
to mumax2
PS
For you reference.

My go.mod in directory of 
/home/eguchi/go/src/github.com/mumax/3/cmd/mumax3
is as follows,

========================================
module gitHub.com/mumax/3/cmd/3/mumax3

require gitHub.com/3 v3.9.3+incompatible // indirect
========================================

Thank you in advance.

Best regards,

Haruki


2022年11月2日水曜日 12:42:14 UTC+9 Haruki EGUCHI:

Chirag Kalouni

unread,
Nov 3, 2022, 8:41:19 AM11/3/22
to mumax2
Warm Regards

I followed the method for installing ME. In doing so i got stuck at (l) msg appears " cannot remove 'mumax/3/.git/objects/pack' : Directory  not empty"

also at command (g) as stated by you it fails so i have downloaded the files of github and copied them to github.com folder. But in my system github.com was placed here GOPATH\Go\src\cmd\vendor so i moved it to  GOPATH\Go\src\github.com

What could be the solution for this?
I have attached the screen snap for reference. 

Much appreciation for your work. Thanks



Chirag Kalouni
Phd Scholar
Jamia Millia Islamia University
3.png
1.png
2.png

Chirag Kalouni

unread,
Nov 4, 2022, 8:06:07 AM11/4/22
to mumax2
Hi!
I was able to proceed further from where i was stuck yesterday but again i got stuck at (o). I have attached the image for reference.

Thanks for the help. 
go mod init error.png

Rasmus Antons

unread,
Nov 8, 2022, 6:29:01 AM11/8/22
to mumax2
Just FYI, we were able to install this with go 1.19.3 on linux using GO111MODULE=off essentially as described by Josh, just leaving out the go mod init.

 curl -OL https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
 tar -xf go1.19.3.linux-amd64.tar.gz
 export PATH=$(pwd)/go/bin:$PATH
 export GOPATH=$(pwd)/go
 export GO111MODULE=off
 mkdir -p go/src/github.com/mumax/3
 git clone https://github.com/Fredericvdv/Magnetoelasticity_MuMax3.git go/src/github.com/mumax/3
 cd go/src/github.com/mumax/3/cmd/mumax3
 go install

Then we moved the executable from go/bin/mumax3 somewhere else and apparently it works.

Chirag Kalouni

unread,
Nov 9, 2022, 9:00:44 AM11/9/22
to mumax2
Ok but i am doing it on windows OS and stuck in command (o ) also if i skip (o) and proceed to next one (p) then it is unable to get executable file that is a issue. 

Also what i have tried for magnetoelastic extension to work was put the binary file provided by Josh for windows in the folder from where i was earlier using mumax3 it just replaces it. In doing so the extension works but still i am unable to use normstress function.

will the binary file work same as the installation from github.  

Message has been deleted

qinfa luo

unread,
Aug 15, 2024, 8:49:50 AM8/15/24
to mumax2
Hello
everybody
I've looked at how Linux goes about adding a magnetically elastic coupling extension. However, how do you add any other extensions to Windows, such as your own files?
Hope someone can help me!
Sincerely
Luo

Антон Луценко

unread,
Aug 15, 2024, 11:38:18 AM8/15/24
to mumax2
Hi,
The difference would be mostly in the compilation procedures. There was already a bit of discussion on this forum about compiling mumax on Windows, and compiling the extended code should not have any difference from the compiling the vanilla mumax from scratch.

qinfa luo

unread,
Aug 15, 2024, 9:11:02 PM8/15/24
to mum...@googlegroups.com
Hi

Антон Луценко

Thanks for your reply very much! I will learn this discussion carefully, and I think its useful for me.
Sincerely
Luo

Антон Луценко <lutsenk...@gmail.com> 于2024年8月15日周四 23:38写道:
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 on the web visit https://groups.google.com/d/msgid/mumax2/2a72e1c9-d45b-456c-9eac-9c42f74c206an%40googlegroups.com.

qinfa luo

unread,
Aug 16, 2024, 9:36:57 AM8/16/24
to mum...@googlegroups.com
Hi,

Антон Луценко,Josh,and everyone

I have read the steps (a-q) Josh made in MUMAX3 Groups on September 9, 2021 regarding adding the Magnetically Elastic Coupling Expansion Pack. However, since I only use Windows at the moment, I am not very familiar with the Linux system. So, I still have some questions about how to install the Magnet Coupling Expansion Pack on Windows.
1. Before following the steps you provided to install the Magnetic Elastic Coupling Expansion Package, does the computer have installed the normal MUMAX3 and does it have any effect on the installation result?
2. Can the installation steps you provide be used to install other extensions?
3. BASED ON QUESTION 2, IF I WRITE AN EXTENSION PACKAGE PROGRAM THAT DOES NOT EXIST IN GIT-HUB (BECAUSE IT IS NOT POSSIBLE TO UPLOAD TO GIT-HUB AT THE MOMENT), CAN I ADD MY OWN PROGRAM TO MUMAX3? If so, can you help me a little bit?
The above questions are based on the Windows system.
Looking forward to your reply!
Sincerely
Luo

Антон Луценко <lutsenk...@gmail.com> 于2024年8月15日周四 23:38写道:
Hi,
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 on the web visit https://groups.google.com/d/msgid/mumax2/2a72e1c9-d45b-456c-9eac-9c42f74c206an%40googlegroups.com.

Антон Луценко

unread,
Aug 16, 2024, 1:51:55 PM8/16/24
to mumax2
Hi,
1. No, you don't need to have vanilla mumax installed. However, the prerequisites for compiling the extention (or rather the extended mumax) are the same as for compiling the default mumax (which also answers question 2). So a useful exercise would be to compile default mumax from the source code. Once that works, you would need to replace the default code with the extended one.
3. It is totally possible if you use "no git" pipeline, i.e. manually putting the code in a specific folder.
Hope that helps!

Josh Lauzier

unread,
Aug 17, 2024, 1:11:03 AM8/17/24
to mumax2
Hi,

A small clarification: The process I listed above was for Windows. Some later posts adapted it for Linux, but my post was for Windows specifically. Anton's answers above are correct.

1) No, you do not need to have mumax preinstalled. 

2) You can use the steps above, but there are several steps that are specifically to fix the typos in the ME extension, that are redundant. It will still work, but you're probably better off following Mykola's instructions that I mentioned in the previous post (for convenience here), or other similar posts discussing it. It's basically the same process, just without the steps I added to fix the typo in the ME extension specifically. The installation process for compiling normal mumax is basically the same as compiling an edited one (the only difference is you wouldn't be using "go get" to get the source files initially from the mumax github). So as Anton suggested, it would be a good idea to start with normal mumax, and see if you can get that compiled. Then you can just replace the normal source with your edited source, and recompile. The processes already listed will work, you don't need to meaningfully change them.

One important note: This particular installation process assumes you are not changing any of the underlying CUDA .cu files or PTX code. If you need to edit those, you need to follow a slightly different process (see here ). The process above compiles the Go portion but reuses the existing CUDA code. Edits to the .cu files won't be reflected in the final executable using this process.

3) Yes, it is possible to compile without github. The process I listed above does not actually use github other than to grab the files initially in step (g). If you already had the files locally because you made them, there is no need for github (or "go get"). It is compiling from the local source files.

One thing I would mention is, you might want to make sure you actually need to make an extension to accomplish what you want, before dealing with compiling and writing a new extension. You didn't mention what functionality you're looking for, but Mumax is pretty flexible so there is a chance what you want to do can already be done via custom fields or something within normal mumax. It might save you some time/trouble.

Best,
Josh L.

Reply all
Reply to author
Forward
0 new messages