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, 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.
  1. 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:
    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
    This division is done internaly and automatically within vs_evolve.m.

  2. 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
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_loadShapevs_main vs_paths

You can access them from the Matlab shell by typing their name. Some of these variables are described below: :

Back to top

Last updated 11/29/2002.