Difference between resfields and eigfields

General forum for EasySpin: questions, how to's, etc.
Post Reply
Dmitry
Newbie
Posts: 4
Joined: Fri Feb 04, 2022 12:54 am

Difference between resfields and eigfields

Post by Dmitry »

Dear,

Could you explain me a difference between subject function? The problem is that they produce "slightly" different result. Whereas eigfields works perfect for me, resfields for a simple spin 1/2 give spatial distribution in the resonance fields in the crystal orientation experiments. Perhaps this question were cleared up already, then I am sorry for the repetition. For me both cases should be identical. m-file is attached. Thank you in advance,

Dmitry
PS: version 5.2.13

Attachments
TestSystem.m
(2.07 KiB) Downloaded 228 times
Stefan Stoll
EasySpin Creator
Posts: 1050
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Difference between resfields and eigfields

Post by Stefan Stoll »

The two functions use different algorithms to calculate the resonance fields. resfields is a lot faster and very reliable in 99% of cases. eigfields uses a very expensive method, but works generally.

Besides this, another difference is that the order of the returned transitions might differ between the two functions.

For a S=1/2 with a rhombic g, my expectation is that both methods work equally well.

Dmitry
Newbie
Posts: 4
Joined: Fri Feb 04, 2022 12:54 am

Re: Difference between resfields and eigfields

Post by Dmitry »

I also expected them to be similar. However the result of the program above mentioned is attached and it looks weird. It seems I cannot attach picture here (html error).

derdemand
Newbie
Posts: 1
Joined: Mon Feb 07, 2022 2:43 am

Re: Difference between resfields and eigfields

Post by derdemand »

Indeed..
This seems very weird angle dependence for S=1/2

Screenshot_9.png
Screenshot_9.png (19.55 KiB) Viewed 3782 times

Maybe something wrong in Dmitry's .m file.
However I didn't find any mistakes up to now.

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

Re: Difference between resfields and eigfields

Post by Matt Krzyaniak »

Here is a pared down script.

Code: Select all

clear

Exp.mwFreq=9.46;
%Exp.Temperature=4.2;
Exp.CrystalSymmetry='C1';
Exp.Range = [0 1000];

Sys.S=1/2;
Sys.g=[8.2819 8.3053 3.3640];
Sys.gFrame=[   45.03    54.55    -4.47]/180*pi;

phi = (0:5:180)*pi/180;
Tilt = [  -89.64    45.07   -90.65]/180*pi -pi;

for i=1:length(phi)
  Exp.CrystalOrientation = [phi(i),pi/2,0];
  Exp.CrystalOrientation=eulang(erot(Exp.CrystalOrientation)*erot(Tilt(1),Tilt(2),Tilt(3)));
  [Br(i), Ir(i)]=resfields(Sys,Exp);
  [Be(i), Ie(i)]=eigfields(Sys,Exp);
end
subplot(2,1,1)
plot(phi,Br,'.',phi,Be,'o')
xlabel('phi /rad')
ylabel('field /mT')
subplot(2,1,2)
plot(phi,Ir,'.',phi,Ie,'o')
xlabel('phi /rad')
ylabel('intensity /a.u.')
legend('resfields','eigfields')

Your problem is arising from your post processing and sorting with respect to the intensity. eigfields does not take into account the temperature(or other polarization mechanisms) like resfields, and as a result the intensities don't match between the two algorithms. Your discrepancies are likely from (in your script) lines 85-91 not behaving the same.

eigfields isn't really utilized so there hasn't been an effort to provide feedback about improper or unused inputs.

Dmitry
Newbie
Posts: 4
Joined: Fri Feb 04, 2022 12:54 am

Re: Difference between resfields and eigfields

Post by Dmitry »

The problem is not from post processing. First, for spin 1/2 there is no problem with selection rules. Second, in my version Opt.Trsh=0, therefore all the possible transition with intensities above 0 should be taken into account. If you replace eigfields/resfields parts of my program with the next one:

[B Int]=eigfields(Sys,Exp,Opt);
fprintf('%5.1f ',B);
[B Int]=resfields(Sys,Exp,Opt);
fprintf('%5.1f\n',B);

You will get something like this:

96.0 96.0
95.9 96.2
95.6 98.8
94.9 94.9
94.1 93.4
93.1 97.1
91.9 92.1
90.7 97.0
89.4 89.4
88.1 88.1
86.9 86.9
85.7 85.7
84.7 94.1
83.8 88.8
83.0 82.6
82.4 83.2
81.9 81.8
81.7 81.7
81.5 81.5
81.6 83.0
81.8 88.6
82.2 82.2
82.8 82.8
83.5 76.9
84.4 84.4
85.4 89.1
86.5 95.0
87.7 94.5
89.0 89.0
90.2 95.0
91.5 91.5
92.7 92.7
93.8 93.8
94.7 94.7
95.4 95.4
95.8 102.8
96.0 96.0

which is already weird. Moreover to omit all the possible problems with probabilities/orientations etc., if you use g=[2 2 2], you will obtain complete rubbish in the results:

337.9 337.4
337.9 343.0
337.9 341.4
337.9 337.9
337.9 343.8
337.9 337.9
337.9 337.9
337.9 337.9
337.9 340.7
337.9 337.9
337.9 326.2
337.9 340.4
337.9 337.9
337.9 337.9
337.9 337.9
337.9 337.9
337.9 337.9
337.9 339.2
337.9 337.9
337.9 342.3
337.9 339.2
337.9 339.2
337.9 337.9
337.9 337.9
337.9 337.6
337.9 337.9
337.9 337.9
337.9 337.9
337.9 340.2
337.9 337.9
337.9 337.9
337.9 337.9
337.9 345.6
337.9 337.9
337.9 337.9
337.9 340.9
337.9 337.9

Interesting, that resfields_perturb return perfect results until you try to use symmetry related centres, then it crushes with "reshape" problem:

Error using reshape
To RESHAPE the number of elements must not change.

Error in resfields_perturb

Error in TestSystem>eprsf0 (line 86)
[B Int]=resfields_perturb(Sys,Exp,Opt);

Anyway, I think the problem is not in the plane you suggested, however I did not find where up to now.

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

Re: Difference between resfields and eigfields

Post by Matt Krzyaniak »

OK I went back and looked at things, yes my initial thought was wrong. It actually turns out that this is an interpolation problem, namely your range is just way too large for the number of points.

It is easy enough to see in the minimal script that I included, take the max range from 103 -> 105 and resfields agrees with eigfields, increase to 106 a couple points stop matching, 107 a few more, and it just gets worse.

A related post viewtopic.php?f=3&t=712

Dmitry
Newbie
Posts: 4
Joined: Fri Feb 04, 2022 12:54 am

Re: Difference between resfields and eigfields

Post by Dmitry »

Thanks! That thing works!

Post Reply