structure.replace_sites_... vs. structure.set_sites_...
Hi, while working on a really fast way to calculate the structure factors of a few millions of different modifications of a structure with only the selected scatterers contributing to f_calc I came across this: Why are there two methods for changing the sites_(cart/frac) of the scatterers doing quite different things? set_sites_... seems to simply update the corresponding site information of the scatterer, while replace_sites_... seems to create a copy of the structure. Is this the only difference there is? Also If anybody got a nice idea for my original problem, I'm also very much interested. (I think building a larger structure and working with selections might be faster than creating lots of different structures containing only the desired scatterers, but I might be wrong on this.) Cheers, Jan
Am Montag 15 April 2013 18:33:00 schrieb Jan Marten Simons:
Hi,
while working on a really fast way to calculate the structure factors of a few millions of different modifications of a structure with only the selected scatterers contributing to f_calc ....
[...]
(I think building a larger structure and working with selections might be faster than creating lots of different structures containing only the desired scatterers, but I might be wrong on this.)
I've found "flags" might be what I'm looking for. So if I could set the "use" flag for all scatterers at once and if it was taken into consideration during structure factor calculation then I think it would most likely be the fastest way to enable or disable the contribution of individual scatterers to the structure factors. Am I right on this and how would I best interface with the flags mechanism (from python)? Cheers, Jan
Are the same scatterers contributing to f_calc for every calculation, or
will the scatterers that are contributing vary from calculation to
calculation? In the case of the former it might be simplest to create a new
copy of the xray_structure with only those scatterers.
It looks the "use" flag isn't actually respected in the structure factor or
gradient calculations as far as I can tell. If you feel you need something
like this rather than creating new copies of the xray_structure with only
the scatterers you need or alternatively setting the occupancy to zero,
then this is probably something we can add into the code. There is some
code in cctbx/xray/scatterer_flags.h for flags_set_grad_*() that will set a
selection of gradients all at once in C++, but I don't see an equivalent
for set_use_*(). I suspect that the overhead of looping through the
scatterers to set flags in Python would be small compared to the cost of
calculating the structure factors in the first place.
Cheers,
Richard
On 15 April 2013 10:40, Jan Marten Simons
Am Montag 15 April 2013 18:33:00 schrieb Jan Marten Simons:
Hi,
while working on a really fast way to calculate the structure factors of a few millions of different modifications of a structure with only the selected scatterers contributing to f_calc ....
[...]
(I think building a larger structure and working with selections might be faster than creating lots of different structures containing only the desired scatterers, but I might be wrong on this.)
I've found "flags" might be what I'm looking for. So if I could set the "use" flag for all scatterers at once and if it was taken into consideration during structure factor calculation then I think it would most likely be the fastest way to enable or disable the contribution of individual scatterers to the structure factors. Am I right on this and how would I best interface with the flags mechanism (from python)?
Cheers,
Jan _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
I added "use" flag (at the time when I was adding all other scatterer flags) rather as a placeholder for a future use, so yes, indeed, currently it is not respected in fcalc and gradients calculation (though it should be respected!). Perhaps it's time to start using it... Pavel On 4/15/13 11:58 AM, Richard Gildea wrote:
Are the same scatterers contributing to f_calc for every calculation, or will the scatterers that are contributing vary from calculation to calculation? In the case of the former it might be simplest to create a new copy of the xray_structure with only those scatterers.
It looks the "use" flag isn't actually respected in the structure factor or gradient calculations as far as I can tell. If you feel you need something like this rather than creating new copies of the xray_structure with only the scatterers you need or alternatively setting the occupancy to zero, then this is probably something we can add into the code. There is some code in cctbx/xray/scatterer_flags.h for flags_set_grad_*() that will set a selection of gradients all at once in C++, but I don't see an equivalent for set_use_*(). I suspect that the overhead of looping through the scatterers to set flags in Python would be small compared to the cost of calculating the structure factors in the first place.
Cheers,
Richard
On 15 April 2013 10:40, Jan Marten Simons
mailto:[email protected]> wrote: Am Montag 15 April 2013 18:33:00 schrieb Jan Marten Simons: > Hi, > > while working on a really fast way to calculate the structure factors of a > few millions of different modifications of a structure with only the > selected scatterers contributing to f_calc ....
[...]
> (I think building a larger structure and working with > selections might be faster than creating lots of different structures > containing only the desired scatterers, but I might be wrong on this.)
I've found "flags" might be what I'm looking for. So if I could set the "use" flag for all scatterers at once and if it was taken into consideration during structure factor calculation then I think it would most likely be the fastest way to enable or disable the contribution of individual scatterers to the structure factors. Am I right on this and how would I best interface with the flags mechanism (from python)?
Cheers,
Jan _______________________________________________ cctbxbb mailing list [email protected] mailto:[email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Hi Jan,
I think you are right - from looking at the implementation it looks like
set_sites_* updates the coordinates in place, whereas replace_sites_*
returns a copy of the original structure and scatterers without modifying
the original. replace_sites_* also allows you to pass a selection too.
Cheers,
Richard
On 15 April 2013 09:33, Jan Marten Simons
Hi,
while working on a really fast way to calculate the structure factors of a few millions of different modifications of a structure with only the selected scatterers contributing to f_calc I came across this:
Why are there two methods for changing the sites_(cart/frac) of the scatterers doing quite different things?
set_sites_... seems to simply update the corresponding site information of the scatterer, while replace_sites_... seems to create a copy of the structure. Is this the only difference there is?
Also If anybody got a nice idea for my original problem, I'm also very much interested. (I think building a larger structure and working with selections might be faster than creating lots of different structures containing only the desired scatterers, but I might be wrong on this.)
Cheers,
Jan _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
participants (3)
-
Jan Marten Simons
-
Pavel Afonine
-
Richard Gildea