Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Refactor magnetic structure into a class #20

@mducle

Description

@mducle

While not strictly needed for the conversion to C++ of the spin-wave dispersion calculation, refactoring the magnetic structure definition of the spinw object (currently a struct with elements F for the basis, k for the propagation vector and nExt for the super cell size) is desirable for future translation into Python.

The basis spinw.mag_str.F is an array of complex 3-vectors (one vector per spin [indexed j] in the first unit cell / supercell). The general j th moment of a unit cell at t from the first unit cell is:

\mathbf{m}_j = \mathbf{F}_j \exp(-2\pi i \mathbf{k}\cdot\mathbf{t})

Note that spinw only supports a single k (propagation) vector (usually the above formula is a sum over different k each of which can have a different basis).

Whilst the above is a general representation of all single-k magnetic structures, what SpinW actually uses is a rotating frame representation with a real magnetisation vector M which rotates within a plane defined by a plane normal n and phases phi between equivalent atoms in different unit cells. The method spinw.magstr() (note no underscore) calculates this rotating frame representation and it is this representation which is used in the spin wave calculation (although other parts of SpinW use the Fourier representation described by the above equation).


Currently there is a magnetic_structure class but it is a very confused object. It was aimed at the spin wave calculation only so takes as its input the (transformed by spinw.magstr()) rotating frame representation and defines two methods (get_local_basis() and transform_frame() which is needed by spin wave calculation itself. This issue is to extend and refactor this class to be a general magnetic structure class for SpinW.

As such, it should first be refactored to use the Fourier representation (or to be constructable with the Fourier representation). Then there should be a method (basically moving spin.magstr() into magnetic_structure) to convert to a rotating frame representation.

The constructor should also accept arguments similar or the same as what the spinw.genmagstr() currently accepts (so that genmagstr() can just call straight through to the magnetic_structure constructor.


Required parts for this work are:

  • Refactor current sw_classes.magnetic_structure class to use Fourier basis but to still be able to calculate and export the real magnetisation and rotation plane perpendicular vector on demand
  • Add a constructor which mirrors spinw.genmagstr()
  • Update functions which currently uses the rotation frame representation to use the methods / properties of magnetic_structure.
  • Update functions which currently sets elements of the (Fourier representation) spinw.mag_str structure directly to use setters in the new class.
  • Update the spinw.mag_str property and spinw.magstr() method to use sw_classes.magnetic_structure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions