YARM Samples

Find all angles between proton spin pairs (< 6 angs apart) WRT the principal axis of rotation.

#!/usr/local/bin/perl
require "/usr/local/yarm/yarm_lib.pl";

################################################
# Define variables
################################################
$pdb_file = "dick_xtal.pdb";

# Set to 0 for no debugging messages
# Set to 1 for a few debugging messages
# set to 2 for TONS of debugging messages (lots!)
$debug = 0; 

#############################################
# Call YARM subroutines
#############################################
print "$yarm_version\n";

# Get non-exchangeable nucleic acid protons from a PDB file
%xyz = &Pdb_Read_All( $pdb_file );
%xyz = &Get_Atom_Type( \%xyz, \%nonX_NA );
%xyz = &Pseudo_Methyl( \%xyz );

# Calculate principal axis
( $Ax, $Ay, $Az ) = &Principal_Axis( \%xyz );
print "Principal axis vector $Ax $Ay $Az\n";

# Measure distances of all atom pairs between 
# 0 to 6 angstroms
%rij  = &Rij_Hash( \%xyz, 0, 6 );

# Measure angles of all atom pairs found in %rij 
# WRT principal axis
%beta = &Beta_Hash( $Ax, $Ay, $Az, \%xyz, \%rij );

################################################
# Print a nice report
################################################

# Use %rij to make atoms_i list
@atoms_i = sort keys %rij;

print "ATOM_I           ATOM_J            RIJ   ANGLE\n";
foreach $atom_i ( @atoms_i ) {
        # Use %rij to make atoms_j list
    @atoms_j = sort keys %{ $rij{$atom_i} };

    foreach $atom_j ( @atoms_j ) {

                # Set values from the hashes
        $rij = $rij{$atom_i}{$atom_j};
        $beta = $beta{$atom_i}{$atom_j};
        printf ("%-16s %-16s %5.2f  %5.2f\n", $atom_i, $atom_j, $rij, $beta);

    }

}