Introduction to CCP4i Task Programming

Liz Potterton

It's easy (honest!)..

It is possible to create a task interface without knowing anything about the 'core' of CCP4i
Although the core of CCP4i and some of the task definition files are in the Tcl scripting language you can get by with minimal knowledge of Tcl because the most important functionality is done via library functions.
The library functions are documented.

A CCP4i task is usually an interface to run a script

The script is run as a separate process to the main graphical interface.
Usually the script is written in Tcl (this is not strictly essential).
The script usually runs one or more programs - these do not have to be CCP4 or even crystallographic programs.

There are three files to define one task

def file ../ccp4i/tasks/taskname.def  defines the parameters used in the task interface
tcl file ../ccp4i/tasks/taskname.tcl  defines the visible task window
run script ../ccp4i/scripts/taskname.script the script that does the useful stuff

Running programs..

There are no rules about how run scripts create program scripts and run programs but usually they employ a template file to create a program script..


Note that these template files are associated with a specific program and not with a task.  Several tasks might use the same template file.

The parameters..

For example to use the NCYLES parameter which appears in a task window:

..are defined in taskname.def

NCYCLES                 _positiveint    5

i.e. NCYCLES has a type _positiveint and a default value of 5.

..are attached to widget for user to edit in taskname.tcl

CreateLine line \
        message "Number of cycles of refinement (NCYC)" \
        help refi_ncyc \
        label "Number of refinement cycles" \
        widget NCYCLES

..are available but usually not used in the taskname.script

.. are inserted into the program script according to format in

1 ncycles $NCYCLES

(the meaning of the 1 is explained later).

The CCP4i distribution

$CCP4/ccp4i  has the environment variable $CCP4I_TOP

The subdirectories are..
bin contains the executables (ccp4i , loggraph)
etc default 'def' files, library data files
icons images used in the interface
src the source files for 'core' ccp4i
tasks the definitions of task interfaces
scripts the 'run'  scripts associated with the task interfaces
templates the program script templates
utils utilities (e.g. for handling PDB files)
loggraph, sketcher etc large areas of functionality
help html documentation

After you have run ccp4i there is an shadow copy of this directory structure in


you can put files in this area and they should be picked up in preference to the distributed version.