Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sequential_refinements_-_save_phase_pattern [2020/04/20 13:01]
iangie
sequential_refinements_-_save_phase_pattern [2021/05/13 05:07] (current)
iangie [Extracting the intensity contribution from a certain phase for a batch of dataset]
Line 1: Line 1:
-====== Extracting the intensity contribution from a certain phase from a batch data set ======+====== Extracting the intensity contribution from a certain phase for a batch of dataset ​======
 Intensity contribution from individual phase can be saved out from GUI interface "​right-click -> save if displayed..."​. Intensity contribution from individual phase can be saved out from GUI interface "​right-click -> save if displayed..."​.
  
-However, there were multiple questions asked in the forum concerning how to extract phase contribution through Launch Mode .inp file setup, and even do this for in-situ data set.+However, there were multiple questions asked in the forum concerning how to extract phase contribution through Launch Mode .inp file setup, and how to do this even for a batch dataset.
  
-The solution below has been enlightened by the Alan Coelho'​s 2-step refinement & Matthew Rowles'​s Sequential Refinement method.+The solution below has been enlightened by Alan Coelho'​s 2-step refinement ​solution ​& Matthew Rowles'​s Sequential Refinement method.
  
-TOPAS V6 allows a keyword //​num_runs//​ which instructs the programme to run an .inp file multiple times, which means above 2-step solution can be devised in one .inp file with "​num_runs 2" and several #if switches:+TOPAS V6 allows a keyword //​num_runs//​ which instructs the programme to run an .inp file multiple times. This means above 2-step solution can be devised in one .inp file with "​num_runs 2" and several #if switches:
  
 +====== 1. Extracting phase contribution from a single data ====== ​
 <code topas> <code topas>
 num_runs 2 num_runs 2
Line 30: Line 31:
    bkg @ 713.3525387 332.4034599 -218.0099371    bkg @ 713.3525387 332.4034599 -218.0099371
    ​One_on_X(@,​ 9993.352223)    ​One_on_X(@,​ 9993.352223)
 +#else bkg 1                             /* A arbitrary 1 count is added to the phase contribution in case some plotting software does not like 0 intensity. ​ */
 #​endif ​   #​endif ​  
  
    ​LP_Factor( 0)    ​LP_Factor( 0)
    ​Specimen_Displacement(samp_disp,​ -0.05080112471)    ​Specimen_Displacement(samp_disp,​ -0.05080112471)
-   Mixture_LAC_1_on_cm0) +   Radius(300)
-   ​mixture_MAC 0 +
-   ​mixture_density_g_on_cm3 1.6605402e+22 +
-   Rp 300 +
-   Rs 300+
    ​lpsd_th2_angular_range_degrees ​ 2.29    ​lpsd_th2_angular_range_degrees ​ 2.29
       lpsd_equitorial_divergence_degrees ​ 0.5       lpsd_equitorial_divergence_degrees ​ 0.5
-   ​axial_conv  +      Full_Axial_Model(12202055)
-      filament_length  ​12 +
-      sample_length  ​20 +
-      receiving_slit_length  ​20 +
-      primary_soller_angle  ​5 +
-      secondary_soller_angle  ​5 +
-      axial_n_beta ​ 30+
    ​CuKa(0.0001)    ​CuKa(0.0001)
        
Line 54: Line 46:
       {       {
        "​ %11.6f ​ " = X + 2 samp_disp Cos(X Deg_on_2)/​Rp Rad;                     /* Correct sample displacement from an internal standard, hkl_Al in this case */               "​ %11.6f ​ " = X + 2 samp_disp Cos(X Deg_on_2)/​Rp Rad;                     /* Correct sample displacement from an internal standard, hkl_Al in this case */       
-       "​ %11.6f\n ​ " = Ycalc;+       "​ %11.6f\n ​ " = Ycalc; ​                                                   /* You can add Ln() in the equation , if you want to plot as the intensity of the 2D plot in logarithm scale. */
        }        }
 #endif #endif
- 
    
 #if (Run_Number == 0) #if (Run_Number == 0)
Line 81: Line 72:
       Cubic(!a_000040787 4.049) ​         /*  Fixed to the lattice parameter from a PDF card. */       Cubic(!a_000040787 4.049) ​         /*  Fixed to the lattice parameter from a PDF card. */
  
-   ​hkl_Is ​ 
-      hkl_m_d_th2 1 0 0 6 3.72346902 23.8787327 I @ 0.0001220703125_LIMIT_MIN_1e-15 
-      hkl_m_d_th2 0 0 1 2 3.66351223 24.2754326 I @ 4.043069301 
-      ... 
-      e0_from_Strain( 0.0004851245559,​@,​ 0.2223647167_LIMIT_MIN_0.0001,,​) 
-      r_bragg ​ 0.1279653452 
-      phase_MAC 0 
-      phase_name "​hkl_LiC6" ​              /​* ​ Some other irrelevant phases ​ */      ​ 
-      MVW( 0, 58.64925299,​ 0) 
-      space_group P6/mmm 
-      Hexagonal(a_010834148 4.299491625,​c_010834148 3.66351217) 
 #endif #endif
  
Line 108: Line 88:
    
 </​code> ​     </​code> ​    
-It can be seen that, in the first run (Run_Number = 0), the #if switches ​allows ​a normal Pawley refinement which refines the sample displacement according to an internal standard (hkl_Al in this case). ​+It can be seen that, in the first run (Run_Number = 0), the #if switches ​allow a normal Pawley refinement which refines the sample displacement according to an internal standard (hkl_Al in this case). ​
  
-In the second run (Run_Number = 1), the #if switches only turned ​on the phase of interest with "iters 0" and get the intensity saved out.+In the second run (Run_Number = 1), the #if switches only turn on the phase of interest with "iters 0" and get the intensity saved out. 
 + 
 +====== 2. Extracting phase contribution from a batch dataset ======
  
 To apply this method for a batch of data set (e.g. in-situ data set), which contains, say 100 patterns, an .inp file with "​num_run = 2 * 100;" can be set as below: ​ To apply this method for a batch of data set (e.g. in-situ data set), which contains, say 100 patterns, an .inp file with "​num_run = 2 * 100;" can be set as below: ​
Line 120: Line 102:
 num_runs =2*100; ​               /* This set the Reserved Keywords "​Run_Number"​ goes from 0 to 199 */ num_runs =2*100; ​               /* This set the Reserved Keywords "​Run_Number"​ goes from 0 to 199 */
  
-#if (Mod(Run_Number,​2) == 1)    /* Normal Pawley refinement when Run_Number is an even number; Save the phase intensity when Run_Number is an odd number */+#if (Mod(Run_Number,​2) == 1)    /* Normal Pawley refinement when Run_Number is an even number; Save the phase intensity when Run_Number is an odd number. Refinements goes on like tik-tok tik-tok … */
 iters 0 iters 0
 #endif #endif
Line 134: Line 116:
 #​endif ​   #​endif ​  
  
-#prm filenum = Round((Run_Number+1)/​2); ​   /* This calculates the run number of the file, NOTE Round(0.5) evaluates to 0 in TOPAS V5, but evaluates to 1 in TOPAS V6! */+#prm filenum = Round((Run_Number+1)/​2); ​   /* This calculates the run number of the file, __NOTE ​Round(0.5) evaluates to 0 in TOPAS V5, but evaluates to 1 in TOPAS V6!__ */
  
 xdd Somepattern_#​out filenum##​.raw ​        /* This allow TOPAS to find the corresponding pattern ​ */ xdd Somepattern_#​out filenum##​.raw ​        /* This allow TOPAS to find the corresponding pattern ​ */
Line 141: Line 123:
    bkg @ 713.3525387 332.4034599 -218.0099371    bkg @ 713.3525387 332.4034599 -218.0099371
    ​One_on_X(@,​ 9993.352223)    ​One_on_X(@,​ 9993.352223)
-#else bkg 100                              ​/* A arbitrary ​bkg 100 is added to the phase contribution in case some plotting software ​don'​t ​like 0 intensity. ​ */+#else bkg 1                             /* A arbitrary ​1 count is added to the phase contribution in case some plotting software ​does not like 0 intensity. ​ */ 
 +#​endif ​  
  
