Alias assigns to name the specified wordlist. Subsequent occurrences of name (space- and/or semicolon-delimited) in commands will be replaced with wordlist. Using ^name indicates that only occurrences as a command (at the beginning of a line, following a semicolon, or as a command argument of perframe) should be replaced. This is useful for aliasing a long command to a short string without having to worry about that string appearing (and being expanded) in the middle of some other command. Conversely, aliases defined without ^ are useful for atom specification strings that are tedious to type. See also: namesel, perframe, preset, rmfalias
Aliases are saved in sessions. Aliases defined with ^name and that do not require arguments (see below) are also saved in the preferences file and listed in a top-level Aliases menu. Choosing an entry in the Aliases menu executes the alias. Aliases can be set up automatically by placing alias commands in a startup command file (see the Command Line preferences).
The alias command without any arguments shows the definitions of all current aliases in the Reply Log. The definition of a specific alias can be shown with alias name.
The command ~alias without arguments deletes all aliases, whereas a specific alias can be deleted with ~alias name (^name should be used instead of name if the alias was defined that way).
Within wordlist, $1, $2, $3 ... may be used to indicate the first, second, third ... arguments of name. To have a string with spaces in it handled as a single argument, replace each space with an underscore. Any underscore (unless escaped by a preceding backslash) will be replaced with a space before the command is executed. For example,
alias ^colorsrf color $1,s $2is equivalent to
alias helix5 :200-228.a
colorsrf light_sea_green helix5
color light sea green,s :200-228.awhich colors the molecular surface of the specified residues light sea green.
Note that wordlist may contain multiple commands separated by semicolons, for example:
alias ^inspect ~rl; show $1 z<4; align $1 protein; focus $1 z<4; rl $1Avoid embedding semicolons in an alias by accident. For example, the following will not color anything red because the entire line is interpreted as merely creating an alias:
alias others ligand | ions | solvent; color red othersIn this case, the aliasing and coloring commands should be on separate lines.