Custom simulation function: fit single-crystal rotation
Posted: Fri Apr 22, 2016 3:12 pm
I am trying to better understand how to create custom simulation functions to invoke with esfit.
So far, I have understood that we can use custom functions to tie together parameters defined in Sys (e.g. J couplings, or hyperfine couplings) and to fit experimental parameters defined in Exp, such as the microwave phase (as described in the documentation).
However, what about entirely arbitrarily defined parameters. E.g. in single-crystal experiments, the rotation of the EPR tube αround the vertical axis is described by an angle that is neither in Sys, nor in Exp. It does enter in Exp.CrystalOrientation at some point, but can we fit just that angle? I have tried to follow the instructions which say: "put the parameter you want to fit into the first input structure (called Sys), even if it is not a spin system parameter".
I have set up the code as follows for a S = 3/2 system:
My fitrot function is:
However, upon launching the fit with only the two angles as variables, the rmsd is a flat line and there is no minimization.
How should I correct my custom function?
So far, I have understood that we can use custom functions to tie together parameters defined in Sys (e.g. J couplings, or hyperfine couplings) and to fit experimental parameters defined in Exp, such as the microwave phase (as described in the documentation).
However, what about entirely arbitrarily defined parameters. E.g. in single-crystal experiments, the rotation of the EPR tube αround the vertical axis is described by an angle that is neither in Sys, nor in Exp. It does enter in Exp.CrystalOrientation at some point, but can we fit just that angle? I have tried to follow the instructions which say: "put the parameter you want to fit into the first input structure (called Sys), even if it is not a spin system parameter".
I have set up the code as follows for a S = 3/2 system:
Code: Select all
cm=100*clight/1e6;
g = 2.18;
D32 = [0.105 0];
tilt = 14; % molecular axis tilt from the horizontal plane (in degrees)
rot = 150; % rotation of the crystal with respect to the magnetic field (in degrees)
w1 = 16; w2 = 10;
Sys1.S=3/2;
Sys1.g=g;
Sys1.D=D32*cm;
Sys1.tilt = tilt;
Sys1.rot = rot;
Sys1.lwpp=[w1 w2];
Exp.Temperature = 290; Exp.mwFreq=params.MF; Exp.CenterSweep=[params.HCF/10 params.HSW/10]; Exp.nPoints=2048;
Exp.CrystalSymmetry = 2; % space group P-1
Exp.MolFrame = [0 tilt 0]*pi/180; % molecular frame tilted towards the horizontal plane
cori0 = [0 0 0]*pi/180; % initial crystal orientation in lab frame
nRot_L = [1;0;0]; % rotation axis = x-axis of lab frame i.e. the EPR tube axis (as per ES frame definitions)
rho = rot*pi/180; % rotation angle (in radians)
cori = rotatecrystal(cori0,nRot_L,rho); % rotate crystal by rho around nRot
Exp.CrystalOrientation = cori; % final crystal orientation
Vary1.g = 0;
Vary1.D = [0 0]*cm;
Vary1.lwpp = [ 0 ];
Vary1.tilt = 2;
Vary1.rot = 4;
FitOpt.Method = 'simplex fcn'; FitOpt.Scaling = 'maxabs';
esfit('fitrot',spc,Sys1,Vary1,Exp,[],FitOpt);
Code: Select all
function y = fitrot(Sys1,Exp,Opt);
rot = 0;
tilt = 0;
Sys1.rot = rot;
Sys1.tilt = tilt;
[x,y] = pepper(Sys1,Exp,Opt);
return
How should I correct my custom function?