The Magic Sand Slicer

We have published for the first time a project on Instructables: a website specialised in publishing interesting DIY projects by an effervescent community of makers and educators.

The project is called the Magic-Sand Slicer and it is an education project initially conceived as a STEM activity to learn using Arduino, a 3D printer, and some exciting science. It is also a collaboration with my son Leonardo who helped me in evaluating the device as a STEM student. We have learned a lot together, and we want to share the results of this long journey. This project aims to create a device that automatically makes sections of a cylinder of easy-to-cut colored material. That can be used for practicing 3D image reconstruction of the colored blogs hidden in the column. The so-called Magic-Sand (c), also known with other trademarks names, becomes suitable for this experiment.
What is the point of making pictures of thin layers of sand and then reconstructing it digitally? Is it just for the fun of it? It varies on who is using it. However, students and teachers from different disciplines (e.g. geology, biology, medical) can find it a helpful education device to practice with image reconstruction from the serial sections. It could also be of interest to a geologist interested in sedimentary material plasticity to study rock and the secrets it beholds, or to a process, engineering to emulate the packing of fine granular materials. Finally, an artist can make a fantastic program of unraveling magic forms generated by packing colored sand. 

I was surprised that the project got so much interest in very short of time and I thank the Instructable community for their nice welcome! If you like to know more about the project (and try it!) then you can read our instructable here.

I also just realized that the Instructable was reviewed in the Arduino blog site by the Arduino team!

Retro programming nostalgia V: L’Equilibrio e la Titolazione Acido/Base (Parte II)

Questo secondo articolo continua il mio personale viaggio retro-computazionale delle titolazioni acido/base. Nell’articolo precedente, ho mostrato come calcolare un equilibrio acido base per acidi e basi forti. In questo articolo, vengono descritte anche le subroutines per le titolazioni di acidi e basi deboli monoprotici. Il metodo che ho usato risolve in modo esatto il calcolo dei pH e si basa su articolo pubblicato sulla rivista di chimica “Rassegna chimica” da Prof Luigi Campanella (e Dr G. Visco) nel 1985. Ricevetti dall’autore stesso una copia dell’articolo quando frequentavo il suo corso di chimica analitica presso l’Università “la Sapienza” di Roma. Ricordo che scrivere un programma per lo studio delle titolazioni non solo fu divertente e stimolante ma mi aiutò molto a capire a fondo l’argomento. Pertanto raccomando il giovane lettore di provare a convertire il programma in un linguaggio moderno a voi più familiare (per esempio il Python) per meglio comprenderne il funzionamento.

Continue reading

A Practical Introduction to the C Language for Computational Chemistry. Part 3

Sphere. From Space, from Space, Sir: whence else?

Square. Pardon me, my Lord, but is not your Lordship already in Space, your Lordship and his humble servant, even at this moment?

Sphere. Pooh! what do you know of Space? Define Space.

Square. Space, my Lord, is height and breadth indefinitely prolonged.

Sphere. Exactly: you see you do not even know what Space is. You think it is of Two Dimensions only; but I have come to announce to you a Third — height, breadth, and length.

Square. Your Lordship is pleased to be merry. We also speak of length and height, or breadth and thickness, thus denoting Two Dimensions by four names.

Sphere. But I mean not only three names, but Three Dimensions.

Adapted from: 
Flatland: A romance of many dimensions by Edwin A. Abbott

ADVENTURE IN SPACELAND

In the part 2 of this tutorial, we have learnt how to use arrays and how to read atomic coordinates from a file. In th eappendix, youc an find an example of solution of the exercises given in the previous tutorial.

In this third part, we are going to learn how to generate three-dimensional coordinated of atoms in a cubic crystal lattice and how to calculate non-bonded molecular potential and the force acting among them.

Continue reading

A Practical Introduction to the C Language for Computational Chemistry. Part 2

In the first part of this introduction to C language, we have learnt the basic of the C language by writing simple programs for the calculation of the non-bonded interaction between two particles at variable distances. Some solutions to the first part exercises are reported in the appendix of this article.

In this second tutorial, we will learn how to use arrays data types and how to load them with a set of data read from a file. We will also use these data to perform numerical calculations and write results in output files.

Arrays and Pointers Datatypes

