Glyph Commands

Glyph Commands

Add glyphs to atoms in the model.

[Note]See also:
  • Glyphs for information on glyph types and how they use vector data.

  • Glyph window for management of glyphs in the GUI.

autoellipsoids

Syntax:

void autoellipsoids(); 

Note: Experimental Feature!

Using the current atom selection, this command creates ellipsoid glyphs that cover (or represent) individual bound fragments within the selection. An ellipsoid glyph is added for each bound fragment within the selection, positioned at the geometric centre of the bound fragment, and scaled in an attempt to cover all atoms within the bound fragment. Such things are useful when wanting to represent molecules by simple geometric shapes, rather than by their fine-grained atomic positions.

For instance, given a box full of benzene molecules:

selectall();
autoellipsoids();

will add on a flattened ellipsoid to each individual molecule. To do the same thing but using only the ring carbons to generate the ellipsoids:

select("C");
autoellipsoids();

Now the ellipsoids will cover the carbon atoms in each ring, leaving the hydrogens poking out.

[Note]See also:

autopolyhedra

Syntax:

void autopolyhedra(options = ""); 
string  options = "";

Note: Very Experimental Feature!

In a similar way to the autoellipsoids command, 'autopolyhedra' adds triangle glyphs to the current selection in an attempt to enclose certain atoms within solid structures. There are two principal modes of operation. The first (the default) assumes that the current atom selection consists of individual atoms that should be enclosed in a polyhedron made up from triangles added between triplets of bound neighbours. The carbon atom at the centre of methane would make a good example. The alternative mode (requested with the 'fragments' option) assumes that atoms within individual bound fragments in the current selection should be used as the vertices to form an enclosed shell.

Possible options are:

Table 6.24. Autopolyhedra options

OptionEffect
centresAssume that the current selection consists of individual atomic centres that should be enclosed (the default).
fragmentsUse individual bound fragments instead of assuming individual centres.
nolinkDo not link the coordinates of generated glyphs to coordinates of the atoms (the default is to link glyph coordinates to atoms).
rcut=distanceSpecifies the maximum distance allowed between vertices of a triangle

[Note]See also:

glyphatomf

Syntax:

void glyphatomf(n); 
int  n;
void glyphatomf(n,  
 sourceatom); 
int  n;
atom|int  sourceatom;

Set current (or specified) atom's forces as data n in the current glyph.

For example:

glyphatomf(1);

links the current atoms forces to the first datum in the current glyph.

glyphatomr

Syntax:

void glyphatomr(n); 
int  n;
void glyphatomr(n,  
 sourceatom); 
int  n;
atom|int  sourceatom;

Set current (or specified) atom's position as data n in the current glyph.

For example:

glyphatomr(3, 55);

links the 55th atom's position to the third datum in the current glyph.

glyphatomv

Syntax:

void glyphatomv(n); 
int  n;
void glyphatomv(n,  
 sourceatom); 
int  n;
atom|int  sourceatom;

Set current (or specified) atom's velocity as data n in the current glyph.

For example:

atom i = newatom("H");
glyphatomv(2,i);

links the velocity of new atom i to the second datum in the current glyph.

glyphatomsf

Syntax:

void glyphatomsf(sourceatom,  
 ...); 
atom|int  sourceatom;
 ...;

Accepts one or more atoms, setting consecutive data in the current glyph to the forces of the atoms / atom IDs provided.

For example:

glyphatomsf(1, 2, 3);

links the forces of atoms 1, 2, and 3 to the first three glyph data.

glyphatomsr

Syntax:

void glyphatomsr(sourceatom,  
 ...); 
atom|int  sourceatom;
 ...;

Accepts one or more atoms, setting consecutive data in the current glyph to the positions of the atoms / atom IDs provided.

For example:

glyphatomsr(3, 10);

links the positions of atoms 3 and 10 to the first two glyph data.

glyphatomsv

Syntax:

void glyphatomsv(sourceatom,  
 ...); 
atom|int  sourceatom;
 ...;

Accepts one or more atoms, setting consecutive data in the current glyph to the velocities of the atoms / atom IDs provided.

For example:

glyphatomsv(9, 11, 13);

links the velocities of atoms 9, 11, and 13 to first three glyph data.

glyphcolour

Syntax:

void glyphcolour(n,  
 r,  
 g,  
 b,  
 alpha = 1.0); 
int  n;
double  r;
double  g;
double  b;
double  alpha = 1.0;

Set the colour of vertex n for the current glyph to the RGB(A) colour provided.

For example:

glyphcolour(1, 1.0, 0.0, 0.0);

sets the colour of the first vertex in the current glyph to red.

glyphdata

Syntax:

void glyphdata(n,  
 r,  
 g,  
 b); 
int  n;
double  r;
double  g;
double  b;

Set vector data n for the current glyph to the fixed values provided.

For example:

glyphdata(1, 0.0, 5.0, 2.4);

sets the first positional data in the glyph to {0.0, 5.0, 2.4}.

glyphsolid

Syntax:

void glyphsolid(issolid); 
bool  issolid;

Sets the drawing style of the current glyph to solid (true) or wireframe (false) (if the glyph style permits).

For example:

glyphsolid("true");

glyphtext

Syntax:

void glyphtext(text); 
string  text;

Set the text data in the current glyph. For text-style glyphs, this is of course useful! For others, whether or not the text is used depends on the style of the glyph.

For example:

glyphtext("Coordinate Origin");

newglyph

Syntax:

glyph newglyph(style,  
 options = ""); 
string  style;
string  options = "";

Create a new glyph of the specified style, and make it current. The colour of the glyph is set using the default glyph colour set in the global preferences. Valid glyph styles are listed in the Glyphs section. Positional / size / scale vector data should be set afterwards with appropriate 'glyphatom*' and 'glyphdata' commands.

One or more options may be given to the command. The list of possible options is:

Table 6.25. Newglyph options

OptionEffect
linewidth=widthSet the linewidth used to draw the glyph to the (floating point) value provided.
solidRender the glyph in solid mode (if the glyph supports it). Same as calling glyphsolid(TRUE) after creation.
text=stringSet the character data associated to the glyph to string. Currently, this has no effect for glyphs other than those that display text.
wireRender the glyph in wireframe mode (if the glyph supports it). Same as calling glyphsolid(FALSE) after creation.

For example:

newglyph("cube");

creates a new cube in the model.

newglyph("text","text=\"I am some text\"");

creates a new text glyph in the model, reading 'I am some text'. Note the need to escape the quotes surrounding the text.

newglyph("tetrahedron", "wire");

creates a new wireframe tetrahedron in the model.