mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-21 11:03:29 +01:00
Fix basis bugs when working on trexio
This commit is contained in:
parent
7fba7a1209
commit
2a98378fca
@ -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
|
||||||
@ -610,14 +620,14 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
~rank:1 ~dim:[| prim_num |] ~data:shell_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:[| shell_num |]
|
~rank:1 ~dim:[| shell_num |]
|
||||||
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
|
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
|
||||||
) ;
|
) ;
|
||||||
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)
|
||||||
) []
|
) []
|
||||||
@ -713,7 +723,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;
|
||||||
|
|
||||||
|
|
||||||
@ -737,7 +747,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
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ type:integer
|
|||||||
interface: ezfio,provider
|
interface: ezfio,provider
|
||||||
|
|
||||||
[pseudo_n_k]
|
[pseudo_n_k]
|
||||||
doc: Number of gaussians in the local component
|
doc: Powers of r - 2 in the local component
|
||||||
type: integer
|
type: integer
|
||||||
interface: ezfio,provider
|
interface: ezfio,provider
|
||||||
size: (nuclei.nucl_num,pseudo.pseudo_klocmax)
|
size: (nuclei.nucl_num,pseudo.pseudo_klocmax)
|
||||||
@ -38,7 +38,7 @@ type:integer
|
|||||||
interface: ezfio,provider
|
interface: ezfio,provider
|
||||||
|
|
||||||
[pseudo_n_kl]
|
[pseudo_n_kl]
|
||||||
doc: Number of functions in the non-local component
|
doc: Powers of r - 2 in the non-local component
|
||||||
type: integer
|
type: integer
|
||||||
interface: ezfio,provider
|
interface: ezfio,provider
|
||||||
size: (nuclei.nucl_num,pseudo.pseudo_kmax,0:pseudo.pseudo_lmax)
|
size: (nuclei.nucl_num,pseudo.pseudo_kmax,0:pseudo.pseudo_lmax)
|
||||||
@ -69,7 +69,7 @@ default: 1000
|
|||||||
|
|
||||||
[pseudo_grid_rmax]
|
[pseudo_grid_rmax]
|
||||||
type: double precision
|
type: double precision
|
||||||
doc: R_max of the QMC grid
|
doc: R_max of the QMC grid
|
||||||
interface: ezfio,provider,ocaml
|
interface: ezfio,provider,ocaml
|
||||||
default: 10.0
|
default: 10.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user