Daylight Summer School 1998, July 28-30, St. John's College, Santa Fe, NM

Daylight Worksheet - Compiling cansmi.c

One good way to start learning Daylight Toolkit programming is to work from a simple existing program. If programming in C or Fortran, learning to compile and link, probably with a Makefile, is an essential skill. cansmi.c is a good first program because it links only to the SMILES Toolkit, and performs a simple yet useful function, to canonicalize SMILES.

  1. Before compiling cansmi.c, you must do the following:

    cd $DY_ROOT/contrib/src

    This creates the Daylight-user library and also installs the correct machine-dependent include file at $DY_ROOT/contrib/src/makefile_include. This must be done as the Daylight administrator ("thor").

    In this course, since the software is NFS mounted, this has already been done and is unnecessary.

  2. Create a directory for this exercise in your home directory:

    mkdir toolkit/cansmi
    cd toolkit/cansmi
    cp $DY_ROOT/contrib/src/c/smiles/cansmi.c .
    cp $DY_ROOT/contrib/src/c/smiles/makefile .

  3. Now compile cansmi.c:

    make cansmi

  4. Test cansmi by entering the command and then a few SMILES:


Modifying cansmi.c

  1. Let's modify cansmi.c and recompile.

  2. Use the function dt_count() to determine the number of atoms and bonds in each molecule. With each SMILES, print these numbers.

  3. Recompile as before and test.

Daylight Chemical Information Systems Inc.