Unexpected behaviour of eigfields()

A place to report and discuss potential bugs
Post Reply
katarkon
Local Expert
Posts: 185
Joined: Mon Jan 12, 2015 4:01 am

Unexpected behaviour of eigfields()

Post by katarkon »

I found that Opt.Threshold parameters is ignored if output of intensities is not requested. Here the script illustrating the problem.

Code: Select all

clear;
Op.Threshold=0.001;
Exp.mwFreq=9.65;
Sys.g=gfree;
Sys.A=mt2mhz([10 20]/10);
Sys.Nucs='31P,31P';
[Pos,I]=eigfields(Sys,Exp,Op);
disp(Pos');
Pos=eigfields(Sys,Exp,Op);
disp(Pos');
The second problem concerns the order of output. The swaping or the nuclei order in the spin system have no effect on the output sequence, although spin hamiltonians are different. Here the script illustrating the problem.

Code: Select all

clear;
Op.Threshold=0.001;
Exp.mwFreq=9.65;
Sys.g=gfree;
Sys.A=mt2mhz([10 20]/10);
Sys.Nucs='31P,31P';
B0=344;
B=[0 0 B0]; %in mT
H=sham(Sys,B);
disp(H);
[Pos,I]=eigfields(Sys,Exp,Op);
disp(Pos');
Sys.A=mt2mhz([20 10]/10);
H=sham(Sys,B);
disp(H);
[Pos,I]=eigfields(Sys,Exp,Op);
disp(Pos');
UPD. It seems that MATLAB function eig() sorts its output according to increment of eigenvalues.
Stefan Stoll
EasySpin Creator
Posts: 1047
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Unexpected behaviour of eigfields()

Post by Stefan Stoll »

The first is an inconsistency in the interface, we will fix it in the next bug-fix release. Thanks for noting.

The second observation is correct. eigfields is agnostic about the particular ordering of spins (and the associated Zeeman basis functions) in the spin Hamiltonian. It calculates all resonance fields and returns them sorted by increasing value. Since the eigenfields approach is so general, there is no way of defining any other order that would be generally valid.
katarkon
Local Expert
Posts: 185
Joined: Mon Jan 12, 2015 4:01 am

Re: Unexpected behaviour of eigfields()

Post by katarkon »

Thanks. The similar problem was found for Opt.Threshold parameter in pepper function with hybrid method.If some nuclei are treated perturbationally, several transitions with zero intensities are kept in the output. Here the script illustrating the problem.

Code: Select all

clear
Sys.Nucs = '63Cu,14N';
Sys.S=[0.5 0.5];
Sys.g = [2.15; 2.0023];
Sys.A=mt2mhz([120 0;0 15]/10);
Sys.lwpp = [0 0.65];   
Sys.J=1000;
Exp.mwFreq = 9.65;     
Exp.Range = [300 360]; 
Opt.Method = 'hybrid';
Opt.Output='separate';
Opt.HybridCoreNuclei=[];
Opt.Threshold=0.1;
[x,y]=pepper(Sys,Exp,Opt);
stackplot(x,y,0,50);
y1=sum(cumsum(y,2),2); %estimate transition intensity
disp(y1');
katarkon
Local Expert
Posts: 185
Joined: Mon Jan 12, 2015 4:01 am

Re: Unexpected behaviour of eigfields()

Post by katarkon »

I don't completely shure, but the problem of the output ordering may be solved by using of qz and ordeig instead of eig. It's a topic of special study, of course.
UPD. It seems to be working. The computing of eigenvalues by qz-ordeig sequence really keeps their ordering according to initial spin hamiltonian. But it isn't so clear how to calculate the intesities by this way because ordeig does not return eigenvectors.
UPD2. The flag 'qz' for eig function probably makes the same. So simple changing of the [U,B]=eig(A,B) on the [U,B]=eig(A,B,'qz') should leads to ordered output of eigfields function. It still have to be tested, of course.
Stefan Stoll
EasySpin Creator
Posts: 1047
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Unexpected behaviour of eigfields()

Post by Stefan Stoll »

The issue with Opt.Threshold in eigfields is now fixed in ES 5.2.13.
Post Reply