From: FX (
Date: Sat Nov 16 2013 - 15:58:20 CST

> There must be something Iím missing hereÖ On VMD 1.9.1 on my Mac, both ďmeasure symmetryĒ and its graphical interface SymmetryTools fail to recognize the simple symmetry (D2h) of this simple molecule:

Iíve confirmed this is a bug in VMDís source code, namely in file MeasureSymmetry.C. I suppose itís not been exposed before because people usually use SymmetryTools on very small systems. When the number of atoms is larger than 70 (maxnatoms), only some of the atoms are checked. This makes sense, but itís done wrong:

> // If we have more than maxnatoms atoms in the selection then pick
> // only approximately maxnatoms random atoms for the comparision.
> if (sel->selected>maxnatoms && vmd_random()>maxnatoms/sel->selected)
> continue;

I cannot make head or tail of how the second part (after the &&) is supposed to work. Because sel->selected>maxnatoms, the integer division maxnatoms/sel->selected is guaranteed to return zero. Moreover, this is compared to a random integer between 0 and VMD_RAND_MAX (= 2^31 - 1). I suppose two thinkos coexist:

  1. maxnatoms/sel->selected should be a floating-point division
  2. the codeís author thought vmd_random() returned a real between 0 and 1

But even then, I think the test should be < instead of > (i.e. you want to test a fraction of nmax/nsel atoms, not 1 - nmax/nsel).

Anyway, I cannot write a proper patch and test it right now (I canít manage to build VMD on my new Mac laptop, have to figure out why first), but Iím quite sure of my analysis: if I reduce my test structure to 68 atoms (while keeping the symmetry), then suddenly VMD guesses the point group correctly.


PS: there are other occurrences of vmd_random() in MeasureSymmetry.C, and all of them seem wrong.