#!/usr/bin/perl # # Converting Turbomole basis sets into the Molpro format # # (c) 2006 Robin Haunschild # # Lizenz: GNU/GPLV2 # if (! $ARGV[0]) { print "Error: No basis file was given.\n"; print "For help use -h\n"; exit 1; } if ($ARGV[0] eq "-h" || $ARGV[0] eq "-H") { print "Help:\n\n"; $PRGNAME = `basename $0`; chomp($PRGNAME); print "$PRGNAME can convert Turbomole basis set files into the Molpro basis set format. \n"; print "BUT, the effective core potentials (ECPs) are NOT converted. \nPlease choose the appropreate "; print "buildin ECP in Molpro.\n"; print "Call this program with the name of the Turbomole basis set file as the first command line argument.\n"; print "I can not stress that, too much. ;)\n\n"; print "Example of Turbomole basis set file:\n\n"; print ",-------------------------------------------\n"; print "\$basis \n"; print "* \n"; print "h def2-TZVPP \n"; print "# h (5s2p1d) / [3s2p1d] {311/11/1}\n"; print "* \n"; print " 3 s \n"; print " 34.061341000 0.60251978000E-02 \n"; print " 5.1235746000 0.45021094000E-01 \n"; print " 1.1646626000 0.20189726000 \n"; print " 1 s \n"; print " 0.32723041000 1.0000000000 \n"; print " 1 s \n"; print " 0.10307241000 1.0000000000 \n"; print " 1 p \n"; print " 1.4070000000 1.0000000000 \n"; print " 1 p \n"; print " 0.38800000000 1.0000000000 \n"; print " 1 d \n"; print " 1.0570000000 1.0000000000 \n"; print "* \n"; print "\$end \n"; print "`-------------------------------------------\n"; exit 0; } open INFILE, "$ARGV[0]" || die "Can't open file $ARGV[0]!!! EOP - End Of Program!!!\n"; # # Read basis file in array @basis $i = 0; while ($basis[$i] = ) { $i++; } $max_elements = $i; ($atom, $basisname) = split(/ /, $basis[2]); print "!\n"; print "! $basis[2]"; print "! $basis[3]"; print "! Generated by TMbasis2molprobasis.pl \n"; print "!\n"; # # loop over whole basis file for($i=5; $i<=$max_elements; $i++) { ($anz, $quant) = split(" ", $basis[$i]); # # Is the end of one basis set reached? if ($anz =~ /[a-zA-Z]/ || $quant =~ /[a-zA-Z]{2,}/) { print "!\n"; ($atom, $basisname) = split(/ /, $basis[$i]); print "! $basis[$i]"; $i +=3; ($anz, $quant) = split(" ", $basis[$i]); print "! Generated by TMbasis2molprobasis.pl \n"; print "!\n"; } $j = 0; # # loop over contractions while ($j <= $anz) { $i++; ($exp, $coeff) = split(" ", $basis[$i]); if ($j < $anz) { $exps = $exps.",".$exp; $coeffs = $coeffs.",".$coeff; } else { $exps = $exps.";"; $coeffs = $coeffs.";"; } $j++; } $i--; # # print out the basis functions if ($quant) { # # After the beginning of every new atom a errornous ";" occours, remove it! if ($exps =~ /^;,/) { $exps =~ s/^;,/,/; $coeffs =~ s/^;,/,/; } if ($basis[$i+2] =~ /ecp/) { exit 0; } print "$quant,$atom$exps\n"; print "c,1.$anz$coeffs\n"; $exps = ""; $coeffs = ""; } } print "!\n"; # # Finished! ;)