Tie selected variables to a common value

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

Tie selected variables to a common value

Post by thanasis »

This is relevant to the more general post "Tie several variables to a common value", but in this case I would like to fix together only some of the total variables (i.e. considering a not so symmetric system).

E.g., following up from the special case of the model described in "Fitting of magnetic susceptibility data", I would like to tie together two J values and let the third one evolve independently:

Code: Select all

cm=100*clight/1e6;
Ja = -20;
Jb = -22;
gxy = 2;
gz = 2;
Sys1.S=[5/2 5/2 5/2];
Sys1.g=[gxy gz; gxy gz; gxy gz];
Sys1.ee = -2*cm*[Ja Ja Jb];
In that post I had successfully tied all three J's and g's together, but when the problem becomes less symmetrical I cannot simply invoke a fullSys.ee = [Sys1.ee; Sys1.ee; Sys1.ee]; declaration in my constrainJg external function to tie the J's together.

Is that possible to do?

Thanks in advance!
Stefan Stoll
EasySpin Creator
Posts: 1073
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Tie selected variables to a common value

Post by Stefan Stoll »

Define a Sys.Ja and a Sys.Jb, and then in your custom function set fullSys.ee = [Sys.Ja Sys.Ja Sys.Jb].
thanasis
Local Expert
Posts: 245
Joined: Thu Jan 21, 2016 6:28 am
Location: Strasbourg

Re: Tie selected variables to a common value

Post by thanasis »

Thanks for the suggestion!

What worked is:

Code: Select all

Ja = -20.6;
Jb = -27.1;
gxy = 2;
gz = 2;

Sys1.S=[5/2 5/2 5/2];
Sys1.g=[gxy gz; gxy gz; gxy gz];
Sys1.Ja = -2*cm*Ja;
Sys1.Jb = -2*cm*Jb;

Vary1.Ja = 10*cm;
Vary1.Jb = 10*cm;
Vary1.g = [0 0];

Exp.Field = 1000; Exp.Temperature = T;

% Fitting arguments
FitOpt.OutArg = [2 2];   % to fit the magnetic susceptibility chizz (second output)
FitOpt.Method = 'simplex fcn';
FitOpt.Scaling = 'none';
esfit('constrainJg_isosceles',chiSI,Sys1,Vary1,Exp,[],FitOpt);
using the constrain function:

Code: Select all

function [x,y] = constrainJg_isosceles(Sys1,Exp,Opt);
fullSys = Sys1;
fullSys.g = [Sys1.g];
fullSys.ee = [Sys1.Ja Sys1.Ja Sys1.Jb];
[x,y] = curry(fullSys,Exp,Opt);
return
That seems to have done the trick!
Stefan Stoll
EasySpin Creator
Posts: 1073
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Tie selected variables to a common value

Post by Stefan Stoll »

Great!
Post Reply