home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
fish
/
801-810
/
ff809
/
cpk
/
cpk.doc
< prev
next >
Wrap
Text File
|
1993-01-24
|
14KB
|
401 lines
CPK Program Documentation
-------------------------
V 1.0 1/3/93
© 1993 Eric G. Suchanek, Ph.D.
All Rights Reserved
Introduction
CPK is a program to render a space-filling representation of atoms in
molecules. This is the type of representation one would find in the
plastic 'CPK' (Corey, Pauling, Kendrew) models often used in organic
chemistry. The program is AmigaDos V 3.x specific, and has no hard-coded
constraints in the number of atoms it can process. Unlike many
programs of a similar nature, CPK correctly handles intersecting
3-dimensional spheres by using the famous Bresenham circle algorithm
in 3D. In order to keep the program simple and reasonably fast I do
not supersample the spheres, so their resolution is essentially equal
to the display screen you're using at the time.
That's all well and good, but what does it really mean?? Well, simply
put it means that the sphere's surface gets increasingly inaccurate
as your resolution goes down. Don't be surprised to see the image
quality degrade as the screen resolution drops. See the
TIPS
section
below for a "workaround".
The molecular format used is called
Protein Data Bank
(.pdb) format.
This is one of the most prevalent formats used in modern chemistry.
The entire Protein Data Bank consists of a few hundred protein and DNA
molecular structures and can be obtained from the Brookhaven
laboratories for a nominal fee (or from me if you know what you want).
This program represents a small piece of a larger program called
Proteus-C
, the C version of the Proteus molecular modeling package I
co-developed as a graduate student. The main Proteus kernel is
device-independent and runs on VAX, Silicon Graphics, Trace/Multiflow,
Sun, and Amiga platforms. As I have time I'm writing molecular
display front-ends on these systems (mostly Amiga and SGI, though).
Since it took me six years to write this module, it will probably be a
while before new ones are released :-)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
System Requirements:
CPK should run on any Amiga with at least 1MB memory. It tries
to be reasonably tolerant of low memory conditions, and should
hopefully gracefully degrade if it can't get memory.
This program will run only under Version 3.X of the Amiga Operating
System!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEDICATION:
I dedicate this program to my late son George Kelly Suchanek. His life
was short, but while he was with us he showed me what is really important...
Requiescat in Pace.
I also dedicate this program to the Gurus of the Public Domain who
selflessly write good, solid code for the Amiga community. They are
all, in large measure, responsible for the continuing existence of this
machine and the excitement felt by her users. The folks in the Amiga
CATS sections of
BIX
also deserve special praise, both for their
professionalism and their ability to develop the best microcomputer in
the world despite their management. I salute them!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Disclaimer:
It displays molecules. It does not crash my machine, nor do I get
Enforcer or Mungwall hits with it. It does not "leak" memory.
It will not solve the world's problems nor will it balance the federal
budget. There are no warranties either expressed or implied.
Use at your own risk!
I consider this program to be
CHARITYWARE
: If you like it, please
consider sending a donation to the National SIDS foundation. You can read
more about SIDS in the
About.SIDS
document included in this distribution.
I'd also be interested in good 3D matrix manipulation algorithms in 680x0
Assembly. Also, 3D solid modeling algorithms with shading would be
GREATLY
appreciated.
I would distribute the CPK Source code with this release, but it is in
a state of flux right now. Also some of the IFF routines are still
developer beta, and I don't think I can release the source for them -
sorry :-(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
License:
You may distribute this program as long as it is not "For Profit",
and as long as all files in the distribution remain intact. Fred Fish
is expressly given permission to distribute this code in his disk
collection.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Installation
Drag the CPK drawer to some appropriate location on your system. Keep the
directory hierarchy intact, though.
Double click on the icon appropriate for your machine:
68000
-
CPK.000
68030
-
CPK.030
68040
-
CPK.040
.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISTRIBUTION KIT:
The distribution should contain:
cpk.000
- Generic version which should run on all Amigas.
cpk.030
- 68030 specific version.
cpk.040
- 68040 specific version.
pdb/test.pdb
- A small molecular fragment.
pdb/cube.pdb
- A small file to test scaling, aspect ratios, etc.
pdb/nati2.pdb
- An actual protein molecule. This protein is used
in some modern detergents as an enzyme which
digests proteinacious stains.
pdb/hello.pdb
- A whimsical "molecule"
pdb/*.pdb
- More atomic files as I acquire them.
prefs/*.prefs
- Various preference files of settings.
cpk.doc
- What you're reading now.
About.SIDS
- Information about SIDS.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using CPK:
Double click on the correct program icon to launch the program. You
will notice that it immediately starts rendering a "molecule". This
is because the program always reads the
STARTUP
file (see the section
on
TOOLTYPES
, below) upon invocation. This is a good way to get up
and running fast.
The program opens in interlaced, overscan mode, and opens two
windows. The Image window is sizable, and all rendering is performed
here. The program will automagically re-center the molecule upon
re-sizing.
When a molecule is rendering, a progress window will appear. This
window indicates the rendering percentage completed as well as
allowing the user to abort the current rendering by selecting the
Abort
gadget.
The Control window allows the user to change the orientation
and scale of the molecule, as well as load files by name. The
gadgets perform as follows:
Rotation Gadgets:
XROT
YROT
ZROT
These gadgets perform rotations about the X, Y, and Z axes,
respectively. The plane of the screen is considered the X,Y plane.
Scaling Gadget:
This gadget adjusts the overall scale of the image, sizing the
molecule up from 1.0 to 10.0 fold. This is a
relative
scaling,
not absolute.
File Name Gadget:
This gadget allows the user to type in the name of a file to
read. You'll see the screen flash (DisplayBeep()) if the file
can't be read.
Reset Gadget:
This gadget resets the rotation axes and scaling factor, and
re-renders the current molecule.
Load File Gadget:
This gadget opens the file-requester to load a molecule file.
There are several molecules in the PDB directory (this is where
the Open ASL requester opens by default).
Note that some of the molecules are quite large. The file
'nati2.pdb' is over 1900 atoms and requires approximately
282 KB to load. Also, the process of reading the atoms
can take a while (about 30 seconds on my 25MHZ 68040 A3000).
Auto Render Checkbox Gadget:
This gadget turns the
Auto Render
feature on and
off. Normally any rotation or scaling gadget manipulation will
force a re-render of the current molecule. With auto render
turned off the user may play with multiple gadgets
without
automatically re-rendering.
Render Gadget:
This gadget forces a re-render of the current molecule. It is
normally used when Auto Render is turned off.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Menus:
File Menu
Open...
Open a preference file. Try to
Open
one after launching
the program. Hello.prefs is interesting.
Save
Save the current X,Y,Z rotations, scaling, window sizes
and positions to the currently named 'preferences' file.
SaveAs...
Save the current X,Y,Z rotations, scaling, window sizes
to a
named
'preferences' file.
Print
Print the molecule window to the printer. Uses default WB
prefs and currently does not have file notification setup.
This means that if you change the printer prefs file
using a Preference Editor, you should quit the program and
restart.
About...
Informational window about the current release of CPK.
Quit
Quit? Why would you want to quit this cool program?
Screen Menu
Screen Format...
Allows the user to choose between a low-res or hi-res and
interlaced or non-interlaced display.
NOTE:
these
screens are opened in STDSCREENWIDTH STDSCREENHEIGHT
overscan mode.
Save Window as IFF
Save the Molecule Window to an IFF ILBM format file using
a user-specified name. (Right Amiga I).
Save Icons?
Boolean value indicating whether or not to create icons for
the IFF window dumps. The default tool on these images is
Display
.
Animation Menu
Anim Setup...
This window allows the user to specify a frame
sequence of IFF files for use with post-processing programs.
I use DPAINT IV to load the individual frames into an
animation, and manipulate them from there. By using the
images as an AnimBrush it's possible to create some nice
animations. The gadgets are described below:
Frame Prefix:
Specifies the complete path prefix for the anim frames.
It should end in a period. For example:
ram:mol_anim.
The program will add a numerical suffix like
001
to this
prefix in creating the file name.
Start Frame:
Frame number the program should use when starting the
animation. (Zero based).
End Frame:
Frame number to use for the ending frame. (Exclusive).
See Below for more info.
Total Rotation:
Total rotation in degrees for the animation.
X, Y, Z boxes:
If checked, will rotate about this axis.
NOTE:
This is set up for
Loop
style animations. That is, if
you have selected, start 0, end 10, 360 degrees rotation set,
the program will compute frames 000 - 009 but you'll only
rotate 360 - 360/10 degrees. This means that cyclic loop
animations will not hesitate on the first frame.
In essence, you're doing one less frame, since the frame
counter is 0 based.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tooltypes:
CPK supports the following tooltypes:
TOOLPRI - The priority of the program. I usually run at -1.
SETTINGS - The preference file to open upon startup. Default
is cpk.prefs.
PUBSCREEN -
< Not supported yet >
SAVEICONS -
< Not supported yet >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Known Limitations/Quirks
1) No abort from printing. Do it if you really mean it.
2) No stereo viewing (I'm working on this).
3) No wireframe viewing (I'm also working on this).
4) Need better Public Screen support.
5) No launch from Tool icon.
6) The ultra low-res modes aren't too good.
7) No multi-project management.
8) One must bring the image window to the front before doing an
IFF save in order to avoid getting any other intersecting windows
in the picture.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TIPS:
1) Try to run this program in Interlaced mode because the pixel
aspect ratio is closer to 1:1. In HighRes-Interlace you'll
only get 16 color gray scale screens. That was a tough decision
but there just aren't enough colors in 4 bitplane screens to get
good looking renderings. Perhaps when I get my A1200?
2) Be
patient
. The sphere intersection code is all integer math,
but it still takes a while to traverse the atom lists during the
course of rendering, especially on a 68000 machine.
3) Try to run the program with a fairly large scale. The output looks
better with larger spheres.
4) Keeping the rendering window narrow speeds up the calculations, since
the program builds a cliprect based on the window inner width and
only traverses that width on rendering.
5) When saving IFF images, make sure the molecule image window is in
front of all other windows. Otherwise the IFF image might have
the other window regions saved as well.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drop me some E-Mail if you'd like to comment on the program
or share code.
Eric G. Suchanek, Ph.D.
BIX:
esuchanek
CIS:
76456,710
INET:
procter!suchanek_eg@ms.uky.edu
U.S. Snail:
5785 Lake Michigan Drive
Fairfield, OH 45014-4421
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~