Track Distance Between Groups - k-ngo/CATMD GitHub Wiki

Track Distance Between Groups

Overview and Methodology

What It Does

This script calculates the distance between two groups of atoms, either their centers of mass or their closest atoms—across a molecular dynamics simulation. It supports one required pair and one optional comparison pair.

How It Works

  • Objective: Monitor spatial proximity or separation between selected groups over time.
  • Process:
    • Selection: Define atom groups using flexible selection syntax.
    • Distance Metric: Choose either center-of-mass distance or the minimum interatomic distance.
    • Computation: Calculates distances frame-by-frame for each pair.
    • Visualization: Produces a time series plot with optional rolling average smoothing.

Configuration and Inputs

Prerequisites

  • Requires a loaded trajectory.

Key Configuration Options

  • Selections:

    • group1_sel, group2_sel, group1_name, group2_name: Required pair (e.g., 'segid VSD' and 'segid TOX').
    • group3_sel, group4_sel, group3_name, group4_name: Optional second pair for comparison.
  • Distance Type:

    • Center of Mass: Geometric center-to-center distance.
    • Minimum Distance: Shortest atom–atom distance between two groups.
  • Rolling Average:

    • plot_rolling_average: Option to overlay smoothed trends.
    • rolling_window: Controls the smoothing window size.

Output

  • Distance Plot:
    figures/Distance.png
    Line plot of distance vs. simulation time for one or two group pairs. Colors and labels distinguish the pairs.

  • Legend:
    Shows each group pair with their labels.

  • Console Output:

    • Summary of group selections.
    • Confirmation of plot generation and file location.

Interpreting the Results

  • Consistently Low Distance:

    • Indicates persistent interaction, contact, or binding (e.g., ligand bound to pocket).
  • Sudden Increase in Distance:

    • Suggests dissociation or conformational shift (e.g., unbinding, domain separation).
  • Oscillating Distance Pattern:

    • Reflects dynamic interactions (e.g., flexible linker region or weak binding).
  • Comparison of Two Pairs:

    • Helps distinguish local vs. global movement or multiple contact points.

Example Scenarios

Ligand Binding Stability

  • Scenario: Analyze a toxin's interaction with a binding site.
  • Observation: Distance stays ~3–5 Å throughout.
  • Interpretation: Ligand remains bound.

Domain Opening

  • Scenario: Track distance between two helices.
  • Observation: Distance increases from ~10 Å to ~25 Å after 100 ns.
  • Interpretation: Domain separation or unfolding event.

Contact Shift

  • Scenario: Compare distance from toxin to two different residues.
  • Observation: One contact shortens while the other extends.
  • Interpretation: Binding site shift or rotation.

Usage Tips

  • COM vs. Min Distance:

    • Use Center of Mass for large groups, Minimum Distance for detecting contact loss.
  • Second Pair:

    • Optional but useful for internal controls or contact competition.
  • Smoothing:

    • Enables clearer trend visualization, especially in noisy signals.