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

Possible bin-center/edge issue with sw_plotspec #141

Open
RichardWaiteSTFC opened this issue Apr 21, 2023 · 0 comments
Open

Possible bin-center/edge issue with sw_plotspec #141

RichardWaiteSTFC opened this issue Apr 21, 2023 · 0 comments

Comments

@RichardWaiteSTFC
Copy link
Collaborator

RichardWaiteSTFC commented Apr 21, 2023

To Reproduce:

(1) Run this script with 11 q-bins in call to spinwave and plot using sw_plotspec

nqbins = 11  % <- CHANGE THIS IN STEP 2
dE = 0.1 % <- CHANGE THIS IN STEP 3
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);
FMspec = sw_egrid(FMspec,'component','Sperp', 'Evect', 0:dE:6);
sw_plotspec(FMspec)

(2) Run the script again with nqbins=21
It looks like the patches are no longer at the bin center in q
image

(3) Change the energy binning dE=0.15 - this looks like it fixes the problem
image

Perhaps it matters whether the energy bin edges coincide with the eigenvalues? Not sure why though. Also the colorfill plotting (inside sw_plotspec) is done by the image function which does apparently center the patch on the bin center (unlike some colorfill plotting functions which put the bottom left corner of the patch at the bin center).

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

No branches or pull requests

1 participant