TPPM decoupling

Topics related to Spinach package
Post Reply
andrea_simion
Posts: 11
Joined: Sun Aug 15, 2021 9:42 pm

TPPM decoupling

Post by andrea_simion »

Hello,

I am a master's student in physics, and I started to learn Matlab and spinach to do spin dynamics simulations. I need some help. I want to obtain the 13C FID decay curve of L-alanine (i.e normalized intensity on the vertical axis and time on the horizontal axis of the graph) after different decoupling schemes. I started with TPPM decoupling. I write the code (see below), but there are some errors. I don’t know if the code it’s complete, or there are some things that I need to write and I didn’t do that, e.g I need to write the Liouvillian, or when I call spin_system=create(sys, inter); this is created automatically? And why I can't set the offset to zero?
I obtained the following errors:

Error using create>grumble (line 1214)
inter. zeeman.matrix cell array must have dimension 1 x nspins.

Error in create (line 54)
grumble(sys,inter);

Error in tppm_decoupling (line 72)
spin_system=create(sys,inter);

Error in run (line 91)
evalin('caller', strcat(script, ';'));

Code: Select all


% TPPM decoupling using Floquet theory 
% L-Alanine, one C and seven H atoms were considered for the simulation

function tppm_decoupling()

%**************************** The system *********************************

% Magnet field (in Tesla) for 500 MHz spectrometer
sys.magnet=11.74;

% Spinning frequency under MAS conditions: 20 KHz
parameters.rate=20000;
% rotor axis (MAS condition)
parameters.axis=[1 1 1];

% chennels: channel 1: 1H, channel 2: 13C
parameters.spins={'1H','13C'};
  
% nuclei/isotopes 
sys.isotopes={'13C','1H','1H','1H','1H','1H','1H','1H'};

% atomic_coords, i.e Cartesian coordinates of every spin (in Angstroms), 
% used to determine point dipolar interactions
inter.coordinates={[-3.153 1.989 -3.728];
                   [-3.4   3.047 -3.831];
                   [-4.104 0.083 -4.015];
                   [-5.146 1.294 -3.299];
                   [-4.76  1.363 -5.014];
                   [-1.743 0.731 -4.624];
                   [-2.442 1.836 -5.68];
                   [-1.3   2.363 -4.562]};

% Isotropic chemical shifts (in ppm)
inter.zeeman.scalar={0 0 -2.6 -2.6 -2.6 5.3 5.3 5.3};

% Full chemical shift tensor (in ppm)
inter.zeeman.matrix={[0 0 0; 0 0 0; 0 0 0];
                     [-3.64 0 0; 0 -1.56 0; 0 0 5.2];
                     [-0.44 0 0; 0 -9.16 0; 0 0 1.8];
                     [-5.42 0 0; 0 -4.48 0; 0 0 2.1];
                     [-4.64 0 0; 0 -4.23 0; 0 0 1.1];
                     [-1.34 0 0; 0 -1.46 0; 0 0 18.7];
                     [-5.02 0 0; 0 -1.58 0; 0 0 22.5];
                     [-2.68 0 0; 0 -1.23 0; 0 0 19.8]};

% Euler angles (degrees expressed in radians)
inter.zeeman.euler={[0          0           0];
                    [0          20*pi/180   10*pi/180];
                    [90*pi/180  80*pi/180   60*pi/180];
                    [120*pi/180 130*pi/180  50*pi/180];
                    [50*pi/180  72*pi/180   0];
                    [120*pi/180 230*pi/180  90*pi/180];
                    [60*pi/180  60*pi/180   0];
                    [30*pi/180  90*pi/180   120*pi/180]};

% Create basis set:

% Basis formalism: 'sphten−liouv' formalism, i.e spherical tensors in 
% Liouville space. It is the fastest algorithms that can use incomplete 
% basis sets and have polynomial complexity scaling 
bas.formalism='sphten-liouv';

% no approximations, i.e complete basis set
bas.approximation='none';

% Use all parts of the coupling tensors to build the spin interaction graph
bas.connectivity='full_tensors';

% Create spin system:

% Create spin system data structure 
spin_system=create(sys,inter);

% Add basis set information
spin_system=basis(spin_system,bas);

% Initial state: I_x operator on 1H channel
parameters.rho0=state(spin_system,'Lx','1H');

% Detection state: I^+ operator on 13C channel 
parameters.coil=state(spin_system,'L+','13C');

% *************************** Pulse sequence *****************************
% ************************** TPPM decoupling *****************************

% step 1: 1H rf irradiation, phase 0, 4 usec, 125 kHz

parameters.rf_pwr=[125 0];            % rf power in KHz
parameters.rf_dur=[4 4];              % rf application duration in us
phi_sequence=[0 0];                   % tppm phase sequence
parameters.offset=[0 0];              % transmitter offsets, Hz

% step 2: 1H rf irradiation, phase 15, 4 usec, 125 kHz

parameters.rf_pwr=[125 0];            % rf power in KHz
parameters.rf_dur=[4 4];              % rf application duration in us
phi_sequence=[15 0];                  % tppm phase sequence
parameters.offset=[0 0];              % transmitter offsets, Hz


% ********************** Variables and Plotting ***************************

% 1D experiment, just 13C spectra is recorded here
parameters.sweep= [0 25000];    % Sweep width in Hz
parameters.npoints=[0 512];     % Number of points of the output data array
parameters.zerofill=[0 0];
parameters.axis_units='time [usec]';

% Simulation
fid=floquet(spin_system,parameters.zerofill,'nmr');

% Apodization
fid=apodization(fid,'exp-1d',5);

% Plotting of 13C FID, i.e normalized intensity on vertical axis, and time
% (usec) on horizontal axis
plot_ 1d(spin_system,real(fid),parameters);

end
kuprov
Posts: 201
Joined: Mon Mar 29, 2021 4:26 pm

Re: TPPM decoupling

Post by kuprov »

The code is passing chemical shift tensors as a column (Nx1) array rather than a row (1xN) array. Thinking of it, that is probably unnecessarily restrictive; I'll remove this check in the next release. For now, replace semicolons in your inter.zeeman.matrix with ", ..." line breaks.
Post Reply