10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 13:53:49 +01:00

qp_find_pi_space -apply

This commit is contained in:
Anthony Scemama 2018-05-24 23:50:56 +02:00
parent 142a2d25fa
commit 25f7e47ef1

View File

@ -2,7 +2,7 @@ open Core
open Qputils open Qputils
open Qptypes open Qptypes
let run ?(sym="None") ezfio_filename = let run ?(sym="None") apply ezfio_filename =
Ezfio.set_file ezfio_filename ; Ezfio.set_file ezfio_filename ;
let aos = let aos =
@ -72,28 +72,51 @@ let run ?(sym="None") ezfio_filename =
| _ -> ([],[]) | _ -> ([],[])
in in
match sym with begin
| "x" | "X" | "y" | "Y" | "z" | "Z" -> match sym with
begin | "x" | "X" | "y" | "Y" | "z" | "Z" ->
Printf.printf "Pi: ["; if apply then
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) pi; begin
Printf.printf "\b]\n\nSigma: ["; let ne = Ezfio.get_electrons_elec_alpha_num () in
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) sigma; let command =
Printf.printf "\b]\n" (Printf.sprintf "qp_set_mo_class -act \"[") ^
end (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^
| _ -> List.iter ~f:(fun (mo_i,x,y,z) -> Printf.printf "%d: (%f,%f,%f)\n" mo_i x y z) result "]\" -core \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^
"]\" -del \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > ne) sigma) ^
"]\" " ^ ezfio_filename
in
print_endline command;
if Sys.command command <> 0 then
failwith "Command failed"
end
else
begin
Printf.printf "Pi: [";
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) pi;
Printf.printf "\b]\n\nSigma: [";
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) sigma;
Printf.printf "\b]\n"
end
| _ -> List.iter ~f:(fun (mo_i,x,y,z) -> Printf.printf "%d: (%f,%f,%f)\n" mo_i x y z) result
end
let spec = let spec =
let open Command.Spec in let open Command.Spec in
empty empty
+> flag "sym" (optional string) ~doc:"{x,y,z} Axis perpendicular to the plane" +> flag "sym" (optional string)
~doc:"{x,y,z} Axis perpendicular to the plane"
+> flag "apply" no_arg
~doc:"Set the pi space as the active space, all other MOs frozen"
+> anon ("ezfio_filename" %: string) +> anon ("ezfio_filename" %: string)
let command = let command =
Command.basic_spec Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
@ -101,7 +124,7 @@ let command =
"Find all the pi molecular orbitals to create a pi space. "Find all the pi molecular orbitals to create a pi space.
") ")
spec spec
(fun sym ezfio_filename () -> run ?sym ezfio_filename ) (fun sym apply ezfio_filename () -> run ?sym apply ezfio_filename)
let () = let () =