Skip to content

Commit 7cb87fe

Browse files
Merge remote-tracking branch 'origin/master' into nebm-kf
2 parents 743b8f6 + 0d8ee05 commit 7cb87fe

File tree

7 files changed

+203
-292
lines changed

7 files changed

+203
-292
lines changed

AUTHORS.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
| Tests Type | Status |
1111
|:-:|:-:|
1212
| GHA Unit Tests | ![Build](https://github.com/computationalmodelling/fidimag/actions/workflows/build.yml/badge.svg?)
13-
| Notebooks | ![Notebooks](https://travis-matrix-badges.herokuapp.com/repos/computationalmodelling/fidimag/branches/master/2)
1413

1514
<img src="http://computationalmodelling.github.io/fidimag/figs/skyrmion.jpg" alt="Fidimag Image" width="400" align="right">
1615

1716
Fidimag solves finite-difference micromagnetic problems and supports atomistic simulations, using Python interface. The interface to both types of simulation is similar.
1817

18+
### Install
19+
20+
See: [https://fidimag.readthedocs.io/en/latest/install.html](https://fidimag.readthedocs.io/en/latest/install.html)
21+
1922
### Features
2023
* Optimal LLG equation integration using modern [Sundial's v6](https://github.com/LLNL/sundials/) CVODE solver
2124
* Offers LLG and LLG with spin torque terms (Zhang-Li and Sloncewski)
@@ -86,7 +89,6 @@ If you use Fidimag, please cite as:
8689
Bisotti, M.-A., Cortés-Ortuño, D., Pepper, R., Wang, W., Beg, M., Kluyver, T. and Fangohr, H., 2018. Fidimag – A Finite Difference Atomistic and Micromagnetic Simulation Package. Journal of Open Research Software, 6(1), p.22. DOI: http://doi.org/10.5334/jors.223
8790

8891

89-
9092
### Acknowledgements
9193

9294
We acknowledge financial support from EPSRC’s Centre for Doctoral Training in Next Generation Computational Modelling (EP/L015382/1), EPSRC’s Doctoral Training Centre in Complex System Simulation (EP/G03690X/1), EPSRC Programme grant on Skyrmionics (EP/N032128/1) and OpenDreamKitHorizon 2020 European Research Infrastructure project (676541).

doc/install.rst

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,104 @@ Installation
22
============
33

44

5-
Please use these instructions to build and run Fidimag on Linux or
6-
OS X. We do not currently support Windows, as none of the developers
7-
use this as their operating system, though please make a pull request
8-
with instructions or let us know if you are able to get Fidimag
9-
working on a Windows machine.
5+
Please use these instructions to build and run Fidimag on Linux, OS X, or Windows WSL.
6+
Fidimag can work in Windows using a Python disctribution such as Anaconda or Mamba, with a C/C++ compiler.
107

11-
Ubuntu
12-
------
13-
14-
Users can run a quick convenience script in the folder Fidimag/bin
15-
by running the command::
16-
sudo bash ubuntu_install_script.sh
8+
Linux
9+
-----
1710

18-
Then, follow the instructions in 'All Systems' below.
11+
We recommend using `mamba <https://mamba.readthedocs.io/en/latest/>` (or conda). First create an environment with Python >= 3.10.
1912

13+
.. code-block:: bash
2014
21-
Other Linux
22-
-----------
15+
mamba create -n fidimag python=3.13 -c conda-forge
16+
mamba activate fidimag
2317
24-
Please install FFTW and Sundials using the scripts below, or use your package
25-
manager to do so.
2618
27-
* install-fftw.sh
28-
* install-sundials.sh
19+
Now clone the repository and `cd` into it.
2920

30-
We also need a number of Python packages:
31-
32-
* numpy
33-
* scipy
34-
* cython
35-
* pytest
36-
* matplotlib
37-
* ipywidgets
38-
* pyvtk
39-
* ipython
21+
.. code-block:: bash
4022
41-
These can be installed through the pip package manager with::
23+
git clone [email protected]:computationalmodelling/fidimag.git
24+
cd fidimag
4225
43-
pip install numpy scipy cython pytest matplotlib ipywidgets pyvtk ipython
4426
45-
You will need a relatively recent installation of CMake (> version 3) to use the Sundials script. You may also need to install development versions of
27+
Install FFTW and Sundials. You will need a relatively recent installation of (> version 3) to use the Sundials script. You may also need to install development versions of
4628

4729
* BLAS
4830
* LAPACK
4931

50-
though many Linux distributions come with these.
32+
though many Linux distributions come with these. Using the scripts provided in Fidimag:
5133

52-
Then, follow the instructions in 'All Systems' below.
34+
.. code-block:: bash
35+
36+
cd bin
37+
bash install-fftw.sh
38+
bash install-sundials.sh
39+
40+
Python library dependencies are specified in the `pyproject.toml` file. We can install the `fidimag` library in editable mode, using `pip`:
41+
42+
.. code-block:: bash
43+
44+
pip install -e .
45+
46+
This will build the C/C++ modules and setup `fidimag` in our Python environment. We can make any changes to the Python code and not install the library again, unless we modified the C/C++ modules, which requires building again. Now we can simply call
47+
48+
.. code-block:: bash
49+
50+
python -c "import fidimag"
51+
52+
53+
If you want to check everything has worked correctly, try the command 'make test' from the fidimag directory - if all tests pass, then you have a working installation!
54+
55+
Alternatively, for development, we can install the C/C++ modules
56+
57+
.. code-block:: bash
58+
59+
make
60+
61+
62+
and link the Fidimag directory to the Python path
63+
64+
.. code-block:: bash
65+
66+
export PYTHONPATH=/path/to/fidimag:$PYTHONPATH
67+
68+
69+
Any changes to the C/C++ modules will require building only the modified codes and not all of the modules using `make`.
5370

5471

5572
OS X
5673
----
5774

5875
OS X has not shipped with GCC since the release of OS X Mavericks. You therefore need to install this, as the version of clang which ships does not support OpenMP. We advise that you use the brew package manager, and install gcc5. We also strongly advise that you install the Anaconda Python distribution - we do not test against the version of Python that comes with OS X.
5976

60-
Once you have done this, you need to specify the compiler you are using::
77+
Once you have done this, you need to specify the compiler you are using
78+
79+
.. code-block:: bash
6180
6281
export CC=gcc-5
6382
6483
You can then follow the same installation instructions as for 'Other Linux', but don't worry about BLAS and LAPACK as Anaconda takes care of these for you.
6584

6685
Then, follow the instructions in 'All Systems' below.
6786

87+
Troubleshooting
88+
---------------
6889

69-
All systems
70-
-----------
90+
If there is a problem with finding C/C++ sundials and fftw libraries, it is necessary to update the corresponding env variable
7191

72-
Once you've built Fidimag, you need to add the libraries to your LD_LIBRARY_PATH, so that Fidimag can find them. If you installed SUNDIALS and FFTW using our scripts, you can do this with the command::
92+
.. code-block:: bash
7393
7494
export LD_LIBRARY_PATH=/path/to/fidimag/local/lib:$LD_LIBRARY_PATH
7595
76-
You may want to add this and another command to the file ~/.bashrc on Linux or ~/.bash_profile on OS X::
77-
78-
export PYTHONPATH=/path/to/fidimag:$PYTHONPATH
79-
80-
Adding Fidimag to your PYTHONPATH allows fidimag to be imported in Python from any directory.
81-
82-
If you want to check everything has worked correctly, try the command 'make test' from the fidimag directory - if all tests pass, then you have a working installation!
8396
8497
OOMMF
8598
-----
8699

87100
Some additional tests check Fidimag against OOMMF. To run these, you need a working OOMMF installation, and you need need to tell the system where to
88-
find it. You can do this by setting the environment variable to the directory containing oommf.tcl::
101+
find it. You can do this by setting the environment variable to the directory containing oommf.tcl
102+
103+
.. code-block:: bash
89104
90105
export OOMMF_PATH=/path/to/folder/containing/OOMMF

fidimag/atomistic/lib/fmmlib/fmmlib.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ cdef vector[Particle] sim_to_particles(mesh, mu_s):
3535
for j in range(mesh.ny):
3636
for i in range(mesh.nx):
3737
id = k * mesh.nx * mesh.ny + j * mesh.nx + i
38-
// Check that the spin is not a 'ghost' spin
39-
if mus[id] != 0:
38+
# Check that the spin is not a 'ghost' spin
39+
if mu_s[id] != 0:
4040
ids.append(id)
4141

4242

fidimag/common/driver_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def set_integrator(self, integrator, use_jac):
8989
elif integrator == "sundials":
9090
self.integrator = CvodeSolver(self.spin, self.sundials_rhs)
9191
elif integrator == "euler" or integrator == "rk4":
92-
self.integrator = StepIntegrator(self.spin, self.step_rhs)
92+
self.integrator = StepIntegrator(self.spin, self.step_rhs, step=integrator)
9393
elif integrator == "scipy":
9494
self.integrator = ScipyIntegrator(self.spin, self.step_rhs)
9595

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[project]
2+
name = "fidimag"
3+
dynamic = ["version"]
4+
description = "Atomistic and Finite-DIfference microMAGnetic code, based on Python, Cython and C "
5+
readme = "README.md"
6+
license-files = "LICENSE.txt"
7+
# license = "BSD-2-Clause"
8+
requires-python = ">= 3.10"
9+
dependencies = [
10+
'numpy',
11+
'scipy',
12+
'cython>=3.0.0',
13+
'pytest',
14+
'matplotlib',
15+
'ipywidgets',
16+
'pyvtk',
17+
'ipython',
18+
'psutil'
19+
]
20+
authors = [
21+
{ name = "Weiwei Wang" },
22+
{ name = "David Cortes Ortuno" },
23+
{ name = "Ryan Pepper" },
24+
{ name = "Hans Fangohr" },
25+
{ name = "Marc-Antonio Bisotti" },
26+
{ name = "Thomas Kluyver" },
27+
{ name = "Mark Vousden" },
28+
{ name = "Oliver Laslett" },
29+
{ name = "Rebecca Carey" },
30+
]
31+
32+
maintainers = [
33+
{name = "David Cortes Ortuno", email = "[email protected]"},
34+
{name = "Ryan Pepper"}
35+
]
36+
37+
[build-system]
38+
build-backend = "setuptools.build_meta"
39+
requires = [
40+
"setuptools",
41+
"numpy",
42+
"cython>=3.0.0",
43+
]

0 commit comments

Comments
 (0)