/*** ^^A -*-C++-*- **********************************************/ /* PMLG shapes 29.01.2002 */ /****************************************************************/ /* Short Description : */ /* Program to calculate shape file for */ /* phase modulated Lee-Goldburg sequences */ /****************************************************************/ /* Keywords : */ /* shaped pulse, FSLG */ /****************************************************************/ /* Description/Usage: */ /* Following the paper by E. Vinogradow, P.K. Madhu, */ /* and S. Vega Chem. Phys. Lett. 314, 443-450 (1999) */ /* Creates shape for FSLG sequence according to what the */ /* experiment needs */ /* One can chose the resolution - slices (parameter m) and */ /* the number of FSLG units x,x_bar */ /* or symmetric units (x, x_bar)*n; (x_bar, x)*n */ /* that should allow for most convenient custom design of */ /* the FSLG / PMLG shape for the planned experiment. */ /* */ /****************************************************************/ /* Author(s) : */ /* Name : Jochem Struppe */ /* Organisation : Bruker BioSpin GmbH */ /* Email : jochem.struppe@nmr.bruker-biospin.com */ /****************************************************************/ /* Name Date Modification: */ /* jos 010724 created */ /* jos 020129 revised */ /****************************************************************/ /* $Id: pmlg_shape,v 1.2 2006/12/12 14:43:07 hb Exp $ */ FILE *fwave; char outfile[256],outputfile[PATH_MAX],filename[PATH_MAX]; double omega, deltaalpha, start; double alpha, alpha_bar, alphatr, alphatr_bar; double x[32], x_bar[32], xtr[32], xtr_bar[32]; int ntimestr=0, ntimes, m, count, total,i, k, j, nlines; m=9; ntimes=4; count=2; GETINT("please enter the number of steps for one FSLG 294 degree pulse;",m) GETINT("please enter the number (e.g. 1 .. 4) of x,x_bar subcycles:", ntimes) i1=Proc_err(QUESTION_OPT, "do you want to use time reversed x_bar,x subcycles:?\n" "OK for yes, cancel for no"); if(i1==ERR_OK) ntimestr=ntimes; if(i1==ERR_CANCEL) ntimestr=0; nlines=2*m*(ntimes+ntimestr); Proc_err(INFO_OPT,"you have chosen %d steps and %d subcycles with total %d lines\n" "and %d full FSLG cycles", m, ntimes, nlines, ntimes+ntimestr); GETINT("please enter the number (x,x_bar)*n (x_bar,x)*n blocks:", count) /* read parameters for sweep calculation from file */ /* and store shaped pulse filename */ GETSTRING("Name for the shape file?",outfile) /* various calculations */ omega=207.8; deltaalpha=207.8/m; start=deltaalpha/2.0; total=(ntimes+ntimestr)*count; nlines=2*m*total; Proc_err(1,"nlines=%d",nlines); Proc_err(1,"total FSLG cycles=%d",total); if(nlines<1) { Proc_err(INFO_OPT, "no shape defined Zero lines!!\n ABORT!!!"); ABORT } if(nlines>12000) { Proc_err(INFO_OPT, "shape is too large >12000 lines!!\n ABORT!!!"); ABORT } for(i=1; i360.0) alpha=alpha-360.0; x[i]=alpha; if(alpha_bar<0.0) alpha_bar=alpha_bar+360.0; if(alpha_bar>360.0) alpha_bar=alpha_bar-360.0; x_bar[i] = alpha_bar; } for(i=1; i360.0) alphatr=alphatr-360.0; xtr[i]=alphatr; if(alphatr_bar<0.0) alphatr_bar=alphatr_bar+360.0; if(alphatr_bar>360.0) alphatr_bar=alphatr_bar-360.0; xtr_bar[i] = alphatr_bar; } /* open outputfile for shaped pulse */ if (getParfileDirForRead(outfile, SHAPE_DIRS, outputfile) < 0) { Proc_err(DEF_ERR_OPT, "%s: %s", outfile, outputfile); ABORT } (void)strcpy(filename,outputfile); if ((fwave=fopen(outputfile, "wt")) == 0 ) { Perror(DEF_ERR_OPT,outfile); ABORT } /* store amplitude values in shaped pulse file */ fprintf(fwave,"##TITLE= %s\n",filename); fprintf(fwave,"##USAGE= Vega shape with %d steps and %d xx_bar and %d x_barx cycles and %d total cycles \n",m,ntimes, ntimestr, total); fprintf(fwave,"##JCAMP-DX= 5.00 $$ Bruker JCAMP library\n"); fprintf(fwave,"##DATA TYPE= Shape Data\n"); fprintf(fwave,"##ORIGIN= Bruker BioSpin\n"); fprintf(fwave,"##DATE= 01/01/30\n"); fprintf(fwave,"##TIME= 08:15:00\n"); fprintf(fwave,"##MINX= -1.000000e+02\n"); fprintf(fwave,"##MAXX= 1.000000e+02\n"); fprintf(fwave,"##MINY= 0.000000e+00\n"); fprintf(fwave,"##MAXY= 0.000000e+00\n"); fprintf(fwave,"##$SHAPE_EXMODE= None\n"); fprintf(fwave,"##$SHAPE_TOTROT= 0.000000e+00\n"); fprintf(fwave,"##$SHAPE_BWFAC= 0.000000e+00\n"); fprintf(fwave,"##$SHAPE_INTEGFAC= 7.460936e-01\n"); fprintf(fwave,"##$SHAPE_MODE= 1\n"); fprintf(fwave,"##NPOINTS=%d\n",nlines); fprintf(fwave,"##XYPOINTS= (XY..YX)\n"); for(k=1; k