<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Tutorial 0 - First JOOMMF notebook
The goal of this tutorial is for all participants to familiarise themselves with running JOOMMF simulations in Jupyter notebook. The only thing you need to know for this tutorial is how to execute individual cells
Step1:  We create a system object and provide
Step2:  Our Hamiltonian should only contain exchange, demagnetisation, and Zeeman energy terms. We will apply the external magnetic field in the $x$ direction for the purpose of this demonstration
Step3:  The dynamics of the system is governed by the LLG equation containing precession and damping terms
Step4:  We initialise the system in positive $y$ direction, i.e. (0, 1, 0), which is different from the equlibrium state we expect for the external Zeeman field applied in $x$ direction
Step5:  We can check the characteristics of the system we defined by asking objects to represent themselves
Step6:  We can also visualise the current magnetisation field
Step7:  After the system object is created, we can minimise its energy (relax it) using the Minimisation Driver (MinDriver).
Step8:  The system is now relaxed, and we can plot its slice and compute its average magnetisation.
<ASSISTANT_TASK:>
Python Code:
import oommfc as oc
import discretisedfield as df
%matplotlib inline
Explanation: Tutorial 0 - First JOOMMF notebook
The goal of this tutorial is for all participants to familiarise themselves with running JOOMMF simulations in Jupyter notebook. The only thing you need to know for this tutorial is how to execute individual cells: this is done by pressing Shift + Return.
Simple JOOMMF simulation
End of explanation
system = oc.System(name="first_notebook")
Explanation: We create a system object and provide:
Hamiltonian,
dynamics, and
magnetisation configuration.
End of explanation
A = 1e-12  # exchange energy constant (J/m)
H = (5e6, 0, 0)  # external magnetic field in x-direction (A/m)
system.hamiltonian = oc.Exchange(A=A) + oc.Demag() + oc.Zeeman(H=H)
Explanation: Our Hamiltonian should only contain exchange, demagnetisation, and Zeeman energy terms. We will apply the external magnetic field in the $x$ direction for the purpose of this demonstration:
End of explanation
gamma = 2.211e5  # gamma parameter (m/As)
alpha = 0.2  # Gilbert damping
system.dynamics = oc.Precession(gamma=gamma) + oc.Damping(alpha=alpha)
Explanation: The dynamics of the system is governed by the LLG equation containing precession and damping terms:
End of explanation
L = 100e-9  # cubic sample edge length (m)
d = 5e-9  # discretisation cell size (m)
mesh = oc.Mesh(p1=(0, 0, 0), p2=(L, L, L), cell=(d, d, d))
Ms = 8e6  # saturation magnetisation (A/m)
system.m = df.Field(mesh, value=(0, 1, 0), norm=Ms)
Explanation: We initialise the system in positive $y$ direction, i.e. (0, 1, 0), which is different from the equlibrium state we expect for the external Zeeman field applied in $x$ direction:
End of explanation
mesh
system.hamiltonian
system.dynamics
Explanation: We can check the characteristics of the system we defined by asking objects to represent themselves:
End of explanation
system.m.plot_slice("z", 50e-9, xsize=6);
Explanation: We can also visualise the current magnetisation field:
End of explanation
md = oc.MinDriver()
md.drive(system)
Explanation: After the system object is created, we can minimise its energy (relax it) using the Minimisation Driver (MinDriver).
End of explanation
system.m.plot_slice("z", 50e-9, xsize=6);
system.m.average
Explanation: The system is now relaxed, and we can plot its slice and compute its average magnetisation.
End of explanation
<END_TASK>