From 1c50739c988b83a3d24f17c718e4661350a7c7f0 Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Thu, 8 Oct 2020 11:52:49 +0200 Subject: [PATCH] Add quack-input.ml --- qcaml-tools/Makefile | 23 ++++++++++++ qcaml-tools/dune | 10 ++++++ qcaml-tools/dune-project | 22 ++++++++++++ qcaml-tools/quack_input.ml | 72 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 qcaml-tools/Makefile create mode 100644 qcaml-tools/dune create mode 100644 qcaml-tools/dune-project create mode 100644 qcaml-tools/quack_input.ml diff --git a/qcaml-tools/Makefile b/qcaml-tools/Makefile new file mode 100644 index 0000000..7c537b9 --- /dev/null +++ b/qcaml-tools/Makefile @@ -0,0 +1,23 @@ +# Frontend to dune. +.NOTPARALLEL: + +TARGETS=quack_input \ + quack_integrals + +.PHONY: default build install uninstall test clean + +%.exe: build + dune build $@ + +$(TARGETS): $(patsubst %, %.exe, $(TARGETS)) + for i in $* ; do ln _build/default/$$i $${i%.exe} ; done + +default: $(TARGETS) + +build: + dune build + +clean: + dune clean + + diff --git a/qcaml-tools/dune b/qcaml-tools/dune new file mode 100644 index 0000000..7bc46c7 --- /dev/null +++ b/qcaml-tools/dune @@ -0,0 +1,10 @@ +(executables + (names + quack_input + quack_integrals + ) + (libraries + qcaml + ) +) + diff --git a/qcaml-tools/dune-project b/qcaml-tools/dune-project new file mode 100644 index 0000000..e086792 --- /dev/null +++ b/qcaml-tools/dune-project @@ -0,0 +1,22 @@ +(lang dune 1.10) +(name quack-qcaml) +(maintainers + "Anthony Scemama " +) +(authors + "Anthony Scemama " +) +(package + (name quack-qcaml) + (synopsis "Quack toold using QCaml") + (depends + (ocaml (>= 4.10)) + (dune (>= 1.10)) + qcaml + ) +) + + + + + diff --git a/qcaml-tools/quack_input.ml b/qcaml-tools/quack_input.ml new file mode 100644 index 0000000..bc320be --- /dev/null +++ b/qcaml-tools/quack_input.ml @@ -0,0 +1,72 @@ +let basis_file : string option ref = ref None +let nuclei_file : string option ref = ref None +let charge : int option ref = ref None +let multiplicity : int option ref = ref None + + +let speclist = [ + ( "-b" , Arg.String (fun x -> basis_file := Some x), + "File containing the atomic basis set") ; + ( "-c" , Arg.Int (fun x -> charge := Some x), + "Total charge of the system") ; + ( "-m" , Arg.Int (fun x -> multiplicity := Some x), + "Multiplicity of the system") ; + ( "-x" , Arg.String (fun x -> nuclei_file := Some x), + "File containing the nuclear coordinates") ; +] + +let run () = + let basis_file = + match !basis_file with + | None -> raise (Invalid_argument "Basis set file should be specified with -b") + | Some x -> x + and nuclei_file = + match !nuclei_file with + | None -> raise (Invalid_argument "Coordinate file should be specified with -x") + | Some x -> x + in + + let nuclei = + Qcaml.Nuclei.of_xyz_file nuclei_file + in + + let basis = + QCaml.Gaussian_basis.of_nuclei_and_basis_filename nuclei basis_file + |> QCaml.Gaussian_basis.general_basis + in + + (* Print basis *) + Format.printf "%a" QCaml.Gaussian_basis.pp basis; + () +(* + List.map (fun (element, shell) -> + Simulation.of_filenames ?range_separation ?charge ?multiplicity + ~nuclei:nuclei_file basis_file + in + + print_endline @@ Nuclei.to_string @@ Simulation.nuclei s; + print_endline "Nuclear repulsion : "; + print_float @@ Simulation.nuclear_repulsion s; print_newline (); + print_endline @@ Basis.to_string @@ Simulation.basis s; + + let ao_basis = Simulation.ao_basis s in + let overlap = AOBasis.overlap ao_basis in + let eN_ints = AOBasis.eN_ints ao_basis in + let kin_ints = AOBasis.kin_ints ao_basis in + let ee_ints = AOBasis.ee_ints ao_basis in + Overlap.to_file ~filename:("Ov.dat") overlap; + NucInt.to_file ~filename:("Nuc.dat") eN_ints; + KinInt.to_file ~filename:("Kin.dat") kin_ints; + ERI.to_file ~filename:("ERI.dat") ee_ints; + match range_separation with + | Some _mu -> + ERI_lr.to_file ~filename:("ERI_lr.dat") (AOBasis.ee_lr_ints ao_basis) + | None -> () +*) + +let () = + let usage_msg = "Available options:" in + Arg.parse speclist (fun _ -> ()) usage_msg; + run () + +