mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 03:23:29 +01:00
Changed Symmetry into Angmom in OCaml
This commit is contained in:
parent
3ceea5e8b2
commit
68b33e4b35
@ -26,7 +26,7 @@ let of_string = function
|
|||||||
| "J" | "j" -> J
|
| "J" | "j" -> J
|
||||||
| "K" | "k" -> K
|
| "K" | "k" -> K
|
||||||
| "L" | "l" -> L
|
| "L" | "l" -> L
|
||||||
| x -> raise (Failure ("Symmetry should be S|P|D|F|G|H|I|J|K|L,
|
| x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L,
|
||||||
not "^x^"."))
|
not "^x^"."))
|
||||||
|
|
||||||
let of_char = function
|
let of_char = function
|
||||||
@ -40,7 +40,7 @@ let of_char = function
|
|||||||
| 'J' | 'j' -> J
|
| 'J' | 'j' -> J
|
||||||
| 'K' | 'k' -> K
|
| 'K' | 'k' -> K
|
||||||
| 'L' | 'l' -> L
|
| 'L' | 'l' -> L
|
||||||
| x -> raise (Failure ("Symmetry should be S|P|D|F|G|H|I|J|K|L"))
|
| x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L"))
|
||||||
|
|
||||||
let to_l = function
|
let to_l = function
|
||||||
| S -> Positive_int.of_int 0
|
| S -> Positive_int.of_int 0
|
||||||
@ -68,7 +68,7 @@ let of_l i =
|
|||||||
| 7 -> J
|
| 7 -> J
|
||||||
| 8 -> K
|
| 8 -> K
|
||||||
| 9 -> L
|
| 9 -> L
|
||||||
| x -> raise (Failure ("Symmetry should be S|P|D|F|G|H|I|J|K|L"))
|
| x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L"))
|
||||||
|
|
||||||
|
|
||||||
type st = t
|
type st = t
|
@ -2,14 +2,14 @@ open Qptypes
|
|||||||
open Sexplib.Std
|
open Sexplib.Std
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ sym : Symmetry.t ;
|
{ sym : Angmom.t ;
|
||||||
expo : AO_expo.t ;
|
expo : AO_expo.t ;
|
||||||
} [@@deriving sexp]
|
} [@@deriving sexp]
|
||||||
|
|
||||||
let to_string p =
|
let to_string p =
|
||||||
let { sym = s ; expo = e } = p in
|
let { sym = s ; expo = e } = p in
|
||||||
Printf.sprintf "(%s, %22e)"
|
Printf.sprintf "(%s, %22e)"
|
||||||
(Symmetry.to_string s)
|
(Angmom.to_string s)
|
||||||
(AO_expo.to_float e)
|
(AO_expo.to_float e)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ type fmt =
|
|||||||
| Gaussian
|
| Gaussian
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ sym : Symmetry.t ;
|
{ sym : Angmom.t ;
|
||||||
lc : ((GaussianPrimitive.t * AO_coef.t) list)
|
lc : ((GaussianPrimitive.t * AO_coef.t) list)
|
||||||
} [@@deriving sexp]
|
} [@@deriving sexp]
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ let read_one in_channel =
|
|||||||
in
|
in
|
||||||
let sym_str = String.sub buffer 0 2 in
|
let sym_str = String.sub buffer 0 2 in
|
||||||
let n_str = String.sub buffer 2 ((String.length buffer)-2) in
|
let n_str = String.sub buffer 2 ((String.length buffer)-2) in
|
||||||
let sym = Symmetry.of_string (String_ext.strip sym_str) in
|
let sym = Angmom.of_string (String_ext.strip sym_str) in
|
||||||
let n = int_of_string (String_ext.strip n_str) in
|
let n = int_of_string (String_ext.strip n_str) in
|
||||||
(* Read all the primitives *)
|
(* Read all the primitives *)
|
||||||
let rec read_lines result = function
|
let rec read_lines result = function
|
||||||
@ -82,7 +82,7 @@ let read_one in_channel =
|
|||||||
(** Write the GTO in Gamess format *)
|
(** Write the GTO in Gamess format *)
|
||||||
let to_string_gamess { sym = sym ; lc = lc } =
|
let to_string_gamess { sym = sym ; lc = lc } =
|
||||||
let result =
|
let result =
|
||||||
Printf.sprintf "%s %3d" (Symmetry.to_string sym) (List.length lc)
|
Printf.sprintf "%s %3d" (Angmom.to_string sym) (List.length lc)
|
||||||
in
|
in
|
||||||
let rec do_work accu i = function
|
let rec do_work accu i = function
|
||||||
| [] -> List.rev accu
|
| [] -> List.rev accu
|
||||||
@ -102,7 +102,7 @@ let to_string_gamess { sym = sym ; lc = lc } =
|
|||||||
(** Write the GTO in Gaussian format *)
|
(** Write the GTO in Gaussian format *)
|
||||||
let to_string_gaussian { sym = sym ; lc = lc } =
|
let to_string_gaussian { sym = sym ; lc = lc } =
|
||||||
let result =
|
let result =
|
||||||
Printf.sprintf "%s %3d 1.00" (Symmetry.to_string sym) (List.length lc)
|
Printf.sprintf "%s %3d 1.00" (Angmom.to_string sym) (List.length lc)
|
||||||
in
|
in
|
||||||
let rec do_work accu i = function
|
let rec do_work accu i = function
|
||||||
| [] -> List.rev accu
|
| [] -> List.rev accu
|
||||||
|
@ -5,7 +5,7 @@ type fmt =
|
|||||||
| Gaussian
|
| Gaussian
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ sym : Symmetry.t ;
|
{ sym : Angmom.t ;
|
||||||
lc : (GaussianPrimitive.t * Qptypes.AO_coef.t) list;
|
lc : (GaussianPrimitive.t * Qptypes.AO_coef.t) list;
|
||||||
} [@@deriving sexp]
|
} [@@deriving sexp]
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ module Ao_basis : sig
|
|||||||
ao_prim_num : AO_prim_number.t array;
|
ao_prim_num : AO_prim_number.t array;
|
||||||
ao_prim_num_max : AO_prim_number.t;
|
ao_prim_num_max : AO_prim_number.t;
|
||||||
ao_nucl : Nucl_number.t array;
|
ao_nucl : Nucl_number.t array;
|
||||||
ao_power : Symmetry.Xyz.t array;
|
ao_power : Angmom.Xyz.t array;
|
||||||
ao_coef : AO_coef.t array;
|
ao_coef : AO_coef.t array;
|
||||||
ao_expo : AO_expo.t array;
|
ao_expo : AO_expo.t array;
|
||||||
ao_cartesian : bool;
|
ao_cartesian : bool;
|
||||||
@ -32,7 +32,7 @@ end = struct
|
|||||||
ao_prim_num : AO_prim_number.t array;
|
ao_prim_num : AO_prim_number.t array;
|
||||||
ao_prim_num_max : AO_prim_number.t;
|
ao_prim_num_max : AO_prim_number.t;
|
||||||
ao_nucl : Nucl_number.t array;
|
ao_nucl : Nucl_number.t array;
|
||||||
ao_power : Symmetry.Xyz.t array;
|
ao_power : Angmom.Xyz.t array;
|
||||||
ao_coef : AO_coef.t array;
|
ao_coef : AO_coef.t array;
|
||||||
ao_expo : AO_expo.t array;
|
ao_expo : AO_expo.t array;
|
||||||
ao_cartesian : bool;
|
ao_cartesian : bool;
|
||||||
@ -87,7 +87,7 @@ end = struct
|
|||||||
if (data.(2*dim+i-1) > 0) then
|
if (data.(2*dim+i-1) > 0) then
|
||||||
result.(i-1) <- result.(i-1)^"z"^(string_of_int data.(2*dim+i-1));
|
result.(i-1) <- result.(i-1)^"z"^(string_of_int data.(2*dim+i-1));
|
||||||
done;
|
done;
|
||||||
Array.map Symmetry.Xyz.of_string result
|
Array.map Angmom.Xyz.of_string result
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let read_ao_coef () =
|
let read_ao_coef () =
|
||||||
@ -133,7 +133,7 @@ end = struct
|
|||||||
let ao_num = AO_number.to_int b.ao_num in
|
let ao_num = AO_number.to_int b.ao_num in
|
||||||
let gto_array = Array.init (AO_number.to_int b.ao_num)
|
let gto_array = Array.init (AO_number.to_int b.ao_num)
|
||||||
(fun i ->
|
(fun i ->
|
||||||
let s = Symmetry.Xyz.to_symmetry b.ao_power.(i) in
|
let s = Angmom.Xyz.to_symmetry b.ao_power.(i) in
|
||||||
let ao_prim_num = AO_prim_number.to_int b.ao_prim_num.(i) in
|
let ao_prim_num = AO_prim_number.to_int b.ao_prim_num.(i) in
|
||||||
let prims = List.init ao_prim_num (fun j ->
|
let prims = List.init ao_prim_num (fun j ->
|
||||||
let prim = { GaussianPrimitive.sym = s ;
|
let prim = { GaussianPrimitive.sym = s ;
|
||||||
@ -217,9 +217,9 @@ end = struct
|
|||||||
let ao_power =
|
let ao_power =
|
||||||
let l = Array.to_list ao_power in
|
let l = Array.to_list ao_power in
|
||||||
List.concat [
|
List.concat [
|
||||||
(list_map (fun a -> Positive_int.to_int a.Symmetry.Xyz.x) l) ;
|
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.x) l) ;
|
||||||
(list_map (fun a -> Positive_int.to_int a.Symmetry.Xyz.y) l) ;
|
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.y) l) ;
|
||||||
(list_map (fun a -> Positive_int.to_int a.Symmetry.Xyz.z) l) ]
|
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.z) l) ]
|
||||||
in
|
in
|
||||||
Ezfio.set_ao_basis_ao_power(Ezfio.ezfio_array_of_list
|
Ezfio.set_ao_basis_ao_power(Ezfio.ezfio_array_of_list
|
||||||
~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ;
|
~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ;
|
||||||
@ -409,7 +409,7 @@ end = struct
|
|||||||
| [] -> []
|
| [] -> []
|
||||||
| (i,n,x)::tail ->
|
| (i,n,x)::tail ->
|
||||||
(Printf.sprintf " %5d %6d %-8s\n" i (Nucl_number.to_int n)
|
(Printf.sprintf " %5d %6d %-8s\n" i (Nucl_number.to_int n)
|
||||||
(Symmetry.Xyz.to_string x)
|
(Angmom.Xyz.to_string x)
|
||||||
)::(do_work tail)
|
)::(do_work tail)
|
||||||
in do_work l
|
in do_work l
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
@ -496,7 +496,7 @@ md5 = %s
|
|||||||
(b.ao_nucl |> Array.to_list |> list_map Nucl_number.to_string |>
|
(b.ao_nucl |> Array.to_list |> list_map Nucl_number.to_string |>
|
||||||
String.concat ", ")
|
String.concat ", ")
|
||||||
(b.ao_power |> Array.to_list |> list_map (fun x->
|
(b.ao_power |> Array.to_list |> list_map (fun x->
|
||||||
"("^(Symmetry.Xyz.to_string x)^")" )|> String.concat ", ")
|
"("^(Angmom.Xyz.to_string x)^")" )|> String.concat ", ")
|
||||||
(b.ao_coef |> Array.to_list |> list_map AO_coef.to_string
|
(b.ao_coef |> Array.to_list |> list_map AO_coef.to_string
|
||||||
|> String.concat ", ")
|
|> String.concat ", ")
|
||||||
(b.ao_expo |> Array.to_list |> list_map AO_expo.to_string
|
(b.ao_expo |> Array.to_list |> list_map AO_expo.to_string
|
||||||
|
@ -2,7 +2,7 @@ open Qptypes
|
|||||||
open Qputils
|
open Qputils
|
||||||
open Sexplib.Std
|
open Sexplib.Std
|
||||||
|
|
||||||
type t = (Symmetry.Xyz.t * Gto.t * Nucl_number.t ) list [@@deriving sexp]
|
type t = (Angmom.Xyz.t * Gto.t * Nucl_number.t ) list [@@deriving sexp]
|
||||||
|
|
||||||
let of_basis b =
|
let of_basis b =
|
||||||
let rec do_work accu = function
|
let rec do_work accu = function
|
||||||
@ -10,7 +10,7 @@ let of_basis b =
|
|||||||
| (g,n)::tail ->
|
| (g,n)::tail ->
|
||||||
begin
|
begin
|
||||||
let new_accu =
|
let new_accu =
|
||||||
Symmetry.Xyz.of_symmetry g.Gto.sym
|
Angmom.Xyz.of_symmetry g.Gto.sym
|
||||||
|> List.rev_map (fun x-> (x,g,n))
|
|> List.rev_map (fun x-> (x,g,n))
|
||||||
in
|
in
|
||||||
do_work (new_accu@accu) tail
|
do_work (new_accu@accu) tail
|
||||||
@ -25,7 +25,7 @@ let to_basis b =
|
|||||||
| [] -> List.rev accu
|
| [] -> List.rev accu
|
||||||
| (s,g,n)::tail ->
|
| (s,g,n)::tail ->
|
||||||
let first_sym =
|
let first_sym =
|
||||||
Symmetry.Xyz.of_symmetry g.Gto.sym
|
Angmom.Xyz.of_symmetry g.Gto.sym
|
||||||
|> List.hd
|
|> List.hd
|
||||||
in
|
in
|
||||||
let new_accu =
|
let new_accu =
|
||||||
@ -42,7 +42,7 @@ let to_basis b =
|
|||||||
let to_string b =
|
let to_string b =
|
||||||
let middle = list_map (fun (x,y,z) ->
|
let middle = list_map (fun (x,y,z) ->
|
||||||
"( "^((string_of_int (Nucl_number.to_int z)))^", "^
|
"( "^((string_of_int (Nucl_number.to_int z)))^", "^
|
||||||
(Symmetry.Xyz.to_string x)^", "^(Gto.to_string y)
|
(Angmom.Xyz.to_string x)^", "^(Gto.to_string y)
|
||||||
^" )"
|
^" )"
|
||||||
) b
|
) b
|
||||||
|> String.concat ",\n"
|
|> String.concat ",\n"
|
||||||
|
@ -5,16 +5,16 @@ open Qptypes;;
|
|||||||
* all the D orbitals are converted to xx, xy, xz, yy, yx
|
* all the D orbitals are converted to xx, xy, xz, yy, yx
|
||||||
* etc
|
* etc
|
||||||
*)
|
*)
|
||||||
type t = (Symmetry.Xyz.t * Gto.t * Nucl_number.t) list [@@deriving sexp]
|
type t = (Angmom.Xyz.t * Gto.t * Nucl_number.t) list [@@deriving sexp]
|
||||||
|
|
||||||
(** Transform a basis to a long basis *)
|
(** Transform a basis to a long basis *)
|
||||||
val of_basis :
|
val of_basis :
|
||||||
(Gto.t * Nucl_number.t) list -> (Symmetry.Xyz.t * Gto.t * Nucl_number.t) list
|
(Gto.t * Nucl_number.t) list -> (Angmom.Xyz.t * Gto.t * Nucl_number.t) list
|
||||||
|
|
||||||
(** Transform a long basis to a basis *)
|
(** Transform a long basis to a basis *)
|
||||||
val to_basis :
|
val to_basis :
|
||||||
(Symmetry.Xyz.t * Gto.t * Nucl_number.t) list -> (Gto.t * Nucl_number.t) list
|
(Angmom.Xyz.t * Gto.t * Nucl_number.t) list -> (Gto.t * Nucl_number.t) list
|
||||||
|
|
||||||
(** Convert the basis into its string representation *)
|
(** Convert the basis into its string representation *)
|
||||||
val to_string :
|
val to_string :
|
||||||
(Symmetry.Xyz.t * Gto.t * Nucl_number.t) list -> string
|
(Angmom.Xyz.t * Gto.t * Nucl_number.t) list -> string
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
type t =
|
type t =
|
||||||
{ sym : Symmetry.t;
|
{ sym : Angmom.t;
|
||||||
expo : Qptypes.AO_expo.t;
|
expo : Qptypes.AO_expo.t;
|
||||||
} [@@deriving sexp]
|
} [@@deriving sexp]
|
||||||
|
|
||||||
@ -7,5 +7,5 @@ type t =
|
|||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
|
|
||||||
(** Creation *)
|
(** Creation *)
|
||||||
val of_sym_expo : Symmetry.t -> Qptypes.AO_expo.t -> t
|
val of_sym_expo : Angmom.t -> Qptypes.AO_expo.t -> t
|
||||||
|
|
||||||
|
@ -512,13 +512,14 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
let ao_num = List.length long_basis in
|
let ao_num = List.length long_basis in
|
||||||
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;
|
||||||
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 Symmetry.Xyz.(t.x)) l)@
|
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.x)) l)@
|
||||||
(list_map (fun t -> Positive_int.to_int Symmetry.Xyz.(t.y)) l)@
|
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.y)) l)@
|
||||||
(list_map (fun t -> Positive_int.to_int Symmetry.Xyz.(t.z)) l)
|
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.z)) l)
|
||||||
in
|
in
|
||||||
let ao_prim_num_max = List.fold_left (fun s x ->
|
let ao_prim_num_max = List.fold_left (fun s x ->
|
||||||
if x > s then x
|
if x > s then x
|
||||||
|
47
src/basis/EZFIO.cfg
Normal file
47
src/basis/EZFIO.cfg
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[basis]
|
||||||
|
type: character*(256)
|
||||||
|
doc: Name of the |AO| basis set
|
||||||
|
interface: ezfio
|
||||||
|
|
||||||
|
[shell_num]
|
||||||
|
type: integer
|
||||||
|
doc: Number of shells
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_normalization_factor]
|
||||||
|
type: double precision
|
||||||
|
doc: Number of primitives per |AO|
|
||||||
|
size: (basis.shell_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_prim_num]
|
||||||
|
type: integer
|
||||||
|
doc: Max number of primitives in a shell
|
||||||
|
size: (basis.shell_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_prim_index]
|
||||||
|
type: integer
|
||||||
|
doc: Max number of primitives in a shell
|
||||||
|
size: (basis.shell_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_nucl]
|
||||||
|
type: integer
|
||||||
|
doc: Index of the nucleus on which the shell is centered
|
||||||
|
size: (basis.shell_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_coef]
|
||||||
|
type: double precision
|
||||||
|
doc: Primitive coefficients
|
||||||
|
size: (basis.shell_prim_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
[shell_expo]
|
||||||
|
type: double precision
|
||||||
|
doc: Exponents in the shell
|
||||||
|
size: (basis.shell_prim_num)
|
||||||
|
interface: ezfio, provider
|
||||||
|
|
||||||
|
|
1
src/basis/NEED
Normal file
1
src/basis/NEED
Normal file
@ -0,0 +1 @@
|
|||||||
|
nuclei
|
8
src/basis/README.rst
Normal file
8
src/basis/README.rst
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
======
|
||||||
|
basis
|
||||||
|
======
|
||||||
|
|
||||||
|
This module contains the basis set information, which will then be used to build the atomic orbitals.
|
||||||
|
|
||||||
|
|
||||||
|
|
32
src/basis/basis.irp.f
Normal file
32
src/basis/basis.irp.f
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
BEGIN_PROVIDER [ double precision, basis_normalization_factor, (shell_num) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Normalization factors of the shells
|
||||||
|
END_DOC
|
||||||
|
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
|
||||||
|
integer :: l, powA(3), nz
|
||||||
|
integer :: i,j,k
|
||||||
|
nz=100
|
||||||
|
C_A(1) = 0.d0
|
||||||
|
C_A(2) = 0.d0
|
||||||
|
C_A(3) = 0.d0
|
||||||
|
|
||||||
|
do i=1,shell_num
|
||||||
|
powA(1) = shell_ang_mom(i)
|
||||||
|
powA(2) = 0
|
||||||
|
powA(3) = 0
|
||||||
|
|
||||||
|
! Normalization of the contracted basis functions
|
||||||
|
norm = 0.d0
|
||||||
|
do j=shell_prim_index(i), shell_prim_index(i)+shell_prim_num(i)-1
|
||||||
|
do k=shell_prim_index(i), shell_prim_index(i)+shell_prim_num(i)-1
|
||||||
|
call overlap_gaussian_xyz(C_A,C_A,shell_prim_expo(j),shell_prim_expo(k), &
|
||||||
|
powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
|
||||||
|
norm = norm+c*shell_prim_coef(j)*shell_prim_coef(k)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
basis_normalization_factor(i) = basis_normalization_factor(i) * sqrt(norm)
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
|
END_PROVIDER
|
Loading…
Reference in New Issue
Block a user