This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Set The View From A Particular Angle (Plane) In Pymol?

Is there a way of selecting a particular position from the camera? I want to set 3 views: top, side and front. In other words, one view per plane: XY, YZ and XZ.

I tried using rotate or turn but the angle you can set for the rotation is not absolute to the space.

pymol

2 answers

You can use set_view to set up a viewing matrix (cf. here for the rotation part).

If you don't know the theory behind matrix transformation, then using get_view, rotate, and set_view together might be easier than constructing the matrix yourself.

Thanks I'll learn the theory and give it a go.

You can use quaternions. It is a quite difficult when you start to use it but it is very useful.

Here I paste some lines from one code I made some time ago. I hope it help you.

What I do is to add some lines to a pymol script. Basically I trace a vector from the c-terminal to the n-terminal and align this vector with one of the axis of the screen.

There is more help in the web if you search for quaternion use.


system 'echo q = quaternion\\(script\\(\"show rotation\"\\)\\) >>'." $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo toAtom = {$Length.CA}.xyz - {1.CA}.xyz  >> $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo toUser = \\(!q\\)\%{1 0 0}  >> $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo axis = cross\\(toAtom, toUser\\) >> $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo a = angle\\(toAtom, {0 0 0}, axis, toUser\\) >> $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo rotate MOLECULAR {0 0 0} \@axis \@a >> $Pdb\_$Chain.pdb_cfrst.jmol";
system "echo center >> $Pdb\_$Chain.pdb_cfrst.jmol";

Best

There's no need for quaternions here IMO. And yes, I do know what they are.

Log in to answer this question.