Benzene is a planar molecule; six carbon atoms and six hydrogen atoms are arranged in a ring, with double bonds between the carbon atoms. Bonds, nuclei, and electron spheres with van der Walls radii can all be shown. Their positions are generated by subroutines which can generate rings with an arbitrary number of atoms, but six is the chemically most significant value.
/* molhr - generate a hexagonal ring */ void molhr(s,r,rr,a,b,c) double s[][7], r, rr, a, b, c; {int i; double ph; for (i=0, ph=0.0; i<6; i++,ph+=(60.0*3.14159)/180.0) { s[i][0]=r*cos(ph); s[i][1]=0.0; s[i][2]=r*sin(ph); s[i][3]=rr; s[i][4]=a; s[i][5]=b; s[i][6]=c;} }
/* molbe - generate a benzene molecule */ void molbe(s,ac,rc,ah,rh) double s[][7], ac, rc, ah, rh; { molhr(&s[0][0],rc,ac,30.0,50.0,40.0); molhr(&s[6][0],rh,ah,-60.0,40.0,30.0); }