It seems I found the reason of the problem. It looks that

`garlic`

handles every set of equivalent nuclei indepedently like only one group is present in spin system. So equivalent sets give equal splitting. In such manner the system with only one large constant will be processed correctly.

I suggest that correction of g-factor before each processing should solve the problem.

Briefly the idea is follow. The processing of first set of nuclei gives a set of resonance fields. Each resonance should be converted to g-factor and used for processing of second set of nuclei (each calculated g-factor substitutes initial one). Concatenation of the results should give a set of resonance fields for two group of the nuclei. Third and follows groups may be handled with the same manner.

I still vaguely imagine how to release this idean in the algorythm optimally but I can try if necessary.

Draft demonstrator of the idea.

- Code: Select all
`Sys.g = 2;`

Sys.Nucs = '1H,1H';

Sys.n = [1 1];

Sys.lw = 1;

Sys.A = [880 880];

Exp.mwFreq = 9.5;

Exp.Range=[300 380];

Opt.PerturbOrder=2;

%beginning

gList=Sys.g; %starting value

nNucs=numel(Sys.A); %number of set of the nuclei

Nucs=nucstring2list(Sys.Nucs); %list of nuclei

convConst=Exp.mwFreq*1e12*planck/bmagn; %field to g conversion factor

%beginning iterative calculation

for i=1:nNucs

B=[]; %starting resonance fields list

Sys1.A=Sys.A(i);

Sys1.Nucs=Nucs{i};

%Sys1.n=Sys.n(i); %may be used in future

for j=1:numel(gList)

Sys1.g=gList(j);

B1=resfields_perturb(Sys1,Exp,Opt); %breit-rabi solver should be used here

B1=B1';

B=[B B1];

end

gList=convConst*ones(1,numel(B))./B; %field to g conversion

end

%display results

disp(B);

UPD.

Unfortunately the idea looks unworking. I don't completely understand why.

- Code: Select all
`clear`

Sys.g = 2;

Sys.Nucs = '31P';

Sys.n = [2];

Sys.lw = 1;

Sys.A = [880];

Exp.mwFreq = 9.5;

Exp.Range=[300 380];

[x,y]=garlic(Sys,Exp);

convConst=Exp.mwFreq*1e12*planck/bmagn;

Sys.n=1;

B=resfields(Sys,Exp)';

gList=convConst*ones(1,numel(B))./B

Sys1.g=gList(1);

Sys1.Nucs = '31P';

Sys1.n = [1];

Sys1.lw = 1;

Sys1.A = [880];

Vary1.A=80;

Vary1.g=0.1;

Sys2.g=gList(2);

Sys2.Nucs = '31P';

Sys2.n = [1];

Sys2.lw = 1;

Sys2.A = [880];

Vary2.g=0.1;

Vary2.A=80;

FitOpt.Method = 'simplex fcn';

FitOpt.Scaling = 'maxabs';

esfit('garlic',y,{Sys1,Sys2},{Vary1,Vary2},Exp,[],FitOpt);