Calculated spectrum is 0 for narrow range

A place to report and discuss potential bugs
Post Reply
christiansen
User
Posts: 21
Joined: Thu Apr 08, 2021 7:38 am

Calculated spectrum is 0 for narrow range

Post 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.
Last edited by christiansen on Sun Feb 26, 2023 7:47 am, edited 1 time in total.
Stefan Stoll
EasySpin Creator
Posts: 1108
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Calculated spectrum is 0 for narrow range

Post 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?

Matt Krzyaniak
EasySpin Guru
Posts: 154
Joined: Tue Jul 22, 2014 11:01 am
Location: Northwestern University

Re: Calculated spectrum is 0 for narrow range

Post 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.

christiansen
User
Posts: 21
Joined: Thu Apr 08, 2021 7:38 am

Re: Calculated spectrum is 0 for narrow range

Post 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.

Stefan Stoll
EasySpin Creator
Posts: 1108
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Calculated spectrum is 0 for narrow range

Post 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.

Post Reply