2019-05-07 17:00:44 +02:00
|
|
|
open Lacaml.D
|
|
|
|
|
2019-03-20 19:18:36 +01:00
|
|
|
let () =
|
|
|
|
let open Command_line in
|
|
|
|
begin
|
|
|
|
set_header_doc (Sys.argv.(0) ^ " - QCaml command");
|
2019-03-21 00:44:10 +01:00
|
|
|
set_description_doc "Runs a F12-Full CI calculation";
|
2019-03-20 19:18:36 +01:00
|
|
|
set_specs
|
|
|
|
[ { short='b' ; long="basis" ; opt=Mandatory;
|
|
|
|
arg=With_arg "<string>";
|
|
|
|
doc="Name of the file containing the basis set"; } ;
|
|
|
|
|
|
|
|
{ short='a' ; long="aux_basis" ; opt=Mandatory;
|
|
|
|
arg=With_arg "<string>";
|
|
|
|
doc="Name of the file containing the auxiliary basis set"; } ;
|
|
|
|
|
|
|
|
{ short='x' ; long="xyz" ; opt=Mandatory;
|
|
|
|
arg=With_arg "<string>";
|
|
|
|
doc="Name of the file containing the nuclear coordinates in xyz format"; } ;
|
|
|
|
|
|
|
|
{ short='m' ; long="multiplicity" ; opt=Optional;
|
|
|
|
arg=With_arg "<int>";
|
|
|
|
doc="Spin multiplicity (2S+1). Default is singlet"; } ;
|
|
|
|
|
|
|
|
{ short='c' ; long="charge" ; opt=Optional;
|
|
|
|
arg=With_arg "<int>";
|
|
|
|
doc="Total charge of the molecule. Default is 0"; } ;
|
2019-03-26 10:38:50 +01:00
|
|
|
|
2019-10-24 11:25:49 +02:00
|
|
|
(*
|
2019-03-26 10:38:50 +01:00
|
|
|
{ short='e' ; long="expo" ; opt=Optional;
|
|
|
|
arg=With_arg "<float>";
|
|
|
|
doc="Exponent of the Gaussian geminal"; } ;
|
2019-10-24 11:25:49 +02:00
|
|
|
*)
|
2019-05-07 17:00:44 +02:00
|
|
|
|
|
|
|
{ short='s' ; long="state" ; opt=Optional;
|
|
|
|
arg=With_arg "<int>";
|
|
|
|
doc="Requested state. Default is 1."; } ;
|
2019-03-20 19:18:36 +01:00
|
|
|
]
|
|
|
|
end;
|
|
|
|
|
|
|
|
(* Handle options *)
|
|
|
|
let basis_file = Util.of_some @@ Command_line.get "basis" in
|
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let aux_basis_filename = Util.of_some @@ Command_line.get "aux_basis" in
|
2019-03-20 19:18:36 +01:00
|
|
|
|
|
|
|
let nuclei_file = Util.of_some @@ Command_line.get "xyz" in
|
|
|
|
|
|
|
|
let charge =
|
|
|
|
match Command_line.get "charge" with
|
2019-12-02 14:58:48 +01:00
|
|
|
| Some x -> ( if x.[0] = 'm' then
|
|
|
|
~- (int_of_string (String.sub x 1 (String.length x - 1)))
|
|
|
|
else
|
|
|
|
int_of_string x )
|
2019-03-20 19:18:36 +01:00
|
|
|
| None -> 0
|
|
|
|
in
|
|
|
|
|
2019-10-24 11:25:49 +02:00
|
|
|
(*
|
2019-03-26 10:38:50 +01:00
|
|
|
let expo =
|
|
|
|
match Command_line.get "expo" with
|
|
|
|
| Some x -> float_of_string x
|
|
|
|
| None -> 1.0
|
|
|
|
in
|
2019-10-24 11:25:49 +02:00
|
|
|
*)
|
2019-03-26 10:38:50 +01:00
|
|
|
|
2019-05-07 17:00:44 +02:00
|
|
|
let state =
|
|
|
|
match Command_line.get "state" with
|
|
|
|
| Some x -> int_of_string x
|
|
|
|
| None -> 1
|
|
|
|
in
|
|
|
|
|
2019-03-20 19:18:36 +01:00
|
|
|
let multiplicity =
|
|
|
|
match Command_line.get "multiplicity" with
|
|
|
|
| Some x -> int_of_string x
|
|
|
|
| None -> 1
|
|
|
|
in
|
|
|
|
|
|
|
|
let ppf =
|
|
|
|
if Parallel.master then Format.std_formatter
|
|
|
|
else Printing.ppf_dev_null
|
|
|
|
in
|
|
|
|
|
2019-10-24 11:25:49 +02:00
|
|
|
(*
|
2019-03-26 10:38:50 +01:00
|
|
|
let f12 =
|
2019-10-24 11:25:49 +02:00
|
|
|
F12factor.gaussian_geminal expo
|
|
|
|
in
|
|
|
|
*)
|
|
|
|
let f12 =
|
|
|
|
F12factor.gaussian_geminal 1.0
|
2019-03-26 10:38:50 +01:00
|
|
|
in
|
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let simulation =
|
2019-03-26 10:38:50 +01:00
|
|
|
Simulation.of_filenames ~f12 ~charge ~multiplicity ~nuclei:nuclei_file basis_file
|
2019-03-20 19:18:36 +01:00
|
|
|
in
|
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let hf = HartreeFock.make simulation in
|
2019-12-03 09:13:57 +01:00
|
|
|
Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;
|
2019-03-20 19:18:36 +01:00
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let mo_basis =
|
2019-03-20 19:18:36 +01:00
|
|
|
MOBasis.of_hartree_fock hf
|
|
|
|
in
|
|
|
|
|
2019-10-03 16:58:15 +02:00
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let fcif12 =
|
2019-05-07 17:00:44 +02:00
|
|
|
F12CI.make ~simulation ~frozen_core:false ~mo_basis ~aux_basis_filename ~state ()
|
2019-03-20 19:18:36 +01:00
|
|
|
in
|
2019-03-26 10:38:50 +01:00
|
|
|
|
2019-03-21 00:44:10 +01:00
|
|
|
let ci = F12CI.ci fcif12 in
|
2019-05-07 17:00:44 +02:00
|
|
|
Format.fprintf ppf "FCI energy : ";
|
|
|
|
Vec.iteri (fun i x -> if i <= state then
|
|
|
|
Format.fprintf ppf "%20.16f@; " (x +. Simulation.nuclear_repulsion simulation) )
|
|
|
|
(CI.eigenvalues ci);
|
|
|
|
Format.fprintf ppf "@.";
|
2019-03-26 10:38:50 +01:00
|
|
|
|
2019-03-22 00:34:00 +01:00
|
|
|
let _, e_cif12 = F12CI.eigensystem fcif12 in
|
2019-05-07 17:00:44 +02:00
|
|
|
Format.fprintf ppf "FCI-F12 energy : ";
|
|
|
|
Vec.iteri (fun i x -> if i <= state then
|
|
|
|
Format.fprintf ppf "%20.16f@; " (x +. Simulation.nuclear_repulsion simulation) )
|
|
|
|
e_cif12;
|
|
|
|
Format.fprintf ppf "@."
|
|
|
|
|
|
|
|
|