all_macros
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
all_macros [2009/08/31 15:05] – created johnsoevans | all_macros [2022/11/03 15:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== All User Macros ====== | ||
+ | |||
+ | List below is all the macros in jsoe's library | ||
+ | |||
+ | <code topas>' | ||
+ | ' | ||
+ | ' | ||
+ | 'Save the ones you need to your local.inc | ||
+ | ' | ||
+ | 'To get a listing highlight the word " | ||
+ | ' | ||
+ | ' | ||
+ | 'send contributions to john.evans@durham.ac.uk | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro Out_min_max(file) | ||
+ | { | ||
+ | out file | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | |||
+ | | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | " A1( x%s" = Get_From_String(Get(current_atom), | ||
+ | ", | ||
+ | " , | ||
+ | " | ||
+ | ", | ||
+ | " , | ||
+ | " | ||
+ | ", | ||
+ | " , | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro wifd_pkshape(two_theta, | ||
+ | local | ||
+ | local | ||
+ | prm aprm aprmv min 1.5 max 2.5 | ||
+ | prm tauf_2 | ||
+ | prm tauf_1 | ||
+ | prm tauf_0 | ||
+ | user_defined_convolution = X^aprm Exp(-X / (tauf_0 + tauf_1 lam + tauf_2 lam^2)); min 0 max = 20 aprm tauf_1 lam; | ||
+ | |||
+ | prm taus_0 | ||
+ | prm taus_1 | ||
+ | prm t_eff t_effv min 90.0 | ||
+ | local storage = Exp( -950 /(t_eff lam lam)) ; | ||
+ | push_peak | ||
+ | prm hhh hhhv min .001 | ||
+ | prm hhh_0 hhh_0v min 0.001 | ||
+ | hat = hhh_0 + hhh D_spacing; | ||
+ | scale_top_peak = (1-storage); | ||
+ | bring_2nd_peak_to_top | ||
+ | hat = hhh_0 + hhh D_spacing; | ||
+ | scale_top_peak = storage; | ||
+ | exp_conv_const = -Ln(0.001) (taus_0 + lam taus_1); | ||
+ | add_pop_1st_2nd_peak | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro wifd_mic(two_theta, | ||
+ | | ||
+ | prm tspow | ||
+ | prm tauf_0 | ||
+ | prm tauf_1 | ||
+ | prm taus_0 | ||
+ | prm taus_1 | ||
+ | prm t_eff t_effv min 90.0 | ||
+ | prm hhh hhhv min .001 | ||
+ | prm double_pulse | ||
+ | local | ||
+ | |||
+ | | ||
+ | min 0 max = 10 (tauf_0 + tauf_1 lam ); | ||
+ | |||
+ | local !storage = Exp( -950 /(t_eff lam^2)) hhh; | ||
+ | push_peak | ||
+ | hat = double_pulse ; | ||
+ | scale_top_peak = (1-storage)/ | ||
+ | bring_2nd_peak_to_top | ||
+ | exp_conv_const = -Ln(0.001) / (taus_0 + taus_1 / lam^2); | ||
+ | scale_top_peak = storage/ | ||
+ | add_pop_1st_2nd_peak | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro gem_instrumental_peakshape( ,prma0, ,prma1, ,prmb0, ,prmb1) | ||
+ | { | ||
+ | | ||
+ | exp_conv_const = prma0 + prma1 / D_spacing; | ||
+ | bring_2nd_peak_to_top | ||
+ | user_defined_convolution | ||
+ | = prmb0 Exp(- prmb1 X) / D_spacing^4; | ||
+ | min 0 | ||
+ | max = -Ln(0.001) / prmb1; | ||
+ | | ||
+ | peak_buffer_step 1 ' | ||
+ | |||
+ | } | ||
+ | ' | ||
+ | ' | ||
+ | macro tof_sample_peakshape(lor, | ||
+ | { | ||
+ | prm dsp dsp_val del = 0.05 Val + 1; min 1 | ||
+ | prm dspsq dspsq_val del = 0.05 Val + 1; min 0 | ||
+ | peak_type pv | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | 'An alternative approach to spherical harmonics for hkl dependent peak shapes by | ||
+ | 'Peter Stephens (P.W. Stephens, J. Appl. Cryst. (1999) 32, 281-9) as coded in gsas. | ||
+ | 'eta term allows mixture of Gauss/ | ||
+ | ' | ||
+ | 'As an example try: | ||
+ | 'prm s400 11769.84126` | ||
+ | 'prm s004 153.55044` | ||
+ | 'prm s220 28029.32854` | ||
+ | 'prm s202 -1067.03124` | ||
+ | 'prm eta 0.52180` min 0 max 1 | ||
+ | ' | ||
+ | |||
+ | macro Stephens_tetragonal(s400, | ||
+ | { | ||
+ | prm mhkl = Abs(S400 (H^4+ K^4)+ S004 L^4+ S220 H^2 K^2 + S202 (H^2 L^2 + K^2 L^2) ); | ||
+ | |||
+ | prm pp = D_spacing^2 * Sqrt(Max(mhkl, | ||
+ | gauss_fwhm = 1.8/ | ||
+ | lor_fwhm = 1.8/ | ||
+ | } | ||
+ | |||
+ | macro Stephens_monoclinic(s400, | ||
+ | { | ||
+ | prm mhkl = H^4 s400 + K^4 s040 + L^4 s004 + | ||
+ | H^2 K^2 s220 + H^2 L^2 s202 + K^2 L^2 s022 + | ||
+ | H K^2 L s121 + | ||
+ | H L^3 s103 + H^3 L s301; | ||
+ | |||
+ | prm pp = D_spacing^2 * Sqrt(Max(mhkl, | ||
+ | |||
+ | gauss_fwhm = 1.8/ | ||
+ | lor_fwhm = 1.8/ | ||
+ | } | ||
+ | |||
+ | macro Stephens_hexagonal(s400, | ||
+ | { | ||
+ | prm mhkl = H^4 s400 + K^4 s400 + L^4 s004 + | ||
+ | H^2 K^2 3 s400 + H^2 L^2 s202 + K^2 L^2 s202 + | ||
+ | H K L^2 s202 + | ||
+ | H^3 K 2 s400 + H K^3 2 s400; | ||
+ | |||
+ | prm pp = D_spacing^2 * Sqrt(Max(mhkl, | ||
+ | |||
+ | gauss_fwhm = 1.8/ | ||
+ | lor_fwhm = 1.8/ | ||
+ | } | ||
+ | |||
+ | macro Stephens_orthorhombic(s400, | ||
+ | { | ||
+ | prm mhkl = H^4 s400 + K^4 s040 + L^4 s004 + | ||
+ | H^2 K^2 s220 + H^2 L^2 s202 + K^2 L^2 s022; | ||
+ | |||
+ | prm pp = D_spacing^2 * Sqrt(Max(mhkl, | ||
+ | |||
+ | gauss_fwhm = 1.8/ | ||
+ | lor_fwhm = 1.8/ | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro Robust_refinement_xye | ||
+ | { | ||
+ | ' | ||
+ | r_exp 4.390 | ||
+ | prm test = Get(r_exp); | ||
+ | prm N = (1/ | ||
+ | prm !p0 =0.40007404; | ||
+ | prm !p1 =-2.5949286; | ||
+ | prm !p2 =4.3513542; | ||
+ | prm !p3 =-1.7400101; | ||
+ | prm !p4 =3.6140845 * 10^-1; | ||
+ | prm !p5 =-4.5247609 * 10^-2; | ||
+ | prm !p6 =3.5986364 * 10^-3; | ||
+ | prm !p7 =-1.8328008 * 10^-4; | ||
+ | prm !p8 =5.7937184 * 10^-6; | ||
+ | prm !p9 =-1.035303 * 10^-7; | ||
+ | prm !p10 =7.9903166 * 10^-10; | ||
+ | prm t = ((Yobs - Ycalc)/ | ||
+ | prm testjohn = If( t < 0.8, | ||
+ | | ||
+ | If(t < 21, N*((((((((((p10*t + p9)*t + p8)*t + p7) | ||
+ | *t + p6)*t + p5)*t + p4)*t + p3) | ||
+ | *t + p2)*t + p1)*t +p0)/(Yobs - Ycalc)^2, | ||
+ | | ||
+ | weighting = If( t < 0.8, | ||
+ | (1/ | ||
+ | If(t < 21, N*((((((((((p10*t + p9)*t + p8)*t + p7) | ||
+ | *t + p6)*t + p5)*t + p4)*t + p3) | ||
+ | *t + p2)*t + p1)*t +p0)/(Yobs - Ycalc)^2, | ||
+ | N*(2.0131 * Ln(t) + 3.9183)/ | ||
+ | recal_weighting_on_iter | ||
+ | } | ||
+ | |||
+ | macro Robust_refinement_poisson | ||
+ | { | ||
+ | ' | ||
+ | 'N.B. changed SigmaYobs to Yobs^0.5 | ||
+ | r_exp 4.390 | ||
+ | prm test = Get(r_exp); | ||
+ | prm N = (1/ | ||
+ | prm !p0 =0.40007404; | ||
+ | prm !p1 =-2.5949286; | ||
+ | prm !p2 =4.3513542; | ||
+ | prm !p3 =-1.7400101; | ||
+ | prm !p4 =3.6140845 * 10^-1; | ||
+ | prm !p5 =-4.5247609 * 10^-2; | ||
+ | prm !p6 =3.5986364 * 10^-3; | ||
+ | prm !p7 =-1.8328008 * 10^-4; | ||
+ | prm !p8 =5.7937184 * 10^-6; | ||
+ | prm !p9 =-1.035303 * 10^-7; | ||
+ | prm !p10 =7.9903166 * 10^-10; | ||
+ | prm t = ((Yobs - Ycalc)/ | ||
+ | prm testjohn = If( t < 0.8, | ||
+ | | ||
+ | If(t < 21, N*((((((((((p10*t + p9)*t + p8)*t + p7) | ||
+ | *t + p6)*t + p5)*t + p4)*t + p3) | ||
+ | *t + p2)*t + p1)*t +p0)/(Yobs - Ycalc)^2, | ||
+ | | ||
+ | weighting = If( t < 0.8, | ||
+ | (1/ | ||
+ | If(t < 21, N*((((((((((p10*t + p9)*t + p8)*t + p7) | ||
+ | *t + p6)*t + p5)*t + p4)*t + p3) | ||
+ | *t + p2)*t + p1)*t +p0)/(Yobs - Ycalc)^2, | ||
+ | N*(2.0131 * Ln(t) + 3.9183)/ | ||
+ | recal_weighting_on_iter | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro H_ride(h_site, | ||
+ | { | ||
+ | site h_site | ||
+ | x = Constant((xv)-Get(Find_Child(Get(site_recs), | ||
+ | y = Constant((yv)-Get(Find_Child(Get(site_recs), | ||
+ | z = Constant((zv)-Get(Find_Child(Get(site_recs), | ||
+ | occ H 1 | ||
+ | beq beqcv | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro Get_Distance(sites, | ||
+ | { | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | sites_distance c | ||
+ | load site_to_restrain { sites } | ||
+ | prm = c; : d_calc | ||
+ | } | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro adp_no_limits | ||
+ | { | ||
+ | move_to u11 min = Val - .05; max = Val + .05; | ||
+ | move_to u22 min = Val - .05; max = Val + .05; | ||
+ | move_to u33 min = Val - .05; max = Val + .05; | ||
+ | move_to u12 min = Val - .05; max = Val + .05; | ||
+ | move_to u13 min = Val - .05; max = Val + .05; | ||
+ | move_to u23 min = Val - .05; max = Val + .05; | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro Out_CIF_crystalmaker(file) {Out_CIF_crystalmaker_1(file) Out_CIF_crystalmaker_2(file)} | ||
+ | macro Out_CIF_crystalmaker_1(file) | ||
+ | { | ||
+ | out file | ||
+ | Out_String(" | ||
+ | Out(Get(phase_name), | ||
+ | Out(Get(a), " | ||
+ | Out(Get(b), " | ||
+ | Out(Get(c), " | ||
+ | Out(Get(al), | ||
+ | Out(Get(be), | ||
+ | Out(Get(ga), | ||
+ | Out(Get(cell_volume), | ||
+ | |||
+ | Out(Get(sp_grp_char), | ||
+ | |||
+ | Out_String(" | ||
+ | Out(Get(sp_xyzs_txt), | ||
+ | |||
+ | Out_String(" | ||
+ | | ||
+ | ' | ||
+ | ' | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_crystalmaker_2(file) | ||
+ | { | ||
+ | out file append | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | ' | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | atom_out file append | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | ' | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | 'Why: outputs Biso in format that Diamond will import properly | ||
+ | ' | ||
+ | macro Out_CIF_Diamond(file) | ||
+ | { | ||
+ | out file | ||
+ | Out_String(" | ||
+ | Out(Get(phase_name), | ||
+ | Out(Get(a), " | ||
+ | Out(Get(b), " | ||
+ | Out(Get(c), " | ||
+ | Out(Get(al), | ||
+ | Out(Get(be), | ||
+ | Out(Get(ga), | ||
+ | Out(Get(cell_volume), | ||
+ | |||
+ | Out(Get(sp_grp_char), | ||
+ | |||
+ | Out_String(" | ||
+ | Out(Get(sp_xyzs_txt), | ||
+ | |||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_ADPs_Diamond(file) | ||
+ | { | ||
+ | out file append | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | atom_out file append | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro Out_Dif(file) | ||
+ | { | ||
+ | out file | ||
+ | Out_String(" | ||
+ | | ||
+ | { | ||
+ | " | ||
+ | " %11.5f\n" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | macro Out_gnuplot_labels(file) | ||
+ | { | ||
+ | out file | ||
+ | Out_String("# | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | | ||
+ | { | ||
+ | " | ||
+ | " at %11.5f" | ||
+ | ", %11.5f * yoffset \n" = I_after_scale_pks; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_gnuplot_tics(file) | ||
+ | { | ||
+ | | ||
+ | { | ||
+ | " | ||
+ | " %11.5f\n" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro write_atoms(file) | ||
+ | { | ||
+ | out file ' | ||
+ | Out_String(" | ||
+ | Out(Get(sp_grp_char), | ||
+ | Out(Get(a), " | ||
+ | Out(Get(b), " | ||
+ | Out(Get(c), " | ||
+ | Out(Get(al), | ||
+ | Out(Get(be), | ||
+ | Out(Get(ga), | ||
+ | Out_String(" | ||
+ | | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | macro write_atoms_adp(file) | ||
+ | { | ||
+ | out file ' | ||
+ | Out_String(" | ||
+ | Out(Get(sp_grp_char), | ||
+ | Out(Get(a), " | ||
+ | Out(Get(b), " | ||
+ | Out(Get(c), " | ||
+ | Out(Get(al), | ||
+ | Out(Get(be), | ||
+ | Out(Get(ga), | ||
+ | Out_String(" | ||
+ | | ||
+ | load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ |