Chemistry Computing Course Lecture and CourseWork Summaries
Introduction and Objectives.
To introduce the aims of the course, and the skills to be acquired, including
the use of workstations and Macintosh systems, experience with window type
environments and on-line "hypermedia" documentation.
Data entry from a keyboard and creating, naming, editing and
storing computer files. Use of high level scientific programming languages such
as Fortran 77 or 90 will be discussed. The course will also illustrate the use
of graphical display packages and of computer networks. Skills at
troubleshooting and solving various types of error will be developed and project
objectives stated. (20 min)
Reading: General,
Macintosh Computers,
Workstations,
Information Technology
Concepts:
Definitions of Workstations (Indigo), Personal computers
(Macintosh, PC) and the Networks that connect them (Ethernet/Internet).
Keyboard, screen, window, mouse and disk file management. The difference between
operating systems and system commands (Unix), screen editors and editing
commands (asedit) and programs and program commands. The structure of a Fortran
77 program; numbers, characters, variables, input and output from disk, keyboard
or screen. Subroutines and functions. Compilers and interpreters. The difference
between high level language source code, binary object code and machine
executable code. Memory, real or virtual and disk. The difference between
compilation errors, run time errors and algorithmic errors. (50 min)
Reading: Learning Guide; chapter 1
First Steps:
Log on using a
Workstation or a Mac. Unix console command line, toolchest and
Apple pull down menus. Creation of several windows on the screen and
switching between windows. A minimised and maximised window. An editing window.
Using Tab stops, the importance of columns in Fortran 77, the differences
between upper and lower case characters. Recognising different types of problem
due to Workstation, Server and Network, Editor, compiler, Program. (35
min) Reading: Workstations
What to do in the First Course Work Session:
The objectives of the first session are to achieve
Workstation/Mac/Editor familiarity and confidence.
Excercises such as Log-in and manipulation
of some simple windows should be attempted. Familiarity with how to browse
the on-line documentation should be achieved.
Create and edit a simple text file with a name such as first.f, practicing
the operations of inserting and deleting, cutting, pasting and searching text,
using the tab key to position the cursor at e.g. columns 1 or 7 and
saving the file to disk. Practice using the the console ugfor command.
Try to use electronic mail (Macintosh Netscape
browsers only).
On a Macintosh system, format a new empty floppy disk,
configure Eudora on it, and practice sending e-mail and mounting
the Indigo file base.
Character set used in Fortran (ie *, ', /, :, etc). Program layout: statements, special
meaning of columns 1, 6 and 7-120, Comments, Continuations and Statement
numbers. Program, Stop, End, Function and Subroutine statements. Meaning of
names starting with I,J,K,L,M or N. Assignment of values to variables.
Scientific (E) notation. Integer and Real (floating point) variables and
converting one type to the other. Accuracy (bits, bytes, single, double
precision). Arithmetic operations and hierarchy (+,-,*,/,**). Use of
uninitialised variables and division by zero. (50 min)
Reading:
Learning Guide, chapters 2.
Unformatted or Free-Format input from a keyboard using READ
* and output of variables and text strings to a terminal using PRINT *. Use of
DO loops and GOTOs for program control. Alternative use of IF and IF (relation)
THEN/ELSE/ENDIF statements. Arithmetic operators (.EQ., .GT., .LT., etc).
(50 min)
Reading: Learning Guide; chapters 3,4.
Course work:
Use the editor to create/edit and the ugfor
command to compile and run a simple program. Learn to recognise the filenames
and their qualifiers (.f, .uxe, .lis) and learn to monitor your Indigo
disk quota usage by entering the commands
quota -v
ls -l
from the console or Macintosh Telnet windows.
If the quota command shows that you have used close to the 5 Mbytes
of storage allowed, you will have to delete one or more files using the
rm filename
command.
Learn how to handle compilation errors by opening two editor windows and
switching between them. Try for example writing code to see what
happens when you divide by zero.
To do this, open up a console window (Macintosh users only, Indigo users already have one) by
If response on one machine is slow, try another.
Try editing and compiling some of the following programs. If you click
on the names below, the editor should be invoked automatically
Use of two dimensional arrays. Dimension Statements, Data
declarations. Logical variables and declarations and logical operators (.AND.,
.OR.) used with IF statements. Using intrinsic functions (eg SQRT, EXP, FLOAT
etc) and the meaning of arguments (the non-verbal type). (50 min)
Reading: LG; chapters 5,6
Character handling, string variables and
their assignment and comparison. The meaning of invisible characters (eg ESCAPE)
and the use of the CHAR function. The difference between Formatted and
Unformatted (Free-Format) Output to the terminal. Using WRITE (*,
n)/n FORMAT statements (cf LG p 49 rather than p 39). Formatted
Input from the keyboard using READ (*,n)/n FORMAT statements. The
meaning of and the difference between <CR> and <CTRL+D> to terminate
Formatted READs from the keyboard. Setting up default values of variables.
Implied DO Loops in READs and WRITEs. (50 min)
Reading: LG;
chapters 7,8,9.
Course Work:
First, open up a console window (Macintosh users only) by clicking here
or here. Try editing, compiling
and executing several of the following example programs. Try to correlate what you
type at the keyboard and what comes out on the screen! If you click
on the names below, the editor should be invoked automatically
Using Fortran Input/Output to disk files in for
inter-program communication. OPEN(c) statements. The READ (c,n) statement
and error handling in reading from disk file. Using WRITE (c,n) to write disk
files. Definition and use of Subroutines and User defined Functions. The RETURN
statement. Passing arguments to Subroutines. (50 min)
Reading: LG; chapters 9,10
Modular programs and their development. Using
supplied Subroutines and libraries. Examples of various Compiler/Linking/Run
time/Algorithmic errors; the concept of a 'fail-safe' program. Make files for
program development. Use of the Explorer program to display an array of data.
Outline of what is required in the projects. Brief introduction to the use of
computer networks for information technology, and the future role of "hypermedia"
services. (50 min)
Reading: LG; chapter 10.
Course work:
If you click
on the names below, the editor should be invoked automatically
- Try running SCREEN, a program that controls the appearance
of characters on the screen.
- Debug the Karplus program and get
it working.
- Write a short program to declare say an array A(15,15), fill the
array with some interesting numbers evaluated in a subroutine or a function,
normalise the array so that the values span the range -1 to +1 and write the
array out to a disk file called horbit.dat with the format shown in the
details for Project A. Trying starting Explorer and seeing if an interesting
picure appears.
- This
Polynomial program fits in a least squares sense to a general
polynomial function. Most of it is written in "old" Fortran IV (actually vintage 1970. The first serious program HSR ever wrote!).
A frequently required programming
skill is to take such "dusty-deck" code and update it. Try updating the code by
"reverse-engineering" any sections of code you recognise and producing more
modern equivalents.
A Note on Hypermedia
If you are reading these notes on a computer, please note that
any unlined word represents a hyperlink to another document. Associated
with each pair of lectures is some course work. Here you will find various
suggested programs for you to try out. If you click on their names, the
program file will be downloaded to your computer and an
editor ( asedit on the Indigo, BBedit on the Macintosh)
will be automatically invoked. After
any appropriate editing, the file should be saved to your local disk area.
Select the SAVE AS item from the File menu, remove the existing file name
(e.g. /tmp/blogs/temp0938) and
replace it with one of your own choosing. On a Macintosh, ensure
you save it as a Unix file on the Indigo file volume. After this, you can go to the
Console or Telnet window and compile it if necessary.
An Indigo workstation
must be used for viewing the
graphics generated for Project A, whilst a Macintosh must be used
for viewing the spectral output from project B.
Copyright (c) B. P. Levitt, H. S. Rzepa and ICSTM Chemistry Department, 1994, 1995.
Return to Index page