mirror of
https://gitlab.com/scemama/resultsFile.git
synced 2025-01-03 01:55:53 +01:00
Python3
This commit is contained in:
parent
b502a622cc
commit
53b075a839
@ -41,9 +41,9 @@ if "q5CostFile" in all:
|
|||||||
|
|
||||||
for mod in all:
|
for mod in all:
|
||||||
try:
|
try:
|
||||||
exec 'from '+mod+' import *'
|
exec('from '+mod+' import *')
|
||||||
except:
|
except:
|
||||||
print "Error importing module", mod
|
print("Error importing module", mod)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import include
|
from . import include
|
||||||
eval(include.code)
|
eval(include.code)
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -54,13 +54,13 @@ class gamessFile(resultsFile):
|
|||||||
local_vars = list(local_vars)
|
local_vars = list(local_vars)
|
||||||
defined_vars = list(gamessFile_defined_vars)
|
defined_vars = list(gamessFile_defined_vars)
|
||||||
|
|
||||||
exec get_data('date',"EXECUTION OF GAMESS BEGUN",'4:') in locals()
|
exec(get_data('date',"EXECUTION OF GAMESS BEGUN",'4:'), locals())
|
||||||
exec get_data('machine',"Files used on the master node",'6:7') in locals()
|
exec(get_data('machine',"Files used on the master node",'6:7'), locals())
|
||||||
exec get_data('version',"GAMESS VERSION",'4:8') in locals()
|
exec(get_data('version',"GAMESS VERSION",'4:8'), locals())
|
||||||
exec get_data('num_proc',"MEMDDI DISTRIBUTED OVER",'3:4',"int") in locals()
|
exec(get_data('num_proc',"MEMDDI DISTRIBUTED OVER",'3:4',"int"), locals())
|
||||||
exec get_data('num_elec',"NUMBER OF ELECTRONS", '4:5',"int") in locals()
|
exec(get_data('num_elec',"NUMBER OF ELECTRONS", '4:5',"int"), locals())
|
||||||
exec get_data('charge',"CHARGE OF MOLECULE", '4:5',"float") in locals()
|
exec(get_data('charge',"CHARGE OF MOLECULE", '4:5',"float"), locals())
|
||||||
exec get_data('nuclear_energy',"THE NUCLEAR REPULSION ENERGY", '5:6',"float") in locals()
|
exec(get_data('nuclear_energy',"THE NUCLEAR REPULSION ENERGY", '5:6',"float"), locals())
|
||||||
|
|
||||||
def get_multiplicity(self):
|
def get_multiplicity(self):
|
||||||
if self._multiplicity is None:
|
if self._multiplicity is None:
|
||||||
@ -272,7 +272,7 @@ class gamessFile(resultsFile):
|
|||||||
tokens = line.split()[0::2]
|
tokens = line.split()[0::2]
|
||||||
values = line.split()[1::2]
|
values = line.split()[1::2]
|
||||||
if len(tokens) != len(values):
|
if len(tokens) != len(values):
|
||||||
print "error: ",line
|
print("error: ",line)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
@ -407,7 +407,7 @@ class gamessFile(resultsFile):
|
|||||||
buffer = self.text[pos].split()
|
buffer = self.text[pos].split()
|
||||||
label = buffer[1]
|
label = buffer[1]
|
||||||
assert label == i.name
|
assert label == i.name
|
||||||
f = map(float,buffer[2:])
|
f = list(map(float,buffer[2:]))
|
||||||
self._gradient_energy.append(f)
|
self._gradient_energy.append(f)
|
||||||
pos +=1
|
pos +=1
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -698,7 +698,7 @@ class gamessFile(resultsFile):
|
|||||||
"xxxxyz", "xyyyyz", "xyzzzz", "xxxyyy", "xxxzzz", \
|
"xxxxyz", "xyyyyz", "xyzzzz", "xxxyyy", "xxxzzz", \
|
||||||
"yyyzzz", "xxxyyz", "xxxyzz", "xxyyyz", "xyyyzz", \
|
"yyyzzz", "xxxyyz", "xxxyzz", "xxyyyz", "xyyyzz", \
|
||||||
"xxyzzz", "xyyzzz" ]
|
"xxyzzz", "xyyzzz" ]
|
||||||
map(normalize_basis_name,mylist)
|
list(map(normalize_basis_name,mylist))
|
||||||
for i in mylist[:-1]:
|
for i in mylist[:-1]:
|
||||||
basis[k][0] = i
|
basis[k][0] = i
|
||||||
basis.insert(k,list(basis[k]))
|
basis.insert(k,list(basis[k]))
|
||||||
@ -1451,17 +1451,17 @@ class gamessFile(resultsFile):
|
|||||||
|
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i not in defined_vars:
|
if i not in defined_vars:
|
||||||
exec build_get_funcs(i) in locals()
|
exec(build_get_funcs(i), locals())
|
||||||
exec build_property(i,j) in locals()
|
exec(build_property(i,j), locals())
|
||||||
del to_remove, i, j
|
del to_remove, i, j
|
||||||
|
|
||||||
atom_to_ao_range = property(fget=get_atom_to_ao_range)
|
atom_to_ao_range = property(fget=get_atom_to_ao_range)
|
||||||
|
|
||||||
for i in "two_e_int_mo_filename two_e_int_ao_filename".split():
|
for i in "two_e_int_mo_filename two_e_int_ao_filename".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
class two_e_int_array(object):
|
class two_e_int_array(object):
|
||||||
@ -1499,7 +1499,7 @@ def set_%(i)s(self,value): self._%(i)s = value
|
|||||||
Nint = rec.pop(0)
|
Nint = rec.pop(0)
|
||||||
while (index >= Nint):
|
while (index >= Nint):
|
||||||
index -= Nint
|
index -= Nint
|
||||||
rec = self._file.next()
|
rec = next(self._file)
|
||||||
Nint = rec.pop(0)
|
Nint = rec.pop(0)
|
||||||
|
|
||||||
rec_i = rec[:4*Nint]
|
rec_i = rec[:4*Nint]
|
||||||
@ -1524,29 +1524,29 @@ def set_%(i)s(self,value): self._%(i)s = value
|
|||||||
|
|
||||||
def gamess_write_contrl(res,file, runtyp="ENERGY",guess="HUCKEL",
|
def gamess_write_contrl(res,file, runtyp="ENERGY",guess="HUCKEL",
|
||||||
exetyp="RUN",scftyp=None,moread=False,NoSym=False,units="BOHR"):
|
exetyp="RUN",scftyp=None,moread=False,NoSym=False,units="BOHR"):
|
||||||
print >>file, " $CONTRL"
|
print(" $CONTRL", file=file)
|
||||||
print >>file, " EXETYP=",exetyp
|
print(" EXETYP=",exetyp, file=file)
|
||||||
print >>file, " COORD= UNIQUE", " UNITS=",units
|
print(" COORD= UNIQUE", " UNITS=",units, file=file)
|
||||||
print >>file, " RUNTYP=", runtyp
|
print(" RUNTYP=", runtyp, file=file)
|
||||||
if NoSym:
|
if NoSym:
|
||||||
print >>file, " NOSYM=1"
|
print(" NOSYM=1", file=file)
|
||||||
if scftyp is None:
|
if scftyp is None:
|
||||||
if res.num_alpha == res.num_beta:
|
if res.num_alpha == res.num_beta:
|
||||||
scftyp="RHF"
|
scftyp="RHF"
|
||||||
else:
|
else:
|
||||||
scftyp="ROHF"
|
scftyp="ROHF"
|
||||||
print >>file, " SCFTYP=", scftyp
|
print(" SCFTYP=", scftyp, file=file)
|
||||||
print >>file, " MULT=", res.multiplicity
|
print(" MULT=", res.multiplicity, file=file)
|
||||||
print >>file, " ICHARG=",str(int(res.charge))
|
print(" ICHARG=",str(int(res.charge)), file=file)
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, " $GUESS"
|
print(" $GUESS", file=file)
|
||||||
if moread:
|
if moread:
|
||||||
print >>file, " GUESS=MOREAD"
|
print(" GUESS=MOREAD", file=file)
|
||||||
print >>file, " NORB=",len(res.mo_sets[res.mo_types[-1]])
|
print(" NORB=",len(res.mo_sets[res.mo_types[-1]]), file=file)
|
||||||
else:
|
else:
|
||||||
print >>file, " GUESS=HUCKEL"
|
print(" GUESS=HUCKEL", file=file)
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
|
|
||||||
|
|
||||||
def gamess_write_vec(res, file):
|
def gamess_write_vec(res, file):
|
||||||
@ -1556,8 +1556,8 @@ def gamess_write_vec(res, file):
|
|||||||
# motypelist = [motype]
|
# motypelist = [motype]
|
||||||
# for motype in motypelist:
|
# for motype in motypelist:
|
||||||
motype = res.mo_types[-1]
|
motype = res.mo_types[-1]
|
||||||
print >>file, motype, "MOs"
|
print(motype, "MOs", file=file)
|
||||||
print >>file, " $VEC"
|
print(" $VEC", file=file)
|
||||||
moset = res.mo_sets[motype]
|
moset = res.mo_sets[motype]
|
||||||
moindex = res.closed_mos + res.active_mos + \
|
moindex = res.closed_mos + res.active_mos + \
|
||||||
res.virtual_mos
|
res.virtual_mos
|
||||||
@ -1578,13 +1578,13 @@ def gamess_write_vec(res, file):
|
|||||||
fields.append ( "%15.8E"%v.pop(0) )
|
fields.append ( "%15.8E"%v.pop(0) )
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
print >>file, ''.join(fields)
|
print(''.join(fields), file=file)
|
||||||
line += 1
|
line += 1
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
|
|
||||||
def gamess_write_data(res, file):
|
def gamess_write_data(res, file):
|
||||||
print >>file, " $DATA"
|
print(" $DATA", file=file)
|
||||||
print >>file, res.title
|
print(res.title, file=file)
|
||||||
try:
|
try:
|
||||||
point_group = res.point_group
|
point_group = res.point_group
|
||||||
N = point_group[1]
|
N = point_group[1]
|
||||||
@ -1594,10 +1594,10 @@ def gamess_write_data(res, file):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
point_group = 'C1'
|
point_group = 'C1'
|
||||||
N = '1'
|
N = '1'
|
||||||
print >>file, point_group
|
print(point_group, file=file)
|
||||||
for at in res.geometry:
|
for at in res.geometry:
|
||||||
print >>file, "%10s %3.1f %15.8f %15.8f %15.8f" % tuple( \
|
print("%10s %3.1f %15.8f %15.8f %15.8f" % tuple( \
|
||||||
[at.name.ljust(10), at.charge]+list(at.coord) )
|
[at.name.ljust(10), at.charge]+list(at.coord) ), file=file)
|
||||||
for contr in at.basis:
|
for contr in at.basis:
|
||||||
sym = contr.sym
|
sym = contr.sym
|
||||||
if sym == 's' :
|
if sym == 's' :
|
||||||
@ -1632,13 +1632,13 @@ def gamess_write_data(res, file):
|
|||||||
else:
|
else:
|
||||||
doPrint = False
|
doPrint = False
|
||||||
if doPrint:
|
if doPrint:
|
||||||
print >>file, "%4s%8d"%(sym, len(contr.prim))
|
print("%4s%8d"%(sym, len(contr.prim)), file=file)
|
||||||
for i, p in enumerate(contr.prim):
|
for i, p in enumerate(contr.prim):
|
||||||
if not isinstance(p,gaussian):
|
if not isinstance(p,gaussian):
|
||||||
raise TypeError("Basis function is not a gaussian")
|
raise TypeError("Basis function is not a gaussian")
|
||||||
print >>file, "%6d%26.10f%12.8f"%(i+1,p.expo,contr.coef[i])
|
print("%6d%26.10f%12.8f"%(i+1,p.expo,contr.coef[i]), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
|
|
||||||
def gamess_write_integrals(res,file):
|
def gamess_write_integrals(res,file):
|
||||||
filename = file.name.replace('.inp','.moints')
|
filename = file.name.replace('.inp','.moints')
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import include
|
from . import include
|
||||||
eval(include.code)
|
eval(include.code)
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -343,7 +343,7 @@ class gaussianFile(resultsFile):
|
|||||||
if self._basis is None:
|
if self._basis is None:
|
||||||
gfprint=False
|
gfprint=False
|
||||||
gfinput=False
|
gfinput=False
|
||||||
buffer = map(lambda x: x.lower(),self.options[1][0].split())
|
buffer = [x.lower() for x in self.options[1][0].split()]
|
||||||
if 'gfprint' in buffer: gfprint=True
|
if 'gfprint' in buffer: gfprint=True
|
||||||
elif 'gfinput' in buffer: gfinput=True
|
elif 'gfinput' in buffer: gfinput=True
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ class gaussianFile(resultsFile):
|
|||||||
if line[0].startswith('==============='):
|
if line[0].startswith('==============='):
|
||||||
pos = end
|
pos = end
|
||||||
else:
|
else:
|
||||||
print "GFPRINT should be present in the gaussian keywords."
|
print("GFPRINT should be present in the gaussian keywords.")
|
||||||
return None
|
return None
|
||||||
Nmax = basis_read[len(basis_read)-1][0]
|
Nmax = basis_read[len(basis_read)-1][0]
|
||||||
basis = [None for i in range(Nmax)]
|
basis = [None for i in range(Nmax)]
|
||||||
@ -473,7 +473,7 @@ class gaussianFile(resultsFile):
|
|||||||
mylist = [ "G0", "G1+", "G1-", "G2+", "G2-", "G3+", "G3-",
|
mylist = [ "G0", "G1+", "G1-", "G2+", "G2-", "G3+", "G3-",
|
||||||
"H4+", "H4-", "H5+", "H5-", "I6+", "I6-" ]
|
"H4+", "H4-", "H5+", "H5-", "I6+", "I6-" ]
|
||||||
|
|
||||||
mylist = map(normalize_basis_name,mylist)
|
mylist = list(map(normalize_basis_name,mylist))
|
||||||
for i in mylist[:-1]:
|
for i in mylist[:-1]:
|
||||||
basis[k][0] = i
|
basis[k][0] = i
|
||||||
basis.insert(k,list(basis[k]))
|
basis.insert(k,list(basis[k]))
|
||||||
@ -904,8 +904,8 @@ class gaussianFile(resultsFile):
|
|||||||
|
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i not in defined_vars:
|
if i not in defined_vars:
|
||||||
exec build_get_funcs(i) in locals()
|
exec(build_get_funcs(i), locals())
|
||||||
exec build_property(i,j) in locals()
|
exec(build_property(i,j), locals())
|
||||||
del to_remove, i, j
|
del to_remove, i, j
|
||||||
|
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ class gaussianFile(resultsFile):
|
|||||||
Nint = rec.pop(0)
|
Nint = rec.pop(0)
|
||||||
while (index >= Nint):
|
while (index >= Nint):
|
||||||
index -= Nint
|
index -= Nint
|
||||||
rec = self._file.next()
|
rec = next(self._file)
|
||||||
Nint = rec.pop(0)
|
Nint = rec.pop(0)
|
||||||
|
|
||||||
rec_i = rec[:4*Nint]
|
rec_i = rec[:4*Nint]
|
||||||
@ -969,7 +969,7 @@ class gaussianFile(resultsFile):
|
|||||||
|
|
||||||
def write_vec(res, file):
|
def write_vec(res, file):
|
||||||
for motype in res.mo_types:
|
for motype in res.mo_types:
|
||||||
print >>file, " $VEC"
|
print(" $VEC", file=file)
|
||||||
moset = res.mo_sets[motype]
|
moset = res.mo_sets[motype]
|
||||||
for idx,mo in enumerate(moset):
|
for idx,mo in enumerate(moset):
|
||||||
v = list(mo.vector)
|
v = list(mo.vector)
|
||||||
@ -984,24 +984,24 @@ def write_vec(res, file):
|
|||||||
fields.append ( linum )
|
fields.append ( linum )
|
||||||
for n in range(5):
|
for n in range(5):
|
||||||
fields.append ( "%15.8E"%v.pop(0) )
|
fields.append ( "%15.8E"%v.pop(0) )
|
||||||
print >>file, ''.join(fields)
|
print(''.join(fields), file=file)
|
||||||
line += 1
|
line += 1
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
|
|
||||||
def write_data(res, file):
|
def write_data(res, file):
|
||||||
print >>file, " $DATA"
|
print(" $DATA", file=file)
|
||||||
print >>file, res.title
|
print(res.title, file=file)
|
||||||
point_group = res.point_group
|
point_group = res.point_group
|
||||||
N = point_group[1]
|
N = point_group[1]
|
||||||
if N != '1':
|
if N != '1':
|
||||||
point_group = point_group[0]+'N'+point_group[2:]
|
point_group = point_group[0]+'N'+point_group[2:]
|
||||||
point_group += ' '+N
|
point_group += ' '+N
|
||||||
print >>file, point_group
|
print(point_group, file=file)
|
||||||
if N != '1':
|
if N != '1':
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
for at in res.geometry:
|
for at in res.geometry:
|
||||||
print >>file, "%10s %3.1f %15.8f %15.8f %15.8f" % tuple( \
|
print("%10s %3.1f %15.8f %15.8f %15.8f" % tuple( \
|
||||||
[at.name.ljust(10), at.charge]+list(at.coord) )
|
[at.name.ljust(10), at.charge]+list(at.coord) ), file=file)
|
||||||
for contr in at.basis:
|
for contr in at.basis:
|
||||||
sym = contr.sym
|
sym = contr.sym
|
||||||
if sym == 's' :
|
if sym == 's' :
|
||||||
@ -1024,13 +1024,13 @@ def write_data(res, file):
|
|||||||
else:
|
else:
|
||||||
doPrint = False
|
doPrint = False
|
||||||
if doPrint:
|
if doPrint:
|
||||||
print >>file, "%4s%8d"%(sym, len(contr.prim))
|
print("%4s%8d"%(sym, len(contr.prim)), file=file)
|
||||||
for i, p in enumerate(contr.prim):
|
for i, p in enumerate(contr.prim):
|
||||||
if not isinstance(p,gaussian):
|
if not isinstance(p,gaussian):
|
||||||
raise TypeError("Basis function is not a gaussian")
|
raise TypeError("Basis function is not a gaussian")
|
||||||
print >>file, "%6d%26.10f%12.8f"%(i+1,p.expo,contr.coef[i])
|
print("%6d%26.10f%12.8f"%(i+1,p.expo,contr.coef[i]), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, " $END"
|
print(" $END", file=file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import include
|
from . import include
|
||||||
eval(include.code)
|
eval(include.code)
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -54,10 +54,10 @@ class molproFile(resultsFile):
|
|||||||
local_vars = list(local_vars)
|
local_vars = list(local_vars)
|
||||||
defined_vars = list(molproFile_defined_vars)
|
defined_vars = list(molproFile_defined_vars)
|
||||||
|
|
||||||
exec get_data('date',"DATE: ",'-3:-2') in locals()
|
exec(get_data('date',"DATE: ",'-3:-2'), locals())
|
||||||
exec get_data('point_group',"Point group",'2:') in locals()
|
exec(get_data('point_group',"Point group",'2:'), locals())
|
||||||
exec get_data('version'," Version",'1:2') in locals()
|
exec(get_data('version'," Version",'1:2'), locals())
|
||||||
exec get_data('nuclear_energy',"NUCLEAR REPULSION ENERGY", '3:4',"float") in locals()
|
exec(get_data('nuclear_energy',"NUCLEAR REPULSION ENERGY", '3:4',"float"), locals())
|
||||||
|
|
||||||
def get_num_elec(self):
|
def get_num_elec(self):
|
||||||
if self._num_elec is None:
|
if self._num_elec is None:
|
||||||
@ -181,7 +181,7 @@ class molproFile(resultsFile):
|
|||||||
program = regexp.findall(line)
|
program = regexp.findall(line)
|
||||||
if program != []:
|
if program != []:
|
||||||
if program[0] in methods_with_orbitals:
|
if program[0] in methods_with_orbitals:
|
||||||
while program[0] in occ.keys():
|
while program[0] in list(occ.keys()):
|
||||||
program[0] += 'x'
|
program[0] += 'x'
|
||||||
occ[program[0]] = []
|
occ[program[0]] = []
|
||||||
progFound=True
|
progFound=True
|
||||||
@ -483,10 +483,10 @@ class molproFile(resultsFile):
|
|||||||
file = open('basis.molpro','w')
|
file = open('basis.molpro','w')
|
||||||
molpro_write_input(self,file)
|
molpro_write_input(self,file)
|
||||||
file.close()
|
file.close()
|
||||||
print >>sys.stderr, """
|
print("""
|
||||||
Warning: there is a bug in the molpro output. Run the 'basis.molpro'
|
Warning: there is a bug in the molpro output. Run the 'basis.molpro'
|
||||||
input file with molpro to generate a correct output for the basis set.
|
input file with molpro to generate a correct output for the basis set.
|
||||||
"""
|
""", file=sys.stderr)
|
||||||
return self._basis
|
return self._basis
|
||||||
|
|
||||||
def get_mo_types(self):
|
def get_mo_types(self):
|
||||||
@ -584,7 +584,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
v.sym = self.symmetries[ int(buffer[0].split('.')[1])-1 ][0]
|
v.sym = self.symmetries[ int(buffer[0].split('.')[1])-1 ][0]
|
||||||
v.eigenvalue = float(buffer[2])
|
v.eigenvalue = float(buffer[2])
|
||||||
if v.eigenvalue == 999999.9999:
|
if v.eigenvalue == 999999.9999:
|
||||||
print "Warning line", iline+1, ": '**********' in orbital eigenvalues"
|
print("Warning line", iline+1, ": '**********' in orbital eigenvalues")
|
||||||
for l,s in enumerate(self.num_orb_sym):
|
for l,s in enumerate(self.num_orb_sym):
|
||||||
if l < symcount-1 :
|
if l < symcount-1 :
|
||||||
bf += s[0]
|
bf += s[0]
|
||||||
@ -604,7 +604,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
try:
|
try:
|
||||||
x2 = k*float(x)
|
x2 = k*float(x)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "Error line", iline+1, ": orbital coefficients"
|
print("Error line", iline+1, ": orbital coefficients")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
v.vector.append(x2)
|
v.vector.append(x2)
|
||||||
bf+=1
|
bf+=1
|
||||||
@ -708,7 +708,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
ncoreold=0
|
ncoreold=0
|
||||||
nactold=0
|
nactold=0
|
||||||
mo2=""
|
mo2=""
|
||||||
for ((ncore,nact),next) in zip(zip(ncore0,nact0),next0):
|
for ((ncore,nact),next) in zip(list(zip(ncore0,nact0)),next0):
|
||||||
for i in range(ncore):
|
for i in range(ncore):
|
||||||
tempcsf_a.append(ncoreold+i)
|
tempcsf_a.append(ncoreold+i)
|
||||||
tempcsf_b.append(ncoreold+i)
|
tempcsf_b.append(ncoreold+i)
|
||||||
@ -748,7 +748,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
def get_closed_mos(self):
|
def get_closed_mos(self):
|
||||||
if self._closed_mos is None:
|
if self._closed_mos is None:
|
||||||
result = []
|
result = []
|
||||||
occ = filter(lambda x: x>0., self.occ_num[self.determinants_mo_type])
|
occ = [x for x in self.occ_num[self.determinants_mo_type] if x>0.]
|
||||||
maxmo = len(occ)
|
maxmo = len(occ)
|
||||||
for orb in range(maxmo):
|
for orb in range(maxmo):
|
||||||
present = True
|
present = True
|
||||||
@ -765,7 +765,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
def get_virtual_mos(self):
|
def get_virtual_mos(self):
|
||||||
if self._virtual_mos is None:
|
if self._virtual_mos is None:
|
||||||
result = []
|
result = []
|
||||||
occ = filter(lambda x: x>0., self.occ_num[self.determinants_mo_type])
|
occ = [x for x in self.occ_num[self.determinants_mo_type] if x>0.]
|
||||||
maxmo = len(self.mo_sets[self.determinants_mo_type])
|
maxmo = len(self.mo_sets[self.determinants_mo_type])
|
||||||
for orb in range(maxmo):
|
for orb in range(maxmo):
|
||||||
present = False
|
present = False
|
||||||
@ -821,7 +821,7 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
# ----------
|
# ----------
|
||||||
exec build_property("num_orb_sym","Number of SALCAO/sym") in locals()
|
exec(build_property("num_orb_sym","Number of SALCAO/sym"), locals())
|
||||||
to_remove = []
|
to_remove = []
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i in resultsFile_defined_vars:
|
if i in resultsFile_defined_vars:
|
||||||
@ -831,8 +831,8 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
|
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i not in defined_vars:
|
if i not in defined_vars:
|
||||||
exec build_get_funcs(i) in locals()
|
exec(build_get_funcs(i), locals())
|
||||||
exec build_property(i,j) in locals()
|
exec(build_property(i,j), locals())
|
||||||
del to_remove, i, j
|
del to_remove, i, j
|
||||||
|
|
||||||
# Output Routines
|
# Output Routines
|
||||||
@ -840,9 +840,9 @@ input file with molpro to generate a correct output for the basis set.
|
|||||||
|
|
||||||
def molpro_write_input(res,file):
|
def molpro_write_input(res,file):
|
||||||
|
|
||||||
print >>file, " ***,", res.title
|
print(" ***,", res.title, file=file)
|
||||||
geom = res.geometry
|
geom = res.geometry
|
||||||
print >>file, """
|
print("""
|
||||||
print,basis;
|
print,basis;
|
||||||
print,orbitals;
|
print,orbitals;
|
||||||
gprint,civector;
|
gprint,civector;
|
||||||
@ -850,17 +850,17 @@ def molpro_write_input(res,file):
|
|||||||
|
|
||||||
geomtyp=xyz
|
geomtyp=xyz
|
||||||
geometry={
|
geometry={
|
||||||
""", len(geom)
|
""", len(geom), file=file)
|
||||||
print >>file, res.title
|
print(res.title, file=file)
|
||||||
i=1
|
i=1
|
||||||
for at in geom:
|
for at in geom:
|
||||||
coord = []
|
coord = []
|
||||||
for x in at.coord: coord.append(x*a0)
|
for x in at.coord: coord.append(x*a0)
|
||||||
print >>file, "%10s %15.8f %15.8f %15.8f" % tuple( \
|
print("%10s %15.8f %15.8f %15.8f" % tuple( \
|
||||||
[(at.name+str(i)).ljust(10) ]+coord )
|
[(at.name+str(i)).ljust(10) ]+coord ), file=file)
|
||||||
i+=1
|
i+=1
|
||||||
print >>file, "}\n"
|
print("}\n", file=file)
|
||||||
print >>file, "basis={"
|
print("basis={", file=file)
|
||||||
lines = []
|
lines = []
|
||||||
for idx,at in enumerate(geom):
|
for idx,at in enumerate(geom):
|
||||||
# Find atom
|
# Find atom
|
||||||
@ -925,11 +925,11 @@ def molpro_write_input(res,file):
|
|||||||
if line not in lines:
|
if line not in lines:
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
print >>file, line
|
print(line, file=file)
|
||||||
print >>file, "}\n",
|
print("}\n", end=' ', file=file)
|
||||||
|
|
||||||
print >>file, "rhf;"
|
print("rhf;", file=file)
|
||||||
print >>file, "---"
|
print("---", file=file)
|
||||||
|
|
||||||
fileTypes.append(molproFile)
|
fileTypes.append(molproFile)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import include
|
from . import include
|
||||||
eval(include.code)
|
eval(include.code)
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -336,8 +336,8 @@ class wfnFile(resultsFile):
|
|||||||
|
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i not in defined_vars:
|
if i not in defined_vars:
|
||||||
exec build_get_funcs(i) in locals()
|
exec(build_get_funcs(i), locals())
|
||||||
exec build_property(i,j) in locals()
|
exec(build_property(i,j), locals())
|
||||||
del to_remove, i, j
|
del to_remove, i, j
|
||||||
|
|
||||||
|
|
||||||
@ -381,9 +381,9 @@ basis_correspond['f+2'] = 16
|
|||||||
basis_correspond['f+3'] = 17
|
basis_correspond['f+3'] = 17
|
||||||
|
|
||||||
def wfn_write(res,file,MO_type=None):
|
def wfn_write(res,file,MO_type=None):
|
||||||
print >>file, " "+res.title.strip()
|
print(" "+res.title.strip(), file=file)
|
||||||
print >>file, "GAUSSIAN %14d MOL ORBITALS %6d PRIMITIVES %8d NUCLEI" \
|
print("GAUSSIAN %14d MOL ORBITALS %6d PRIMITIVES %8d NUCLEI" \
|
||||||
%(len(res.closed_mos+res.active_mos), len(res.uncontracted_basis), len(res.geometry)),
|
%(len(res.closed_mos+res.active_mos), len(res.uncontracted_basis), len(res.geometry)), end=' ', file=file)
|
||||||
|
|
||||||
# write geom
|
# write geom
|
||||||
geom = res.geometry
|
geom = res.geometry
|
||||||
@ -394,8 +394,8 @@ def wfn_write(res,file,MO_type=None):
|
|||||||
name = atom.name
|
name = atom.name
|
||||||
for d in string.digits:
|
for d in string.digits:
|
||||||
name = name.replace(d,'')
|
name = name.replace(d,'')
|
||||||
print >>file, "\n%3s %4d (CENTRE%3d) %12.8f%12.8f%12.8f CHARGE = %4.1f" \
|
print("\n%3s %4d (CENTRE%3d) %12.8f%12.8f%12.8f CHARGE = %4.1f" \
|
||||||
%(name, i+1, i+1, atom.coord[0]*f, atom.coord[1]*f, atom.coord[2]*f, atom.charge),
|
%(name, i+1, i+1, atom.coord[0]*f, atom.coord[1]*f, atom.coord[2]*f, atom.charge), end=' ', file=file)
|
||||||
|
|
||||||
# write basis
|
# write basis
|
||||||
basis = res.uncontracted_basis
|
basis = res.uncontracted_basis
|
||||||
@ -415,23 +415,23 @@ def wfn_write(res,file,MO_type=None):
|
|||||||
k=0
|
k=0
|
||||||
for c in center:
|
for c in center:
|
||||||
if k%20 == 0:
|
if k%20 == 0:
|
||||||
print "\nCENTRE ASSIGNMENTS ",
|
print("\nCENTRE ASSIGNMENTS ", end=' ')
|
||||||
print "%2d"%(c),
|
print("%2d"%(c), end=' ')
|
||||||
k+=1
|
k+=1
|
||||||
k=0
|
k=0
|
||||||
for t in type:
|
for t in type:
|
||||||
if k%20 == 0:
|
if k%20 == 0:
|
||||||
print "\nTYPE ASSIGNMENTS ",
|
print("\nTYPE ASSIGNMENTS ", end=' ')
|
||||||
print "%2d"%(t),
|
print("%2d"%(t), end=' ')
|
||||||
k+=1
|
k+=1
|
||||||
k=0
|
k=0
|
||||||
for e in expo:
|
for e in expo:
|
||||||
if k%5 == 0:
|
if k%5 == 0:
|
||||||
print "\nEXPONENTS ",
|
print("\nEXPONENTS ", end=' ')
|
||||||
print ("%13.7e"%(e)).replace('e','D'),
|
print(("%13.7e"%(e)).replace('e','D'), end=' ')
|
||||||
k+=1
|
k+=1
|
||||||
|
|
||||||
print '\n',
|
print('\n', end=' ')
|
||||||
|
|
||||||
# MOs
|
# MOs
|
||||||
if MO_type is None:
|
if MO_type is None:
|
||||||
@ -439,7 +439,7 @@ def wfn_write(res,file,MO_type=None):
|
|||||||
try:
|
try:
|
||||||
allMOs = res.uncontracted_mo_sets[MO_type]
|
allMOs = res.uncontracted_mo_sets[MO_type]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print "MO type not present in "+res.filename
|
print("MO type not present in "+res.filename)
|
||||||
return
|
return
|
||||||
mos = []
|
mos = []
|
||||||
occ = res.occ_num[MO_type]
|
occ = res.occ_num[MO_type]
|
||||||
@ -449,22 +449,22 @@ def wfn_write(res,file,MO_type=None):
|
|||||||
for i,orb2 in enumerate(mos):
|
for i,orb2 in enumerate(mos):
|
||||||
if occ[orb2[2]] > 0.:
|
if occ[orb2[2]] > 0.:
|
||||||
orb = orb2[1]
|
orb = orb2[1]
|
||||||
print "MO %4d MO 0.0 OCC NO = %9.7f ORB. ENERGY =%12.6f" \
|
print("MO %4d MO 0.0 OCC NO = %9.7f ORB. ENERGY =%12.6f" \
|
||||||
%(i+1, occ[orb2[2]], orb.eigenvalue),
|
%(i+1, occ[orb2[2]], orb.eigenvalue), end=' ')
|
||||||
k=0
|
k=0
|
||||||
for c in orb.vector:
|
for c in orb.vector:
|
||||||
if k%5 == 0:
|
if k%5 == 0:
|
||||||
print "\n",
|
print("\n", end=' ')
|
||||||
print "%15.8e"%(c),
|
print("%15.8e"%(c), end=' ')
|
||||||
k+=1
|
k+=1
|
||||||
print "\n",
|
print("\n", end=' ')
|
||||||
print "END DATA"
|
print("END DATA")
|
||||||
idx = res.mo_types.index(MO_type)
|
idx = res.mo_types.index(MO_type)
|
||||||
try:
|
try:
|
||||||
print " THE HF ENERGY =%20.12f THE VIRIAL(-V/T)="%(res.energies[idx]),
|
print(" THE HF ENERGY =%20.12f THE VIRIAL(-V/T)="%(res.energies[idx]), end=' ')
|
||||||
print "%12.8f"%(res.virials[idx])
|
print("%12.8f"%(res.virials[idx]))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print " THE HF ENERGY =%20.12f THE VIRIAL(-V/T)=%12.8f"%(0.,0.)
|
print(" THE HF ENERGY =%20.12f THE VIRIAL(-V/T)=%12.8f"%(0.,0.))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ def wfn_write(res,file,MO_type=None):
|
|||||||
|
|
||||||
|
|
||||||
def write_wfnFile(file,out=sys.stdout):
|
def write_wfnFile(file,out=sys.stdout):
|
||||||
if "basis" in file.mo_sets.keys() :
|
if "basis" in list(file.mo_sets.keys()) :
|
||||||
MoType = "basis"
|
MoType = "basis"
|
||||||
else:
|
else:
|
||||||
MoType = None
|
MoType = None
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import include
|
from . import include
|
||||||
eval(include.code)
|
eval(include.code)
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
@ -316,7 +316,7 @@ class xmvbFile(resultsFile):
|
|||||||
if len(bf) > 0:
|
if len(bf) > 0:
|
||||||
basis_read.append( [index,sym,bf,iatom] )
|
basis_read.append( [index,sym,bf,iatom] )
|
||||||
else:
|
else:
|
||||||
print "GFPRINT should be present in the gaussian keywords."
|
print("GFPRINT should be present in the gaussian keywords.")
|
||||||
return None
|
return None
|
||||||
Nmax = basis_read[len(basis_read)-1][0]
|
Nmax = basis_read[len(basis_read)-1][0]
|
||||||
basis = [None for i in range(Nmax)]
|
basis = [None for i in range(Nmax)]
|
||||||
@ -373,7 +373,7 @@ class xmvbFile(resultsFile):
|
|||||||
# "XXXXYZ", "YYYYXZ", "ZZZZXY", "XXXYYY", "XXXZZZ", \
|
# "XXXXYZ", "YYYYXZ", "ZZZZXY", "XXXYYY", "XXXZZZ", \
|
||||||
# "YYYZZZ", "XXXYYZ", "XXXZZY", "YYYXXZ", "YYYZZX", \
|
# "YYYZZZ", "XXXYYZ", "XXXZZY", "YYYXXZ", "YYYZZX", \
|
||||||
# "ZZZXXY", "ZZZYYX" ]
|
# "ZZZXXY", "ZZZYYX" ]
|
||||||
mylist = map(normalize_basis_name,mylist)
|
mylist = list(map(normalize_basis_name,mylist))
|
||||||
for i in mylist[:-1]:
|
for i in mylist[:-1]:
|
||||||
basis[k][0] = i
|
basis[k][0] = i
|
||||||
basis.insert(k,list(basis[k]))
|
basis.insert(k,list(basis[k]))
|
||||||
@ -718,8 +718,8 @@ class xmvbFile(resultsFile):
|
|||||||
|
|
||||||
for i, j in local_vars:
|
for i, j in local_vars:
|
||||||
if i not in defined_vars:
|
if i not in defined_vars:
|
||||||
exec build_get_funcs(i) in locals()
|
exec(build_get_funcs(i), locals())
|
||||||
exec build_property(i,j) in locals()
|
exec(build_property(i,j), locals())
|
||||||
del to_remove, i, j
|
del to_remove, i, j
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ all = [ "resultsFile", "getFile", "lib", "Modules" ]
|
|||||||
|
|
||||||
for mod in all:
|
for mod in all:
|
||||||
try:
|
try:
|
||||||
exec 'from '+mod+' import *'
|
exec('from '+mod+' import *')
|
||||||
except:
|
except:
|
||||||
print "Error importing module", mod
|
print("Error importing module", mod)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from resultsFile import *
|
from .resultsFile import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Find fileType
|
# Find fileType
|
||||||
@ -44,7 +44,7 @@ def getFile(name):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if fileType is None:
|
if fileType is None:
|
||||||
print "File type not recognized."
|
print("File type not recognized.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return file
|
return file
|
||||||
|
@ -38,9 +38,9 @@ all = [ i[:-3] for i in os.listdir(wd) if i.endswith(".py") ]
|
|||||||
|
|
||||||
for mod in all:
|
for mod in all:
|
||||||
try:
|
try:
|
||||||
exec 'from '+mod+' import *'
|
exec('from '+mod+' import *')
|
||||||
except:
|
except:
|
||||||
print "Error importing module", mod
|
print("Error importing module", mod)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from library import *
|
from .library import *
|
||||||
from math import *
|
from math import *
|
||||||
|
|
||||||
class atom(object):
|
class atom(object):
|
||||||
@ -62,10 +62,10 @@ class atom(object):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for i in "name charge coord basis".split():
|
for i in "name charge coord basis".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
class atomDataElement(object):
|
class atomDataElement(object):
|
||||||
@ -213,5 +213,5 @@ for line in atomDataText.splitlines():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
for s in atomData:
|
for s in atomData:
|
||||||
print s
|
print(s)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#import pdb
|
#import pdb
|
||||||
from library import *
|
from .library import *
|
||||||
from math import *
|
from math import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -97,10 +97,10 @@ class primitive(object):
|
|||||||
|
|
||||||
norm = property (get_norm,None,doc="Sqrt( Integral f^2(R) dR ).")
|
norm = property (get_norm,None,doc="Sqrt( Integral f^2(R) dR ).")
|
||||||
for i in "center expo sym".split():
|
for i in "center expo sym".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
#-----------------------
|
#-----------------------
|
||||||
@ -132,7 +132,7 @@ def binom(n,m):
|
|||||||
def rintgauss(n):
|
def rintgauss(n):
|
||||||
|
|
||||||
def ddfact2(n):
|
def ddfact2(n):
|
||||||
if n%2 == 0: print 'error in ddfact2'
|
if n%2 == 0: print('error in ddfact2')
|
||||||
res=1.
|
res=1.
|
||||||
for i in range(1,n+1,2):
|
for i in range(1,n+1,2):
|
||||||
res*=float(i)
|
res*=float(i)
|
||||||
@ -228,7 +228,7 @@ def xyz_from_lm(l,m):
|
|||||||
absm = abs(m)
|
absm = abs(m)
|
||||||
nb2 = absm
|
nb2 = absm
|
||||||
nb1 = (l-absm)/2
|
nb1 = (l-absm)/2
|
||||||
clmt = [ (-0.25)**t * binom(l,t) * binom(l-t,absm+t) for t in xrange(nb1+1) ]
|
clmt = [ (-0.25)**t * binom(l,t) * binom(l-t,absm+t) for t in range(nb1+1) ]
|
||||||
mod_absm_2 = absm % 2
|
mod_absm_2 = absm % 2
|
||||||
if m>=0:
|
if m>=0:
|
||||||
nb2_start = mod_absm_2
|
nb2_start = mod_absm_2
|
||||||
@ -241,8 +241,8 @@ def xyz_from_lm(l,m):
|
|||||||
for n1 in range(nb2_start,nb2+1,2):
|
for n1 in range(nb2_start,nb2+1,2):
|
||||||
k = (absm-n1)/2
|
k = (absm-n1)/2
|
||||||
factor = (-1.)**k * binom(absm,n1) * norm
|
factor = (-1.)**k * binom(absm,n1) * norm
|
||||||
for t in xrange(nb1+1):
|
for t in range(nb1+1):
|
||||||
for n2 in xrange(t+1):
|
for n2 in range(t+1):
|
||||||
coe = clmt[t] * factor * binom(t,n2)
|
coe = clmt[t] * factor * binom(t,n2)
|
||||||
ipw = ( n1+2*n2 , absm-n1+2*(t-n2), l-2*t-absm )
|
ipw = ( n1+2*n2 , absm-n1+2*(t-n2), l-2*t-absm )
|
||||||
done = False
|
done = False
|
||||||
@ -402,10 +402,10 @@ class contraction(object):
|
|||||||
|
|
||||||
|
|
||||||
for i in "center prim sym coef".split():
|
for i in "center prim sym coef".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
norm = property (get_norm,None,doc="Sqrt( Integral f^2(R) dR ).")
|
norm = property (get_norm,None,doc="Sqrt( Integral f^2(R) dR ).")
|
||||||
|
|
||||||
@ -425,9 +425,9 @@ except ImportError:
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
for l in range(6):
|
for l in range(6):
|
||||||
print '---'
|
print('---')
|
||||||
for m in range(-l,l+1):
|
for m in range(-l,l+1):
|
||||||
print "%3d %3d :"%(l,m), xyz_from_lm(l,m)
|
print("%3d %3d :"%(l,m), xyz_from_lm(l,m))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -441,13 +441,13 @@ if __name__ == '__main__':
|
|||||||
b.center = [0.,0.,0.]
|
b.center = [0.,0.,0.]
|
||||||
x = spheToCart(a)
|
x = spheToCart(a)
|
||||||
y = spheToCart(a)
|
y = spheToCart(a)
|
||||||
print x
|
print(x)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
print GoverlapCart(a,b)
|
print(GoverlapCart(a,b))
|
||||||
print GoverlapCartNorm2(a,b)
|
print(GoverlapCartNorm2(a,b))
|
||||||
print ''
|
print('')
|
||||||
for i in range(0,10):
|
for i in range(0,10):
|
||||||
print rintgauss(i)
|
print(rintgauss(i))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
c = gaussian()
|
c = gaussian()
|
||||||
c.sym = 's'
|
c.sym = 's'
|
||||||
@ -458,7 +458,7 @@ if __name__ == '__main__':
|
|||||||
d.append(0.190362765893, b)
|
d.append(0.190362765893, b)
|
||||||
d.append(0.852162022245, c)
|
d.append(0.852162022245, c)
|
||||||
d.normalize()
|
d.normalize()
|
||||||
print d
|
print(d)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
a = gaussian()
|
a = gaussian()
|
||||||
a.sym = 'x'
|
a.sym = 'x'
|
||||||
@ -471,14 +471,14 @@ if __name__ == '__main__':
|
|||||||
c = contraction()
|
c = contraction()
|
||||||
c.append(1.,a)
|
c.append(1.,a)
|
||||||
c.append(2.,b)
|
c.append(2.,b)
|
||||||
print c.value( (1.,1.,0.) )
|
print(c.value( (1.,1.,0.) ))
|
||||||
print b.overlap(a)
|
print(b.overlap(a))
|
||||||
print a.overlap(b)
|
print(a.overlap(b))
|
||||||
print a.norm
|
print(a.norm)
|
||||||
print c.norm, c.coef
|
print(c.norm, c.coef)
|
||||||
c.normalize()
|
c.normalize()
|
||||||
print c.norm, c.coef
|
print(c.norm, c.coef)
|
||||||
c.normalize()
|
c.normalize()
|
||||||
print c.norm, c.coef
|
print(c.norm, c.coef)
|
||||||
print Goverlap(a,b)
|
print(Goverlap(a,b))
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from library import *
|
from .library import *
|
||||||
|
|
||||||
class CSF(object):
|
class CSF(object):
|
||||||
"""Class for an configuration state function."""
|
"""Class for an configuration state function."""
|
||||||
@ -69,8 +69,8 @@ class CSF(object):
|
|||||||
self._coefficients.append( c )
|
self._coefficients.append( c )
|
||||||
|
|
||||||
for i in "determinants coefficients".split():
|
for i in "determinants coefficients".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
from library import *
|
from .library import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
class fortranBinary(object):
|
class fortranBinary(object):
|
||||||
@ -51,7 +51,7 @@ Behaves like an array of records.
|
|||||||
def seek(self,index):
|
def seek(self,index):
|
||||||
self.file.seek(index)
|
self.file.seek(index)
|
||||||
|
|
||||||
def next(self):
|
def __next__(self):
|
||||||
if self.form is None:
|
if self.form is None:
|
||||||
raise TypeError
|
raise TypeError
|
||||||
data = self.file.read(4) # Rec length at the beginning of record
|
data = self.file.read(4) # Rec length at the beginning of record
|
||||||
@ -102,18 +102,18 @@ Behaves like an array of records.
|
|||||||
# file = property ( get_file, doc="Binary file")
|
# file = property ( get_file, doc="Binary file")
|
||||||
# form = xproperty ( '_form', doc="Format to read the binary record")
|
# form = xproperty ( '_form', doc="Format to read the binary record")
|
||||||
for i in "recl mode name file form".split():
|
for i in "recl mode name file form".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
f = fortranBinary(sys.argv[1],"rb")
|
f = fortranBinary(sys.argv[1],"rb")
|
||||||
f.form = 'l'+4*15000*'h'+15000*'d'
|
f.form = 'l'+4*15000*'h'+15000*'d'
|
||||||
print f.name
|
print(f.name)
|
||||||
print f.mode
|
print(f.mode)
|
||||||
print f[0]
|
print(f[0])
|
||||||
print f[10]
|
print(f[10])
|
||||||
print f[0]
|
print(f[0])
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from library import *
|
from .library import *
|
||||||
from math import *
|
from math import *
|
||||||
|
|
||||||
class integral(object):
|
class integral(object):
|
||||||
@ -56,19 +56,19 @@ class integral(object):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for i in "indices value".split():
|
for i in "indices value".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
i = integral()
|
i = integral()
|
||||||
i.indices = [1,4]
|
i.indices = [1,4]
|
||||||
i.value = 1.5
|
i.value = 1.5
|
||||||
print i
|
print(i)
|
||||||
j = integral()
|
j = integral()
|
||||||
j.indices = [4,3,2,1]
|
j.indices = [4,3,2,1]
|
||||||
j.value = 2.5
|
j.value = 2.5
|
||||||
print j
|
print(j)
|
||||||
print i<j
|
print(i<j)
|
||||||
|
@ -35,10 +35,10 @@ def prettyPrint(obj,shift=" "):
|
|||||||
prettyPrint(k)
|
prettyPrint(k)
|
||||||
elif isinstance(obj,dict):
|
elif isinstance(obj,dict):
|
||||||
for k in obj:
|
for k in obj:
|
||||||
print k
|
print(k)
|
||||||
prettyPrint(obj[k])
|
prettyPrint(obj[k])
|
||||||
else:
|
else:
|
||||||
print str(obj)
|
print(str(obj))
|
||||||
|
|
||||||
def xproperty(fget, fset=None, fdel=None, doc=None):
|
def xproperty(fget, fset=None, fdel=None, doc=None):
|
||||||
"""Automatically defines the properties if the functions don't exist."""
|
"""Automatically defines the properties if the functions don't exist."""
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from library import *
|
from .library import *
|
||||||
from math import *
|
from math import *
|
||||||
|
|
||||||
class orbital(object):
|
class orbital(object):
|
||||||
@ -96,10 +96,10 @@ class orbital(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
for i in "eigenvalue vector basis set sym".split():
|
for i in "eigenvalue vector basis set sym".split():
|
||||||
exec """
|
exec("""
|
||||||
def get_%(i)s(self): return self._%(i)s
|
def get_%(i)s(self): return self._%(i)s
|
||||||
def set_%(i)s(self,value): self._%(i)s = value
|
def set_%(i)s(self,value): self._%(i)s = value
|
||||||
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals()
|
%(i)s = property(fget=get_%(i)s,fset=set_%(i)s) """%locals())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,20 +114,20 @@ if __name__ == '__main__':
|
|||||||
l[1].eigenvalue = 1.
|
l[1].eigenvalue = 1.
|
||||||
l[2].eigenvalue = 3.
|
l[2].eigenvalue = 3.
|
||||||
for i in l:
|
for i in l:
|
||||||
print i.eigenvalue
|
print(i.eigenvalue)
|
||||||
l.sort()
|
l.sort()
|
||||||
print ""
|
print("")
|
||||||
for i in l:
|
for i in l:
|
||||||
print i.eigenvalue
|
print(i.eigenvalue)
|
||||||
l[0].vector = [1., 0., 0.]
|
l[0].vector = [1., 0., 0.]
|
||||||
l[1].vector = [0., 1., 0.]
|
l[1].vector = [0., 1., 0.]
|
||||||
l[2].vector = [0., 1., 1.]
|
l[2].vector = [0., 1., 1.]
|
||||||
print l[0].is_ortho(l[1])
|
print(l[0].is_ortho(l[1]))
|
||||||
print l[1].is_ortho(l[2])
|
print(l[1].is_ortho(l[2]))
|
||||||
print l[1].dot(l[2])
|
print(l[1].dot(l[2]))
|
||||||
print l[1].dot(l[0])
|
print(l[1].dot(l[0]))
|
||||||
print l[1].norm()
|
print(l[1].norm())
|
||||||
print l[2].norm()
|
print(l[2].norm())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user