Tag: artificial intelligence

Materiomics Chronicles: week 13 & 14

Weeks eleven and twelve gave some rest, needed for the last busy week of the semester: week 13. During this week, I have an extra cameo in the first year our materiomics program at UHasselt.

NightCafe's response to the prompt: "Professor teaching quantum chemistry."

NightCafe’s response to the prompt: “Professor teaching quantum chemistry.”

Within the Bachelor of chemistry, the courses introduction to quantum chemistry and quantum and computational chemistry draw to a close, leaving just some last loose to tie up. For the second bachelor students in chemistry, this meant diving into the purely mathematical framework describing the quantum mechanical angular momentum and discovering spin operators are an example, though they do not represent an actual rotating object. Many commutators were calculated and ladder operators were introduced. The third bachelor students in chemistry dove deeper in the quantum chemical modeling of simple molecules, both in theory as well as in computation using a new set of jupyter notebooks during an exercise session.

In the first master materiomics, I had gave the students a short introduction into high-throughput modeling and computational screening approaches during a lecture and exercise class in the course Materials design and synthesis. The students came into contact with materials project via the web-interface and the python API. For the course on Density Functional Theory there was a final guest response lecture, while in the course Machine learning and artificial intelligence in modern materials science a guest lecture on optimal control was provided. During the last response lecture, final questions were addressed.

With week 14 coming to a close, the first semester draws to an end for me. We added another 15h of classes, ~1h of video lecture, and 3h of guest lectures, putting our semester total at 133h of live lectures (excluding guest lectures, obviously). January and February brings the exams for the second quarter and first semester courses.

I wish the students the best of luck with their exams, and I happily look back at surviving this semester.

Materiomics Chronicles: week 11 & 12

After the exam period in weeks nine and ten, the eleventh and twelfth week of the academic year bring the second quarter of our materiomics program at UHasselt for the first master students. Although I’m not coordinating any courses in this quarter, I do have some teaching duties, including being involved in two of the hands-on projects.

As in the past 10 weeks, the bachelor students in chemistry had lectures for the courses introduction to quantum chemistry and quantum and computational chemistry. For the second bachelor this meant they finally came into contact with the H atom, the first and only system that can be exactly solved using pen and paper quantum chemistry (anything beyond can only be solved given additional approximations.) During the exercise class we investigated the concept of aromatic stabilization in more detail in addition to the usual exercises with simple Schrödinger  equations and wave functions. For the third bachelor, their travel into the world of computational chemistry continued, introducing post-Hartree-Fock methods with also include the missing correlation energy. This is the failure of Hartree-Fock theory, making it a nice framework, but of little practical use for any but the most trivial molecules (e.g. H2 for example already being out of scope). We also started looking into molecular systems, starting with simple diatomic molecules like H2+.

SnV split vacancy defect in diamond.

SnV split vacancy defect in diamond.

In the master materiomics, the course Machine learning and artificial intelligence in modern materials science hosted a guest lecture on Large Language Models, and their use in materials research as well as an exercise session during which the overarching ML study of the QM9 dataset was extended. During the course on  Density Functional Theory there was a second lab, this time on conceptual DFT. For the first master students, the hands-on project kept them busy. One group combining AI and experiments, and a second group combining DFT modeling of SnV0 defects in diamond with their actual lab growth. It was interesting to see the enthusiasm of the students. With only some mild debugging, I was able to get them up and running relatively smoothly on the HPC. I am also truly grateful to our experimental colleagues of the diamond growth group, who bravely set up these experiments and having backup plans for the backup plans.

At the end of week 12, we added another 12h of classes, ~1h of video lecture, ~2h of HPC support for the handson project and 6h of guest lectures, putting our semester total at 118h of live lectures. Upwards and onward to weeks 13 & 14.

Materiomics Chronicles: week 8

After the complexities of week seven, week eight brings the last lecture week of the first quarter of the academic year. After this week, the students of our materiomics program at UHasselt will start studying for a first batch of exams. It also means with this week, their basic courses come to an end and they have all been brought up to speed and to a similar level, needed for the continuation of their study in the materiomics program.

