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

In the first part of this short 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 datatypes and how to load them with 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
Posted in Programming, Science Topics, What is new | Leave a comment

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
Posted in Leonardo's Corner, Programming, Science Topics, What is new | Leave a comment

La Termodinamica: La Meravigliosa Cattedrale Della Scienza. Parte I.

Indipendentemente dai motivi del culto, le antiche cattedrali invitano ad un’ammirata contemplazione, ispirano rispetto e quiete. Anche il visitatore piu’ disinvolto non si esimere dal moderare la voce, non insiste in argomenti futili: delle navate, l’eco delle sue stesse parole sembra destare insolite suggestioni. L’impegno di generazioni di architetti e di artigiani e’ stato dimenticato, le loro impalcature sono state rimosse ormai da lungo tempo, i loro stessi errori sono stati cancellati dai secoli. Il monumento che essi crearono, ora compiuto e perfetto, ci appare come la testimonianza di un disegno sopraordinario. Se evochiamo in noi il ricordo di un cantiere in attività, con il rumore ritmato dei martelli, le voci ed i gesti degli operai, l’odore stantio del legno e di tabacco, alle splendide structure che ora ammiriamo non possiamo attribuire altro significato che quello di essere il frutto di un ordine imposto alla mera fatica umana.

Anche la scienza ha i suoi templi, costruiti con gli sforzi di pochi architetti e di molto operai, e di fronte ad essi proviamo lo stesso sentimento. Anche in questi templi l’atmosfera e’ solenne, e forse lo e’ a tal punto da condizionare l’espressione stessa del pensiero scientifico, che una lunga tradizione vuole assai severo e formale.

G.N, Lewis, M. Randall -“Thermodinamica”, Leonardo Edizioni Scientifiche, Roma (1971).

INTRODUZIONE

Gilbert Newton Lewis e Merle Randall nella introduzione alla prima edizione del loro autorevole testo di termodinamica chimica descrivono  la termodinamica come la cattedrale della scienza. La loro non è solo una concessione poetica di un’epoca ancora permeata dal romanticismo scientifico, ma una meravigliosa analogia per questa fondamentale disciplina della scienza che più di ogni altra contiene  le leggi arcane che goverano il nostro Universo e il suo destino.

In questa serie di articoli riporto alcuni appunti su argomenti vari di termodinamica chimica che possono essere utili come riferimento o come materiale didattico.

Continue reading
Posted in Science Topics, What is new | Leave a comment

Programming in Awk Language. LiStLA: 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
Posted in Programming, What is new | Leave a comment

Molekulare Maschinen: Die Coronavirus SARS-CoV-2 Bedrohung, Teil I.

Was Freunde mit und für uns tun, ist auch ein Erlebtes; denn es stärkt und fördert unsere Persönlichkeit. Was Feinde gegen uns unternehmen, erleben wir nicht, wir erfahren’s nur, lehnen’s ab und schützen uns dagegen wie gegen Frost, Sturm, Regen und Schloßenwetter oder sonst äußere Übel, die zu erwarten sind.

Johann Wolfgang von Goethe (1749-1832), Maximen und Reflexionen. Aphorismen und Aufzeichnungen.

Ein Virus ist Leben in der einfachsten Form. Es ist die minimalistische Reduktion eines Organismus auf seine wesentlichen Funktionselemente. Noch pragmatischer ist ein Virus ein Behälter mit genetischem Code mit einem effizienten molekularen Mechanismus, der es ihm ermöglicht, in eine Wirtszelle eines Organismus einzudringen, der sich selbstständig reproduzieren kann. Als molekulare Maschine kann ein Virus der Form und der zerstörerischen Kraft des Todessterns in der Star-Wars-Saga ähneln. Daher ist es eine Art molekulare Maschine, die wir absolut nicht in uns haben wollen!

Wie der große Goethe sagt, ist der Feind Teil unserer Erfahrung und wir müssen ihn jagen und uns tatsächlich vor anderen möglichen Feinden schützen. Dieser epische Naturkrieg veranlasste mich, diesen Blog zu starten, in dem ich mitteilen werde, was ich über diese gefährliche molekulare Maschine lerne.

Continue reading
Posted in Research, Science Topics, What is new | Leave a comment

Le Macchine Molecolari: La minaccia del Coronavirus SARS-CoV-2. Parte I

Difficilmente è vinto colui che sa conoscere le forze sue e quelle del nemico.

Nicollò Machiavelli in Dell’arte della guerra (1519-1520)

