From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Nov 18 2010 - 15:41:28 CST

On Thu, 2010-11-18 at 12:23 -0800, Erin L. wrote:
> Hello,

hi erin,

> I'm new to VMD and having trouble with particle positions in triclinic
> unit cells. I've written my own program and make output in both .xsf
> (using www.xcrysden.org/doc/XSF.html as a guide) and .xyz file format.
>
> My problem is that the two files, when loaded into VMD, give me
> different visualizations of the crystal. I've narrowed down the
> problem to the .xsf file coordinate positions are not consistent from
> input to visualization, but I'm not sure why. How can I fix or

but i am. ;-)

the reason lies in the xsf plugin: it rotates all the data
after reading, if the cell vectors are not conforming to the
assumptions that VMD makes. the internal storage in VMD for the
periodic cell does not contain information about the orientation,
so for getting the correct periodic visualizations. the whole
data set will have to be rotated, so that the a vector is
collinear with the x-axis, the b-vector in the xy-plane and
the z-vector so that you get a right-handed coordinate system.

unfortunately, there is no easy way to work around this.
when i adjusted to .cube reader for it (and later wrote the
.xsf reader) i had to make a choice between keeping the coordinates
consistent and getting correct periodic display. i chose the
latter. if you would like it the other way around, my suggestion
would be to compile your own copy of the .xsf file molfile
plugin where this rotation is disabled. for as long as you have
a higher (minor) version number in the plugin as the one that
ships with the VMD binary, your .so file will override the
plugin shipped with VMD (you have to be careful with loading
files from the command line, here the reading usually starts
before the plugin is overridden).

i hope that explains matters. let us know, if you have
additional questions on this subject. we'd been pondering
better solutions on and off, but they require quite a bit
programming in VMD, and there is a shortage of people with
the experience and enough free time at their hands... :-(

cheers,
    axel.

> reconcile this? I would prefer to keep using the .xsf format because
> the files are much smaller.
>
> I've made up a minimal example with only one non-orthogonal angle.
> The .xsf and VMD Query results are below. I should note that the unit
> cell vectors in the .xsf seem to work just fine. The command "pbc
> box" in the Tk Console draws the unit cell as specified and it matches
> the lattice from the .xyz file. I'm using VMD 1.8.6 (Linux, 64 bit),
> but have also checked it on VMD 1.8.7 (Linux, 32 bit). Any thoughts
> or pointers would be appreciated.
>
> Thank you for your time,
>
> Erin
>
> ------------
>
> sample .xsf file:
>
> -------------
> CRYSTAL
> PRIMVEC
> 5.000 0.000 0.000
> 0.000 5.000 0.000
> 0.000 2.500 4.330
>
> # 5.000 5.000 5.000 (a, b, c lengths)
> # 60.000 90.000 90.000 (alpha, beta, gamma angles)
>
> PRIMCOORD
> 4 1
> 12 0.000 0.000 0.000
> 12 2.500 0.000 0.000
> 12 0.000 2.500 0.000
> 12 0.000 1.250 2.165
> --------------
>
> VMD Coordinate Query results on the .xsf unit cell particles:
>
> --------------
>
> 0.00 0.00 0.00
> 2.50 0.00 0.00
> 0.00 2.50 1.25
> 0.00 5.00 4.665
>
> -------------
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.