list_command
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| list_command [2016/10/26 16:35] – johnsoevans | list_command [2025/09/19 15:18] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== List #list Command ====== | ||
| + | |||
| + | #list is a new feature in v6. It's super-useful for running multiple refinements on different data sets or running multiple models against a single data set. Some things you can do are below. | ||
| + | |||
| + | Typical syntax is: | ||
| + | |||
| + | <code topas> | ||
| + | Backup_INP | ||
| + | #list pa_val | ||
| + | 0.1 | ||
| + | 0.2 | ||
| + | 0.3 | ||
| + | 0.4 | ||
| + | 0.5 | ||
| + | } | ||
| + | prm pa = pa_val(Run_Number);</ | ||
| + | |||
| + | By default refinement results aren't written to the INP file. This can be changed with the lines below, where inp_filename.inp is the name of your INP file. Note that out_file uses a " | ||
| + | |||
| + | <code topas> | ||
| + | out_file =" | ||
| + | |||
| + | If you step through a set of pa values and fit the data with each value Topas won't save the "best answer" | ||
| + | |||
| + | <code topas> | ||
| + | { | ||
| + | #if (Run_Number == 0) | ||
| + | prm Best_Rwp_ = 9999; | ||
| + | #else | ||
| + | prm Best_Rwp_ = #include Best_Rwp_.txt; | ||
| + | #endif | ||
| + | out Best_Rwp_.txt Out(If(Get(r_wp) < Best_Rwp_, Get(r_wp), Best_Rwp_)) | ||
| + | out_file = If(Get(r_wp) < Best_Rwp_, Concat(String(INP_File), | ||
| + | } </ | ||
| + | |||
| + | You can easily automate refinements using the #list command and [[string_equations|string equations]]. | ||
| + | |||
| + | For results files you can e.g. delete old files and write header lines with commands like the ones below. | ||
| + | |||
| + | <code topas># | ||
| + | | ||
| + | | ||
| + | out " | ||
| + | | ||
| + | #endif </ | ||
| + | |||
| + | There' | ||
| + | |||
| + | Here's an example of how to vary a specific parameter (the sample height) in the input file from Martin Fisch: | ||
| + | |||
| + | <code topas> | ||
| + | /* | ||
| + | Copy paste this file to an .inp file and run with Topas 6 | ||
| + | It shows how the #list command can be used to perform pattern | ||
| + | simulations. In this case, specimen displacement is varied. | ||
| + | Note that the list parameter (h_err) is used via a macro | ||
| + | in order to use it in the file name of the saved scan. | ||
| + | */ | ||
| + | |||
| + | yobs_eqn = 0; | ||
| + | min 20 | ||
| + | max 150 | ||
| + | del 0.01 | ||
| + | |||
| + | num_runs 11 | ||
| + | |||
| + | #list h_err { | ||
| + | -0.25 | ||
| + | -0.20 | ||
| + | -0.15 | ||
| + | -0.10 | ||
| + | -0.05 | ||
| + | 0.00 | ||
| + | 0.05 | ||
| + | 0.10 | ||
| + | 0.15 | ||
| + | 0.20 | ||
| + | 0.25 | ||
| + | } | ||
| + | |||
| + | macro displacement { h_err(Run_Number) } | ||
| + | |||
| + | Specimen_Displacement(, | ||
| + | |||
| + | lam ymin_on_ymax 0.0001 | ||
| + | Lam_recs | ||
| + | { 0.0159 | ||
| + | 0.5691 | ||
| + | 0.0762 | ||
| + | 0.2517 | ||
| + | 0.0871 | ||
| + | LP_Factor(0) | ||
| + | Rp 240 | ||
| + | Rs 240 | ||
| + | Slit_Width(0.07) | ||
| + | Divergence (0.25) | ||
| + | axial_conv | ||
| + | filament_length 12 | ||
| + | sample_length 9.5 | ||
| + | receiving_slit_length 15 | ||
| + | primary_soller_angle 2.55 | ||
| + | secondary_soller_angle 2.55 | ||
| + | |||
| + | str | ||
| + | phase_name " | ||
| + | a 4.1569162 | ||
| + | b =Get(a); | ||
| + | c =Get(a); | ||
| + | space_group " | ||
| + | site La1 x 0 y 0 z 0 occ La 1 beq 0.5 | ||
| + | site B1 x 0.5 y 0.5 z 0.19 occ B 1 beq 0.5 | ||
| + | scale 0.0001 | ||
| + | |||
| + | seed 10 | ||
| + | xdd_out LaB6_Displacement_## | ||
| + | { | ||
| + | " %11.6f | ||
| + | " %11.6f\n | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | There' | ||