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
anisotropic_crystallite_size [2015/10/30 12:16]
hanslustig
anisotropic_crystallite_size [2018/01/30 09:18] (current)
hanslustig
Line 2: Line 2:
 As published in J. Appl. Cryst. **48(1)** //(2015)//, 189-194, Ectors et al. As published in J. Appl. Cryst. **48(1)** //(2015)//, 189-194, Ectors et al.
 [[http://​doi.org/​10.1107/​S1600576714026557]] [[http://​doi.org/​10.1107/​S1600576714026557]]
-An extention of the model published in J. Appl. Cryst. **48(6)** //(2015)//, Ectors et al. [[http://​doi.org/​10.1107/​S1600576715018488]] ​to account also for the Gaussian size contribution including distributions is also available  ​ +and J. Appl. Cryst. **48(6)** //(2015)//, 1998-2001, Ectors et al. [[http://​doi.org/​10.1107/​S1600576715018488]] 
-[[http://​doi.org/10.1107/S1600576715018488/​po5050sup2.txt]]+ 
 +---- 
 + 
 +Updated with an optional plotting macro PlotAnisoCS ​for the normals_plot window (Version 5+) 
 +July 2016 
 + 
 +Fixed a bug concerning the automatic orientation tool (Abs(alr) instead of alr)Thank you Remo for the feedback. 
 +January 2018 
 + 
 +---- 
 + 
 +Application e.g. for a cylinder in a hexagonal/trigonal system: 
 +     str 'or hkl_Is 
 +     ... 
 +     ​AnisoCS( 2, 0, 0, 1, 1, 0, 0, rx, 5, rx, 5, rz, 10, !pc, 0, !tc, 0, !nc, 0, 0) 
 +     ​AnisoCSg( tau, 1) 
 +     ​AnisoCSgout(result.txt
 +     ​PlotAnisoCS 'V5+ only 
 +     ... 
 + 
 + 
 +---- 
  
      macro AnisoCS( mod, h11, k11, l11, h22, k22, l22, ac, av, bc, bv, cc, cv, pc, pv, tc, tv, nc, nv, sp)      macro AnisoCS( mod, h11, k11, l11, h22, k22, l22, ac, av, bc, bv, cc, cv, pc, pv, tc, tv, nc, nv, sp)
      {      {
-      ' mod which model to use 1 for ellipsoid 2 for elliptic cylinder 3 for cuboid + ' As published in Ectors et al. (2015) J. Appl. Cryst. 48, 189-194  
-     ' h11 k11 l11 vector defining the z-axis + ' mod which model to use 1 for ellipsoid 2 for elliptic cylinder 3 for cuboid 
-     ' h22 k22 l22 vector defining the x-axis + ' h11 k11 l11 vector defining the z-axis 
-     ' av bv cv rx ry rz of the model + ' h22 k22 l22 vector defining the x-axis 
-     ' pv tv nv additional rotation parameters theta' theta' nu + ' av bv cv rx ry rz of the model 
-     ' sp activate special method for triclinic systems 1/0 on/off + ' pv tv nv additional rotation parameters theta' theta' nu 
-     ​' --------- Code starts here ------ + ' sp activate special method for triclinic systems 1/0 on/off 
-     peak_buffer_step 0 +        ' --------- Code starts here ------ 
-     '​Initialize variables ​+ peak_buffer_step 0 
 + '​Initialize variables ​
    ​ #​m_argu mod    ​ #​m_argu mod
  #m_argu ac If_Prm_Eqn_Rpt(ac,​ av, min 0.0001 max 10000)  #m_argu ac If_Prm_Eqn_Rpt(ac,​ av, min 0.0001 max 10000)
Line 39: Line 62:
  local !r31 = r13;  local !r32 = r23;         local !r33 = cr^2;   local !r31 = r13;  local !r32 = r23;         local !r33 = cr^2; 
  'Test if special method triclinic is activated  'Test if special method triclinic is activated
-      #m_ifarg sp 1 +     #m_ifarg sp 1 
- local !h1 = 0; local !h2 = If(alr <= 0.00001, 0 , 1); + local !h1 = 0; local !h2 = If(Abs(alr<= 0.00001, 0 , 1); 
- local !k1 = 0; local !k2 = If(alr <= 0.00001, 1 , -(r31 / r32));+ local !k1 = 0; local !k2 = If(Abs(alr<= 0.00001, 1 , -(r31 / r32));
  local !l1 = 1; local !l2 = 0;  local !l1 = 1; local !l2 = 0;
  #m_else  #m_else
Line 98: Line 121:
  '​Models:​  '​Models:​
  '​Ellipsoid  '​Ellipsoid
-      #m_ifarg mod 1+ #m_ifarg mod 1
  local volop  = ((4/3) 3.14159265358979 CeV(ac,av) CeV(bc,bv) CeV(cc,​cv));​  local volop  = ((4/3) 3.14159265358979 CeV(ac,av) CeV(bc,bv) CeV(cc,​cv));​
  local areaop = 3.14159265358979 Sqrt(((CeV(cc,​cv) sinphirot)^2)(((CeV(ac,​av) sinthetarot)^2)+(CeV(bc,​bv) costhetarot)^2)+((CeV(ac,​av) CeV(bc,bv) cosphirot)^2));​  local areaop = 3.14159265358979 Sqrt(((CeV(cc,​cv) sinphirot)^2)(((CeV(ac,​av) sinthetarot)^2)+(CeV(bc,​bv) costhetarot)^2)+((CeV(ac,​av) CeV(bc,bv) cosphirot)^2));​
Line 135: Line 158:
  lor_fwhm = 0.1 18.2378130556208 Lam / (Cos(Th) sizeL); ​  lor_fwhm = 0.1 18.2378130556208 Lam / (Cos(Th) sizeL); ​
      }      }
 +     
      macro AnisoCSout(file) {      macro AnisoCSout(file) {
 +     '​ As published in Ectors et al. (2015) J. Appl. Cryst. 48, 189-194 ​
      out file      out file
      ​Out_String("​Analysis Report: ")      ​Out_String("​Analysis Report: ")
Line 141: Line 166:
      ​Out(Get (r_wp), " Rwp: %8.3f \n")      ​Out(Get (r_wp), " Rwp: %8.3f \n")
      ​Out(Get (r_exp), " Rexp:%8.3f \n\n")      ​Out(Get (r_exp), " Rexp:%8.3f \n\n")
-          ​Out_String("​G-Metrictensor \n\n")+      
 +     Out_String("​G-Metrictensor \n\n")
      ​Out(m11,"​%8.3f"​) Out(m12,"​%8.3f"​) Out(m13,"​%8.3f\n"​)      ​Out(m11,"​%8.3f"​) Out(m12,"​%8.3f"​) Out(m13,"​%8.3f\n"​)
      ​Out(m21,"​%8.3f"​) Out(m22,"​%8.3f"​) Out(m23,"​%8.3f\n"​)      ​Out(m21,"​%8.3f"​) Out(m22,"​%8.3f"​) Out(m23,"​%8.3f\n"​)
      ​Out(m31,"​%8.3f"​) Out(m32,"​%8.3f"​) Out(m33,"​%8.3f\n\n"​)      ​Out(m31,"​%8.3f"​) Out(m32,"​%8.3f"​) Out(m33,"​%8.3f\n\n"​)
-          ​Out_String("​G*-Metrictensor \n\n")+      
 +     Out_String("​G*-Metrictensor \n\n")
      ​Out(r11,"​%8.3f"​) Out(r12,"​%8.3f"​) Out(r13,"​%8.3f\n"​)      ​Out(r11,"​%8.3f"​) Out(r12,"​%8.3f"​) Out(r13,"​%8.3f\n"​)
      ​Out(r21,"​%8.3f"​) Out(r22,"​%8.3f"​) Out(r23,"​%8.3f\n"​)      ​Out(r21,"​%8.3f"​) Out(r22,"​%8.3f"​) Out(r23,"​%8.3f\n"​)
      ​Out(r31,"​%8.3f"​) Out(r32,"​%8.3f"​) Out(r33,"​%8.3f\n\n"​)      ​Out(r31,"​%8.3f"​) Out(r32,"​%8.3f"​) Out(r33,"​%8.3f\n\n"​)
-          ​Out_String("​Rotationmatrix \n\n")+      
 +     Out_String("​Rotationmatrix \n\n")
      ​Out(grot11,"​%8.3f"​) Out(grot12,"​%8.3f"​) Out(grot13,"​%8.3f\n"​)      ​Out(grot11,"​%8.3f"​) Out(grot12,"​%8.3f"​) Out(grot13,"​%8.3f\n"​)
      ​Out(grot21,"​%8.3f"​) Out(grot22,"​%8.3f"​) Out(grot23,"​%8.3f\n"​)      ​Out(grot21,"​%8.3f"​) Out(grot22,"​%8.3f"​) Out(grot23,"​%8.3f\n"​)
      ​Out(grot31,"​%8.3f"​) Out(grot32,"​%8.3f"​) Out(grot33,"​%8.3f\n\n"​)      ​Out(grot31,"​%8.3f"​) Out(grot32,"​%8.3f"​) Out(grot33,"​%8.3f\n\n"​)
 +     
 +     
      ​Out_String("​Model parameters \n")      ​Out_String("​Model parameters \n")
      ​Out_String("​ (1) Ellipsoid / (2) Cylinder / (3) Cuboid \n")      ​Out_String("​ (1) Ellipsoid / (2) Cylinder / (3) Cuboid \n")
Line 165: Line 195:
      ​Out(vole,"​ Volume: %8.3f nm^3 \n")      ​Out(vole,"​ Volume: %8.3f nm^3 \n")
      ​Out(larea,"​ <True CS>: %8.3f nm \n\n")      ​Out(larea,"​ <True CS>: %8.3f nm \n\n")
 +     
 +     
 +     
       Out_String(" ​  ​H ​  ​K ​ L   ​M ​  ​2Th ​       D        phi     ​theta ​   phirot ​ thetarot ​ <​L_surf>​\n"​)       Out_String(" ​  ​H ​  ​K ​ L   ​M ​  ​2Th ​       D        phi     ​theta ​   phirot ​ thetarot ​ <​L_surf>​\n"​)
      ​phase_out file append load out_record out_fmt out_eqn ​      ​phase_out file append load out_record out_fmt out_eqn ​
 +     
      {      {
             "​%4.0f"​ = H;             "​%4.0f"​ = H;
Line 179: Line 213:
             "​%8.3f"​ = therot;             "​%8.3f"​ = therot;
             "​%8.3f\n"​ = sizeL;             "​%8.3f\n"​ = sizeL;
-        ​}+     } 
 +      
 +     } 
 +      
 +     macro AnisoCSg( tauc, tauv) 
 +     { 
 + #m_argu tauc If_Prm_Eqn_Rpt(tauc,​ tauv, min 1 max 2) 
 + '​Parameters Eq.(5-7) 
 + local para = Abs((costhetarot*sinphirot)/​ax);​ 
 + local parb = Abs((sinthetarot*sinphirot)/​bx);​ 
 + local parc = Abs((cosphirot)/​cx);​ 
 + '​Parameters chapter 2.4 
 + local pard = Sqrt(para^2+parb^2);​ 
 + local pare = pard/​parc;​ 
 + local parf = Sqrt(1-pare^2);​ 
 + 'Here comes the tricky part 
 + '​Ellipsoid Eq.(4) 
 + local ev = If(modx < 2,​CeV(tauc,​tauv) * (9/8) * sizeL, 
 + '​Cylinder  
 + If(modx < 3, 
 + 'Eq. (11) 
 + If(pard <= 0.0001,​CeV(tauc,​ tauv) * sizeL, 
 + 'Eq. (12) 
 + If(pard < parc, CeV(tauc, tauv) * ( (2/parc) - (8/​(3.14159265358979*pard)) * (-(2/​3)+(2/​3)*parf+((pare*pare*parf)/​3)+(pare*ArcSin(pare)))+ 
 + ((2*parc)/​(3.14159265358979*pard*pard))*(((pare*parf)/​2)-((1/​2)*(ArcSin(pare)))+(pare*pare*pare*parf)+(2*pare*pare*ArcSin(pare)))),​ 
 + 'Eq. (13) 
 + CeV(tauc, tauv)*((16)/​(3*3.14159265358979*pard))-((2*parc)/​(4*pard*pard)))),​ 
 + '​Cuboid 
 + 'Eq. (8) 
 + If(And(para>​=parb,​ para>​=parc),​CeV(tauc,​ tauv)*(2/​para)*(1-(parb/​(3*para))-(parc/​(3*para))+((parb*parc)/​(6*para*para))),​ 
 + 'Eq. (9) 
 + If(And(parb>​=para,​ parb>​=parc),​CeV(tauc,​ tauv)*(2/​parb)*(1-(para/​(3*parb))-(parc/​(3*parb))+((para*parc)/​(6*parb*parb))),​ 
 + 'Eq. (10) 
 + CeV(tauc, tauv)*(2/​parc)*(1-(para/​(3*parc))-(parb/​(3*parc))+((para*parb)/​(6*parc*parc)))))) 
 + ); 
 + 'IB calculations Eq. (1-3) 
 + local ibV = 1/ev; 
 + local ibL = 1/​(2*sizeL);​ 
 + 'ibG is 0 if ibV < ibL  
 + local ibG = If (ibV > ibL, ((Sqrt((4*ibV^2)-(4.27679864*ibV*ibL)+(0.27679864*ibL^2)))/​2),​ 0); 
 + 'CS_G macro 
 + local sizeG = ibG/​(Sqrt(3.14159265358979/​(4*Ln(2))));​ 
 + gauss_fwhm = 0.1 Rad Lam sizeG / Cos(Th); 
 + 'For Output purposes only 
 + local taux =  CeV(tauc, tauv); 
 +     } 
 +      
 +     macro AnisoCSgout(file) { 
 +     out file 
 +     ​Out_String("​Analysis Report: ") 
 +     ​Out(Get(phase_name),"​%s \n") 
 +     ​Out(Get (r_wp), " Rwp: %8.3f \n") 
 +     ​Out(Get (r_exp), " Rexp:%8.3f \n\n"​) 
 +      
 +     ​Out_String("​G-Metrictensor \n\n"​) 
 +     ​Out(m11,"​%8.3f"​) Out(m12,"​%8.3f"​) Out(m13,"​%8.3f\n"​) 
 +     ​Out(m21,"​%8.3f"​) Out(m22,"​%8.3f"​) Out(m23,"​%8.3f\n"​) 
 +     ​Out(m31,"​%8.3f"​) Out(m32,"​%8.3f"​) Out(m33,"​%8.3f\n\n"​) 
 +      
 +     ​Out_String("​G*-Metrictensor \n\n"​) 
 +     ​Out(r11,"​%8.3f"​) Out(r12,"​%8.3f"​) Out(r13,"​%8.3f\n"​) 
 +     ​Out(r21,"​%8.3f"​) Out(r22,"​%8.3f"​) Out(r23,"​%8.3f\n"​) 
 +     ​Out(r31,"​%8.3f"​) Out(r32,"​%8.3f"​) Out(r33,"​%8.3f\n\n"​) 
 +      
 +     ​Out_String("​Rotationmatrix \n\n"​) 
 +     ​Out(grot11,"​%8.3f"​) Out(grot12,"​%8.3f"​) Out(grot13,"​%8.3f\n"​) 
 +     ​Out(grot21,"​%8.3f"​) Out(grot22,"​%8.3f"​) Out(grot23,"​%8.3f\n"​) 
 +     ​Out(grot31,"​%8.3f"​) Out(grot32,"​%8.3f"​) Out(grot33,"​%8.3f\n\n"​) 
 +      
 +      
 +     ​Out_String("​Model parameters \n") 
 +     ​Out_String("​ (1) Ellipsoid / (2) Cylinder / (3) Cuboid \n") 
 +     ​Out(modx,​ " Model: %1.0f \n\n"​) 
 +     ​Out(h1,"​ z-axis hkl: %8.3f"​) Out(k1,"​ %8.3f"​) Out(l1,"​ %8.3f \n") 
 +     ​Out(px,​ " Rotation phi: %8.3f"​) Out(tx, " ​ theta: %8.3f \n\n"​) 
 +     ​Out(h2,"​ x-axis hkl: %8.3f"​) Out(k2,"​ %8.3f"​) Out(l2,"​ %8.3f \n") 
 +     ​Out(nx,​ " Additional rotation nu: %8.3f \n\n"​) 
 +     ​Out(ax,"​ rx-radius_surf:​ %8.3f nm ") 
 +     ​Out(ax*taux,"/​ rx-radius_vol:​ %8.3f nm \n") 
 +     ​Out(bx,"​ ry-radius_surf:​ %8.3f nm ") 
 +     ​Out(bx*taux,"/​ ry-radius_vol:​ %8.3f nm \n") 
 +     ​Out(cx,"​ rz-radius_surf:​ %8.3f nm ") 
 +     ​Out(cx*taux,"/​ rz-radius_vol:​ %8.3f nm \n") 
 +     ​Out(vole,"​ Volume_surf:​ %8.3f nm^3 ") 
 +     ​Out(vole*taux*taux*taux,"/​ Volume_vol: %8.3f nm^3 \n") 
 +     ​Out(larea,"​ <True CS>​_surf:​ %8.3f nm ") 
 +     ​Out(larea*taux,"/​ <True CS>_vol: %8.3f nm \n\n"​) 
 +     ​Out_String("​Distribution parameters \n") 
 +     ​Out(taux,"​ Tau: %8.4f  \n") 
 +     ​Out_String("​ If Lognormal of <True CS>​\n"​) 
 +     ​Out(Ln(larea*taux)-(3.5*Ln(taux)),"​ Logn. mean:​%8.4f ​ \n") 
 +     ​Out(Sqrt(Ln(taux)),"​ Logn. var.: %8.4f  \n\n"​) 
 +      
 +      Out_String(" ​  ​H ​  ​K ​ L   ​M ​  ​2Th ​       D    <​L_surf><​L_vol> ​ <​L_vol>/<​L_surf>​ \n") 
 +     ​phase_out file append load out_record out_fmt out_eqn  
 +      
 +     { 
 +            "​%4.0f"​ = H; 
 +            "​%4.0f"​ = K; 
 +            "​%4.0f"​ = L; 
 +            "​%4.0f"​ = M; 
 +            "​%8.3f"​ = 2 Th Rad; 
 +            "​%8.3f"​ =  D_spacing;​ 
 +            "​%8.3f"​ = sizeL; 
 +            "​%8.3f"​ = ev; 
 +            "​%8.3f\n"​ = ev/sizeL; 
 +     } 
 +      
 +     } 
 +      
 +     macro PlotAnisoCS 
 +     { 
 +     '​ellipsoid 
 +     ​normals_plot = If(modx < 2, sizeL*(3/​4),​ 
 +     '​cylinder 
 +     ​If(modx < 3, 
 +     1/( ( ((Abs((1/​cx)*cosphirot))^(10))+((Abs((sinphirot))^(10))*( ((Abs((1/​bx)*sinthetarot))^(2)) + ((Abs((1/​ax)*costhetarot))^(2)) )^(5) ) )^(1/10) ), 
 +     '​cuboid 
 +     1/( ( ((Abs((1/​cx)*cosphirot))^(10))+((Abs((sinphirot))^(10))*( ((Abs((1/​bx)*sinthetarot))^(10)) + ((Abs((1/​ax)*costhetarot))^(10)) ) ) )^(1/10) ) 
 +     ) 
 +     );
      }      }

Personal Tools