Unit Cells

Ideas often come to my brain at incredibly random times.

Last night as I was falling asleep, I realized an easy way to handle
unit cells (and crystals) in the rendering engines of libavogadro.

Right now, you could say the engines are completely ignorant of
anything related to a crystal. (The current code won’t even draw xyz
axes.)

It’s pretty easy to handle adding crystal structures though.
Typically the result from Open Babel the full unit cell. If we want
to show more, we simply add a parameter to the rendering engines,
telling it an offset to draw atoms and bonds. So one unit cell starts
at (0,0,0), another is offset along the “a” translation vector to (a,
0, 0) or whatever.

Downsides:

  • Sometimes molecules have bonds across unit cell boundaries. This
    doesn’t solve that problem.
  • Need to write the code and add a control to show multiple unit cells.
  • Probably hard to measure across a unit cell boundary (when we have
    a measure tool, that is).
  • We don’t have code to draw xyz axes or the unit cell frame yet.

Upsides:

  • Really easy to code.
  • Should handle selection correctly (i.e., if I select one atom, then
    all symmetric versions of it are selected two – they are all the
    same Atom object).

Does any of that make sense? Carsten, I think you mentioned wanting
to have some crystal support in Kalzium, right?

Thanks,
-Geoff

Am Freitag, 30. März 2007 22:26 schrieb Geoffrey Hutchison:

Does any of that make sense? Carsten, I think you mentioned wanting
to have some crystal support in Kalzium, right?

I am looking at this from a teachers perspective. What I have in mind is to be
able to draw these things in 3D and be able to rotate them. If possible, the
translation (is that the english term? In german, “Translation” means adding
other unit cells to the already existing ones so that the crystal becomes
bigger. You translate on the three axes by a multiple of one of the vectors).

Or the deluxe version:

Carsten

On Mar 30, 2007, at 5:55 PM, Carsten Niehaus wrote:

In german, “Translation” means adding other unit cells to the
already existing ones so that the crystal becomes
bigger. You translate on the three axes by a multiple of one of the
vectors).

Yes, exactly right. Open Babel can calculate the translation vectors
from unit cell parameters via OBUnitCell.

My proposal (adding an offset point to the rendering engines) makes
it easier to “grow” the crystal. Sometimes it’s easier to show parts
of the crystal by showing a larger picture.

http://commons.wikimedia.org/wiki/Image:Linbo3_Unit_Cell.png

Yes, exactly that. All they’ve added is lines for the unit cell
boundaries (i.e., the translation vectors). Shouldn’t be too hard to
do that.

Cheers,
-Geoff

Am Samstag, 31. März 2007 00:01 schrieb Geoffrey Hutchison:

http://commons.wikimedia.org/wiki/Image:Linbo3_Unit_Cell.png

Yes, exactly that. All they’ve added is lines for the unit cell
boundaries (i.e., the translation vectors). Shouldn’t be too hard to
do that.

If Avo / Kalzium is able to render a crystal like that and is giving the
teacher a tool to show his students the angles and distances Avo would be a
real win for school.
You wouldn’t believe how much schoolsoftware can suck. Suck. Suck.

Carsten

On Mar 30, 2007, at 6:12 PM, Carsten Niehaus wrote:

If Avo / Kalzium is able to render a crystal like that and is
giving the
teacher a tool to show his students the angles and distances Avo
would be a
real win for school.

As I said, I don’t know how easy (possible?) it will be to show
markers or measurements across a unit cell boundary. Rendering
multiple unit cells should be really easy.

On the other hand, it’d be pretty easy to make a plugin which would
actually multiply the Atom objects to make a “supercell” for that
purpose. That’s the benefit of open source!

You wouldn’t believe how much schoolsoftware can suck. Suck. Suck.

Yes, I can believe. Why do you think I work to write my own? :slight_smile:

Cheers,
-Geoff

Am Samstag, 31. März 2007 03:34 schrieb Geoffrey Hutchison:

As I said, I don’t know how easy (possible?) it will be to show
markers or measurements across a unit cell boundary. Rendering
multiple unit cells should be really easy.

On the other hand, it’d be pretty easy to make a plugin which would
actually multiply the Atom objects to make a “supercell” for that
purpose. That’s the benefit of open source!

What about stealing some ideas from this age old application?

http://www.crystaldesigner.no/UserGuide/tutorial.html

About the “choosing the space group” dialog (in case we decide we want
something like that):

Fortunally, OB 2.1 already has basic support for the spacegroups:

int OBUnitCell::GetSpaceGroupNumber( std::string name)

The rest of the data (like the vectors and angles of each spacegroup) cannot
be added to OB 2.1, right? So that had to go into Avo and as soon as done
probbaly be moved to OB 2.2/3.0.
I would be interested in doing the dialog, by the way.

Carsten