9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-12 16:33:37 +01:00

Merge branch 'cleaning_dft' of https://github.com/QuantumPackage/qp2 into cleaning_dft

This commit is contained in:
Emmanuel Giner 2021-06-18 15:17:10 +02:00
commit a5bb1b4166
44 changed files with 835 additions and 217 deletions

View File

@ -36,8 +36,8 @@ https://arxiv.org/abs/1902.08154
# Build status
* Master [![master build status](https://travis-ci.org/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2)
* Development [![dev build status](https://travis-ci.org/QuantumPackage/qp2.svg?branch=dev)](https://travis-ci.org/QuantumPackage/qp2)
* Master [![master build status](https://travis-ci.com/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2)
* Development [![dev build status](https://travis-ci.com/QuantumPackage/qp2.svg?branch=dev)](https://travis-ci.org/QuantumPackage/qp2)
* Documentation [![Documentation Status](https://readthedocs.org/projects/quantum-package/badge/?version=master)](https://quantum-package.readthedocs.io/en/master/?badge=master)

View File

@ -29,6 +29,7 @@
- Disk-based Davidson when too much memory is required
- Fixed bug in DIIS
- Fixed bug in molden (Au -> Angs)
- Fixed bug with non-contiguous MOs in active space and deleter MOs
*** User interface
@ -52,6 +53,10 @@
- Added ~print_hamiltonian~
- Added input for two body RDM
- Added keyword ~save_wf_after_selection~
- Added a ~restore_symm~ flag to enforce the restoration of
symmetry in matrices
- qp_export_as_tgz exports also plugin codes
- Added a basis module containing basis set information
*** Code
@ -76,6 +81,8 @@
- Added ~h_core_guess~ routine
- Fixed Laplacians in real space (indices)
- Added LIB file to add extra libs in plugin
- Using Intel IPP for sorting when using Intel compiler
- Removed parallelism in sorting
ao_one_e_integral_zero
banned_excitations

1
VERSION Normal file
View File

@ -0,0 +1 @@
2.2.1

View File

@ -99,7 +99,9 @@ function find_libs () {
}
function find_exec () {
find ${QP_ROOT}/$1 -perm /u+x -type f
for i in $@ ; do
find ${QP_ROOT}/$i -perm /u+x -type f
done
}
@ -119,7 +121,7 @@ fi
echo "Copying binary files"
# --------------------
FORTRAN_EXEC=$(find_exec src)
FORTRAN_EXEC=$(find_exec src/*/)
if [[ -z $FORTRAN_EXEC ]] ; then
error 'No Fortran binaries found.'
exit 1

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32
IRPF90_FLAGS : --ninja --align=32 -DINTEL
# Global options
################

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32
IRPF90_FLAGS : --ninja --align=32 -DINTEL
# Global options
################

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
# Global options
################

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 --assert
IRPF90_FLAGS : --ninja --align=32 --assert -DINTEL
# Global options
################

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
# Global options
################

View File

@ -7,9 +7,9 @@
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32
IRPF90_FLAGS : --ninja --align=32 -DINTEL
# Global options
################
@ -31,8 +31,8 @@ OPENMP : 1 ; Append OpenMP flags
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -O2 -ip -g -march=core-avx2 -align array64byte -fma -ftz -fomit-frame-pointer
FC : -traceback -shared-intel
FCFLAGS : -O2 -ip -g -march=core-avx2 -align array64byte -fma -ftz -fomit-frame-pointer
# Profiling flags
#################

View File

@ -6,10 +6,10 @@
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=64
IRPF90_FLAGS : --ninja --align=64 -DINTEL
# Global options
################

View File

@ -3606,4 +3606,4 @@ D 5
5 1.507524E+00 2.667560E-01
D 1
1 5.030000E-01 1.000000E+00
$END
$END

View File

@ -19,4 +19,3 @@
# export QP_NIC=lo
# export QP_NIC=ib0

2
external/ezfio vendored

@ -1 +1 @@
Subproject commit ccee52d00c2cde1d628b0d34f4a247143747bf36
Subproject commit ed1df9f3c1f51752656ca98da5693a4119add05c

2
external/irpf90 vendored

@ -1 +1 @@
Subproject commit 132a4a1661c9878d21dcbf0ac14f7fe9a3b110d0
Subproject commit 33ca5e1018f3bbb5e695e6ee558f5dac0753b271

View File

@ -26,7 +26,7 @@ let of_string = function
| "J" | "j" -> J
| "K" | "k" -> K
| "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^"."))
let of_char = function
@ -40,7 +40,7 @@ let of_char = function
| 'J' | 'j' -> J
| 'K' | 'k' -> K
| '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
| S -> Positive_int.of_int 0
@ -68,7 +68,7 @@ let of_l i =
| 7 -> J
| 8 -> K
| 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

View File

@ -2,14 +2,14 @@ open Qptypes
open Sexplib.Std
type t =
{ sym : Symmetry.t ;
{ sym : Angmom.t ;
expo : AO_expo.t ;
} [@@deriving sexp]
let to_string p =
let { sym = s ; expo = e } = p in
Printf.sprintf "(%s, %22e)"
(Symmetry.to_string s)
(Angmom.to_string s)
(AO_expo.to_float e)

View File

@ -9,7 +9,7 @@ type fmt =
| Gaussian
type t =
{ sym : Symmetry.t ;
{ sym : Angmom.t ;
lc : ((GaussianPrimitive.t * AO_coef.t) list)
} [@@deriving sexp]
@ -47,7 +47,7 @@ let read_one in_channel =
in
let sym_str = String.sub buffer 0 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
(* Read all the primitives *)
let rec read_lines result = function
@ -82,7 +82,7 @@ let read_one in_channel =
(** Write the GTO in Gamess format *)
let to_string_gamess { sym = sym ; lc = lc } =
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
let rec do_work accu i = function
| [] -> List.rev accu
@ -102,7 +102,7 @@ let to_string_gamess { sym = sym ; lc = lc } =
(** Write the GTO in Gaussian format *)
let to_string_gaussian { sym = sym ; lc = lc } =
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
let rec do_work accu i = function
| [] -> List.rev accu

View File

@ -5,7 +5,7 @@ type fmt =
| Gaussian
type t =
{ sym : Symmetry.t ;
{ sym : Angmom.t ;
lc : (GaussianPrimitive.t * Qptypes.AO_coef.t) list;
} [@@deriving sexp]

View File

@ -9,7 +9,7 @@ module Ao_basis : sig
ao_prim_num : AO_prim_number.t array;
ao_prim_num_max : AO_prim_number.t;
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_expo : AO_expo.t array;
ao_cartesian : bool;
@ -32,7 +32,7 @@ end = struct
ao_prim_num : AO_prim_number.t array;
ao_prim_num_max : AO_prim_number.t;
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_expo : AO_expo.t array;
ao_cartesian : bool;
@ -87,7 +87,7 @@ end = struct
if (data.(2*dim+i-1) > 0) then
result.(i-1) <- result.(i-1)^"z"^(string_of_int data.(2*dim+i-1));
done;
Array.map Symmetry.Xyz.of_string result
Array.map Angmom.Xyz.of_string result
;;
let read_ao_coef () =
@ -133,7 +133,7 @@ end = struct
let ao_num = AO_number.to_int b.ao_num in
let gto_array = Array.init (AO_number.to_int b.ao_num)
(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 prims = List.init ao_prim_num (fun j ->
let prim = { GaussianPrimitive.sym = s ;
@ -217,9 +217,9 @@ end = struct
let ao_power =
let l = Array.to_list ao_power in
List.concat [
(list_map (fun a -> Positive_int.to_int a.Symmetry.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.Symmetry.Xyz.z) l) ]
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.x) l) ;
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.y) l) ;
(list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.z) l) ]
in
Ezfio.set_ao_basis_ao_power(Ezfio.ezfio_array_of_list
~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ;
@ -409,7 +409,7 @@ end = struct
| [] -> []
| (i,n,x)::tail ->
(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)
in do_work l
|> String.concat ""
@ -496,7 +496,7 @@ md5 = %s
(b.ao_nucl |> Array.to_list |> list_map Nucl_number.to_string |>
String.concat ", ")
(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
|> String.concat ", ")
(b.ao_expo |> Array.to_list |> list_map AO_expo.to_string

View File

@ -2,7 +2,7 @@ open Qptypes
open Qputils
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 rec do_work accu = function
@ -10,7 +10,7 @@ let of_basis b =
| (g,n)::tail ->
begin
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))
in
do_work (new_accu@accu) tail
@ -25,7 +25,7 @@ let to_basis b =
| [] -> List.rev accu
| (s,g,n)::tail ->
let first_sym =
Symmetry.Xyz.of_symmetry g.Gto.sym
Angmom.Xyz.of_symmetry g.Gto.sym
|> List.hd
in
let new_accu =
@ -42,7 +42,7 @@ let to_basis b =
let to_string b =
let middle = list_map (fun (x,y,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
|> String.concat ",\n"

View File

@ -5,16 +5,16 @@ open Qptypes;;
* all the D orbitals are converted to xx, xy, xz, yy, yx
* 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 *)
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 *)
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 *)
val to_string :
(Symmetry.Xyz.t * Gto.t * Nucl_number.t) list -> string
(Angmom.Xyz.t * Gto.t * Nucl_number.t) list -> string

View File

@ -1,5 +1,5 @@
type t =
{ sym : Symmetry.t;
{ sym : Angmom.t;
expo : Qptypes.AO_expo.t;
} [@@deriving sexp]
@ -7,5 +7,5 @@ type t =
val to_string : t -> string
(** Creation *)
val of_sym_expo : Symmetry.t -> Qptypes.AO_expo.t -> t
val of_sym_expo : Angmom.t -> Qptypes.AO_expo.t -> t

View File

@ -512,13 +512,14 @@ let run ?o b au c d m p cart xyz_file =
let ao_num = List.length long_basis in
Ezfio.set_ao_basis_ao_num ao_num;
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
and ao_nucl = list_map (fun (_,_,n) -> Nucl_number.to_int n) long_basis
and ao_power=
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 Symmetry.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.x)) l)@
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.y)) l)@
(list_map (fun t -> Positive_int.to_int Angmom.Xyz.(t.z)) l)
in
let ao_prim_num_max = List.fold_left (fun s x ->
if x > s then x
@ -561,6 +562,78 @@ let run ?o b au c d m p cart xyz_file =
and ao_expo = create_expo_coef `Expos
in
let () =
let shell_num = List.length basis in
let lc : (GaussianPrimitive.t * Qptypes.AO_coef.t) list list =
list_map ( fun (g,_) -> g.Gto.lc ) basis
in
let ang_mom =
list_map (fun (l : (GaussianPrimitive.t * Qptypes.AO_coef.t) list) ->
let x, _ = List.hd l in
Angmom.to_l x.GaussianPrimitive.sym |> Qptypes.Positive_int.to_int
) lc
in
let expo =
list_map (fun l -> list_map (fun (x,_) -> Qptypes.AO_expo.to_float x.GaussianPrimitive.expo) l ) lc
|> List.concat
in
let coef =
list_map (fun l ->
list_map (fun (_,x) -> Qptypes.AO_coef.to_float x) l
) lc
|> List.concat
in
let shell_prim_num =
list_map List.length lc
in
let shell_prim_idx =
let rec aux count accu = function
| [] -> List.rev accu
| l::rest ->
let newcount = count+(List.length l) in
aux newcount (count::accu) rest
in
aux 1 [] lc
in
let prim_num = List.length coef in
Ezfio.set_basis_typ "Gaussian";
Ezfio.set_basis_shell_num shell_num;
Ezfio.set_basis_prim_num prim_num ;
Ezfio.set_basis_shell_prim_num (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num);
Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ;
Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ;
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| nucl_num |]
~data:(
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
~rank:1 ~dim:[| nucl_num |]
~data:(
list_map (fun (_,n) -> Nucl_number.to_int n) basis
|> List.fold_left (fun accu i ->
match accu with
| [] -> [(1,i)]
| (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((1,i)::(h,j)::rest)
) []
|> List.rev
|> List.map fst
)) ;
Ezfio.set_basis_prim_coef (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| prim_num |] ~data:coef) ;
Ezfio.set_basis_prim_expo (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| prim_num |] ~data:expo) ;
Ezfio.set_ao_basis_ao_prim_num (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| ao_num |] ~data:ao_prim_num) ;
Ezfio.set_ao_basis_ao_nucl(Ezfio.ezfio_array_of_list

View File

@ -1 +1,2 @@
nuclei
basis

View File

@ -6,6 +6,23 @@ BEGIN_PROVIDER [ integer, ao_prim_num_max ]
ao_prim_num_max = maxval(ao_prim_num)
END_PROVIDER
BEGIN_PROVIDER [ integer, ao_shell, (ao_num) ]
implicit none
BEGIN_DOC
! Index of the shell to which the AO corresponds
END_DOC
integer :: i, j, k, n
k=0
do i=1,shell_num
n = shell_ang_mom(i)+1
do j=1,(n*(n+1))/2
k = k+1
ao_shell(k) = i
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalized, (ao_num,ao_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, ao_coef_normalization_factor, (ao_num) ]
implicit none
@ -23,14 +40,15 @@ END_PROVIDER
do i=1,ao_num
powA(1) = ao_power(i,1)
powA(2) = ao_power(i,2)
powA(3) = ao_power(i,3)
powA(1) = ao_power(i,1) + ao_power(i,2) + ao_power(i,3)
powA(2) = 0
powA(3) = 0
! Normalization of the primitives
if (primitives_normalized) then
do j=1,ao_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j),powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), &
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
ao_coef_normalized(i,j) = ao_coef(i,j)/sqrt(norm)
enddo
else
@ -39,6 +57,10 @@ END_PROVIDER
enddo
endif
powA(1) = ao_power(i,1)
powA(2) = ao_power(i,2)
powA(3) = ao_power(i,3)
! Normalization of the contracted basis functions
if (ao_normalized) then
norm = 0.d0
@ -56,39 +78,6 @@ END_PROVIDER
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalization_libint_factor, (ao_num) ]
implicit none
BEGIN_DOC
! |AO| normalization for interfacing with libint
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,ao_num
powA(1) = ao_l(i)
powA(2) = 0
powA(3) = 0
! Normalization of the contracted basis functions
norm = 0.d0
do j=1,ao_prim_num(i)
do k=1,ao_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k)
enddo
enddo
ao_coef_normalization_libint_factor(i) = ao_coef_normalization_factor(i) * sqrt(norm)
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalized_ordered, (ao_num,ao_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, ao_expo_ordered, (ao_num,ao_prim_num_max) ]
implicit none
@ -231,38 +220,11 @@ END_PROVIDER
END_DOC
do i = 1, nucl_num
Nucl_num_shell_Aos(i) = 0
do j = 1, Nucl_N_Aos(i)
if(ao_l(Nucl_Aos(i,j))==0)then
! S type function
Nucl_num_shell_Aos(i)+=1
Nucl_list_shell_Aos(i,Nucl_num_shell_Aos(i))=Nucl_Aos(i,j)
elseif(ao_l(Nucl_Aos(i,j))==1)then
! P type function
if(ao_power(Nucl_Aos(i,j),1)==1)then
if (ao_power(Nucl_Aos(i,j),1) == ao_l(Nucl_Aos(i,j))) then
Nucl_num_shell_Aos(i)+=1
Nucl_list_shell_Aos(i,Nucl_num_shell_Aos(i))=Nucl_Aos(i,j)
endif
elseif(ao_l(Nucl_Aos(i,j))==2)then
! D type function
if(ao_power(Nucl_Aos(i,j),1)==2)then
Nucl_num_shell_Aos(i)+=1
Nucl_list_shell_Aos(i,Nucl_num_shell_Aos(i))=Nucl_Aos(i,j)
endif
elseif(ao_l(Nucl_Aos(i,j))==3)then
! F type function
if(ao_power(Nucl_Aos(i,j),1)==3)then
Nucl_num_shell_Aos(i)+=1
Nucl_list_shell_Aos(i,Nucl_num_shell_Aos(i))=Nucl_Aos(i,j)
endif
elseif(ao_l(Nucl_Aos(i,j))==4)then
! G type function
if(ao_power(Nucl_Aos(i,j),1)==4)then
Nucl_num_shell_Aos(i)+=1
Nucl_list_shell_Aos(i,Nucl_num_shell_Aos(i))=Nucl_Aos(i,j)
endif
endif
enddo
enddo

View File

@ -96,8 +96,12 @@ end
! x=cos(theta)
double precision function ylm_real(l,m,x,phi)
implicit double precision (a-h,o-z)
DIMENSION PM(0:100,0:100)
implicit none
integer :: MM, iabs_m, m, l
double precision :: pi, fourpi, factor, x, phi, coef
double precision :: xchap, ychap, zchap
double precision, external :: fact
double precision :: PM(0:100,0:100), plm
MM=100
pi=dacos(-1.d0)
fourpi=4.d0*pi
@ -1150,8 +1154,10 @@ end
! Output: PM(m,n) --- Pmn(x)
! =====================================================
!
IMPLICIT DOUBLE PRECISION (P,X)
DIMENSION PM(0:MM,0:(N+1))
implicit none
! IMPLICIT DOUBLE PRECISION (P,X)
integer :: MM, N, I, J, M
double precision :: PM(0:MM,0:(N+1)), X, XQ, XS
DOUBLE PRECISION, SAVE :: INVERSE(100) = 0.D0
DOUBLE PRECISION :: LS, II, JJ
IF (INVERSE(1) == 0.d0) THEN
@ -1202,8 +1208,9 @@ end
! P_l^|m|(cos(theta)) exp(i m phi)
subroutine erreur(x,n,rmoy,error)
implicit double precision(a-h,o-z)
dimension x(n)
implicit none
integer :: i, n
double precision :: x(n), rn, rn1, error, rmoy
! calcul de la moyenne
rmoy=0.d0
do i=1,n

75
src/basis/EZFIO.cfg Normal file
View File

@ -0,0 +1,75 @@
[basis]
type: character*(256)
doc: Name of the |AO| basis set
interface: ezfio, provider
[typ]
type: character*(32)
doc: Type of basis set. Only 'Gaussian' is supported
interface: ezfio, provider
[shell_num]
type: integer
doc: Number of shells
interface: ezfio, provider
[nucleus_shell_num]
type: integer
doc: Number of shells per nucleus
size: (nuclei.nucl_num)
interface: ezfio, provider
[shell_normalization_factor]
type: double precision
doc: Normalization factor applied to the whole shell, ex $1/\sqrt{ <d_{z^2}|d_{z^2}>}$
size: (basis.shell_num)
interface: ezfio
[shell_ang_mom]
type: integer
doc: Angular momentum of each shell
size: (basis.shell_num)
interface: ezfio, provider
[shell_prim_num]
type: integer
doc: 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
[basis_nucleus_index]
type: integer
doc: Index of the nucleus on which the shell is centered
size: (nuclei.nucl_num)
interface: ezfio, provider
[prim_normalization_factor]
type: double precision
doc: Normalization factor applied to each primitive
size: (basis.prim_num)
interface: ezfio
[prim_num]
type: integer
doc: Total number of primitives
interface: ezfio, provider
[prim_coef]
type: double precision
doc: Primitive coefficients
size: (basis.prim_num)
interface: ezfio, provider
[prim_expo]
type: double precision
doc: Exponents in the shell
size: (basis.prim_num)
interface: ezfio, provider

1
src/basis/NEED Normal file
View File

@ -0,0 +1 @@
nuclei

8
src/basis/README.rst Normal file
View File

@ -0,0 +1,8 @@
======
basis
======
This module contains the basis set information, which will then be used to build the atomic orbitals.

119
src/basis/basis.irp.f Normal file
View File

@ -0,0 +1,119 @@
BEGIN_PROVIDER [ double precision, shell_normalization_factor , (shell_num) ]
implicit none
BEGIN_DOC
! Number of primitives per |AO|
END_DOC
logical :: has
PROVIDE ezfio_filename
if (mpi_master) then
if (size(shell_normalization_factor) == 0) return
call ezfio_has_basis_shell_normalization_factor(has)
if (has) then
write(6,'(A)') '.. >>>>> [ IO READ: shell_normalization_factor ] <<<<< ..'
call ezfio_get_basis_shell_normalization_factor(shell_normalization_factor)
else
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
norm = 0.d0
do k=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1
do j=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1
call overlap_gaussian_xyz(C_A,C_A,prim_expo(j),prim_expo(k), &
powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*prim_coef(j)*prim_coef(k) * prim_normalization_factor(j) * prim_normalization_factor(k)
enddo
enddo
shell_normalization_factor(i) = 1.d0/dsqrt(norm)
enddo
endif
endif
IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
IRP_ENDIF
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( shell_normalization_factor, (shell_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read shell_normalization_factor with MPI'
endif
IRP_ENDIF
call write_time(6)
END_PROVIDER
BEGIN_PROVIDER [ double precision, prim_normalization_factor , (prim_num) ]
implicit none
BEGIN_DOC
! Number of primitives per |AO|
END_DOC
logical :: has
PROVIDE ezfio_filename
if (mpi_master) then
if (size(prim_normalization_factor) == 0) return
call ezfio_has_basis_prim_normalization_factor(has)
if (has) then
write(6,'(A)') '.. >>>>> [ IO READ: prim_normalization_factor ] <<<<< ..'
call ezfio_get_basis_prim_normalization_factor(prim_normalization_factor)
else
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
do k=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1
call overlap_gaussian_xyz(C_A,C_A,prim_expo(k),prim_expo(k), &
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
prim_normalization_factor(k) = 1.d0/dsqrt(norm)
enddo
enddo
endif
endif
IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
IRP_ENDIF
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( prim_normalization_factor, (prim_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read prim_normalization_factor with MPI'
endif
IRP_ENDIF
call write_time(6)
END_PROVIDER

View File

@ -27,9 +27,7 @@ BEGIN_PROVIDER [ integer(bit_kind), full_ijkl_bitmask, (N_int) ]
full_ijkl_bitmask(j) = 0_bit_kind
do i=0,bit_kind_size-1
k=k+1
if (mo_class(k) /= 'Deleted') then
full_ijkl_bitmask(j) = ibset(full_ijkl_bitmask(j),i)
endif
full_ijkl_bitmask(j) = ibset(full_ijkl_bitmask(j),i)
if (k == mo_num) exit
enddo
enddo

View File

@ -286,7 +286,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
call write_int(6,nproc_target,'Number of threads for PT2')
call write_double(6,mem,'Memory (Gb)')
call omp_set_nested(.false.)
call omp_set_max_active_levels(1)
print '(A)', '========== ======================= ===================== ===================== ==========='
@ -313,6 +313,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
endif
!$OMP END PARALLEL
call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2')
call omp_set_max_active_levels(8)
print '(A)', '========== ======================= ===================== ===================== ==========='

View File

@ -253,12 +253,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
deallocate(exc_degree)
nmax=k-1
allocate(iorder(nmax))
do i=1,nmax
iorder(i) = i
enddo
call isort(indices,iorder,nmax)
deallocate(iorder)
call isort_noidx(indices,nmax)
! Start with 32 elements. Size will double along with the filtering.
allocate(preinteresting(0:32), prefullinteresting(0:32), &
@ -749,7 +744,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
double precision :: eigvalues(N_states+1)
double precision :: work(1+6*(N_states+1)+2*(N_states+1)**2)
integer :: iwork(3+5*(N_states+1)), info, k
integer :: info, k , iwork(N_states+1)
if (do_diag) then
double precision :: pt2_matrix(N_states+1,N_states+1)
@ -761,8 +756,8 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
pt2_matrix(N_states+1,istate) = mat(istate,p1,p2)
enddo
call DSYEVD( 'V', 'U', N_states+1, pt2_matrix, N_states+1, eigvalues, &
work, size(work), iwork, size(iwork), info )
call DSYEV( 'V', 'U', N_states+1, pt2_matrix, N_states+1, eigvalues, &
work, size(work), info )
if (info /= 0) then
print *, 'error in '//irp_here
stop -1
@ -770,7 +765,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
pt2_matrix = dabs(pt2_matrix)
iwork(1:N_states+1) = maxloc(pt2_matrix,DIM=1)
do k=1,N_states
e_pert(iwork(k)) = eigvalues(k) - E0(iwork(k))
e_pert(k) = eigvalues(iwork(k)) - E0(k)
enddo
endif

View File

@ -1,3 +1,9 @@
real*8 function logabsgamma(x)
implicit none
real*8, intent(in) :: x
logabsgamma = log(abs(gamma(x)))
end function logabsgamma
BEGIN_PROVIDER [ integer, NSOMOMax]
&BEGIN_PROVIDER [ integer, NCSFMax]
&BEGIN_PROVIDER [ integer*8, NMO]
@ -22,33 +28,65 @@
integer NSOMO
integer dimcsfpercfg
integer detDimperBF
real*8 :: coeff
real*8 :: coeff, binom1, binom2
integer MS
integer ncfgpersomo
real*8, external :: logabsgamma
detDimperBF = 0
MS = elec_alpha_num-elec_beta_num
! number of cfgs = number of dets for 0 somos
n_CSF = cfg_seniority_index(0)-1
n_CSF = 0
ncfgprev = cfg_seniority_index(0)
do i = 0-iand(MS,1)+2, NSOMOMax,2
if(cfg_seniority_index(i) .EQ. -1)then
ncfgpersomo = N_configuration + 1
else
ncfgpersomo = cfg_seniority_index(i)
endif
ncfg = ncfgpersomo - ncfgprev
!detDimperBF = max(1,nint((binom(i,(i+1)/2))))
if (i > 2) then
dimcsfpercfg = max(1,nint((binom(i-2,(i-2+1)/2)-binom(i-2,((i-2+1)/2)+1))))
else
dimcsfpercfg = 1
endif
n_CSF += ncfg * dimcsfpercfg
!if(cfg_seniority_index(i+2) == -1) EXIT
!if(detDimperBF > maxDetDimPerBF) maxDetDimPerBF = detDimperBF
ncfgprev = cfg_seniority_index(i)
ncfgpersomo = ncfgprev
do i = iand(MS,1), NSOMOMax-2,2
if(cfg_seniority_index(i) .EQ. -1) then
cycle
endif
if(cfg_seniority_index(i+2) .EQ. -1) then
ncfgpersomo = N_configuration + 1
else
if(cfg_seniority_index(i+2) > ncfgpersomo) then
ncfgpersomo = cfg_seniority_index(i+2)
else
k = 0
do while(cfg_seniority_index(i+2+k) < ncfgpersomo)
k = k + 2
ncfgpersomo = cfg_seniority_index(i+2+k)
enddo
endif
endif
ncfg = ncfgpersomo - ncfgprev
if(iand(MS,1) .EQ. 0) then
!dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1))))
binom1 = dexp(logabsgamma(1.0d0*(i+1)) &
- logabsgamma(1.0d0*((i/2)+1)) &
- logabsgamma(1.0d0*(i-((i/2))+1)));
binom2 = dexp(logabsgamma(1.0d0*(i+1)) &
- logabsgamma(1.0d0*(((i/2)+1)+1)) &
- logabsgamma(1.0d0*(i-((i/2)+1)+1)));
dimcsfpercfg = max(1,nint(binom1 - binom2))
else
!dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2))))
binom1 = dexp(logabsgamma(1.0d0*(i+1)) &
- logabsgamma(1.0d0*(((i+1)/2)+1)) &
- logabsgamma(1.0d0*(i-(((i+1)/2))+1)));
binom2 = dexp(logabsgamma(1.0d0*(i+1)) &
- logabsgamma(1.0d0*((((i+3)/2)+1)+1)) &
- logabsgamma(1.0d0*(i-(((i+3)/2)+1)+1)));
dimcsfpercfg = max(1,nint(binom1 - binom2))
endif
n_CSF += ncfg * dimcsfpercfg
if(cfg_seniority_index(i+2) > ncfgprev) then
ncfgprev = cfg_seniority_index(i+2)
else
k = 0
do while(cfg_seniority_index(i+2+k) < ncfgprev)
k = k + 2
ncfgprev = cfg_seniority_index(i+2+k)
enddo
endif
enddo
END_PROVIDER
END_PROVIDER
subroutine get_phase_qp_to_cfg(Ialpha, Ibeta, phaseout)

View File

@ -197,6 +197,7 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
call write_int(6,N_st,'Number of states')
call write_int(6,N_st_diag,'Number of states in diagonalization')
call write_int(6,sze,'Number of determinants')
call write_int(6,sze_csf,'Number of CSFs')
call write_int(6,nproc_target,'Number of threads for diagonalization')
call write_double(6, r1, 'Memory(Gb)')
if (disk_based) then

View File

@ -72,7 +72,7 @@ subroutine run_dress_slave(thread,iproce,energy)
provide psi_energy
ending = dress_N_cp+1
ntask_tbd = 0
call omp_set_nested(.true.)
call omp_set_max_active_levels(8)
!$OMP PARALLEL DEFAULT(SHARED) &
!$OMP PRIVATE(interesting, breve_delta_m, task_id) &
@ -84,7 +84,7 @@ subroutine run_dress_slave(thread,iproce,energy)
zmq_socket_push = new_zmq_push_socket(thread)
integer, external :: connect_to_taskserver
!$OMP CRITICAL
call omp_set_nested(.false.)
call omp_set_max_active_levels(1)
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
print *, irp_here, ': Unable to connect to task server'
stop -1
@ -296,7 +296,7 @@ subroutine run_dress_slave(thread,iproce,energy)
!$OMP END CRITICAL
!$OMP END PARALLEL
call omp_set_nested(.false.)
call omp_set_max_active_levels(1)
! do i=0,dress_N_cp+1
! call omp_destroy_lock(lck_sto(i))
! end do

View File

@ -47,10 +47,3 @@ type: Disk_access
doc: Read/Write |MO| one-electron integrals from/to disk [ Write | Read | None ]
interface: ezfio,provider,ocaml
default: None
[restore_symm]
type: logical
doc: If true, try to find symmetry in the MO coefficient matrices
interface: ezfio,provider,ocaml
default: True