mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-26 06:21:45 +02:00
Find_pi_space updated
This commit is contained in:
parent
dbe2e997f9
commit
de1791f9d6
@ -2,7 +2,7 @@ open Core
|
|||||||
open Qputils
|
open Qputils
|
||||||
open Qptypes
|
open Qptypes
|
||||||
|
|
||||||
let run ?(sym="None") apply ezfio_filename =
|
let run ?(sym="None") ?(apply="no") fc ezfio_filename =
|
||||||
Ezfio.set_file ezfio_filename ;
|
Ezfio.set_file ezfio_filename ;
|
||||||
|
|
||||||
let aos =
|
let aos =
|
||||||
@ -75,11 +75,11 @@ let run ?(sym="None") apply ezfio_filename =
|
|||||||
begin
|
begin
|
||||||
match sym with
|
match sym with
|
||||||
| "x" | "X" | "y" | "Y" | "z" | "Z" ->
|
| "x" | "X" | "y" | "Y" | "z" | "Z" ->
|
||||||
if apply then
|
if apply = "cas" then
|
||||||
begin
|
begin
|
||||||
let ne = Ezfio.get_electrons_elec_alpha_num () in
|
let ne = Ezfio.get_electrons_elec_alpha_num () in
|
||||||
let command =
|
let command =
|
||||||
(Printf.sprintf "qp_set_mo_class -act \"[") ^
|
"qp_set_mo_class -act \"[" ^
|
||||||
(String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^
|
(String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^
|
||||||
"]\" -core \"[" ^
|
"]\" -core \"[" ^
|
||||||
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^
|
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^
|
||||||
@ -91,6 +91,32 @@ let run ?(sym="None") apply ezfio_filename =
|
|||||||
if Sys.command command <> 0 then
|
if Sys.command command <> 0 then
|
||||||
failwith "Command failed"
|
failwith "Command failed"
|
||||||
end
|
end
|
||||||
|
else if apply = "cassd" then
|
||||||
|
begin
|
||||||
|
let ne = Ezfio.get_electrons_elec_alpha_num () in
|
||||||
|
let nfc =
|
||||||
|
if fc then
|
||||||
|
let ic =
|
||||||
|
Unix.open_process_in ("qp_set_frozen_core.py -q "^ezfio_filename)
|
||||||
|
in
|
||||||
|
let result = int_of_string @@ input_line ic in
|
||||||
|
close_in ic; result
|
||||||
|
else 0
|
||||||
|
in
|
||||||
|
let command =
|
||||||
|
"qp_set_mo_class" ^
|
||||||
|
( if nfc > 0 then
|
||||||
|
Printf.sprintf " -core \"[1-%d]\"" nfc else "") ^
|
||||||
|
" -inact \"[" ^
|
||||||
|
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > nfc && mo_i <= ne) sigma) ^ "]\"" ^
|
||||||
|
" -act \"[" ^ (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^ "]\"" ^
|
||||||
|
" -virt \"[" ^
|
||||||
|
(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
|
else
|
||||||
begin
|
begin
|
||||||
Printf.printf "Pi: [";
|
Printf.printf "Pi: [";
|
||||||
@ -111,8 +137,10 @@ let spec =
|
|||||||
empty
|
empty
|
||||||
+> flag "sym" (optional string)
|
+> flag "sym" (optional string)
|
||||||
~doc:"{x,y,z} Axis perpendicular to the plane"
|
~doc:"{x,y,z} Axis perpendicular to the plane"
|
||||||
+> flag "apply" no_arg
|
+> flag "apply" (optional string)
|
||||||
~doc:"Set the pi space as the active space, all other MOs frozen"
|
~doc:"[cas|cassd] Set the pi space as the active space, all other MOs frozen. If [cassd] is chosen, set inactive and virtual mos."
|
||||||
|
+> flag "fc" no_arg
|
||||||
|
~doc:"freeze core MOs with -apply cassd"
|
||||||
+> anon ("ezfio_filename" %: string)
|
+> anon ("ezfio_filename" %: string)
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +152,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 apply ezfio_filename () -> run ?sym apply ezfio_filename)
|
(fun sym apply fc ezfio_filename () -> run ?sym ?apply fc ezfio_filename)
|
||||||
|
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
|
@ -6,8 +6,16 @@ import sys
|
|||||||
sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path
|
sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path
|
||||||
from ezfio import ezfio
|
from ezfio import ezfio
|
||||||
|
|
||||||
ezfio.set_filename(sys.argv[1])
|
|
||||||
if ezfio.get_pseudo_do_pseudo:
|
filename = sys.argv[1]
|
||||||
|
if filename == '-q': filename = sys.argv[2]
|
||||||
|
|
||||||
|
ezfio.set_filename(filename)
|
||||||
|
|
||||||
|
if ezfio.pseudo_do_pseudo:
|
||||||
|
if '-q' in sys.argv:
|
||||||
|
print 0
|
||||||
|
sys.exit(0)
|
||||||
print "I will not set frozen core with pseudopotentials."
|
print "I will not set frozen core with pseudopotentials."
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
@ -23,7 +31,7 @@ for charge in ezfio.nuclei_nucl_charge:
|
|||||||
mo_tot_num = ezfio.mo_basis_mo_tot_num
|
mo_tot_num = ezfio.mo_basis_mo_tot_num
|
||||||
|
|
||||||
if len(sys.argv)>2:
|
if len(sys.argv)>2:
|
||||||
if sys.argv[2] == '-q':
|
if '-q' in sys.argv:
|
||||||
print nb
|
print nb
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user