Molecule Tutorials - Herong's Tutorial Examples - v1.21, by Dr. Herong Yang
Turn Structure around Camera
This section provides a tutorial on how to turn molecule structure around camera using the 'rotate' command with rotation origin specified in PyMol.
When you use the "turn" command in PyMol, you are actually turning the camera around a given rotation center in camera space.
By default, this rotation center is set to the center of the molecule structure. So the "turn" command turns the camera around the center of the molecule structure.
In some cases, we want to turn the camera around the camera itself, like how we use a camera in real life. But there is no PyMol to directly support this.
One work around is to use the "rotate" command, which allows you to specify the origin of the rotation. But the "rotate" command changes atom locations in the model space. You need to be careful when using it.
Below is the "rotate" command syntax showing the origin of the rotation origin given as the last argument:
rotate axis, angle[, selection[, state[, camera[, object[, origin]]]]]
Note that the "rotate" works in the model space. The rotation origin must be specified as model space coordinates. So if you want to use the camera (located at [0,0,0] in camera space) as the rotation origin, you need to map [0,0,0] from the camera space to the model space as described in the last tutorial.
The first argument, axis, specifies the rotation axis. It can be x, y, z or a vector like [1,0,0]
The fifth argument, camera, is 1 or 0, indicating the rotation axis is given in camera space or in model space.
Here are some examples of the "rotate" command:
# Rotate all atoms around y-axis in camera space for 30 degrees rotate y, 30, all, -1, 1 rotate y, 30 # Rotate all atoms around [1,1,0] axis and [1,1,0] center in model space rotate [1,1,0], 30, all, -1, 0, , [1,1,0]
Table of Contents