Re: [PyMOL] How to get TTT matrix in PyMOL 1.7.6?

2015-08-18 Thread Paweł Tomaszewski
Thanks Jared,
I have tried the script, and here is what I've got:
- I get a quaternions from external source (a 3d manipulator) in a
classical form: [x,y,z,w]
- I use function: quaternion_matrix(quaternion) from

m = quaternion_matrix([x, y, z, w])# m is an array of an arrays (4x4)
M = [m[0,0], m[0,1], m[0,2], m[0,3], m[1,0], m[1,1], m[1,2], m[1,3],
m[2,0], m[2,1], m[2,2], m[2,3], m[3,0], m[3,1], m[3,2], m[3,3]]   # so i
need to convert it to a vector 16x1
cmd.transform_selection(all, M, homogenous=1)  # its time to apply the
vector into a transform_selection function; homogenous=0 also doesn't work
print M # print works fine ;)

But the function transform_selection does not work and I don't really know
why, rotation doesn't occur.
Maybe it's because the selection is wrong? On the scene I have a CGO (an
arrow) and even when I change the selection string from all to arrow it
doesn't rotate either.
What exactly is the selection, could this be a CGO?

I have also noticed, that function cmd.rotate(...) works for my CGO arrow
when I set property object=arrow and I put some arbitrary hardcoded
parameters (axis and angle).
Maybe the better way would be use this function?
But I'm not really sure which function from script
should I use to convert quaternions to axis and angle params required by
cmd.rotate() function...
any ideas?

Pawel T.

2015-08-13 18:34 GMT+02:00 Sampson, Jared

 Hi Paweł -

 Honestly, if you prefer to use matrices, I'd say just go ahead and use
 get_object_matrix; I doubt it's going away any time soon.  You may want to
 use this in combination with transform_selection

 Also maybe check out Christoph Gohlke's script  It offers several
 tools for manipulating quaternions, matrices, and angle/axis operations.  I
 think there's also a newer version on his website, which is linked from the
 wiki page.


 Jared Sampson
 Xiangpeng Kong Lab
 NYU Langone Medical Center

 On Aug 6, 2015, at 4:04 AM, Paweł Tomaszewski wrote:

 I've created a CGO in pymol script (a cone) and I need to make some
 transformations on it. I've found that it is easier for me to modify a TTT
 matrix rather than using translate/rotate functions.

 Documentation says []
 get_object_matrix is unsupported operation. So how to get/set TTT?

 The problem is, that I get (from external source) position in quaternions
 and now I need to make my CGO position equal to those quaternion. How can I
 make it work?

 Paweł Tomaszewski

 PyMOL-users mailing list (
 Info Page:

 This email message, including any attachments, is for the sole use of the
 intended recipient(s) and may contain information that is proprietary,
 confidential, and exempt from disclosure under applicable law. Any
 unauthorized review, use, disclosure, or distribution is prohibited. If you
 have received this email in error please notify the sender by return email
 and delete the original message. Please note, the recipient should check
 this email and any attachments for the presence of viruses. The
 organization accepts no liability for any damage caused by any virus
 transmitted by this email.

PyMOL-users mailing list (
Info Page:

Re: [PyMOL] Pymol crash when raytracing empty graphics

2015-08-18 Thread Spencer Bliven
Thanks for the quick fix! I would love to get a hotfix if possible.

The PDBe API is a nice solution. I think that detecting CA traces will fix
90% of the cases. There are still a few edge cases besides CA which don't
have a cartoon mode (e.g. 1hzs, which has a polydeoxyribonucleotide polymer
type but lacks phosphate atoms needed for cartoon), but these are rare
enough to be handled individually.


On Mon, Aug 17, 2015 at 7:54 PM, Thomas Holder wrote:

 Hi Spencer,

 Thank you for the bug report. We could reproduce and fix the crash, if you
 want I can send you a hotfix build. I will also push the fix to the open
 source SVN repository soon.

 I second John's suggestions to query the ca_p_only property from the
 PDBe API. Also, the next PyMOL version will read that property from the
 mmCIF file and automatically set the cartoon_trace_atoms and
 ribbon_trace_atoms settings.


 On 17 Aug 2015, at 10:58, John Berrisford wrote:

  Dear Spencer
  It is possible to work this out using the PDBe API.
  for our interactive API see:
  The molecules url will give you this information:
  entity 1 has ca_p_only: true,
  which means cartoon will not work for this chain - so we use ribbon
 instead with the command
  pymol.cmd.set(ribbon_trace_atoms, 1)
  This test allows us to make images such as those shown on the entry page
 for 1a1q at PDBe
  The images are made with pymol (currently 1.6, but also works in 1.7)
  On Monday 17 August 2015 15:40:14 Spencer Bliven wrote:
   We have a pipeline that uses pymol to create images using the headless
   command line interface. I've discovered that PyMOL 1.7.4 and 1.7.6 (at
   least) crash if you try to ray-trace an empty viewport.
   pymol -q -c -d 'fetch 1a1q,async=0;as cartoon;ray'
   This particular example only has CA atoms, so the cartoon mode doesn't
   anything. In interactive mode I would `set cartoon_trace_atoms,1` but
   batch processing there isn't a good way of detecting whether anything
   showing or not.
   The error is:
   *** glibc detected ***
   /home/user/software/packages/pymol-v1.7.4.4/pymol.exe: double free or
   corruption (out): 0x7f11f8744f40 ***
   I've reproduced the error on Redhat 6 and Ubuntu 14.04, with PyMOL
   Attached is a stack trace.
   Any suggestions on ensuring that there are some polygons in frame would
   also be appreciated. Say, if there was a way to detect that cartoon
   fail so that I can switch to a lines or nonbonded representation (I
   that was the default fallback for cartoon).
  John Berrisford
  European Bioinformatics Institute (EMBL-EBI)
  European Molecular Biology Laboratory
  Wellcome Trust Genome Campus
  Cambridge CB10 1SD UK
  Tel: +44 1223 492529

 Thomas Holder
 PyMOL Principal Developer
 Schrödinger, Inc.

 PyMOL-users mailing list (
 Info Page:

PyMOL-users mailing list (
Info Page: