Monday, August 21, 2006

Crystal structures in Jmol

The following CML is indicates how unit cell information can be represented. By using the titles 'a', 'b', 'c', 'alpha', 'beta' and 'gamma', Jmol is able to read the unit cell properties:

<?xml version="1.0"?>
<molecule xmlns="http://www.xml-cml.org/schema">
<crystal>
<scalar title="a">8.781</scalar>
<scalar title="b">8.845</scalar>
<scalar title="c">10.171</scalar>
<scalar title="alpha">90.00</scalar>
<scalar title="beta">101.34</scalar>
<scalar title="gamma">90.00</scalar>
</crystal>
<atomArray>
<atom id="Fe1" xFract="1.0" yFract="0.0" zFract="1.0" elementType="Fe"/>
<atom id="N1" xFract="0.7619" yFract="0.0548" zFract="0.9299" elementType="N"/>
</atomArray>
</molecule>

However, if you want to make to of the full power of CML, you would not use the @title attributes on the <crystal>'s <scalar> elements, but use @dictRef instead. Dictionary references allow to make the semantics complete: it would explicitely say what you mean with 'a', or 'beta'. The CML project has setup a simple CML dictionary (namespaced: http://www.xml-cml.org/dict/cmlDict) which contains the concepts for these six unit cell properties. The example then becomes:

<?xml version="1.0"?>
<molecule xmlns="http://www.xml-cml.org/schema">
<crystal xmlns:cmldict="http://www.xml-cml.org/dict/cmlDict">
<scalar dictRef="cmldict:a">8.781</scalar>
<scalar dictRef="cmldict:b">8.845</scalar>
<scalar dictRef="cmldict:c">10.171</scalar>
<scalar dictRef="cmldict:alpha">90.00</scalar>
<scalar dictRef="cmldict:beta">101.34</scalar>
<scalar dictRef="cmldict:gamma">90.00</scalar>
</crystal>
<atomArray>
<atom id="Fe1" xFract="1.0" yFract="0.0" zFract="1.0" elementType="Fe"/>
<atom id="N1" xFract="0.7619" yFract="0.0548" zFract="0.9299" elementType="N"/>
</atomArray>
</molecule>

Jmol currently does not recognize, and thus ignore, this dictionary (bug #1543784).

Sunday, August 20, 2006

CML Explained

There seems to be a niche in explaining the use of Chemical Markup Language, so here goes. This blog will discuss frequently and less frequently asked questions.