From: Craig Knox (
Date: Mon Apr 18 2011 - 13:03:51 CDT

Dear VMD Developers:

First of all, thank you very much for such a wonderfully useful and
powerful code!

FYI, I believe there's a minor bug in the mdf molfile plugin that
causes the element symbol field to be incorrectly used in place of the
atom type (FF) field.

Here's the relevant piece of code (lines 62-66) from

static int read_mdf_structure_line(molfile_atom_t *atom, const char *line) {
  // Read pertinent structure information from the line
  if ( sscanf(line, "%[^:]:%s %s %*s %*s %*d %*s %f %*d %*d %*d %f",
              atom->resname, atom->name, atom->type,
              &atom->charge, &atom->occupancy) != 5 ) {

The sscanf line (line 64) should be changed to:
  if ( sscanf(line, "%[^:]:%s %*s %s %*s %*d %*s %f %*d %*d %*d %f",

, in order to skip the element field and read the atom_type field instead.

As an example, here's the beginning of my mdf file:

!BIOSYM molecular_data 4

!Date: Wed Jan 12 17:19:39 2011 Materials Studio Generated MDF file


@column 1 element
@column 2 atom_type
@column 3 charge_group
@column 4 isotope
@column 5 formal_charge
@column 6 charge
@column 7 switching_atom
@column 8 oop_flag
@column 9 chirality_flag
@column 10 occupancy
@column 11 xray_temp_factor
@column 12 connections

@molecule Dendrimer

LAYE_1:N1 N n3 ? 0 0 -0.5610 0 0 8 1.0000
0.0000 C1 C21H_2:C21 C21H_3:C21


vmd > set a1 [atomselect top "index 0"]
vmd > $a1 get {index name type element atomicnumber}
{0 N1 N X -1}

So, the molfile plugin read the 2nd field ('N') as the atom type
instead of the 3rd field ('n3').

Notice that this bug is likely due to the misleading header/comment in
the mdf file, which says "@column 2 atom_type", although this seems to
be counting from zero, not one (i.e., there's an implicit "@column 0

Is there any reason to use the element field in place of the
atom_type, or is this a bug?


Craig K. Knox, Ph.D.
Computational Materials Science
U.S. Army Research Laboratory
Materials & Manufacturing Science Division
Macromolecular Science & Technology Branch
4600 Deer Creek Loop
RDRL-WMM-G, Bldg. 4600, Rm. C237
Aberdeen Proving Ground, MD  21005-5069
410-306-0856 (phone)
410-306-0676 (fax)