source: bin/getnwbas.pl@ 7ed4e8

Last change on this file since 7ed4e8 was 5d30c1, checked in by Frederik Heber <heber@…>, 13 years ago

Initial commit based on 3.0.0alpha (here claimed as 2.4).

  • simply added all files.
  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/usr/bin/perl
2
3# This script uses lwp-request from the libwww-perl package.
4# The -o text option to lwp-request requires the HTML-Tree package
5# and the HTML-Format package.
6
7require 5.002;
8
9$url = "http://www.emsl.pnl.gov/cgi-bin/ecce/basis_old.pl";
10#$url = "http://localhost/cgi-bin/echo";
11
12$SIG{'INT'} = 'dokill';
13
14sub dokill {
15 kill 9, $child if $child;
16}
17
18if ($#ARGV != 1) {
19 printf "need two arguments: email_address and basis_name\n";
20 exit;
21}
22
23$email = $ARGV[0];
24
25$basis = $ARGV[1];
26
27$basisreq = $basis;
28$basisreq =~ s/\+/%2B/g;
29$basisreq =~ s/\(/\%28/g;
30$basisreq =~ s/\)/\%29/g;
31$basisreq =~ s/,/\%2C/g;
32
33$atoms = "H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr";
34$atoms =~ s/ /+/g;
35
36$email =~ s/@/%40/;
37
38open(HOSTNAME,"hostname|");
39$hostname = <HOSTNAME>;
40close(HOSTNAME);
41$hostname =~ s/\n//;
42
43$data = sprintf "BasisSets=%s&Atoms=$atoms&Codes=NWChem&Optimize=on&ECP=on&Email=%s", $basisreq, $email;
44
45$basisname = $basis;
46$basisname =~ tr/A-Z/a-z/;
47$basisname =~ tr/+/P/;
48$basisname =~ tr/\*/S/;
49$basisname =~ tr/\(/L/;
50$basisname =~ tr/\)/R/;
51$basisname =~ tr/,/_/;
52$basisname =~ tr/ /_/;
53$basisfile = "$basisname.nw";
54
55printf "Basis will be put in %s.nw ...", $basisname;
56
57open(HTTPD,"|lwp-request -m post -o text $url > $basisfile");
58print HTTPD "$data";
59close HTTPD;
60
61printf " done.\n";
Note: See TracBrowser for help on using the repository browser.