#!@PYTHON@ # # crudely converts an espack config file to a mpqc config file import sys, string, re, math wrerr = sys.stderr.write config = open(sys.argv[1]+".conf", "r") input = open(sys.argv[1]+".in", "w") BASIS = "STO-3G" # parse in atom coordinates & element symbols n=0 atompos = [] elements = [] sys.stdout.write("Elemente: ") for line in config: if re.compile("Ion_Type[0-9]+[^_]+").match(line): words = line.split("Type") words2 = (words[0]+"Type_"+words[1]).split() sys.stdout.write(words2[8]+" ") elements.append(words2[8]) if re.compile("Ion_Type[0-9]+[_]+").match(line): words = line.split() iontype = words[0].split("_") print words atompos.append(iontype[1].lstrip("Type")+"_"+words[1]+"_"+words[2]+"_"+words[3]) n=n+1 sys.stdout.write("\n") print "I found ",n," atoms." # general stuff print >>input,"% espack2mpqc.sh" print >>input,"mpqc: (" print >>input,"\tsavestate = no" print >>input,"\tdo_gradient = yes" print >>input,"\tmole: (" print >>input,"\t\tmolecule: (" print >>input,"\t\t\tunit = angstrom" print >>input,"\t\t\t{ atoms geometry } = {" for i in range(n): atome = atompos[i].split("_") print >>input,"\t\t\t\t%s\t%s\t%s\t%s" % (elements[int(atome[0])-1], atome[1], atome[2], atome[3]) print >>input,"\t\t\t}" print >>input,"\t\t)" print >>input,"\t\tbasis: (" print >>input,"\t\t\tname = \"%s\"" % (BASIS) print >>input,"\t\t\tmolecule = $:mpqc:mole:molecule" print >>input,"\t\t)" print >>input,"\t)" print >>input,")"