mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-08-24 21:21:47 +02:00
minor modifs to merge
This commit is contained in:
parent
7c1c761ea8
commit
d09e3e7308
@ -91,7 +91,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
| Element e -> Element.to_string e
|
| Element e -> Element.to_string e
|
||||||
| Int_elem (i,e) -> Printf.sprintf "%d,%s" (Nucl_number.to_int i) (Element.to_string e)
|
| Int_elem (i,e) -> Printf.sprintf "%d,%s" (Nucl_number.to_int i) (Element.to_string e)
|
||||||
in
|
in
|
||||||
Hashtbl.find basis_table key
|
Hashtbl.find basis_table key
|
||||||
in
|
in
|
||||||
|
|
||||||
let temp_filename =
|
let temp_filename =
|
||||||
@ -132,7 +132,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
Element.to_string elem.Atom.element
|
Element.to_string elem.Atom.element
|
||||||
in
|
in
|
||||||
Hashtbl.add basis_table key new_channel
|
Hashtbl.add basis_table key new_channel
|
||||||
) nuclei
|
) nuclei
|
||||||
end
|
end
|
||||||
| Some (key, basis) -> (*Aux basis *)
|
| Some (key, basis) -> (*Aux basis *)
|
||||||
begin
|
begin
|
||||||
@ -277,6 +277,16 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
) nuclei
|
) nuclei
|
||||||
in
|
in
|
||||||
|
|
||||||
|
let z_core =
|
||||||
|
List.map (fun x ->
|
||||||
|
Positive_int.to_int x.Pseudo.n_elec
|
||||||
|
|> float_of_int
|
||||||
|
) pseudo
|
||||||
|
in
|
||||||
|
let nucl_num = (List.length z_core) in
|
||||||
|
Ezfio.set_pseudo_nucl_charge_remove (Ezfio.ezfio_array_of_list
|
||||||
|
~rank:1 ~dim:[| nucl_num |] ~data:z_core);
|
||||||
|
|
||||||
let molecule =
|
let molecule =
|
||||||
let n_elec_to_remove =
|
let n_elec_to_remove =
|
||||||
List.fold_left (fun accu x ->
|
List.fold_left (fun accu x ->
|
||||||
@ -293,13 +303,13 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
Molecule.nuclei =
|
Molecule.nuclei =
|
||||||
let charges =
|
let charges =
|
||||||
list_map (fun x -> Positive_int.to_int x.Pseudo.n_elec
|
list_map (fun x -> Positive_int.to_int x.Pseudo.n_elec
|
||||||
|> Float.of_int) pseudo
|
|> Float.of_int) pseudo
|
||||||
|> Array.of_list
|
|> Array.of_list
|
||||||
in
|
in
|
||||||
List.mapi (fun i x ->
|
List.mapi (fun i x ->
|
||||||
{ x with Atom.charge = (Charge.to_float x.Atom.charge) -. charges.(i)
|
{ x with Atom.charge = (Charge.to_float x.Atom.charge) -. charges.(i)
|
||||||
|> Charge.of_float }
|
|> Charge.of_float }
|
||||||
) molecule.Molecule.nuclei
|
) molecule.Molecule.nuclei
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
let nuclei =
|
let nuclei =
|
||||||
@ -356,11 +366,11 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
in
|
in
|
||||||
if (x > accu) then x
|
if (x > accu) then x
|
||||||
else accu
|
else accu
|
||||||
) 0 x.Pseudo.non_local
|
) 0 x.Pseudo.non_local
|
||||||
in
|
in
|
||||||
if (x > accu) then x
|
if (x > accu) then x
|
||||||
else accu
|
else accu
|
||||||
) 0 pseudo
|
) 0 pseudo
|
||||||
in
|
in
|
||||||
|
|
||||||
let kmax =
|
let kmax =
|
||||||
@ -368,10 +378,10 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
list_map (fun x ->
|
list_map (fun x ->
|
||||||
List.filter (fun (y,_) ->
|
List.filter (fun (y,_) ->
|
||||||
(Positive_int.to_int y.Pseudo.GaussianPrimitive_non_local.proj) = i)
|
(Positive_int.to_int y.Pseudo.GaussianPrimitive_non_local.proj) = i)
|
||||||
x.Pseudo.non_local
|
x.Pseudo.non_local
|
||||||
|> List.length ) pseudo
|
|> List.length ) pseudo
|
||||||
|> List.fold_left (fun accu x ->
|
|> List.fold_left (fun accu x ->
|
||||||
if accu > x then accu else x) 0
|
if accu > x then accu else x) 0
|
||||||
)
|
)
|
||||||
|> Array.fold_left (fun accu i ->
|
|> Array.fold_left (fun accu i ->
|
||||||
if i > accu then i else accu) 0
|
if i > accu then i else accu) 0
|
||||||
@ -396,11 +406,11 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
in
|
in
|
||||||
tmp_array_dz_k.(i).(j) <- y;
|
tmp_array_dz_k.(i).(j) <- y;
|
||||||
tmp_array_n_k.(i).(j) <- z;
|
tmp_array_n_k.(i).(j) <- z;
|
||||||
) x.Pseudo.local
|
) x.Pseudo.local
|
||||||
) pseudo ;
|
) pseudo ;
|
||||||
let concat_2d tmp_array =
|
let concat_2d tmp_array =
|
||||||
let data =
|
let data =
|
||||||
Array.map Array.to_list tmp_array
|
Array.map Array.to_list tmp_array
|
||||||
|> Array.to_list
|
|> Array.to_list
|
||||||
|> List.concat
|
|> List.concat
|
||||||
in
|
in
|
||||||
@ -438,14 +448,14 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
tmp_array_dz_kl.(k).(i).(j) <- y;
|
tmp_array_dz_kl.(k).(i).(j) <- y;
|
||||||
tmp_array_n_kl.(k).(i).(j) <- z;
|
tmp_array_n_kl.(k).(i).(j) <- z;
|
||||||
last_idx.(k) <- i+1;
|
last_idx.(k) <- i+1;
|
||||||
) x.Pseudo.non_local
|
) x.Pseudo.non_local
|
||||||
) pseudo ;
|
) pseudo ;
|
||||||
let concat_3d tmp_array =
|
let concat_3d tmp_array =
|
||||||
let data =
|
let data =
|
||||||
Array.map (fun x ->
|
Array.map (fun x ->
|
||||||
Array.map Array.to_list x
|
Array.map Array.to_list x
|
||||||
|> Array.to_list
|
|> Array.to_list
|
||||||
|> List.concat) tmp_array
|
|> List.concat) tmp_array
|
||||||
|> Array.to_list
|
|> Array.to_list
|
||||||
|> List.concat
|
|> List.concat
|
||||||
in
|
in
|
||||||
@ -513,8 +523,8 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
Ezfio.set_ao_basis_ao_num ao_num;
|
Ezfio.set_ao_basis_ao_num ao_num;
|
||||||
Ezfio.set_ao_basis_ao_basis b;
|
Ezfio.set_ao_basis_ao_basis b;
|
||||||
Ezfio.set_basis_basis b;
|
Ezfio.set_basis_basis b;
|
||||||
let ao_prim_num = list_map (fun (_,g,_) -> List.length g.Gto.lc) long_basis
|
let ao_prim_num = list_map (fun (_,g,_) -> List.length g.Gto.lc) long_basis
|
||||||
and ao_nucl = list_map (fun (_,_,n) -> Nucl_number.to_int n) long_basis
|
and ao_nucl = list_map (fun (_,_,n) -> Nucl_number.to_int n) long_basis
|
||||||
and ao_power=
|
and ao_power=
|
||||||
let l = list_map (fun (x,_,_) -> x) long_basis in
|
let l = list_map (fun (x,_,_) -> x) long_basis in
|
||||||
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.x)) l)@
|
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.x)) l)@
|
||||||
@ -526,7 +536,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
else s) 0 ao_prim_num
|
else s) 0 ao_prim_num
|
||||||
in
|
in
|
||||||
let gtos =
|
let gtos =
|
||||||
list_map (fun (_,x,_) -> x) long_basis
|
list_map (fun (_,x,_) -> x) long_basis
|
||||||
in
|
in
|
||||||
|
|
||||||
let create_expo_coef ec =
|
let create_expo_coef ec =
|
||||||
@ -534,10 +544,10 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
begin match ec with
|
begin match ec with
|
||||||
| `Coefs -> list_map (fun x->
|
| `Coefs -> list_map (fun x->
|
||||||
list_map (fun (_,coef) ->
|
list_map (fun (_,coef) ->
|
||||||
AO_coef.to_float coef) x.Gto.lc) gtos
|
AO_coef.to_float coef) x.Gto.lc) gtos
|
||||||
| `Expos -> list_map (fun x->
|
| `Expos -> list_map (fun x->
|
||||||
list_map (fun (prim,_) -> AO_expo.to_float
|
list_map (fun (prim,_) -> AO_expo.to_float
|
||||||
prim.GaussianPrimitive.expo) x.Gto.lc) gtos
|
prim.GaussianPrimitive.expo) x.Gto.lc) gtos
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
let rec get_n n accu = function
|
let rec get_n n accu = function
|
||||||
@ -567,7 +577,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
list_map ( fun (g,_) -> g.Gto.lc ) basis
|
list_map ( fun (g,_) -> g.Gto.lc ) basis
|
||||||
in
|
in
|
||||||
let ang_mom =
|
let ang_mom =
|
||||||
list_map (fun (l : (GaussianPrimitive.t * Qptypes.AO_coef.t) list) ->
|
list_map (fun (l : (GaussianPrimitive.t * Qptypes.AO_coef.t) list) ->
|
||||||
let x, _ = List.hd l in
|
let x, _ = List.hd l in
|
||||||
Angmom.to_l x.GaussianPrimitive.sym |> Qptypes.Positive_int.to_int
|
Angmom.to_l x.GaussianPrimitive.sym |> Qptypes.Positive_int.to_int
|
||||||
) lc
|
) lc
|
||||||
@ -577,7 +587,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
|> List.concat
|
|> List.concat
|
||||||
in
|
in
|
||||||
let coef =
|
let coef =
|
||||||
list_map (fun l ->
|
list_map (fun l ->
|
||||||
list_map (fun (_,x) -> Qptypes.AO_coef.to_float x) l
|
list_map (fun (_,x) -> Qptypes.AO_coef.to_float x) l
|
||||||
) lc
|
) lc
|
||||||
|> List.concat
|
|> List.concat
|
||||||
@ -585,12 +595,16 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
let shell_prim_num =
|
let shell_prim_num =
|
||||||
list_map List.length lc
|
list_map List.length lc
|
||||||
in
|
in
|
||||||
let shell_prim_idx =
|
let shell_idx =
|
||||||
|
let rec make_list n accu = function
|
||||||
|
| 0 -> accu
|
||||||
|
| i -> make_list n (n :: accu) (i-1)
|
||||||
|
in
|
||||||
let rec aux count accu = function
|
let rec aux count accu = function
|
||||||
| [] -> List.rev accu
|
| [] -> List.rev accu
|
||||||
| l::rest ->
|
| l::rest ->
|
||||||
let newcount = count+(List.length l) in
|
let new_l = make_list count accu (List.length l) in
|
||||||
aux newcount (count::accu) rest
|
aux (count+1) new_l rest
|
||||||
in
|
in
|
||||||
aux 1 [] lc
|
aux 1 [] lc
|
||||||
in
|
in
|
||||||
@ -602,26 +616,18 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num);
|
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num);
|
||||||
Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list
|
Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list
|
||||||
~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ;
|
~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ;
|
||||||
Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list
|
Ezfio.set_basis_shell_index (Ezfio.ezfio_array_of_list
|
||||||
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ;
|
~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ;
|
||||||
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
|
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
|
||||||
~rank:1 ~dim:[| nucl_num |]
|
~rank:1 ~dim:[| shell_num |]
|
||||||
~data:(
|
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
|
||||||
list_map (fun (_,n) -> Nucl_number.to_int n) basis
|
) ;
|
||||||
|> List.fold_left (fun accu i ->
|
|
||||||
match accu with
|
|
||||||
| [] -> []
|
|
||||||
| (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((h+1,i)::(h+1,j)::rest)
|
|
||||||
) [(0,0)]
|
|
||||||
|> List.rev
|
|
||||||
|> List.map fst
|
|
||||||
)) ;
|
|
||||||
Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list
|
Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list
|
||||||
~rank:1 ~dim:[| nucl_num |]
|
~rank:1 ~dim:[| nucl_num |]
|
||||||
~data:(
|
~data:(
|
||||||
list_map (fun (_,n) -> Nucl_number.to_int n) basis
|
list_map (fun (_,n) -> Nucl_number.to_int n) basis
|
||||||
|> List.fold_left (fun accu i ->
|
|> List.fold_left (fun accu i ->
|
||||||
match accu with
|
match accu with
|
||||||
| [] -> [(1,i)]
|
| [] -> [(1,i)]
|
||||||
| (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((1,i)::(h,j)::rest)
|
| (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((1,i)::(h,j)::rest)
|
||||||
) []
|
) []
|
||||||
@ -675,10 +681,8 @@ let () =
|
|||||||
let open Command_line in
|
let open Command_line in
|
||||||
begin
|
begin
|
||||||
"Creates an EZFIO directory from a standard xyz file or from a z-matrix file in Gaussian format. The basis set is defined as a single string if all the atoms are taken from the same basis set, otherwise specific elements can be defined as follows:
|
"Creates an EZFIO directory from a standard xyz file or from a z-matrix file in Gaussian format. The basis set is defined as a single string if all the atoms are taken from the same basis set, otherwise specific elements can be defined as follows:
|
||||||
|
|
||||||
-b \"cc-pcvdz | H:cc-pvdz | C:6-31g\"
|
-b \"cc-pcvdz | H:cc-pvdz | C:6-31g\"
|
||||||
-b \"cc-pvtz | 1,H:sto-3g | 3,H:6-31g\"
|
-b \"cc-pvtz | 1,H:sto-3g | 3,H:6-31g\"
|
||||||
|
|
||||||
If a file with the same name as the basis set exists, this file will be read. Otherwise, the basis set is obtained from the database.
|
If a file with the same name as the basis set exists, this file will be read. Otherwise, the basis set is obtained from the database.
|
||||||
" |> set_description_doc ;
|
" |> set_description_doc ;
|
||||||
set_header_doc (Sys.argv.(0) ^ " - Quantum Package command");
|
set_header_doc (Sys.argv.(0) ^ " - Quantum Package command");
|
||||||
@ -717,7 +721,7 @@ If a file with the same name as the basis set exists, this file will be read. O
|
|||||||
|
|
||||||
anonymous "FILE" Mandatory "Input file in xyz format or z-matrix.";
|
anonymous "FILE" Mandatory "Input file in xyz format or z-matrix.";
|
||||||
]
|
]
|
||||||
|> set_specs
|
|> set_specs
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -741,7 +745,7 @@ If a file with the same name as the basis set exists, this file will be read. O
|
|||||||
| None -> 0
|
| None -> 0
|
||||||
| Some x -> ( if x.[0] = 'm' then
|
| Some x -> ( if x.[0] = 'm' then
|
||||||
~- (int_of_string (String.sub x 1 (String.length x - 1)))
|
~- (int_of_string (String.sub x 1 (String.length x - 1)))
|
||||||
else
|
else
|
||||||
int_of_string x )
|
int_of_string x )
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -37,16 +37,16 @@ doc: Number of primitives in a shell
|
|||||||
size: (basis.shell_num)
|
size: (basis.shell_num)
|
||||||
interface: ezfio, provider
|
interface: ezfio, provider
|
||||||
|
|
||||||
[shell_prim_index]
|
[shell_index]
|
||||||
type: integer
|
type: integer
|
||||||
doc: Max number of primitives in a shell
|
doc: Index of the shell for each primitive
|
||||||
size: (basis.shell_num)
|
size: (basis.prim_num)
|
||||||
interface: ezfio, provider
|
interface: ezfio, provider
|
||||||
|
|
||||||
[basis_nucleus_index]
|
[basis_nucleus_index]
|
||||||
type: integer
|
type: integer
|
||||||
doc: Index of the nucleus on which the shell is centered
|
doc: Nucleus on which the shell is centered
|
||||||
size: (nuclei.nucl_num)
|
size: (basis.shell_num)
|
||||||
interface: ezfio, provider
|
interface: ezfio, provider
|
||||||
|
|
||||||
[prim_normalization_factor]
|
[prim_normalization_factor]
|
||||||
|
@ -16,9 +16,3 @@ doc: If |true|, don't use denominator
|
|||||||
default: False
|
default: False
|
||||||
interface: ezfio,provider,ocaml
|
interface: ezfio,provider,ocaml
|
||||||
|
|
||||||
[threshold_nonsym_davidson]
|
|
||||||
type: Threshold
|
|
||||||
doc: Thresholds of non-symetric Davidson's algorithm
|
|
||||||
interface: ezfio,provider,ocaml
|
|
||||||
default: 1.e-12
|
|
||||||
|
|
||||||
|
@ -652,74 +652,6 @@ subroutine save_wavefunction_general_unormalized(ndet,nstates,psidet,dim_psicoef
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
subroutine save_wavefunction_general_unormalized(ndet,nstates,psidet,dim_psicoef,psicoef)
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Save the wave function into the |EZFIO| file
|
|
||||||
END_DOC
|
|
||||||
use bitmasks
|
|
||||||
include 'constants.include.F'
|
|
||||||
integer, intent(in) :: ndet,nstates,dim_psicoef
|
|
||||||
integer(bit_kind), intent(in) :: psidet(N_int,2,ndet)
|
|
||||||
double precision, intent(in) :: psicoef(dim_psicoef,nstates)
|
|
||||||
integer*8, allocatable :: psi_det_save(:,:,:)
|
|
||||||
double precision, allocatable :: psi_coef_save(:,:)
|
|
||||||
|
|
||||||
double precision :: accu_norm
|
|
||||||
integer :: i,j,k, ndet_qp_edit
|
|
||||||
|
|
||||||
if (mpi_master) then
|
|
||||||
ndet_qp_edit = min(ndet,N_det_qp_edit)
|
|
||||||
|
|
||||||
call ezfio_set_determinants_N_int(N_int)
|
|
||||||
call ezfio_set_determinants_bit_kind(bit_kind)
|
|
||||||
call ezfio_set_determinants_N_det(ndet)
|
|
||||||
call ezfio_set_determinants_N_det_qp_edit(ndet_qp_edit)
|
|
||||||
call ezfio_set_determinants_n_states(nstates)
|
|
||||||
call ezfio_set_determinants_mo_label(mo_label)
|
|
||||||
|
|
||||||
allocate (psi_det_save(N_int,2,ndet))
|
|
||||||
do i=1,ndet
|
|
||||||
do j=1,2
|
|
||||||
do k=1,N_int
|
|
||||||
psi_det_save(k,j,i) = transfer(psidet(k,j,i),1_8)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
call ezfio_set_determinants_psi_det(psi_det_save)
|
|
||||||
call ezfio_set_determinants_psi_det_qp_edit(psi_det_save)
|
|
||||||
deallocate (psi_det_save)
|
|
||||||
|
|
||||||
allocate (psi_coef_save(ndet,nstates))
|
|
||||||
do k=1,nstates
|
|
||||||
do i=1,ndet
|
|
||||||
psi_coef_save(i,k) = psicoef(i,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call ezfio_set_determinants_psi_coef(psi_coef_save)
|
|
||||||
deallocate (psi_coef_save)
|
|
||||||
|
|
||||||
allocate (psi_coef_save(ndet_qp_edit,nstates))
|
|
||||||
do k=1,nstates
|
|
||||||
do i=1,ndet_qp_edit
|
|
||||||
psi_coef_save(i,k) = psicoef(i,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call ezfio_set_determinants_psi_coef_qp_edit(psi_coef_save)
|
|
||||||
deallocate (psi_coef_save)
|
|
||||||
|
|
||||||
call write_int(6,ndet,'Saved determinants')
|
|
||||||
endif
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine save_wavefunction_specified(ndet,nstates,psidet,psicoef,ndetsave,index_det_save)
|
subroutine save_wavefunction_specified(ndet,nstates,psidet,psicoef,ndetsave,index_det_save)
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
|
Loading…
Reference in New Issue
Block a user