#!/usr/bin/perl
# 
# Add Tropp correction to methyls.
# From Georges, 050799
# Most thorough accounting of methyl NOE intensity corrections
# Follows Wuthrich rules
# Better than addtropp or addtropp5, which just add 0.5 angstrom

while(<>)
{
   print if(/^#/);
   next if(/^#/);

#   2 ALA MB      7 GLN HN    6.0 # met_cnstr_vols.intra2:12

   chop;
   ($resNum1, $resName1, $atomName1,
    $resNum2, $resName2, $atomName2,
    $distance, $garb, $comment) = split(' ');

   if(($atomName1 =~ /^QB/) or ($atomName1=~ /^QG/))
   { $distance += 1.0; $comment .= " -T"; }
   if(($atomName2 =~ /^QB/) or ($atomName2=~ /^QG/))
   { $distance += 1.0; $comment .= " -T"; }
   if(($atomName1 =~ /^QD/) or ($atomName1=~ /^QE/))
   { $distance += 1.0; $comment .= " -T"; }
   if(($atomName2 =~ /^QD/) or ($atomName2=~ /^QE/))
   { $distance += 1.0; $comment .= " -T"; }
   if(($atomName1 =~ /^CG/) or ($atomName1=~ /^CZ/))
   { $distance += 2.0; $comment .= " -T"; }
   if(($atomName2 =~ /^CG/) or ($atomName2=~ /^CZ/))
   { $distance += 2.0; $comment .= " -T"; }
   if(($atomName1 =~ /^QQG/) or ($atomName1=~ /^QQD/))
   { $distance += 2.4; $comment .= " -T"; }
   if(($atomName2 =~ /^QQG/) or ($atomName2=~ /^QQD/))
   { $distance += 2.4; $comment .= " -T"; }

   printf("%3d %-5s%-5s%4d %-5s%-5s%7.2f \n",
      $resNum1, $resName1, $atomName1,
      $resNum2, $resName2, $atomName2,
      $distance);
}

