Skip to main content

Commands & Options

Synopsis

zsasa calc <input> [output] [OPTIONS]
zsasa batch <input_dir> [output_dir] [OPTIONS]
zsasa traj <trajectory> <topology> [output] [OPTIONS]

Subcommands

calc - Single File SASA Calculation

Calculate SASA for a single structure file.

zsasa calc structure.cif output.json [OPTIONS]

batch - Directory Batch Processing

Process all structure files in a directory.

zsasa batch input_dir/ output_dir/ [OPTIONS]

Batch mode uses file-level parallelism: multiple files are processed simultaneously, one thread per file. Use --threads to control the number of concurrent files.

traj - Trajectory Analysis

Calculate SASA for each frame in a trajectory file (XTC or DCD).

zsasa traj trajectory.xtc topology.pdb [OPTIONS]

See Trajectory Options for traj-specific options and details.

Basic Usage

# Basic SASA calculation
./zig-out/bin/zsasa calc structure.cif output.json

# With algorithm selection
./zig-out/bin/zsasa calc --algorithm=lr structure.cif output.json

# Multi-threaded
./zig-out/bin/zsasa calc --threads=4 structure.cif output.json

# With analysis features
./zig-out/bin/zsasa calc --rsa --polar structure.cif output.json

Common Options

Algorithm Options

OptionDescriptionDefault
--algorithm=ALGOsr (Shrake-Rupley) or lr (Lee-Richards)sr
--precision=PFloating-point precision: f32 or f64f64
--probe-radius=RProbe radius in Å (0 < R ≤ 10)1.4
--n-points=NTest points per atom (SR only, 1-10000)100
--n-slices=NSlices per atom diameter (LR only, 1-1000)20
--use-bitmaskUse bitmask LUT optimization (SR only, n_points 1-1024)off
--threads=NNumber of threads (0 = auto-detect)0

Classifier Options

OptionDescriptionDefault
--classifier=TYPEBuilt-in classifier: naccess, protor, or oonsprotor for PDB/mmCIF, none for JSON
--config=FILECustom classifier config file (TOML or FreeSASA format, auto-detected by extension)none

When --classifier is used, atom radii are assigned based on residue and atom names. For PDB/mmCIF input, protor is used by default (matching FreeSASA/RustSASA defaults). If both --classifier and --config are specified, --config takes precedence.

See Classifiers for detailed classifier documentation.

Structure Filtering

OptionDescriptionDefault
--chain=IDFilter by chain ID (e.g., A or A,B,C)all chains
--model=NModel number for NMR structures (≥1)all models
--auth-chainUse auth_asym_id instead of label_asym_idlabel_asym_id
--include-hydrogensInclude hydrogen atoms (calc/batch default: excluded)excluded
--no-hydrogensExclude hydrogen atoms (traj default: included)
--include-hetatmInclude HETATM recordsexcluded

Analysis Options

OptionDescription
--per-residueShow per-residue SASA aggregation
--rsaCalculate Relative Solvent Accessibility (enables --per-residue)
--polarShow polar/nonpolar SASA summary (enables --per-residue)

See Output & Analysis for detailed output descriptions.

Output Options

OptionDescriptionDefault
-o, --output=FILEOutput file pathoutput.json
--format=FMTOutput format: json, compact, csvjson
--timingShow timing breakdown (for benchmarking)off
-q, --quietSuppress progress outputoff
--validateValidate input only, do not calculateoff

Information Options

OptionDescription
-h, --helpShow help message
-V, --versionShow version

Trajectory Options

The traj subcommand has additional options specific to trajectory processing.

Arguments

ArgumentDescription
<trajectory>Trajectory file (.xtc for GROMACS, .dcd for NAMD/CHARMM)
<topology>Topology file (PDB or mmCIF) for atom names and radii

Options

All common options apply, plus:

OptionDescriptionDefault
--precision=PFloating-point precision: f32 or f64f32 (note: different from calc/batch)
--no-hydrogensExclude hydrogen atomsincluded
--include-hydrogensInclude hydrogen atoms (default, for backward compat)included
--stride=NProcess every Nth frame1
--start=NStart from frame N0
--end=NEnd at frame Nall
--batch-size=NFrames per batch for parallel processing (omit for auto)auto
-o, --output=FILEOutput CSV filetraj_sasa.csv

