SpinW / spinw

SpinW Matlab library for spin wave calculation
http://www.spinw.org
GNU General Public License v3.0
36 stars 15 forks source link

Profile SpinW #74

Closed rebeccafair closed 1 year ago

rebeccafair commented 2 years ago

Before work starts on converting SpinW core computations to C++, current SpinW should be profiled to:

There may be useful resources in the https://github.com/SpinW/spinw/tree/multiprocessor branch

Tasks:

wardsimon commented 2 years ago

The current multiprocessing benchmarking is: Here

mducle commented 2 years ago

Regarding test systems. We currently have (in the +system_tests folder) the following systems:

The Hamiltonian matrix size is twice the number of spins in the magnetic unit cell (commensurate) or structural unit cell (incommensurate). For incommensurate structures the number of Q points calculated is tripled and there are additional matrix multiplications to compute the structure factors.

The biggest commensurate systems (most spins per unit cell) I've seen have around 50-60 spins in the unit cell, so I think we can use such a material for a "large" test (we can generate an arbitrary system or use a real example, such as TmMgGaO4 with 56 spins); the examples we have already (PCSMO, YTO) can be "medium" tests.


For incommensurate systems, in principle the actual calculations should be smaller if we can use the rotating coordinate frame. However, for several structures of interest this is not possible (because of multiple-k vectors, or some other reason). One system I know of is BiFeO3, which has a very small ordering wavevector (very large wavelength - and hence a very large supercell). When I worked on it, we collaborated with a theorist who used a rotating coordinate description but we did not use SpinW (paper) - it might be interesting to see if SpinW gives the same dispersion... However, the actual magnetic structure of BiFeO3 is "anharmonic" such that spins in neighbouring cells are not related by a constant rotation angle (this angle is periodic) - it thus cannot be described using a rotating coordinate frame. Still, the actual discrepancies in the spin wave dispersion only occurs are low energies near the magnetic ordering wavevector, and is almost undetectable by neutrons due to the relatively poor resolution we have. A group at ORNL did model this structure correctly in order to fit their terahertz spectroscopy data in a magnetic field (paper) but this required the use of the supercomputer there and the program they used is not public...

Nonetheless, if we want to push the limits of SpinW, we could perhaps simulate increasingly larger supercells of incommensurate structures in "commensurate" mode - e.g. generate Hamiltonian matrices with ranks in the hundreds...

mducle commented 1 year ago

@RichardWaiteSTFC @rebeccafair Ah... so I actually wrote a tutorial for BiFeO3 already: https://spinw.org/magneticStructurePresentation/#/Example1

There's an m-file there you can download.

The answers, if you're interested:

  1. The DM interaction D is responsible for the spins canting away from the easy axis in this system so you increase D the canting and hence kvec increases. Conversely the exchange interaction J prefers the spins to all align along the easy axis so increasing it w.r.t. D will cause kvec to decrease.
  2. Initally there are imaginary modes because optmagk does not actually move the spins - so they are still all aligned parallel to c. Only after you call optmagsteep does the spins get canted. You should plot the dispersion near the ordering k-vector, e.g. sw_plotspec(bfo.spinwave({[-0.01 -0.01 0] [0.01 0.01 0] 100}, 'hermit', false)) in order to see the imaginary modes.
  3. The theoretical expression is ok for the dependence of kvec on J but fails for the dependence of kvec on D for large D. I'm not completely sure about the reason for this but I think that the simple theoretical expression (k=D/J/2a where a is the lattice parameter) is only valid for a harmonic cycloid and for large D the cycloid is again not harmonic (like for the large single-ion anisotropy case).
rebeccafair commented 1 year ago

Initial profiling completed and results are in https://github.com/SpinW/performance. Has resulted in https://github.com/SpinW/spinw/issues/121, https://github.com/SpinW/spinw/issues/123.