Google Summer of Code 2016 is coming to a close! Fortunately, I've been able to accomplish my primary goals for Avogadro2 and a little more. My blog post after the midterm evaluations was here:
http://avogadro2crystals.blogspot.com/2016/06/recently-those-of-us-in-google-summer.html
I've mostly been adding operations related to crystal space groups for the molecular editor. I'll be discussing a few of the new ones that I have added here.
First of all, I've added two features called "fill unit cell" and "reduce to asymmetric unit." These two features can be thought of as opposites of one another. This will be explained more as we go along.
For an example, let's take post-perovskite (MgSiO3). This material is reportedly common in the mantle of the earth. It is stable under the pressures there, and it has important properties as far as geophysics is concerned. It's space group is Cmcm (number 63). This means the Bravais lattice is of type C, and it has two mirror planes (the m's) and a glide plane (the c). Don't worry about those details too much, though, if you aren't familiar with them...
It's common for papers in journals and databases to give a crystal's information as its asymmetric unit. For post-perovskite, that may look something like this (data from here
http://crystallography.net/cod/9009217.html):
a, b, c, alpha, beta, gamma
2.456, 8.042, 6.093, 90, 90, 90
Fractional Coordinates
Mg 0.0 0.25 0.25
Si 0.0 0.0 0.0
O 0.0 0.923 0.25
O 0.0 0.631 0.436
In Avogadro2, this looks like the following:
|
Figure 1: Asymmetric Unit of Post-Perovskite (MgSiO3)
Magnesium is green, silicon is grey, and oxygen is red. |
The cell looks rather empty, doesn't it? That's because only the necessary atoms are included. You find the other atoms by applying symmetry operations for the space group to the existing atoms. This is done with the "Fill Unit Cell" feature. In Avogadro2, you now just need to select it from the dropdown menu as shown in Figure 2:
|
Figure 2: Fill Unit Cell in Dropdown Menu |
Once "Fill Unit Cell" is selected from the dropdown menu, it will ask the user to select a space group. This is necessary because the space group cannot be determined from an asymmetric unit since it does not yet have the correct symmetry. The Select Space Group dialog is a scroll-able table containing all of the space groups - it looks like the following:
|
Figure 3: Select Space Group Dialog |
Once a space group has been chosen, the fill unit cell feature will apply the symmetry operations to every atom in the crystal. The result for post-perovskite is the following:
|
Figure 4: Post-Perovskite with a Filled Unit Cell |
That is what the filled conventional crystal of post-perovskite actually looks like. Notice that the numbers of atoms for magnesium and silicon went from 1 to 4, but the number of oxygen atoms went from 2 to 12. This is because an atom that lies on a symmetry site may be duplicated a different number of times than an atom on another symmetry site.
So "Fill Unit Cell" is a very useful feature! But what if we want to go the other way? As in, we start out with a filled unit cell, and we want to reduce it to its asymmetric unit to reduce the amount of data? Well, that is done with the "Reduce to Asymmetric Unit" feature. Starting with our filled cell, you can select the "Reduce to Asymmetric Unit" feature via the following dropdown menu:
|
Figure 5: Reduce to Asymmetric Unit Dropdown Menu |
Like "Fill Unit Cell," "Reduce to Asymmetric Unit" needs to know the space group in order to perform its actions. Because the unit cell is probably filled, the program uses space group detection from the other functions I added (see the first blog post linked at the top) to try to determine the space group. In our case, it detects that the space group is Cmcm (number 63) as shown below:
|
Figure 6: Reduce to Asymmetric Unit Dialog |
The user can decide whether or not to proceed with the perceived space group. If the user selects "yes," then the algorithm will proceed. If the user selects "no," then the Select Space Group dialog (Figure 3) appears and allows the user to select a different space group. In our case, when we use the space group 63 (Cmcm), the filled unit cell gets reduced, and it ends up looking just like the crystal Figure 1. "Reduce to Asymmetric Unit" basically works by looking at the results of the symmetry operations when applied to an atom. If there are atoms at the positions that result from the symmetry operations, they get removed. So "Reduce to Asymmetric Unit" does indeed do the opposite of "Fill Unit Cell."
Another recent feature that I added was a "Symmetrize" feature. This uses the space group library, and it is similar to the "Conventionalize Cell" and "Reduce to Primitive" features I added (see my first blog post linked at the top). It can be found in the dropdown menu as shown below:
|
Figure 7: Symmetrize Dropdown Menu |
It's probably best to think of "Symmetrize" as a combination of "Conventionalize Cell" followed by "Reduce to Primitive," although it does it in one operation to save time and memory. "Conventionalize Cell" idealizes the atom positions to match those of the space group, and it changes the unit cell to be in its conventional form (as defined by its Bravais lattice). "Reduce to Primitive" does not do either of these things, but it reduces the crystal to the smallest form in which it can be represented. So "Symmetrize" idealizes atom positions and reduces the crystal to its smallest form. The result of symmetrizing the filled unit cell of post-perovskite is the following:
|
Figure 8: Symmetrized Post-Perovskite |
Notice that the number of atoms has been reduced, and the unit cell is a lot smaller. So this is similar to a "Reduce to Primitive" feature in that way. The difference, however, is that the positions of the atoms have also been idealized so that they should be in nearly perfect positions for the space group.
As I mentioned at the top of the blog, I've been able to do work on some additional things with Avogadro2 as well. One of them involves undo and redo commands. Before the summer, none of the crystal features in Avogadro were "undo-able" (and consequently, none of them were "redo-able" either). This is an important feature: if you were to make a mistake by performing a crystal feature, you'd have to start over in your editing. In addition, undo and redo features make it easier to review what you have done thus far. Thus, I added in the necessary commands and functions so that "undo" and "redo" operations can be performed on the old crystal features (as well as the new ones). I also changed the program so that it displays text now for the undo and redo commands. They look like so:
|
Figure 9: Undo and Redo Operations |
This is certainly a plus as it makes editing easier.
I've fixed a few other bugs as well including ones in the atomic coordinates editor. These fixed bugs help keep the user experience smooth.
Some final things that I am currently working on but have not yet been added are features involving YAeHMOP (Yet Another extended Hückel Molecular Orbital Package). Extended Hückel Theory has proven to be a fast and successful semi-empirical method for quantum calculations. It was developed by Roald Hoffmann, and its applications were part of the reason he won the Nobel Prize in 1981. YAeHMOP was created by a student, Greg Landrum, who worked in Roald's research group. In order to improve on the versatility of Avogadro, we decided to add YAeHMOP to Avogadro1 and Avogadro2. Its inclusion opens the door to many possibilities, including molecular orbital calculations, band structure calculations (for solids), total and partial density of states calculations (for solids as well), and more.
I've worked mostly on band structure calculations so far in Avogadro1. After the user has created a crystal (or imported one from somewhere else), they can select "Calculate Band Structure" from the dropdown menu. I am using diamond as an example. "Calculate Band Structure" is located here in my branch of Avogadro1:
|
Figure 10: Yaehmop Calculate Band Structure Dropdown Menu in Avogadro 1 |
Once that is selected, the following dialog appears:
|
Figure 11: Yaehmop Band Structure Dialog in Avogadro 1 |
In this dialog, the user is able to select the number of k points connecting special k points. K points are three dimensional coordinates in reciprocal space. They are locations that are "sampled" during quantum calculations for crystals. The higher the number of k points connecting special k points, the smoother the curves will be, but the calculation will take longer since it must sample at more k point values. The special k points are typically high symmetry points in reciprocal space for a space group. In our case, diamond is of space group 227 (Fd3m), so a few high symmetry points in reciprocal space are Gamma (0,0,0), X (1/2,0,1/2), and L (1/2,1/2,1/2). The lines will begin at the first special k point that is given and traverse through each special k point after it until it reaches the final special k point. So, our order is L, G, X (since that is what was input in Figure 11). When you hit "Ok", Yaehmop calculates the band structure using the information you gave it. Since it is a semi-empirical calculation, it takes less than a second on most computers for it to finish, and the following graph is plotted:
|
Figure 12: Yaehmop Band Structure for Diamond in Avogadro1 |
This plot is the band structure of diamond as obtained from YAeHMOP.
The YAeHMOP features are currently being worked on (so they are not yet released to the public). There are still some details and bugs to sort out. In addition, some other features are going to be added as well (like total and partial density of state and molecular orbitals calculations). However, they should be in usable sometime in the near future!
It's exciting to see where Avogadro2 is heading with these new features!
Thanks for reading! Hope you enjoyed it!
Patrick Avery