Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
list_command [2016/10/26 17:19] johnsoevans |
list_command [2017/06/01 16:30] johnsoevans |
||
---|---|---|---|
Line 16: | Line 16: | ||
prm pa = pa_val(Run_Number);</code> | prm pa = pa_val(Run_Number);</code> | ||
- | By default the 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 "string equation". The "Backup_INP" macro creates a backup of your input file. This is useful as if you mess up with #list you can write a blank .inp file (essentially deleting your .inp). | + | 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 "string equation". The "Backup_INP" macro creates a backup of your input file. This is useful as if you mess up with #list you can write a blank .inp file (essentially deleting your .inp). |
<code topas>Backup_INP | <code topas>Backup_INP | ||
Line 34: | Line 34: | ||
} </code> | } </code> | ||
- | You can easily automate refinements using the #list command and string equations. Just give the filenames in the #list command and use something like "xdd filename(Run_Number)". You can add experimental information like time/temperature/etc in the #list command. | + | You can easily automate refinements using the #list command and [[string_equations|string equations]]. Just give the filenames in the #list command and use something like "xdd filename(Run_Number)". You can add experimental information like time/temperature/etc in the #list command. |
+ | |||
+ | For results files you can e.g. delete old files and write header lines with commands like the ones below. If you backup only for run 0 then you won't get annoying screen "flashes": | ||
+ | |||
+ | <code topas>#if (Run_Number == 0) | ||
+ | Backup_INP | ||
+ | system_before_save_OUT { del results.txt } | ||
+ | out "results.txt" append | ||
+ | Out_String(" 01_range 02_temp 03_time 04_r_wp 05_height 06_err 07_bval 08_err 09_perc_cubic \n") | ||
+ | #endif </code> | ||
+ | |||
+ | 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(, displacement ) | ||
+ | |||
+ | lam ymin_on_ymax 0.0001 | ||
+ | Lam_recs | ||
+ | { 0.0159 1.534753 3.6854 | ||
+ | 0.5691 1.540596 0.4370 | ||
+ | 0.0762 1.541058 0.6000 | ||
+ | 0.2517 1.544410 0.5200 | ||
+ | 0.0871 1.544721 0.6200 } | ||
+ | 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 "LaB6" | ||
+ | a 4.1569162 | ||
+ | b =Get(a); | ||
+ | c =Get(a); | ||
+ | space_group "Pm-3m" | ||
+ | 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_##displacement##.xy load out_record out_fmt out_eqn | ||
+ | { | ||
+ | " %11.6f " = X; | ||
+ | " %11.6f\n " = Rand_Normal(Ycalc, Sqrt(Ycalc)); | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | There's an example of how to name .out files by Run_Number at: [[saving_out_files_as_a_function_of_run_number|Saving .out Files as a Function of Run Number]] | ||