10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-25 22:52:15 +02:00

Put pseudo in pseudo and add suport for SIZE un ezfio.cfg

This commit is contained in:
Thomas Applencourt 2015-05-11 14:40:55 +02:00
parent 02cfbc8a8d
commit 4a45182ff7
8 changed files with 91 additions and 70 deletions

View File

@ -197,7 +197,7 @@ def get_dict_config_file(config_file_path, module_lower):
* equal to MODULE_lower name by default.
- interface : The provider is a imput or a output
- default : The default value /!\ stored in a Type named type!
if interface == output
if interface == input
- size : Is the string read in ezfio.cgf who containt the size information
(like 1 or =sum(ao_num))
"""
@ -230,7 +230,8 @@ def get_dict_config_file(config_file_path, module_lower):
# Create the dictionary who containt the value per default
d_default = {"ezfio_name": pvd,
"ezfio_dir": module_lower}
"ezfio_dir": module_lower,
"size": "1"}
# Check if type if avalaible
type_ = config_file.get(section, "type")
@ -274,6 +275,8 @@ def get_dict_config_file(config_file_path, module_lower):
def create_ezfio_provider(dict_ezfio_cfg):
import re
"""
From dict d[provider_name] = {type,
doc,
@ -286,12 +289,13 @@ def create_ezfio_provider(dict_ezfio_cfg):
output = output_dict_info['ezfio_dir'
return [code, ...]
"""
from ezfio_generate_provider import EZFIO_Provider
dict_code_provider = dict()
ez_p = EZFIO_Provider()
for provider_name, dict_info in dict_ezfio_cfg.iteritems():
if "default" in dict_info:
if "input" in dict_info["interface"]:
ez_p.set_type(dict_info['type'].fortran)
ez_p.set_name(provider_name)
ez_p.set_doc(dict_info['doc'])
@ -299,6 +303,9 @@ def create_ezfio_provider(dict_ezfio_cfg):
ez_p.set_ezfio_name(dict_info['ezfio_name'])
ez_p.set_output("output_%s" % dict_info['ezfio_dir'])
# (nuclei.nucl_num,pseudo.klocmax) => (nucl_num,klocmax)
ez_p.set_size(re.sub(r'\w+\.', "", dict_info['size']))
dict_code_provider[provider_name] = str(ez_p) + "\n"
return dict_code_provider
@ -342,15 +349,29 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
def size_format_to_ezfio(size_raw):
"""
If size_raw == "=" is a formula -> do nothing; return
Else convert the born of a multidimential array
(12,begin:end) into (12,begin+end+1) for example
If the value are between parenthses -> do nothing; return
Else put it in parenthsesis
"""
size_raw = str(size_raw)
if any([size_raw.startswith('='),
size_raw.startswith("(") and size_raw.endswith(")")]):
if size_raw.startswith('='):
size_convert = size_raw
else:
size_raw = provider_info["size"].translate(None, "()")
size_raw = size_raw.replace('.', '_')
a_size_raw = []
for dim in size_raw.split(","):
try:
(begin, end) = map(str.strip, dim.split(":"))
except ValueError:
a_size_raw.append(dim)
else:
a_size_raw.append("{0}+{1}+1".format(begin, end))
size_raw = ",".join(a_size_raw)
size_convert = "({0})".format(size_raw)
return size_convert
@ -719,7 +740,6 @@ def save_ocaml_qp_edit(str_ocaml_qp_edit):
if __name__ == "__main__":
arguments = docopt(__doc__)
# ___
# | ._ o _|_
# _|_ | | | |_

View File

@ -10,10 +10,11 @@ fetched from the EZFIO file.
import sys
class EZFIO_Provider(object):
data = """
BEGIN_PROVIDER [ %(type)s, %(name)s ]
BEGIN_PROVIDER [ %(type)s, %(name)s %(size)s ]
implicit none
BEGIN_DOC
! %(doc)s
@ -48,6 +49,9 @@ END_PROVIDER
msg = "Error : %s is not set in EZFIO.cfg" % (v)
print >>sys.stderr, msg
sys.exit(1)
if "size" not in self.__dict__:
self.__dict__["size"] = ""
return self.data % self.__dict__
def set_write(self):
@ -83,6 +87,12 @@ END_PROVIDER
def set_output(self, t):
self.output = t
def set_size(self, t):
if t != "1":
self.size = ", " + t
else:
self.size = ""
def test_module():
T = EZFIO_Provider()

View File

@ -311,11 +311,11 @@ if __name__ == "__main__":
# ~#~#~#~#~ #
klocmax = max([len(i) for i in v_k])
ezfio.pseudo_integrals_klocmax = klocmax
ezfio.pseudo_pseudo_klocmax = klocmax
ezfio.pseudo_integrals_v_k = zip(*v_k)
ezfio.pseudo_integrals_n_k = zip(*n_k)
ezfio.pseudo_integrals_dz_k = zip(*dz_k)
ezfio.pseudo_pseudo_v_k = zip(*v_k)
ezfio.pseudo_pseudo_n_k = zip(*n_k)
ezfio.pseudo_pseudo_dz_k = zip(*dz_k)
# ~#~#~#~#~#~#~#~#~ #
# N o n _ L o c a l #
@ -324,15 +324,15 @@ if __name__ == "__main__":
lmax = max([len(i) for i in v_kl])
kmax = max([len(sublist) for list_ in v_kl for sublist in list_])
ezfio.pseudo_integrals_lmaxpo = lmax
ezfio.pseudo_integrals_kmax = kmax
ezfio.pseudo_pseudo_lmax = lmax - 1
ezfio.pseudo_pseudo_kmax = kmax
v_kl = make_it_square(v_kl, [lmax, kmax])
n_kl = make_it_square(n_kl, [lmax, kmax], int)
dz_kl = make_it_square(dz_kl, [lmax, kmax])
ezfio.pseudo_integrals_v_kl = zip(*v_kl)
ezfio.pseudo_integrals_n_kl = zip(*n_kl)
ezfio.pseudo_integrals_dz_kl = zip(*dz_kl)
ezfio.pseudo_pseudo_v_kl = zip(*v_kl)
ezfio.pseudo_pseudo_n_kl = zip(*n_kl)
ezfio.pseudo_pseudo_dz_kl = zip(*dz_kl)
ezfio.pseudo_integrals_do_pseudo = True

View File

@ -1 +1 @@
AOs Bielec_integrals Bitmask CID CID_SC2_selected CID_selected CIS CISD CISD_selected CISD_SC2_selected Determinants Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs MP2 Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD DDCI_selected MRCC Pseudo_integrals
AOs Bielec_integrals Bitmask CID CID_SC2_selected CID_selected CIS CISD CISD_selected CISD_SC2_selected Determinants Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs MP2 Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD DDCI_selected MRCC Pseudo_integrals Pseudo

View File

@ -1 +1 @@
AOs Electrons
AOs Electrons Pseudo

View File

@ -21,4 +21,5 @@ Needed Modules
* `AOs <http://github.com/LCPQ/quantum_package/tree/master/src/AOs>`_
* `Electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Electrons>`_
* `Pseudo <http://github.com/LCPQ/quantum_package/tree/master/src/Pseudo>`_

View File

@ -21,23 +21,23 @@
!
!! Parameters of the local part of pseudo:
integer klocmax
integer, allocatable :: n_k(:,:)
double precision, allocatable :: v_k(:,:), dz_k(:,:)
call ezfio_get_pseudo_integrals_klocmax(klocmax)
allocate(n_k(nucl_num,klocmax),v_k(nucl_num,klocmax), dz_k(nucl_num,klocmax))
call ezfio_get_pseudo_integrals_v_k(v_k)
call ezfio_get_pseudo_integrals_n_k(n_k)
call ezfio_get_pseudo_integrals_dz_k(dz_k)
! integer klocmax
! integer, allocatable :: n_k(:,:)
! double precision, allocatable :: v_k(:,:), dz_k(:,:)
!
! call ezfio_get_pseudo_klocmax(klocmax)
!
! allocate(n_k(nucl_num,klocmax),v_k(nucl_num,klocmax), dz_k(nucl_num,klocmax))
!
! call ezfio_get_pseudo_v_k(v_k)
! call ezfio_get_pseudo_n_k(n_k)
! call ezfio_get_pseudo_dz_k(dz_k)
!
!! Dump array
integer, allocatable :: n_k_dump(:)
double precision, allocatable :: v_k_dump(:), dz_k_dump(:)
allocate(n_k_dump(1:klocmax), v_k_dump(1:klocmax), dz_k_dump(1:klocmax))
allocate(n_k_dump(1:pseudo_klocmax), v_k_dump(1:pseudo_klocmax), dz_k_dump(1:pseudo_klocmax))
!
@ -46,27 +46,27 @@
!
!! Parameters of non local part of pseudo:
integer :: kmax,lmax
integer, allocatable :: n_kl(:,:,:)
double precision, allocatable :: v_kl(:,:,:), dz_kl(:,:,:)
call ezfio_get_pseudo_integrals_lmaxpo(lmax)
call ezfio_get_pseudo_integrals_kmax(kmax)
!lmax plus one -> lmax
lmax = lmax - 1
allocate(n_kl(nucl_num,kmax,0:lmax), v_kl(nucl_num,kmax,0:lmax), dz_kl(nucl_num,kmax,0:lmax))
call ezfio_get_pseudo_integrals_n_kl(n_kl)
call ezfio_get_pseudo_integrals_v_kl(v_kl)
call ezfio_get_pseudo_integrals_dz_kl(dz_kl)
! integer :: kmax,lmax
! integer, allocatable :: n_kl(:,:,:)
! double precision, allocatable :: v_kl(:,:,:), dz_kl(:,:,:)
!
! call ezfio_get_pseudo_lmaxpo(lmax)
! call ezfio_get_pseudo_kmax(kmax)
! !lmax plus one -> lmax
! lmax = lmax - 1
!
! allocate(n_kl(nucl_num,kmax,0:lmax), v_kl(nucl_num,kmax,0:lmax), dz_kl(nucl_num,kmax,0:lmax))
!
! call ezfio_get_pseudo_n_kl(n_kl)
! call ezfio_get_pseudo_v_kl(v_kl)
! call ezfio_get_pseudo_dz_kl(dz_kl)
!
!
!! Dump array
integer, allocatable :: n_kl_dump(:,:)
double precision, allocatable :: v_kl_dump(:,:), dz_kl_dump(:,:)
allocate(n_kl_dump(kmax,0:lmax), v_kl_dump(kmax,0:lmax), dz_kl_dump(kmax,0:lmax))
allocate(n_kl_dump(pseudo_kmax,0:pseudo_lmax), v_kl_dump(pseudo_kmax,0:pseudo_lmax), dz_kl_dump(pseudo_kmax,0:pseudo_lmax))
! _
! / _. | _ |
@ -86,7 +86,7 @@
!$OMP wall_0,wall_2,thread_num, output_monoints) &
!$OMP SHARED (ao_num,ao_prim_num,ao_expo_ordered_transp,ao_power,ao_nucl,nucl_coord,ao_coef_normalized_ordered_transp, &
!$OMP ao_nucl_elec_integral_pseudo,nucl_num,nucl_charge, &
!$OMP klocmax,lmax,kmax,v_k,n_k, dz_k, n_kl, v_kl, dz_kl, &
!$OMP pseudo_klocmax,pseudo_lmax,pseudo_kmax,pseudo_v_k,pseudo_n_k, pseudo_dz_k, pseudo_n_kl, pseudo_v_kl, pseudo_dz_kl, &
!$OMP wall_1)
!$OMP DO SCHEDULE (guided)
@ -117,19 +117,19 @@
C_center(1:3) = nucl_coord(k,1:3)
v_k_dump = v_k(k,1:klocmax)
n_k_dump = n_k(k,1:klocmax)
dz_k_dump = dz_k(k,1:klocmax)
v_k_dump = pseudo_v_k(k,1:pseudo_klocmax)
n_k_dump = pseudo_n_k(k,1:pseudo_klocmax)
dz_k_dump = pseudo_dz_k(k,1:pseudo_klocmax)
c = c + Vloc(klocmax, v_k_dump,n_k_dump, dz_k_dump, &
c = c + Vloc(pseudo_klocmax, v_k_dump,n_k_dump, dz_k_dump, &
A_center,power_A,alpha,B_center,power_B,beta,C_center)
n_kl_dump = n_kl(k,1:kmax,0:lmax)
v_kl_dump = v_kl(k,1:kmax,0:lmax)
dz_kl_dump = dz_kl(k,1:kmax,0:lmax)
n_kl_dump = pseudo_n_kl(k,1:pseudo_kmax,0:pseudo_lmax)
v_kl_dump = pseudo_v_kl(k,1:pseudo_kmax,0:pseudo_lmax)
dz_kl_dump = pseudo_dz_kl(k,1:pseudo_kmax,0:pseudo_lmax)
c = c + Vpseudo(lmax,kmax,v_kl_dump,n_kl_dump,dz_kl_dump,A_center,power_A,alpha,B_center,power_B,beta,C_center)
c = c + Vpseudo(pseudo_lmax,pseudo_kmax,v_kl_dump,n_kl_dump,dz_kl_dump,A_center,power_A,alpha,B_center,power_B,beta,C_center)
enddo
ao_nucl_elec_integral_pseudo(i,j) = ao_nucl_elec_integral_pseudo(i,j) + &
@ -157,10 +157,10 @@
! |_/ (/_ (_| | | (_) (_ (_| |_ (/_
!
deallocate(n_k,v_k, dz_k)
! deallocate(n_k,v_k, dz_k)
deallocate(n_k_dump,v_k_dump, dz_k_dump)
deallocate(n_kl,v_kl, dz_kl)
! deallocate(n_kl,v_kl, dz_kl)
deallocate(n_kl_dump,v_kl_dump, dz_kl_dump)

View File

@ -1,10 +0,0 @@
pseudo_integrals
klocmax integer
v_k double precision (nuclei_nucl_num,pseudo_integrals_klocmax)
n_k integer (nuclei_nucl_num,pseudo_integrals_klocmax)
dz_k double precision (nuclei_nucl_num,pseudo_integrals_klocmax)
lmaxpo integer
kmax integer
v_kl double precision (nuclei_nucl_num,pseudo_integrals_kmax,pseudo_integrals_lmaxpo)
n_kl integer (nuclei_nucl_num,pseudo_integrals_kmax,pseudo_integrals_lmaxpo)
dz_kl double precision (nuclei_nucl_num,pseudo_integrals_kmax,pseudo_integrals_lmaxpo)