/ColabChem

Primary LanguageJupyter Notebook

This repository provides an introductory guide on how to apply basic concepts of coding using the Python language to solve chemistry exercises through Google Colab. Phyton is a programming language used in a great variety of applications, with the advantage of applicability to different work platforms, in addition, python is an open-access language being accessible to anyone who wishes to use it. Previous knowledge of coding concepts is not required to develop this introductory guide. 😆
Screencast get started

Session 1. Introduction to Google Colaboratory

In the first session, we presented basic concepts of coding in Python (e.g., description of Colabs platform, types of variables in computer sciences, first commands, some function and routines) and then, we used math library to perform numerical calculations. Finally, we used library numpy to perform some exercises with arrays and the students are then tasked with finding the HCl solutions concentration from a list of data. You can directly access the Colabs notebook by clicking on one of the following links:
Screencast Lesson 1
Colab notebook English version
Colab notebook Spanish version

Session 2. Mathematical treatment of experimental data

In the second session, we used the math library to perform some typical statistical calculations. Then we use matplotlib library to obtain a graphic data representation of the Lennard-Jones potential for some species. Furthermore, we used scipy.stats library to perform linear regression and obtain calibration equation. The students are then tasked with finding a concentration from calibrating curve. You can directly access the Colabs notebook by clicking on one of the following links:
Screencast Lesson 2
Colab notebook English version
Colab notebook Spanish version

Session 3: Ideal Gases

In this session, we explore the Charles’s law for ideal gases. Using the scipy.stats and matplotlib libraries, the students are tasked with finding the absolute temperature on Celsius scale assuming ideal gas behavior. We used the plotly library to obtain an interactive chart. In the final activity, the students are tasked with plotting compressibility factor (Z) Vs pressure at two different temperatures. In the Virtual Lab Simulation section, we included a step-by-step guide to verified Boyle’s law and Charles’s law for ideal gases. Analysis and plotting data can be solved using the Colabs notebook. You can directly access the Colabs notebook by clicking on one of the following links:
Colab notebook English version
Colab notebook Spanish version

Session 4. Equation of the State (EoS)

In this session, we presented basic concepts for use of functions in Python. Then, we explore the general form of the analytic equation of EoS. The general equation is presented and reduced to most simple version (the Van der Waals equation). We plotted PV diagram using the Van der Waals equation for six different temperatures of methane. The students are tasked with plotting PV diagram for CCl4 applying the Van der Waals equation. In the second activity, the students are tasked with plotting PV diagram for methane using the Redlich Kwong equation. You can directly access the Colabs notebook by clicking on one of the following links:
Colab notebook English version
Colab notebook Spanish version

Session 5: First Law

In this session, we present the PV diagrams for various ideal gas processes. In the first activity, we plotted a PV diagram for both reversible and irreversible expansions. In the second activity, we plotted the PV diagram for an adiabatic reversible expansion. In the third activity, we used the polynomial equation to describe the specific heat capacity cp(T) as a function of temperature. We use the sympy library to define the temperature as a “symbolic” variable, obtaining the cp(T) for a specific substance. In the fourth activity, we present basic concepts of the pandas library, then we use this library to exemplify the manipulation a dataframe containing the coefficients of the polynomial equation in order to describe the specific heat capacity cp(T) of 23 chemical substances. Subsequently, we present a routine to obtain the polynomial equation of any of the 23 chemical substances in the dataframe. Finally, in last part of notebook, we included a step-by-step guide to determine the heat of the neutralization reaction between HCl and NaOH. You can directly access the Colabs notebook by clicking on one of the following links:
Screencast Lesson 5
Colab notebook English version
Colab notebook Spanish version

Session 6: Hess's Law - Matrix Method

In session 6, resorting to a procedure previously reported and used by Khalil, we calculated enthalpy of reactions by a matrix method. In this Colab notebook, we showed the technical aspects necessary to obtain a matrix from chemical equations, and we used the numpy library to introduce matrix code, and the linalg.lstqs() function to solve the equation. Then, the students were tasked with calculating the enthalpy of some reactions through the matrix method. In the final activity, we utilized the matplotlib library and the matshow() function to plot the matrix form of the chemical reaction with colormaps – this is an attractive way to present this type of information. You can directly access the Colabs notebook by clicking on one of the following links:
Colab notebook English version
Colab notebook Spanish version