From: FX (fxcoudert_at_gmail.com)
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: https://dl.dropboxusercontent.com/u/52398724/toto.xyz

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.

FX

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