The program that calculate the energy of interaction between two particle doe not take in account the actual position in space of the two particle but only their distance. If we want to study the dynamics of a system composed by multiple atoms in a tridimensional space, it is way more convenient to represent the and calculate their interactions by using the coordinates directly to evaluate the distances.

Continue reading

The Dandelion (Taraxacum Officinalis) and OpenCV

The dandelion’s pallid tube
Astonishes the grass,
And winter instantly becomes
An Infinite Alas —

The tube uplifts a signal Bud
And then a shouting Flower, —
The Proclamation of the Suns
That septulture is o’er.

– Emily Dickinson

The yellow flowers and the delicate and beautiful florescence of Dandelion catch the attention of both romantic and curious souls. The aerial consistency of the fine silk decorated seeds that glance to the sunlight as crystalline material became the favourite subject of inspired photographer and the toy of amused children. Beside the grace of its forms, other interesting and curious secret is hidden in its phloem fluids. In fact, if you cut one of the stems of the plant a milky sticky liquid will flow out of the wound resection. This latex is going to polymerize at 30-35 oC in few minutes in a yellow-brown quite solid mass. Around the year 1982, I have annotated this observation but I could not find in my later notes further follow-ups study on the topics. It was a casual observation but I didn’t know at that time that this latex is indeed very useful. A variety of the Taraxacum (Taraxacum koksaghyz, Russian Dandelion) was used in Russian and American to produce a replacement of the natural rubber from Brazil during the WWII that was in shortage because of the war. Now days, many researches are in progress to exploit the lattice of Taraxacum and also Taraxacum brevicorniculatumas a convenient replacement of the rubber plant lattice. A recent study has shown the presence of rubber particles in the lattice of these plant in 32% proportion composed prevalently by poly(cis-1,4-isoprene) at >95% of purity (www.biomedcentral.com/1471-2091/11/11). The brownish lattice condensate that, as I reported in my note, forms after exposing for several minutes the latex to the air, is caused by the presence of the polyphenol oxidase (PPO) enzyme that produces the fast coagulation of the latex by catalysing the oxidation of polyphenols. Genetic engineer the plant, it is possible to reduce the amount of PPO in the latex making economically competitive the use of this resource for the production of latex.

Continue reading

Programming in Awk Language. LiStaLiA: Little Statistics Library in Awk. Part I.

In the following previous Awk programming articles

The AWK Programming Language

Awk Programming II: Life in a Shell

Awk Programming III: the One-Dimensional Cellular Automaton

I have given a short introduction to this very useful Unix program by also showing two example of elaborate applications. In this fourth article of the series, I am going to show a little library of functions that can be used for basic statistical analysis of data sets. I have written (and rewritten) many of these function but I have spent little time to collect them in a library that can be used by other user. So this article give me the motivation to achieve this target. I didn’t extensively test the library so I am realeasing it as alpha version. If you spot errors or you have improved it then please just send me your modified code!

READING DATA SETS

We start with a function that can be used to read data from a text file (ascii format). A good data reader should be able to read common data format such as comma separated (cvs) or space separated data files. It should also be able to spik blank lines or lines starting with special characters. It would be also handy to select the columns that need to be read and also check and skip lines with inconsistent data sets (missing data or NaNs). This is what exacty work the function ReadData() given in the Appendix. But shall we see it more in details.

ReadData(filename,fsep,skipchr,warn,range,ndata,data)

The function read the data from a file with name provided in the variable filename. The program skips all empty record, those starting with one of the characters contained in the regular expression skipchar. For example, a regular expressions such as skipchr=”@|#|;” skips the occurrence of the characters “at” or “hash” or semicolomn. The variable warn is used to check the behavior of the program if alphabetic characters or NaN or INF values are present in the data. If the variable is set to 0, the function gives a warning without stop the program, if set to 1 then the function terminate the program after the first warning.

The field separator is specified in fsep and it is used to set the awk internal variable FS and define the separator between data. The variable can be assigned with single character such as fsep=” “ or fsep=”,” or ESC codes such as fsep=FS=”\t” for tab-delimited.

The column in the data record can be read in two ways by set the element zero of the array range[]. For range[0]=0, a adjoint range of data is specified by setting the first element is at range[1] the last one in range[2]. For range[0]=1, the first element in range[1] is the number of data to read followed by the specific field in the record where the data is located.