In the bachelor program, the third bachelor chemistry students ended their detailed study of the He atom in the course quantum and computational chemistry with the investigation of its excited states. They learned about the splitting of in singlet and triplet states as well as Fermi-holes and heaps.

Vulcanoplot

Vulcano-plot of small data model quality of model instances in a large ensemble. Taken from our paperSmall Data Materials Design with Machine Learning: When the Average Model Knows Best“, J. Appl. Phys. 128, 054901 (2020)

The first mater materiomics students got their last lecture in the course Fundamentals of materials modeling, where we looked into some examples of application of machine learning in materials research. We also brought all levels of the course together and imagined how to link these in a multiscale project. Starting from the example of a windmill we discussed the application of computational materials modeling at different scales. For the course Properties of functional materials, the third and final presentation and discussion was held, now focusing on characterization methods. The second master students had response lectures for the courses on Density Functional Theory and Machine learning and artificial intelligence in modern materials science where the various topics of the self study were discussed (e.g., concepts of Neural Networks in case of the latter).

At the end of this week, we have added another 8h of live lectures, putting our semester total at 99h of live lectures. With the workload of the first master materiomics coming to an end, the following chronicles will be biweekly. Upwards and onward to week 9&10.

 

Materiomics Chronicles: week 7

After a relatively chill week six, the seventh week of the academic year ended up being complicated. As it was fall-break the week only consisted of two class days at university. However, primary schools are closed entirely so our son was at home having a holiday, while both parents were trying to juggle classes and project proposal deadlines as well as additional administrative reporting. A second evaluation meeting with the students of our materiomics program at UHasselt took place (second master this time), and also these students appreciated the effort put into creating their classes.

Although there were only two days of teaching, this did not mean there was little work there. The students of the second bachelor in chemistry extended their knowledge of a particle in a box to the model of a particle on a ring, during the course introduction to quantum chemistry. Similar as for a particle in a box, this can be considered a simplified model for a circular molecule like benzene, allowing us to estimate the first excitation quite accurately.

For the course Fundamentals of Materials Modeling, there was a lecture introducing the first master students materiomics into the very basics of machine learning, as well as an exercise session. During these, the students learned about linear regression, decision trees and support vector machines. This class was also open to students of the bachelor programs to get a bit of an idea of the content of the materiomics program. Finally, the first master students also presented the results of their lab on finite element modeling as part of the course Fundamentals of Materials Modeling. They presented flow studies around arrows, reef and car models, as well as heat transfer in complex partially insulated systems, as well as sinking boats. They showed they clearly gained insight through this type of hands-on tasks, which is always a joy to note, resulting in grades reflecting their efforts and insights.

Though this week was rather short, we added another 6h of classes, putting our semester total at 91h of live lectures. Upwards and onward to week 8.

Materiomics Chronicles: week 5

After week four, this fifth week of the academic year is most arguably the most intense and hectic week of teaching. With 22h of classes and still two classes that needed to be prepared from scratch (even including weekends time was running out), I’m tired but happy it is over. However, all the effort is worth it, and I was happy to hear the students of our materiomics program at UHasselt appreciate the effort put into creating their classes, during an evaluation meeting.

The corral is an artificial structure created from 48 iron atoms (the sharp peaks) on a copper surface. The wave patterns in this scanning tunneling microscope image are formed by copper electrons confined by the iron atoms. Don Eigler and colleagues created this structure in 1993 by using the tip of a low-temperature scanning tunneling microscope (STM) to position iron atoms on a copper surface, creating an electron-trapping barrier. This was the first successful attempt at manipulating individual atoms and led to the development of new techniques for nanoscale construction.source: https://www.nisenet.org/catalog/scientific-image-quantum-corral-top-view

The corral is an artificial structure created from 48 iron atoms (the sharp peaks) on a copper surface. The wave patterns in this scanning tunneling microscope image are formed by copper electrons confined by the iron atoms. Don Eigler and colleagues created this structure in 1993 by using the tip of a low-temperature scanning tunneling microscope (STM) to position iron atoms on a copper surface, creating an electron-trapping barrier. This was the first successful attempt at manipulating individual atoms and led to the development of new techniques for nanoscale construction.
source: https://www.nisenet.org/catalog/scientific-image-quantum-corral-top-view

