In [11]:
from joommf.sim import Sim
from joommf.mesh import Mesh
from joommf.energies.exchange import Exchange
from joommf.energies.demag import Demag
from joommf.energies.zeeman import FixedZeeman
from joommf.drivers import evolver

import matplotlib.pyplot as plt
%matplotlib inline

# Mesh specification.
lx = ly = lz = 50e-9  # x, y, and z dimensions (m)
dx = dy = dz = 5e-9  # x, y, and z cell dimensions (m)

Ms = 8e5  # saturation magnetisation (A/m)
A = 1e-11  # exchange energy constant (J/m)
H = (1e3, 0, 0)  # external magnetic field (A/m)
m_init = (0, 0, 1)  # initial magnetisation
t_sim = 1e-9  # simulation time (s)
gamma = 2.21e5
alpha = 0.1
# Create a mesh.
mesh = Mesh((lx, ly, lz), (dx, dy, dz))

# Create a simulation object.
sim = Sim(mesh, Ms, name='dynamics_example', debug=True)

# Add energies.
sim.add_energy(Exchange(A))
sim.add_energy(Demag())
sim.add_energy(FixedZeeman(H))
sim.set_evolver(
    evolver.LLG(t_sim, m_init, Ms, alpha, gamma, name='evolver'))
# Set initial magnetisation.
sim.set_m(m_init)

# Run simulation.
sim.run()


About to execute: '/Users/ryan/oommf/oommf/oommf.tcl boxsi dynamics_example.mif'
Running simulation... This may take a while
Simulation complete
JOOMMF DEBUG MODE
Oommf Stderr:




Oommf Stdout:
Start: "/Users/ryan/oommf-python/joommf/dynamics_example.mif"
Options: -threads 2
Boxsi version 1.2.0.6
Running on: ip-038-226.vpn.soton.ac.uk
OS/machine: Darwin/x86_64
User: ryan	PID: 71026
Number of threads: 2
Mesh geometry: 10 x 10 x 10 = 1 000 cells
Boxsi run end.

Loading simulation scalar output from dynamics_example.odt

In [8]:
import glob

In [9]:
print glob.glob("*.omf")


[]

In [10]:
!ls


"""                             __init__.pyc                    dynamics_example.pyc            mesh.py                         oommfmif.py                     tests
Dynamics_Example_Notebook.ipynb __pycache__                     energies                        mesh.pyc                        oommfmif.pyc                    vectorfield.py
Makefile                        bigbar.mif                      examples                        minimisation_example.py         ovf.py                          vectorfield.pyc
README.md                       drivers                         exceptions.py                   odtreader.py                    sim.py                          vectorfield_example.ipynb
__init__.py                     dynamics_example.py             exceptions.pyc                  odtreader.pyc                   sim.pyc

In [ ]: