Cerius2 Modeling Environment |
Although many users generally need to know nothing about this process, you may want to learn about creating and using Cerius2 commands, to facilitate performing a series of related or identical tasks in an automated way.
You may also want to know about Cerius2's facilities for running application modules on remote machines and for managing licenses.
This section explains
This section contains information on:
The basics of starting Cerius2 and using its interface are demonstrated in Introducing Cerius2 and described in The Cerius2 Interface.
Command logging and scripting utilities enable you to record Cerius2 commands into script files and play them back (Playing back scripts and log files) at a later time.
Command logging and scripting
This section includes information on:
Command scripts can be played back later (Playing back scripts and log files) unmodified, to repeat a previous session. Alternatively, you can supplement a command script with Tool Command Language (Tcl) statements to produce responsive, program-like scripts that can be used to drive Cerius2 and its applications. How it works
During every Cerius2 session, generated commands are continuously logged to a file named RUN.LOG. This continuous log file provides a record of the modeling activity that took place in a Cerius2 session.
Select the Utilities/Record Commands... menu item in the main Visualizer control panel to access the Record Commands control panel.
To copy all the current contents of the RUN.LOG file to a file with a different name, change the filename in the entry box near the top of the Record Commands control panel (if desired) and click the Dump current Log contents action button.
To empty and restart the current RUN.LOG file from the current point in your Cerius2 session, click the Empty Log File contents action button in the Record Commands control panel. This action does not reinitialize the Cerius2 session (Starting a new session), it merely restarts the log file.
Please see the on-screen help for details on the functioning of each control in the Record Commands control panel.
Command tracing
Command tracing enables you to view and store various levels of Cerius2 command output. You can also display the commands in the text window as they are generated. This output can be useful for monitoring the commands generated during a Cerius2 session, especially if you are logging commands for use in a script.
Three levels of commands are generated by the graphical interface and application modules:
Select the Utilities/Command Tracing... menu item in the main Visualizer control panel to access the Command Tracing control panel.
To specify the level (see Levels of commands) of commands to trace, check one or more of the Activate Command Tracing check boxes.
To turn on or off tracing of primary commands, you can also check the Activate command tracing check box in the Customize Environment control panel (Accessing the tools). The commands are sent to the text window and/or a file, as specified in the Command Tracing control panel (see Where to send the commands). |
To display the traced commands in the text window, check the Text Window check box.
To stop command tracing or change the level of commands to trace, uncheck the relevant check boxes in the Command Tracing control panel.
To print the most recent primary and utility commands in the text window, enter the command history in the text window.
Please see the on-screen help for details on the functioning of each control in the Command Tracing control panel.
Cerius2 enables you to play back command scripts containing command strings, control syntax, and, optionally, additional Tcl commands. The commands in the script are processed as though they were being generated in real time by the Cerius2 interface, triggering the appropriate actions.
Controlling Cerius2 from scripts
Command scripts are often based on Cerius2 log files, which can be used unmodified, to repeat a previous session. Alternatively, you can supplement a log file with Tool Command Language (Tcl) statements to produce responsive, program-like command scripts that can be used to drive Cerius2 and its applications. In addition, you can write command scripts completely from scratch.
This section includes information on:
Related information
To learn more about using Tcl to enhance script files, see Cerius2 Command Script Guide.
Recording commands is discussed under Command logging and scripting.
Playing back scripts and log files
If you have certain tasks that you nearly always perform during a Cerius2 session, you can record them in a command script file, and then have Cerius2 automatically perform these tasks from the script, either immediately (Starting Cerius2 with a command script file) or when you request it (this section). Then you can proceed with additional tasks using the graphical interface.
Select the Utilities/Playback Script... menu item in the main Visualizer control panel to access the Playback Script control panel.
Use the file browser and selector tools to find and choose the desired script file. How to use these tools is detailed under Finding model file(s). (All file browsers work similarly.)
You can play back the script file in several ways:
Please see the on-screen help for details on the functioning of each control in the Playback Script control panel.
Starting Cerius2 with a command script file
Ordinarily, the cerius2 script (Starting Cerius2) starts a regular Cerius2 session that takes its input by means of your interaction with the graphical interface.
Cerius2 can also be run from a recorded script, either with or without the graphical interface. You can manually specify the script when you start Cerius2 or have Cerius2 always process a certain script automatically without your needing to specify it.
You can run Cerius2 from a command script in several ways:
If you have certain tasks that you always or often perform when you start a Cerius2 session, you can record them in a command script file, and then have Cerius2 automatically perform these tasks from the script, either immediately (this section) or when you request it (Playing back scripts and log files). Then you can proceed with additional tasks using the graphical interface.
If you have repetitive, routine calculations or other tasks that can be performed without the graphical interface, you can record these tasks in a command script file. Then you can run Cerius2 in a completely automated way, in either the foreground or background, without your interacting with the graphical interface at all.
To run Cerius2 from a command script with the graphical interface and have it immediately and automatically process a certain command script, move (cd) to a directory containing an initialization script, then simply start Cerius2 as usual.
To set up different initialization scripts for use when you run Cerius2 for different purposes or projects, simply create separate directories, each containing a different cerius2.ini file. If Cerius2 does not find a cerius2.ini file in the directory in which you start it, it looks for a cerius2.ini file in your home directory.
> cerius2 scriptfilewhere scriptfile is the name of your command script file. Any text output is sent (as usual) to the text window.
To run Cerius2 from a command script with the graphical interface, have it immediately process a specified command script, and have it send any text output to a file instead of to the text window, start Cerius2 by entering at the system prompt:
> cerius2 -o outputfile scriptfilewhere outputfile is the name of the file that you want to send any text output to, and scriptfile is the name of your command script file.
In either case, graphics are displayed in normal fashion in the model window. After the command script terminates, Cerius2 enters interactive mode, awaiting your input.
Running Cerius2 without the graphical interface
To run Cerius2 without the graphical interface in background mode, enter at the system prompt:
> cerius2 -b outputfile scriptfilewhere outputfile is the name of the file that you want to send any text output to, and scriptfile is the name of your command script file.
To run Cerius2 without the graphical interface in foreground mode, enter at the system prompt:
> cerius2 -n -o outputfile scriptfilewhere outputfile is the name of the file that you want to send any text output to, and scriptfile is the name of your command script file.
To run Cerius2 without the graphical interface in foreground mode and send any text output to the shell window rather than to a file, enter at the system prompt:
> cerius2 -n scriptfilewhere scriptfile is the name of your command script file.
When to manage licenses
Some situations exist in which you may want to manage licenses interactively, for example:
If you want to run Cerius2 applications in parallel, please see the Cerius2 Installation and Administration Guide. |
Select the Utilities/Application Licensing... menu item in the main Visualizer control panel to access the License Management control panel.
The Available Licenses list box shows the names of modules that require licenses and for which you have purchased licenses.
The login name(s) of the people using floating licenses for the selected module are shown in the Checked out to list box.
To manually reserve (check out) one floating licence for the selected module, click the name of the selected module in the Available Licenses list box or click the CHECK OUT pushbutton.
To return (check in) a license that you have checked out manually for a selected module but are finished using, click the name of the selected module in the Available Licenses list box or click the CHECK IN pushbutton.
Please see the on-screen help for details on the functioning of each control in the License Management control panel.
External application facilities enable you to manage Cerius2 application modules running on external servers.
Running application modules externally
This implementation method has several advantages, including:
To always run an application module externally under the conditions you set with the Process Management control panel, you need to save the current session (Saving the current session). Otherwise, your settings are saved only for the current Cerius2 session. |
Cerius2 and independent processes
Some application modules (for example, those on the QUANTUM cards) are actually used only to set up and act as interfaces to calculations that are run by essentially separate programs that are independent of the Cerius2 interface. Such modules offer their own job-control options that affect the separate (usually computationally intensive) program. These controls are accessed from the application module itself and are documented in the user guide for the relevant module.
Select the Utilities/External Processes... menu item in the main Visualizer control panel to access the Process Management control panel.
The names of machines on your network appear in the Host list box. Select the one that you want to send the process to. (The machine you are running Cerius2 on is called localhost.) If a machine's name is not on that list but you know it is accessible from your machine, you can enter its name in the Remote Host entry box.
To specify your working directory on the specified host, if it does not appear automatically, enter the name of your working directory in the Working Directory entry box. This directory must already exist.
You can start the specified Cerius2 process on an external host in two ways:
To stop running the selected Cerius2 process on the specified host, click the Kill action button. You would typically use this button if you want to restart the selected process on another host.
Please see the on-screen help for details on the functioning of each control in the Process Management control panel.