1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-09 07:33:41 +01:00

Compare commits

..

No commits in common. "d9237ab2712385c34cf4fb2d09856dad34992b6e" and "f87df2b4e965c401408d50afa26c117d88a34cf0" have entirely different histories.

3 changed files with 33 additions and 43 deletions

View File

@ -1,2 +1,2 @@
-ltrexio -L/home/scemama/.conda/envs/trexio_v2/lib -ltrexio

View File

@ -84,7 +84,7 @@ subroutine run
end do end do
end do end do
do l=0,pseudo_lmax do l=1,pseudo_lmax
do k=1,pseudo_kmax do k=1,pseudo_kmax
do i=1,nucl_num do i=1,nucl_num
if (pseudo_dz_kl(i,k,l) /= 0.d0) then if (pseudo_dz_kl(i,k,l) /= 0.d0) then
@ -101,8 +101,8 @@ subroutine run
lmax(nucl_num) ) lmax(nucl_num) )
do i=1,nucl_num do i=1,nucl_num
lmax(i) = -1 lmax(i) = 0
do l=0,pseudo_lmax do l=1,pseudo_lmax
do k=1,pseudo_kmax do k=1,pseudo_kmax
if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then
lmax(i) = max(lmax(i), l) lmax(i) = max(lmax(i), l)
@ -124,7 +124,7 @@ subroutine run
end if end if
end do end do
do l=0,lmax(i) do l=1,lmax(i)
do k=1,pseudo_kmax do k=1,pseudo_kmax
if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then if (pseudo_dz_kl_transp(k,l,i) /= 0.d0) then
j = j+1 j = j+1

View File

