sgtbx.space_group and sgtbx.space_group_info query
Dear CCTBX devs, What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group? >>> from cctbx import sgtbx >>> print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b) >>> print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1 sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either... Cheers, Ben -- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
Hi, For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever! Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op) With a space_group_info sgi, you can just do sgi_other_hand = sgi.change_hand() to you get a new space_group_info with the opposite hand. Best wishes, Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
>>> from cctbx import sgtbx >>> print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b) >>> print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
HI Luc Thanks for this - it’s a helpful description of the difference which would make a good addition to the documentation Does not explain why the output is different (or whether the output _should_ be different) though All the best Graeme
On 14 Oct 2019, at 11:03, Luc Bourhis
wrote: Hi,
For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever!
Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg
sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op)
With a space_group_info sgi, you can just do
sgi_other_hand = sgi.change_hand()
to you get a new space_group_info with the opposite hand.
Best wishes,
Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
from cctbx import sgtbx print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b) print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
sgtbx.space_group is a pure C++ object (well, almost, there are a few auxilliary Python methods injected). Its constructor expects a hall symbol as input:
https://github.com/cctbx/cctbx_project/blob/54344b84c0b4fd00c5ca8438b98a501e...
In contrast, sgtbx.space_group_info is a pure Python object that contains utility methods related to handling space groups. Its constructor is much more flexible and can interpret various "conventional" space group strings or from a space group number:
https://github.com/cctbx/cctbx_project/blob/54344b84c0b4fd00c5ca8438b98a501e...
I haven't delved into exactly what is happening when you construct an sgtbx.space_group() with the input "C2", but I'm not sure it's a valid hall symbol:
http://cci.lbl.gov/sginfo/hall_symbols.html
Cheers,
Richard
Dr Richard Gildea
Data Analysis Scientist
Tel: +441235 77 8078
Diamond Light Source Ltd.
Diamond House
Harwell Science & Innovation Campus
Didcot
Oxfordshire
OX11 0DE
________________________________
From: [email protected]
On 14 Oct 2019, at 11:03, Luc Bourhis
wrote: Hi,
For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever!
Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg
sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op)
With a space_group_info sgi, you can just do
sgi_other_hand = sgi.change_hand()
to you get a new space_group_info with the opposite hand.
Best wishes,
Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
from cctbx import sgtbx print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b) print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Thanks Richard, Luc, that makes things a little clearer. Perhaps some documentation of this would be useful in future? Cheers, Ben On 14/10/2019 11:46, Gildea, Richard (DLSLtd,RAL,LSCI) wrote:
sgtbx.space_group is a pure C++ object (well, almost, there are a few auxilliary Python methods injected). Its constructor expects a hall symbol as input:
https://github.com/cctbx/cctbx_project/blob/54344b84c0b4fd00c5ca8438b98a501e...
In contrast, sgtbx.space_group_info is a pure Python object that contains utility methods related to handling space groups. Its constructor is much more flexible and can interpret various "conventional" space group strings or from a space group number:
https://github.com/cctbx/cctbx_project/blob/54344b84c0b4fd00c5ca8438b98a501e...
I haven't delved into exactly what is happening when you construct an sgtbx.space_group() with the input "C2", but I'm not sure it's a valid hall symbol:
http://cci.lbl.gov/sginfo/hall_symbols.html
Cheers,
Richard
Dr Richard Gildea Data Analysis Scientist Tel: +441235 77 8078 Diamond Light Source Ltd. Diamond House Harwell Science & Innovation Campus Didcot Oxfordshire OX11 0DE ------------------------------------------------------------------------ *From:* [email protected]
on behalf of Winter, Graeme (DLSLtd,RAL,LSCI) *Sent:* 14 October 2019 11:33 *To:* cctbx mailing list *Subject:* Re: [cctbxbb] sgtbx.space_group and sgtbx.space_group_info query HI Luc Thanks for this - it’s a helpful description of the difference which would make a good addition to the documentation
Does not explain why the output is different (or whether the output _should_ be different) though
All the best Graeme
On 14 Oct 2019, at 11:03, Luc Bourhis
wrote: Hi,
For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever!
Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg
sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op)
With a space_group_info sgi, you can just do
sgi_other_hand = sgi.change_hand()
to you get a new space_group_info with the opposite hand.
Best wishes,
Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
from cctbx import sgtbx
print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b)
print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
Yes, sorry, I should have guessed that was puzzling as well! sgtbx.space_group_info is constructed with a Hermann-Mauguin symbol by default whereas sgtbx.space_group is constructed with a Hall symbol. Unfortunately the meaning of C2 is different in both notations. In Hermann-Mauguin the 2-axis is about b whereas in Hall the convention is that it is about c. That’s why you have a change of basis denoted between parenthesis.
On 14 Oct 2019, at 12:33, Winter, Graeme (DLSLtd,RAL,LSCI)
wrote: HI Luc
Thanks for this - it’s a helpful description of the difference which would make a good addition to the documentation
Does not explain why the output is different (or whether the output _should_ be different) though
All the best Graeme
On 14 Oct 2019, at 11:03, Luc Bourhis
wrote: Hi,
For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever!
Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg
sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op)
With a space_group_info sgi, you can just do
sgi_other_hand = sgi.change_hand()
to you get a new space_group_info with the opposite hand.
Best wishes,
Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
from cctbx import sgtbx print(sgtbx.space_group('C2').type().universal_hermann_mauguin_symbol()) P 1 2 1 (c,2*a+c,b) print(sgtbx.space_group_info('C2').group().type().universal_hermann_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
HI Luc,
Perfect thanks
For those of us who came from MX, this subtlety is utterly lost!
All the best Graeme
-----Original Message-----
From: [email protected]
On 14 Oct 2019, at 12:33, Winter, Graeme (DLSLtd,RAL,LSCI)
wrote: HI Luc
Thanks for this - it’s a helpful description of the difference which would make a good addition to the documentation
Does not explain why the output is different (or whether the output _should_ be different) though
All the best Graeme
On 14 Oct 2019, at 11:03, Luc Bourhis
wrote: Hi,
For the particular operation you showed, space_group_info is more efficient because it caches the result of determining space group type. The computation is delegated to an underlying sgtbx.space_group object. Asking such an object for the type results in a significant bunch of computations being done every time you ask. That’s because essentially a sgtbx.space_group object is just a list of rotation matrices and translation vectors. A space_group_info is more clever!
Moreover, space_group_info provides an easy entry point for many operations which would otherwise be more obscure to write. For example, if you want to change the hand, without space_group_info, you would need to do, starting from a space_group object sg
sgt = sg.type() op = sgt.change_of_hand_op() sg_other_hand = sg.change_basis(op)
With a space_group_info sgi, you can just do
sgi_other_hand = sgi.change_hand()
to you get a new space_group_info with the opposite hand.
Best wishes,
Luc
On 9 Oct 2019, at 18:08, Ben Williams
wrote: Dear CCTBX devs,
What is a sgtbx.space_group_info object, and why does it do something subtly different to sgtbx.space_group?
from cctbx import sgtbx print(sgtbx.space_group('C2').type().universal_hermann_mauguin_sy mbol()) P 1 2 1 (c,2*a+c,b) print(sgtbx.space_group_info('C2').group().type().universal_herma nn_mauguin_symbol()) C 1 2 1
sgtbx.space_group_info is notably lacking in docstring (or indeed comments in the code). sgtbx.space_group isn't too hot on the documentation either...
Cheers, Ben
-- Ben Williams Post-doctoral research associate Scientific Software Diamond Light Source
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
participants (4)
-
Ben Williams
-
Gildea, Richard (DLSLtd,RAL,LSCI)
-
Luc Bourhis
-
Winter, Graeme (DLSLtd,RAL,LSCI)