Setting Up a Comprehensive Quantum Chemistry Environment on Linux

Posted on April 5, 2025

Abstract

This work presents a comprehensive protocol for establishing a robust quantum chemistry computing environment on Linux systems. The environment is designed to support a wide range of computational chemistry applications including molecular modeling, quantum mechanical calculations, materials science simulations, and machine learning approaches to chemical problems. The protocol leverages Conda for environment management and includes the installation of Psi4 quantum chemistry package alongside supporting libraries for visualization, data analysis, and machine learning. This guide systematically addresses all aspects of the setup process from initial system assessment to environment configuration and verification, with particular attention to reproducibility and user accessibility. The effectiveness of this environment is demonstrated through successful installation verification and system compatibility assessment. This approach provides researchers with a flexible computational platform capable of supporting diverse chemistry research applications while minimizing software configuration challenges.1

Introduction

Computational approaches have become indispensable in modern chemistry research, enabling investigations that would be impractical or impossible through experimental means alone.2 Quantum chemistry methods in particular have revolutionized our understanding of chemical systems by providing detailed insights into electronic structure, reaction mechanisms, and molecular properties.3 However, establishing an effective computational environment for quantum chemistry research presents significant challenges, particularly regarding software dependencies, version compatibility, and system configuration.4

The primary objective of this work is to provide a systematic approach to establishing a comprehensive computational chemistry environment on Linux systems. This environment is designed to support a diverse range of computational methods relevant to chemistry research, including electronic structure calculations, geometry optimizations, molecular dynamics simulations, and emerging machine learning approaches to chemical problems.5

Conda has emerged as a powerful tool for managing scientific computing environments due to its ability to handle complex dependency networks and create isolated environments.6 This capability is particularly valuable in computational chemistry, where different software packages often have conflicting requirements. The Psi4 quantum chemistry package represents an excellent foundation for such an environment, offering an accessible open-source platform for electronic structure calculations with Python integration capabilities.7

Beyond core quantum chemistry functionality, a comprehensive research environment requires tools for data analysis and visualization. Python libraries such as NumPy, SciPy, and Matplotlib provide essential capabilities for processing and interpreting computational results.8 Additionally, specialized packages for chemistry applications such as RDKit and OpenBabel facilitate molecular manipulation and format conversion tasks.10

The integration of machine learning approaches with quantum chemistry has created exciting new research directions in recent years.11 Including PyTorch in the computational environment enables researchers to explore these emerging methodologies, potentially accelerating discovery in areas ranging from force field development to novel materials design.12

Remote access capabilities represent another critical component of modern computational research infrastructure. JupyterLab provides an ideal platform for remote code execution and visualization, enabling collaborative research and convenient access from multiple devices.13 This functionality is particularly valuable for computational chemistry, where calculations may run for extended periods and require occasional monitoring or parameter adjustments.

This work details a complete protocol for establishing such a comprehensive computational chemistry environment. The approach addresses initial system assessment, environment configuration, package installation, and verification testing. Particular attention is given to reproducibility and accessibility, ensuring that researchers can implement this environment across different systems with minimal technical barriers.

Experimental

System Requirements Assessment

Code 1. The code will retrieve the system details on the target computer.

#!/bin/bash
# This script collects system information for computational chemistry setup

echo "Collecting system information..."

# Create a directory for results if it doesn't exist
mkdir -p system_info

# System and distribution information
echo "Distribution Information:" > system_info/system_details.txt
lsb_release -a >> system_info/system_details.txt 2>/dev/null
echo -e "\nKernel Information:" >> system_info/system_details.txt
uname -a >> system_info/system_details.txt

# CPU information
echo -e "\nCPU Information:" >> system_info/system_details.txt
lscpu | grep -E 'Model name|Socket|Core|Thread|CPU MHz|CPU max MHz' >> system_info/system_details.txt

# Memory information
echo -e "\nMemory Information:" >> system_info/system_details.txt
free -h >> system_info/system_details.txt

