10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 04:43:50 +01:00

Merge branch 'TApplencourt-master'

This commit is contained in:
Anthony Scemama 2015-05-11 15:06:23 +02:00
commit e34c22adc2
12 changed files with 128 additions and 29 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

50
src/Pseudo/EZFIO.cfg Normal file
View File

@ -0,0 +1,50 @@
[pseudo_klocmax]
doc: test
type:integer
interface: input_without_default
[pseudo_n_k]
doc: test
type: integer
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_klocmax)
[pseudo_v_k]
doc: test
type: double precision
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_klocmax)
[pseudo_dz_k]
doc: test
type: double precision
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_klocmax)
[pseudo_lmax]
doc: test
type:integer
interface: input_without_default
[pseudo_kmax]
doc: test
type:integer
interface: input_without_default
[pseudo_n_kl]
doc: test
type: integer
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_kmax,0:pseudo.pseudo_lmax)
[pseudo_v_kl]
doc: test
type: double precision
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_kmax,0:pseudo.pseudo_lmax)
[pseudo_dz_kl]
doc: test
type: double precision
interface: input_without_default
size: (nuclei.nucl_num,pseudo.pseudo_kmax,0:pseudo.pseudo_lmax)

6
src/Pseudo/Makefile Normal file
View File

@ -0,0 +1,6 @@
# Define here all new external source files and objects.Don't forget to prefix the
# object files with IRPF90_temp/
SRC=
OBJ=
include $(QPACKAGE_ROOT)/src/Makefile.common

View File

@ -0,0 +1 @@
Output Ezfio_files

21
src/Pseudo/README.rst Normal file
View File

@ -0,0 +1,21 @@
=============
Pseudo Module
=============
Documentation
=============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
Needed Modules
==============
.. Do not edit this section. It was auto-generated from the
.. NEEDED_MODULES file.
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_

View File

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

View File

@ -27,4 +27,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

@ -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)