mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-10-07 00:25:57 +02:00
Merge branch 'QuantumPackage:dev-stable' into dev-stable
This commit is contained in:
commit
22228b868f
1
.github/workflows/compilation.yml
vendored
1
.github/workflows/compilation.yml
vendored
@ -48,6 +48,7 @@ jobs:
|
||||
./configure -i docopt || :
|
||||
./configure -i resultsFile || :
|
||||
./configure -i bats || :
|
||||
./configure -i trexio-nohdf5 || :
|
||||
./configure -c ./config/gfortran_debug.cfg
|
||||
- name: Compilation
|
||||
run: |
|
||||
|
8
.github/workflows/configuration.yml
vendored
8
.github/workflows/configuration.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt install gfortran gcc liblapack-dev libblas-dev wget python3 make m4 pkg-config
|
||||
sudo apt install gfortran gcc liblapack-dev libblas-dev wget python3 make m4 pkg-config hdf5
|
||||
- name: zlib
|
||||
run: |
|
||||
./configure -i zlib || echo OK
|
||||
@ -50,6 +50,12 @@ jobs:
|
||||
- name: bats
|
||||
run: |
|
||||
./configure -i bats || echo OK
|
||||
- name: trexio-nohdf5
|
||||
run: |
|
||||
./configure -i trexio-nohdf5 || echo OK
|
||||
- name: trexio
|
||||
run: |
|
||||
./configure -i trexio || echo OK
|
||||
- name: Final check
|
||||
run: |
|
||||
./configure -c config/gfortran_debug.cfg
|
||||
|
52
.travis.yml
52
.travis.yml
@ -1,52 +0,0 @@
|
||||
#sudo: true
|
||||
#before_script:
|
||||
# - sudo apt-get update -q
|
||||
# - sudo apt-get remove curl
|
||||
# - sudo apt-get remove zlib1g-dev
|
||||
# - sudo apt-get install autoconf
|
||||
# - sudo rm /usr/local/bin/bats
|
||||
|
||||
os: linux
|
||||
|
||||
dist: bionic
|
||||
|
||||
sudo: false
|
||||
|
||||
compiler: gfortran
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gfortran
|
||||
- gcc
|
||||
- libatlas-base-dev
|
||||
# - liblapack-dev
|
||||
# - libblas-dev
|
||||
- wget
|
||||
|
||||
env:
|
||||
- OPAMROOT=$HOME/.opam
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.opam/
|
||||
- $HOME/cache
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "3.7"
|
||||
|
||||
stages:
|
||||
- configuration
|
||||
- compilation
|
||||
- testing
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: configuration
|
||||
script: travis/configuration.sh
|
||||
- stage: compilation
|
||||
script: travis/compilation.sh
|
||||
- stage: testing
|
||||
script: travis/testing.sh
|
||||
|
@ -9,15 +9,23 @@
|
||||
- Configure adapted for ARM
|
||||
- Added many types of integrals
|
||||
- Accelerated four-index transformation
|
||||
|
||||
*** TODO: take from dev
|
||||
- [ ] Added GTOs with complex exponent
|
||||
- Updated version of f77-zmq
|
||||
- Added transcorrelated SCF
|
||||
- Added transcorrelated CIPSI
|
||||
- Added CCSD and CCSD(T)
|
||||
- Added MO localization
|
||||
- Changed coupling parameters for ROHF
|
||||
- General Davidson algorithm
|
||||
- Accelerated restore_symmetry
|
||||
- Point charges in the Hamiltonian
|
||||
- Removed cryptokit dependency in OCaml
|
||||
- Using now standard convention in RDM
|
||||
- Added molecular properties
|
||||
- [ ] Added GTOs with complex exponent
|
||||
|
||||
*** TODO: take from dev
|
||||
- Updated version of f77-zmq
|
||||
- Started to introduce shells in AOs
|
||||
- Added ECMD UEG functional
|
||||
- General Davidson algorithm
|
||||
|
||||
* Version 2.2
|
||||
|
||||
|
@ -46,7 +46,7 @@ def main(arguments):
|
||||
append_bats(dirname, filenames)
|
||||
else:
|
||||
for (dirname, _, filenames) in os.walk(os.getcwd(), followlinks=False):
|
||||
if "IRPF90_temp" not in dirname:
|
||||
if "IRPF90_temp" not in dirname and "external" not in dirname:
|
||||
append_bats(dirname, filenames)
|
||||
l_bats = [y for _, y in sorted(l_bats)]
|
||||
|
||||
@ -67,6 +67,7 @@ def main(arguments):
|
||||
os.system(test+" python3 bats_to_sh.py "+bats_file+
|
||||
"| bash")
|
||||
else:
|
||||
# print(" ".join(["bats", "--verbose-run", "--trace", bats_file]))
|
||||
subprocess.check_call(["bats", "--verbose-run", "--trace", bats_file], env=os.environ)
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# --align=32 : Align all provided arrays on a 32-byte boundary
|
||||
#
|
||||
[COMMON]
|
||||
FC : ifort -fpic
|
||||
FC : ifort -fpic -diag-disable 5462
|
||||
LAPACK_LIB : -mkl=parallel
|
||||
IRPF90 : irpf90
|
||||
IRPF90_FLAGS : --ninja --align=64 -DINTEL
|
||||
|
39
configure
vendored
39
configure
vendored
@ -9,6 +9,8 @@ echo "QP_ROOT="$QP_ROOT
|
||||
unset CC
|
||||
unset CCXX
|
||||
|
||||
TREXIO_VERSION=2.3.2
|
||||
|
||||
# Force GCC instead of ICC for dependencies
|
||||
export CC=gcc
|
||||
|
||||
@ -189,7 +191,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then
|
||||
fi
|
||||
|
||||
if [[ ${PACKAGES} = all ]] ; then
|
||||
PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats"
|
||||
PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats trexio"
|
||||
fi
|
||||
|
||||
|
||||
@ -203,6 +205,33 @@ for PACKAGE in ${PACKAGES} ; do
|
||||
mv ninja "\${QP_ROOT}"/bin/
|
||||
EOF
|
||||
|
||||
elif [[ ${PACKAGE} = trexio-nohdf5 ]] ; then
|
||||
|
||||
VERSION=$TREXIO_VERSION
|
||||
execute << EOF
|
||||
cd "\${QP_ROOT}"/external
|
||||
wget https://github.com/TREX-CoE/trexio/releases/download/v${VERSION}/trexio-${VERSION}.tar.gz
|
||||
tar -zxf trexio-${VERSION}.tar.gz
|
||||
cd trexio-${VERSION}
|
||||
./configure --prefix=\${QP_ROOT} --without-hdf5
|
||||
make -j 8 && make -j 8 check && make -j 8 install
|
||||
cp ${QP_ROOT}/include/trexio_f.f90 ${QP_ROOT}/src/ezfio_files
|
||||
tar -zxvf "\${QP_ROOT}"/external/qp2-dependencies/${ARCHITECTURE}/ninja.tar.gz
|
||||
mv ninja "\${QP_ROOT}"/bin/
|
||||
EOF
|
||||
elif [[ ${PACKAGE} = trexio ]] ; then
|
||||
|
||||
VERSION=$TREXIO_VERSION
|
||||
execute << EOF
|
||||
cd "\${QP_ROOT}"/external
|
||||
wget https://github.com/TREX-CoE/trexio/releases/download/v${VERSION}/trexio-${VERSION}.tar.gz
|
||||
tar -zxf trexio-${VERSION}.tar.gz
|
||||
cd trexio-${VERSION}
|
||||
./configure --prefix=\${QP_ROOT}
|
||||
make -j 8 && make -j 8 check && make -j 8 install
|
||||
cp ${QP_ROOT}/include/trexio_f.f90 ${QP_ROOT}/src/ezfio_files
|
||||
EOF
|
||||
|
||||
|
||||
elif [[ ${PACKAGE} = gmp ]] ; then
|
||||
|
||||
@ -232,7 +261,7 @@ EOF
|
||||
|
||||
execute << EOF
|
||||
cd "\${QP_ROOT}"/external
|
||||
tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.2.tar.gz
|
||||
tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.?.tar.gz
|
||||
cd f77-zmq-*
|
||||
./configure --prefix=\$QP_ROOT
|
||||
export ZMQ_H="\$QP_ROOT"/include/zmq.h
|
||||
@ -338,6 +367,12 @@ if [[ ${ZEROMQ} = $(not_found) ]] ; then
|
||||
fail
|
||||
fi
|
||||
|
||||
TREXIO=$(find_lib -ltrexio)
|
||||
if [[ ${TREXIO} = $(not_found) ]] ; then
|
||||
error "TREXIO (trexio,trexio-nohdf5) is not installed. If you don't have HDF5, use trexio-nohdf5"
|
||||
fail
|
||||
fi
|
||||
|
||||
F77ZMQ=$(find_lib -lzmq -lf77zmq -lpthread)
|
||||
if [[ ${F77ZMQ} = $(not_found) ]] ; then
|
||||
error "Fortran binding of ZeroMQ (f77zmq) is not installed."
|
||||
|
5
data/basis/none
Normal file
5
data/basis/none
Normal file
@ -0,0 +1,5 @@
|
||||
$DATA
|
||||
|
||||
HYDROGEN
|
||||
|
||||
$END
|
12
etc/qp.rc
12
etc/qp.rc
@ -110,6 +110,11 @@ function qp()
|
||||
unset COMMAND
|
||||
;;
|
||||
|
||||
"test")
|
||||
shift
|
||||
qp_test $@
|
||||
;;
|
||||
|
||||
*)
|
||||
which "qp_$1" &> /dev/null
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
@ -183,7 +188,7 @@ _qp_Complete()
|
||||
;;
|
||||
esac;;
|
||||
set_file)
|
||||
COMPREPLY=( $(compgen -W "$(for i in * ; do [[ -f ${i}/ezfio/.version ]] && echo $i ; done)" -- ${cur} ) )
|
||||
COMPREPLY=( $(compgen -W "$(for i in */ $(find . -name ezfio | sed 's/ezfio$/.version/') ; do [[ -f $i ]] && echo ${i%/.version} ; done)" -- ${cur} ) )
|
||||
return 0
|
||||
;;
|
||||
plugins)
|
||||
@ -215,10 +220,15 @@ _qp_Complete()
|
||||
return 0
|
||||
;;
|
||||
esac;;
|
||||
test)
|
||||
COMPREPLY=( $(compgen -W "-v -a " -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W 'plugins set_file \
|
||||
unset_file man \
|
||||
create_ezfio \
|
||||
test \
|
||||
convert_output_to_ezfio \
|
||||
-h update' -- $cur ) )
|
||||
|
||||
|
2
external/qp2-dependencies
vendored
2
external/qp2-dependencies
vendored
@ -1 +1 @@
|
||||
Subproject commit f40bde0925808bbec0424b57bfcef1b26473a1c8
|
||||
Subproject commit e0d0e02e9f5ece138d1520106954a881ab0b8db2
|
@ -247,8 +247,7 @@ end = struct
|
||||
|
||||
|
||||
let read () =
|
||||
if (Ezfio.has_ao_basis_ao_basis ()) then
|
||||
begin
|
||||
try
|
||||
let result =
|
||||
{ ao_basis = read_ao_basis ();
|
||||
ao_num = read_ao_num () ;
|
||||
@ -267,9 +266,8 @@ end = struct
|
||||
|> MD5.to_string
|
||||
|> Ezfio.set_ao_basis_ao_md5 ;
|
||||
Some result
|
||||
end
|
||||
else
|
||||
None
|
||||
with
|
||||
| _ -> (Ezfio.set_ao_basis_ao_md5 "None" ; None)
|
||||
;;
|
||||
|
||||
|
||||
|
@ -478,6 +478,7 @@ let run ?o b au c d m p cart xyz_file =
|
||||
let nmax =
|
||||
Nucl_number.get_max ()
|
||||
in
|
||||
|
||||
let rec do_work (accu:(Atom.t*Nucl_number.t) list) (n:int) = function
|
||||
| [] -> accu
|
||||
| e::tail ->
|
||||
@ -520,141 +521,144 @@ let run ?o b au c d m p cart xyz_file =
|
||||
in
|
||||
let long_basis = Long_basis.of_basis basis in
|
||||
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 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
|
||||
else s) 0 ao_prim_num
|
||||
in
|
||||
let gtos =
|
||||
list_map (fun (_,x,_) -> x) long_basis
|
||||
in
|
||||
|
||||
let create_expo_coef ec =
|
||||
let coefs =
|
||||
begin match ec with
|
||||
| `Coefs -> list_map (fun x->
|
||||
list_map (fun (_,coef) ->
|
||||
AO_coef.to_float coef) x.Gto.lc) gtos
|
||||
| `Expos -> list_map (fun x->
|
||||
list_map (fun (prim,_) -> AO_expo.to_float
|
||||
prim.GaussianPrimitive.expo) x.Gto.lc) gtos
|
||||
end
|
||||
if ao_num > 0 then
|
||||
begin
|
||||
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 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 rec get_n n accu = function
|
||||
| [] -> List.rev accu
|
||||
| h::tail ->
|
||||
let y =
|
||||
begin match List.nth_opt h n with
|
||||
| Some x -> x
|
||||
| None -> 0.
|
||||
let ao_prim_num_max = List.fold_left (fun s x ->
|
||||
if x > s then x
|
||||
else s) 0 ao_prim_num
|
||||
in
|
||||
let gtos =
|
||||
list_map (fun (_,x,_) -> x) long_basis
|
||||
in
|
||||
|
||||
let create_expo_coef ec =
|
||||
let coefs =
|
||||
begin match ec with
|
||||
| `Coefs -> list_map (fun x->
|
||||
list_map (fun (_,coef) ->
|
||||
AO_coef.to_float coef) x.Gto.lc) gtos
|
||||
| `Expos -> list_map (fun x->
|
||||
list_map (fun (prim,_) -> AO_expo.to_float
|
||||
prim.GaussianPrimitive.expo) x.Gto.lc) gtos
|
||||
end
|
||||
in
|
||||
get_n n (y::accu) tail
|
||||
in
|
||||
let rec get_n n accu = function
|
||||
| [] -> List.rev accu
|
||||
| h::tail ->
|
||||
let y =
|
||||
begin match List.nth_opt h n with
|
||||
| Some x -> x
|
||||
| None -> 0.
|
||||
end
|
||||
in
|
||||
get_n n (y::accu) tail
|
||||
in
|
||||
let rec build accu = function
|
||||
| n when n=ao_prim_num_max -> accu
|
||||
| n -> build ( accu @ (get_n n [] coefs) ) (n+1)
|
||||
in
|
||||
build [] 0
|
||||
in
|
||||
let rec build accu = function
|
||||
| n when n=ao_prim_num_max -> accu
|
||||
| n -> build ( accu @ (get_n n [] coefs) ) (n+1)
|
||||
in
|
||||
build [] 0
|
||||
in
|
||||
|
||||
let ao_coef = create_expo_coef `Coefs
|
||||
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_idx =
|
||||
let rec make_list n accu = function
|
||||
| 0 -> accu
|
||||
| i -> make_list n (n :: accu) (i-1)
|
||||
let ao_coef = create_expo_coef `Coefs
|
||||
and ao_expo = create_expo_coef `Expos
|
||||
in
|
||||
let rec aux count accu = function
|
||||
| [] -> List.rev accu
|
||||
| l::rest ->
|
||||
let new_l = make_list count accu (List.length l) in
|
||||
aux (count+1) new_l 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_index (Ezfio.ezfio_array_of_list
|
||||
~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ;
|
||||
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
|
||||
~rank:1 ~dim:[| shell_num |]
|
||||
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
|
||||
) ;
|
||||
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) ;
|
||||
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_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
|
||||
| [] -> List.rev accu
|
||||
| l::rest ->
|
||||
let new_l = make_list count accu (List.length l) in
|
||||
aux (count+1) new_l 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_index (Ezfio.ezfio_array_of_list
|
||||
~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ;
|
||||
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
|
||||
~rank:1 ~dim:[| shell_num |]
|
||||
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
|
||||
) ;
|
||||
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
|
||||
~rank:1 ~dim:[| ao_num |] ~data:ao_nucl) ;
|
||||
Ezfio.set_ao_basis_ao_power(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ;
|
||||
Ezfio.set_ao_basis_ao_coef(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_coef) ;
|
||||
Ezfio.set_ao_basis_ao_expo(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_expo) ;
|
||||
Ezfio.set_ao_basis_ao_cartesian(cart);
|
||||
in
|
||||
match Input.Ao_basis.read () with
|
||||
| None -> failwith "Error in basis"
|
||||
| Some x -> Input.Ao_basis.write x
|
||||
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
|
||||
~rank:1 ~dim:[| ao_num |] ~data:ao_nucl) ;
|
||||
Ezfio.set_ao_basis_ao_power(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ;
|
||||
Ezfio.set_ao_basis_ao_coef(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_coef) ;
|
||||
Ezfio.set_ao_basis_ao_expo(Ezfio.ezfio_array_of_list
|
||||
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_expo) ;
|
||||
Ezfio.set_ao_basis_ao_cartesian(cart);
|
||||
in
|
||||
match Input.Ao_basis.read () with
|
||||
| None -> failwith "Error in basis"
|
||||
| Some x -> Input.Ao_basis.write x
|
||||
end
|
||||
in
|
||||
let () =
|
||||
try write_file () with
|
||||
@ -781,7 +785,7 @@ If a file with the same name as the basis set exists, this file will be read. O
|
||||
run ?o:output basis au charge dummy multiplicity pseudo cart xyz_filename
|
||||
)
|
||||
with
|
||||
| Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt
|
||||
(* | Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt *)
|
||||
| Command_line.Error txt -> Printf.eprintf "Command line error: %s\n%!" txt
|
||||
|
||||
|
||||
|
43
scripts/Hn.py
Normal file
43
scripts/Hn.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
from math import *
|
||||
arg = sys.argv
|
||||
#f = open('data_dft','r')
|
||||
n = int(sys.argv[1])
|
||||
r = float(sys.argv[2])
|
||||
f = open('H'+str(n)+'_'+str(r)+'.xyz','w')
|
||||
string=str(n)+"\n"
|
||||
f.write(string)
|
||||
string="\n"
|
||||
f.write(string)
|
||||
for i in range(n):
|
||||
x = r * cos(2.* i* pi/n)
|
||||
y = r * sin(2.* i* pi/n)
|
||||
z = 0.
|
||||
string="H "+str(x)+" "+str(y)+" "+str(z)+"\n"
|
||||
f.write(string)
|
||||
|
||||
#lines = f.readlines()
|
||||
#cipsi_dft= []
|
||||
#
|
||||
#dissoc = []
|
||||
#dissoc.append(float(-76.0179223470363))
|
||||
#dissoc.append(float(-76.0592367866993))
|
||||
#dissoc.append(float(-76.0678739715659))
|
||||
#delta_e = []
|
||||
#
|
||||
#for line in lines:
|
||||
# data = line.split()
|
||||
# if(len(data)>0):
|
||||
# dft=float(data[1])
|
||||
# fci=float(data[2])
|
||||
# e=fci+dft
|
||||
# cipsi_dft.append(e)
|
||||
#
|
||||
#print(*cipsi_dft,sep=" & ")
|
||||
#
|
||||
#for i in 0,1,2:
|
||||
# delta_e.append(1000.*(dissoc[i] - cipsi_dft[i]))
|
||||
#
|
||||
#print(*delta_e,sep=" & ")
|
||||
#
|
@ -25,7 +25,7 @@ except ImportError:
|
||||
"quantum_package.rc"))
|
||||
|
||||
print("\n".join(["", "Error:", "source %s" % f, ""]))
|
||||
sys.exit(1)
|
||||
raise
|
||||
|
||||
# Compress path
|
||||
def comp_path(path):
|
||||
@ -38,7 +38,7 @@ def comp_path(path):
|
||||
|
||||
from qp_path import QP_ROOT, QP_SRC, QP_EZFIO
|
||||
|
||||
LIB = " -lz"
|
||||
LIB = " -lz -ltrexio"
|
||||
EZFIO_LIB = join("$QP_ROOT", "lib", "libezfio_irp.a")
|
||||
ZMQ_LIB = join("$QP_ROOT", "lib", "libf77zmq.a") + " " + join("$QP_ROOT", "lib", "libzmq.a") + " -lstdc++ -lrt -ldl"
|
||||
ROOT_BUILD_NINJA = join("$QP_ROOT", "config", "build.ninja")
|
||||
|
@ -52,7 +52,7 @@ BEGIN_PROVIDER [ %(type)s, %(name)s %(size)s ]
|
||||
%(test_null_size)s
|
||||
call ezfio_has_%(ezfio_dir)s_%(ezfio_name)s(has)
|
||||
if (has) then
|
||||
write(6,'(A)') '.. >>>>> [ IO READ: %(name)s ] <<<<< ..'
|
||||
! write(6,'(A)') '.. >>>>> [ IO READ: %(name)s ] <<<<< ..'
|
||||
call ezfio_get_%(ezfio_dir)s_%(ezfio_name)s(%(name)s)
|
||||
else
|
||||
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
|
||||
@ -117,7 +117,7 @@ END_PROVIDER
|
||||
output = self.output
|
||||
name = self.name
|
||||
l_write = ["",
|
||||
" call write_time(%(output)s)",
|
||||
"! call write_time(%(output)s)",
|
||||
""]
|
||||
|
||||
self.write = "\n".join(l_write) % locals()
|
||||
@ -129,7 +129,7 @@ END_PROVIDER
|
||||
write = self.write_correspondance[self.type]
|
||||
|
||||
l_write = ["",
|
||||
" call write_time(%(output)s)",
|
||||
"! call write_time(%(output)s)",
|
||||
" call %(write)s(%(output)s, %(name)s, &",
|
||||
" '%(name)s')",
|
||||
""]
|
||||
|
@ -172,25 +172,23 @@ let run check_only ?ndet ?state ezfio_filename =
|
||||
|
||||
(* Reorder basis set *)
|
||||
begin
|
||||
let aos =
|
||||
match Input.Ao_basis.read() with
|
||||
| Some x -> x
|
||||
| _ -> assert false
|
||||
in
|
||||
let ordering = Input.Ao_basis.ordering aos in
|
||||
let test = Array.copy ordering in
|
||||
Array.sort compare test ;
|
||||
if test <> ordering then
|
||||
begin
|
||||
Printf.eprintf "Warning: Basis set is not properly ordered. Redordering.\n";
|
||||
let new_aos = Input.Ao_basis.reorder aos in
|
||||
Input.Ao_basis.write new_aos;
|
||||
match Input.Mo_basis.read() with
|
||||
| None -> ()
|
||||
| Some mos ->
|
||||
let new_mos = Input.Mo_basis.reorder mos ordering in
|
||||
Input.Mo_basis.write new_mos
|
||||
end
|
||||
match Input.Ao_basis.read() with
|
||||
| Some aos ->
|
||||
let ordering = Input.Ao_basis.ordering aos in
|
||||
let test = Array.copy ordering in
|
||||
Array.sort compare test ;
|
||||
if test <> ordering then
|
||||
begin
|
||||
Printf.eprintf "Warning: Basis set is not properly ordered. Redordering.\n";
|
||||
let new_aos = Input.Ao_basis.reorder aos in
|
||||
Input.Ao_basis.write new_aos;
|
||||
match Input.Mo_basis.read() with
|
||||
| None -> ()
|
||||
| Some mos ->
|
||||
let new_mos = Input.Mo_basis.reorder mos ordering in
|
||||
Input.Mo_basis.write new_mos
|
||||
end
|
||||
| _ -> ()
|
||||
end;
|
||||
|
||||
begin
|
||||
|
7
scripts/get_fci_conv.sh
Executable file
7
scripts/get_fci_conv.sh
Executable file
@ -0,0 +1,7 @@
|
||||
file=$1
|
||||
grep "N_det =" $1 | cut -d "=" -f 2 > N_det_tmp
|
||||
grep "E =" $file | cut -d "=" -f 2 > E_tmp
|
||||
grep "E+PT2 =" $file | cut -d "=" -f 2 | cut -d "+" -f 1 > E+PT2_tmp
|
||||
grep "E+rPT2 =" $file | cut -d "=" -f 2 | cut -d "+" -f 1 > E+rPT2_tmp
|
||||
paste N_det_tmp E_tmp E+PT2_tmp E+rPT2_tmp | column -s ' ' -t > $file.conv_fci
|
||||
rm N_det_tmp E_tmp E+PT2_tmp E+rPT2_tmp
|
2
scripts/get_fci_tc_conv.sh
Executable file
2
scripts/get_fci_tc_conv.sh
Executable file
@ -0,0 +1,2 @@
|
||||
file=$1
|
||||
grep "Ndet,E,E+PT2,E+RPT2,|PT2|=" $file | cut -d "=" -f 2 > ${file}.conv_fci_tc
|
188
scripts/qp_exc_energy.py
Executable file
188
scripts/qp_exc_energy.py
Executable file
@ -0,0 +1,188 @@
|
||||
#!/usr/bin/env python
|
||||
# Computes the error on the excitation energy of a CIPSI run.
|
||||
|
||||
def student(p,df):
|
||||
import scipy
|
||||
from scipy.stats import t
|
||||
return t.ppf(p, df)
|
||||
|
||||
|
||||
def chi2cdf(x,k):
|
||||
import scipy
|
||||
import scipy.stats
|
||||
return scipy.stats.chi2.cdf(x,k)
|
||||
|
||||
|
||||
def jarque_bera(data):
|
||||
|
||||
n = max(len(data), 2)
|
||||
norm = 1./ sum( [ w for (_,w) in data ] )
|
||||
|
||||
mu = sum( [ w* x for (x,w) in data ] ) * norm
|
||||
sigma2 = sum( [ w*(x-mu)**2 for (x,w) in data ] ) * norm
|
||||
if sigma2 > 0.:
|
||||
S = ( sum( [ w*(x-mu)**3 for (x,w) in data ] ) * norm ) / sigma2**(3./2.)
|
||||
K = ( sum( [ w*(x-mu)**4 for (x,w) in data ] ) * norm ) / sigma2**2
|
||||
else:
|
||||
S = 0.
|
||||
K = 0.
|
||||
|
||||
# Value of the Jarque-Bera test
|
||||
JB = n/6. * (S**2 + 1./4. * (K-3.)**2)
|
||||
|
||||
# Probability that the data comes from a Gaussian distribution
|
||||
p = 1. - chi2cdf(JB,2)
|
||||
|
||||
return JB, mu, sqrt(sigma2/(n-1)), p
|
||||
|
||||
|
||||
|
||||
to_eV = 27.2107362681
|
||||
import sys, os
|
||||
import scipy
|
||||
import scipy.stats
|
||||
from math import sqrt, gamma, exp
|
||||
import qp_json
|
||||
|
||||
|
||||
def read_data(ezfio_filename,state):
|
||||
""" Read energies and PT2 from input file """
|
||||
data = qp_json.load_last(ezfio_filename)
|
||||
for method in data.keys():
|
||||
x = data[method]
|
||||
lines = x
|
||||
|
||||
print(f"State: {state}")
|
||||
|
||||
gs = []
|
||||
es = []
|
||||
|
||||
for l in lines:
|
||||
try:
|
||||
pt2_0 = l['states'][0]['pt2']
|
||||
e_0 = l['states'][0]['energy']
|
||||
pt2_1 = l['states'][state]['pt2']
|
||||
e_1 = l['states'][state]['energy']
|
||||
gs.append( (e_0, pt2_0) )
|
||||
es.append( (e_1, pt2_1) )
|
||||
except: pass
|
||||
|
||||
def f(p_1, p0, p1):
|
||||
e, pt2 = p0
|
||||
y0, x0 = p_1
|
||||
y1, x1 = p1
|
||||
try:
|
||||
alpha = (y1-y0)/(x0-x1)
|
||||
except ZeroDivisionError:
|
||||
alpha = 1.
|
||||
return [e, pt2, alpha]
|
||||
|
||||
for l in (gs, es):
|
||||
p_1, p0, p1 = l[0], l[0], l[1]
|
||||
l[0] = f(p_1, p0, p1)
|
||||
|
||||
for i in range(1,len(l)-1):
|
||||
p_1 = (l[i-1][0], l[i-1][1])
|
||||
p0 = l[i]
|
||||
p1 = l[i+1]
|
||||
l[i] = f(p_1, p0, p1)
|
||||
|
||||
i = len(l)-1
|
||||
p_1 = (l[i-1][0], l[i-1][1])
|
||||
p0 = l[i]
|
||||
p1 = l[-1]
|
||||
l[i] = f(p_1, p0, p1)
|
||||
|
||||
return [ x+y for x,y in zip(gs,es) ]
|
||||
|
||||
|
||||
def compute(data):
|
||||
|
||||
d = []
|
||||
for e0, p0, a0, e1, p1, a1 in data:
|
||||
x = (e1+p1)-(e0+p0)
|
||||
w = 1./sqrt(p0**2 + p1**2)
|
||||
bias = (a1-1.)*p1 - (a0-1.)*p0
|
||||
d.append( (x,w,bias) )
|
||||
|
||||
x = []
|
||||
target = (scipy.stats.norm.cdf(1.)-0.5)*2 # = 0.6827
|
||||
|
||||
print("| %2s | %8s | %8s | %8s | %8s | %8s |"%( "N", "DE", "+/-", "bias", "P(G)", "J"))
|
||||
print("|----+----------+----------+----------+----------+----------|")
|
||||
xmax = (0.,0.,0.,0.,0.,0,0.)
|
||||
for i in range(len(data)-1):
|
||||
jb, mu, sigma, p = jarque_bera( [ (x,w) for (x,w,bias) in d[i:] ] )
|
||||
bias = sum ( [ w * e for (_,w,e) in d[i:] ] ) / sum ( [ w for (_,w,_) in d[i:] ] )
|
||||
mu = (mu+0.5*bias) * to_eV
|
||||
sigma = sigma * to_eV
|
||||
bias = bias * to_eV
|
||||
n = len(data[i:])
|
||||
beta = student(0.5*(1.+target/p) ,n)
|
||||
err = sigma * beta + 0.5*abs(bias)
|
||||
print("| %2d | %8.3f | %8.3f | %8.3f | %8.3f | %8.3f |"%( n, mu, err, bias, p, jb))
|
||||
if n < 3 :
|
||||
continue
|
||||
y = (err, p, mu, err, jb,n,bias)
|
||||
if p > xmax[1]: xmax = y
|
||||
if p < 0.8:
|
||||
continue
|
||||
x.append(y)
|
||||
|
||||
x = sorted(x)
|
||||
|
||||
print("|----+----------+----------+----------+----------+----------|")
|
||||
if x != []:
|
||||
xmax = x[0]
|
||||
_, p, mu, err, jb, n, bias = xmax
|
||||
beta = student(0.5*(1.+target/p),n)
|
||||
print("| %2d | %8.3f | %8.3f | %8.3f | %8.3f | %8.3f |\n"%(n, mu, err, bias, p, jb))
|
||||
|
||||
return mu, err, bias, p
|
||||
|
||||
ezfio_filename = sys.argv[1]
|
||||
print(ezfio_filename)
|
||||
if len(sys.argv) > 2:
|
||||
state = int(sys.argv[2])
|
||||
else:
|
||||
state = 1
|
||||
data = read_data(ezfio_filename,state)
|
||||
mu, err, bias, _ = compute(data)
|
||||
print(" %s: %8.3f +/- %5.3f eV\n"%(ezfio_filename, mu, err))
|
||||
|
||||
import numpy as np
|
||||
A = np.array( [ [ data[-1][1], 1. ],
|
||||
[ data[-2][1], 1. ] ] )
|
||||
B = np.array( [ [ data[-1][0] ],
|
||||
[ data[-2][0] ] ] )
|
||||
E0 = np.linalg.solve(A,B)[1]
|
||||
A = np.array( [ [ data[-1][4], 1. ],
|
||||
[ data[-2][4], 1. ] ] )
|
||||
B = np.array( [ [ data[-1][3] ],
|
||||
[ data[-2][3] ] ] )
|
||||
E1 = np.linalg.solve(A,B)[1]
|
||||
average_2 = (E1-E0)*to_eV
|
||||
|
||||
A = np.array( [ [ data[-1][1], 1. ],
|
||||
[ data[-2][1], 1. ],
|
||||
[ data[-3][1], 1. ] ] )
|
||||
B = np.array( [ [ data[-1][0] ],
|
||||
[ data[-2][0] ],
|
||||
[ data[-3][0] ] ] )
|
||||
E0 = np.linalg.lstsq(A,B,rcond=None)[0][1]
|
||||
A = np.array( [ [ data[-1][4], 1. ],
|
||||
[ data[-2][4], 1. ],
|
||||
[ data[-3][4], 1. ] ] )
|
||||
B = np.array( [ [ data[-1][3] ],
|
||||
[ data[-2][3] ],
|
||||
[ data[-3][3] ] ] )
|
||||
E1 = np.linalg.lstsq(A,B,rcond=None)[0][1]
|
||||
average_3 = (E1-E0)*to_eV
|
||||
|
||||
exc = ((data[-1][3] + data[-1][4]) - (data[-1][0] + data[-1][1])) * to_eV
|
||||
error_2 = abs(average_2 - average_3)
|
||||
error_3 = abs(average_3 - exc)
|
||||
print(" 2-3 points: %.3f +/- %.3f "% (average_3, error_2))
|
||||
print(" largest wf: %.3f +/- %.3f "%(average_3, error_3))
|
||||
|
||||
|
37
scripts/qp_extract_cipsi_data.py
Executable file
37
scripts/qp_extract_cipsi_data.py
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import qp_json
|
||||
import sys
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
print(f"syntax: {sys.argv[0]} EZFIO_FILE")
|
||||
|
||||
d = qp_json.load_all(sys.argv[1])
|
||||
|
||||
k = [ x for x in d.keys() ]
|
||||
k.sort()
|
||||
|
||||
print("# Energy PT2 PT2_err rPT2 rPT2_err exFCI\n")
|
||||
for f in k:
|
||||
try:
|
||||
j = d[f]["fci"]
|
||||
except:
|
||||
continue
|
||||
|
||||
print(f"# {f}")
|
||||
for e in j:
|
||||
|
||||
out = f" {e['n_det']:8d}"
|
||||
|
||||
nstates = len(e["states"])
|
||||
for ee in e["states"]:
|
||||
try:
|
||||
exc_energy = ee['ex_energy'][0]
|
||||
except:
|
||||
exc_energy = 0.
|
||||
out += f" {ee['energy']:16.8f} {ee['pt2']:e} {ee['pt2_err']:e} {ee['rpt2']:e} {ee['rpt2_err']:e} {exc_energy:16.8f}"
|
||||
print(out)
|
||||
|
||||
print("\n")
|
||||
|
||||
|
33
scripts/script_fci_tc.sh
Executable file
33
scripts/script_fci_tc.sh
Executable file
@ -0,0 +1,33 @@
|
||||
source ~/qp2/quantum_package.rc
|
||||
alpha=1.8
|
||||
input=O
|
||||
basis=cc-pvdz
|
||||
mult=3
|
||||
output=${input}_${basis}_al_${alpha}
|
||||
qp create_ezfio -b ${basis} ${input}.xyz -m $mult
|
||||
qp run scf
|
||||
qp set perturbation pt2_max 0.0001
|
||||
qp set_frozen_core
|
||||
|
||||
########## FCI CALCULATION FOR REFERENCE
|
||||
qp run fci | tee ${EZFIO_FILE}.fci.out
|
||||
qp run sort_wf
|
||||
mv ${EZFIO_FILE}.wf_sorted ${EZFIO_FILE}_fci.wf_sorted
|
||||
########### TC SCF CALCULATION
|
||||
qp reset -d
|
||||
qp set ao_two_e_erf_ints mu_erf 0.87
|
||||
qp set tc_keywords j1b_type 3
|
||||
qp set tc_keywords j1b_pen "[${alpha}]"
|
||||
qp set tc_keywords bi_ortho True
|
||||
qp set tc_keywords test_cycle_tc True
|
||||
qp set tc_keywords write_tc_integ True
|
||||
qp set tc_keywords read_tc_integ False
|
||||
qp run tc_scf | tee ${EZFIO_FILE}.tc_scf.out
|
||||
qp set tc_keywords write_tc_integ False
|
||||
qp set tc_keywords read_tc_integ True
|
||||
############ TC-FCI CALCULATION
|
||||
qp run fci_tc_bi_ortho | tee ${EZFIO_FILE}.fci_tc_bi_ortho.out
|
||||
grep "Ndet,E,E+PT2,E+RPT2,|PT2|=" ${EZFIO_FILE}.fci_tc_bi_ortho.out | cut -d "=" -f 2 > data_al_$alpha
|
||||
qp run sort_wf
|
||||
mv ${EZFIO_FILE}.wf_sorted ${EZFIO_FILE}_tc_fci.wf_sorted
|
||||
|
66
scripts/utility/qp_json.py
Normal file
66
scripts/utility/qp_json.py
Normal file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import json
|
||||
|
||||
def fix_json(s):
|
||||
"""Properly termitates an incomplete JSON file"""
|
||||
|
||||
s = s.replace(' ','')
|
||||
s = s.replace('\n','')
|
||||
s = s.replace('\t','')
|
||||
s = s.replace(",{}",'')
|
||||
tmp = [ c for c in s if c in "[]{}" ]
|
||||
tmp = "".join(tmp)
|
||||
tmp_old = ""
|
||||
while tmp != tmp_old:
|
||||
tmp_old = tmp
|
||||
tmp = tmp.replace("{}","")
|
||||
tmp = tmp.replace("[]","")
|
||||
while s[-1] in [ ',', '\n', ' ', '\t' ]:
|
||||
s = s[:-1]
|
||||
tmp = [ c for c in tmp ]
|
||||
tmp.reverse()
|
||||
for c in tmp:
|
||||
if c == '[': s += "]"
|
||||
elif c == '{': s += "}"
|
||||
return s
|
||||
|
||||
|
||||
def load(filename):
|
||||
"""Loads a JSON file after calling the fix_json function."""
|
||||
with open(filename,'r') as f:
|
||||
data = f.read()
|
||||
new_data = fix_json(data)
|
||||
return json.loads(new_data)
|
||||
|
||||
|
||||
def load_all(ezfio_filename):
|
||||
"""Loads all JSON files of an EZFIO."""
|
||||
d = {}
|
||||
prefix = ezfio_filename+'/json/'
|
||||
for filename in [ x for x in os.listdir(prefix) if x.endswith(".json")]:
|
||||
d[filename] = load(prefix+filename)
|
||||
return d
|
||||
|
||||
|
||||
def load_last(ezfio_filename):
|
||||
"""Loads last JSON file of an EZFIO."""
|
||||
d = {}
|
||||
prefix = ezfio_filename+'/json/'
|
||||
l = [ x for x in os.listdir(prefix) if x.endswith(".json")]
|
||||
l.sort()
|
||||
filename = l[-1]
|
||||
print(filename)
|
||||
return load(prefix+filename)
|
||||
|
||||
|
||||
def fix(ezfio_filename):
|
||||
"""Fixes all JSON files in an EZFIO."""
|
||||
d = load_all(ezfio_filename)
|
||||
prefix = ezfio_filename+'/json/'
|
||||
for filename in d.keys():
|
||||
with open(prefix+filename, 'w') as json_file:
|
||||
json.dump(d[filename], json_file)
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test, (ao_num, ao_n
|
||||
!$OMP expo_gauss_1_erf_x_2, coef_gauss_1_erf_x_2, &
|
||||
!$OMP List_comb_thr_b3_coef, List_comb_thr_b3_expo, &
|
||||
!$OMP List_comb_thr_b3_cent, int2_grad1u2_grad2u2_j1b2_test, ao_abs_comb_b3_j1b, &
|
||||
!$OMP ao_overlap_abs,sq_pi_3_2)
|
||||
!$OMP ao_overlap_abs,sq_pi_3_2,thrsh_cycle_tc)
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
@ -46,7 +46,7 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test, (ao_num, ao_n
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
if(ao_overlap_abs(j,i) .lt. 1.d-12) then
|
||||
if(ao_overlap_abs(j,i) .lt. thrsh_cycle_tc) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
@ -58,7 +58,7 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test, (ao_num, ao_n
|
||||
do i_fit = 1, ng_fit_jast
|
||||
expo_fit = expo_gauss_1_erf_x_2(i_fit)
|
||||
coef_fit = -0.25d0 * coef_gauss_1_erf_x_2(i_fit)
|
||||
if(dabs(coef_fit*int_j1b*sq_pi_3_2*(expo_fit)**(-1.5d0)).lt.1.d-10)cycle
|
||||
! if(dabs(coef_fit*int_j1b*sq_pi_3_2*(expo_fit)**(-1.5d0)).lt.thrsh_cycle_tc)cycle
|
||||
int_gauss = overlap_gauss_r12_ao(r, expo_fit, i, j)
|
||||
int2_grad1u2_grad2u2_j1b2_test(j,i,ipoint) += coef_fit * int_gauss
|
||||
enddo
|
||||
@ -81,8 +81,7 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test, (ao_num, ao_n
|
||||
!DIR$ FORCEINLINE
|
||||
call gaussian_product(expo_fit,r,beta,B_center,factor_ij_1s,beta_ij,center_ij_1s)
|
||||
coef_fit = -0.25d0 * coef_gauss_1_erf_x_2(i_fit) * coef
|
||||
! if(dabs(coef_fit*factor_ij_1s*int_j1b).lt.1.d-10)cycle ! old version
|
||||
if(dabs(coef_fit*factor_ij_1s*int_j1b*sq_pi_3_2*(beta_ij)**(-1.5d0)).lt.1.d-10)cycle
|
||||
! if(dabs(coef_fit*factor_ij_1s*int_j1b*sq_pi_3_2*(beta_ij)**(-1.5d0)).lt.thrsh_cycle_tc)cycle
|
||||
! call overlap_gauss_r12_ao_with1s_v(B_center, beta, final_grid_points_transp, &
|
||||
! expo_fit, i, j, int_fit_v, n_points_final_grid)
|
||||
int_gauss = overlap_gauss_r12_ao_with1s(B_center, beta, r, expo_fit, i, j)
|
||||
@ -145,14 +144,14 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test_v, (ao_num, ao
|
||||
!$OMP expo_gauss_1_erf_x_2, coef_gauss_1_erf_x_2, &
|
||||
!$OMP List_comb_thr_b3_coef, List_comb_thr_b3_expo, &
|
||||
!$OMP List_comb_thr_b3_cent, big_array,&
|
||||
!$OMP ao_abs_comb_b3_j1b,ao_overlap_abs)
|
||||
!$OMP ao_abs_comb_b3_j1b,ao_overlap_abs,thrsh_cycle_tc)
|
||||
!
|
||||
allocate(int_fit_v(n_points_final_grid))
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
if(ao_overlap_abs(j,i) .lt. 1.d-12) then
|
||||
if(ao_overlap_abs(j,i) .lt. thrsh_cycle_tc) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
@ -161,7 +160,6 @@ BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2_test_v, (ao_num, ao
|
||||
coef = List_comb_thr_b3_coef (i_1s,j,i)
|
||||
beta = List_comb_thr_b3_expo (i_1s,j,i)
|
||||
int_j1b = ao_abs_comb_b3_j1b(i_1s,j,i)
|
||||
! if(dabs(coef)*dabs(int_j1b).lt.1.d-15)cycle
|
||||
B_center(1) = List_comb_thr_b3_cent(1,i_1s,j,i)
|
||||
B_center(2) = List_comb_thr_b3_cent(2,i_1s,j,i)
|
||||
B_center(3) = List_comb_thr_b3_cent(3,i_1s,j,i)
|
||||
@ -243,7 +241,7 @@ BEGIN_PROVIDER [ double precision, int2_u2_j1b2_test, (ao_num, ao_num, n_points_
|
||||
!$OMP final_grid_points, ng_fit_jast, &
|
||||
!$OMP expo_gauss_j_mu_x_2, coef_gauss_j_mu_x_2, &
|
||||
!$OMP List_comb_thr_b3_coef, List_comb_thr_b3_expo,sq_pi_3_2, &
|
||||
!$OMP List_comb_thr_b3_cent, int2_u2_j1b2_test,ao_abs_comb_b3_j1b)
|
||||
!$OMP List_comb_thr_b3_cent, int2_u2_j1b2_test,ao_abs_comb_b3_j1b,thrsh_cycle_tc)
|
||||
!$OMP DO
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
@ -260,11 +258,11 @@ BEGIN_PROVIDER [ double precision, int2_u2_j1b2_test, (ao_num, ao_num, n_points_
|
||||
! --- --- ---
|
||||
|
||||
int_j1b = ao_abs_comb_b3_j1b(1,j,i)
|
||||
if(dabs(int_j1b).lt.1.d-10) cycle
|
||||
if(dabs(int_j1b).lt.thrsh_cycle_tc) cycle
|
||||
do i_fit = 1, ng_fit_jast
|
||||
expo_fit = expo_gauss_j_mu_x_2(i_fit)
|
||||
coef_fit = coef_gauss_j_mu_x_2(i_fit)
|
||||
if(dabs(coef_fit*int_j1b*sq_pi_3_2*(expo_fit)**(-1.5d0)).lt.1.d-10)cycle
|
||||
! if(dabs(coef_fit*int_j1b*sq_pi_3_2*(expo_fit)**(-1.5d0)).lt.thrsh_cycle_tc)cycle
|
||||
int_fit = overlap_gauss_r12_ao(r, expo_fit, i, j)
|
||||
tmp += coef_fit * int_fit
|
||||
enddo
|
||||
@ -278,7 +276,7 @@ BEGIN_PROVIDER [ double precision, int2_u2_j1b2_test, (ao_num, ao_num, n_points_
|
||||
coef = List_comb_thr_b3_coef (i_1s,j,i)
|
||||
beta = List_comb_thr_b3_expo (i_1s,j,i)
|
||||
int_j1b = ao_abs_comb_b3_j1b(i_1s,j,i)
|
||||
if(dabs(coef)*dabs(int_j1b).lt.1.d-10)cycle
|
||||
! if(dabs(coef)*dabs(int_j1b).lt.thrsh_cycle_tc)cycle
|
||||
B_center(1) = List_comb_thr_b3_cent(1,i_1s,j,i)
|
||||
B_center(2) = List_comb_thr_b3_cent(2,i_1s,j,i)
|
||||
B_center(3) = List_comb_thr_b3_cent(3,i_1s,j,i)
|
||||
@ -288,8 +286,7 @@ BEGIN_PROVIDER [ double precision, int2_u2_j1b2_test, (ao_num, ao_num, n_points_
|
||||
coef_fit = coef_gauss_j_mu_x_2(i_fit)
|
||||
!DIR$ FORCEINLINE
|
||||
call gaussian_product(expo_fit,r,beta,B_center,factor_ij_1s,beta_ij,center_ij_1s)
|
||||
! if(dabs(coef_fit*coef*factor_ij_1s*int_j1b).lt.1.d-10)cycle ! old version
|
||||
if(dabs(coef_fit*coef*factor_ij_1s*int_j1b*sq_pi_3_2*(beta_ij)**(-1.5d0)).lt.1.d-10)cycle
|
||||
! if(dabs(coef_fit*coef*factor_ij_1s*int_j1b*sq_pi_3_2*(beta_ij)**(-1.5d0)).lt.thrsh_cycle_tc)cycle
|
||||
int_fit = overlap_gauss_r12_ao_with1s(B_center, beta, r, expo_fit, i, j)
|
||||
tmp += coef * coef_fit * int_fit
|
||||
enddo
|
||||
@ -350,7 +347,7 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_x_j1b2_test, (ao_num, ao_num, n
|
||||
!$OMP final_grid_points, ng_fit_jast, &
|
||||
!$OMP expo_gauss_j_mu_1_erf, coef_gauss_j_mu_1_erf, &
|
||||
!$OMP List_comb_thr_b3_coef, List_comb_thr_b3_expo, &
|
||||
!$OMP List_comb_thr_b3_cent, int2_u_grad1u_x_j1b2_test,ao_abs_comb_b3_j1b,sq_pi_3_2)
|
||||
!$OMP List_comb_thr_b3_cent, int2_u_grad1u_x_j1b2_test,ao_abs_comb_b3_j1b,sq_pi_3_2,thrsh_cycle_tc)
|
||||
!$OMP DO
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
@ -369,7 +366,7 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_x_j1b2_test, (ao_num, ao_num, n
|
||||
coef = List_comb_thr_b3_coef (i_1s,j,i)
|
||||
beta = List_comb_thr_b3_expo (i_1s,j,i)
|
||||
int_j1b = ao_abs_comb_b3_j1b(i_1s,j,i)
|
||||
if(dabs(coef)*dabs(int_j1b).lt.1.d-10)cycle
|
||||
if(dabs(coef)*dabs(int_j1b).lt.thrsh_cycle_tc)cycle
|
||||
B_center(1) = List_comb_thr_b3_cent(1,i_1s,j,i)
|
||||
B_center(2) = List_comb_thr_b3_cent(2,i_1s,j,i)
|
||||
B_center(3) = List_comb_thr_b3_cent(3,i_1s,j,i)
|
||||
@ -392,8 +389,7 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_x_j1b2_test, (ao_num, ao_num, n
|
||||
expo_coef_1s = beta * expo_fit * alpha_1s_inv * dist
|
||||
coef_tmp = coef * coef_fit * dexp(-expo_coef_1s)
|
||||
sq_alpha = alpha_1s_inv * dsqrt(alpha_1s_inv)
|
||||
! if(dabs(coef_tmp*int_j1b) .lt. 1d-10) cycle ! old version
|
||||
if(dabs(coef_tmp*int_j1b*sq_pi_3_2*sq_alpha) .lt. 1d-10) cycle
|
||||
! if(dabs(coef_tmp*int_j1b*sq_pi_3_2*sq_alpha) .lt. thrsh_cycle_tc) cycle
|
||||
|
||||
call NAI_pol_x_mult_erf_ao_with1s(i, j, alpha_1s, centr_1s, 1.d+9, r, int_fit)
|
||||
|
||||
@ -470,13 +466,13 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_j1b2_test, (ao_num, ao_num, n_p
|
||||
!$OMP expo_gauss_j_mu_1_erf, coef_gauss_j_mu_1_erf, &
|
||||
!$OMP ao_prod_dist_grid, ao_prod_sigma, ao_overlap_abs_grid,ao_prod_center,dsqpi_3_2, &
|
||||
!$OMP List_comb_thr_b3_coef, List_comb_thr_b3_expo, ao_abs_comb_b3_j1b, &
|
||||
!$OMP List_comb_thr_b3_cent, int2_u_grad1u_j1b2_test)
|
||||
!$OMP List_comb_thr_b3_cent, int2_u_grad1u_j1b2_test,thrsh_cycle_tc)
|
||||
!$OMP DO
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
if(dabs(ao_overlap_abs_grid(j,i)).lt.1.d-10) cycle
|
||||
if(dabs(ao_overlap_abs_grid(j,i)).lt.thrsh_cycle_tc) cycle
|
||||
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
@ -489,10 +485,10 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_j1b2_test, (ao_num, ao_num, n_p
|
||||
! --- --- ---
|
||||
|
||||
int_j1b = ao_abs_comb_b3_j1b(1,j,i)
|
||||
if(dabs(int_j1b).lt.1.d-10) cycle
|
||||
! if(dabs(int_j1b).lt.thrsh_cycle_tc) cycle
|
||||
do i_fit = 1, ng_fit_jast
|
||||
expo_fit = expo_gauss_j_mu_1_erf(i_fit)
|
||||
if(dabs(int_j1b)*dsqpi_3_2*expo_fit**(-1.5d0).lt.1.d-15) cycle
|
||||
! if(dabs(int_j1b)*dsqpi_3_2*expo_fit**(-1.5d0).lt.thrsh_cycle_tc) cycle
|
||||
coef_fit = coef_gauss_j_mu_1_erf(i_fit)
|
||||
int_fit = NAI_pol_mult_erf_ao_with1s(i, j, expo_fit, r, 1.d+9, r)
|
||||
tmp += coef_fit * int_fit
|
||||
@ -507,7 +503,7 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_j1b2_test, (ao_num, ao_num, n_p
|
||||
coef = List_comb_thr_b3_coef (i_1s,j,i)
|
||||
beta = List_comb_thr_b3_expo (i_1s,j,i)
|
||||
int_j1b = ao_abs_comb_b3_j1b(i_1s,j,i)
|
||||
if(dabs(coef)*dabs(int_j1b).lt.1.d-10)cycle
|
||||
! if(dabs(coef)*dabs(int_j1b).lt.thrsh_cycle_tc)cycle
|
||||
B_center(1) = List_comb_thr_b3_cent(1,i_1s,j,i)
|
||||
B_center(2) = List_comb_thr_b3_cent(2,i_1s,j,i)
|
||||
B_center(3) = List_comb_thr_b3_cent(3,i_1s,j,i)
|
||||
@ -517,7 +513,7 @@ BEGIN_PROVIDER [ double precision, int2_u_grad1u_j1b2_test, (ao_num, ao_num, n_p
|
||||
do i_fit = 1, ng_fit_jast
|
||||
expo_fit = expo_gauss_j_mu_1_erf(i_fit)
|
||||
call gaussian_product(expo_fit,r,beta,B_center,factor_ij_1s,beta_ij,center_ij_1s)
|
||||
if(factor_ij_1s*dabs(coef*int_j1b)*dsqpi_3_2*beta_ij**(-1.5d0).lt.1.d-15)cycle
|
||||
! if(factor_ij_1s*dabs(coef*int_j1b)*dsqpi_3_2*beta_ij**(-1.5d0).lt.thrsh_cycle_tc)cycle
|
||||
coef_fit = coef_gauss_j_mu_1_erf(i_fit)
|
||||
|
||||