For the second bachelor students in chemistry the introduction to quantum chemistry finally put them into contact with some “real” quantum mechanics when they were introduced into the world of potential barriers, steps, and wells. Though these are still abstract and toy-model in nature, they provide a first connection with reality, where they can be seen as crude approximations of the potential experienced by valence electrons near the surface, or STM experiments. They were also introduced to my favorite quantum system related to this course: the quantum corral. Without any effort it can be used in half a dozen situations with varying complexity to show and learn basic quantum mechanics. For the third bachelor chemistry students the course quantum and computational chemistry finally provided them the long promised first example of a non-trivial quantum chemical object: The Helium atom. With it’s two electrons, we break free of the H-atom(-like)  world. Using perturbation theory and Slater determinant wave functions, we made our first approximations of its energy. In addition, these students also had a seminar for their course Introductory lectures in preparation to the bachelor project (Kennismakingstraject m.b.t. stage en eindproject, in Dutch). During this lecture I gave a brief introduction and overview of the work I did in the past and the work we do in our research group QuATOMs, which although “quantum” is quite different of what the students experience during their courses on quantum chemistry.

In the materiomics program, the first master students continued their travels into the basics of force-fields during the lecture of the course Fundamentals of materials modelling. The exercise class of this week upped the ante by moving from ASE to LAMMPS for practical modeling of alkane chains, which was also the topic of their second lab session. In the course Properties of functional materials, we investigated the ab initio modelling of vibrations. During the exercise classes we investigated precalculated phonon spectra in the materials-project database, as well as calculated our own vibrational spectrum at the gamma-point of the first Brillouin zone. During the second master course Machine learning and artificial intelligence in modern materials science the central theme was GIGO (Garbage-In-Garbage-Out). How can we make sure our data is suitable and good enough for our models to return useful results. We therefore looked into data-preparation & cleaning, as well as  clustering methods.

At the end of this week, we have added another 22h of live lectures and ~1h of video lectures, putting our semester total at 74h of live lectures. Upwards and onward to week 6.

Cover image Polymer International: A machine learning approach for the design of hyperbranched polymeric dispersing agents based on aliphatic polyesters for radiation curable inks

Authors: Danny E.P. Vanpoucke, Marie A.F. Delgove, Jules Stouten, Jurrie Noordijk, Nils De Vos, Kamiel Matthysen, Geert G.P. Deroover, Siamak Mehrkanoon, and Katrien V. Bernaerts
Journal: Polymer International 71(8), i-i (2022)
doi: 10.1002/pi.6434
IF(2015): 3.213
export: bibtex
pdf: <PolymerInt>

Abstract

The cover image is based on the Research Article A machine learning approach for the design of hyperbranched polymeric dispersing agents based on aliphatic polyesters for radiation-curable inks by Danny E.P. Vanpoucke et al., https://doi.org/10.1002/pi.6378.  (The related paper can be found here.)

 

Cover Polymer International: Machine learning on small data sets, application on UV curable inks.

Cover Polymer International: Machine learning on small data sets, application on UV curable inks.

 

A machine learning approach for the design of hyperbranched polymeric dispersing agents based on aliphatic polyesters for radiation curable inks

Authors: Danny E.P. Vanpoucke, Marie A.F. Delgove, Jules Stouten, Jurrie Noordijk, Nils De Vos, Kamiel Matthysen, Geert G.P. Deroover, Siamak Mehrkanoon, and Katrien V. Bernaerts
Journal: Polymer International 71(8), 966-975 (2022)
doi: 10.1002/pi.6378
IF(2021): 3.213
export: bibtex
pdf: <PI> (Open Access) (Cover Paper)

 

An ensemble based machine learning model for small datasets was used to predict the relationship between the dispersant structure and the pigment dispersion quality (particle size) for radiation curable formulations.
Graphical Abstract:An ensemble based machine learning model for small datasets was used to predict the relationship between the dispersant structure and the pigment dispersion quality (particle size) for radiation curable formulations.

Abstract

