[cctbxbb] Conversion from symmetry operation to matrix

Graeme.Winter at Diamond.ac.uk Graeme.Winter at Diamond.ac.uk
Tue Jul 12 07:40:56 PDT 2011


However...

Having said this, I am struggling to write the inverse namely the general conversion from a symmetry / reindexing operation as a matrix to a string.

In principle if I have an rt_mx I can call apon:

>>> r
<cctbx_sgtbx_ext.rt_mx object at 0xb7e46f9c>
>>> t = sgtbx.change_of_basis_op(r)
>>> t.as_xyz()
'1/2*z,-y+1/2*z,x'

which works a treat. However unless I get the rt_mx from a reindexing operation I cannot assign a non-rotation to R:
>>> r = matrix.sqr(s.c().as_double_array()[:9])
>>> rt = sgtbx.rt_mx(r, (0,0,0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: cctbx InternalError: /home/gw56/xtal/cctbx/cctbx_sources/cctbx/sgtbx/rt_mx.cpp(290): Unsuitable value for rational rotation matrix.

which is something of a pain. Is there some kind of constructor hidden about the place which will allow me to make an rt_mx in the way I can get from a change_of_basis_op but from 9 numbers instead? Where |r| != 1.0?

Thanks again in advance,

Graeme

________________________________
From: cctbxbb-bounces at phenix-online.org [cctbxbb-bounces at phenix-online.org] on behalf of Graeme.Winter at diamond.ac.uk [Graeme.Winter at diamond.ac.uk]
Sent: 12 July 2011 15:17
To: cctbxbb at phenix-online.org
Subject: Re: [cctbxbb] Conversion from symmetry operation to matrix

Dear All,

Answered my own question:

Sgtbx.change_of_basis_op(op).c().as_double_array()

Etc. in case anyone is interested.

Best wishes,

Graeme

From: cctbxbb-bounces at phenix-online.org [mailto:cctbxbb-bounces at phenix-online.org] On Behalf Of Graeme.Winter at diamond.ac.uk
Sent: 12 July 2011 15:06
To: cctbxbb at phenix-online.org
Subject: [cctbxbb] Conversion from symmetry operation to matrix

Dear All,

For a little while now I have been using some cctbx jiffy code to convert from symmetry operations to matrices to help with testing reindexing data. This works as

def symop_to_mat(symop):
    return matrix.sqr(sgtbx.rt_mx(
        sgtbx.parse_string(symop)).as_double_array()[:9]).transpose().elems

Which is plenty simple. However it just exploded when given “1/2*z,-y+1/2*z,x”  - reasonably really as this is not a rotation. It is however a valid reindexing operation to go from C2 to P1.

Does anyone have code which will handle this general transformation from a reindexing operation to a matrix, which will cope with the fact that the resulting matrix is not RT? I had a little jiffy I wrote using ccp4f lib (symop2mat – you can probably see it!) but I am trying to do away with things like that and do everything properly…

Many thanks in advance,

Graeme

Dr. Graeme Winter
Senior Software Scientist
Diamond Light Source

+44 1235 778091 (work)
+44 7786 662784 (work mobile)






--

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






--

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



-- 
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
 





More information about the cctbxbb mailing list