Notes

  • Supported trajectory formats: XTC (GROMACS) and DCD (NAMD/CHARMM), auto-detected from extension
  • XTC coordinates are in nm; automatically converted to Å. DCD coordinates are already in Å.
  • Hydrogen atoms are included by default in trajectory mode; use --no-hydrogens to exclude them
  • Topology file provides atom names for radius classification
  • The number of atoms in XTC must match the topology
  • Default precision is f32 (faster for trajectory processing)

Examples

Basic Calculations

# mmCIF input
./zig-out/bin/zsasa calc structure.cif output.json

# PDB input
./zig-out/bin/zsasa calc structure.pdb output.json

# JSON input
./zig-out/bin/zsasa calc atoms.json output.json

Algorithm Selection

# Lee-Richards with 50 slices
./zig-out/bin/zsasa calc --algorithm=lr --n-slices=50 structure.cif output.json

# Shrake-Rupley with 200 test points
./zig-out/bin/zsasa calc --algorithm=sr --n-points=200 structure.cif output.json

Performance Tuning

# Fast mode: f32 precision
./zig-out/bin/zsasa calc --precision=f32 structure.cif output.json

# Multi-threaded
./zig-out/bin/zsasa calc --threads=4 structure.cif output.json

# Show timing breakdown
./zig-out/bin/zsasa calc --timing structure.cif output.json

Classifier Usage

# NACCESS classifier
./zig-out/bin/zsasa calc --classifier=naccess structure.cif output.json

# Custom config
./zig-out/bin/zsasa calc --config=custom.config structure.cif output.json

Chain/Model Filtering

# Single chain
./zig-out/bin/zsasa calc --chain=A structure.cif output.json

# Multiple chains
./zig-out/bin/zsasa calc --chain=A,B,C structure.cif output.json

# Specific model (NMR)
./zig-out/bin/zsasa calc --model=1 nmr_structure.cif output.json

# Use auth chain IDs
./zig-out/bin/zsasa calc --auth-chain --chain=A structure.cif output.json

Atom Filtering

By default, hydrogen atoms and HETATM records are excluded (matching FreeSASA/RustSASA defaults).

# Include hydrogen atoms
./zig-out/bin/zsasa calc --include-hydrogens structure.pdb output.json

# Include HETATM records (water, ligands, etc.)
./zig-out/bin/zsasa calc --include-hetatm structure.pdb output.json

# Include both
./zig-out/bin/zsasa calc --include-hydrogens --include-hetatm structure.pdb output.json

Batch Processing

# Basic batch processing
./zig-out/bin/zsasa batch input_dir/ output_dir/

# Multi-threaded (file-level parallelism)
./zig-out/bin/zsasa batch --threads=8 input_dir/ output_dir/

Trajectory Analysis

# Basic trajectory analysis
zsasa traj trajectory.xtc topology.pdb

# With NACCESS classifier
zsasa traj trajectory.xtc topology.pdb --classifier=naccess

# Every 10th frame
zsasa traj trajectory.xtc topology.pdb --stride=10

# Frames 100-200 only
zsasa traj trajectory.xtc topology.pdb --start=100 --end=200

# Lee-Richards algorithm with f64 precision
zsasa traj trajectory.xtc topology.pdb --algorithm=lr --precision=f64

Validation Only

# Validate without calculation
./zig-out/bin/zsasa calc --validate structure.cif

Error Messages

ErrorDescription
Missing input fileNo input file specified
Cannot access '<path>'Input file not found or not readable
Invalid probe radiusProbe radius out of range (0, 10]
Invalid n-pointsTest points out of range [1, 10000]
Invalid n-slicesSlices out of range [1, 1000]
Invalid formatUnknown output format
Invalid algorithmUnknown algorithm name
Invalid classifierUnknown classifier name
Invalid model numberModel number must be ≥ 1
Array lengths do not matchJSON arrays have different lengths
Radius must be positiveRadius ≤ 0 in input
Coordinate is not finiteNaN or Inf in coordinates
Classifier requires 'residue' and 'atom_name'Missing classification info

Exit Codes

CodeMeaning
0Success
1Error (invalid input, file not found, etc.)