Polymeric dispersing agents were prepared from aliphatic polyesters consisting of δ-undecalactone (UDL) and β,δ-trimethyl-ε-caprolactones (TMCL) as biobased monomers, which are polymerized in bulk via organocatalysts. Graft copolymers were obtained by coupling of the polyesters to poly(ethylene imine) (PEI) in the bulk without using solvents. Different parameters that influence the performance of the dispersing agents in pigment based UV-curable matrices were investigated: chemistry of the polyester (UDL or TMCL), weight ratio of polyester/PEI, molecular weight of the polyesters and of PEI. The performance of the dispersing agents was modelled using machine learning in order to increase the efficiency of the dispersant design. The resulting models were presented as analytical models for the individual polyesters and the synthesis conditions for optimal performing dispersing agents were indicated as a preference for high molecular weight polyesters and a polyester dependent maximum weight ratio polyester/PEI.

Animation of TMCL model 6

Animation of TMCL model 6

 

Wordle-mania: an opportunity for python programming and artificial intelligence.

Over that last few months the wordle game has become increasingly popular, with people sharing their daily feats on Twitter. Currently the game is hosted by the NY times which bought it the end of January 2022 from its creator.  The game is rather straightforward: you have 6 guesses to find a 5-letter English word. Every guess, the game tells you if a letter is (1) not in the word [grey], (2) in the word at a different position [yellow/orange], or (3) in the word at the exact same position [green].

Wordle 242 4/6
⬛⬛🟨⬛⬛
⬛🟨⬛⬛⬛
⬛⬛🟩🟨🟩
🟩🟩🟩🟩🟩
An example of the result (as it looks when shared on Twitter). My first guess was the word “PIANO”, which means the A is in the word but at a different position. My second word, “QUERY”, adds the U to the list of letters that are present. With my third guess, “STUCK”, the position of the U and the K are fixed and we now also know the letter C is involved. At this point, I was also stuck, so I got some help of my wordle-assistant program, which taught me there could only be 1 word matching all the information we had: “CAULK“.

This seamlessly brings me to the central topic of this post: writing a program to help win this game as efficiently as possible. Not terribly original, but it’s a means to an end, as this simple project allows us to explore some more advanced topics in programming in python as well as artificial intelligence.

During this exploration I’ll  be including and updating a set of tutorials as well as this post. The python side of the project will focus on efficiency and easy of use and distribution, while the AI side will focus on smart ways predicting the best possible next guess. For the latter, an important caveat is that this means that the program should also work if you’re the last player living on earth, or if you decide to play wordle in a different language or a different number of letters. This means that creating a distribution of the  tweeted results of other players and comparing this with the complete set of brute-forced distributions to guess the wordle of the day in a single guess, would not satisfy my definition of AI. It is an interesting Big-data kaggle competition though.

Python Tutorials

  • Classes in Python. This tutorial provides a simple introduction in the concept of classes in python.
  • Child Classes. Continuing on the previous we deal now with child classes and the intricacies of function overriding and accessibility.
  • Python Library on Github.
  • Jupyter Notebook examples.
  • Slow Python: Profiling python in Jupyter. We look into profiling a Jupyter notebook script, to find the bottlenecks.
  • Slow Python: speeding up copying.

 

Artificial Intelligence

  • Distributions of words and letters.
  • Information theory of wordle?

 

The WordleAssistant Library and notebooks.

All tutorial code and jupyter notebooks can be found in this github repository.

TEDx Talk: The Virtual Lab

Happy to announce my TEDxUHasselt talk is officially part of the TEDx universe:  https://www.ted.com/talks/danny_vanpoucke_the_virtual_lab .

I enjoyed talking about the VirtualLab. Showed examples from atoms to galaxies, from computer-chips to drug-design and from to opinion-dynamics to epidemiology. I looked at the past and and glanced towards the future, where machine learning and artificial intelligence are the new kids on the block.

 

Practical Machine-Learning for the Materials Scientist

Scilight graphic

Individual model realizations may not perform that well, but the average model realization always performs very well.

