-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor magnetic structure into a class #20
Description
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:
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_structureclass 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_strstructure directly to use setters in the new class. - Update the
spinw.mag_strproperty andspinw.magstr()method to usesw_classes.magnetic_structure