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

RAL-India workshop bugs #147

Closed mducle closed 4 months ago

mducle commented 1 year ago

Bugs discovered during RAL-India workshop on neutron scattering data analysis.

  1. ~sw_egrid invalid handling of half-polarized mode~ (Fixed in #130)
  2. Segfault when using temporary numpy arrays in spinw definition (see libpymcr#19)
  3. Add ability to specify cell-arrays of equal-lengths vectors from Python (see libpymcr#18)
  4. Need to add call_python mex file to distribution (need CI modifications to compile it for all platforms). This would allow helper functions in Python to be used (e.g. for genmagstr, instead of the the provided gmplanar etc.)
  5. ~Some Matlab command fails with incorrect nargout in call.m (e.g. m.axis([0,1,0,2])) [a MATLAB:nargoutchk:tooManyOutputs error]~ (Fixed in libpymcr#20

Other minor bugs identified by users

  1. Issue with using a CIF file: lmo = spinw('LuMnO3.cif'); lmo.gencoupling will give a Symmetry error!. The LuMnO3.cif file is in the tutorials folder

~### sw_egrid: invalid handling of half-polarized mode~

~To reproduce: calculate a spectrum, compute the polarised intensities and then try to plot the half-polarised cross-sections with Pa (a=x,y,z) component:~

spec = sw_neutron(spec, 'pol', True, 'uv', ([1,0,0], [0,1,0]))
sw_plotspec(m.sw_egrid(spec, 'component', 'Pz'), 'dE', 0.1)

~This gives an error Matrix dimensions must agree. in line 424 of sw_egrid.m - which is due to the incorrect reshaping of the intP property of the input spectra (computed from sw_neutron in line 388 which should be: intP{ii} = reshape(intP{ii},3,nMode,[]);~

RichardWaiteSTFC commented 11 months ago

Just checking - have all of these been fixed by v0.1.5 of libpymcr https://github.com/pace-neutrons/libpymcr/pull/20

mducle commented 11 months ago

I've just updated the description. The call_python stuff is not in libpymcr-0.1.5 but is needed more for pace-python than for us. Still working on something there (I got it to work but it causes a segfault when you exit Python).

The LuMnO3.cif might be broken but I haven't checked and is not a libpymcr issue...

mducle commented 4 months ago
  1. Issue with using a CIF file: lmo = spinw('LuMnO3.cif'); lmo.gencoupling will give a Symmetry error!. The LuMnO3.cif file is in the tutorials folder

This is actually just a tolerance issue as the error message suggests. The 'tolDist' default is 1e-3 Angstrom, but the accuracy of the c lattice coordinate of the Mn ion is 1e-4 (it is 0.99923 in the file). If this is changed to 0.99 or 'tolDist' is tightened to 1e-4 then no error occurs.

We'll probably just leave the code as is rather than change the defaults or the cif.


All other issues have been fixed.