SpinW / spinw

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

Fitting Spinwaves at Different Field Strengths #162

Closed GavinatBrock closed 4 months ago

GavinatBrock commented 8 months ago

Hello! I have two sets of field polarized spin wave data that were taken at different fields strengths and along different crystallographic directions. I have read through the documentation on the fitting functions and I don't think this feature is available in SpinW. Does anyone know for sure if this is the case?

If it is the case, could anyone suggest where in the fitting algorithm I should start implementing this on my own?

mducle commented 7 months ago

@GavinatBrock Sorry for the long delay in replying.

Yes, you can calculate the spin wave spectrum in an applied field - have a look at tutorial 20. In short, you need to define your spinw object / model, and then specify the field as a 3-vector:

swobj.field(Bvec);
spec = swobj.spinwave(hkl);

Where Bvec is the field vector specified in the crystal Cartesian coordinate system (defined by x||a, z perpendicular to a-b, and y perpendicular to x-z). If you want to split it into a direction and magnitude you can do as in the tutorial:

n = [1 1 0];
mag = 5;
swobj.field(n/norm(n)*mag);

(I presume that you don't want to fit the actual field magnitude / direction) - once you've set the field, you can use fitspec() like in tutorial 35 - or you can write your own fitting function using fminsearch or one of the curvefitting toolbox functions.