From 9b2324ae51c9d29ccef35c613f97919128108965 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 7 Apr 2015 10:17:38 +0200 Subject: [PATCH] Solved problem with lowercases --- data/ezfio_defaults/q_package.ezfio_default | 33 --------------------- ocaml/Qpackage.ml | 2 +- ocaml/qp_run.ml | 4 +++ ocaml/qptypes_generator.ml | 18 ++++------- scripts/ezfio_interface/ei_handler.py | 20 ++++++------- src/Bielec_integrals/EZFIO.cfg | 10 +++---- src/CISD/cisd.irp.f | 5 +--- src/CISD_SC2_selected/EZFIO.cfg | 6 ++-- src/Dets/det_svd.irp.f | 23 ++++++++------ src/Full_CI/EZFIO.cfg | 4 +-- 10 files changed, 46 insertions(+), 79 deletions(-) diff --git a/data/ezfio_defaults/q_package.ezfio_default b/data/ezfio_defaults/q_package.ezfio_default index 5da4d813..9d9604d8 100644 --- a/data/ezfio_defaults/q_package.ezfio_default +++ b/data/ezfio_defaults/q_package.ezfio_default @@ -1,12 +1,3 @@ -bielec_integrals - read_ao_integrals False - read_mo_integrals False - write_ao_integrals False - write_mo_integrals False - threshold_ao 1.e-15 - threshold_mo 1.e-15 - direct False - cis_dressed n_state_cis 10 n_core_cis 0 @@ -25,13 +16,6 @@ determinants s2_eig False only_single_double_dm False -full_ci - n_det_max_fci 10000 - n_det_max_fci_property 50000 - pt2_max 1.e-4 - do_pt2_end True - var_pt2_ratio 0.75 - all_singles n_det_max_fci 50000 pt2_max 1.e-8 @@ -41,20 +25,3 @@ cassd n_det_max_cassd 10000 pt2_max 1.e-4 do_pt2_end True - -hartree_fock - n_it_scf_max 200 - thresh_scf 1.e-10 - guess "Huckel" - -cisd_selected - n_det_max_cisd 10000 - pt2_max 1.e-4 - -cisd_sc2_selected - n_det_max_cisd_sc2 10000 - pt2_max 1.e-4 - do_pt2_end True - -properties - z_one_point 3.9 diff --git a/ocaml/Qpackage.ml b/ocaml/Qpackage.ml index 4d08192a..a3862f11 100644 --- a/ocaml/Qpackage.ml +++ b/ocaml/Qpackage.ml @@ -94,7 +94,7 @@ let get_ezfio_default_in_file ~directory ~data ~filename = match (String.lsplit2 ~on:' ' (String.strip line)) with | Some (l,r) -> if (l = data) then - String.lowercase (String.strip r) + String.strip r else find_data rest | None -> raise Not_found diff --git a/ocaml/qp_run.ml b/ocaml/qp_run.ml index 341a4ce6..2abea107 100644 --- a/ocaml/qp_run.ml +++ b/ocaml/qp_run.ml @@ -20,6 +20,10 @@ let run exe ezfio_file = Printf.printf "===============\nQuantum Package\n===============\n\n"; Printf.printf "Date : %s\n\n%!" (Time.to_string time_start); + match (Sys.command ("qp_edit -c "^ezfio_file)) with + | 0 -> () + | i -> failwith "Error: Input inconsistent\n"; + ; let exe = match (List.find ~f:(fun (x,_) -> x = exe) executables) with | None -> assert false diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index 633727f8..fd1739f1 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -150,15 +150,12 @@ end = struct let to_string = function | Huckel -> \"Huckel\" - | HCore -> \"HCore\" + | HCore -> \"Hcore\" let of_string s = - let s = - String.lowercase s - in match s with - | \"huckel\" -> Huckel - | \"hcore\" -> HCore + | \"Huckel\" -> Huckel + | \"Hcore\" -> HCore | _ -> failwith (\"Wrong Guess type : \"^s) end @@ -179,13 +176,10 @@ end = struct | Write -> \"Write\" | None -> \"None\" let of_string s = - let s = - String.lowercase s - in match s with - | \"read\" -> Read - | \"write\" -> Write - | \"none\" -> None + | \"Read\" -> Read + | \"Write\" -> Write + | \"None\" -> None | _ -> failwith (\"Wrong IO type : \"^s) end diff --git a/scripts/ezfio_interface/ei_handler.py b/scripts/ezfio_interface/ei_handler.py index 8fad8511..4adf85b9 100755 --- a/scripts/ezfio_interface/ei_handler.py +++ b/scripts/ezfio_interface/ei_handler.py @@ -12,8 +12,8 @@ By default all the option are executed. Options: -h --help --path The path of the `EZFIO.cfg`, by default will look in the ${pwd} - --irpf90 Create the `ezfio_interface.ipf90` - who containt all the provider needed + --irpf90 Create the `ezfio_interface.irpf90` + which contains all the providers needed (aka all with the `interface: input` parameter) in `${pwd}` --ezfio_config Create the `${module_lower}_ezfio_interface_config` in @@ -28,7 +28,7 @@ Options: Format specification : [provider_name] | the name of the provider in irp.f90 doc:{str} | Is the doc - Type:{str} | Is a fancy_type support by the ocaml + Type:{str} | Is a fancy_type supported by the ocaml ezfio_name:{str} | Will be the name of the file for the ezfio (optional by default is the name of the provider) interface:{str} | The provider is a imput or a output @@ -67,13 +67,13 @@ Type = namedtuple('Type', 'fancy ocaml fortran') def is_bool(str_): """ - Take a string, if is a bool return the convert into - fortran and ocaml one. + Take a string, if is a bool return the conversion into + fortran and ocaml. """ if str_.lower() in ['true', '.true.']: - return Type(None, "True", ".True.") - elif str_.lower() in ['false', '.False.']: - return Type(None, "False", ".False") + return Type(None, "true", ".True.") + elif str_.lower() in ['false', '.false.']: + return Type(None, "false", ".False") else: raise TypeError @@ -81,7 +81,7 @@ def is_bool(str_): def get_type_dict(): """ This function makes the correspondance between the type of value read in - ezfio.cfg into the f90 and Ocam Type + ezfio.cfg into the f90 and Ocaml Type return fancy_type[fancy_type] = namedtuple('Type', 'ocaml fortran') For example fancy_type['Ndet'].fortran = interger .ocaml = int @@ -154,7 +154,7 @@ def get_type_dict(): # 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 ocaml to the fortran for i in l_gen + l_un: str_fancy_type = i.split()[1].strip() str_ocaml_type = i.split()[3] diff --git a/src/Bielec_integrals/EZFIO.cfg b/src/Bielec_integrals/EZFIO.cfg index bd1d774a..eaada232 100644 --- a/src/Bielec_integrals/EZFIO.cfg +++ b/src/Bielec_integrals/EZFIO.cfg @@ -7,26 +7,26 @@ ezfio_name: direct [disk_access_mo_integrals] type: Disk_access -doc: Write, Read, None for MO integrals from disk (EZFIO folder) +doc: Read/Write MO integrals from/to disk [ Write | Read | None ] interface: input default: None [disk_access_ao_integrals] type: Disk_access -doc: Write or Read or None for AO integrals from disk (EZFIO folder) +doc: Read/Write AO integrals from/to disk [ Write | Read | None ] interface: input default: None [ao_integrals_threshold] type: Threshold -doc: If < ao_integrals_threshold then is null +doc: If || < ao_integrals_threshold then is zero interface: input default: 1.e-15 ezfio_name: threshold_ao [mo_integrals_threshold] type: Threshold -doc: If < ao_integrals_threshold then is null +doc: If || < ao_integrals_threshold then is zero interface: input default: 1.e-15 -ezfio_name: threshold_mo \ No newline at end of file +ezfio_name: threshold_mo diff --git a/src/CISD/cisd.irp.f b/src/CISD/cisd.irp.f index 0b6bc9fd..cfa21005 100644 --- a/src/CISD/cisd.irp.f +++ b/src/CISD/cisd.irp.f @@ -13,8 +13,5 @@ program cisd print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy enddo -! call CISD_SC2(psi_det,psi_coef,eigvalues,size(psi_coef,1),N_det,N_states,N_int) -! do i = 1, N_states -! print*,'eigvalues(i) = ',eigvalues(i) -! enddo + call save_wavefunction end diff --git a/src/CISD_SC2_selected/EZFIO.cfg b/src/CISD_SC2_selected/EZFIO.cfg index 660f9fd6..a97e2d76 100644 --- a/src/CISD_SC2_selected/EZFIO.cfg +++ b/src/CISD_SC2_selected/EZFIO.cfg @@ -1,6 +1,6 @@ [N_det_max_cisd_sc2] type: Det_number_max -doc: Get n_det_max_cisd_sc2 from EZFIO file +doc: Max number of determinants interface: input default: 10000 @@ -12,8 +12,8 @@ default: true [PT2_max] type: PT2_energy -doc: The selection process stops when the largest PT2 (for all the state) is lower - than pt2_max in absolute value +doc: The selection process stops when the largest PT2 (for all the states) is lower + than abs(pt2_max) interface: input default: 0.0001 diff --git a/src/Dets/det_svd.irp.f b/src/Dets/det_svd.irp.f index 8365b42c..0a57acf3 100644 --- a/src/Dets/det_svd.irp.f +++ b/src/Dets/det_svd.irp.f @@ -3,7 +3,7 @@ program det_svd BEGIN_DOC ! Computes the SVD of the Alpha x Beta determinant coefficient matrix END_DOC - integer :: i,j + integer :: i,j,k read_wf = .True. TOUCH read_wf @@ -40,17 +40,22 @@ program det_svd print *, 'N_det_alpha = ', N_det_alpha_unique print *, 'N_det_beta = ', N_det_beta_unique print *, '' - -! do i=1,N_det_alpha_unique -! do j=1,N_det_beta_unique -! print *, i,j,psi_svd_matrix(i,j,:) -! enddo -! enddo - print *, '' + call diagonalize_ci print *, 'Energy = ', ci_energy + + do i=1,N_det_alpha_unique + do j=1,N_det_beta_unique + do k=1,N_states + if (dabs(psi_svd_matrix(i,j,k)) < 1.d-15) then + psi_svd_matrix(i,j,k) = 0.d0 + endif + enddo + enddo + enddo + print *, '' print *, psi_svd_coefs(1:20,1) -! call save_wavefunction + call save_wavefunction end diff --git a/src/Full_CI/EZFIO.cfg b/src/Full_CI/EZFIO.cfg index 30528fd8..f59e094f 100644 --- a/src/Full_CI/EZFIO.cfg +++ b/src/Full_CI/EZFIO.cfg @@ -32,11 +32,11 @@ default: 0.75 [energy] type: double precision -doc: "Calculated Full CI energy" +doc: Calculated Selected FCI energy interface: output [energy_pt2] type: double precision -doc: "Calculated Full CI energy" +doc: Calculated FCI energy + PT2 interface: output