Main Functions and Variables
--------------- for curious minds -----------------
This is a brief description of the main functions and variables
used in the Virtual NMR Spectrometer, ver. 3.0 (alpha). The simulation algorithms are
described in detail in our JMR paper.
When you click on the xlate-button, the Translator is activated.
It reads the pulse sequence you selected and creates the following
two files: vs_mainsim.m and vs_init.m.
If you followed the instructions for default settings,
these files should be in your VS/xlatedir folder.
These automatically generated files are rewritten every time you click on xlate.
These files are also automatically deleted when you exit VNMR by clicking
on the EXIT button. Make sure these files are not marked as read-only (Windows) and you
have the write-permission (Unix/Linux) in this folder.
As might be clear from their names,
- vs_init.m contains commands to initialize all parameters necessary to
execute the pulse sequence;
- vs_mainsim.m contains the actual translation of the pulse sequence
into a sequence of matlab functions that simulate NMR experiment.
Let's take a closer look at some of the matlab functions we've written
for VNMR.
If you look at the vs_mainsim.m file created when you translate
your pulse sequence (e.g. cosysh) into matlab code, you will
notice that there are two basic commands used to simulate the
course of NMR experiment:
vs_evolve.m and vs_acquire.m.
These functions represent two major events during NMR experiments:
spin system evolution (including preparation) and data acquisition.
The rest is just a bunch of logical statements and setting/resetting
of various flags and simulation and pulse sequence parameters. Here
is a brief description of these two functions.
- EVOLUTION. Function: vs_evolve.m (also vs_chop.m)
Since all events are considered in the rotating frame, there is
no formal difference between a time delay and a RF pulse: both are
treated as evolution of the spin system happening in the absence (delay)
or in the presence (pulse) of the transverse field, B1.
Evolution of the spin system is simulated using function
vs_evolve.m (type help vs_evolve or look at the header of this function
using Matlab editor or any other text editor).
During the evolution, relaxation/cross-relaxation effects are included
as described in our JMR paper (I will probably have to give you a more
detailed explanation next time).
In the following cases vs_evolve.m is substituted with vs_chop.m in
vs_mainsim.m:
- there is an overlap of the pulses applied simultaneously on
different channels (e.g. simultaneous 1H and 15N pulses in HSQC);
- a shaped RF pulse is applied;
- a pulsed field gradient (automatically considered to be shaped)
is present.
Translator recognizes these cases automatically.
The vs_chop.m function divides the time duration of the considered
pulse(s) into smaller pieces so that during each small time period the
system evolves under a constant Hamiltonian (for a shaped pulse or a
PFG the interval will be the step size of the envelope function).
Evolution during each of these intervals is then simulated using
vs_evolve.m.
In addtion, vs_evolve.m will automatically divide the duration
of the time interval into smaller pieces if
- 'smaller integration step' is checked out in the 'simulation
params' window; or
- the duration of the interval is greater than 1/(8*max{J}),
where max{J} is the largest scalar coupling component in the system.
This division is done internaly and automatically within vs_evolve.m.
- ACQUISITION. Function vs_acquire.m
This function divides the total duration of the acqusition period
into td2 fixed equal intervals (of duration dw) and for each
interval
- 'acquires' the signal (using the quadrature-detection
principle) according to the selected receiver phase at the
beginning of the interval and stores the result in the storage
buffer; and then
- simulates evolution of the spin system during this interval
(similar treatment to vs_evolve.m).
All important control parameters and the results of calculations are stored as structures that are
also global variables.
These are:
vs_dataProc | vs_expSetup | vs_load |
vs_loadShape | vs_main | vs_paths |
vs_progParam | vs_relCalc | vs_runCalc |
vs_save | vs_saveShape | vs_shapeGeg |
vs_simParam | vs_spinSetup | |
You can access them from the Matlab shell by typing their name. Some of these variables are described below: :
vs_runCalc.s -- is a structure comprising most parameters related to the actual
simulation, including (most important!):
- vs_runCalc.s.d -- the spin-density matrix;
- vs_runCalc.s.rlx -- relaxation rates matrices (vs_runCalc.s.rlx.R1 for 1/T1 and
vs_runCalc.s.rlx.R2 for 1/T2);
- vs_runCalc.s.Ho -- spin system Hamiltonian (matrix) in the absence of
B1 and at zero gradient;
- vs_runCalc.s.Hg -- addition to the Hamiltonian due to field gradient,
for multiple-position treatment of gradients
(it is a set of matrices, each for a particular layer
in the sample)
- vs_runCalc.s.Z -- matrices corresponding to Sz spin operator for each
spin (e.g. vs_runCalc.s.Z{1}, vs_runCalc.s.Z{2} for a 2-spin system)
- vs_runCalc.s.z -- a total Sz matrix (sum of all Sz's)
- vs_runCalc.s.X, vs_runCalc.s.Y, vs_runCalc.s.x, vs_runCalc.s.y --
similar matrices for Sx and Sy
- vs_runCalc.ser0 -- experimental (acquired) data set. It is a matrix of the size of
tdaq x tdin, where the number of acquisition points (tdaq) and the
number of points in the t1 dimension (tdin) are set in the
Program Parameters Window. The default values
of these parameters are tdaq = td2 = vs_expSetup.td2Value
and tdin = td1 = vs_expSetup.td1Value;
- vs_runCalc.spe -- processed data set;
- vs_runCalc.spf2 -- interferogram: the result of Fourier-transformation in t2-dimension only;
- vs_runCalc.pj -- a structure containing projections of the spin density matrix to be
displayed in the Projections Display Window.
Type "vs_runCalc.pj" when in the Matlab window and see.
vs_expSetup -- a structure containing all experimental-setup related params,
including channel selection,
calibration pulses, gradient strength, etc. I do not go into much
details here hoping that the file-names (e.g. vs_expSetup.nucSelection,
vs_expSetup.p90selection, etc.) are self-explanatory -- just type
'vs_expSetup' when in the Matlab window and see;
vs_spinSetup -- a structure containing all setting for the spin system: type of nucleus, chemical shifts,
relaxation rates, spin couplings etc.
BACK TO VNMR MANUAL
Back to top
Last updated 11/29/2002.