computationalmodelling / fidimag

Finite DIfference microMAGnetic code, based on Python, Cython and C
http://computationalmodelling.github.io/fidimag/
Other
60 stars 24 forks source link

example about atomistic simulation #146

Closed ghost closed 4 years ago

ghost commented 4 years ago

Is there an example of Fidimag about some atomistic simulation? I could not find information on that.

Regards

davidcortesortuno commented 4 years ago

Hi, yes you can find them in examples/atomistic. Some of them might be out of date though, but we can try to update them if you find any issues.

ghost commented 4 years ago

Fidimag throws the following when trying to run the atomistic examples ,

File "dmi_2d.py", line 49 print 'relax system done' ^ SyntaxError: Missing parentheses in call to 'print'

or

Traceback (most recent call last): File "disk.py", line 113, in relax_system_stage1 () File "disk.py", line 55, in relax_system_stage1 sim.driver.alpha = 0.5 AttributeError: 'LLG' object has no attribute 'driver'

davidcortesortuno commented 4 years ago

The print error it's because the example is outdated, you should use Python 3's print: print(...)

The second error is because you are using an old version of Fidimag, how did you install it?

ghost commented 4 years ago

Thanks, I use "docker pull fidimag/notebook" for install. I think that install the last version, right?

davidcortesortuno commented 4 years ago

Hi, that's an old image that we haven't updated (we need to update the documentation). To get the latest version you have to clone the repository and in the main folder docker build -t fidimag . (since there is a Dockerfile in the main folder) If you are using Linux, you can also try to install Fidimag following the commands from the Dockerfile, which are like:

git clone https://github.com/computationalmodelling/fidimag.git
cd fidimag
cd bin
bash install-fftw.sh
bash install-sundials.sh
cd ..
export PYTHONPATH="PATH/TO/FIDIMAG/:$PYTHONPATH"
export LD_LIBRARY_PATH="PATH/TO/FIDIMAG//local/lib:$LD_LIBRARY_PATH"

python3 setup.py build_ext --inplace

(replace the path to fidimag to where you cloned the repo)

You can also try Fidimag using the Binder button in the README.

thomasbrianwinkler commented 4 years ago

Hello, i have a similar question concerning atomistic simulations. is there a difference in the units of material Parameters for the atomistic and the micromagnetic model? In which units do i have to put the (Zeeman) field for atomistic simulations? T, mT or A/m?

In some of the atomistic examples (skyrmion_demag/single_ku.py) there is an values called ONE_DEGREE_PER_NS = 17453292.52, which is used in the relax command. Is this still necessary?

Best, Thomas

davidcortesortuno commented 4 years ago

Hi @thomasbrianwinkler , for the atomistic simulations the Zeeman field is specified in Tesla units, since you use B. And the other constants for the energy terms in the Hamiltonian are mostly specified in units of energy, Joules. You can import fidimag.common.constant to get units of meV and mu_0 if necessary. In micromagnetics you set the Zeeman field in A/m since you use H.

As far as I remember, the ONE_DEGREE_PER_NS unit is mostly used as a reference for the LLG equation to stop, which is similar than is done in the OOMMF code. You do not need to use that value but rather specify a stopping value which goes in units of this parameter.

thomasbrianwinkler commented 4 years ago

Hello davidcortesortuno, thanks a lot for the quick answer! That helps.. Best, Thomas