mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 10:05:57 +01:00
Add new type Disk_access (Read Write None)
This commit is contained in:
parent
00be8bc06a
commit
88db8c9ae6
@ -161,8 +161,36 @@ end = struct
|
|||||||
| \"hcore\" -> HCore
|
| \"hcore\" -> HCore
|
||||||
| _ -> failwith (\"Wrong Guess type : \"^s)
|
| _ -> failwith (\"Wrong Guess type : \"^s)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
module Disk_access : sig
|
||||||
|
type t with sexp
|
||||||
|
val to_string : t -> string
|
||||||
|
val of_string : string -> t
|
||||||
|
end = struct
|
||||||
|
type t =
|
||||||
|
| Read
|
||||||
|
| Write
|
||||||
|
| None
|
||||||
|
with sexp
|
||||||
|
|
||||||
|
let to_string = function
|
||||||
|
| Read -> \"Read\"
|
||||||
|
| Write -> \"Write\"
|
||||||
|
| None -> \"None\"
|
||||||
|
let of_string s =
|
||||||
|
let s =
|
||||||
|
String.lowercase s
|
||||||
|
in
|
||||||
|
match s with
|
||||||
|
| \"read\" -> Read
|
||||||
|
| \"write\" -> Write
|
||||||
|
| \"none\" -> None
|
||||||
|
| _ -> failwith (\"Wrong IO type : \"^s)
|
||||||
|
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let template = format_of_string "
|
let template = format_of_string "
|
||||||
|
22
scripts/ezfio_interface/convert_ezfio.sh
Normal file → Executable file
22
scripts/ezfio_interface/convert_ezfio.sh
Normal file → Executable file
@ -4,10 +4,24 @@
|
|||||||
|
|
||||||
# Hartree Fock
|
# Hartree Fock
|
||||||
# Changin the case, don't know if is needed or not
|
# Changin the case, don't know if is needed or not
|
||||||
mv $1/Hartree_Fock $1/hartree_fock
|
mv $1/Hartree_Fock $1/hartree_fock 2> /dev/null
|
||||||
mv $1/hartree_Fock/thresh_SCF $1/hartree_fock/thresh_scf
|
|
||||||
|
|
||||||
mv $1/hartree_Fock/thresh_SCF $1/hartree_fock/thresh_scf
|
mv $1/hartree_Fock/thresh_SCF $1/hartree_fock/thresh_scf 2> /dev/null
|
||||||
|
|
||||||
# BiInts
|
# BiInts
|
||||||
mv $1/bi_integrals $1/bielect_integrals
|
mv $1/bi_integrals $1/bielect_integrals 2> /dev/null
|
||||||
|
|
||||||
|
if [ -f $1/bielect_integrals/read_ao_integrals ]; then
|
||||||
|
if [ `cat $1/bielect_integrals/read_ao_integrals` -eq "True" ]
|
||||||
|
then
|
||||||
|
echo "Read" > $1/bielect_integrals/disk_access_ao_integrals
|
||||||
|
|
||||||
|
elif [ `cat bielect_integrals/write_ao_integrals` -eq "True" ]
|
||||||
|
then
|
||||||
|
echo "Write" > $1/bielect_integrals/disk_access_ao_integrals
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "None" > $1/bielect_integrals/disk_access_ao_integrals
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
@ -105,8 +105,6 @@ def get_type_dict():
|
|||||||
fancy_type['logical'] = Type(None, "bool", "logical")
|
fancy_type['logical'] = Type(None, "bool", "logical")
|
||||||
fancy_type['bool'] = Type(None, "bool", "logical")
|
fancy_type['bool'] = Type(None, "bool", "logical")
|
||||||
|
|
||||||
fancy_type['MO_guess'] = Type("MO_guess", "string", "character*(32)")
|
|
||||||
|
|
||||||
fancy_type['character*(32)'] = Type(None, "string", "character*(32)")
|
fancy_type['character*(32)'] = Type(None, "string", "character*(32)")
|
||||||
fancy_type['character*(60)'] = Type(None, "string", "character*(60)")
|
fancy_type['character*(60)'] = Type(None, "string", "character*(60)")
|
||||||
fancy_type['character*(256)'] = Type(None, "string", "character*(256)")
|
fancy_type['character*(256)'] = Type(None, "string", "character*(256)")
|
||||||
@ -121,16 +119,34 @@ def get_type_dict():
|
|||||||
"logical": "logical",
|
"logical": "logical",
|
||||||
"string": "character*32"}
|
"string": "character*32"}
|
||||||
|
|
||||||
# Read and parse qptype
|
# Read and parse qptype generate
|
||||||
src = qpackage_root + "/ocaml/qptypes_generator.ml"
|
src = qpackage_root + "/ocaml/qptypes_generator.ml"
|
||||||
with open(src, "r") as f:
|
with open(src, "r") as f:
|
||||||
l = [i for i in f.read().splitlines() if i.strip().startswith("*")]
|
r = f.read()
|
||||||
|
|
||||||
|
# Generate
|
||||||
|
l_gen = [i for i in r.splitlines() if i.strip().startswith("*")]
|
||||||
|
|
||||||
|
# Untouch
|
||||||
|
b = r.find('let untouched = "')
|
||||||
|
e = r.find(';;', b)
|
||||||
|
|
||||||
|
l_un = [i for i in r[b:e].splitlines() if i.strip().startswith("module")]
|
||||||
|
|
||||||
|
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
# q p _ t y p e s _ g e n e r a t e #
|
||||||
|
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
# Read the fancy_type, the ocaml. and convert the ocam to the fortran
|
# Read the fancy_type, the ocaml. and convert the ocam to the fortran
|
||||||
for i in l:
|
for i in l_gen + l_un:
|
||||||
str_fancy_type = i.split()[1].strip()
|
str_fancy_type = i.split()[1].strip()
|
||||||
str_ocaml_type = i.split()[3]
|
str_ocaml_type = i.split()[3]
|
||||||
|
|
||||||
|
if str_ocaml_type != 'sig':
|
||||||
str_fortran_type = ocaml_to_fortran[str_ocaml_type]
|
str_fortran_type = ocaml_to_fortran[str_ocaml_type]
|
||||||
|
else:
|
||||||
|
str_fortran_type = 'character*(32)'
|
||||||
|
str_ocaml_type = 'string'
|
||||||
|
|
||||||
fancy_type[str_fancy_type] = Type(str_fancy_type,
|
fancy_type[str_fancy_type] = Type(str_fancy_type,
|
||||||
str_ocaml_type,
|
str_ocaml_type,
|
||||||
@ -277,7 +293,7 @@ def create_ezfio_provider(dict_ezfio_cfg):
|
|||||||
ez_p.set_ezfio_name(dict_info['ezfio_name'])
|
ez_p.set_ezfio_name(dict_info['ezfio_name'])
|
||||||
ez_p.set_output("output_%s" % dict_info['ezfio_dir'])
|
ez_p.set_output("output_%s" % dict_info['ezfio_dir'])
|
||||||
|
|
||||||
dict_code_provider[provider_name] = str(ez_p)
|
dict_code_provider[provider_name] = str(ez_p) + "\n"
|
||||||
|
|
||||||
return dict_code_provider
|
return dict_code_provider
|
||||||
|
|
||||||
@ -304,10 +320,10 @@ def save_ezfio_provider(path_head, dict_code_provider):
|
|||||||
|
|
||||||
l_output += [code for code in dict_code_provider.values()]
|
l_output += [code for code in dict_code_provider.values()]
|
||||||
|
|
||||||
output = "\n\n".join(l_output)
|
output = "\n".join(l_output)
|
||||||
|
|
||||||
if output != old_output:
|
if output != old_output:
|
||||||
with open(path, "w") as f:
|
with open(path, "w+") as f:
|
||||||
f.write(output)
|
f.write(output)
|
||||||
|
|
||||||
|
|
||||||
@ -424,7 +440,7 @@ def save_ezfio_config(module_lower, str_ezfio_config):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if str_ezfio_config != old_output:
|
if str_ezfio_config != old_output:
|
||||||
with open(path, "w") as f:
|
with open(path, "w+") as f:
|
||||||
f.write(str_ezfio_config)
|
f.write(str_ezfio_config)
|
||||||
|
|
||||||
|
|
||||||
@ -453,7 +469,7 @@ def save_ezfio_default(module_lower, str_ezfio_default):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if str_ezfio_default != old_output:
|
if str_ezfio_default != old_output:
|
||||||
with open(path, "w") as f:
|
with open(path, "w+") as f:
|
||||||
f.write(str_ezfio_default)
|
f.write(str_ezfio_default)
|
||||||
|
|
||||||
|
|
||||||
@ -566,7 +582,7 @@ def save_ocaml_input(module_lower, str_ocaml_input):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if str_ocaml_input != old_output:
|
if str_ocaml_input != old_output:
|
||||||
with open(path, "w") as f:
|
with open(path, "w+") as f:
|
||||||
f.write(str_ocaml_input)
|
f.write(str_ocaml_input)
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ Creates the provider of a variable that has to be
|
|||||||
fetched from the EZFIO file.
|
fetched from the EZFIO file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
class EZFIO_Provider(object):
|
class EZFIO_Provider(object):
|
||||||
|
|
||||||
@ -27,7 +28,6 @@ BEGIN_PROVIDER [ %(type)s, %(name)s ]
|
|||||||
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
|
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
|
||||||
stop 1
|
stop 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%(write)s
|
%(write)s
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
""".strip()
|
""".strip()
|
||||||
@ -57,9 +57,12 @@ END_PROVIDER
|
|||||||
output = self.output
|
output = self.output
|
||||||
name = self.name
|
name = self.name
|
||||||
|
|
||||||
l_write = [" call write_time(%(output)s)",
|
l_write = ["",
|
||||||
|
" call write_time(%(output)s)",
|
||||||
" call %(write)s(%(output)s, %(name)s, &",
|
" call %(write)s(%(output)s, %(name)s, &",
|
||||||
" '%(name)s')"]
|
" '%(name)s')",
|
||||||
|
""]
|
||||||
|
|
||||||
self.write = "\n".join(l_write) % locals()
|
self.write = "\n".join(l_write) % locals()
|
||||||
|
|
||||||
def set_type(self, t):
|
def set_type(self, t):
|
||||||
|
@ -5,29 +5,17 @@ interface: input
|
|||||||
default: False
|
default: False
|
||||||
ezfio_name: direct
|
ezfio_name: direct
|
||||||
|
|
||||||
[write_ao_integrals]
|
[disk_access_mo_integrals]
|
||||||
type: logical
|
type: Disk_access
|
||||||
doc: Write AO integrals from disk (EZFIO folder)
|
doc: Write, Read, None for MO integrals from disk (EZFIO folder)
|
||||||
interface: input
|
interface: input
|
||||||
default: False
|
default: None
|
||||||
|
|
||||||
[write_mo_integrals]
|
[disk_access_ao_integrals]
|
||||||
type: logical
|
type: Disk_access
|
||||||
doc: Write MO integrals from disk (EZFIO folder)
|
doc: Write or Read or None for AO integrals from disk (EZFIO folder)
|
||||||
interface: input
|
interface: input
|
||||||
default: False
|
default: None
|
||||||
|
|
||||||
[read_ao_integrals]
|
|
||||||
type: logical
|
|
||||||
doc: Read AO integrals from disk (EZFIO folder)
|
|
||||||
interface: input
|
|
||||||
default: False
|
|
||||||
|
|
||||||
[read_mo_integrals]
|
|
||||||
type: logical
|
|
||||||
doc: Read MO integrals from disk (EZFIO folder)
|
|
||||||
interface: input
|
|
||||||
default: False
|
|
||||||
|
|
||||||
[ao_integrals_threshold]
|
[ao_integrals_threshold]
|
||||||
type: Threshold
|
type: Threshold
|
||||||
|
@ -319,13 +319,6 @@ subroutine compute_ao_bielec_integrals(j,k,l,sze,buffer_value)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, ao_bielec_integrals_in_map ]
|
BEGIN_PROVIDER [ logical, ao_bielec_integrals_in_map ]
|
||||||
implicit none
|
implicit none
|
||||||
use map_module
|
use map_module
|
||||||
|
41
src/Bielec_integrals/read_write.irp.f
Normal file
41
src/Bielec_integrals/read_write.irp.f
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
BEGIN_PROVIDER [ logical, read_ao_integrals ]
|
||||||
|
&BEGIN_PROVIDER [ logical, read_mo_integrals ]
|
||||||
|
&BEGIN_PROVIDER [ logical, write_ao_integrals ]
|
||||||
|
&BEGIN_PROVIDER [ logical, write_mo_integrals ]
|
||||||
|
|
||||||
|
BEGIN_DOC
|
||||||
|
! One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals
|
||||||
|
END_DOC
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
if (disk_access_ao_integrals.EQ.'Read') then
|
||||||
|
read_ao_integrals = .True.
|
||||||
|
write_ao_integrals = .False.
|
||||||
|
|
||||||
|
else if (disk_access_ao_integrals.EQ.'Write') then
|
||||||
|
read_ao_integrals = .False.
|
||||||
|
write_ao_integrals = .True.
|
||||||
|
|
||||||
|
else if (disk_access_ao_integrals.EQ.'None') then
|
||||||
|
read_ao_integrals = .False.
|
||||||
|
write_ao_integrals = .False.
|
||||||
|
|
||||||
|
else if (disk_access_mo_integrals.EQ.'Read') then
|
||||||
|
read_mo_integrals = .True.
|
||||||
|
write_mo_integrals = .False.
|
||||||
|
|
||||||
|
else if (disk_access_mo_integrals.EQ.'Write') then
|
||||||
|
read_mo_integrals = .False.
|
||||||
|
write_mo_integrals = .True.
|
||||||
|
|
||||||
|
else if (disk_access_mo_integrals.EQ.'None') then
|
||||||
|
read_mo_integrals = .False.
|
||||||
|
write_mo_integrals = .False.
|
||||||
|
|
||||||
|
else
|
||||||
|
print *, 'bielec_integrals/disk_acces not of a the good type'
|
||||||
|
stop "1"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
END_PROVIDER
|
@ -54,6 +54,10 @@ def get_error_message(l_exepected, l_cur):
|
|||||||
return "\n".join(l_msg)
|
return "\n".join(l_msg)
|
||||||
|
|
||||||
|
|
||||||
|
def check_hf(geo, basis):
|
||||||
|
ezfio.bielec_integrals_disk_access_ao_integrals = "None"
|
||||||
|
|
||||||
|
|
||||||
def run_hf(geo, basis):
|
def run_hf(geo, basis):
|
||||||
"""
|
"""
|
||||||
Run a simle by default hf
|
Run a simle by default hf
|
||||||
@ -86,12 +90,10 @@ def run_hf(geo, basis):
|
|||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
ezfio.bielec_integrals_direct = False
|
ezfio.bielec_integrals_direct = False
|
||||||
ezfio.bielec_integrals_threshold_ao = 1.e-15
|
ezfio.bielec_integrals_threshold_ao = 1.e-15
|
||||||
ezfio.bielec_integrals_write_ao_integrals = False
|
ezfio.bielec_integrals_disk_access_ao_integrals = "None"
|
||||||
ezfio.bielec_integrals_read_ao_integrals = False
|
|
||||||
|
|
||||||
ezfio.bielec_integrals_threshold_mo = 1.e-15
|
ezfio.bielec_integrals_threshold_mo = 1.e-15
|
||||||
ezfio.bielec_integrals_write_mo_integrals = False
|
ezfio.bielec_integrals_disk_access_mo_integrals = "None"
|
||||||
ezfio.bielec_integrals_read_mo_integrals = False
|
|
||||||
|
|
||||||
ezfio.hartree_fock_mo_guess_type = "Huckel"
|
ezfio.hartree_fock_mo_guess_type = "Huckel"
|
||||||
ezfio.hartree_fock_thresh_scf = 1.e-10
|
ezfio.hartree_fock_thresh_scf = 1.e-10
|
||||||
|
Loading…
Reference in New Issue
Block a user