Here's a simple molecular modeling program written in OPENscad. It's a derivative of the OPENscad program in "Protein Models". It contains two modules, "atom" and "bond". A call to atom makes a sphere and a call to bond makes a cylinder. Atom requires a radius and a set of atomic coordinates; bond requires two sets of atomic coordinates. For example to make a water molecule we could write:
atom (.3, 0, 0, 0); // an Oxygen at the origin, .3 for its radius
atom (.25, -.96, 0, 0); // for the first H atom, .25 for its radius
atom (.25, .24, .93, 0); // for the second H atom
bond (0,0,0,-.96,0,0); // for the first O-H bond
bond (0,0,0,.24,.93.0); // for the second o-H bond
To render it all together the above commands are included within a union statement. More details in makewater.scad.
Once I had this program I began looking for coordinates of interesting molecules to print. I found a collection of fullerenes at http://www.ccl.net/cca/data/fullerenes/index.shtml Better known as "Buckyballs" you can read about the fullerenes on Wikipedia. The buckyball most discussed contains 60 carbon atoms but the coordinate collection has a range of sizes, from 20 to 540 atms.
Buckyballs contain too many atoms to type in directly. The fortran program buckyread.f takes one of the files from the fullerene collection and outputs the atom and bond calls for the openSCAD program.
Files at the fullerene repository are in Chem-3D format. I'm not familiar with the details but it seens to be a fixed format, good for fortran. All of the files in the collection start with an integer in the first three columns of the first record. The integer is the number of atoms in the file. Download one of the files and save it as text. The first record should contain the number of atoms to be read but you might have leading records which have to be deleted depending on how you obtained the file. Use the text file as input to the fortran program which outputs atom and bond calls.
I've included two sample programs makebucky60.scad and makebucky180.scad and their outputs, bucky60.stl and bucky180.stl.
I use a raft and external support to print the buckyballs. They are quite sturdy and can usually be wiggled from the support material in one piece. I've printed balls with 20, 30, 60, 180, 240, and 540 atoms. The upper picture shows examples of 20, 60 and 180 atom bucky balls. The lower picture shows a 540 atom buckyball; not so spherical, it looks like an inflated icosahedron.
Beware - buckyballs with more than 100 atoms take a long time to render.