[cctbxbb] sgtbx.space_group and sgtbx.space_group_info query

Ben Williams ben.williams at diamond.ac.uk
Mon Oct 14 05:39:12 PDT 2019


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/54344b84c0b4fd00c5ca8438b98a501eca503fae/cctbx/sgtbx/space_group.h#L73-L85
>
> 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/54344b84c0b4fd00c5ca8438b98a501eca503fae/cctbx/sgtbx/__init__.py#L81-L114
>
> 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:* cctbxbb-bounces at phenix-online.org 
> <cctbxbb-bounces at phenix-online.org> on behalf of Winter, Graeme 
> (DLSLtd,RAL,LSCI) <Graeme.Winter at diamond.ac.uk>
> *Sent:* 14 October 2019 11:33
> *To:* cctbx mailing list <cctbxbb at phenix-online.org>
> *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 <luc_j_bourhis at mac.com> 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 <ben.williams at diamond.ac.uk> 
> 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
> >> cctbxbb at phenix-online.org
> >> http://phenix-online.org/mailman/listinfo/cctbxbb
> >
> >
> > _______________________________________________
> > cctbxbb mailing list
> > cctbxbb at phenix-online.org
> > http://phenix-online.org/mailman/listinfo/cctbxbb
>
>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> 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
> cctbxbb at phenix-online.org
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20191014/8ce4846b/attachment.htm>


More information about the cctbxbb mailing list