Warning: Trying to access array offset on value of type null in /home/site/wwwroot/lib/plugins/move/action/rename.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/Action/Export.php on line 106

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/Action/Export.php on line 106

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/Action/Export.php on line 106
====== 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.activestate.com/recipes/573463-converting-xml-to-dictionary-and-back/|this code]] to get the xml file into a Python dictionary for further manipulation. This is particularly valuable when working with large datasets, such as variable temperature data collections or analysing maps of diffraction data. macro xml_create(file) { out file Out_String("") } macro xml_add(file,name,value) { out file append Out_String("\n\t<") Out_String(name) Out(value,">%e") Out_String("") } macro xml_close(file) { out file append Out_String("\n") } macro xml_from_xdds(file,append_to_file) { #m_ifarg append_to_file 1 out file append #m_else out file Out_String("") #m_endif Out(Get(r_wp), "\n\t%V") Out(Get(r_exp), "\n\t%V") Out(Get(gof), "\n\t%V") for xdds { Out_String("\n\t") Out(Get(r_wp), "\n\t\t%V") Out(Get(r_exp), "\n\t\t%V") Out(Get(gof), "\n\t\t%V") Out(Get(mixture_density_g_on_cm3), "\n\t\t%4.8f") Out_String("") for strs { Out_String("\n\t\t") Out(Get(phase_name), "\n\t\t\t%s") Out(Get(r_bragg), "\n\t\t\t%V") Out_String("\n\t\t\t") Out(Get(sp_grp_char), "\n\t\t\t\t%s") Out(Get(a), "\n\t\t\t\t%V") Out(Get(b), "\n\t\t\t\t%V") Out(Get(c), "\n\t\t\t\t%V") Out(Get(al), "\n\t\t\t\t%V") Out(Get(be), "\n\t\t\t\t%V") Out(Get(ga), "\n\t\t\t\t%V") Out(Get(cell_volume), "\n\t\t\t\t%V") Out(1.6605402 Get(cell_mass) / Get(cell_volume), "\n\t\t\t\t%4.8f") Out_String("") Out_String("\n\t\t\t") Out(Get(weight_percent), "\n\t\t\t%V") Out(Get(scale) Get(all_scale_pks), "\n\t\t\t%e") Out_String("") Out(Get(numerical_area), "\n\t\t\t%V") Out_String("\n\t\t") } Out_String("\n\t\t") xdd_out file append load out_record out_fmt out_eqn { "\n\t\t\t%0.6f" = X; "%0.6f" = Yobs; "%0.6f" = Ycalc; "%0.6f" = Yobs-Ycalc; } out file append Out_String("\n\t\t") Out_String("\n\t") } #m_ifarg append_to_file 1 #m_else Out_String("\n") #m_endif } macro xml_from_xdds(file) { xml_from_xdds(file,0) } **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. xml_from_xdds("myfilename.xml") **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't allow for the easy addition of other parameters. This example shows how to create an xml file which includes other values you may need to store. - 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 '1' signifies that this is appending into the file, rather than creating a new file. - Closes the end of the xml description using xml_close. xml_create("myfilename.xml") xml_add("myfilename.xml","myvalue1",1.0) xml_add("myfilename.xml","myvalue2",2.0) xml_add("myfilename.xml","myvalue3",aTopasPrmName) xml_from_xdds("myfilename.xml",1) xml_close("myfilename.xml")