Page 1 of 1

Calculated spectrum is 0 for narrow range

Posted: Fri Feb 17, 2023 6:23 am
by christiansen

Dear Easyspin community

Today I discovered a bug. I was able to simulate a full spectrum (0-15.8 T) very well using 'pepper'. However, when I try to only simulate a narrow range (15.5-15.8 T) 'pepper' returns nothing but zeros instead of something similar to what I got for the broad simulation. Am I doing something wrong? See code below. I run Easyspin 5.2.35 in Matlab R2019b on Ubuntu 18.04.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Code: Select all

clear all

rcm = 29979.2458; % reciprocal cm to MHz
Sys.S = [9/2];
D = 1.15*rcm;
E = 0.31*rcm;
Sys.D = [D E];
Sys.g = [2 2 2];
Sys.B4 = -2e-4*rcm;
Sys.lwpp = [0 100];
Sys.DStrain = abs(Sys.D)*0.05;

Exp.nPoints = 729; %For narrow spectrum

Exp.mwFreq = 331.2;
Bmax = 15.8; %in T
Exp.Range = [15.5 15.8].*1000; % in mT
Exp.Temperature = 18; %in K

[BSim,spcSim] = pepper(Sys,Exp); %spcSim is full of zeros when narrow range is simulated. When full range is simulated there is intensity in the narrow range.
% Opt.nKnots = 91;
% [BSim,spcSim] = pepper(Sys,Exp, Opt); %spcSim is full of zeros when narrow range is simulated. When full range is simulated there is intensity in the narrow range.

Re: Calculated spectrum is 0 for narrow range

Posted: Thu Feb 23, 2023 3:17 pm
by Stefan Stoll

Interesting, we'll look into that. Your script errors, can you please post one that runs clean so we can reproduce the problem?


Re: Calculated spectrum is 0 for narrow range

Posted: Fri Feb 24, 2023 9:22 pm
by Matt Krzyaniak

This is problem with the number of orientations, using the default number of nKnots or GridSize there are effectively no transitions in the chosen range. Increase that value and your reduced range and overall spectrum will look considerably better.


Re: Calculated spectrum is 0 for narrow range

Posted: Sun Feb 26, 2023 7:44 am
by christiansen

Thanks for your replies

@Stefan: The code does not give any errors; the returnt array spcSim is simply full of 0. Besides that, the code runs, and no error messages are given. I corrected a few typos I my original post and it should run now.

@Matt: That sounds like a reasonable explanation. In fact, increasing the number of knots solved the problem!

In the updated code example in my original post, the code now runs as it should when pepper is run with Opt.nKnots = 91.


Re: Calculated spectrum is 0 for narrow range

Posted: Wed May 10, 2023 11:45 am
by Stefan Stoll

Excellent. Quick note: if you switching over to version 6, remember to use Opt.GridSize instead of Opt.nKnots. The syntax has changed between versions 5 and 6.