# Disk information
echo -e "\nDisk Information:" >> system_info/system_details.txt
df -h | grep -v tmpfs >> system_info/system_details.txt

# GPU information (if applicable)
echo -e "\nGPU Information:" >> system_info/system_details.txt
lspci | grep -i vga >> system_info/system_details.txt

# Check for virtualization support
echo -e "\nVirtualization Support:" >> system_info/system_details.txt
grep -E 'svm|vmx' /proc/cpuinfo | uniq >> system_info/system_details.txt

echo "System information collected and saved to system_info/system_details.txt"

Complete Environment Setup Script

Code 2. This script performs the full setup of the quantum chemistry environment.

#!/bin/bash
# Final Quantum Chemistry Environment Setup Script
# Optimized for Psi4 compatibility with Python 3.9

# Exit on error
set -e

# Function to check if a command exists
command_exists() {
    command -v "$1" >/dev/null 2>&1
}

# Function to check if a package is installed in the active environment
check_package() {
    python -c "import $1" 2>/dev/null && return 0 || return 1
}

echo "================================================================="
echo "  Quantum Chemistry Environment Setup"
echo "================================================================="
echo
echo "This script will set up a comprehensive environment for"
echo "computational chemistry research including Psi4 and supporting tools."
echo

# Check for and install dependencies
echo "Checking system dependencies..."
if command_exists apt-get; then
    sudo apt-get update
    sudo apt-get install -y build-essential gfortran cmake python3-dev libopenblas-dev liblapack-dev wget curl git
elif command_exists yum; then
    sudo yum update -y
    sudo yum install -y gcc gcc-c++ make gfortran cmake python3-devel openblas-devel lapack-devel wget curl git
else
    echo "Warning: Unsupported package manager. Please install build tools manually."
fi

# Download and install Miniconda if not already installed
if ! command_exists conda; then
    echo "Installing Miniconda..."
    MINICONDA_PATH=~/miniconda3
    MINICONDA_INSTALLER=Miniconda3-latest-Linux-x86_64.sh
    
    # Download installer
    wget https://repo.anaconda.com/miniconda/$MINICONDA_INSTALLER -P /tmp/
    
    # Run installer
    bash /tmp/$MINICONDA_INSTALLER -b -p $MINICONDA_PATH
    
    # Initialize conda
    $MINICONDA_PATH/bin/conda init bash
    
    # Source bashrc to get conda in current session
    source ~/.bashrc
    
    echo "Miniconda installed successfully."
else
    echo "Conda is already installed, proceeding..."
fi

# Ensure conda is available in current shell
if ! command_exists conda; then
    export PATH="$HOME/miniconda3/bin:$PATH"
fi

# Update conda
echo "Updating conda..."
conda update -n base -c defaults conda -y

# Remove any existing environment with the same name
echo "Checking for existing environment..."
conda env list | grep -q quantum_chem && { 
    echo "Removing existing quantum_chem environment..."; 
    conda env remove -n quantum_chem -y; 
}

# Create the quantum chemistry environment with Python 3.9 (specific for psi4 compatibility)
echo "Creating quantum chemistry environment with Python 3.9 (for psi4 compatibility)..."
conda create -n quantum_chem python=3.9 -y

# Activate the environment
echo "Activating environment..."
source $(conda info --base)/etc/profile.d/conda.sh
conda activate quantum_chem

# Configure channels
echo "Configuring conda channels..."
conda config --env --add channels defaults
conda config --env --add channels conda-forge
conda config --env --add channels psi4

# Install pydantic v1 explicitly first (critical for psi4 compatibility)
echo "Installing pydantic v1 (required for psi4)..."
conda install pydantic=1.10 -c conda-forge -y

# Install psi4 and psi4-rt together
echo "Installing Psi4 and Psi4-rt..."
if ! conda install psi4 psi4-rt -c psi4 -c conda-forge -y; then
    echo "ERROR: Psi4 installation failed. Please check the logs."
    echo "Continuing with other packages..."
