Share Pastebin
Guest
Public paste!

energy-surface

By: a guest | Mar 20th, 2010 | Syntax: Perl | Size: 4.95 KB | Hits: 37 | Expires: Never
Copy text to clipboard
  1. #!/usr/bin/perl
  2. use File::Copy;
  3.  
  4. $count = 0;
  5.  
  6. $stepconst = 1550; #first step
  7. $gap = 8; #gap between steps
  8. $numberofsteps = 12; #number of steps
  9.  
  10. $switch = 0;
  11. $switch2 = 1;
  12. $level = "ground";
  13. $extra = "";
  14.  
  15. open my $runout, '>', $newfile = "run-nohup" or die "Can't write new file: $!";
  16.  
  17. print $runout "\#\!/bin/bash
  18.  
  19. PP=/home/nd/pp
  20.  
  21. ";
  22.  
  23. while ($switch <= $switch2) {
  24.  
  25. $step = $stepconst;
  26.  
  27.         while ($count < $numberofsteps) {
  28.  
  29.         $rand = $count * $gap;
  30.         $filenumber = $step + $rand;
  31.  
  32.         print $runout "rm GEO*
  33. rm DENSITY*
  34. rm RESTART*
  35. rm LATEST*
  36. rm WAVEFUNCTION*
  37. nohup cpmd_serial.x sa-$level-$filenumber.in \$\PP > sa-$level-$filenumber.out
  38. ";
  39.         $count ++;
  40.         }
  41.  
  42.         $count = 0;
  43.  
  44.         # RUN A WHILE LOOP
  45.         while ($count < $numberofsteps) {
  46.        
  47.                 $filenumber = $step;
  48.  
  49.                 $stepnumber = ($filenumber*18)+3;
  50.                 $trial = $stepnumber+1;
  51.  
  52.  
  53.                 open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  54.                 open my $out, '>', $newfile = "sa-$level-$step.in" or die "Can't write new file: $!";
  55.  
  56.                 print $out "&CPMD
  57. OPTIMIZE WAVEFUNCTION
  58. PCG
  59. CONVERGENCE ORBITAL
  60. 1.D-6
  61. RHOOUT BANDS
  62.  2
  63.  -26
  64.  -27
  65.  MAXSTEP
  66.  10000
  67.  STORE
  68.  100
  69. &END
  70.  
  71. &DFT
  72.  FUNCTIONAL BLYP
  73.  GC-CUTOFF
  74.  0.1E-06
  75. &END
  76.  
  77. &SYSTEM
  78.  ANGSTROM
  79.  POISSON TUCKERMAN
  80.  SYMMETRY
  81.  8
  82.  CELL ABSOLUTE DEGREES
  83.  13. 13 13  90  90  90
  84.  CUTOFF
  85.  70.0$extra
  86. &END
  87.  
  88. &ATOMS
  89.  
  90. *C_MT_BLYP  KLEINMAN-BYLANDER
  91.   LMAX=P
  92.   7
  93. ";     
  94.  
  95.                 while( <$in> )
  96.                 {
  97.                 next unless $. eq $stepnumber;
  98.                 s/\b(C)\b//g;
  99.                 s/\b(O)\b//g;
  100.                 s/\b(H)\b//g;
  101.                 print $out $_;
  102.                 }
  103.  
  104.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  105.  
  106.         while( <$in> )
  107.         {
  108.         next unless $. eq $trial;
  109.         s/\b(C)\b//g;
  110.         s/\b(O)\b//g;
  111.         s/\b(H)\b//g;
  112.         print $out $_;
  113.         }
  114.  
  115.         $trial ++;
  116.  
  117.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  118.  
  119.         while( <$in> )
  120.         {
  121.         next unless $. eq $trial;
  122.         s/\b(C)\b//g;
  123.         s/\b(O)\b//g;
  124.         s/\b(H)\b//g;
  125.         print $out $_;
  126.         }
  127.  
  128.         $trial ++;
  129.  
  130.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  131.  
  132.         while( <$in> )
  133.         {
  134.         next unless $. eq $trial;
  135.         s/\b(C)\b//g;
  136.         s/\b(O)\b//g;
  137.         s/\b(H)\b//g;
  138.         print $out $_;
  139.         }
  140.         $trial ++;
  141.  
  142.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  143.  
  144.         while( <$in> )
  145.         {
  146.         next unless $. eq $trial;
  147.         s/\b(C)\b//g;
  148.         s/\b(O)\b//g;
  149.         s/\b(H)\b//g;
  150.         print $out $_;
  151.         }
  152.         $trial ++;
  153.  
  154.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  155.  
  156.         while( <$in> )
  157.         {
  158.         next unless $. eq $trial;
  159.         s/\b(C)\b//g;
  160.         s/\b(O)\b//g;
  161.         s/\b(H)\b//g;
  162.         print $out $_;
  163.         }
  164.         $trial ++;
  165.  
  166.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  167.  
  168.         while( <$in> )
  169.         {
  170.         next unless $. eq $trial;
  171.         s/\b(C)\b//g;
  172.         s/\b(O)\b//g;
  173.         s/\b(H)\b//g;
  174.         print $out $_;
  175.         }
  176.         $trial++;
  177.  
  178.         print $out "
  179. *O_MT_BLYP  KLEINMAN-BYLANDER
  180.   LMAX=P
  181.   3
  182. ";
  183.  
  184.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  185.  
  186.         while( <$in> )
  187.         {
  188.         next unless $. eq $trial;
  189.         s/\b(C)\b//g;
  190.         s/\b(O)\b//g;
  191.         s/\b(H)\b//g;
  192.         print $out $_;
  193.         }
  194.         $trial++;
  195.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  196.  
  197.         while( <$in> )
  198.         {
  199.         next unless $. eq $trial;
  200.         s/\b(C)\b//g;
  201.         s/\b(O)\b//g;
  202.         s/\b(H)\b//g;
  203.         print $out $_;
  204.         }
  205.         $trial++;
  206.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  207.  
  208.         while( <$in> )
  209.         {
  210.         next unless $. eq $trial;
  211.         s/\b(C)\b//g;
  212.         s/\b(O)\b//g;
  213.         s/\b(H)\b//g;
  214.         print $out $_;
  215.         }
  216.         $trial++;
  217.  
  218.         print $out "
  219. *H_MT_BLYP
  220.   LMAX=S
  221.   6
  222. ";
  223.  
  224.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  225.  
  226.         while( <$in> )
  227.         {
  228.         next unless $. eq $trial;
  229.         s/\b(C)\b//g;
  230.         s/\b(O)\b//g;
  231.         s/\b(H)\b//g;
  232.         print $out $_;
  233.         }
  234.         $trial++;
  235.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  236.  
  237.         while( <$in> )
  238.         {
  239.         next unless $. eq $trial;
  240.         s/\b(C)\b//g;
  241.         s/\b(O)\b//g;
  242.         s/\b(H)\b//g;
  243.         print $out $_;
  244.         }
  245.         $trial++;
  246.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  247.  
  248.         while( <$in> )
  249.         {
  250.         next unless $. eq $trial;
  251.         s/\b(C)\b//g;
  252.         s/\b(O)\b//g;
  253.         s/\b(H)\b//g;
  254.         print $out $_;
  255.         }
  256.         $trial++;
  257.  
  258.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  259.  
  260.         while( <$in> )
  261.         {
  262.         next unless $. eq $trial;
  263.         s/\b(C)\b//g;
  264.         s/\b(O)\b//g;
  265.         s/\b(H)\b//g;
  266.         print $out $_;
  267.         }
  268.         $trial++;
  269.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  270.  
  271.         while( <$in> )
  272.         {
  273.         next unless $. eq $trial;
  274.         s/\b(C)\b//g;
  275.         s/\b(O)\b//g;
  276.         s/\b(H)\b//g;
  277.         print $out $_;
  278.         }
  279.         $trial++;
  280.         open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
  281.  
  282.         while( <$in> )
  283.         {
  284.         next unless $. eq $trial;
  285.         s/\b(C)\b//g;
  286.         s/\b(O)\b//g;
  287.         s/\b(H)\b//g;
  288.         print $out $_;
  289.         }
  290.         $trial++;
  291.  
  292.         print $out "
  293. &END";
  294.  
  295.  
  296.        
  297.  
  298. close $out;
  299.  
  300. $step = $step + $gap;  
  301. $count ++;
  302.         }
  303.  
  304. $level = "excited";
  305. $extra = "
  306. LOW SPIN EXCITATION ROKS";
  307. $switch ++;
  308. $count = 0;
  309. }
  310.  
  311.         print $runout "
  312. exit
  313.  
  314.  
  315. ";
  316.  
  317.         close $runout;