Coordinate Systems

From Jmol
Revision as of 10:55, 23 August 2018 by AngelHerraez (talk | contribs) (documenting screen coordinates)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Coordinate systems in Jmol

When a file is loaded, the model contains a 3D space system of coordinates and the values of x,y,z for every atom. This coordinate system is inherent to the model. If you load several models, each one brings its own coordinates, so you will usually see both models positioned very far apart, or sometimes overlapping.

Jmol uses this 3D coordinates for all the operations.

Some commands, however, refer to a 2D space, the projection that the observer sees; these are the "screen coordinates".

Retrieving 3D coordinates

The position of the origin and the orientation of the x,y,z axes may be anyone with respect to the viewer (i.e. the screen display) when a model file is loaded. The command axes on will let you check those.

Examples of how to check the coordinates of an atom: (p1 is a variable used to hold the values and print allows to see its value)

p1 = {atomNo=6}.xyz;
print p1.x;
print p1.y;
print p1.z;

p1 = {atomNo=6}.x;
print p1;
p1 = {atomNo=6}.y;
print p1;
p1 = {atomNo=6}.z;
print p1;

Retrieving screen coordinates

Screen coordinates sx,sy,sz are defined as:

  • sx from the left border
  • sy from the bottom border
  • sz from the front (small sz for positions at the front, near the observer; large sz for positions at the rear, far from the observer)
p2 = {atomNo=6}.sx;
print p2;
p2 = {atomNo=6}.sy;
print p2;
p2 = {atomNo=6}.sz;
print p2;

Converting between 3D coordinates and screen coordinates

Contributors

AngelHerraez