Book contents
- Frontmatter
- Contents
- Acknowledgments
- 1 Introduction
- 2 Basic Python Usage
- 3 Strings
- 4 Lists and Loops
- 5 Comparisons and Flow Control
- 6 Functions
- 7 Data Structures
- 8 File Input/Output
- 9 Basic NumPy
- 10 Graph Plotting with Matplotlib
- 11 The Steady-State Approximation
- 12 Liquid–Vapor Equilibrium
- 13 Jupyter Notebook
- 14 LaTeX
- 15 Chemistry Databases and File Formats
- 16 More NumPy and Matplotlib
- 17 Thermodynamic Cycles
- 18 Vectors, Matrices and Linear Algebra
- 19 Linear Least Squares Fitting I
- 20 Linear Least Squares Fitting II
- 21 Numerical Integration
- 22 Optimization with scipy.optimize
- 23 Vibrational Spectroscopy
- 24 The Morse Oscillator
- 25 Solving Ordinary Differential Equations
- 26 The Oregonator
- 27 Root-Finding with scipy.optimize
- 28 Rotational Spectroscopy
- 29 Peak Finding
- 30 Fitting the Vibrational Spectrum of CO
- 31 pandas
- 32 Simulating a Powder Diffraction Spectrum
- 33 The Hückel Approximation
- 34 Nonlinear Fitting and Constrained Optimization
- 35 SymPy
- 36 Molecular Orbital Theory for H2+
- 37 Approximations of the Helium Atom Electronic Energy
- 38 Computational Chemistry with Psi4 and Python
- 39 Atomic Structure
- 40 Solutions
- Index
8 - File Input/Output
Published online by Cambridge University Press: 12 October 2023
- Frontmatter
- Contents
- Acknowledgments
- 1 Introduction
- 2 Basic Python Usage
- 3 Strings
- 4 Lists and Loops
- 5 Comparisons and Flow Control
- 6 Functions
- 7 Data Structures
- 8 File Input/Output
- 9 Basic NumPy
- 10 Graph Plotting with Matplotlib
- 11 The Steady-State Approximation
- 12 Liquid–Vapor Equilibrium
- 13 Jupyter Notebook
- 14 LaTeX
- 15 Chemistry Databases and File Formats
- 16 More NumPy and Matplotlib
- 17 Thermodynamic Cycles
- 18 Vectors, Matrices and Linear Algebra
- 19 Linear Least Squares Fitting I
- 20 Linear Least Squares Fitting II
- 21 Numerical Integration
- 22 Optimization with scipy.optimize
- 23 Vibrational Spectroscopy
- 24 The Morse Oscillator
- 25 Solving Ordinary Differential Equations
- 26 The Oregonator
- 27 Root-Finding with scipy.optimize
- 28 Rotational Spectroscopy
- 29 Peak Finding
- 30 Fitting the Vibrational Spectrum of CO
- 31 pandas
- 32 Simulating a Powder Diffraction Spectrum
- 33 The Hückel Approximation
- 34 Nonlinear Fitting and Constrained Optimization
- 35 SymPy
- 36 Molecular Orbital Theory for H2+
- 37 Approximations of the Helium Atom Electronic Energy
- 38 Computational Chemistry with Psi4 and Python
- 39 Atomic Structure
- 40 Solutions
- Index
Summary
This accessible and self-contained guide provides a comprehensive introduction to the popular programming language Python, with a focus on applications in chemistry and chemical physics. Ideally suited to students and researchers of chemistry learning to employ Python for problem-solving in their research, this fast-paced primer first builds a solid foundation in the programming language before progressing to advanced concepts and applications in chemistry. The required syntax and data structures are established, and then applied to solve problems computationally. Popular numerical packages are described in detail, including NumPy, SciPy, Matplotlib, SymPy, and pandas. End of chapter problems are included throughout, with worked solutions available within the book. Additional resources, datasets, and Jupyter Notebooks are provided on a companion website, allowing readers to reinforce their understanding and gain confidence applying their knowledge through a hands-on approach.
- Type
- Chapter
- Information
- Python for Chemists , pp. 76 - 81Publisher: Cambridge University PressPrint publication year: 2023