Building Commands

Building Commands

Tools to build molecules from scratch, or finalise unfinished models. When creating atoms using the commands listed below, if the coordinates of the new atom are not specified then it is placed at the current pen position. In addition, the reference frame of the pen position is represented as a set of three orthogonal vectors defining the pen's local coordinate system (set initially to the Cartesian axes) centred at an arbitrary origin (the pen position). Subsequent rotations operate on these coordinate axes. Think of it as a 3D version of the old-school turtle.

addhydrogen

Syntax:

void addhydrogen(); 
void addhydrogen(i); 
atom|int  i;

Satisfy the valencies of all atoms in the current model by adding hydrogens to heavy atoms. If an integer id or atom reference is provided as the argument then the addition of hydrogen is restricted to the specified atom.

For example:

addhydrogen();

add hydrogens to all atoms in the current model.

addhydrogen(10);

add hydrogens to atom 10 only.

bohr

Syntax:

void bohr(x,  
 ...); 
object  x;
 ...;

Converts the specified object(s) data to Å, assuming that it is currently specified in Bohr.

For example:

atom i = aten.model.atoms[2];
bohr(i);

converts the coordinates of the supplied atom from Bohr to Å.

chain

Syntax:

atom chain(el); 
int|string  el;
atom chain(el,  
 bondtype); 
int|string  el;
int|string  bondtype;
atom chain(el,  
 x,  
 y,  
 z); 
int|string  el;
double  x;
double  y;
double  z;
atom chain(el,  
 x,  
 y,  
 z,  
 bondtype); 
int|string  el;
double  x;
double  y;
double  z;
int|string  bondtype;

Create a new atom of element el at the current pen position (or the specified coordinates) bound to the last drawn atom with a single bond (or of type bondtype if it was specified). The element can be provided as a character string containing the element symbol or element name instead of the integer atomic number. A reference to the new atom is returned.

For example:

atom i = chain("C");

places a carbon atom at the current pen coordinates, and creates a single bond with the last drawn atom.

atom i = chain(8, "double");

places an oxygen atom at the current pen coordinates, and creates a double bond with the last drawn atom.

atom i = chain("Cl", 4.0, 5.0, 6.0, "single");

creates a chlorine at coordinates { 4.0, 5.0, 6.0 }, joined by a single bond to the last drawn atom.

endchain

Syntax:

void endchain(); 

Ends the current chain (so that the next atom drawn with 'chain' will be unbound).

For example:

endchain();

locate

Syntax:

void locate(x,  
 y,  
 z); 
double  x;
double  y;
double  z;

Sets the pen position to the coordinates specified (in Å).

For example:

locate(0.0, 0.0, 0.0);

moves the pen back to the coordinate origin.

move

Syntax:

void move(x,  
 y,  
 z); 
double  x;
double  y;
double  z;

Moves the pen position by the amounts specified (in Å).

For example:

move(1.0, 1.0, 0.0);

moves the pen +1 Angstrom in both the x and y directions.

movetoend

Syntax:

void movetoend(); 

Move the current atom selection to the end of the list. The relative order of atoms in the selection is preserved.

For example:

movetoend();

movetostart

Syntax:

void movetostart(); 

Move the current atom selection to the start of the list. The relative order of the atoms in the selection is preserved.

For example:

movetostart();

newatom

Syntax:

void newatom(el); 
int|string  el;
void newatom(el,  
 x,  
 y,  
 z); 
int|string  el;
double  x;
double  y;
double  z;
void newatom(el,  
 x,  
 y,  
 z,  
 vx,  
 vy,  
 vz); 
int|string  el;
double  x;
double  y;
double  z;
double  vx;
double  vy;
double  vz;
void newatom(el,  
 x,  
 y,  
 z,  
 vx,  
 vy,  
 vz,  
 fx,  
 fy,  
 fz); 
int|string  el;
double  x;
double  y;
double  z;
double  vx;
double  vy;
double  vz;
double  fx;
double  fy;
double  fz;

Create a new atom of element el at the current pen position or, if provided, the specified coordinates (and optional velocities or velocities and forces). Either the integer atomic number or the symbol/name of the element may be used to identify the desired element. A reference to the new atom is returned.

For example:

atom i = newatom("N");

places a nitrogen atom at the current pen coordinates.

atom i = newatom(18, 5.2, 0, 0);

places an argon atom at the coordinates { 5.2, 0.0, 0.0 }.

newatomfrac

Syntax:

void newatomfrac(el,  
 x,  
 y,  
 z); 
int|string  el;
double  x;
double  y;
double  z;
void newatomfrac(el,  
 x,  
 y,  
 z,  
 vx,  
 vy,  
 vz); 
int|string  el;
double  x;
double  y;
double  z;
double  vx;
double  vy;
double  vz;
void newatomfrac(el,  
 x,  
 y,  
 z,  
 vx,  
 vy,  
 vz,  
 fx,  
 fy,  
 fz); 
int|string  el;
double  x;
double  y;
double  z;
double  vx;
double  vy;
double  vz;
double  fx;
double  fy;
double  fz;

Create a new atom of element el at the specified fractional coordinates (velocities and forces are optional). Either the integer atomic number or the symbol/name of the element may be used to identify the desired element. A reference to the new atom is returned.

For example:

atom i = newatomfrac("C", 0.5, 0.5, 0.5);

places a carbon atom at the centre of the model's cell.

reorder

Syntax:

void reorder(); 

Adjust the ordering of atoms in the current selection such that atoms in bound fragments/molecules have successive IDs. Useful to recover 'molecularity' in order to apply a suitable pattern description to the system.

For example:

reorder();

rotx

Syntax:

void rotx(angle); 
double  angle;

Rotates the reference coordinate system about the x axis by angle degrees.

For example:

rotx(90.0);

rotates around the x axis by 90 degrees.

roty

Syntax:

void roty(angle); 
double  angle;

Rotates the reference coordinate system about the y axis by angle degrees.

For example:

roty(45.0);

rotates around the y axis by 45 degrees.

rotz

Syntax:

void rotz(angle); 
double  angle;

Rotates the reference coordinate system about the z axis by angle degrees.

For example:

rotz(109.5);

rotates around the z axis by 109.5 degrees.

shiftdown

Syntax:

void shiftdown(); 
void shiftdown(n); 
int  n;

Move the current atom selection one (or n) places down in the atom list (i.e. towards higher IDs).

For example:

shiftdown(4);

moves the current atom selection down four places.

shiftup

Syntax:

void shiftup(); 
void shiftup(n); 
int  n;

Move the current atom selection one (or n) places up in the atom list (i.e. towards lower IDs).

For example:

shiftup();

moves the current atom selection up one place.

transmute

Syntax:

void transmute(el); 
int|string  el;

Transmute the current atom selection to the specified element.

For example:

transmute("F");

changes all atoms in the current selection to fluorine.

transmute(Cl);

changes all atoms in the current selection to chlorine.

transmute(6);

changes all atoms in the current selection to carbon