Strange Alchemy: Better Chemistry With Computer Science
By Tracy Seipel
Associate Professor Grace Stokes helps her chemistry students visualize equations by integrating Python coding into her curriculum.
Seven years ago, when Associate Professor Grace Stokes began teaching upper-division thermodynamics at Santa Clara, she worried that students found it archaic, and the math tedious and challenging.
There had to be a better way to engage them in the branch of physical science that deals with the relationship between heat and other forms of energy. So when she heard how the computer programming language Python could help students better understand complex chemistry concepts, it was a hallelujah moment.
“It was the answer to everything,” says Stokes, the SCU Clare Boothe Luce Associate Professor of Chemistry and Biochemistry.
Instead of calculating chemistry equations with paper and pencil or even using spreadsheets and calculators, Python allows students to graph and visualize fundamental equations in new ways, Stokes explains.
“Physical chemistry is very hard to visualize if you don’t use Python, which can actually generate a graph based on the question, which is something you cannot do by just imagining it,” says Matt Shulman ’22.
Stokes believes Python helps students gain a valuable skill that should serve them well in their chemistry-related careers, from pharmacology to food science to environmental science. Learning to code also makes students more efficient and effective researchers because it speeds up computational algorithms, allowing more time for analysis.
Talk about a chain reaction.
“It’s definitely challenging, but she presented in such a way that it was easy enough to come into it without knowing Python,” says Elliott Anderson ’22, who took Stokes’ quantum chemistry class and also participated in a Python workshop this summer. He’s so proficient now that he helped write a Python exercise that Stokes used in her general chemistry course in fall 2021.
“Coding and chemistry are super linked in this modern age—it’s hard to divorce these two ideas,” says Anderson, adding that Python saves time when it comes to data analysis. “It’s a valuable skill, and I think it should be standard nowadays when so much of what I do as a chemist is digital.”
Shulman says after using Python in two of Stokes’ classes, where “she would 100 percent walk you through everything step by step,” he’s become so adept at coding that classmates often seek his help.
Over the years, Stokes’ own coding journey—from newbie to leader—caught the attention of the American Chemical Society Symposium Series Book. The editors asked her to write a chapter about the experience. Her article, “Teaching Programming Across the Chemistry Curriculum,” is featured in the latest edition.
“Don’t be afraid to ask for help” is Stokes’ motto. “That’s what this book chapter is about: I’m not an expert in computer programming, and yet I was able to teach this topic successfully because I had help from experts.”
At Santa Clara, Stokes—who just won a prestigious Dreyfus Teacher-Scholar Award, the sixth member in her SCU department so honored—has been spreading the Python gospel to colleagues, including chemistry professor Korin Wheeler and assistant professor of biology Michelle McCully. As part of a Slack channel of 40 to 50 higher education science faculty across the country using or adopting Python and other computer programs, she’s able to gather more ideas and now offer advice.
Still, most important to Stokes is how Python inspires her teaching and benefits her students.
“This is a way for students to learn, but not in a boring way,” she says. “It is definitely more sophisticated and certainly more interactive. And I would say, fun.”