Mainchain angle¶
The angle program computes backbone angle profiles along the amino acid
sequence of a coarse-grained protein.
It can generate:
time-resolved angle evolution
residue-resolved average angles
chain-resolved angle profiles
angle statistics (mean ± std) across chains and time
fully verbose angle output for every chain and every residue
This program is part of the DROPPS analysis suite and is defined in
angle.py.
Overview¶
The program:
Loads a MD trajectory (TPR + XTC ± NDX) using the DROPPS trajectory API.
Selects a reference atom group (either automatically or interactively).
Splits this group into chains and removes terminal residues.
For each non-terminal residue (i), computes the angle formed by the triplet ((i-1, i, i+1)).
Processes all selected frames.
Writes one or more XVG files depending on output options.
The computation uses MDAnalysis for coordinate handling and supports optional periodic boundary condition (PBC) unwrapping.
Usage¶
dps angle -s run.tpr -f run.xtc [-n run.ndx] [options]
Required Arguments¶
- -s, --run-input TPR¶
TPR file containing the full simulation input information (topology, coordinates, box, mapping).
- -f, --input XTC¶
Trajectory (XTC) file to analyze.
Optional Arguments¶
Selection¶
- -n, --index NDX¶
Optional index file containing predefined groups.
- -sel, --selection INT¶
Select a group by index instead of interactive selection. The group must contain the angle-center atoms (the central atom of each triplet). Chains will be automatically split and terminal residues removed.
Time Control¶
- -b, --start-time INT¶
Starting time (ns) for analysis.
- -e, --end-time INT¶
Ending time (ns).
- -dt, --delta-time INT¶
Time interval (ns) between analyzed frames.
Frame indices are computed internally via time2frame.
Periodic Boundary Conditions¶
- -pbc, --treat-pbc¶
Apply MDAnalysis
unwraptransformation to remove PBC discontinuities.
Output Options¶
One or multiple XVG files may be generated.
- -ot, --output-time FILE¶
Output angles averaged over all chains, as a function of time.
- -or, --output-residue FILE¶
Output angles averaged over all time points, for each chain, as a function of residue index.
- -ors, --output-residue-statistic FILE¶
Mean and standard deviation across all angles, for each residue index.
- -ov, --output-verbose FILE¶
Output verbose per-chain, per-residue, per-frame angle values.
Algorithm¶
Trajectory Loading
trajectory = trajectory_class(args.run_input, args.index, args.input)
PBC Handling (optional)
unwrap(trajectory.Universe.atoms)
Frame Index Construction
start, end, step = trajectory.time2frame(b, e, dt)
Selection
If
--selectionis used: direct selectionOtherwise: interactive
trajectory.index.print_all()promptGroups are split by chain:
splitch_indicesTerminal residues removed using
trajectory.is_terminal(atom)
Angle Triplet Construction
For each internal residue with index i:
angle(i) = angle( (i-1), i, (i+1) )
Angle Calculation
For each frame:
v1 = pos[i-1] - pos[i] v2 = pos[i+1] - pos[i] cosθ = dot(normalize(v1), normalize(v2)) θ = arccos(cosθ) in degrees
Statistics & Output
verbose output
time-averaged angles
residue-averaged angles
mean ± std per residue
Output Files (XVG)¶
All outputs are written via write_xvg with proper legends and axes labels.
1. Verbose angle file (--output-verbose)
Angle vs Time for every chain and every residue.
legend example:
Chain A Residue 32
Chain A Residue 33
...
2. Time-resolved averages (--output-time)
For each residue: angle averaged over all chains.
3. Residue-resolved averages (--output-residue)
For each chain: angle averaged over time.
4. Statistics (--output-residue-statistic)
Mean angle and standard deviation across all chains and frames.
Example¶
dps angle \
-s run.tpr \
-f run.xtc \
-n run.ndx \
--selection 3 \
--start-time 0 \
--end-time 200 \
--delta-time 1 \
--output-time angle_time.xvg \
--output-residue angle_res.xvg \
--output-residue-statistic angle_stat.xvg
Error Messages¶
“Exception occurred when trying to open trajectory file” Trajectory could not be loaded → check TPR, XTC, NDX paths.
“Chains in selection groups are not same in length.” Your selection must contain identical chain lengths.
“The chains … don’t possess same residue IDs.” Your chosen index group mixes chains with different residue numbering.
“Distance will be calculated without PBC.”
Displayed when --treat-pbc is omitted.
May be acceptable for folded proteins, but not for long disordered chains.
Summary¶
dps angle provides a flexible and powerful tool for computing backbone angle
profiles across chains, time, and residue index.
It supports both per-chain and averaged analyses, and produces high-quality XVG
files suitable for plotting with:
Xmgrace
Matplotlib
DROPPS visualization scripts