fi

# Verify psi4 installation
if check_package psi4; then
    PSI4_VERSION=$(python -c "import psi4; print(psi4.__version__)")
    echo "✓ Psi4 ${PSI4_VERSION} installed successfully."
else
    echo "✗ Psi4 installation could not be verified."
    echo "Please check error messages above."
fi

# Install core scientific packages
echo "Installing core scientific packages..."
conda install numpy scipy matplotlib pandas jupyter jupyterlab -y

# Install chemistry-specific packages
echo "Installing additional chemistry packages..."
conda install rdkit openbabel -y

# Install materials science packages
echo "Installing materials science packages..."
conda install ase pymatgen -y

# Install machine learning package (PyTorch only)
echo "Installing PyTorch machine learning package..."
conda install -c pytorch pytorch torchvision cpuonly -y

# Install visualization tools
echo "Installing visualization packages..."
conda install seaborn plotly bokeh -y
conda install ipywidgets nodejs -y

# Final verification
echo
echo "================================================================="
echo "  Verification of installed packages"
echo "================================================================="

PACKAGES=("numpy" "scipy" "matplotlib" "pandas" "psi4" "rdkit" "openbabel" 
          "ase" "pymatgen" "torch" "seaborn" "plotly" "bokeh")

for pkg in "${PACKAGES[@]}"; do
    if check_package "$pkg"; then
        VERSION=$(python -c "import $pkg; print($pkg.__version__)" 2>/dev/null || echo "unknown")
        echo "✓ $pkg ($VERSION)"
    else
        echo "✗ $pkg (not found)"
    fi
done

echo
echo "================================================================="
echo "  Quantum Chemistry Environment Setup Complete"
echo "================================================================="
echo "To activate the environment in the future, run:"
echo "  conda activate quantum_chem"
echo "================================================================="

Results

Table 1. System specifications of the target computer used for environment setup, showing distribution details, hardware specifications, and available resources. The system offers adequate CPU, memory, and storage resources for computational chemistry applications.

Component Details
Distribution Ubuntu 24.04.2 LTS (Noble)
Kernel Linux 6.11.0-21-generic
Architecture x86_64 (64-bit)
CPU 11th Gen Intel Core i7-1165G7 @ 2.80GHz
CPU Cores 4 cores, 8 threads (Hyperthreading enabled)
CPU Max Frequency 4.7 GHz
Memory 16GB RAM (15.9GB total)
Swap 4GB
Storage 954GB NVMe SSD (937GB available)
Graphics Intel Iris Xe Graphics

Table 2. Package verification results showing successfully installed components in the quantum chemistry environment. Core packages were successfully installed, providing a complete toolset for computational chemistry applications.

Package Category Packages Versions
Core Scientific numpy 1.24.3
scipy 1.13.1
matplotlib 3.9.2
pandas 2.2.2
Quantum Chemistry psi4 1.7
qcelemental 0.25.1
qcengine 0.26.0
Cheminformatics rdkit 2024.03.5
openbabel 3.1.0
Materials Science ase 3.23.0
pymatgen 2023.8.10
Machine Learning pytorch 2.5.1
Visualization plotly 6.0.1
seaborn 0.13.2
bokeh 3.3.4
Interactive Computing jupyterlab 4.4.0
jupyter 1.1.1

Discussion

The implementation of the quantum chemistry environment setup protocol on the test system yielded successful installation of all required components. The system specifications determined during the initial assessment phase are presented in Table 1, demonstrating appropriate hardware capabilities for computational chemistry applications.

The environment verification process was carried out using an inspection of the terminal output. Successful installation of all required packages was verified as shown in Table 2. A critical finding of this implementation was the specific dependency requirements for Psi4, which necessitated Python 3.9 and pydantic version 1.10. This configuration insight represents a significant contribution of this work, as Psi4 installation frequently presents challenges due to complex interdependencies.

