CHEMOLYTICA

Foundations · Volume 1

Python Programming for Chemists

An introduction to programming through chemical problems

Sections
6
Units
5
Level
Beginner
Edition
First
Python Programming for ChemistsFront matter

About this volume

This volume teaches Python from the beginning, using the problems a chemist meets every day: computing molar masses, converting units, fitting rate data, reading spectra. No programming experience is assumed. Every new idea in code is introduced the moment a chemical problem needs it, and every result is checked against the chemistry.

[A second paragraph on why this volume exists, what makes its approach different, and what the reader will be able to build by the end.]

Learning goals

By the end of this volume, you will be able to:

  1. write and run Python programs that solve routine chemical calculations;
  2. store and organise chemical data in variables, lists and dictionaries;
  3. repeat a calculation over many molecules with loops and functions;
  4. load experimental data from files and plot it as publication-ready figures;
  5. read error messages and debug your own code.

CONTENTS

1Getting Started with PythonAvailable1.1 Your First Calculation: Molar Mass · 1.2 Installing Python and Jupyter · 1.3 Running a Script · 1.4 Numbers, Units and Rounding · 1.5 Reading Error Messages
2Storing Chemical DataforthcomingVariables, strings, lists and dictionaries, built around a small periodic table
3Repeating CalculationsforthcomingLoops and conditions, applied to a series of compounds
4FunctionsforthcomingWriting reusable tools: unit conversions, ideal-gas calculations
5Working with Data FilesforthcomingReading instrument output with NumPy and pandas
6Plotting Your ResultsforthcomingSpectra, calibration curves and kinetics plots with matplotlib

How to read this book

Margin notes

Definitions and asides sit beside the text, so the main line of argument stays clear.

Worked examples

Each idea is applied to a real chemical problem, with the code and its output in full.

Exercises

Every unit ends with problems to try yourself. Answers are folded away until you want them.

Errata

Corrections are dated at the end of each unit. Found an error? Let me know.