Commit 4da981e3 authored by hebrewsnabla's avatar hebrewsnabla
Browse files

update cidump

parent 17b395f2
......@@ -230,7 +230,7 @@ def sort_mo(mf, sort, ncore, base=1):
mf.mo_coeff = mo
return mf
def cas(mf, act_user=None, crazywfn=False, max_memory=2000, natorb=True, gvb=False, suhf=False, lmo=True, sort=None):
def cas(mf, act_user=None, crazywfn=False, max_memory=2000, natorb=True, gvb=False, suhf=False, lmo=True, sort=None, dry=False):
is_uhf, mf = check_uhf(mf)
if is_uhf:
if suhf:
......@@ -278,6 +278,8 @@ def cas(mf, act_user=None, crazywfn=False, max_memory=2000, natorb=True, gvb=Fal
#if not is_uhf and sort is not None:
# mo = mc.sort_mo(sort)
# mf.mo_coeff = mo
if dry:
return mc
mc.kernel()
#mc.analyze(with_meta_lowdin=False)
if natorb:
......
......@@ -30,36 +30,40 @@ def dump(mc, thresh=1e-2):
Gaussian format: 11a00
ORCA format : 22100
'''
print('***** CI components ******')
ci = mc.ci
ncas = mc.ncas
na, nb = mc.nelecas
#print(mc.ci)
lena, lenb = mc.ci.shape
dump_g = {}
dump_o = {}
for i in range(lena):
for j in range(lenb):
veca = fci.cistring.addr2str(ncas, na, i)
vecb = fci.cistring.addr2str(ncas, nb, j)
coeff = ci[i,j]
if coeff**2 > thresh:
vec, veco, va, vb = merge_vec(veca, vecb, ncas)
dump_g[vec] = coeff**2
if veco in dump_o:
dump_o[veco] += coeff**2
else:
dump_o[veco] = coeff**2
dump_g = sorted(dump_g.items(), key=lambda d: d[1], reverse=True)
dump_o = sorted(dump_o.items(), key=lambda d: d[1], reverse=True)
#print(dump_g)
#print(dump_o)
print(" c**2 Gaussian-type vector")
for k,v in dump_g:
print("{: .6f} {:7s}".format(v,k))
print(" c**2 ORCA-type vector")
for k,v in dump_o:
print("{: .6f} {:7s}".format(v,k))
if isinstance(mc.ci, (list, tuple)):
civecs = mc.ci
else:
civecs = [mc.ci]
for ici, ci in enumerate(civecs):
print('***** CI components ROOT %d ******' % ici)
ncas = mc.ncas
na, nb = mc.nelecas
#print(mc.ci)
lena, lenb = ci.shape
dump_g = {}
dump_o = {}
for i in range(lena):
for j in range(lenb):
veca = fci.cistring.addr2str(ncas, na, i)
vecb = fci.cistring.addr2str(ncas, nb, j)
coeff = ci[i,j]
if coeff**2 > thresh:
vec, veco, va, vb = merge_vec(veca, vecb, ncas)
dump_g[vec] = coeff**2
if veco in dump_o:
dump_o[veco] += coeff**2
else:
dump_o[veco] = coeff**2
dump_g = sorted(dump_g.items(), key=lambda d: d[1], reverse=True)
dump_o = sorted(dump_o.items(), key=lambda d: d[1], reverse=True)
#print(dump_g)
#print(dump_o)
print(" c**2 Gaussian-type vector")
for k,v in dump_g:
print("{: .6f} {:7s}".format(v,k))
print(" c**2 ORCA-type vector")
for k,v in dump_o:
print("{: .6f} {:7s}".format(v,k))
return dump_g, dump_o
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment