I finished the Gamma Processing layer. This is the part of the file that takes in the formulas we created and screened in the Beta Processing Layer and then creates there structures and run a few initial validity tests on them.
.
First we start off with importing all the infinity stones of materials science. Then we get into our functions
.
First comes the Initial Super Gamma function. Ooooo fancyyy. No just kidding, I named everything so that I could tell which step of the process it came in just by reading the name. Initial tells me its the first and the Keyword super tells me its one of if not the first function to be run. Since keeping the order of every function run is super important for this to be built well this helps a lot. In the Initial Super Gamma Function we have a LLM, whos job is to take a look at the formula we created in the Beta Processing Layer and figure out what are the correct inputs to put into PyXtal for that formula. I will get into PyXtal in a bit
.
Next comes the SubGammaFunction. This function is nothing more than a overglorified string parser. It takes the output from the LLM, finds the key information we want, Dim, Group, Species, NumIons, and extracts them into variables we can input into PyXtal. Now all that seams straight forward right? So you can imagine my surprise when I was getting error after error in parsing the LLM response. I was so confused for some reason it could not extract the species from the response???? Yeah no it turned out I spelled species wrong in the function call. :)
I know I make complaint jokes but its bugs, erros, and moments like that , that really make coding such a laugh, even those moments I really so enjoy.
.
Now back to the project! After parsing out all the information we can finally get to the interesting part 😈. CREATING AWESOME CRYSTAL STRUCTURES!!!!! PyXtal is a python tool that lets us randomly generate structures that don’t disobey fundamental laws of chemistry, such as Wyckoff positioning. The main challenge I had to overcome here was maintaining the structural group I had assigned to this crystal. PyXtal would be actively trying to create the best structure it thought was best but I wanted to preserve certain geometries to test since that is the most important thing in crystal creation
.
ANOTHER HUGE PROBLEM, I KEPT RUNNING OUT OF FREE CREDITS TO USE THE HUGGINGFACE AI MODELS. In the middle I tried to switch to Ollama locally hosted models I have before, but the remembered why I left them, THEY TAKE FOREVER.
.
After we create the PyXtal structures we run them through CHGNet to relax the structures, PyXtal SUCKS at creating low energy, high stability structures, its good at creating structures that don’t break certain rules such as Wyckoff positioning. After CHGNet relaxes the structure. It gives up the Stress values on the structure and the forces acting on the lattice of the crystal. We run 2 small loops to check each value and make sure its under 0.1 which is the value that is considered unstable for both metrics. If it passes the tests then its structure file is stored.