# Differences

This shows you the differences between two versions of the page.

 t [2009/08/06 15:40]clare created t [2009/08/27 12:20] (current)clare 2009/08/27 12:20 clare 2009/08/06 15:40 clare created 2009/08/27 12:20 clare 2009/08/06 15:40 clare created Line 1: Line 1: ====== t ====== ====== t ====== + + **[//​temperature//​ !E]...** + + **[****//​move_to_the_next_temperature_regardless_of_the_change_in_rwp//​****]** + + **[****//​save_values_as_best_after_randomization//​****]** + + **[****//​use_best_values//​****]** + + **[****//​do_processes//​****]** + + A temperature regime has no affect unless the reserved parameter name T is used in //​[[#​x000|val_on_continue]]//​ attributes, or, if the following temperature dependent keywords are used: + + [[#​k128|rand_xyz]] + + [[#​k133|randomize_on_errors]] + + //​randomize_on_errors//​automatically determines parameter displacements without the need for //​[[#​k128|rand_xyz]]//​or //​val_on_continue//​. It performs well on a wide range of problems. + + The reserved parameter T returns the current temperature and it can be used in equations and in particular the //​[[#​x000|val_on_continue]]//​ attribute. The first //​temperature//​ defined becomes the starting temperature;​ subsequent //​temperature//​(s) become the current temperature. + + If <​sub>​{{techref_files:​image016.gif?​20x23}}​ increases relative to a previous cycle then the temperature is advanced to the next //​temperature//​. If <​sub>​{{techref_files:​image016.gif?​20x23}}​ decreases relative to previous temperatures of lesser values then the current temperature is rewound to a previous temperature such that its previous is of a greater value. + + //​move_to_the_next_temperature_regardless_of_the_change_in_rwp//​ forces the refinement to move to the next temperature regardless of the change in Rwp from the previous temperature. + + //​save_values_as_best_after_randomization//​ saves the current set of parameters and gives them the status of “best solution”. Note, this does not change the global “best solution” which is saved at the end of refinement. + + //​use_best_values//​ replaces the current set of parameters with those marked as “best solution”. + + //​do_processes//​ executes any //​swap_sites//​ or //​try_site_patterns//​ processes. + + The temperature regime as defined in the macro Auto_T is sufficient for most problems. + + A typical temperature regime starts with a high value and then a series of annealing temperatures,​ for example: + + temperature 2 + + move_to_the_next_temperature_regardless_of_the_change_in_rwp + + temperature 1 + + temperature 1 + + temperature 1 + + If the current temperature is the last one defined (the fourth one), and <​sub>​{{techref_files:​image016.gif?​20x23}}​ decreased relative to the second and third //​temperature//​s,​ then the current temperature is set to the second temperature. + + The current temperature can be used in all equations using the reserved parameter T, for example: + + x @ 0.123 val_on_continue = Val + T Rand(-.1, .1) + + The following temperature regime will allow parameters to randomly walk for the first temperature. At the second temperature the parameters are reset to those that gave the "best solution"​. + + temperature 1 + + temperature 1   use_best_values + + temperature 1 + + temperature 1   use_best_values + + temperature 1 + + temperature 10 + + save_values_as_best_after_randomization + + move_to_the_next_temperature_regardless_of_the_change_in_rwp + + Note, that when a "best solution"​ is encountered the temperature is rewound to a position where the temperature decreased. For example, if the R<​sub>​WP​ dropped at lines 2 to 5 then the next temperature will be set to "​line 1"​. + + The following will continuously use the "best solution"​ before randomisation. This particular temperature regime has a tendency to remain in a false minimum. + + temperature 1 use_best_values + + **[//​th2_offset//​ E]...** + + Used for applying 2q corrections to phase peaks. The following example applies a sample displacement correction: + + th2_offset = -2 Rad (c) Cos(Th) / Rs; + + //​th2_offset//​ is used for example in the Zero_Error and Specimen_Displacement macros. + + **[//​try_site_patterns//​ \$sites [//​num_patterns_at_a_time//​ #] ]...** + + //​try_site_patterns//​ performs an exhaustive search of all possible cation configurations where the cations in question is [[#​k142|identified]] by \$sites. //​num_patterns_at_a_time//​ defines the number of patterns to process at any one time. Outline of the algorithm: + + While //​try_site_patterns//​ processes still to be processed { + + k = 0 + + Do + + Change the cation configuration according to //​try_site_patterns//​ + + Find the local minimum of <​sub>​{{techref_files:​image002.gif?​20x23}}​ + + If <​sub>​{{techref_files:​image016.gif?​20x23}}​(k+1) > <​sub>​{{techref_files:​image016.gif?​20x23}}​(k) then reset site positions + + k = k + 1 + + While <​sub>​{{techref_files:​image016.gif?​20x23}}​(k+1) > <​sub>​{{techref_files:​image016.gif?​20x23}}​(k) or //k// < //​num_patterns_at_a_time//​ + + } + + The number of possible cation configurations determines the approximate magnitude of a structure determination problem. A structure consisting of N<​sub>​A​ cation sites of species A and N<​sub>​B​ cation sites of species B has, for a particular set of cation positions, a number of possible configurations N<​sub>​AB​ calculated as follows: + + N<​sub>​AB​ = <​sup>​(NA+NB)​C<​sub>​NB​ / N<​sub>​B​! + + where the notation <​sup>​u​C<​sub>​v​=(u-0)(u-1)(u-2)…(u-(v-1)) has been used. Thus for N<​sub>​A​=3 and N<​sub>​B​=4 we have N<​sub>​AB​=(7 6 5 4)%%/(%%4 3 2 1)=N<​sub>​BA​=(7 6 5)%%/(%%3 2 1)=35. The number of configurations N<​sub>​ABD​ for and additional set of cation sites of species D becomes: + + N<​sub>​ABD​ = N<​sub>​AB​ (<​sup>​(NA+NB+NDD)​C<​sub>​ND​ / N<​sub>​D​! ) + + An additional two D sites, or, N<​sub>​A​=3,​ N<​sub>​B​=4 and N<​sub>​D​=2 gives and N<​sub>​ABD​=1260. Thus the number of configurations quickly becomes prohibitive for an exhaustive search. + + Here is an example of using //​try_site_patterns//​ on three Ca sites and two Zr sites: + + str... + + site Ca... + + site Ca... + + site Ca... + + site Zr... + + site Zr... + + //​try_site_patterns//​ "Ca Zr" //​num_patterns_at_a_time//​ 3 + + N<​sub>​CaZr​=10 and thus //​try_site_patterns//​ will cycle through the 10 patterns searching for a reduction in <​sub>​{{techref_files:​image002.gif?​20x23}}​.