The JupyterLab installation was also successful, providing an interactive computational interface accessible via both local and remote connections. This interactive environment significantly enhances the usability of the quantum chemistry tools, allowing researchers to create, share, and modify computational workflows through a web-based interface.

The core of the setup protocol addresses several critical aspects of environment configuration. Conda was selected as the environment management system due to its robust handling of Python dependencies and its widespread adoption in the scientific computing community.6 The creation of an isolated environment specifically for quantum chemistry prevents conflicts with other Python applications and facilitates reproducibility. The systematic installation of packages builds a comprehensive toolkit moving from foundational scientific computing libraries to specialized chemistry applications.

The installation of Psi4 provides the fundamental quantum chemistry capabilities for the environment. As an open-source electronic structure package, Psi4 offers a range of methods from Hartree-Fock to coupled-cluster theory and density functional theory, making it suitable for diverse research applications.7 Its Python API allows for seamless integration with the other components of the environment, enabling automated workflows and custom analysis scripts.

Supporting chemistry packages such as RDKit and OpenBabel complement Psi4 by providing cheminformatics capabilities and file format conversion utilities. RDKit is particularly valuable for molecular manipulation, property calculation, and machine learning applications in chemistry.9 OpenBabel facilitates interoperability between different chemical file formats, allowing researchers to integrate their computational studies with diverse chemical databases and external software.10

The materials science packages ASE and Pymatgen extend the environment’s capabilities beyond molecular chemistry to solid-state systems. ASE provides tools for setting up, manipulating, and analyzing atomistic simulations, while Pymatgen offers specialized functions for materials analysis and property prediction.15 These capabilities are essential for research at the interface of chemistry and materials science, such as heterogeneous catalysis, surface chemistry, and functional materials design.

The inclusion of PyTorch provides a powerful framework for developing machine learning models relevant to chemistry, including neural network potentials, property prediction models, and molecular design algorithms. The visualization libraries (Matplotlib, Seaborn, Plotly, and Bokeh) offer diverse options for creating publication-quality figures and interactive visualizations of computational results.

Several practical considerations emerged during the implementation of this protocol. The Python version specificity (3.9) for Psi4 compatibility highlights the importance of careful version management in scientific computing environments. The installation sequence also proved critical, with certain packages (like pydantic) needing to be installed before others to avoid conflicts. These insights underscore the value of documented, reproducible setup protocols for complex scientific software environments.

Conclusion

The quantum chemistry environment setup protocol presented in this work provides a systematic approach to establishing a comprehensive computational platform for chemistry research. The environment successfully integrates quantum chemistry software, supporting scientific libraries, and interactive computing tools within a cohesive framework. The verification results confirm that all components function correctly, creating a ready-to-use research environment.

This approach addresses the common challenges in computational chemistry setup by providing an organized, reproducible process that minimizes technical barriers. The resulting environment supports diverse research applications ranging from fundamental electronic structure calculations to emerging machine learning approaches in chemistry. The interactive JupyterLab interface facilitates collaborative research and flexible work arrangements.

The protocol’s design emphasizes accessibility and adaptability, making it suitable for implementation across different research contexts from individual projects to educational settings. By reducing the technical overhead associated with environment configuration, this approach allows researchers to focus more directly on their scientific questions rather than computing infrastructure.

Future work could explore expanding this protocol to include additional specialized tools for specific research domains, integration with high-performance computing resources, and adaptation to container-based deployment for enhanced portability. The foundation established here provides a solid platform for such extensions, contributing to more accessible and reproducible computational chemistry research.

References

