home *** CD-ROM | disk | FTP | other *** search
-
-
-
- CPK Program Documentation
- -------------------------
- V 2.0 10/9/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).
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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
- gracefully degrade if it can't get memory.
-
- This program was written for Version 3.X of the Amiga Operating
- System! It will no longer run under Version 2.X!
-
- This program also requires Nico Francois' reqtools.library, which is
- available on many public BBS. I currently use reqtools.library V38.1042.
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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. The quality of many public domain and shareware programs on the
- Amiga rivals many commerical programs on the PC and MAC.
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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.
-
- If you have any 3D solid modeling algorithms with shading I'd love to seem them,
- (especially some 3D cylinder shading routines).
-
- I am unable to distribute the CPK source code except to licensed Amiga
- developers, since the IFF routines are developer beta and can not be generally
- distributed asorry :-(
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-
- License:
-
- You may distribute this program freely 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, (with math coprocessor).
- 68040 - CPK.040, (with math coprocessor).
-
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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.
- changes.doc - The program history with recent changes
-
- 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/heme.pdb - The heme group from myoglobin.
-
- pdb/zna2b.pdb - A Z-Dna molecule.
-
- pdb/lysozyme.pdb - The enzyme lysozyme.
-
- pdb/znf2.pdb - A modeled zinc-finger domain from the aids
- virus.
-
- pdb/mbn4.pdb - Myoglobin
-
- pdb/*.pdb - More atomic files as I acquire them.
-
- prefs/*.prefs - Various preference files of settings.
-
- cpk.doc - What you're reading now.
-
- prefs/*.* - Various preference files and palettes.
-
- test.cpk - AREXX script to test the CPK AREXX
- interface.
-
- 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 the display mode saved in the startup file, 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.
-
- If the saved displaymode is not available you will be prompted to
- select a new one. When you first get CPK it's likely that you'll
- see this requestor, since most of my preference files are saved
- with Picasso II screen modes.
-
- When a molecule is rendering, a progress window will appear. This
- window indicates the rendering percentage completed and
- allows 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 20.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 10 seconds on my 25MHZ 68040 A4000).
- I have greatly improved the file I/O in Version 2.0 of the
- program, so large molecules should load considerably faster
- then V1.0.
-
- 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. No abort gadget yet. Print if you're serious about
- it!
-
- Save Window as IFF
- Save the Molecule Window to an IFF ILBM format file using
- a user-specified name. (Right Amiga I).
-
- About...
- Informational window about the current release of CPK.
-
- Quit
- Quit? Why would you want to quit this cool program?
-
-
- Screen Menu
-
- Screen Format...
- Brings up the ASL screen mode requester to select a screen
- mode. You must select a display with at least 4 bitplanes
- of color. I recommend a 1024x768x8 display if possible.
- This mode is saved in the settings file as well as
- window positions and sizes.
-
-
- Color Mode
- Check either color or grayscale rendering mode.
-
- Palette...
- Opens the palette editor window. You currently cannot save color
- palettes.
-
- 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.
-
- Misc Menu
-
- Annotations Window:
- Brings up a window to show the various 'annotations'
- which may be present in the PDB file. Things like
- the compound name, structure author, journal references
- and crystallographic parameters are shown. Just click
- on the cycle gadget to browse the annotations. Most of
- the files included don't have any annotations present.
-
- Light Window:
- Brings up the light source positioning window. The
- three sliders for X, Y and Z represent the
- direction vectors for the light source. X and Y
- can vary from -100 to 100, Z from 0 to 100. The Z direction is
- out of the plane of the screen in this program. These are
- the direction vectors times 100 (or percentages). As an
- example, if X were 0, Y were 0 and Z 100, the light source would
- be pointing along the Z axis. Simply set the values you want and
- hit the OK button. The program will normalize the values for
- you and re-render the molecule. This works best when the
- QuickRender flag is turned ON. Select QuickRender and try moving
- the light source around. Click on the Done gadget to remove the
- window.
-
- CPK Scaling:
- This menu option brings up a window which lets you specify the
- scaling factor. A factor of 1.0 gives the normal CPK style
- rendering, while factors < 1.0 make smaller spheres. This can
- be useful when rendering structures like DNA which have a
- regular internal structure. Factors > 1.0 make more of a
- 'VanderWalls' style rendering.
-
- Quick Render:
- When set this menu option disables some of the specular highlight
- calculations (which use the transcendental power function).
- On unaccelerated machines this can have a noticeable effect
- on rendering times. Unfortunately in Quick Render mode the
- program suffers from pretty severe color banding.
-
- Save Icons:
- When set, this menu option saves a nifty icon with IFF files.
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- AREXX:
-
- CPK now supports AREXX! The port name is CPK1. Errors are returned in
- the CPK.LASTERROR variable. The return code will be 0 for normal
- returns. In general the load and save functions require a complete
- pathname. See the example test.cpk for a test of all the
- AREXX functions.
-
- The command set is listed below:
-
- Command Arguments
-
- PORT - Returns the port name in the CPK.LASTERROR
- variable
-
- LOAD PREFS <filename> - Loads the specified preference file.
-
- LOAD PDB <filename> - Loads the specified molecule file.
-
- SAVE PREFS <filename> - Saves the specified preference file.
-
- SAVE IFF <filename> - Saves the molecule window to an iff
- file.
-
- XROT <angle> - Set the X axis rotation to <angle>
- degrees. Does NOT render.
-
- YROT <angle> - Set the Y axis rotation to <angle>
- degrees. Does NOT render.
-
- ZROT <angle> - Set the Z axis rotation to <angle>
- degrees. Does NOT render.
-
- SCALE <amount> - Sets the overall scale to <amount>.
- This can range from 1 to 20.
- Does NOT render.
-
- RESET <NULL> - Resets the rotations and scaling to
- default values. Does NOT render.
-
- RENDER <NULL> - Renders the molecule using the current
- settings.
-
- QUIT <NULL> - Quits the program.
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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.
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 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) No launch from Tool icon.
- 5) No multi-project management.
- 6) 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) 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.
-
- 2) Try to run the program with a fairly large scale. The output looks
- better with larger spheres.
-
- 3) Run at the highest possible resolution.
-
- 4) A narrow 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@bix.com
- CIS: 76456,710
- INET: procter!suchanek_eg@ms.uky.edu <-- preferred
-
- U.S. Snail:
-
- 5785 Lake Michigan Drive
- Fairfield, OH 45014-4421
-
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-