Transform Commands

Transform Commands

Commands to transform the current selection of the model.

axisrotate

Syntax:

void axisrotate(i,  
 i,  
 theta); 
atom|int  i;
atom|int  i;
double  theta;
void axisrotate(i,  
 i,  
 theta,  
 ox,  
 oy,  
 oz); 
atom|int  i;
atom|int  i;
double  theta;
double  ox;
double  oy;
double  oz;
void axisrotate(,  
 y,  
 z,  
 theta); 
double  ;
double  y;
double  z;
double  theta;
void axisrotate(,  
 y,  
 z,  
 theta,  
 ox,  
 oy,  
 oz); 
double  ;
double  y;
double  z;
double  theta;
double  ox;
double  oy;
double  oz;

Rotate the current selection by an angle theta (in degrees) about an axis defined either by the vector between two atom IDs or the vector components provided. If supplied, the rotation is performed using the coordinate origin specified by ox, oy, and oz, otherwise {0,0,0} is assumed.

For example:

axisrotate(4, 5, 90.0);

rotates the current selection 90 degrees about the axis formed by the vector between atom ids 4 and 5 (4->5).

axisrotate(0, 1, 0, -52.0);

rotates the current selection -52 degrees about the y-axis.

axisrotate(0, 1, 0, -52.0, 4.0, 4.0, 4.0);

rotates the current selection -52 degrees about the y-axis, but with the rotation centre at {4.0,4.0,4.0}.

centre

Syntax:

void centre(x,  
 y,  
 z,  
 lockx = FALSE,  
 locky = FALSE,  
 lockz = FALSE); 
double  x;
double  y;
double  z;
bool  lockx = FALSE;
bool  locky = FALSE;
bool  lockz = FALSE;

Centre the current atom selection at the specified coordinates. The three optional arguments lockx, locky, and lockz specify one or more atomic coordinates that are to remain unchanged during the transformation.

For example:

centre(0.0, 0.0, 15.0);

centres the current selection at the coordinates (0 0 15).

flipx

Syntax:

void flipx(); 

Flip (negate) the x-coordinates of the current selection.

For example:

flipx();

flipy

Syntax:

void flipy(); 

Flip (negate) the y-coordinates of the current selection.

For example:

flipy();

flipz

Syntax:

void flipz(); 

Flip (negate) the z-coordinates of the current selection.

For example:

flipz();

matrixconvert

Syntax:

void matrixconvert(i_sx,  
 j_sx,  
 i_sy,  
 j_sy,  
 i_sz,  
 j_sz,  
 i_tx,  
 j_tx,  
 i_ty,  
 j_ty,  
 i_tz,  
 j_tz); 
int  i_sx;
int  j_sx;
int  i_sy;
int  j_sy;
int  i_sz;
int  j_sz;
int  i_tx;
int  j_tx;
int  i_ty;
int  j_ty;
int  i_tz;
int  j_tz;
void matrixconvert(i_sx,  
 j_sx,  
 i_sy,  
 j_sy,  
 i_sz,  
 j_sz,  
 i_tx,  
 j_tx,  
 i_ty,  
 j_ty,  
 i_tz,  
 j_tz,  
 oy,  
 oz,  
 oz); 
int  i_sx;
int  j_sx;
int  i_sy;
int  j_sy;
int  i_sz;
int  j_sz;
int  i_tx;
int  j_tx;
int  i_ty;
int  j_ty;
int  i_tz;
int  j_tz;
double  oy;
double  oz;
double  oz;
void matrixconvert(s_ax,  
 s_ay,  
 s_az,  
 s_bx,  
 s_by,  
 s_bz,  
 s_cx,  
 s_cy,  
 s_cz,  
 t_ax,  
 t_ay,  
 t_az,  
 t_bx,  
 t_by,  
 t_bz,  
 t_cx,  
 t_cy,  
 t_cz); 
double  s_ax;
double  s_ay;
double  s_az;
double  s_bx;
double  s_by;
double  s_bz;
double  s_cx;
double  s_cy;
double  s_cz;
double  t_ax;
double  t_ay;
double  t_az;
double  t_bx;
double  t_by;
double  t_bz;
double  t_cx;
double  t_cy;
double  t_cz;
void matrixconvert(s_ax,  
 s_ay,  
 s_az,  
 s_bx,  
 s_by,  
 s_bz,  
 s_cx,  
 s_cy,  
 s_cz,  
 t_ax,  
 t_ay,  
 t_az,  
 t_bx,  
 t_by,  
 t_bz,  
 t_cx,  
 t_cy,  
 t_cz,  
 oy,  
 oz,  
 oz); 
double  s_ax;
double  s_ay;
double  s_az;
double  s_bx;
double  s_by;
double  s_bz;
double  s_cx;
double  s_cy;
double  s_cz;
double  t_ax;
double  t_ay;
double  t_az;
double  t_bx;
double  t_by;
double  t_bz;
double  t_cx;
double  t_cy;
double  t_cz;
double  oy;
double  oz;
double  oz;

From a defined frame of reference (i.e. a set of axes defining the spatial orientation), rotate the current selection from this frame into the second frame, using the coordinate origin supplied or {0,0,0} by default. In the first form six pairs of atom IDs define each matrix, with the vectors taken to be i->j in all cases (normalised to 1.0), and specifying the x, y, and z axes in turn. In the second, the matrices are given as two sets of nine numbers that define the vectors of the axes.

When supplying atom IDs, the x axis is taken to be absolute, the y-axis is orthogonalised w.r.t. the x-axis, and the z-axis is taken as the cross product between the x and y axes. Note that providing the definition of the z axis is still important, however, since the vector cross product is adjusted (if necessary) to point along the same direction as this supplied z-axis. When supplying the complete matrices no orthogonalisation or normalisation of the axes is performed (permitting arbitrary scale and shear operations).

