Plot Radius of Gyration (Rg) - k-ngo/CATMD GitHub Wiki
Plot Radius of Gyration (Rg)
Overview and Methodology
What It Does
This script calculates the Radius of Gyration (Rg) over time for up to four atom groups in a molecular dynamics simulation. The Rg describes how spatially extended a group of atoms is with respect to its center of mass or geometry, a key indicator of compaction or unfolding.
How It Works
- Objective: Quantify and compare how "spread out" different selections are over the simulation.
- Process:
- Centering: Calculates the center of mass (or geometry).
- Rg Calculation: Computes the average distance of atoms from this center — mass-weighted if selected.
- Multi-Group Support: Allows simultaneous analysis of up to four groups.
- Visualization: Plots Rg vs. time for all selections, with optional smoothing.
Configuration and Inputs
Prerequisites
- Requires a loaded trajectory.
- Atom groups should be well-defined and stable throughout the simulation.
Key Configuration Options
-
Selections:
group1_sel
–group4_sel
: Up to four atomic groups.group1_name
–group4_name
: Labels for the plotted curves.
-
Rg Method:
mass_weighted=True
: Uses atomic mass for center and distance calculation.mass_weighted=False
: Uses geometric (equal-weighted) center and distance.num_bins
: Number of bins for Rg histogram.
-
Rolling Average:
plot_rolling_average=True
: Adds smoothed curves using a moving average (rolling_window
size).
-
Plot Settings:
- Fully customizable figure size, labels, fonts, and color palettes.
Output
-
Rg Line Plot:
figures/*_Rg.png
— Shows Rg vs. time for each defined group. Each line reflects structural compactness or unfolding trends. -
Rg Distribution Histogram:
figures/*_Rg_histogram.png
— Shows Rg distribution over the course of the entire simulation. -
Console Output:
- Confirmation of defined selections.
- Frame count and simulation time range.
- Save path for the final plot image.
Interpreting the Results
-
Stable Rg:
- Indicates structural integrity or a well-packed region.
- Common for rigid domains or folded proteins.
-
Increasing Rg:
- Suggests unfolding, expansion, or dissociation.
- Typical for denaturation or ligand unbinding studies.
-
Decreasing Rg:
- Indicates compaction or aggregation.
- May reflect folding events or collapsing disordered segments.
-
Synchronized Rg Changes:
- May highlight coordinated transitions between groups, such as domain–domain movements.
Example Scenarios
Folding Kinetics
- Scenario: Simulate a peptide starting from an extended state.
- Observation: Gradual decrease in Rg.
- Interpretation: Folding or collapse into a compact structure.
Ligand-Induced Expansion
- Scenario: A ligand binds and induces expansion of a flexible domain.
- Observation: Rg of that domain increases sharply after ligand contact.
- Interpretation: Ligand perturbs domain structure or solvation dynamics.
Complex Stability
- Scenario: Compare bound and unbound states of a protein–ligand system.
- Observation: Bound system shows reduced Rg fluctuation.
- Interpretation: Ligand stabilizes local or global structure.
Usage Tips
-
Selection Strategy:
- Use consistent residue ranges or segments across groups for fair comparison.
- Include
and protein
if needed to restrict selection to relevant atoms.
-
Mass Weighting:
- Use
mass_weighted=False
if you're comparing geometric shape/volume. - Use
True
for physical realism in protein systems.
- Use
-
Smoothing:
- Use a
rolling_window
of 5–10 for long or noisy trajectories to improve trend visibility.
- Use a