problems with saffron and orientation selection
Posted: Wed Oct 29, 2014 3:48 pm
Hello,
I want to do orientation selective HYSCORE simulations using saffron and actually it's two problems I'm encountering...
1)
The first one concerns the definition of atan2 in comparison to eulang. Below the text please find a set of parameters (first two sections) for an electron and a 2H nucleus, with g, A and direction cosines for each. Using both zyz and zxz convention I calculated the Euler angles with acos and atan2 and compared them to the values I got from Mathematica with the same calculations (note: arguments in ArcTan are in reverse order!).
For zyz I also compared them to the results of eulang.
Weird: For only one constellation I had to switch the arguments in Matlab's atan2 to match the control values: Hy_A_psi in zyz.
Is there something in the definitions of atan2 and eulang that can result in this different result? How can I make sure I don't have to check every matrix by hand?
2)
That's the actual saffron problem.
I want to reproduce some older simulations and don't know how EasySpin is internally processing g/A and gpa/Apa. Therefore I want to calculate the orientations via zxz convention on my own and hand over 3x3 g and A matrices to saffron.
But it doesn't not except full g or A matrices. The working example is also below, third section (all together it's an m-file...).
- Giving g and/or A in the form of [x, y, z] and gpa (Apa) as Euler angles, everything is fine.
- Changing g or A to a full 3x3 matrix and keeping gpa/Apa, I get the following error. That's fine, too.
"Error using saffron (line 252)
Full hyperfine matrices are specified in A, so Apa is not allowed!
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 76)
Error in JL_saffron_orient (line 85)
saffron(Sys,Exp,Opt)"
- But when I don't use gpa and Apa with the full matrices, I get:
"Error using *
Inner matrix dimensions must agree.
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 996)
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 76)
Error in JL_saffron_orient (line 85)
saffron(Sys,Exp,Opt)"
I checked the matrix dimensions, took a look on the homepage for the right format. It's 3x3 as indicated.
Please help
Specifications: EasySpin 4.5.5 with Matlab 2012b, IntelMac 10.8.5.
Thanks and kind regards,
Julia (FU Berlin)
Edit: Similar error occurs on up-to-date stable Debian, Matlab R2011a, Easyspin 4.5.5:
Error using ==> mtimes
Inner matrix dimensions must agree. [...]
I want to do orientation selective HYSCORE simulations using saffron and actually it's two problems I'm encountering...
1)
The first one concerns the definition of atan2 in comparison to eulang. Below the text please find a set of parameters (first two sections) for an electron and a 2H nucleus, with g, A and direction cosines for each. Using both zyz and zxz convention I calculated the Euler angles with acos and atan2 and compared them to the values I got from Mathematica with the same calculations (note: arguments in ArcTan are in reverse order!).
For zyz I also compared them to the results of eulang.
Weird: For only one constellation I had to switch the arguments in Matlab's atan2 to match the control values: Hy_A_psi in zyz.
Is there something in the definitions of atan2 and eulang that can result in this different result? How can I make sure I don't have to check every matrix by hand?
2)
That's the actual saffron problem.
I want to reproduce some older simulations and don't know how EasySpin is internally processing g/A and gpa/Apa. Therefore I want to calculate the orientations via zxz convention on my own and hand over 3x3 g and A matrices to saffron.
But it doesn't not except full g or A matrices. The working example is also below, third section (all together it's an m-file...).
- Giving g and/or A in the form of [x, y, z] and gpa (Apa) as Euler angles, everything is fine.
- Changing g or A to a full 3x3 matrix and keeping gpa/Apa, I get the following error. That's fine, too.
"Error using saffron (line 252)
Full hyperfine matrices are specified in A, so Apa is not allowed!
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 76)
Error in JL_saffron_orient (line 85)
saffron(Sys,Exp,Opt)"
- But when I don't use gpa and Apa with the full matrices, I get:
"Error using *
Inner matrix dimensions must agree.
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 996)
Error in /Users/.../easyspin-4.5.5/easyspin/saffron.p>saffron (line 76)
Error in JL_saffron_orient (line 85)
saffron(Sys,Exp,Opt)"
I checked the matrix dimensions, took a look on the homepage for the right format. It's 3x3 as indicated.
Please help
Specifications: EasySpin 4.5.5 with Matlab 2012b, IntelMac 10.8.5.
Thanks and kind regards,
Julia (FU Berlin)
Code: Select all
%matlab atan2(y,x) and mathematica arctan[x,y] order reversed!
%Ni, g-values and direction cosines
Ni_g = [2.197 2.139 2.015];
Ni_g_cos = [0.461 0.455 -0.762; -0.204 -0.781 -0.590; -0.864, 0.428, -0.267];
% Euler-angles by hand, zyz-convention, all fine
Ni_g_theta = acos(Ni_g_cos(3,3));
Ni_g_phi = atan2(Ni_g_cos(3,2), Ni_g_cos(3,1));
Ni_g_psi = atan2(Ni_g_cos(2,3), -Ni_g_cos(1,3));
Ni_g_eu = [Ni_g_phi, Ni_g_theta, Ni_g_psi];
Ni_g_eulang = eulang(Ni_g_cos);
% compare to Mathematica:
math_g_eu = [2.6817 1.8411 -0.6589];
% Hydride, hyperfine values and direction cosines
Hy_A = [18.4 -10.8 -18.0]/6.514;
Hy_A_cos = [-0.63 0.54 -0.55; 0.21 0.81 0.55; 0.74 0.23 -0.63];
% Euler-angles by hand, zyz-convention
Hy_A_theta = acos(Hy_A_cos(3,3));
Hy_A_phi = atan2(Hy_A_cos(3,2), Hy_A_cos(3,1));
Hy_A_psi = atan2(-Hy_A_cos(1,3), Hy_A_cos(2,3)); %%%% switched to be identical with eulang %%%%
Hy_A_eu = [Hy_A_phi, Hy_A_theta, Hy_A_psi];
Hy_A_eulang = eulang(Hy_A_cos);
% compare to Mathematica:
math_A_eu = [0.3013 2.2524 0.7854];
%% zxz-convention, all fine, nothing has to be exchanged
Ni_g_theta_x = acos(Ni_g_cos(3,3));
Ni_g_phi_x = atan2(Ni_g_cos(3,1), -Ni_g_cos(3,2));
Ni_g_psi_x = atan2(Ni_g_cos(1,3), Ni_g_cos(2,3));
Ni_g_eu_x = [Ni_g_phi_x, Ni_g_theta_x, Ni_g_psi_x]
% compare to Mathematica:
math_g_eu_x = [-2.03073 1.8411 -2.22966]
Hy_A_theta_x = acos(Hy_A_cos(3,3));
Hy_A_phi_x = atan2(Hy_A_cos(3,1), -Hy_A_cos(3,2));
Hy_A_psi_x = atan2(Hy_A_cos(1,3), Hy_A_cos(2,3));
Hy_A_eu_x = [Hy_A_phi_x, Hy_A_theta_x, Hy_A_psi_x]
% compare to Mathematica:
math_A_eu_x = [1.87214 2.2524 -0.785398]
%% Simulation HYSCORE
Exp.Sequence = 'HYSCORE';
Exp.dt = [0.024, 0.024]; %increment
Exp.Flip = [1 1 2 1];
Exp.Inc = [0 1 2 0];
Exp.tau = 0.20; %d_1
Exp.t1 = 0.2;
Exp.t2 = 0.3;
Exp.nPoints = 256;
Exp.Orientations = [];
Exp.mwFreq = 9.72; %EPR frequency in Ghz
Exp.ExciteWidth = 1000/16;
Exp.Field = 317.0;
Sys.S = 1/2;
Sys.Nucs = '2H';
Sys.Q = [0.03 .1];
Sys.g = Ni_g;
%Sys.g = diag(Ni_g); %%%% does not work %%%%
%Sys.g = [2.197 0 0; 0 2.139 0; 0 0 2.015]; %%%% neither %%%%
Sys.gpa = Ni_g_eu;
Sys.A = Hy_A;
%Sys.A = diag(Hy_A); %%%% does not work %%%%
%Sys.A = [18.4 0 0; 0 -10.8 0; 0 0 -18.0]/6.511; %%%% neither %%%%
Sys.Apa = Hy_A_eu;
Opt.nKnots = 50;
Opt.ZeroFillFactor = 2;
saffron(Sys,Exp,Opt)
Edit: Similar error occurs on up-to-date stable Debian, Matlab R2011a, Easyspin 4.5.5:
Error using ==> mtimes
Inner matrix dimensions must agree. [...]