"Operands" error when using Exp.Ordering

General forum for EasySpin: questions, how to's, etc.
Post Reply
thanasis
Local Expert
Posts: 236
Joined: Thu Jan 21, 2016 6:28 am
Location: Strasbourg

"Operands" error when using Exp.Ordering

Post by thanasis »

Hello,

I am trying to use the Exp.Ordering parameter in ES 5.2.9 to fit a spectrum of two centers with dipolar and hyperfine interactions. The code works well until I include Exp.Ordering, at which time I get the error:
Operands to the || and && operators must be convertible to logical scalar values.
Error in pepper (line 450)
Error in pepper (line 159)
Error in constraingdip_exact (line 21)
[x,y] = pepper(fullSys,Exp,Opt);
Error in esfit>assess (line 831)
Error in esfit_simplex (line 77)
Error in esfit>runFitting (line 677)
Error while evaluating UIControl Callback
My code is:

Code: Select all

clear all;
close all;
cm=100*clight/1e6;
[B,spc,params] = eprload('PhCOO1.spc');

ACuxy=0; ACuz=270; %Aperp and Apar for Cu in MHz
r = 4.5; % Distance in Angstrom
eta = 0*pi/180; % eta angle
xi = 0*pi/180; % xi angle

Sys1.S = [1/2 1/2];
Sys1.g=[1.6 2.3; 1.6 2.3];
Sys1.Nucs = '63Cu,63Cu';
Sys1.A = [ACuxy ACuz 0 0; 0 0 ACuxy ACuz];
Sys1.gStrain = [0.02 0; 0.02 0];
Sys1.r = r;
Sys1.eta = eta;
Sys1.xi = xi;
Sys1.lwpp=[0 4];

Exp.Temperature = 4.6; Exp.mwFreq=params.MF; Exp.CenterSweep=[params.HCF/10 params.HSW/10]; Exp.nPoints=params.RES;
Exp.Ordering = +1;

Vary1.g = [0.0 0.1];
Vary1.gStrain = [0.01 0.00]; % Axial system
Vary1.A = [0 50];
Vary1.r = 0.1;
Vary1.eta = 0*pi/180;
Vary1.xi = 0*pi/180;
Vary1.lwpp = [0 0];

FitOpt.Method = 'simplex fcn';
FitOpt.Scaling = 'lsq1';
esfit('constrain',spc,Sys1,Vary1,Exp,[],FitOpt);
And my function is:

Code: Select all

function [x,y] = constrain(Sys1,Exp,Opt)
gx = Sys1.g(1,1); gy = Sys1.g(1,1); gz = Sys1.g(1,2);
Jxx = gx^2*(1-3*sin(Sys1.eta)^2*sin(Sys1.xi)^2);
Jyy = gy^2*(1-3*cos(Sys1.eta)^2*sin(Sys1.xi)^2);
Jzz = gz^2*(1-3*cos(Sys1.xi)^2);
Jxy = -3*gx*gy*sin(Sys1.xi)^2*sin(Sys1.eta)*cos(Sys1.eta);
Jxz = -3*gx*gz*sin(Sys1.xi)*cos(Sys1.xi)*sin(Sys1.eta);
Jyz = -3*gy*gz*sin(Sys1.xi)*cos(Sys1.xi)*cos(Sys1.eta);
fullSys = Sys1;
fullSys.g = [Sys1.g];
fullSys.gStrain = [Sys1.gStrain(1,1) Sys1.gStrain(1,2); Sys1.gStrain(1,1) Sys1.gStrain(1,2)];
fullSys.A = [Sys1.A];
fulSys.Nucs = '63Cu,63Cu';
fullSys.ee = 12993*Sys1.r^-3*[Jxx Jxy Jxz; Jxy Jyy Jyz; Jxz Jyz Jzz];
[x,y] = pepper(fullSys,Exp,Opt);
return
Thanks for the help!
Last edited by thanasis on Tue Nov 14, 2017 5:27 pm, edited 1 time in total.
thanasis
Local Expert
Posts: 236
Joined: Thu Jan 21, 2016 6:28 am
Location: Strasbourg

Re: "Operands" error when using Exp.Ordering

Post by thanasis »

And here is the spectrum files
Attachments
PhCOO1.zip
(9.27 KiB) Downloaded 195 times
Stefan Stoll
EasySpin Creator
Posts: 1041
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: "Operands" error when using Exp.Ordering

Post by Stefan Stoll »

This is a bug, thanks for reporting. We will fix it.

Even after fixing, however, this won't work, since EasySpin currently does not support strains and ordering at the same time.
thanasis
Local Expert
Posts: 236
Joined: Thu Jan 21, 2016 6:28 am
Location: Strasbourg

Re: "Operands" error when using Exp.Ordering

Post by thanasis »

Thanks Stefan!

No problem, I will try it out without the strains when the bug is fixed.

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

Re: "Operands" error when using Exp.Ordering

Post by Stefan Stoll »

Fixed in 5.2.10.
Post Reply