Magnetic field

Exercises

  1. Create a Hamiltonian for the cubic ferromagnetic model with nearest neighbors interactions and add some value of the magnetic field to it.

  2. Create ten Hamiltonians with the following magnetic fields:

    • (0, 0.1, 0)

    • (0, 0.2, 0)

    • (0, 0.3, 0)

    • (0, 0.4, 0)

    • (0, 0.5, 0)

    • (0, 0.6, 0)

    • (0, 0.7, 0)

    • (0, 0.8, 0)

    • (0, 0.9, 0)

    • (0, 1.0, 0)

    Hint

    Use arithmetic operations on the Hamiltonians.

import numpy as np
import magnopy

Exercise 1

# Cubic cell with a = 1
cell = np.eye(3)

# One atom per unit cell
# located in the center of the unit cell
atoms = dict(
    names=["Fe"],
    positions=[[0.5, 0.5, 0.5]],
    spins=[2.5],
    g_factors=[2],
)

# Choose convention
convention = magnopy.Convention(
    multiple_counting=True, spin_normalized=False, c1=1, c22=1
)

# Create a Hamiltonian
spinham = magnopy.SpinHamiltonian(cell=cell, atoms=atoms, convention=convention)

# Add nearest neighbor interactions
for nu in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
    spinham.add_22(
        alpha=0, beta=0, nu=nu, parameter=magnopy.converter22.from_iso(iso=-1)
    )

# Add magnetic field along +y of the value 2.432 Tesla
spinham.add_magnetic_field(B=(0, 2.432, 0))

Exercise 2

First we create base Hamiltonian with no magnetic field present.

# Cubic cell with a = 1
cell = np.eye(3)

# One atom per unit cell
# located in the center of the unit cell
atoms = dict(
    names=["Fe"],
    positions=[[0.5, 0.5, 0.5]],
    spins=[2.5],
    g_factors=[2],
)

# Choose convention
convention = magnopy.Convention(
    multiple_counting=True, spin_normalized=False, c1=1, c22=1
)

# Create a Hamiltonian
spinham = magnopy.SpinHamiltonian(cell=cell, atoms=atoms, convention=convention)

# Add nearest neighbor interactions
for nu in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
    spinham.add_22(
        alpha=0, beta=0, nu=nu, parameter=magnopy.converter22.from_iso(iso=-1)
    )

Then we create a Hamiltonian with only magnetic field of the value (0, 0.1, 0)

B_step = spinham.get_empty()

B_step.add_magnetic_field(B=(0, 0.1, 0), alphas=[0])

Finally, we use arithmetics on spin Hamiltonians to get a list of ten Hamiltonians

spinhams = [spinham + (index + 1) * B_step for index in range(10)]

for spinham in spinhams:
    print(spinham.p1[0])
[0, array([0.        , 0.01157676, 0.        ])]
[0, array([0.        , 0.02315353, 0.        ])]
[0, array([0.        , 0.03473029, 0.        ])]
[0, array([0.        , 0.04630705, 0.        ])]
[0, array([0.        , 0.05788382, 0.        ])]
[0, array([0.        , 0.06946058, 0.        ])]
[0, array([0.        , 0.08103735, 0.        ])]
[0, array([0.        , 0.09261411, 0.        ])]
[0, array([0.        , 0.10419087, 0.        ])]
[0, array([0.        , 0.11576764, 0.        ])]

Total running time of the script: (0 minutes 0.005 seconds)

Gallery generated by Sphinx-Gallery