Installing Serpent

Obtaining, compiling, and configuring the Serpent Monte Carlo code

Before You Begin

Before attempting a local installation, check whether your university or institution already provides access to Serpent. Many nuclear engineering departments maintain centralized installations on shared computing clusters. If one is available, skip directly to the verification section at the end of this page.

Serpent is distributed as source code and must be compiled on your system. It runs natively on Linux, and most production work is done on Linux systems or high-performance computing clusters. Windows users can run Serpent through the Windows Subsystem for Linux (WSL2), which provides near-native performance. A virtual machine running Linux is a last resort, as it incurs a noticeable performance penalty.

Serpent requires at least 4 GB of RAM for small models, though 16 GB or more is recommended for realistic reactor calculations. Nuclear data libraries occupy roughly 10-20 GB of disk space depending on which evaluations you install, so plan for at least 20 GB of free storage. A multi-core processor allows Serpent to exploit its OpenMP parallelism, which can dramatically reduce computation times.

Obtaining Serpent

Serpent is proprietary software distributed through official channels. Academic users in OECD/NEA member countries (including the US, most of Europe, Japan, and Australia) can request the code through the NEA Data Bank. Users in the United States may also obtain Serpent through RSICC at Oak Ridge National Laboratory, which typically requires a university sponsor and US citizenship or permanent residency.

The request process generally takes two to four weeks. Once approved, you will receive the source code distribution as a compressed archive along with documentation. Never download Serpent from unofficial sources — these may contain outdated versions or violate licensing terms.

Compilation

Begin by installing the required development tools on your Linux system. Serpent is written in C and only needs a C compiler and make.

Installing Build Dependencies

bash
# Ubuntu/Debian
sudo apt update
sudo apt install build-essential git

# CentOS/RHEL/Fedora
sudo dnf install gcc gcc-c++ make git

Once the development tools are in place, extract the Serpent distribution archive and compile. Serpent uses a simple Makefile-based build with no configure script. To enable OpenMP shared-memory parallelism (recommended for any serious calculation), edit the Makefile and uncomment the CFLAGS += -fopenmp line before running make.

Compiling Serpent

bash
tar -xzf serpent-2.1.32.tar.gz
cd serpent-2.1.32

# Optional: enable OpenMP by editing the Makefile
# Uncomment the line: CFLAGS += -fopenmp

make

Compilation produces the sss2 executable in the source directory. You can copy it to a directory on your PATH (e.g., /usr/local/bin) or run it directly from the source directory.

Nuclear Data Libraries

Serpent requires ACE-format nuclear cross-section data to perform transport calculations. The most commonly used evaluations are ENDF/B-VII.1 and ENDF/B-VIII.0. These libraries contain the interaction probabilities for every nuclide at continuous energies, along with decay data and fission product yield information needed for burnup calculations.

Installing Cross-Section Data

bash
mkdir -p /opt/serpent/data
cd /opt/serpent/data
tar -xzf endfb71_ace.tar.gz

echo 'export SERPENT_DATA=/opt/serpent/data' >> ~/.bashrc
source ~/.bashrc

The SERPENT_DATA environment variable tells Serpent where to find the cross-section libraries. If you cannot write to /opt, install the data in your home directory instead (e.g., $HOME/serpent/data) and set the environment variable accordingly.

WSL2 Installation for Windows Users

Windows users should install the Windows Subsystem for Linux version 2, which provides a real Linux kernel running alongside Windows. Open PowerShell as Administrator and run wsl --install, then reboot when prompted. After rebooting, install Ubuntu from the Microsoft Store.

Once inside the Ubuntu WSL terminal, the installation process is identical to native Linux. Install the build dependencies with apt, then compile Serpent and install the nuclear data libraries as described above. Windows files are accessible from WSL through the /mnt/c/ mount point, and tools like VS Code with the WSL extension provide a seamless editing experience.

Verification

After installation, verify that everything is working correctly. Start by checking the version and build configuration.

Checking the Installation

bash
sss2 -version

# Run a minimal test input to verify functionality
mkdir ~/serpent_test && cd ~/serpent_test
# Create or copy a simple pin cell input, then run:
sss2 input
ls -la *_res.m *_det0.m

The version command should display the Serpent version number and confirm that OpenMP support is enabled. Running a simple pin cell input verifies the full toolchain; if it completes without errors and produces output files with a reasonable k-effective, your installation is working correctly.

Common Installation Issues

If compilation fails with errors about missing headers or libraries, the most likely cause is incomplete development tool installation. Run the dependency installation commands again and try make clean followed by make. On older systems where the compiler does not support OpenMP, comment out the CFLAGS += -fopenmpline in the Makefile to build a serial-only version.

Cross-section library errors at runtime ("XS data directory not found") indicate that the SERPENT_DATA environment variable is not set or points to the wrong location. Verify it with echo $SERPENT_DATA and confirm that the directory contains the expected .xsdata and .ace files.

If simulations run but are unexpectedly slow, check that OpenMP is actually enabled in your build (the version command will say so) and that you are using multiple threads. You can set the thread count with export OMP_NUM_THREADS=4 or pass it on the command line with sss2 -omp 4 input_file.