Dec 092017
Draws very nice 3D picture of molecules. Needs VGA.
File MOLECULE.ZIP from The Programmer’s Corner in
Category Printer + Display Graphics
Draws very nice 3D picture of molecules. Needs VGA.
File Name File Size Zip Size Zip Type
FERRODOX 12164 3715 deflated
MOLECULE.EXE 63148 36104 deflated
README 4505 2122 deflated
TEST 106 54 deflated

Download File MOLECULE.ZIP Here

Contents of the README file

Molecule - Van-der-Waals display of crystallographic data


Carlos D. Blanco

November 8th, 1989


1) VGA adapter
2) 640k of memory
3) FAST (at least 12Mhz) computer


'Molecule' was a homework assignment for a Computer Science graphics class
at the University of Arizona. It was originally developed to be run on
a Raster Technologies Model One/80, a machine capable of displaying 16
million colors at a resolution of over 1000 by 1000 pixels. During
the debugging process, however, I found it useful to create an MS-DOS
version of the program that would run with the more modest 16 colors
(at 640x480) of a VGA-compatible video card. The results are not that
bad, although they are much less realistic than the ones I obtained with
the Model One/80. If I ever upgrade to super-VGA I will release a new
version to take advantage of the extra colors/resolution. The program
does run at a rather slow rate, mainly because of the many floating point


'Molecule' reads a description of a molecule from a file and creates an
orthographic and light-shaded view of a spherical representation of the
molecule on a standard IBM VGA.

A molecule description consists of a sequence of definition and instance
lines. A definition line for an atom has the syntax

= (, , )

The printable character is declared to be a name(referred to in instance lines)
for a sphere of positive radius 'radius' and rgb color given by r, g, and b,
where r, g, and b are within [0,1]. An atom may not be defined twice.

IMPORTANT: On this MS-DOS version of the program only the last color parameter
b has any meaning. The other two are leftovers from the One/80
version and might be used in a future release.

An instance line has the syntax


This line asserts that an atom of the type named by the character is found
in the molecule and that it has its center at the point (x-coord, y-coord,
z-coord) in world space. It is an error to specify an instance of an
atom not previously defined.

e.g. the water molecule at its minimum energy state is

H=1.0(0.5, 0.5, 0.5)
O=3.2(0.2, 0.2, 1.0)
H: 2.5 2.0 0.0
O: 0.0 0.0 0.0
H: -2.5 2.0 2.0

For another example, see the ferrodoxin file.

The molecule will always be uniformly scaled in all three dimensions so that
it is always centered and justs fits on the screen AND the maximum atom
radius is 30 pixels AND the minimum radius is at least 2 pixels.


molecule filename [view=x,y] [lite=x,y] [no]

Required :
filename : the file from which to read the molecule description.

view=x,y (no spaces!!) : rotate the molecule counterclockwise by x degrees
about the x-axis and by y degrees about the y axis
before displaying it. Without this option, the view
is an orthographic projection with DOP along the
z-axis, i.e. view=0,0 and the molecule coming out
of the screen towards you.
lite=x,y : rotate the light source as for the view. The default light is
at lite=-45,45.
no : do not perform atom intersections. This I think might look better
in certain cases.

e.g try out 'molecule ferrodox'
'molecule test'
'molecule test no'
'molecule test view=60,-60 no'
'molecule ferrodox view=-45,45 lite=90,0'


After the program has stopped displaying atoms, you may press any key to
return to dos.


Yes, the program might have a few floating-point bugs which will show
themselves as blank lines in spheres.


If you are seriously interested in this program and would like to see a
version that supports a math coprocessor or if you would just like to
leave me a comment, you can reach me at CIS 73707,2334, at some Tucson
BBSs, or at '[email protected]'.

The program may be freely copied or run without any charge whatsoever. For
those interested, 'molecule' was written entirely in C (thanks to conditional
compilation!!). Thanks go to my instructor Gene Myers for the assignment, the
texture routine, and an 'almost complete' algorithm for hidden surface removal.

 December 9, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>