Code & Installation
Learn about SMOOTHIE's architecture, installation process, and compilation instructions for this high-performance Modern Fortran nuclear physics code.
Overview
Modern Fortran code for nuclear physics calculations
SMOOTHIE is written in Modern Fortran and designed for high-performance nuclear physics calculations. The code implements the Ichimura-Austern-Vincent formalism for non-elastic breakup reactions and uses advanced numerical methods including the Lagrange-mesh R-matrix approach.
Language
Modern Fortran
Platforms
Linux, macOS, Windows
Dependencies
LAPACK/BLAS (optional)
Build System
Make
Code Architecture
Modular design for maintainability and extensibility
general_modules/
Core modules containing fundamental constants, precision definitions, and system utilities.
constants.F90
Physical constants and parameters
precision.F90
Numerical precision definitions
systems.f
System-specific utilities
channels.f
Channel coupling definitions
mesh_modules/
Numerical mesh and integration routines for wave function calculations.
mesh.f
Radial mesh generation
angularmesh.f
Angular quadrature points
gauss.F
Gaussian integration methods
derivative.f
Numerical differentiation
interpolation.f
Interpolation routines
pot_modules/
Optical potential models and parameterizations for various nuclear systems.
kd02.f
Koning-Delaroche global potential
ch89.f
Chapel Hill 89 potential
bg69.f
Becchetti-Greenlees potential
guopot.f
Guo potential models
pot.f
Generic potential interface
pw_modules/
Partial wave analysis and special function libraries.
clebsch.f
Clebsch-Gordan coefficients
spharm.f
Spherical harmonics
whittaker.f
Whittaker functions
coul90.f
Coulomb wave functions
smoothie/
Main calculation engine implementing the IAV formalism.
smoothie.F
Main program entry point
iavdwba.f
IAV-DWBA calculations
bound.f
Bound state wave functions
scatt.f
Scattering wave functions
green.f
Green's function methods
input.f
Input file parsing
Installation Guide
Step-by-step instructions to get SMOOTHIE running on your system
Prerequisites
Essential components for building SMOOTHIE
Fortran Compiler
gfortran (GCC) or ifort (Intel)
Build Tools
make utility
Libraries
LAPACK/BLAS (recommended)
Platform-specific Installation Commands
sudo apt update
sudo apt install gfortran make liblapack-dev libblas-dev
sudo yum install gcc-gfortran make lapack-devel blas-devel
brew install gcc make openblas lapack
Download Source Code
Clone the SMOOTHIE repository from GitHub
SMOOTHIE Public Repository
Complete source code with examples and documentation
# Clone the source code
git clone https://github.com/jinleiphys/smoothie-public.git
cd smoothie-public
Configure Build Environment
Set up compiler and library settings
Edit the make.inc
file to match your system configuration:
# Copy appropriate template
cp make.inc.gfortran make.inc # For GCC/gfortran
# OR
cp make.inc.ifort make.inc # For Intel Fortran
# Edit configuration
vim make.inc
Compile SMOOTHIE
Build the executable and all modules
# Build all modules and main program
make
# Clean previous builds if needed
make clean && make
# Build with specific compiler (optional)
make FC=gfortran
Compilation Results
Module Libraries
Compiled libraries in each subdirectory
Main Executable
smoothie/smoothie
Test Installation
Verify everything works correctly
Run the included test case to verify your installation:
# Navigate to test directory
cd smoothie/test/
# Run test calculation
../smoothie < test.in
# Check output files
ls -la *.out
Success!
You should see output files containing cross-section data. Your SMOOTHIE installation is ready!
⚙️ Compilation Options
🎯 Optimization Levels
-O0
No optimization (debug builds)
-O2
Standard optimization (recommended)
-O3
High optimization (production)
-Ofast
Aggressive optimization
🐛 Debug Options
-g
Include debug information
-fcheck=all
Runtime array bounds checking
-Wall
Enable all warnings
-Wextra
Extra warning messages
🔗 Linking Libraries
-llapack
Linear algebra package
-lblas
Basic linear algebra subprograms
-lm
Math library functions
-fopenmp
OpenMP parallel processing
Troubleshooting Guide
Common issues and their solutions for smooth SMOOTHIE operations
Compilation Errors
Build-time problems and solutions
Command not found: gfortran
Install Fortran compiler package for your system
Cannot find -llapack
Install LAPACK development libraries or modify library paths in make.inc
Module compilation errors
Ensure Modern Fortran or later compiler. Clean and rebuild all modules
Runtime Issues
Execution problems and fixes
Segmentation fault during execution
Increase stack size or compile with bounds checking for debugging
Numerical instabilities
Adjust mesh parameters or potential model settings in input file
Slow performance
Link with optimized BLAS/LAPACK libraries and enable compiler optimizations
Platform-Specific Issues
OS-specific considerations and solutions
Platform-specific Solutions
Use Homebrew gcc instead of Xcode's compiler for better Fortran support.
Use MinGW-w64 or Windows Subsystem for Linux (WSL) for best compatibility.
Load appropriate modules for compiler and mathematical libraries.
Deployment & Usage
Advanced deployment strategies and usage patterns for production environments
Installing SMOOTHIE Globally
Make SMOOTHIE accessible from anywhere on your system
# Create personal bin directory (if it doesn't exist)
mkdir -p ~/bin
# Copy SMOOTHIE executable to personal bin
cp smoothie/smoothie ~/bin/
# Make executable (if needed)
chmod +x ~/bin/smoothie
# Alternative: Install system-wide (requires sudo)
sudo cp smoothie/smoothie /usr/local/bin/
~/bin/
Personal installation, no sudo required
/usr/local/bin/
System-wide installation, available to all users
/opt/smoothie/bin/
Dedicated application directory
Setting Up PATH Environment
Configure shell environment for global access
# For Bash (add to ~/.bashrc or ~/.bash_profile)
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For Zsh (add to ~/.zshrc)
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# For Fish shell (add to ~/.config/fish/config.fish)
echo 'set -gx PATH $HOME/bin $PATH' >> ~/.config/fish/config.fish
# Verify PATH is set correctly
echo $PATH
which smoothie
Input/Output Usage
Flexible I/O redirection and background execution
# Read input from file via stdin
smoothie < input.dat
# Redirect output to file
smoothie < input.dat > results.out
# Pipe output to another program
smoothie < input.dat | grep "Cross section"
# Run in background
smoothie < input.dat > output.log &
# Run with nohup to survive terminal disconnect
nohup smoothie < input.dat > output.log 2>&1 &
Environment Configuration
Runtime optimization and performance tuning
# OpenMP thread control
export OMP_NUM_THREADS=4
export OMP_STACKSIZE=64M
# BLAS/LAPACK optimization
export OPENBLAS_NUM_THREADS=4
export MKL_NUM_THREADS=4
# Set stack size for large calculations
ulimit -s unlimited
Performance Optimization
Maximize computational efficiency and reduce execution time
Compiler Optimizations
Build-time performance enhancements
Production Flags
Use -O3
or -Ofast
for production runs
Vectorization
Enable vectorization with -ftree-vectorize
Architecture Tuning
Use native architecture flags: -march=native
Library Optimizations
High-performance mathematical libraries
Optimized BLAS
Link with Intel MKL, OpenBLAS, or ATLAS
Parallel Libraries
Use threaded libraries for parallel execution
Environment Setup
Set environment variables: OMP_NUM_THREADS
Runtime Tuning
Optimize computational parameters
Mesh Parameters
Adjust mesh density for accuracy vs. speed trade-off
Angular Momentum
Optimize angular momentum cutoffs
Memory Management
Monitor memory usage and adjust accordingly