Continue reading

Retro programming nostalgia IV: L’Equilibrio e la Titolazione Acido/Base

La motivazione per questo articolo nasce dal mio interesse per il retro-computing connesso, da una parte, alla rivalutazione delle mie esplorazioni giovanili del calcolo scientifico in linguaggio BASIC e dall’altra, alla popolarità che, negli ultimi anni, stanno avendo nel settore amatoriale e della didattica i microcomputer su scheda singola  (single-board computer, quali, per esempio  il Raspberry Pi).  Questi piccoli computer hanno una potenza considerevolmente maggiore a un costo decisamente inferiore dei microcalcolatori degli anni 80. Questo ha reso possibile l’emulazione su questi calcolatori dei sistemi operativi di mitici modelli di home computer della Commodore e i modelli MSX.

Pertanto sta prendendo piede anche un rinnovato interesse nel linguaggio di programmazione BASIC. Questo interesse nel retro-computing riflette la nostalgia nelle grandi emozioni che negli anni 70-80 lo sviluppo della tecnologia informatica consumistica ha portato alla mia generazione. Ricordo che rimasi folgorato dalla creatività nell’uso e nella programmazione di questi microcomputer al punto che ha ridiretto i miei interessi scientifici e la mia carriera accademica. 

Ho raccontato in altri articoli delle mie prime avventure di programmazione con  home computer della Commodore e i sistemi MSX alla fine degli anni ’80 e inizi degli anni ’90 e delle mie riscoperte di archeologia informatica. Tra i reperti ho rinvenuto un piccolo programma che ho usato per studiare le titolazioni acido/base sviluppato in MSX BASIC. Pertanto ho colto l’occasione per scrivere delle note sull’equilibrio acido base  e la titolazione e quindi fornire una versione restaurata e migliorate del mio programma, a gli studenti appassionati di programmazione  che sono  alle prese con questo importante concetto della chimica analitica.

Continue reading

The First 150 Years of the Periodic Table of the Elements

That the nobility of man, acquired in a hundred centuries of trial and error, lay in making himself the conquerer of matter, and that I had enrolled in chemistry because I wanted to remain faithful to this nobility. That conquering matter is to understand it, and understanding matter is necessary to understanding the universe and ourselves: and that therefore Mendeleev’s Periodic Table, which just during those weeks we were laboriously learning to unravel, was poetry, loftier and more solemn than all the poetry we had swallowed down in liceo; and come to think of it, it even rhymed!

Primo Levi, The Periodic Table.

This year marks the 150th anniversary of the periodic table of the elements (TPE) which currently has 118 entries, the latest arrival (the Tennessine) was discovered 10 years ago (2009), and I feel obliged as a chemist to give some a small informative contribution to celebrate this important event.

Continue reading

Retro programming nostalgia III: the MSX Microcomputer and the Orbit of the Planets in the Solar System

In a recent article, I have explained the Euler’s method for solving ordinary differential equations using as a motivation the fictionalized version in the film Hidden Figures of the scientific contribution of Katherine Goble and her two colleagues to the NASA space program. As an example of application, I have also shown a program written in the awk programming language for calculating the orbits of planets of the solar system. However, my interest in astrodynamics come back to my juvenile age, when still going to high school, my parents decided to gift me a more sophisticated microcomputer than my previous one (the celebrated Commodore VIC 20). So I became a programmer of a Philips MSX VG 8010 that I still jealously own in its original box. So, powered by the versatile Federico Faggin’s Zilog Z80 processor with a clock 3.58 MHz, with an impressive (for a previous owner of a VIC20 with a mere 3.583 kB!) memory of 32 kB RAM , 16kB of video RAM and a dedicated tape-record device as storage system, I started to write more sophisticated in MSX Basic. At that time, I was eagerly following the department “Ricreazioni al Computer” by the famous computer scientist A. K. Dewdney on the magazine “Le Scienze”, the Italian edition of Scientific American. The new microcomputer allowed me to experiment with the fascinating computational topics that Dewdney was offering every month. One of these topics was dedicated to the simulation of stars using the algorithm based on the Euler integration of the Newton equation. Following the instruction of Dewdney, I managed to write a small program in MSX basic and this was the starting of my interest in computational astronomy.

Continue reading