#!/usr/bin/perl
use File::Copy;
$count = 0;
$stepconst = 1550; #first step
$gap = 8; #gap between steps
$numberofsteps = 12; #number of steps
$switch = 0;
$switch2 = 1;
$level = "ground";
$extra = "";
open my $runout, '>', $newfile = "run-nohup" or die "Can't write new file: $!";
print $runout "\#\!/bin/bash
PP=/home/nd/pp
";
while ($switch <= $switch2) {
$step = $stepconst;
while ($count < $numberofsteps) {
$rand = $count * $gap;
$filenumber = $step + $rand;
print $runout "rm GEO*
rm DENSITY*
rm RESTART*
rm LATEST*
rm WAVEFUNCTION*
nohup cpmd_serial.x sa-$level-$filenumber.in \$\PP > sa-$level-$filenumber.out
";
$count ++;
}
$count = 0;
# RUN A WHILE LOOP
while ($count < $numberofsteps) {
$filenumber = $step;
$stepnumber = ($filenumber*18)+3;
$trial = $stepnumber+1;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
open my $out, '>', $newfile = "sa-$level-$step.in" or die "Can't write new file: $!";
print $out "&CPMD
OPTIMIZE WAVEFUNCTION
PCG
CONVERGENCE ORBITAL
1.D-6
RHOOUT BANDS
2
-26
-27
MAXSTEP
10000
STORE
100
&END
&DFT
FUNCTIONAL BLYP
GC-CUTOFF
0.1E-06
&END
&SYSTEM
ANGSTROM
POISSON TUCKERMAN
SYMMETRY
8
CELL ABSOLUTE DEGREES
13. 13 13 90 90 90
CUTOFF
70.0$extra
&END
&ATOMS
*C_MT_BLYP KLEINMAN-BYLANDER
LMAX=P
7
";
while( <$in> )
{
next unless $. eq $stepnumber;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial ++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial ++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial ++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial ++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial ++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
print $out "
*O_MT_BLYP KLEINMAN-BYLANDER
LMAX=P
3
";
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
print $out "
*H_MT_BLYP
LMAX=S
6
";
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
open my $in, '<', $file = "TRAJEC.xyz" or die "Can't read old file: $!";
while( <$in> )
{
next unless $. eq $trial;
s/\b(C)\b//g;
s/\b(O)\b//g;
s/\b(H)\b//g;
print $out $_;
}
$trial++;
print $out "
&END";
close $out;
$step = $step + $gap;
$count ++;
}
$level = "excited";
$extra = "
LOW SPIN EXCITATION ROKS";
$switch ++;
$count = 0;
}
print $runout "
exit
";
close $runout;