diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index aa6bd533..d76120b8 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -214,6 +214,26 @@ end = struct | _ -> raise (Invalid_argument (\"Wrong IO type : \"^s)) end + +module Perturbation : sig + type t [@@deriving sexp] + val to_string : t -> string + val of_string : string -> t +end = struct + type t = + | EN + | Barycentric + [@@deriving sexp] + + let to_string = function + | EN -> \"EN\" + | Barycentric -> \"Barycentric\" + let of_string s = + match (String.lowercase_ascii s) with + | \"en\" -> EN + | \"barycentric\" -> Barycentric + | _ -> raise (Invalid_argument (\"Wrong Perturbation type : \"^s)) +end " diff --git a/plugins/Full_CI_ZMQ/energy.irp.f b/plugins/Full_CI_ZMQ/energy.irp.f index a8361b2d..72895a1d 100644 --- a/plugins/Full_CI_ZMQ/energy.irp.f +++ b/plugins/Full_CI_ZMQ/energy.irp.f @@ -12,11 +12,17 @@ BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ] ! E0 in the denominator of the PT2 END_DOC if (initialize_pt2_E0_denominator) then - pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) + if (h0_type == "EN") then + pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) + else if (h0_type == "Barycentric") then + pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) + else + print *, h0_type, ' not implemented' + stop + endif ! call ezfio_get_full_ci_zmq_energy(pt2_E0_denominator(1)) ! pt2_E0_denominator(1) -= nuclear_repulsion ! pt2_E0_denominator(1:N_states) = HF_energy - nuclear_repulsion -! pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) call write_double(6,pt2_E0_denominator(1)+nuclear_repulsion, 'PT2 Energy denominator') else pt2_E0_denominator = -huge(1.d0) diff --git a/plugins/Perturbation/EZFIO.cfg b/plugins/Perturbation/EZFIO.cfg index 7120e4a6..8c56b03a 100644 --- a/plugins/Perturbation/EZFIO.cfg +++ b/plugins/Perturbation/EZFIO.cfg @@ -62,4 +62,9 @@ doc: Thresholds on selectors (fraction of the norm) for final PT2 calculation interface: ezfio,provider,ocaml default: 1. +[h0_type] +type: Perturbation +doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] +interface: ezfio,provider,ocaml +default: EN diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg new file mode 100644 index 00000000..c8dbb19e --- /dev/null +++ b/plugins/shiftedbk/EZFIO.cfg @@ -0,0 +1,22 @@ +[energy] +type: double precision +doc: Calculated energy +interface: ezfio + +[thresh_dressed_ci] +type: Threshold +doc: Threshold on the convergence of the dressed CI energy +interface: ezfio,provider,ocaml +default: 1.e-5 + +[n_it_max_dressed_ci] +type: Strictly_positive_int +doc: Maximum number of dressed CI iterations +interface: ezfio,provider,ocaml +default: 10 + +[h0_type] +type: Perturbation +doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] +interface: ezfio,provider,ocaml +default: EN diff --git a/plugins/shiftedbk/shifted_bk_routines.irp.f b/plugins/shiftedbk/shifted_bk_routines.irp.f index aae25315..e88d153c 100644 --- a/plugins/shiftedbk/shifted_bk_routines.irp.f +++ b/plugins/shiftedbk/shifted_bk_routines.irp.f @@ -82,11 +82,14 @@ BEGIN_PROVIDER [ double precision, E0_denominator, (N_states) ] ! E0 in the denominator of the PT2 END_DOC if (initialize_E0_denominator) then - E0_denominator(1:N_states) = psi_energy(1:N_states) - ! call ezfio_get_full_ci_zmq_energy(pt2_E0_denominator(1)) - ! E0_denominator(1) -= nuclear_repulsion - ! E0_denominator(1:N_states) = HF_energy - nuclear_repulsion - ! E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) + if (h0_type == "EN") then + E0_denominator(1:N_states) = psi_energy(1:N_states) + else if (h0_type == "Barycentric") then + E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) + else + print *, h0_type, ' not implemented' + stop + endif else E0_denominator = -huge(1.d0) endif