For example:

matrixconvert(1, 2, 1, 3, 1, 4, 10, 11, 12, 13, 14, 15);

defines a the current selection's frame of reference as (in terms of atom IDs) X=(1->2), Y=(1->3), and Z=(1->4), which will be rotated such that it corresponds to the new frame of reference (again defined by atom IDs) X=(10->11), Y=(12->13), and Z=(14->15).

matrixconvert -0.7348 -0.0192 -0.678 0.4979 0.6635 -0.5584 0.4606 -0.7479 -0.47801 1 0 0 0 1 0 0 0 1 

defines a the current selection's frame of reference as the vectors X={-0.7348, -0.0192, -0.678}, Y={0.4979, 0.6635, -0.5584}, and Z={0.4606, -0.7479, -0.47801}, which will be rotated into the standard reference frame.

[Note]See also:

matrixtransform

Syntax:

void matrixtransform(ax,  
 ay,  
 az,  
 bx,  
 by,  
 bz,  
 cx,  
 cy,  
 cz); 
double  ax;
double  ay;
double  az;
double  bx;
double  by;
double  bz;
double  cx;
double  cy;
double  cz;
void matrixtransform(ax,  
 ay,  
 az,  
 bx,  
 by,  
 bz,  
 cx,  
 cy,  
 cz,  
 ox,  
 oy,  
 oz); 
double  ax;
double  ay;
double  az;
double  bx;
double  by;
double  bz;
double  cx;
double  cy;
double  cz;
double  ox;
double  oy;
double  oz;

Transform the current selection by applying the defined matrix to each coordinate, operating about the supplied origin (or {0,0,0} by default). No orthogonalisation or normalisation of the defined axes is performed.

For example:

matrixtransform(1, 0, 0, 0, 1, 0, 0, 0, 1);

does absolutely nothing (multiplying by the identity matrix).

matrixtransform(1, 0, 0, 0, 1, 0, 0, 0, -1);

mirrors the current selection in the xy plane.

matrixtransform(0.5, 0, 0, 0, 0.5, 0, 0, 0, -1);

scales the x and y-coordinates of all selected atoms by 0.5, leaving the z coordinates intact.

reorient

Syntax:

void reorient(i_sx,  
 j_sx,  
 i_sy,  
 j_sy,  
 i_sz,  
 j_sz,  
 t_ax,  
 t_ay,  
 t_az,  
 t_bx,  
 t_by,  
 t_bz,  
 t_cx,  
 t_cy,  
 t_cz); 
atom|int  i_sx;
atom|int  j_sx;
atom|int  i_sy;
atom|int  j_sy;
atom|int  i_sz;
atom|int  j_sz;
double  t_ax;
double  t_ay;
double  t_az;
double  t_bx;
double  t_by;
double  t_bz;
double  t_cx;
double  t_cy;
double  t_cz;
void reorient(i_sx,  
 j_sx,  
 i_sy,  
 j_sy,  
 i_sz,  
 j_sz,  
 t_ax,  
 t_ay,  
 t_az,  
 t_bx,  
 t_by,  
 t_bz,  
 t_cx,  
 t_cy,  
 t_cz,  
 ox,  
 oy,  
 oz); 
atom|int  i_sx;
atom|int  j_sx;
atom|int  i_sy;
atom|int  j_sy;
atom|int  i_sz;
atom|int  j_sz;
double  t_ax;
double  t_ay;
double  t_az;
double  t_bx;
double  t_by;
double  t_bz;
double  t_cx;
double  t_cy;
double  t_cz;
double  ox;
double  oy;
double  oz;

Operates in exactly the same manner as matrixtransform except that the source matrix is defined from atoms (or their IDs) and the destination matrix is provided as a matrix.

setdistance

Syntax:

void setdistance(i,  
 j,  
 dist); 
atom|int  i;
atom|int  j;
double  dist;

Shifts the atom j and all its direct and indirectly-bound neighbours (except i) so that the distance between i and j is dist. The coordinates of atom i remain unaffected.

This operation can only be performed for atoms which are not present in the same cyclic structure, e.g. trying to set the distance of two atoms in a benzene ring is not allowed. However, note that the two atoms i and j do not have to be bound, so it is possible to move separate fragments further apart by this method.

For example:

setdistance(1,4,4.9);

sets the distance between atoms 1 and 4 to be 4.9 Å.

translate

Syntax:

void translate(dx,  
 dy,  
 dz); 
double  dx;
double  dy;
double  dz;

Translates the current selection by the specified vector.

For example:

translate(1, 0, 0);

moves the current selection 1 Å along the x axis.

translateatom

Syntax:

void translateatom(dx,  
 dy,  
 dz); 
double  dx;
double  dy;
double  dz;

Translates the current atom by the specified vector.

For example:

translateatom(1, 0, -1);

translates the current atom 1 Å along x and -1 Å along z.

translatecell

Syntax:

void translatecell(fracx,  
 fracy,  
 fracz); 
double  fracx;
double  fracy;
double  fracz;

Translates the current selection by the fractional cell vectors specified. The model must have a unit cell for this command to work.

For example:

translatecell(0, 0.5, 0);

translates the current selection by an amount equivalent to half of the current cell's B vector.

translateworld

Syntax:

void translateworld(dx,  
 dy,  
 dz); 
double  dx;
double  dy;
double  dz;

Translates the current selection by the Å amounts specified, with the XY plane parallel to the monitor screen.

For example:

translateworld(0, 0, 10);

translates the current selection 10 Å 'into' the screen.

mirror

Syntax:

void mirror(axis); 
string  axis;

Mirror the current selection in the specified plane about its geometric centre.

For example:

mirror("y");

mirrors the current selection about the y axis.