Page 1 of 1
Difference between resfields and eigfields
Posted: Fri Feb 04, 2022 1:02 am
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
Re: Difference between resfields and eigfields
Posted: Fri Feb 04, 2022 4:26 pm
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.
Re: Difference between resfields and eigfields
Posted: Sun Feb 06, 2022 10:41 pm
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).
Re: Difference between resfields and eigfields
Posted: Mon Feb 07, 2022 2:53 am
by derdemand
Indeed..
This seems very weird angle dependence for S=1/2
- Screenshot_9.png (19.55 KiB) Viewed 6905 times
Maybe something wrong in Dmitry's .m file.
However I didn't find any mistakes up to now.
Re: Difference between resfields and eigfields
Posted: Mon Feb 07, 2022 9:12 am
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.
Re: Difference between resfields and eigfields
Posted: Mon Feb 07, 2022 10:38 pm
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.
Re: Difference between resfields and eigfields
Posted: Tue Feb 08, 2022 10:58 am
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
Re: Difference between resfields and eigfields
Posted: Tue Feb 08, 2022 11:53 pm
by Dmitry
Thanks! That thing works!