Saturday, March 17, 2012

Count on your neighbour

Counting how many stuff you have is important
Scrooge counting his money
... but boring
counting sheeps
During last week, I saw a few times one of my fellow lab member printing a picture like this
Phase contrast microscopy picture of nucleation
and putting a cross on each white object. He was counting them. The first time I saw this, I thought he had to do it for one or two pictures. But at the end of the week, I asked him what he was doing and if I could help.


The above picture is taken when a phase A nucleates into a phase B. This appends for example if you cool a liquid below it's crystallization temperature. A crystal nucleus will appear from time to time and grow. The probability to form a nucleus (nucleation rate) is a very important physical parameter: if nucleation is extremely rare, you will have a single nucleus in you bottle that will grow to form a single crystal before the birth of the next nucleus. This is exactly what you want for example when you make a silicon wafer for microelectronics. If nucleation rate is high, then you will have many nuclei growing at the same time and at the end a material that is made of many different crystals. You may want this in ice creams, because small crystals have a more pleasant texture than big ones.




The only method to measure the nucleation rate in a given system is to count the number of nuclei function of time. So my colleague was counting ... for the whole week. He had done two dozens of experiments at different temperatures and compositions, and took a series of picture for each (like every couple of second for a few minutes). This makes hundreds if not thousands of pictures to analyze. And his plan was to do it by hand.

Try to count how many nuclei are in the above picture. This is a task that need careful attention: large nuclei have a good contrast, but there are many smaller ones very difficult to tell from the background. That's why my colleague was printing and crossing the counted nuclei.

As I told you in a previous post, this kind of procedure can be fully automatized. The programming takes time, so if you have only a few pictures to analyze, this may not be a good idea. In addition, this counting is tricky because the objects can have very different sizes and contrasts. However I, sitting 3 steps away, had already developed and tested such a program. The physical signification is different (I am tracking polydisperse colloidal particles) but the technology is the same. So yes, I could help.

An hour later my colleague had in his computer a script counting the nuclei for him, a picture per second or less, automated to treat a whole time series automatically without human intervention. Setting-up Python and dependencies on his computer took half of the time. We should have communicated earlier, before he had spent a week doing what the script could do in an hour.

Result of the localization. Original image (red) superimposed with localized positions (cyan squares)
As you can see on the picture above, the result is not 100% perfect, but quite close. For example there are problems when nuclei are fusing and there are also (very few) centers counted multiple times. I think I know how to adapt better my program to this situation, but my colleague told me it was enough precision for him.

This gives an other motivation to explain (in a future post) how this counting/localizing method is working.

Tuesday, January 3, 2012

Mikan stacking fault

Never leave a crystallographer with a pile of fruits.

HCP(left)-FCC(right) stacking fault
Even if I do not consider myself a crystallographer, I spent most of my PhD identifying local symmetries in materials. And the pioneers of the land of symmetries in materials are the crystallographers, so I owe them most of my analysis tools ... and the tetris-o-philia.

The FCC side, note how the 3rd layer's fruits sit on top of voids in the first layer
During new year's vacation in my family in law, my daughter (in the background of the upper picture) started emptying the reserve of mandarin to bring them on the living room's table. This got me started at piling the fruits.
The HCP side. 1st layer and 3rd layers sit on top of each other
The pile begins by a layer where the fruits form hexagons. This is the most compact way of packing disks of the same size in 2D, and thus spheres of the same size on the same plane. Real fruits have different sizes, but anyway.

For the second plane, you have two possibilities that are mirror image of each other, a translation, a rotation of 30 degree, etc. In short, this is not a real choice because you have no reference point.

The same alternative has richer consequences in the third plane. Depending on your choice, you end whether with
  • 3rd layer's fruits sitting on top of 1st layer's fruits
  • 3rd layer's fruits sitting on top of 1st layer's voids
Because you have the first layer as a reference, the choice is no more silent. You end with two different crystals: Hexagonal compact (HCP) and Face-centered cubic (FCC).

FCC is left, HCP right, and the grain boundary in the middle (hole in the 3rd layer)
Now let's be messy. I made two different choices of 3rd layer in two different places. The line where the two stacking meet is a stacking fault. It is not possible to pack same-size spheres efficiently on this line. Evidence is the hole you can see on the pictures.
FCC is right, HCP left, and the grain boundary in the middle (hole in the 3rd layer)
Finally, I added a fourth layer, with fruits sitting on top of the ones of the 2nd layer. No fault in this fourth layer, I can continue my stack if I want. However the fruits immediately over the fault line have a little more space to rattle. The same holds for the fruits immediately below (2nd layer).

If you think about the stacking of a crystal of hard spheres, the price paid to have such a stacking fault is the spheres you could not fit in because of the line. In my very small crystal, I could have fit 2 more spheres without the fault. This is a global penalty.

On the other hand, the space gained to rattle by the spheres neighbouring the fault line increases their (vibrational) entropy and thus decreases their free energy. This is a local gain.

When you balance the global penalty with the local gain, you end up with quite a lot of stacking lines.