VMD Tutorial-Graphics Matrix

Introductions

VMD is a 3D graphic display program, mainly used for displaying simple molecular structures, not so much for overly complex 3D models. The graphics behind it are similar to those of a typical 3D modeling or rendering program, but there are some differences. Here we look in more detail at how VMD displays a set of atomic coordinates on the screen, given a set of atomic coordinates. This involves a lot of matrix transformations, which are part of computer graphics, so consider this a study of computer graphics.

Spaces Classification

  • Model space M, also called object space, local space: the space where the model itself is located, that is, the coordinate system used to create the model, often referred to as the principal axis system. For molecules, this is the coordinate system used to define the molecular coordinates.
  • World space W, also known as global space: The space in which all objects in the scene, such as models, light sources, cameras, etc., reside. It is often used to represent the spatial relationships between objects to be rendered. W is a higher level than M. Models can be translated, rotated, and scaled in W space, so their coordinates in W space will generally be different from their values in M space.
  • Camera space C, also called observation space: similar to W, but its origin is the camera or the observer, and the camera (line of sight) direction is usually taken as the Z-axis. The final image displayed on the screen is observed by a camera, and the space used by the camera for observation is the camera space, which depends on the position and orientation of the camera in the world space.

Tutorial

We take a simple molecular model as an example:

1 4
2 mol
3 C 0 0 0
4 O 1 0 0
5 C1 0 1 0
6 N 0 0 1

Loading this molecule into the VMD, the VMD displays the following:

VMD Tutorial-Graphics Matrix

Left: set the axis at the lower left; Right: set the axis at the origin

Here we use the tcl script to get several matrices used by VMD

Center Matrix

1 > set C [molinfo top get center_matrix]
2 {{1 0 0 -0.25} {0 1 0 -0.25} {0 0 1 -0.25} {0 0 0 1}}

This represents the shift of the origin of the molecular model space with respect to the origin of the world space, and since the origin of the world space is the geometric center of the molecule, it is also the shift of the origin of the molecular model space with respect to its geometric center.

Rotation matrix

1 > set R [molinfo top get rotate_matrix]
2 {{1 0 0 0} {0 1 0 0} {0 0 1 0} {0 0 0 1}}

This is the unit matrix, because we have not done any rotation yet. If the numerator is rotated using the mouse or the rotate command, the rotate_matrix matrix will be changed.

Scale Matrix

1 > S [molinfo top get scale_matrix]
2 {{1.5 0 0 0} {0 1.5 0 0} {0 0 1.5 0} {0 0 0 1}}

This is the default zoom size, depending on the size of the molecule, and the VMD defaults to an appropriate zoom factor to ensure that the entire molecule is visible. If the mouse wheel is used to zoom in and out, the corresponding matrix will change.

Global Matrix

1 > set G [molinfo top get global_matrix]
2 {{1 0 0 0} {0 1 0 0} {0 0 1 0} {0 0 0 1}}

This is also the unit matrix, because we have not done any translation yet. If a translation is performed, the global matrix will change. Note that only the translation part of the global matrix works, the rotation part cannot be changed by mouse or menu.

Conclusions

Given a set of atomic coordinates, the origin of the world coordinate system is taken to be the geometric center of the set of atomic coordinates, the orientation of the world coordinate system is the same as the orientation of the atomic model coordinate system, and the camera coordinate system coincides with the world coordinate system, with the X and Y axes inside the screen and the Z axis perpendicular to the screen and outward. This is the default setting for most molecular display programs.

Related Links

Applications of Visual Molecular Dynamics Software

* For Research Use Only.

Inquiry