Model Space and Camera Space

From PyMOLWiki
Jump to: navigation, search

Objects are defined in a Cartesian coordinate system, i.e. as xyz coordinates for each atom (or surface point or corner or...). This coordinate system is model space. To make objects visible, PyMOL places a "camera" such that it sees most of the molecule. The picture that is shown on the screen is the image that is "taken" by the camera. Initially, after loading an object, the camera is placed such that it looks on the object parallel to the model's z axis. The model's x and y axes are horizontal and vertical, respectively. So, initially, the model axes correspond to the physical directions of the screen: x and y are horizontal and vertical, z is perpendicular to the screen.

In normal operation, to change the view, the camera is moved and the view of all objects is changed simultaneously; that is, the objects are not moved relative to one other. After changing the view, the x, y and z axes of model space no longer correspond to the directions of the screen. The commands turn, move, center, zoom, and orient, as well as mouse action in viewing mode, can be used to move the camera in object space.

For easy description of object movement relative to the camera, an additional coordinate system is defined: Camera space. The camera is situated in the origin of camera space, x and y are horizontal respectively vertical and z is the viewing direction. Camera space always corresponds to the physical directions of the screen--x and y are horizontal and vertical, and z is perpendicular to the screen. The relation between camera space and model space is described in the view matrix (see get_view).

Changing the coordinates in model space is only necessary when objects must be moved relative to each other or when the transformed coordinates are to be written into a file. Model space coordinates can be changed with the commands rotate, translate, and transform_selection, or with the mouse in editing mode.

Space and File saving

When model coordinates are saved (e.g. as a pdb file), PyMOL uses model space coordinates. In contrast, when a specific view is saved as PovRay or vrml, camera space coordinates are used (unless geometry_export_mode is turned on, in which case no camera or lighting information is included in the output file).

When image files in model space coordinates are needed, first choose colors and representations as needed, then align camera space to model space:

set_view (\
     1,    0,    0,\
     0,    1,    0,\
     0,    0,    1,\
     0,    0,    0,\
     0,    0,    0,\
     0,    300,  1 )

After setting the view, the molecule will probably be out of sight but will be saved to the file nonetheless. This can be used e.g. to receive a list of surface points in model space.

See Also

turn, move, center, zoom, orient, rotate, translate, Transform_selection, Get_View