xml_from_xdds
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| xml_from_xdds [2019/06/18 14:17] – created pac079 | xml_from_xdds [2025/09/19 15:18] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== xml_from_xdds ====== | ||
| + | Macros for the creation of xml files from within a TOPAS .inp file. xml_from_xdds will create an xml file with a separate entry for each xdd within the .inp file, and a separate entry for each str within each xdd. Rietveld statistics, lattice parameters, weight percents and the fit data are all stored. | ||
| + | The xml files are a structured format which can be easily used to read the refinement results into other software, such as Python. I recommend using [[http:// | ||
| + | <code topas> | ||
| + | macro xml_create(file) { out file Out_String("< | ||
| + | |||
| + | macro xml_add(file, | ||
| + | out file append | ||
| + | Out_String(" | ||
| + | } | ||
| + | |||
| + | macro xml_close(file) { out file append Out_String(" | ||
| + | |||
| + | macro xml_from_xdds(file, | ||
| + | #m_ifarg append_to_file 1 | ||
| + | out file append | ||
| + | #m_else | ||
| + | out file | ||
| + | Out_String("< | ||
| + | #m_endif | ||
| + | Out(Get(r_wp), | ||
| + | Out(Get(r_exp), | ||
| + | Out(Get(gof), | ||
| + | for xdds { Out_String(" | ||
| + | Out(Get(r_wp), | ||
| + | Out(Get(r_exp), | ||
| + | Out(Get(gof), | ||
| + | Out(Get(mixture_density_g_on_cm3), | ||
| + | for strs { Out_String(" | ||
| + | Out(Get(phase_name), | ||
| + | Out(Get(r_bragg), | ||
| + | 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(Get(cell_volume), | ||
| + | Out(1.6605402 Get(cell_mass) / Get(cell_volume), | ||
| + | Out_String(" | ||
| + | Out(Get(weight_percent), | ||
| + | Out(Get(scale) Get(all_scale_pks), | ||
| + | Out(Get(numerical_area), | ||
| + | Out_String(" | ||
| + | Out_String(" | ||
| + | xdd_out file append load out_record out_fmt out_eqn | ||
| + | { | ||
| + | " | ||
| + | "< | ||
| + | "< | ||
| + | "< | ||
| + | } | ||
| + | out file append | ||
| + | Out_String(" | ||
| + | Out_String(" | ||
| + | #m_ifarg append_to_file 1 | ||
| + | #m_else | ||
| + | Out_String(" | ||
| + | #m_endif | ||
| + | } | ||
| + | macro xml_from_xdds(file) { xml_from_xdds(file, | ||
| + | |||
| + | </ | ||
| + | |||
| + | **Example usage 1 - Create a file using the default values stored by xml_from_xdds** | ||
| + | |||
| + | Simply add the following towards the end of your .inp file. | ||
| + | <code topas> | ||
| + | xml_from_xdds(" | ||
| + | </ | ||
| + | |||
| + | **Example usage 2 - Adding your own values to the xml file, then using xml_from_xdds to append to the same file** | ||
| + | |||
| + | The use of xml_from_xdds writes out the standard data you want want from a refinement, but doesn' | ||
| + | - Create an empty xml file using xml_create. | ||
| + | - Adds a number of fixed values and parameters to the file using xml_add. The value will be added into the xml file as a node with the name given as the second parameter. | ||
| + | - Appends standard details of the xdds using xml_from_xdds. The ' | ||
| + | - Closes the end of the xml description using xml_close. | ||
| + | <code topas> | ||
| + | xml_create(" | ||
| + | xml_add(" | ||
| + | xml_add(" | ||
| + | xml_add(" | ||
| + | xml_from_xdds(" | ||
| + | xml_close(" | ||
| + | </ | ||