scattering-analysis - SAXS/SANS/Experiment Comparison Analysis

USAGE:
  scattering-analysis -s md.tpr -f md.xtc [OPTIONS]
  scattering-analysis --curve simulated.dat --exp experiment.dat [OPTIONS]

MODES:
  saxs       - Calculate SAXS with gmx saxs
  sans       - Calculate SANS with gmx sans (or organize existing data)
  compare    - Compare simulated and experimental curves
  interpret  - Basic Guinier/Kratky interpretation from one curve
  report     - Generate report from existing outputs
  all        - Run calculation + comparison + interpretation + report

INPUT OPTIONS:
  -s FILE              TPR/structure file for GROMACS calculation
  -f FILE              Trajectory file for GROMACS calculation
  -n FILE              Index file (optional)
  -o DIR               Output directory (default: scattering-analysis)
  --mode MODE          Mode: saxs/sans/compare/interpret/report/all (default: all)
  --group NAME         Selection group (default: System)
  --curve FILE         Simulated scattering curve (2-4 columns: q I [err] [Iq2])
  --exp FILE           Experimental curve (2-3 columns: q I [err])
  --sans FILE          Existing SANS/scattering curve to organize
  --qmin VALUE         q minimum (1/nm, default: auto)
  --qmax VALUE         q maximum (1/nm, default: auto)
  --qpoints N          Number of q points for generated grid (default: 200)
  --contrast VALUE     Contrast factor for SANS notes/report (default: auto)
  --buffer-density V   Buffer density hint for preparation notes (default: auto)
  --skip N             Skip frames (default: 1)
  -b TIME              Begin time in ps
  -e TIME              End time in ps
  --label TEXT         Dataset label (default: auto)
  -h, --help           Show this help

EXAMPLES:
  # SAXS from MD and compare with experiment
  scattering-analysis -s md.tpr -f md.xtc --exp exp_saxs.dat --mode all

  # Only compare existing simulated vs experimental curves
  scattering-analysis --curve calc_saxs.xvg --exp exp_saxs.dat --mode compare

  # Organize SANS result and produce interpretation/report
  scattering-analysis --sans sans_curve.dat --exp exp_sans.dat --mode all

  # Interpret an existing curve without GROMACS calculation
  scattering-analysis --curve calc_saxs.xvg --mode interpret

OUTPUT:
  curves/                      Cleaned and normalized curve files
  compare/curve_comparison.tsv Interpolated simulated/experimental comparison
  compare/deviation_summary.txt Fit error summary
  interpret/guinier_summary.txt Guinier region estimate
  interpret/kratky_summary.txt  Kratky peak/tail description
  figures/scattering_plot.png   Plot when python3+matplotlib is available
  export/scattering_export.tsv  Publication/automd-viz friendly export
  export/scattering_export.json Machine-readable summary
  SCATTERING_REPORT.md          Markdown report

EXPERIMENT NOTES:
  - SAXS useful q range: 0.1-3.0 1/nm for global shape, 1-10 1/nm for finer features.
  - Guinier region should satisfy q*Rg < 1.3 for compact systems.
  - Dimensionless Kratky peak near sqrt(3), 3 indicates folded globular behavior.
  - For SANS, contrast matching and H/D composition dominate interpretability.
