Advertisement
ProzacR

naujas_crd.pl

May 10th, 2017
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.96 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #
  3. # VR
  4.  
  5.  
  6. if (@ARGV != 1) {
  7.         print "usage\n";
  8. }
  9. #print $ARGV[0];
  10. open (PDB, $ARGV[0]) or die ("Could not open $ARGV[0].\n");
  11. open (INFO, 'hexanol_rec.crd') or die ("Could not open hexanol_rec.crd\n");
  12.  
  13. $count = 0;
  14. foreach $line (<INFO>)  {  
  15.         $atomnr=$line if ($count == 1);
  16.         if ($count > 1) {
  17.             push @pradzia, substr($line, 0, 21);
  18.             push @galas, substr($line, -22);
  19.             #print "$pradzia-53.2370  -19.9980  -27.4870$galas\n";
  20.         }
  21.         $count++;
  22. }
  23. close(INFO);
  24.  
  25.  
  26. foreach $pdbline (<PDB>) {
  27.         if ($pdbline =~ /AT/) {
  28.         push @x, substr($pdbline, 30, 8);
  29.         push @y, substr($pdbline, 38, 8);
  30.         push @z, substr($pdbline, 46, 8);
  31. }
  32. }
  33. close(PDB);
  34.  
  35. print "*\n$atomnr";
  36. $linenr = 0;
  37. while ($linenr != $atomnr) {
  38.         print "$pradzia[$linenr]$x[$linenr]0";
  39.         print " $y[$linenr]0";
  40.         print " $z[$linenr]0$galas[$linenr]";
  41.         $linenr++;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement