---
# System prepended metadata

title: Predicting glassy dynamics
tags: [masters projects, glassy dynamics, machine learning]

---

# Predicting glassy dynamics

###### tags: `masters projects` `machine learning`  `glassy dynamics`


---



### Owners (the only one with the permission to edit the main text, others can comment)

Rinske, Frank, Laura, Marjolein

---
# 1-12-2021 PCA


I (Marjolein) did PCA on 1062 parameters per particle of a single snapshot of the binary HS glass of Rinske. 

By taking only the data of the fasted 1/3 and slowest 1/3 of particles into account (this is based on the propensity at $t\sim\tau_\alpha$), you bassically take out the interface particles between the fast and slow regions (this is a very crude cutoff of the interface though). Then, by training a PCA model on the small and big particles separatedly, PCA in combination with GMM can find a structural difference between the fast and slow regions.

I normalize the input parameters first, and then put them in the PCA. The model needs many PCs to capture the variance in the data. For example, for the small particle it needs 47 PCs to make sure the information loss is less than 25%. All the input parameters also contribute to the PCs. To illustrate, below you can see the weight with which the input parameters contribute to the first 4 PCs.

| ![](https://i.imgur.com/skznjnV.png) |
| -------- |
| Contribution of the input parameters to the first four PCs for the small particles. |

You cannot visualize 47D space, but if you look at just the first two PCs, you can already distinguish two clusters in the data set. (The color indicates the point density form low/blue to high/red)
![](https://i.imgur.com/BIwSR8F.png)

According to the GMM (and the BIC) there are also two clusters, and it precisely classifies them as you would expect.
![](https://i.imgur.com/oiGlrpR.png)

Then, when I look at the propensity of these "red" and "blue" classified particles, you get the histogram underneath. On the left, you can see the total histogram of all small particles in gray in the background and the red bars are plotted on top of the blue bars. On the right, you just see the red and blue histogram. It is clear that the model nicely separates the fast from the slow particles based on their structure. 
![](https://i.imgur.com/Ykk2Awl.png)
There are some incorrectly classified particles, but these are all located at the interface (which we of course just took out very crudely so it's no surprise we made some mistakes there). The precise red/blue classification of the snapshot is shown underneath.
| ![](https://i.imgur.com/tny6Rca.png) | ![](https://i.imgur.com/Kf9JWwI.png) |
| -------- | -------- | 
|      |      |

Underneath, the histogram with also the interface particles classified using the trained model. Again, on the left the red bars are placed on top of the blue bars, on the right are the "normal" histograms. As is probably expected, the interface particles are classified half blue and half red.
![](https://i.imgur.com/Wqz6QYv.png)
And to compare, if we did not take the interface particles out before training the PCA and GMM, the classification looks like this (underneath), which is definitely not as great. 
![](https://i.imgur.com/ikVlAC7.png)

### Classifying new data
I also tried classifying a different configuration using the trained model. However, that did not work that well. Underneath is the classification of the small particles. I think that at the moment the problem lies with the normalization of the input parameters and the small size of the dataset that I trained the models on. So I still plan to train the model using more configurations, and then try classifiyng some new ones.

![](https://i.imgur.com/Em3xFsB.png)


### Which structural parameters could be important?
From just the scatterplot of the PC0 vs PC1, we could see that the two clusters are sort of already separated by their value of PC1. So if we then look at the histograms of the input parameters that are weighted the strongest for PC1, do we see a difference?
The answers is, yes we do. Underneath, are the histograms of the first three most important parameters for PC1. There is a clear difference between the red and blue distributions.
![](https://i.imgur.com/jyLxhEq.png)
![](https://i.imgur.com/nmOTRfn.png)
![](https://i.imgur.com/tu5aHmO.png)

But there are definitely more parameters which show this separation between the red and blue distributions. Here are some other random ones.
![](https://i.imgur.com/Yrnw1gJ.png)
![](https://i.imgur.com/giYRvAS.png)
![](https://i.imgur.com/4SbT656.png)




---
---

# 8-2-2021 -To Do first weeks
After the first meeting with Frank, this is the to do list for the following week(s)
- Theory (read into the following topics/papers)		   
    - [ ]  Paper: Unveiling the predictive power of static structure in glassy systems(https://www.nature.com/articles/s41567-020-0842-8)
	- [x] Bond Order parameters and other local structure parameters
	- [ ] Background on neural networks
	- [ ] Intermediate scattering functions
	- [ ] Structural relaxation time
	- [x] Background on glassy dynamics (berthier2011.pdf)
	- [x] Event driven brownian dynamics		
- Programming:
	-  Python
		- [ ]  Install pytorch and practice with pyton
	- C-code brownian dynamics
		- [x] Look at code Frank event driven brownian dynamics.
		- [ ] Program code that gives vecor with local structure parameters(doing this now (11-2-2021))
		    - [x] Find nearest neighbours using SANN algorithm
		    - [x] Express local structure using spherical harmonics


# 12-2-2021

Succeeded in find nearest neighbours using SANN algorithm.
Picture below shows the nearest neighbours (purple) for two of the particles (blue) from the glass system (made with Franks code)

![](https://i.imgur.com/8ZL0cjC.png)


And implemented local bond order parameter code. For the glass this is $\bar{q}_4$ against $\bar{q}_6$. I checked with some data from Frank that the code is correct. 

![](https://i.imgur.com/JVcSa0v.png)


