My Account Log in

1 option

Python for quantum chemistry : a full stack programming guide / Qiming Sun.

Elsevier ScienceDirect Books Available online

View online
Format:
Book
Author/Creator:
Sun, Qiming, author.
Contributor:
ScienceDirect (Online service)
Series:
Theoretical and computational chemistry ; 23.
Theoretical and computational chemistry ; Volume 23
Language:
English
Subjects (All):
Quantum chemistry--Data processing.
Quantum chemistry.
Quantum chemistry--Computer programs.
Python (Computer program language).
Physical Description:
1 online resource.
Place of Publication:
Amsterdam, Netherlands : Elsevier, 2025.
Contents:
Front Cover
Python for Quantum Chemistry
Copyright
Contents
Preface
The scope of this book
Who is the audience
Outline of this book
Where to find support information
Acknowledgments
References
List of acronyms
1 Python ecosystems and tools for scientific computing
1 Python programming environment
1.1 Python package system
1.1.1 Python runtime
1.1.1.1 Python executables
1.1.1.2 Python runtime paths
1.1.1.3 Inspecting dependencies
1.1.1.4 The importlib library
1.1.2 Package, sub-package, and module
1.1.2.1 Adding packages
1.1.2.2 Package dependencies
1.1.2.3 Namespace packages
1.1.3 Python program as CLI tools
1.1.4 Virtual environment
1.1.5 Conda
1.2 Python programs in Docker
1.3 Managing a Python project
1.3.1 Version control
Downloading projects from GitHub
Synchronizing remote repository to local repository
Contributing to a GitHub repository
Inspecting changes made in another branch
Reverting modifications
Identifying the commit where a bug was introduced
Sub-packages distributed in different repositories
1.3.2 Testing a Python program
1.3.2.1 Testing tools
1.3.2.2 Testing automation
1.3.2.3 Configuring tests for selective execution
1.3.3 Coding style and static checks
1.3.4 Releasing a Python package
1.3.4.1 Python project structure
1.3.4.2 pyproject.toml and setup.py for Python package configuration
1.3.4.3 Building wheels
1.3.4.4 Files in the PyPI package
1.3.4.5 Building Conda packages
1.3.5 CI and DevOps workflow
1.3.5.1 Self-hosted runners
1.3.5.2 PyPI release workflow
1.4 Modular design and object-oriented programming
1.4.1 Method resolution order in multiple inheritances
1.4.2 Mixins
1.5 Working with IPython and Jupyter
1.5.1 Startup configurations
1.5.2 Extensions.
1.5.3 Magics
1.5.4 Remote execution
Summary
2 Data processing
2.1 Vectorized data processing with NumPy
2.1.1 The basics of NumPy
2.1.2 Universal functions (ufunc)
2.1.3 Inplace operations
2.1.4 Broadcasting
2.1.5 Fancy indexing
2.1.6 Mask array
Indexing a dense array
Indexing a sparse array
Randomly distributed mask array
Indexing a high-dimensional array
2.1.7 Data structure of NumPy ndarray
2.1.7.1 The strides attribute for flexible array structure
2.1.7.2 C-contiguous and F-contiguous storage
2.1.8 Array views
Slicing an array
NumPy functions that return a view of the input array
Calling np.ndarray() with the keyword argument buffer
2.1.9 The reshape function
2.2 Data types in NumPy
2.2.1 Type casting
2.2.2 Scalar type and zero-dimensional array
2.2.3 Infinity ( inf ) and not-a-number ( nan )
2.2.4 Data with high precision
2.2.5 Structured array
2.3 Data with labels: Pandas
2.3.1 Pandas data objects
2.3.1.1 Series
2.3.1.2 DataFrame
2.3.2 Broadcasting
2.3.3 Indexing
2.3.3.1 Location-based indexing
2.3.3.2 Label-based indexing
2.3.3.3 Attribute-based indexing
2.3.3.4 Indexing elements in DataFrame
2.3.4 query and eval methods
2.3.5 Altering structure of DataFrame
2.3.5.1 Changing axes labels
2.3.5.2 Inserting or removing rows and columns
2.3.5.3 Reorganizing rows and columns
2.3.6 Data types
2.3.7 Missing data
2.3.8 Grouping and aggregation
2.3.9 View and copy
3 Visualization
3.1 Matplotlib
3.2 Pandas visualization
3.3 Mayavi for 3D plotting
3.4 Quantum chemistry visualization
3.4.1 Jinja template
Expression
Control statements
Whitespace control
3.4.2 Molden format
3.4.3 Cube format
4 Scientific computing tools.
4.1 Linear algebra
4.2 Sparse matrices
4.2.1 Storage formats
4.2.2 Linear algebra for sparse matrix
4.2.3 Linear operator
4.3 Tensor contractions
4.4 Discrete Fourier transforms
4.4.1 SciPy FFT
4.4.2 Intel FFT
4.4.3 PyFFTW
4.4.4 FFT performance benchmark
4.4.5 How to choose FFT libraries?
5 Meta-programming and non-numerical computation
5.1 Code generation
5.1.1 eval and exec
5.1.2 Composing code programmatically
5.1.3 Manipulating classes and functions at runtime
5.1.4 Python AST
5.2 Symbolic computation
5.3 Automatic differentiation
5.3.1 PyTorch
5.3.2 JAX
6 Input and output
6.1 Serialization
6.1.1 Pickle
What can be pickled?
Cross-platform compatibility
Software version dependency
Security problem
6.1.2 JSON
6.1.3 YAML
6.2 File I/O
6.2.1 The npy format
6.2.2 HDF5 storage
6.2.3 Memory mapping
6.3 I/O buffering
6.4 In-memory I/O
6.5 Network I/O
6.5.1 Network requests over HTTP
6.5.2 REST API
6.5.3 RPC over HTTP
6.5.4 gPRC
6.5.5 Apache arrow
7 Working with cloud
7.1 Utilizing cloud computing
7.1.1 Comparison between cloud and supercomputers
7.1.2 Designing a workflow
7.1.3 Computing resources
7.1.4 Communications among cloud services
The configuration of the DFT task executor
The configuration of the RPC server
Deploying RPC server
7.1.5 Function-as-a-Service
7.2 Distributed job executors
7.2.1 Celery
7.2.2 Dask
7.2.3 Ray
2 High performance computing with Python
8 Foreign language interfaces
8.1 Inter-process communication interfaces
8.2 C/C++ interfaces
8.2.1 Data types and type conversion
8.2.1.1 Integer
8.2.1.2 Float
8.2.1.3 String.
8.2.1.4 Class and structure
8.2.1.5 Array
8.2.1.6 Function pointer and callback
8.2.2 Cython
The cythonize compiler
The setuptools extension
8.2.3 pybind11
8.2.4 Compiling C++ code into a Python module
Enabling OpenMP
Using Intel compilers
Linking to external libraries
Extensions with MPI
Invoking CMake
NumPy header files
8.3 Foreign function interfaces
8.3.1 Ctypes
8.3.1.1 Function prototype
8.3.1.2 NumPy array
8.3.1.3 Pointers
8.3.1.4 Structure and complex numbers
8.3.1.5 Callbacks
8.3.2 CFFI
8.3.3 Memory leaks
8.3.4 Duplicated function names in extensions
8.4 Fortran interfaces
8.4.1 ctypes for Fortran
8.4.2 f2py compiler
8.5 Rust interfaces
9 Program performance optimization
9.1 Principles for performance optimization
9.1.1 Cost comparison between Python and C/C++ operations
Atomic instructions
Dictionary lookup
Referencing a variable
Vectorized operations in NumPy arrays
Branching
Function calls
Data type conversion
I/O operations
Running shell commands
9.1.2 Hardware and operating system overhead
Memory allocation
Page fault
Context switch
9.1.3 Latency and throughput
CPU
CPU cache
Memory
Storage
Network
9.1.4 Strategies for optimizing latency and throughput
9.1.5 Computation bound and I/O bound
9.1.5.1 Is a program computation-bound or memory-bound?
9.1.5.2 How to accelerate memory-bound applications?
9.1.5.3 Optimizing for cache size
9.1.5.4 Optimizing data locality
9.1.5.5 Optimizing cache coherence
9.1.6 Instruction level parallelism
9.2 Profiling
9.2.1 Benchmark tests
9.2.2 Python built-in profiling tools
9.2.3 Line profiler
9.2.4 Sampling profiler
9.2.4.1 py-spy
9.2.5 Perf
9.3 Python level optimization.
9.3.1 The dis module
9.3.2 Performance-friendly Python code
Using enumerate for index and object iteration
Using generator instead of explicitly constructing list or tuple
List comprehension for creating new lists
Dictionary comprehension for creating dictionaries
Merging dictionaries
Swapping two variables
Concatenating strings
Using local variables
9.3.3 Utilizing tensor operations
9.3.4 Optimizing tensor indexing efficiency
9.4 Compiling Python code
9.4.1 Numba
9.4.1.1 Unrolling
9.4.1.2 Numba vectorization issues
9.4.2 Cython
9.4.3 Pythran
9.4.4 Comparison of Cython, Pythran, and Numba
Ease of use
Support for Python features
Optimization hints
Profiling
NumPy specialization
SIMD vectorization
Compilation cost
Execution speed
9.5 Optimization with compiled languages
9.5.1 GCC compiler
9.6 Optimization for I/O
9.6.1 Storage layout
HDF5 format
Memory mapping
HDF5 vs memmap
9.6.2 Compressing data
9.6.3 Overlapping computation and I/O
9.7 Precomputation and memoization
9.7.1 LRU cache
9.7.2 Functional programming
9.7.3 Dynamic programming
9.8 Optimization with lazy evaluation
10 Parallel computation
10.1 Multithreading
10.1.1 The threading module
How to manage data sharing between threads?
How to monitor tasks running on child threads?
How to ensure threading efficiency?
10.1.2 ThreadPoolExecutor
10.2 Lock and thread synchronization
10.2.1 Mutex
10.2.2 Event and condition variable
10.3 Producer-consumer model
10.4 Pipeline executor
10.5 Asynchronous program
10.5.1 Similarity between asynchronous programming and lazy evaluation
10.5.2 Asynchronous program with coroutines and asyncio
10.6 Multiprocessing
10.6.1 Data communication in multiprocessing.Process.
Notes:
Includes bibliographical references and index.
Electronic reproduction. Amsterdam Available via World Wide Web.
Description based on online resource; title from digital title page (viewed on June 17, 2025).
Other Format:
Print version: Sun, Qiming Python for Quantum Chemistry
Print version:
ISBN:
0443238367
9780443238369
Publisher Number:
90104286437
CIPO000210218
Access Restriction:
Restricted for use by site license.

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account