-#​endif ​   
    ​LP_Factor( 0)    ​LP_Factor( 0)
    ​Specimen_Displacement(samp_disp,​ -0.05080112471)    ​Specimen_Displacement(samp_disp,​ -0.05080112471)
-   Mixture_LAC_1_on_cm0) +   Radius(300)
-   ​mixture_MAC 0 +
-   ​mixture_density_g_on_cm3 1.6605402e+22 +
-   Rp 300 +
-   Rs 300+
    ​lpsd_th2_angular_range_degrees ​ 2.29    ​lpsd_th2_angular_range_degrees ​ 2.29
       lpsd_equitorial_divergence_degrees ​ 0.5       lpsd_equitorial_divergence_degrees ​ 0.5
-   ​axial_conv  +      Full_Axial_Model(12202055)
-      filament_length  ​12 +
-      sample_length  ​20 +
-      receiving_slit_length  ​20 +
-      primary_soller_angle  ​5 +
-      secondary_soller_angle  ​5 +
-      axial_n_beta ​ 30 +
    ​CuKa(0.0001)    ​CuKa(0.0001)
  
Line 166: Line 137:
       xdd_out OUTPUT_NMO_#​out filenum##​.xy load out_record out_fmt out_eqn       xdd_out OUTPUT_NMO_#​out filenum##​.xy load out_record out_fmt out_eqn
       {       {
-       "​ %11.6f ​ " = X + 2 samp_disp Cos(X Deg_on_2)/​Rp Rad;   /* Correct sample displacement of the phase  */        +       "​ %11.6f ​ " = X + 2 samp_disp Cos(X Deg_on_2)/​Rp Rad;   /* Correct sample displacement of the phase, because the in-situ cell pops up */        
-       "​ %11.6f\n ​ " = Ycalc;+       "​ %11.6f\n ​ " = Ycalc; ​                                 /* You can add Ln() in the equation , if you want to plot as the intensity of the 2D plot in logarithm scale. */
        }        }
-      ​#endif+#endif
  
 #if (Mod(Run_Number,​2) == 0) #if (Mod(Run_Number,​2) == 0)
Line 193: Line 164:
       Cubic(!a_000040787 4.049)       Cubic(!a_000040787 4.049)
  
-   ​hkl_Is ​ 
-      hkl_m_d_th2 1 0 0 6 3.72346902 23.8787327 I @ 0.0001220703125_LIMIT_MIN_1e-15 
-      hkl_m_d_th2 0 0 1 2 3.66351223 24.2754326 I @ 4.043069301 
-      ... 
-      LVol_FWHM_CS_G_L( 1, 689.7614989,​ 0.89, 964.2925977,,,​@,​ 1083.474829_LIMIT_MIN_0.3) 
-      e0_from_Strain( 0.0004851245559,​@,​ 0.2223647167_LIMIT_MIN_0.0001,,​) 
-      r_bragg ​ 0.1279653452 
-      phase_MAC 0 
-      phase_name "​hkl_LiC6" ​                /​* ​ Other irrelevant phases */      ​ 
-      MVW( 0, 58.64925299,​ 0) 
-      space_group P6/mmm 
-      Hexagonal(a_010834148 4.299491625,​c_010834148 3.66351217) 
 #endif #endif
  
Line 221: Line 180:
       ​       ​
 </​code> ​     ​ </​code> ​     ​
-   + 
 +====== 3. Plot the extracted phase intensity as 2D plot using TOPAS V6 ====== 
 +Note the saved phase intensities .xy files will be in different X step positions.  
 + 
 +Some algorithms require long time to create 2D plot when the data are not in an uniform mesh.  
 + 
 +Surprisingly the 2D plot function in TOPAS v6 can create below 2D plot from 100 .xy data of non-uniform data step very quickly, which persuaded me no need to turn to other plotting software: 
 + 
 +The example of the plot is like [[https://​cloudstor.aarnet.edu.au/​plus/​s/​3sjimyTzfPse30L | this]]. 

Personal Tools