Un virus è la vita nella forma più semplice. È la riduzione minimalista di un organismo ai suoi elementi essenziali di funzionalità. Più pragmaticamente, un virus è un contenitore di codice genetico dotato di un efficiente meccanismo molecolare che gli consente d’invadere una cellula ospite di un organismo capace di riprodursi autonomamente. Come macchina molecolare, un virus può assomigliare nella forma e potere distruttivo, alla Morte Nera della saga di Star Wars. Pertanto, è un tipo di macchina molecolare che non vogliamo assolutamente avere dentro di noi!

La diffusione del coronavirus SARS-CoV-2 (COVID-19) ha prodotto una nuova pandemia, ovvero una infezione causata da un agente patogeno che colpisce l’intera popolazione di una specie vivente, in questo caso quella umana. Questa situazione di emergenza globale è il risultato di una competizione naturale tra specie viventi che ci rammenta di essere ancora un tassello nell’ecosistema di Gaia. Tuttavia, anche se sia sempre arduo da credere visto lo stato in cui abbiamo ridotto il nostro pianeta, siamo la forma di vita più intelligente nell’universo conosciuto. Quindi sarebbe abbastanza imbarazzante essere sconfitti da un nemico invisibile.

Continue reading
Posted in Research, Science Topics | Leave a comment

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
Posted in Programming, Science Topics, What is new | Leave a comment

Modelling Natural Shapes: (Easter) Eggs 2020

One year ago, I wrote an article about the modelling of the egg shapes, promising at one point to come back on the topics. A next step in studying eggs shapes is to look to real one or a copy of it. A happy occasion for experimenting with the model using three-dimensional graphics and 3d Printing! That is a natural indeed step: take half of the symmetric curve representing the egg shape

y=T(1+x)^{\frac{\lambda}{1+\lambda}}(1-x)^{\frac{1}{1+\lambda}},

where T and \lambda are two parameters, and rotate it around the central axis

\begin{aligned} x'&=&x\\ y' &=&y*cos(\theta) \\ z' &=& y*sin(\theta) \end{aligned}

Continue reading
Posted in Leonardo's Corner, Science Topics, What is new | Leave a comment

Nanoparticles in Biology and Medicine

I am very pleased to announce that the second edition of the book Nanoparticles in Biology and Medicine edited by Enrico Ferrari, Mikhail Soloviev is now out.

This fully updated volume presents a wide range of methods for synthesis, surface modification, characterization and application of nano-sized materials (nanoparticles) in the life science and medical fields, with a focus on drug delivery and diagnostics. Beginning with a section on the synthesis of nanoparticles and their applications, the book continues with detailed chapters on nanoparticle derivatization, bio-interface, and nanotoxicity, as well as nanoparticle characterization and advanced methods development. Written for the highly successful Methods in Molecular Biology series, chapters include introductions to their respective topics, lists of the necessary materials and reagents, step-by-step, readily reproducible laboratory protocols, and tips on troubleshooting and avoiding known pitfalls. Authoritative and cutting-edge, Nanoparticles in Biology and Medicine: Methods and Protocols, Second Edition serves as an ideal guide for scientists at all levels of expertise to a wide range of biomedical and pharmaceutical applications including functional protein studies, drug delivery, immunochemistry, imaging, and more.

I have contributed with a chapter (14) titled The Molecular Dynamics Simulation of Peptides on Gold Nanosurfaces.

In this chapter a short tutorial on the preparation of molecular dynamics (MD) simulations for a peptide in solution at the interface of an uncoated gold nanosurface is given. Specifically, the step-by-step procedure will give guidance to set up the simulation of a 16 amino acid long antimicrobial peptide on a gold layer using the program Gromacs for Molecular Dynamics simulations.

Posted in Uncategorized | Leave a comment

Molecular Machines: the Coronavirus SARS-CoV-2 Menace. Part I

If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle.”

SunTzu. The Art of War

A virus is the Bauhaus of the form of life: the minimalist reduction of an organism to its essential element of functionality. More pragmatically, it is a container of genetic code provided with a smart mechanism that allows it to invade cells of another host organism. As a molecular machine, a virus can resemble in shape and destructive power the Death Star spaceship of the Star War saga. Therefore, it is a molecular machine that we do not definitively want to have within us!

The spread of the coronavirus SARS-CoV-2 has produced a new pandemic, i.e. an infection caused by a pathogen that affects the entire population of a living species, in this case the human one. This global emergency situation is the result of a natural competition between living species that reminds us that we are still a small brick of the Gaia ecosystem. However, although it is always difficult to believe given the state in which we have reduced our planet, we are the most intelligent life form in the known universe. So it would be quite embarrassing to be defeated by an invisible enemy.

Continue reading
Posted in Research, Science Topics, What is new | Tagged , | Leave a comment