Multifrequency fitting in multicomponent system

General forum for EasySpin: questions, how to's, etc.
Post Reply
skoutsoukos
Newbie
Posts: 5
Joined: Sun Oct 24, 2021 8:00 am

Multifrequency fitting in multicomponent system

Post by skoutsoukos »

Hello,

I was wondering if anybody has used esfit for multifrequency fitting in multicomponent systems (for CW spectra).
In order to be more specific, I have 2 components (let’s name them Sys1A and Sys1B). The way I currently set up the simulations is defining the system for X band like that:
Sys1A.Nucs = '14N, 1H';
Sys1B.Nucs = '14N';
.
.
.
(with all appropriate parameters for the simulation – g, lw, tcorr and weight)
And then for the Q band I define Sys2A and Sys2B, which are equal to their X-band analogues (apart from lw).

As far as I understand, for multifrequency esfit I practically need to add the spectra one next to each other in one vector and simulate them with one set of parameters for both frequencies (again, apart from lw – where I would set one lw.X and one lw.Q). However, I don’t understand how this could be done when I have 2 components in my system.

Has anybody managed to make this work, or is there another function that does this which I'm not aware of?

Thanks,
Spiros

katarkon
Local Expert
Posts: 186
Joined: Mon Jan 12, 2015 4:01 am

Re: Multifrequency fitting in multicomponent system

Post by katarkon »

You may use Sys.lw field to define both X and Q band linewidths
Sys.lw = [lwX lwX; lwQ lwQ] where [lwX lwX] are gaussian and lorentzian components for X band and [lwQ lwQ] for Q band.
During simulation just parse lw field
SysX=rmfield(Sys,'lw'); %X band
SysQ=SysX; %Qband
SysX.lw=Sys.lw(1,:); %extract lw
SysQ.lw=Sys.lw(2,:);
...
spcX=garlic(...,SysX,..); %simulation
spcQ=garlic(..,SysQ,...);
spc=[spcX spcQ]; %combine spectra

skoutsoukos
Newbie
Posts: 5
Joined: Sun Oct 24, 2021 8:00 am

Re: Multifrequency fitting in multicomponent system

Post by skoutsoukos »

Thanks for the reply. I am doing actually something very similar. I am saving initially all my parameters as Sys.gX1, Sys.gX2, Sys.Q1, Sys.Q2 etc and i have made a function which then picks the parameters it needs for each component and renames them to the corresponding Sys (so Sys.gX1 becomes SysX1.g etc).
I have managed saving all of my parameters under as one Sys. and one Exp. and it seems to work manually (plots the simulated combined spectra when I give it Sys and Exp), but when I put the function on esfit I get the error Too many input arguments.
That's why I asked whether somebody else has faced something similar.

katarkon
Local Expert
Posts: 186
Joined: Mon Jan 12, 2015 4:01 am

Re: Multifrequency fitting in multicomponent system

Post by katarkon »

Are you write your custom simulation function?

skoutsoukos
Newbie
Posts: 5
Joined: Sun Oct 24, 2021 8:00 am

Re: Multifrequency fitting in multicomponent system

Post by skoutsoukos »

Yes, I have modified the chili_multifreq script to include 2 components for each frequency.

katarkon
Local Expert
Posts: 186
Joined: Mon Jan 12, 2015 4:01 am

Re: Multifrequency fitting in multicomponent system

Post by katarkon »

Please give all of the scripts here.

skoutsoukos
Newbie
Posts: 5
Joined: Sun Oct 24, 2021 8:00 am

Re: Multifrequency fitting in multicomponent system

Post by skoutsoukos »

Here I attach the script and the function. I also attach the 2 model measurements I've been working on.
Thanks again for the help.

Last edited by skoutsoukos on Tue Oct 26, 2021 11:45 am, edited 1 time in total.
katarkon
Local Expert
Posts: 186
Joined: Mon Jan 12, 2015 4:01 am

Re: Multifrequency fitting in multicomponent system

Post by katarkon »

Try to rewrite your custom simulation function to accept three parameters (Sys,Exp,Opt) instead two ones (Sys,Exp). It should be compatible with esfit() function.

skoutsoukos
Newbie
Posts: 5
Joined: Sun Oct 24, 2021 8:00 am

Re: Multifrequency fitting in multicomponent system

Post by skoutsoukos »

You are right! Adding SimOpt.Verbocity=[] actually makes it work.
Thanks so much for that! :D

Post Reply