source: util/src/convertPCP2MPQC.py.in@ 7b991d

Last change on this file since 7b991d was e1a46d, checked in by Frederik Heber <heber@…>, 16 years ago

All of my python script put into ESPACK and adapted with @PYTHON@ and so on.

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!@PYTHON@
2#
3# crudely converts an espack config file to a mpqc config file
4
5import sys, string, re, math
6wrerr = sys.stderr.write
7
8config = open(sys.argv[1]+".conf", "r")
9input = open(sys.argv[1]+".in", "w")
10
11
12BASIS = "STO-3G"
13
14# parse in atom coordinates & element symbols
15n=0
16atompos = []
17elements = []
18sys.stdout.write("Elemente: ")
19for line in config:
20 if re.compile("Ion_Type[0-9]+[^_]+").match(line):
21 words = line.split("Type")
22 words2 = (words[0]+"Type_"+words[1]).split()
23 sys.stdout.write(words2[8]+" ")
24 elements.append(words2[8])
25 if re.compile("Ion_Type[0-9]+[_]+").match(line):
26 words = line.split()
27 iontype = words[0].split("_")
28 print words
29 atompos.append(iontype[1].lstrip("Type")+"_"+words[1]+"_"+words[2]+"_"+words[3])
30 n=n+1
31sys.stdout.write("\n")
32print "I found ",n," atoms."
33
34# general stuff
35print >>input,"% espack2mpqc.sh"
36print >>input,"mpqc: ("
37print >>input,"\tsavestate = no"
38print >>input,"\tdo_gradient = yes"
39print >>input,"\tmole<CLHF>: ("
40print >>input,"\t\tmolecule<Molecule>: ("
41print >>input,"\t\t\tunit = angstrom"
42print >>input,"\t\t\t{ atoms geometry } = {"
43for i in range(n):
44 atome = atompos[i].split("_")
45 print >>input,"\t\t\t\t%s\t%s\t%s\t%s" % (elements[int(atome[0])-1], atome[1], atome[2], atome[3])
46print >>input,"\t\t\t}"
47print >>input,"\t\t)"
48print >>input,"\t\tbasis<GaussianBasisSet>: ("
49print >>input,"\t\t\tname = \"%s\"" % (BASIS)
50print >>input,"\t\t\tmolecule = $:mpqc:mole:molecule"
51print >>input,"\t\t)"
52print >>input,"\t)"
53print >>input,")"
Note: See TracBrowser for help on using the repository browser.