# Rg Plugin Reference For a step-by-step guide to running Rg analysis, see {doc}`../how_to/analysis_rg_quickstart`. ## Configuration Reference All fields for `RgRunSettings`: | Field | Type | Default | Description | |-------|------|---------|-------------| | `label` | `str` | *required* | Human-readable run label (must be unique) | | `selection` | `str` | *required* | MDAnalysis selection for Rg calculation | | `calculation_mode` | `str` | `"selection"` | `"selection"` for whole-group Rg, `"fragments"` for per-fragment reduction | | `fragment_weighting` | `str` | `"equal"` | `"equal"` (arithmetic mean) or `"mass"` (mass-weighted mean). Only valid when `calculation_mode="fragments"` | | `save_fragment_distribution` | `bool` | `true` | Save per-fragment Rg values in NPZ sidecar for distribution analysis | | `histogram_bins` | `int` | `50` | Number of bins for fragment/reduced distribution histograms (minimum 2) | Top-level `RgSettings` contains a single field: | Field | Type | Default | Description | |-------|------|---------|-------------| | `runs` | `list[RgRunSettings]` | *required* | One or more named Rg runs (at least one required) | ```{note} Run labels must be unique within a single `comparison.yaml`. Duplicate labels raise a validation error. ``` ```{warning} Unlike RMSD (which defaults `selection` to `"protein and name CA"`), Rg has **no default selection**. You must always specify `selection` explicitly for each run. ``` ## Fragment Mode Reference ```{versionadded} 1.3.0 Fragment-aware Rg calculation was added in PolyzyMD 1.3.0. ``` Standard selection mode computes one Rg value per frame for the full atom group matched by `selection`. Fragment mode first computes Rg for each disconnected topological fragment, then reduces those per-fragment values to one per-frame value. Use fragment mode when your selection includes many independent molecules and you care about the average fragment size rather than the size of the entire multi-molecule cloud. ### Fragment mode configuration ```yaml plugins: rg: runs: - label: protein_rg selection: protein - label: polymer_blob_rg selection: "resname SBM or resname EGM or resname EGP" calculation_mode: fragments fragment_weighting: equal ``` | Setting | Meaning | |---------|---------| | `calculation_mode: "selection"` | Whole-group Rg | | `calculation_mode: "fragments"` | Per-fragment Rg with reduction | | `fragment_weighting: "equal"` | Arithmetic mean over fragments | | `fragment_weighting: "mass"` | Mass-weighted mean over fragments | ### How fragment mode reduction works 1. Identify disconnected fragments within the selected atom group 2. Compute fragment-level Rg for each frame 3. Reduce fragment values to one per-frame value using equal or mass weighting 4. Use the reduced timeseries for summary statistics and comparisons 5. Optionally save pooled fragment values in NPZ sidecars for distribution plots ## Why Rg Has No Alignment or Reference Fields Rg is based on mass-weighted distances from the center of mass, so it is translation and rotation invariant. Because of that, Rg runs do not use RMSD-style fields such as `alignment_selection`, `reference_mode`, `reference_file`, or `reference_frame`. ## Output Files Results are saved in your project analysis directory: ```text / └── analysis/ └── rg/ ├── run_1/ │ ├── rg_eq10ns.json │ ├── rg_Whole Protein_timeseries.npz │ └── rg_Protein Backbone_timeseries.npz ├── run_2/ │ ├── rg_eq10ns.json │ ├── rg_Whole Protein_timeseries.npz │ └── rg_Protein Backbone_timeseries.npz ├── run_3/ │ └── ... └── aggregated/ └── rg_reps1-3_eq10ns.json ``` Each replicate directory contains: - JSON summary result for all configured runs - NPZ sidecars with per-frame timeseries data (one per run) ### NPZ sidecar arrays Each `rg_