Added order_extra feature for Single_crystal #1767
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added extra_order feature to Single_crystal, allowing extra orders of multiple scattering that ignores coherent scattering which is slow for large unit cells.
In a case as below, order=0 does not give satisfactory approximation.
Using higher orders provides less speedup as a function of split as show below.
This update introduces the option to allow a limited number of additional multiple scattering that ignores the coherent part of the cross section which is the computationally expensive part of the algorithm.
Using this feature with order=1 quickly provides a very good approximation with less computation time. Below we see speed ups compared to order=0, all with SPLIT 100. Using extra_order provides a better approximation, but of course does take computation time, though much faster than increasing the normal order parameter.
It can be a bit complex to choose the right combination of SPLIT, order and extra_order. The plot below shows many runs with speed up relative to a reference simulation and a chi square comparison to the reference run (here extra_order is called order_inc / "oi" in label, order is "o", SPLIT as "s"). For this system, leucine, using order=1, high split and extra_order somewhere between 3 and 6 would provide a good balance between accuracy and computation time.
Will update this pull request with equivalent feature for McXtrace.