Fix problems when encoding ID.

When we used an id for the element which is not the same as the id in the data
we had problems, notably we couldn't send things to jmol to draw. This was
because we had to encode the ids for the elements while we needed the raw ids
for display. This commit fixes that by adding some more methods to generate the
element ids and ways to get the element id.
Update libs