925-456-1020 info@acornnmr.com

Displaying molfiles

Displaying molfiles


ML – Molecule subroutine

This is a subroutine for displaying structures based on a previously-saved molfile.  Most drawing programs have the option of saving the structure as a molfile, which is a text file listing each atom and bond.  A brief description of the molfile format is given below.

Typing ML enters the Molecule subroutine.  Note that "Molecule" is displayed in the gray status bar, and the menus have changed.  A File/Open dialog box is displayed, allowing the user to select a .mol file to be displayed.  The molecule can be moved and resized in the usual way.  As with all subroutines, typing <ENTER> or choosing Exit from the File menu will exit the subroutine back to the NUTS base level.


More than one molfile can be displayed.  Typing G or choosing Get Molfile from the File menu allows additional files to be displayed.  Typing I or choosing Increment from the File menu allows each structure, in turn, to be selected.  The selected molecule can be deleted by typing D.  All molecules can be cleared by typing C or choosing Clear Molecule List from the Edit menu.


The Edit menu contains several options, which can also be entered from the keyboard.   Commands operate on the currently selected molecule.  The + and – keys allow the bond line width to be changed.  The font can be changed by typing F or selecting Choose Molecule Font from the Edit menu.  The font can also be set from outside the molfile subroutine with the FJ command.


  The A command displays atom properties

   The B command displays bond properties


The # key toggles on/off display of the numeric atom labels.

The preliminary steps are in place to be able to search a chemical shift database by clicking on a specific carbon atom.  This is done by generating a text-based code for the atom, and then searching a pre-existing text database for matches.  Right click on a carbon atom to display matches found in a small database included with NUTS.  The code for the atom can be displayed by placing the cursor on the chosen atom and typing Note that this feature is incomplete.

See also: Displaying a structure as a MetaObject, 13C chemical shift searching, substructure coding

Sample molfile

A molfile for 2-butanone        

looks like:

ChemWindow   5  4  0  0  0  0  0  0  0  0  1 V2000     2.2994    2.0277    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0     3.2617    0.3611    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0     2.2994    0.9166    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0     1.3372    0.3611    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0     0.3750    0.9166    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0   3  1  2  0   3  2  1  0   4  3  1  0   5  4  1  0 M  END

The first 2 lines are unimportant for our purposes.  The next 5 lines are the atom table, one line per atom.  The first 4 columns are the atom’s x, y and z coordinates and atom type.  Because this was generated from a 2D drawing program (ChemWindow), all z coordinates are zero.   

The next 4 lines comprise the bond table, 1 bond per line.  The first 2 columns list which 2 atoms are connected by the bond.  The third column indicates whether the bond is single (1), double (2), triple (3) or aromatic (4).

Details of the MolFile format

First line of table is the "Counts Line":

aaa bbb lll fff ccc sss xxx rrr ppp jjj mmm vvvvv
aaa = number of atoms bbb = number of bonds lll = number of atom lists fff = obsolete ccc = chiral flag: 0=not chiral, 1=chiral sss = number of stext entries xxx = obsolete rrr = obsolete ppp = obsolete jjj = obsolete mmm = number of lines of additional properties,including the M END line.  No longer supported, the default is set to 999. vvvvvv is the version number - this software accepts V2000 or V3000

The next block of lines is the Atom Block:

xx.xx yy.yy zz.zz aa dd cc ss hh bb vv HH rr ii mm nn ee
x = x atom coordinate y = y atom coordinate z = z atom coordinate a = atom symbol ( this software supports strings less than 10 in length d = mass difference c = charge s = atom stereo parity - 0=not stereo, 1=odd, 2=even, 3=either h = hydrogen count b = stereo care box v = valence H = H0 designator - 0=not specified, 1=no H atoms allowed r = Not Used i = Not Used m = atom-atom mapping number n = inversion/retention flag e = exact change flag - 0=property not applied, 1=change on atom must be exactly as shown

The next block of lines is the Bond Block:

11 22 tt ss xx rr cc
1 = First atom number 2 = Second atom number t = Bond type - 1=Single, 2=Double, 3=Triple, 4=Aromatic s = Bond Stereo - 0=Not Stereo, 1=Up, 4=Either, 6=Down x = Not Used r = Bond Topology - 0=Either, 1=Ring, 2=Chain c = reacting center status

Detailed description of the molfile format can be found at http://www.mdli.com/downloads/public/ctfile/ctfile.jsp.   Note that not all drawing programs adhere strictly to the published format.

Last updated: 3/6/06