Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in fastmode spinwave calculation when mex disabled and hermit=false #181

Closed
RichardWaiteSTFC opened this issue May 2, 2024 · 1 comment · Fixed by #182
Closed

Bug in fastmode spinwave calculation when mex disabled and hermit=false #181

RichardWaiteSTFC opened this issue May 2, 2024 · 1 comment · Fixed by #182

Comments

@RichardWaiteSTFC
Copy link
Collaborator

RichardWaiteSTFC commented May 2, 2024

Here is the spinwave spectrum for a FM chain calculated along H with mex enabled

swpref.setpref('usemex', true);

nqbins = 5;
dE = 0.2;
ebin_edge = 0:dE:6;
FMchain = spinw;
FMchain.genlattice('lat_const',[3 8 8],'angled',[90 90 90],'spgr',0);
FMchain.addatom('r',[0 0 0],'S',1,'label','MCu1','color','blue');
FMchain.gencoupling('maxDistance',7)
FMchain.addmatrix('value', -eye(3),'label','Ja','color','green')
FMchain.addcoupling('mat','Ja','bond',1);
FMchain.genmagstr('mode','direct', 'k',[0 0 0],'n',[1 0 0],'S',[0; 1; 0]);
FMspec = FMchain.spinwave({[0 0 0] [1 0 0], nqbins},'hermit',false, ...
                          'fastmode', true, 'neutron_output', true); % , 'sortMode', true);
FMspec = sw_egrid(FMspec,'component','Sperp', 'Evect', ebin_edge, 'dE', dE);
% sw_plotspec(FMspec)

f = figure('color','white');
ax = axes(f); box on; hold on;
h = imagesc(ax, FMspec.hkl(1,:), 0.5*(ebin_edge(1:end-1) + ebin_edge(2:end)), FMspec.swConv);
set(h, 'AlphaData', FMspec.swConv > 1e-10); % set 0s transparent
plot(ax, FMspec.hkl(1,:), FMspec.omega(1,:),'marker', 'o', 'color', 'r')
xlabel(ax, "H (r.l.u.)")
ylabel(ax, "Energy (meV)")

image

If you disable mex it looks like it returns eigenvalues of 0

>> FMspec.omega(1,:)
ans =
     0     0     0     0     0

So only get intensity within dE of the elastic line
image

Note using home-made plotting code as sw_fitspec errors - see
#180 (comment)

@RichardWaiteSTFC RichardWaiteSTFC changed the title Bug in fastmode spinwave calculation when mex disabled Bug in fastmode spinwave calculation when mex disabled and hermit=false May 2, 2024
@RichardWaiteSTFC
Copy link
Collaborator Author

Looks like the eigenvalues are just not copied from D to omega matrix
The equivalent of this line appears to be missing form the fastmode branch on L1019

omega(:,hklIdxMEM(ii)) = D(:,ii);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant