Data Processing with MATLAB: Formation Energies of Titanium Oxides

Kristina D. Closser, California State University-Fresno, Chemistry

Author Profile

Summary

Titanium dioxide (TiO2) is an extremely common chemical substance and finds uses ranging from serving as a pigment for white paint, sunscreen and even toothpaste, to serving as a photosensitizer in waste water treatment processes where it initiates degradation of various organic molecule contaminants following exposure to UV light.

This activity explores the stability of various titanium oxide materials (TiO, TiO2, Ti2O3, ...) using computed formation energies available from the open quantum materials database. This database contains structures and energies for a wide variety of materials that have been computed using density functional theory.

In completing this activity students are introduced to script files and data processing with MATLAB. The students run and modify a script which extracts data from an xml file containing formation energies of various titanium oxide compounds and then they must process and interpret the data using MATLAB.

Used this activity? Share your experiences and modifications

Learning Goals

Upon completion of this activity, students should accomplish the following

  1. Learning objectives within MATLAB
    • Be familiar reading and running standard script files including basic code structure and comments
    • Explore statistical analysis functions available for data analysis such as min, max and std
    • Generate plots
  2. Learning objectives for Chemistry
    • Analyze computational data from a database to extract information about titanium oxides
    • Assess the stability of materials and connect stability to stable structures.

Context for Use

This activity was developed for an upper division elective course on Computational Chemistry. It was designed to be completed during a ~2 hour lab session in a class with 15 students.

Students should generally be familiar with ionic compounds and the concept of a formation energy in order to interpret the results. These concepts are usually covered in a standard general chemistry course. For background information, students may be referred to the following resources:

Students should be familiar with basic MATLAB operations (equivalent to coverage in MATLAB Onramp). Most students had no programming background and had not encountered MATLAB prior to beginning this course and this activity was the third one of the semester. Previous activities used only Live Scripts, so this was students first exposure to standard script files. MATLAB Online was used to ensure all students had the same version of the program.

This activity makes use of data downloaded from the open quantum materials database in an XML format. Understanding the format is not critical for the success of this lab, but students may be interested in learning more about this data format and may be referred to this resource (or others!): Introduction to XML

Description and Teaching Materials

Materials

Students were given the handout provided below and worked through the activity in a computer lab setting. Previous assignments covered basic loop structures and MATLAB coding in the context of live scripts. The instructor was available to circulate and answer questions as well as assist students with coding errors.

  • The TiO.m (Matlab File 3kB Oct13 20) script and the xml data file formationenergy.xml (XML file 32kB Oct13 20) were provided to students in the class using MATLAB drive.
  • The parseXML function was also made available to students as a .m file in the MATLAB drive. This function was copied directly from the second example in MATLAB help menu page (under heading "Read XML File into MATLAB® Structure Array"), saved as parseXML.m and used with no further modifications. Note the file can also be opened directly by MATLAB using the corresponding links.
  • Students used MATLAB online to complete activities.

Student Handout: Data Processing with MATLAB.docx (Microsoft Word 2007 (.docx) 27kB Oct13 20)

Instructor Key:

Instructor Script:

Activity Description

Students should be able to run the script file as given, before making any modifications. However they need to modify the provided script in order to answer the questions in the handout. There is not a single correct way for students to do this, but ideally they should be directly modifying the script so that the information is printed in the output. Answers for the handout are provided for instructors as well as a modified MATLAB script.

Teaching Notes and Tips

Students should be able to run the script file as given, before making any modifications required to answer questions given in the handout. If there are issues check that all three files (TiO.m, parseXML.m and formationenergy.xml) are in the working directory.

To answer the questions in the handout, students will need to manipulate the code by changing the number of atoms for different compounds in the second "for" loop.

Students should be encouraged to explore the nested structure created by the parseXML function to see the values referenced. This can be done by double clicking on the variable all_data in the workspace and then following the "Children" branch structures.

The activity can be made more challenging by reducing the explanations given in the comments in the script file (my students were not provided comments marked with >>> in the script). It can also be simplified by removing the "Harder questions" in the handout.

Assessment

Students submitted answers to the questions on the handout and these were evaluated for accuracy and completeness, and they also submitted . In this course assignments were simply graded as satisfactory, progressing or incomplete. Satisfactory scores had all questions fully answered, and were roughly 70% correct. If a progressing score was awarded, the students were allowed to resubmit within a week of the documents being returned. The correct answers are provided for instructors in the Materials section.

Informal discussions were also had with students while they were working and were used to gauge understanding during the course of the activity.

References and Resources

Uses of Titanium dioxide:

General Chemistry Text: LibreTexts (TextMap of Brown & Lemay's book "Chemistry--The Central Science")

Source of titanium oxide data: Open Quantum Materials Database (http://oqmd.org/)
Kirklin, S., Saal, J.E., Meredig, B., Thompson, A., Doak, J.W., Aykol, M., Rühl, S. and Wolverton, C. "The Open Quantum Materials Database (OQMD): assessing the accuracy of DFT formation energies", Computational Materials1, 15010 (2015).

Source of parseXML script (https://www.mathworks.com/help/matlab/ref/xmlread.html)