SPARC Installation Guide

This guide provides step-by-step instructions to set up SPARC and its core dependencies.

Core Software Dependencies

Python Package Dependencies

  • numpy, pandas, dpdata, scipy

Step-by-Step Installation

  1. Create and activate a conda environment:

    conda create -n sparc python=3.10
    conda activate sparc
    
  2. Install DeepMD-kit v3:

    pip install deepmd-kit
    

    Refer to the DeepMD-kit installation guide for GPU-enabled or backend-specific (PyTorch / TensorFlow) installation options.

  3. Clone and install SPARC:

    git clone https://github.com/rahulumrao/sparc.git
    cd sparc
    pip install .
    
  1. Install PLUMED (optional):

    For standard CVs, install directly from conda-forge:

    conda install -c conda-forge py-plumed
    

    Note

    Some Collective Variables (e.g., SPRINT) require the additional module and are not included in the standard PLUMED build. To enable them, build from source:

    ./configure --enable-mpi=no --enable-modules=all \
        PYTHON_BIN=$(which python) --prefix=$CONDA_PREFIX
    
    make -j$(nproc) && make install
    

    To verify PLUMED installation:

    >>> from ase.calculators import plumed
    >>> from plumed import Plumed
    
  2. Install xTB (optional):

    conda install -c conda-forge xtb-python
    

DFT Engine Requirements

SPARC supports the following DFT engines. Only install what you need:

Engine

Use case

Notes

VASP

Periodic solids

License required; set VASP_PP_PATH env variable

CP2K

Periodic solids / molecules

Free; ASE CP2K interface included

ORCA

Molecules

Free for academia; set exe_command in input.yaml

Quantum ESPRESSO

Periodic solids

Free; set exe_command

xTB

Semi-empirical (fast)

conda install -c conda-forge xtb-python

Gaussian

Molecules

License required

Environment Setup

For VASP, set the POTCAR files path:

export VASP_PP_PATH=/path/to/vasp/potcar_files

If PLUMED was installed from source (not conda-forge):

export PLUMED_KERNEL="$CONDA_PREFIX/lib/libplumedKernel.so"
export PYTHONPATH="$CONDA_PREFIX/lib/plumed/python:$PYTHONPATH"

Verification

sparc -h

Expected output:

sparc [-h] [-i INPUT_FILE]

options:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input_file INPUT_FILE
                        Input YAML file

Important

The pip install tensorflow[and-cuda] installation may not always detect the GPU due to potential configuration issues. To verify whether TensorFlow has successfully recognized the GPU, run:

python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

If the output is an empty list, check:

  • Your NVIDIA driver and CUDA toolkit installation

  • The CUDA version compatibility with TensorFlow

  • That environment variables (e.g., LD_LIBRARY_PATH) are correctly set

Refer to the TensorFlow GPU troubleshooting guide for details.