1.
Anthropic. Claude 3.7 Sonnet, 2025. https://www.anthropic.com/claude.
2.
Cramer, C. J. Essentials of Computational Chemistry: Theories and Models, 2nd ed.; John Wiley & Sons, 2013.
3.
Jensen, F. Introduction to Computational Chemistry, 3rd ed.; John Wiley & Sons: Chichester, UK, 2017.
4.
Krylov, A. I. The Quantum Chemistry of Open-Shell Species: A Tiered Approach to Computational Spectroscopy. Annual Review of Physical Chemistry 2018, 69, 137–158. https://doi.org/10.1146/annurev-physchem-050317-021120.
5.
Butler, K. T.; Davies, D. W.; Cartwright, H.; Isayev, O.; Walsh, A. Machine Learning for Molecular and Materials Science. Nature 2018, 559 (7715), 547–555. https://doi.org/10.1038/s41586-018-0337-2.
6.
Inc., A. Conda: Package and Environment Management System. Anaconda Documentation 2016.
7.
Smith, D. G. A.; Burns, L. A.; Simmonett, A. C.; Parrish, R. M.; Schieber, M. C.; Galvelis, R.; Kraus, P.; Kruse, H.; Di Remigio, R.; Alenaizan, A.; James, A. M.; Lehtola, S.; Misiewicz, J. P.; Scheurer, M.; Shaw, R. A.; Schriber, J. B.; Xie, Y.; Glick, Z. L.; Sirianni, D. A.; O’Brien, J. S.; Waldrop, J. M.; Kumar, A.; Hohenstein, E. G.; Pritchard, B. P.; Brooks, B. R.; Schaefer III, H. F.; Sokolov, A. Yu.; Patkowski, K.; DePrince III, A. E.; Bozkaya, U.; King, R. A.; Evangelista, F. A.; Turney, J. M.; Crawford, T. D.; Sherrill, C. D. Psi4 1.4: Open-Source Software for High-Throughput Quantum Chemistry. The Journal of Chemical Physics 2020, 152 (18), 184108. https://doi.org/10.1063/5.0006002.
8.
Van Der Walt, S.; Colbert, S. C.; Varoquaux, G. The NumPy Array: A Structure for Efficient Numerical Computation. Computing in Science & Engineering 2011, 13 (2), 22–30. https://doi.org/10.1109/MCSE.2011.37.
9.
10.
O’Boyle, N. M.; Banck, M.; James, C. A.; Morley, C.; Vandermeersch, T.; Hutchison, G. R. Open Babel: An Open Chemical Toolbox. Journal of Cheminformatics 2011, 3 (1), 33. https://doi.org/10.1186/1758-2946-3-33.
11.
Von Lilienfeld, O. A.; Müller, K.-R.; Tkatchenko, A. Exploring Chemical Compound Space with Quantum-Based Machine Learning. Nature Reviews Chemistry 2020, 4 (7), 347–358. https://doi.org/10.1038/s41570-020-0189-9.
12.
Smith, J. S.; Nebgen, B.; Lubbers, N.; Isayev, O.; Roitberg, A. E. Less Is More: Sampling Chemical Space with Active Learning. The Journal of Chemical Physics 2018, 148 (24), 241733. https://doi.org/10.1063/1.5023802.
13.
Project Jupyter. JupyterLab Documentation, 2021. https://jupyterlab.readthedocs.io/.
14.
Larsen, A. H.; Mortensen, J. J.; Blomqvist, J.; Castelli, I. E.; Christensen, R.; Dułak, M.; Friis, J.; Groves, M. N.; Hammer, B.; Hargus, C.; others. The Atomic Simulation Environment—a Python Library for Working with Atoms. Journal of Physics: Condensed Matter 2017, 29 (27), 273002. https://doi.org/10.1088/1361-648X/aa680e.
15.
Ong, S. P.; Richards, W. D.; Jain, A.; Hautier, G.; Kocher, M.; Cholia, S.; Gunter, D.; Chevrier, V. L.; Persson, K. A.; Ceder, G. Python Materials Genomics (Pymatgen): A Robust, Open-Source Python Library for Materials Analysis. Computational Materials Science 2013, 68, 314–319. https://doi.org/10.1016/j.commatsci.2012.10.028.