Explicit values such as numbers, colours and 3D vectors are used as part of commands or state changes. The specifications described here are therefore just syntax fragments, not complete commands.
The logical (or boolean) explicit values are used to set some parameters and in a few commands.
String values are used in the label command, the read command and a few others. A string value is enclosed by double-quote '"' characters. It cannot contain the newline character (line breaks), which means that a string cannot be split into more than one line in the input file. The maximum length of a string is currently 2047 characters. The double-quote character '"' itself may be included in a string by escaping it with the backslash character: '\"'.
As a special case, a string which contains no blank characters, such as tabs or spaces, may be used without the double-quotes. This kind of string is called an identifier. There are several restrictions on it: there must be no blank characters in it, it must not contain characters that are special in a MolScript input file (semi-colon ';', curly brackets '{' '}'), and it cannot be equal to a command keyword. Typically, file names are identifiers.
Any item that is a valid numerical value for the standard library routines in the C programming language is also a valid number in MolScript. Some examples:
1.2
0.3e1
-1.44E1
-1000
Some invalid numbers:
.2
1E2
Note that in contrast to previous versions of MolScript (v1.4 and older), it is now allowed to give an integer value when a floating-point value is expected. The integer is automatically converted into a floating-point value. However, when an integer is expected, a floating point value is invalid.
A vector (or coordinate) can be specified either by an explicit
triplet of numbers, or by the keyword position given with
an atom selection.
A vector specified by explicit x, y and z values, is given by three numbers without separating commas. The values in a vector must be valid numbers. For example, the labeloffset parameter is a vector parameter, so to change it give the following command:
set labeloffset 0 0.5 -0.8;
A vector may be specified by giving an atom selection after the
keyword position. This will compute the geometrical
centre-of-gravity of the atoms as the vector value. All atoms in the
selection have the same weight. Note that in the
transform command, this
computation is done before any of the transformations
have been applied.
Note that the atom selection must contain at least one atom, or an error will result.
Colours can be specified by a name, by greyscale, by the RGB (red, green, blue) system, or by the HSB (hue, saturation, brightness) system.
The colour system within MolScript unfortunately cannot guarantee that the appearance of a given colour specification will be the same in different output formats when displayed on different hardware.
The value in the greyscale specification ranges from 0.0 (black) to 1.0 (white), inclusive.
The values in the RGB specification denote the amount of red, green and blue, respectively, colour components to use in the colour. Each value ranges from 0.0 to 1.0, inclusive.
The values in the HSB specification denote the hue, saturation and brightness values for a colour. These values must all be within the range from 0.0 to 1.0, inclusive.
There are a total of 164 colour names defined in MolScript. They are just symbolic constants for ordinary colour specifications in the greyscale (white and black) or RGB systems (all others).
An alphabetical list of defined colour names is given here .
Note: the colour purple is no longer the same as magenta.
A colour ramp defines a continuously changing scale of colours. Colour ramps are used for the atomcolour and residuecolour parameters.
The ramp is defined by the two end-point colours. The actual result is crucially dependent on the colour space in which the ramp is defined. This is determined by the colourramp parameter. The reason for this is that the ramp is computed by linear interpolation of each colour component in the end-point colours. When the interpolation is done using the red, green and blue components (RGB), the result will be different compared to an interpolation using the hue, saturation, brightness components (HSB) even though the two end-point colours have the same visual appearance.
The HSB colour space is conceptually a
colour-wheel. It is therefore possible to interpolate in two opposite
directions in the HSB colour space. The
hsbreverseramp parameter
determines which direction is used. If the two end-point colours are
hsb 0 1 1 (red) and hsb 0.667 1
1 (blue), then interpolation with hsbreverseramp
off (the default) will be in the forward direction, and will go
through hsb 0.333 1 1 (green). If the parameter is
on, then the interpolation will instead go through
hsb 0.8 1 1 (purple).
Note that it does not matter which colour space is used in the specifications for the ramp end-point colours. The interpolation is determined by the colourramp and hsbreverseramp parameters, not by how the end-point colours are specified.
Defines the colour ramp by two explicit end-point colour
values. The lower end of the colour ramp is given by the first
colour. The interpolation calculation is affected by the
colourramp parameter, and if this
parameter is hsb, then the
hsbreverseramp parameter also
comes into play.
This defines a colour ramp in the HSB colour space from blue to red via cyan, green, and yellow, i.e. in the reverse direction.
Note that, currently, this colour ramp specification
will automatically set the
colourramp parameter to
hsb and the
hsbreverseramp parameter to
on. This is really a bug.