2019-03-04 19:01:54 +01:00
|
|
|
open Lacaml.D
|
|
|
|
|
2019-02-25 14:36:59 +01:00
|
|
|
let () =
|
|
|
|
let open Command_line in
|
|
|
|
begin
|
|
|
|
set_header_doc (Sys.argv.(0) ^ " - QCaml command");
|
|
|
|
set_description_doc "Runs a Hartree-Fock calculation";
|
|
|
|
set_specs
|
|
|
|
[ { short='b' ; long="basis" ; opt=Mandatory;
|
|
|
|
arg=With_arg "<string>";
|
|
|
|
doc="Name of the file containing the 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-04 19:01:54 +01:00
|
|
|
|
|
|
|
{ short='g' ; long="guess" ; opt=Optional;
|
|
|
|
arg=With_arg "<string>";
|
|
|
|
doc="Guess with another basis set."; } ;
|
2019-02-25 14:36:59 +01:00
|
|
|
]
|
|
|
|
end;
|
|
|
|
|
2019-03-04 19:01:54 +01:00
|
|
|
let ppf =
|
|
|
|
if Parallel.master then Format.std_formatter
|
|
|
|
else Printing.ppf_dev_null
|
|
|
|
in
|
|
|
|
|
2019-03-01 21:56:46 +01:00
|
|
|
let basis_file = Util.of_some @@ Command_line.get "basis" in
|
2019-02-25 14:36:59 +01:00
|
|
|
|
2019-03-01 21:56:46 +01:00
|
|
|
let nuclei_file = Util.of_some @@ Command_line.get "xyz" in
|
2019-02-25 14:36:59 +01:00
|
|
|
|
|
|
|
let charge =
|
|
|
|
match Command_line.get "charge" with
|
|
|
|
| Some x -> int_of_string x
|
|
|
|
| None -> 0
|
|
|
|
in
|
|
|
|
|
|
|
|
let multiplicity =
|
|
|
|
match Command_line.get "multiplicity" with
|
|
|
|
| Some x -> int_of_string x
|
|
|
|
| None -> 1
|
2018-02-23 18:44:31 +01:00
|
|
|
in
|
|
|
|
|
2019-03-04 19:01:54 +01:00
|
|
|
let s = Simulation.of_filenames
|
|
|
|
~charge ~multiplicity ~nuclei:nuclei_file basis_file in
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2019-03-04 19:01:54 +01:00
|
|
|
let guess =
|
|
|
|
match Command_line.get "guess" with
|
|
|
|
| None -> `Huckel
|
|
|
|
| Some filename ->
|
|
|
|
let s_guess = Simulation.of_filenames
|
|
|
|
~charge ~multiplicity ~nuclei:nuclei_file filename in
|
|
|
|
let hf = HartreeFock.make s_guess in
|
|
|
|
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf;
|
|
|
|
let guess_mos =
|
|
|
|
MOBasis.of_hartree_fock hf
|
|
|
|
|> MOBasis.of_mo_basis s
|
|
|
|
in
|
|
|
|
`Matrix (MOBasis.mo_coef guess_mos)
|
2019-03-01 21:56:46 +01:00
|
|
|
in
|
|
|
|
|
2019-03-04 19:01:54 +01:00
|
|
|
let hf = HartreeFock.make ~guess s in
|
|
|
|
|
|
|
|
Format.fprintf ppf "@[%a@]@." HartreeFock.pp_hf hf
|
|
|
|
(*
|
2019-03-01 21:56:46 +01:00
|
|
|
let mos = MOBasis.of_hartree_fock hf in
|
2019-03-02 16:48:35 +01:00
|
|
|
Format.fprintf ppf "@[%a@]@." (fun ppf x -> MOBasis.pp_mo ppf x) mos
|
2019-03-04 19:01:54 +01:00
|
|
|
*)
|
2018-02-23 18:44:31 +01:00
|
|
|
|
|
|
|
|