Machine-Learning  is up and trending. You can’t open a paper, magazine or website without someone trying to convince you their new AI-improved app/service will radically change your life. It will make the production of your company more efficient and cheaper, make costumers flock to your shop and possibly cure cancer on the side. Also in science, a lot of impressive claims are being made. General promises entail that it makes the research of interest faster, better, more efficient,… There is, however, a bit of fine print which is never explicitly mentioned: you need a LOT of data. This data is used to teach your Machine-Learning algorithm whatever it is intended to learn.

In some cases, you can get lucky, and this data is already available while in other, you still need to create it yourself. In case of computational materials science this often means performing millions upon millions of calculations to create a data set on which to train the Machine-Learning algorithm.[1] The resulting Machine-Learning model may be a thousand times faster in direct comparison, but only if you ignore the compute-time deficit you start from.

In materials science, this is not only a problem for those performing first principles modeling, but also for experimental researchers. When designing a new material, you generally do not have the resources to generate thousands or millions of samples while varying the parameters involved. Quite often you are happy if you can create even a few dozen samples. So, can this research still benefit from Machine-Learning if only very small data sets are available?

In my recent work on materials design using Machine-Learning combined with small data sets, I discuss the limitations of small data sets in the context of Machine-Learning and present a natural approach for obtaining the best possible model.[2] [3]

The Good, the Bad and the Average.

(a) Simplified representation of modeling small data sets. (b) Data set size dependence of the distribution of model coefficients. (c) Evolution of model-coefficients with data set size. (d) correlation between model coefficient value and model quality.

In Machine-Learning a data set is generally split in two parts. One part to train the model, and a second part to test the quality of the model. One of the underlying assumptions to this approach is that each subset of the data set provides an accurate representation of the “true” data/model. As a result, taking a different subset to train your data should give rise to “the same model” (ignoring small numerical fluctuations). Although this is generally true for large (and huge) data sets, for  small data sets this is seldomly the case (cf. figure (a) on the side). There, the individual data points considered will have a significant impact on the final model, and different subsets give rise to very different models. Luckily the coefficients of these models still present a peaked distribution. (cf. figure (b)).

On the down side, however, if one isn’t careful in preprocessing the data set correctly, these distributions will not converge upon increasing the data set size, giving rise to erratic model behaviour.[2]

Not only the model coefficients give rise to a distribution, the same is true for the model quality. Using the same data set, but making a different split between training and test data can give rise to large differences in  quality for the model instances. Interestingly, the model quality presents a strong correlation with the model coefficients, with the best quality model instances being closer to the “true” model instance. This gives rise to a simple approach: just take many train-test splittings, and select the best model. There are quite some problems with such an approach, which are discussed in the manuscript [2]. The most important one being the fact that the quality measure on a very small data set is very volatile itself. Another is the question of how many such splittings should be considered? Should it be an exhaustive search, or are any 10 random splits good enough (obviously not)? These problems are alleviated by the nice observation that “the average” model shows not the average quality or the average model coefficients, but instead it presents the quality of the best model (as well as the best model coefficients). (cf. figure (c) and (d))

This behaviour is caused by the fact that the best model instances have model coefficients which are also the average of the coefficient distributions. This observation hold for simple and complex model classes making it widely applicable. Furthermore, for model classes for which it is possible to define a single average model instance, it gives access to a very efficient predictive model as it only requires to store model coefficients for a single instance, and predictions only require a single evaluation. For models where this is not the case one can still make use of an ensemble average to benefit from the superior model quality, but at a higher computational cost. 

References and footnotes

[1] For example, take “ANI-1: an extensible neural network potential with DFT accuracy at force field computational cost“, one of the most downloaded papers of the journal of Chemical Science. The data set the authors generated to train their neural network required them to optimize 58.000 molecules using DFT calculations. Furthermore, for these molecules a total of about 17.200.000 single-point energies were calculated (again at the DFT level). I leave it to the reader to estimate the amount of calculation time this requires.

[2] “Small Data Materials Design with Machine Learning: When the Average Model Knows Best“, Danny E. P. Vanpoucke, Onno S. J. van Knippenberg, Ko Hermans, Katrien V. Bernaerts, and Siamak Mehrkanoon, J. Appl. Phys. 128, 054901  (2020)

[3] “When the average model knows best“, Savannah Mandel, AIP SciLight 7 August (2020)