Skip to content

FRIDA scripting

Scripts Library

The use of this scripts is at your own risk. Please DO CHECK if they fit to your problem!!!
To run a script in FRIDA1, you just have to type:

\i name_of_script

The script must have a *.ml extension. Here are some scripts. To use them just make “copy-paste” in any editor, and run them. The explanations of the scripts are minimal, and if you want a deeper explanation you should have a look at the tutorial. The scripts are to be modified depending on from which point of the data analysis you start, therfore are not intended as “plug and play” receipts!!!. The following scripts are available:

  • Program to generate scripts to read T ramps

    script for read

    Be aware that if you run the script two (or more) times the script will crash because the prgroma will ask “overwrite file?”, and the script is writen only to create new files. You can, of course, add the “y” at the correct places...
    rtof
    0
    0
    13810-13813
    13912-13915
    13930-13933
    -
    y
    0
    y
    y
    4
    1000
    0.99
    n
    1-3
    transT220L6
    T=220K l=6A
    3
    -
    fs
    transT220L6
    rtof
    0
    0
    13814-13817
    y
    transT230L6
    T=230K l=6A
    -
    fs
    transT230L6
    rtof
    0
    0
    13818-13821
    y
    transT240L6
    T=240 l=6A
    -
    fs
    transT240L6
    rtof
    0
    0
    13822-13825
    y
    transT250L6
    T=250K l=6A
    -
    fs
    transT250L6
    -

    The last lines are to be repeated for every sample. Note that if you change your vanadium or empty can that is not valid any more!!

    script for diffractogram

    It will read the data after being corrected, that is to say, from the former script, and will add all the channels to calculate the diffractograms. It will delete the not needed files... Be carefull if you want to add more files. Fdel must beincreased one unit per loaded file. You must also check the number of channels you have, and your wavelength: then number 2.094395 is calculated for lambda=6A.
    fl transT220L6
    mca
    y
    1-598i598
    msx
    y
    ox * ec
    0.008726646
    #
    #
    ox sin y
    ox * ec
    2.094395
    #
    #
    fs
    SQT220L6
    1-5 fdel
    fl transT230L6
    mca
    y
    1-598i598
    msx
    y
    ox * ec
    0.008726646
    #
    #
    ox sin y
    ox * ec
    2.094395
    #
    #
    fs
    SQT230L6
    2-6 fdel
    fl transT240L6
    mca
    y
    1-598i598
    msx
    y
    ox * ec
    0.008726646
    #
    #
    ox sin y
    ox * ec
    2.094395
    #
    #
    fs
    SQT240L6
    3-7 fdel
    fl transT250L6
    mca
    y
    1-598i598
    msx
    y
    ox * ec
    0.008726646
    #
    #
    ox sin y
    ox * ec
    2.094395
    #
    #
    fs
    SQT250L6
    4-8 fdel
    fl transT260L6
    mca
    y
    1-598i598
    msx
    y
    ox * ec
    0.008726646
    #
    #
    ox sin y
    ox * ec
    2.094395
    #
    #
    fs
    SQT260L6
    5-9 fdel
    .
    .
    .

    script for S(q,w)

    Before using it you must check your q and energy range. The S(q,w) is calculated for increment of q and w =(0.1,0.02)

    fl transT220L2
    _coq
    1
    -1.3
    0.02
    200
    1
    0
    0.1
    2
    30
    0.05
    7
    fs
    SQWtransT220L2
    1 fdel
    fl transT230L2
    _coq
    1
    -1.3
    0.02
    200
    1
    0
    0.1
    2
    30
    0.05
    7
    fs
    SQWtransT230L2
    2 fdel

    script for temperature ramps

    To run the program you need the code, that must be compiled (is F77 fortran), and a control file, which is after the program. I think the control file is autoexplicative... The program will generate the following scripts:

    • read.ml to read, and perform van and empty can corrections on data
    • sq.ml, and readsq.ml to calculate and afterwards read S(q)
    • sqw.ml, to calculate s(q,w) (up to now the names of scripts are conterintuitive, I know!)
    • int.ml, will colapse the spectra in one point

    Two last things:

    • The names of sq, sqw and so on will be taht of the dirst numor converted. Therefore if you choose to convert from 100 to 200 grouping every 4 numors, the program will generate sq100.i96, sq104.i96, sq108.i96 and so on, but don’t get confused: the numors are of the four grouped numors!!!
    • Be aware that if you run the script two (or more) times the script will crash because the prgroma will ask “overwrite file?”, and the script is writen only to create new files. You can, of course, add the “y” at the correct places... therefore if you want to rerun the script you MUST delete the old files!

      delete the old files!
             implicit none
             character*20 nomout
             integer i,nini,nfin,njump,vanini,vanfin,dumi
             integer bgini,bgfin
             real qini,qfin,qstep,eini,efin,estep,lambda,pi
             real thetamax,Tvan
      
             pi=3.141592654 
      
             open(unit=1,file='control.con')
             read(1,*) nini,nfin,njump
             write(6,*) 'Numor:ini,fin,step: ',nini,nfin,njump
             read(1,*) vanini,vanfin
             write(6,*) 'van runs: ',vanini,vanfin
             read(1,*) bgini,bgfin
             write(6,*) 'Empty Can runs: ',bgini,bgfin
             read(1,*) qini,qfin,qstep
             write(6,*) 'Q: ini,fin,step: ',qini,qfin,qstep
             read(1,*) eini,efin,estep
             write(6,*) 'E: ini,fin,step: ',eini,efin,estep
             read(1,*) thetamax
             write(6,*)'thetamax for sq: ',thetamax
             read(1,*) lambda
             write(6,*) 'lambda: ',lambda
             read(1,*) Tvan
             write(6,*) 'lambda: ',Tvan
      
      
      !       write(6,*)'first, last and jump numor'
      !       read(5,*) nini,nfin,njump
      !       write(6,*)'vanadium first and last'
      !       read(5,*) vanini,vanfin
      ! this part reads and makes the calibration by vanadium and substracts the empty can
             open(unit=1,file='read.ml')
             write(1,*)'rtof'
             write(1,*) '0'
             write(1,*)'0'
             if(njump.eq.1) write(1,*) nini
             if(njump.gt.1) write(1,"(i5,a1,i5)") nini,'-',nini+njump
             if(bgini.gt.bgfin)  write(1,"(a1)")'-'
             if(bgini.eq.bgfin) write(1,"(i5)") bgini
             if(bgini.lt.bgfin) write(1,"(i5,a1,i5)") bgini,'-',bgfin
             if(bgini.eq.0) write(1,*) '-'
             if(vanini.eq.vanfin) write(1,"(i5)") vanini
             if(vanini.ne.vanfin) write(1,"(i5,a1,i5)") vanini,'-',vanfin
             write(1,*)'-'    
             write(1,*)'y' 
             write(1,*)'n' 
             write(1,*)'0' 
             write(1,*)'y' 
             write(1,*)'y' 
             write(1,*)'4' 
             write(1,*)'1000' 
             write(1,*)'0.99' 
             write(1,*)'n' 
             write(1,*)'1-3' 
             write(1,*) Tvan 
             write(1,*)'' 
             write(1,*)'' 
             write(1,*)'3' 
             write(1,*)'-' 
             write(1,*)'fs' 
             write(1,*)'' 
             write(1,*)'1'
             write(1,*)'fdel'
      
             do i=nini+njump,nfin,njump
              write(1,*)'rtof'
              write(1,*)'0'
              write(1,*)'0'
              write(1,*) i
              write(1,*) 'y'
              write(1,*)''
              write(1,*)''
              write(1,*)'-'
              write(1,*)'fs'
              write(1,*)''
              write(1,*)'1'
              write(1,*)'fdel'
             end do
             close(unit=1)
      
      
      
      
      
      ! this part calculates sqw, and saves it
             open(unit=1,file='sqw.ml') 
             open(unit=2,file='readsqw.ml')
              dumi=1
              do i=nini,nfin,njump
              write(1,*)'fl'
              write(1,"(a1,i5)")'r',i
              write(1,*)''
              write(1,*)'_coq'
              write(1,*)'1'
              write(1,"(f12.6)") eini
              write(1,"(f12.6)") estep
              write(1,"(f12.6)") efin
              write(1,*)'1'
              write(1,"(f12.6)") qini
              write(1,"(f12.6)") qstep
              write(1,"(f12.6)") qfin
              write(1,*) 30
              write(1,"(f12.6)") qstep/2.0
              write(1,*)'7'
              write(1,*) dumi
              write(1,*)'fdel'  
              write(1,*) dumi
              write(1,*)'fs'
              write(nomout,"(a3,i5)")'sqw',i
              write(2,"(a3,a8)")'fl ',nomout
              write(1,*) nomout
              dumi=dumi+1  
              end do
              close(unit=1)
      !      thetamax=60.0
      ! this part takes the files and adds the spectra(before doing sqw) every thetamax (startin in thetamax//2)
              open(unit=1,file='int.ml') 
              dumi=1
              do i=nini,nfin,njump
              write(1,*)'fl'
              write(1,"(a1,i5)")'r',i
              write(1,*)''
              write(1,*)'msa'
              write(1,"(a1)")'z'
              write(1,"(f12.6)") thetamax/2.0
              write(1,*)'y'
              write(1,*) dumi
              write(1,*)'fdel'   
              dumi=dumi+1  
              end do
              close(unit=1)
              close(unit=1)
      
      !        lambda=2.5
      ! this one calculates the sq
              open(unit=1,file='sq.ml')
              open(unit=2,file='readsq.ml')
              dumi=1
              do i=nini,nfin,njump
              write(1,*)'fl'
              write(1,"(a1,i5)")'r',i
              write(1,*)''
              write(1,*)'oi'
              write(1,*)'4'
              write(1,"(f7.1,1x,f7.1)") 0.,1000.
              write(1,*) 1
              write(1,*) dumi
              write(1,*) 'fdel'
              write(1,*) dumi
              write(1,*) 'ox'
              write(1,"(a1)") '*'
              write(1,"(a2)") 'ec'
              write(1,"(f12.6)") 0.5*pi/180.0 
              write(1,*) ''
              write(1,*) ''
              write(1,"(a2)") 'ox'
              write(1,"(a3)") 'sin'
              write(1,"(a2)") 'ox'
              write(1,"(a1)") '*'
              write(1,"(a2)") 'ec'
              write(1,*) 4.0*pi/lambda
              write(1,*) ''
              write(1,*) ''
      
              if(dumi.ge.10) then
               write(1,"(i2,a1,i2,a1,i2)") dumi,',',dumi+1,',',dumi+2
               goto 1
              end if
      
              if(dumi+1.ge.10) then
               write(1,"(i1,a1,i2,a1,i2)") dumi,',',dumi+1,',',dumi+2
               goto 1
              end if
      
              if(dumi+2.ge.10) then
               write(1,"(i1,a1,i1,a1,i2)") dumi,',',dumi+1,',',dumi+2
               goto 1
              end if
      
              if(dumi+2.lt.10) then
               write(1,"(i1,a1,i1,a1,i1)") dumi,',',dumi+1,',',dumi+2
               goto 1
              end if
      
      
       1      continue
              write(1,*)'fdel'
              write(1,*) dumi
              write(1,*)'fs'
              write(nomout,"(a2,i5)")'sq',i
              write(2,"(a3,a7)")'fl ',nomout
              write(1,*) nomout
              write(1,*)''
              dumi=dumi+1  
              end do
             close(unit=1)
             close(unit=2)
             write(6,*)''
             write(6,*)'You are wet...'
             write(6,*)'yes. It is raining'
             write(6,*)'RHPS'
      
             stop
             end
      
      
      
      31666 31999  1     !first, last and jump numors
      31220 31222        !vanadium runs
      31121 31123      !empty can ini,fin(Nfin<Nini=no corr)
      0.0 1 0.2          !Qini,Qfin,Qjump
      -1.0 1.0 0.01      !Eini,Efin,Ejump
      20                 !thetamax
      6.0                !lambda
      20.0		! van temperature