@ -120,7 +120,7 @@ def write_ezfio(trexio_filename, filename):
nucl_index = trexio.read_basis_nucleus_index(trexio_file) nucl_index = trexio.read_basis_nucleus_index(trexio_file)
ezfio.set_basis_shell_ang_mom(ang_mom) ezfio.set_basis_shell_ang_mom(ang_mom)
ezfio.set_basis_basis_nucleus_index([ x+1 for x in nucl_index ]) ezfio.set_basis_basis_nucleus_index(nucl_index)
exponent = trexio.read_basis_exponent(trexio_file) exponent = trexio.read_basis_exponent(trexio_file)
coefficient = trexio.read_basis_coefficient(trexio_file) coefficient = trexio.read_basis_coefficient(trexio_file)
@ -131,34 +131,29 @@ def write_ezfio(trexio_filename, filename):
shell_index = trexio.read_basis_shell_index(trexio_file) shell_index = trexio.read_basis_shell_index(trexio_file)
ao_shell = trexio.read_ao_shell(trexio_file) ao_shell = trexio.read_ao_shell(trexio_file)
shell_prim_num = []
nucl_shell_num = [] nucl_shell_num = []
prev = None prev = None
count = 0
n = 0
m = 0 m = 0
for i in ao_shell: for i in ao_shell:
count += 1
if i != prev: if i != prev:
n += 1
m += 1 m += 1
if prev is None or nucl_index[i] != nucl_index[prev]: if prev is None or nucl_index[i] != nucl_index[prev]:
nucl_shell_num.append(m) nucl_shell_num.append(m)
m = 0 m = 0
prev = i
assert (len(nucl_shell_num) == nucl_num)
shell_prim_num = []
prev = shell_index[0]
count = 0
for i in shell_index:
if i != prev:
shell_prim_num.append(count) shell_prim_num.append(count)
count = 0 count = 0
count += 1
prev = i prev = i
shell_prim_num.append(count) assert (len(nucl_shell_num) == nucl_num)
print(shell_prim_num)
assert (len(shell_prim_num) == shell_num) assert (len(shell_prim_num) == shell_num)
ezfio.set_basis_shell_prim_num(shell_prim_num) ezfio.set_basis_shell_prim_num(shell_prim_num)
ezfio.set_basis_shell_index([x+1 for x in shell_index]) ezfio.set_basis_shell_index(shell_index)
ezfio.set_basis_nucleus_shell_num(nucl_shell_num) ezfio.set_basis_nucleus_shell_num(nucl_shell_num)
@ -174,7 +169,7 @@ def write_ezfio(trexio_filename, filename):
ao_num = trexio.read_ao_num(trexio_file) ao_num = trexio.read_ao_num(trexio_file)
ezfio.set_ao_basis_ao_num(ao_num) ezfio.set_ao_basis_ao_num(ao_num)
at = [ nucl_index[i]+1 for i in ao_shell ] at = [ nucl_index[i] for i in ao_shell ]
ezfio.set_ao_basis_ao_nucl(at) ezfio.set_ao_basis_ao_nucl(at)
num_prim0 = [ 0 for i in range(shell_num) ] num_prim0 = [ 0 for i in range(shell_num) ]
@ -208,6 +203,7 @@ def write_ezfio(trexio_filename, filename):
exponent.append(expo[i]) exponent.append(expo[i])
num_prim.append(num_prim0[i]) num_prim.append(num_prim0[i])
print (len(coefficient) , ao_num, len(ao_shell))
assert (len(coefficient) == ao_num) assert (len(coefficient) == ao_num)
ezfio.set_ao_basis_ao_power(power_x + power_y + power_z) ezfio.set_ao_basis_ao_power(power_x + power_y + power_z)
ezfio.set_ao_basis_ao_prim_num(num_prim) ezfio.set_ao_basis_ao_prim_num(num_prim)
@ -247,26 +243,17 @@ def write_ezfio(trexio_filename, filename):
label = trexio.read_mo_type(trexio_file) label = trexio.read_mo_type(trexio_file)
ezfio.set_mo_basis_mo_label(label) ezfio.set_mo_basis_mo_label(label)
try: clss = trexio.read_mo_class(trexio_file)
clss = trexio.read_mo_class(trexio_file) core = [ i for i in clss if i.lower() == "core" ]
core = [ i for i in clss if i.lower() == "core" ] inactive = [ i for i in clss if i.lower() == "inactive" ]
inactive = [ i for i in clss if i.lower() == "inactive" ] active = [ i for i in clss if i.lower() == "active" ]
active = [ i for i in clss if i.lower() == "active" ] virtual = [ i for i in clss if i.lower() == "virtual" ]
virtual = [ i for i in clss if i.lower() == "virtual" ] deleted = [ i for i in clss if i.lower() == "deleted" ]
deleted = [ i for i in clss if i.lower() == "deleted" ]
except trexio.Error:
pass
MoMatrix = trexio.read_mo_coefficient(trexio_file) MoMatrix = trexio.read_mo_coefficient(trexio_file)
ezfio.set_mo_basis_mo_num(mo_num) ezfio.set_mo_basis_mo_num(mo_num)
ezfio.set_mo_basis_mo_coef(MoMatrix) ezfio.set_mo_basis_mo_coef(MoMatrix)
mo_occ = [ 0. for i in range(mo_num) ]
for i in range(num_alpha):
mo_occ[i] += 1.
for i in range(num_beta):
mo_occ[i] += 1.
ezfio.set_mo_basis_mo_occ(mo_occ)
print("OK") print("OK")
@ -295,10 +282,10 @@ def write_ezfio(trexio_filename, filename):
center = nucleus_index[i] center = nucleus_index[i]
if center != prev_center: if center != prev_center:
ecp[center] = { "lmax": max_ang_mom_plus_1[center], ecp[center] = { "lmax": max_ang_mom_plus_1[center],
"zcore": z_core[center], "zcore": zcore[center],
"contr": {} } "contr": {} }
for j in range(max_ang_mom_plus_1[center]+1): for i in range(max_ang_mom_plus_1[center]+1):
ecp[center]["contr"][j] = [] ecp[center]["contr"][i] = []
ecp[center]["contr"][ang_mom[i]].append( (coefficient[i], power[i], exponent[i]) ) ecp[center]["contr"][ang_mom[i]].append( (coefficient[i], power[i], exponent[i]) )
prev_center = center prev_center = center
@ -308,14 +295,13 @@ def write_ezfio(trexio_filename, filename):
kmax = 0 kmax = 0
klocmax = 0 klocmax = 0
for center in ecp: for center in ecp:
ecp_nl [center] = {}
for k in ecp[center]["contr"]: for k in ecp[center]["contr"]:
if k == ecp[center]["lmax"]: if k == ecp[center]["lmax"]:
ecp_loc[center] = ecp[center]["contr"][k] ecp_loc[center] = ecp[center]["contr"][k]
klocmax = max(len(ecp_loc[center]), klocmax) klocmax = max(len(ecp_loc[center], klocmax))
else: else:
ecp_nl [center][k] = ecp[center]["contr"][k] ecp_nl [center][k] = ecp[center]["contr"][k]
kmax = max(len(ecp_nl [center][k]), kmax) kmax = max(len(ecp_nl [center][k], kmax))
ezfio.set_pseudo_pseudo_klocmax(klocmax) ezfio.set_pseudo_pseudo_klocmax(klocmax)
ezfio.set_pseudo_pseudo_kmax(kmax) ezfio.set_pseudo_pseudo_kmax(kmax)
@ -328,7 +314,7 @@ def write_ezfio(trexio_filename, filename):
pseudo_dz_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)] pseudo_dz_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)]
for center in ecp_loc: for center in ecp_loc:
for k in range( len(ecp_loc[center]) ): for k in range( len(ecp_loc[center]) ):
v, n, dz = ecp_loc[center][k] v, n, dz = ecp_loc[center]
pseudo_n_k[k][center] = n pseudo_n_k[k][center] = n
pseudo_v_k[k][center] = v pseudo_v_k[k][center] = v
pseudo_dz_k[k][center] = dz pseudo_dz_k[k][center] = dz
@ -340,7 +326,7 @@ def write_ezfio(trexio_filename, filename):
for center in ecp_nl: for center in ecp_nl:
for k in range( len(ecp_nl[center]) ): for k in range( len(ecp_nl[center]) ):
for l in range( len(ecp_nl[center][k]) ): for l in range( len(ecp_nl[center][k]) ):
v, n, dz = ecp_nl[center][k][l] v, n, dz = ecp_nl[center][k]
pseudo_n_kl[l][k][center] = n pseudo_n_kl[l][k][center] = n
pseudo_v_kl[l][k][center] = v pseudo_v_kl[l][k][center] = v
pseudo_dz_kl[l][k][center] = dz pseudo_dz_kl[l][k][center] = dz
@ -350,6 +336,10 @@ def write_ezfio(trexio_filename, filename):
ezfio.set_pseudo_pseudo_dz_kl(pseudo_dz_kl) ezfio.set_pseudo_pseudo_dz_kl(pseudo_dz_kl)
for i in range(nucl_num):
charge[i] -= nucl_charge_remove[i]
ezfio.set_nuclei_nucl_charge(charge)
print("OK") print("OK")