Page 1 of 1

Applying additional constraints in esfit

Posted: Mon Mar 30, 2015 1:51 am
by AlexTaguchi
Hi,

I'm trying to simulate a CW biradical spectrum, and I'd like to be able to have a constraint so that the g-values of the two radicals are kept the same (although I still want to have EasySpin optimize the g-values). How would you do this?

Thanks,
Alex
(MatlabR2014b, EasySpin4.5.5, Windows7Pro)

Re: Applying additional constraints in esfit

Posted: Mon Mar 30, 2015 11:30 am
by Stefan Stoll
Alex,
that's quite simple: Create your own simulation function, say mysim.m that defines a function with the same syntax as all the ES simulation functions:

Code: Select all

function [x,y] = mysim(Sys,Exp,Opt)
% Here comes your code
In the body of the function, do whatever you need to do to constrain the values, then call the ES simulation function, and return the simulated spectrum.

All that remains is to call esfit with your custom simulation function:

Code: Select all

esfit('mysim',data,Sys,Sys0,Vary,Opt)

Re: Applying additional constraints in esfit

Posted: Wed Apr 01, 2015 9:30 am
by yvesjour
Actually I have the same problem with hyperfine constants of Copper ions in a dinuclear complex. I want to simulate the triplet spectrum of this complex and
I want to have identical A values for the two copper ions during the fitting procedure.

Unfortunately I really do not understand your answer. I must confess that I started to use easyspin last week and I never use MatLab before.

Do you mind to give more details about the solution you proposed to solve the problem

many thanks

Yves

Sys.  Nucs = ‘Cu,  Cu';
Sys. A = [30 245 ; 30 245] ;
Sys. S  = 1 ;
Sys. g = [2.0238 2.0815 2.2956] ;
Sys.  HStrain = [217 344 250] ;
Exp.  Range = [250 450] ;
Exp.  mwFreq = 9.47508 ;
SimOpt.  nKnots = 25 ;
SimOpt.  Method = 'perturb’;

Vary. A  = [0 100 ; 0 100] ;
Vary.  HStrain = [0 0 50] ;

FitOpt.  Method = 'simplex fcn';
FitOpt. Scaling = 'maxabs’; % scaling so that the maximum absolute values coincide

esfit(‘pepper’,spc  ,Sys ,Var y,Exp ,Sim Opt,Fit Opt);

Re: Applying additional constraints in esfit

Posted: Wed Apr 01, 2015 4:02 pm
by Stefan Stoll
Here is how you should write the function for your case:

Code: Select all

function [x,y] = simCuCu(Sys,Exp,SimOpt)
Sys.A = [Sys.ACuCu; Sys.ACuCu];
[x,y] = pepper(Sys,Exp,SimOpt);
The call esfit in the following way:

Code: Select all

Sys.Nucs = 'Cu,Cu';
Sys.ACuCu = [30 245];
Sys.S = 1;
Sys.g = [2.0238 2.0815 2.2956];
Sys.HStrain = [217 344 250];
Exp.Range = [250 450];
Exp.mwFreq = 9.47508;
simOpt.nKnots = 35;
simOpt.Method = 'perturb';

Vary.ACuCu = [0 100];
Vary.HStrain = [0 0 50];

fitOpt.Method = 'simplex';
fitOpt.Scaling = 'maxabs';

esfit('simCuCu',ydata,Sys,Vary,Exp,simOpt,fitOpt)

Re: Applying additional constraints in esfit

Posted: Thu Apr 02, 2015 8:11 am
by yvesjour
Dear Colleague

Thank you very much for your rapid answer and your explanations.

I am very busy today and I will try your suggestions probably next week.

By the way, easy spin is just great and a lot better than the other software I used before. I am very grateful to you for this major contribution to the EPR community

Re: Applying additional constraints in esfit

Posted: Thu Apr 16, 2015 9:59 pm
by AlexTaguchi
I too would like to thank you for your help. I still haven't gotten around to actually implementing it, but it makes sense.