9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-30 15:15:38 +01:00

Merge Master (#69)

* Changed native into SSE4.2 in gfortran.cfg

* Fixed rm opam_installer

* Fix configure

* Improving scaling of pt2 with network

* Router/dealer in qp_tunnel

* Reduced size of qp2.png

* Exclude temp files in tar

* Introduce NO_CACHE in configure for daily test

* Faster determinants in OCaml

* We always give max 10k dets in qp_edit. Read-only if more

* Fixed save_natorb

* Fixing bug in qp_edit

* Comments

* Biblio (#61)

* Biblio (#62)

* Update biblio

* Update paper

* Journal missing in research.bib

* Added paper

* Fixed Pierre Francois

* Checking number of electrons in MOs

* Biblio (#64)

* Update biblio

* Update paper

* Journal missing in research.bib

* Added paper

* Fixed Pierre Francois

* 2 papers

* Fixed 6-31G and quickstart (#65)

* Fixed 6-31 basis sets

* Bug in quickstart

* Biblio (#66)

* Bugfix (#67)

* Fixing opam installation

* Fixed 6-31 basis sets

* Bug in quickstart

* Use irpf90 v1.7.6

* Fix IRPF90 Path
This commit is contained in:
Anthony Scemama 2019-10-21 16:45:00 +02:00 committed by GitHub
parent bfe52ed56f
commit cebc19a601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 647 additions and 411 deletions

80
configure vendored
View File

@ -9,6 +9,22 @@ eval set -- "$TEMP"
export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )" export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
echo "QP_ROOT="$QP_ROOT echo "QP_ROOT="$QP_ROOT
# When updating version, update also etc files
BATS_URL="https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz"
BUBBLE_URL="https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz"
DOCOPT_URL="https://github.com/docopt/docopt/archive/0.6.2.tar.gz"
EZFIO_URL="https://gitlab.com/scemama/EZFIO/-/archive/v1.4.0/EZFIO-v1.4.0.tar.gz"
F77ZMQ_URL="https://github.com/scemama/f77_zmq/archive/v4.2.5.tar.gz"
GMP_URL="ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2"
IRPF90_URL="https://gitlab.com/scemama/irpf90/-/archive/v1.7.6/irpf90-v1.7.6.tar.gz"
LIBCAP_URL="https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz"
NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip"
OCAML_URL="https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh"
RESULTS_URL="https://gitlab.com/scemama/resultsFile/-/archive/master/resultsFile-master.tar.gz"
ZEROMQ_URL="https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz"
ZLIB_URL="https://www.zlib.net/zlib-1.2.11.tar.gz"
function help() function help()
{ {
@ -183,9 +199,7 @@ for PACKAGE in ${PACKAGES} ; do
if [[ ${PACKAGE} = ninja ]] ; then if [[ ${PACKAGE} = ninja ]] ; then
download \ download ${NINJA_URL} "${QP_ROOT}"/external/ninja.zip
"https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" \
"${QP_ROOT}"/external/ninja.zip
execute << EOF execute << EOF
rm -f "\${QP_ROOT}"/bin/ninja rm -f "\${QP_ROOT}"/bin/ninja
unzip "\${QP_ROOT}"/external/ninja.zip -d "\${QP_ROOT}"/bin unzip "\${QP_ROOT}"/external/ninja.zip -d "\${QP_ROOT}"/bin
@ -194,9 +208,7 @@ EOF
elif [[ ${PACKAGE} = gmp ]] ; then elif [[ ${PACKAGE} = gmp ]] ; then
download \ download ${GMP_URL} "${QP_ROOT}"/external/gmp.tar.bz2
"ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2" \
"${QP_ROOT}"/external/gmp.tar.bz2
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --bzip2 --extract --file gmp.tar.bz2 tar --bzip2 --extract --file gmp.tar.bz2
@ -208,9 +220,7 @@ EOF
elif [[ ${PACKAGE} = libcap ]] ; then elif [[ ${PACKAGE} = libcap ]] ; then
download \ download ${LIBCAP_URL} "${QP_ROOT}"/external/libcap.tar.gz
"https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz" \
"${QP_ROOT}"/external/libcap.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file libcap.tar.gz tar --gunzip --extract --file libcap.tar.gz
@ -221,9 +231,7 @@ EOF
elif [[ ${PACKAGE} = bwrap ]] ; then elif [[ ${PACKAGE} = bwrap ]] ; then
download \ download ${BUBBLE_URL} "${QP_ROOT}"/external/bwrap.tar.xz
"https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz" \
"${QP_ROOT}"/external/bwrap.tar.xz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --xz --extract --file bwrap.tar.xz tar --xz --extract --file bwrap.tar.xz
@ -236,9 +244,7 @@ EOF
elif [[ ${PACKAGE} = irpf90 ]] ; then elif [[ ${PACKAGE} = irpf90 ]] ; then
# When changing version of irpf90, don't forget to update etc/irpf90.rc # When changing version of irpf90, don't forget to update etc/irpf90.rc
download \ download ${IRPF90_URL} "${QP_ROOT}"/external/irpf90.tar.gz
"https://gitlab.com/scemama/irpf90/-/archive/v1.7.5/irpf90-v1.7.5.tar.gz" \
"${QP_ROOT}"/external/irpf90.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file irpf90.tar.gz tar --gunzip --extract --file irpf90.tar.gz
@ -250,9 +256,7 @@ EOF
elif [[ ${PACKAGE} = zeromq ]] ; then elif [[ ${PACKAGE} = zeromq ]] ; then
download \ download ${ZEROMQ_URL} "${QP_ROOT}"/external/zeromq.tar.gz
"https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz" \
"${QP_ROOT}"/external/zeromq.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file zeromq.tar.gz tar --gunzip --extract --file zeromq.tar.gz
@ -266,9 +270,7 @@ EOF
elif [[ ${PACKAGE} = f77zmq ]] ; then elif [[ ${PACKAGE} = f77zmq ]] ; then
download \ download ${F77ZMQ_URL} "${QP_ROOT}"/external/f77_zmq.tar.gz
"https://github.com/scemama/f77_zmq/archive/v4.2.5.tar.gz" \
"${QP_ROOT}"/external/f77_zmq.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file f77_zmq.tar.gz tar --gunzip --extract --file f77_zmq.tar.gz
@ -284,9 +286,7 @@ EOF
elif [[ ${PACKAGE} = ocaml ]] ; then elif [[ ${PACKAGE} = ocaml ]] ; then
download \ download ${OCAML_URL} "${QP_ROOT}"/external/opam_installer.sh
"https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh" \
"${QP_ROOT}"/external/opam_installer.sh
if [[ -n ${TRAVIS} ]] ; then if [[ -n ${TRAVIS} ]] ; then
# Special commands for Travis CI # Special commands for Travis CI
@ -338,9 +338,7 @@ EOF
elif [[ ${PACKAGE} = ezfio ]] ; then elif [[ ${PACKAGE} = ezfio ]] ; then
download \ download ${EZFIO_URL} "${QP_ROOT}"/external/ezfio.tar.gz
"https://gitlab.com/scemama/EZFIO/-/archive/v1.4.0/EZFIO-v1.4.0.tar.gz" \
"${QP_ROOT}"/external/ezfio.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file ezfio.tar.gz tar --gunzip --extract --file ezfio.tar.gz
@ -351,9 +349,7 @@ EOF
elif [[ ${PACKAGE} = zlib ]] ; then elif [[ ${PACKAGE} = zlib ]] ; then
download \ download ${ZLIB_URL} "${QP_ROOT}"/external/zlib.tar.gz
"https://www.zlib.net/zlib-1.2.11.tar.gz" \
"${QP_ROOT}"/external/zlib.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file zlib.tar.gz tar --gunzip --extract --file zlib.tar.gz
@ -366,9 +362,7 @@ EOF
elif [[ ${PACKAGE} = docopt ]] ; then elif [[ ${PACKAGE} = docopt ]] ; then
download \ download ${DOCOPT_URL} "${QP_ROOT}"/external/docopt.tar.gz
"https://github.com/docopt/docopt/archive/0.6.2.tar.gz" \
"${QP_ROOT}"/external/docopt.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file docopt.tar.gz tar --gunzip --extract --file docopt.tar.gz
@ -379,9 +373,7 @@ EOF
elif [[ ${PACKAGE} = resultsFile ]] ; then elif [[ ${PACKAGE} = resultsFile ]] ; then
download \ download ${RESULTS_URL} "${QP_ROOT}"/external/resultsFile.tar.gz
"https://gitlab.com/scemama/resultsFile/-/archive/master/resultsFile-master.tar.gz" \
"${QP_ROOT}"/external/resultsFile.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file resultsFile.tar.gz tar --gunzip --extract --file resultsFile.tar.gz
@ -391,9 +383,7 @@ EOF
elif [[ ${PACKAGE} = bats ]] ; then elif [[ ${PACKAGE} = bats ]] ; then
download \ download ${BATS_URL} "${QP_ROOT}"/external/bats.tar.gz
"https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz" \
"${QP_ROOT}"/external/bats.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar -zxf bats.tar.gz tar -zxf bats.tar.gz
@ -438,18 +428,18 @@ if [[ ${ZLIB} = $(not_found) ]] ; then
fail fail
fi fi
BWRAP=$(find_exe bwrap)
if [[ ${BWRAP} = $(not_found) ]] ; then
error "Bubblewrap (bwrap) is not installed."
fail
fi
LIBCAP=$(find_lib -lcap) LIBCAP=$(find_lib -lcap)
if [[ ${LIBCAP} = $(not_found) ]] ; then if [[ ${LIBCAP} = $(not_found) ]] ; then
error "Libcap (libcap) is not installed." error "Libcap (libcap) is not installed."
fail fail
fi fi
BWRAP=$(find_exe bwrap)
if [[ ${BWRAP} = $(not_found) ]] ; then
error "Bubblewrap (bwrap) is not installed."
fail
fi
OPAM=$(find_exe opam) OPAM=$(find_exe opam)
if [[ ${OPAM} = $(not_found) ]] ; then if [[ ${OPAM} = $(not_found) ]] ; then
error "OPAM (ocaml) package manager is not installed." error "OPAM (ocaml) package manager is not installed."

View File

@ -8,6 +8,16 @@ S 1
S 1 S 1
1 0.0360000 1.0000000 1 0.0360000 1.0000000
HELIUM
S 3
1 0.3842163400E+02 0.4013973935E-01
2 0.5778030000E+01 0.2612460970E+00
3 0.1241774000E+01 0.7931846246E+00
S 1
1 0.2979640000E+00 1.0000000
S 1
1 0.8600000000E-01 0.1000000000E+01
LITHIUM LITHIUM
S 6 S 6
1 642.4189200 0.0021426 1 642.4189200 0.0021426

View File

@ -1,14 +1,27 @@
HYDROGEN HYDROGEN
S 3 S 3
1 18.7311370 0.03349460 1 0.1873113696E+02 0.3349460434E-01
2 2.8253937 0.23472695 2 0.2825394365E+01 0.2347269535E+00
3 0.6401217 0.81375733 3 0.6401216923E+00 0.8137573261E+00
S 1 S 1
1 0.1612778 1.0000000 1 0.1612777588E+00 1.0000000
S 1 S 1
1 0.0360000 1.0000000 1 0.3600000000E-01 0.1000000000E+01
P 1 P 1
1 1.1000000 1.0000000 1 0.1100000000E+01 1.0000000
HELIUM
S 3
1 0.3842163400E+02 0.4013973935E-01
2 0.5778030000E+01 0.2612460970E+00
3 0.1241774000E+01 0.7931846246E+00
S 1
1 0.2979640000E+00 1.0000000
S 1
1 0.8600000000E-01 0.1000000000E+01
P 1
1 0.1100000000E+01 1.0000000
LITHIUM LITHIUM
S 6 S 6

View File

@ -1,3 +1,19 @@
HYDROGEN
S 3
1 0.1873113696E+02 0.3349460434E-01
2 0.2825394365E+01 0.2347269535E+00
3 0.6401216923E+00 0.8137573261E+00
S 1
1 0.1612777588E+00 1.0000000
HELIUM
S 3
1 0.3842163400E+02 0.4013973935E-01
2 0.5778030000E+01 0.2612460970E+00
3 0.1241774000E+01 0.7931846246E+00
S 1
1 0.2979640000E+00 1.0000000
LITHIUM LITHIUM
S 6 S 6
1 642.4189200 0.0021426 1 642.4189200 0.0021426

View File

@ -14,6 +14,18 @@ P 1
P 1 P 1
1 0.3750000 1.0000000 1 0.3750000 1.0000000
HELIUM
S 3
1 98.12430 0.0287452
2 14.76890 0.208061
3 3.318830 0.837635
S 1
1 0.874047 1.000000
S 1
1 0.244564 1.000000
P 1
1 0.750 1.000000
LITHIUM LITHIUM
S 6 S 6
1 900.4600000 0.00228704 1 900.4600000 0.00228704

View File

@ -1,3 +1,23 @@
HYDROGEN
S 3
1 33.86500 0.0254938
2 5.094790 0.190373
3 1.158790 0.852161
S 1
1 0.325840 1.000000
S 1
1 0.102741 1.000000
HELIUM
S 3
1 98.12430 0.0287452
2 14.76890 0.208061
3 3.318830 0.837635
S 1
1 0.874047 1.000000
S 1
1 0.244564 1.000000
LITHIUM LITHIUM
S 6 S 6
1 900.4600000 0.00228704 1 900.4600000 0.00228704

View File

@ -1,3 +1,23 @@
HYDROGEN
S 3
1 33.86500 0.0254938
2 5.094790 0.190373
3 1.158790 0.852161
S 1
1 0.325840 1.000000
S 1
1 0.102741 1.000000
HELIUM
S 3
1 98.12430 0.0287452
2 14.76890 0.208061
3 3.318830 0.837635
S 1
1 0.874047 1.000000
S 1
1 0.244564 1.000000
LITHIUM LITHIUM
S 6 S 6
1 900.4600000 0.00228704 1 900.4600000 0.00228704

View File

@ -1,3 +1,19 @@
HYDROGEN
S 3
1 18.7311370 0.03349460
2 2.8253937 0.23472695
3 0.6401217 0.81375733
S 1
1 0.1612778 1.0000000
HELIUM
S 3
1 38.4216340 0.0237660
2 5.7780300 0.1546790
3 1.2417740 0.4696300
S 1
1 0.2979640 1.0000000
LITHIUM LITHIUM
S 6 S 6
1 642.4189200 0.0021426 1 642.4189200 0.0021426

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 MiB

After

Width:  |  Height:  |  Size: 351 KiB

BIN
data/qp2_hd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 MiB

View File

@ -1,41 +1,59 @@
%%% ARXIV TO BE UPDATED %%% %%% ARXIV TO BE UPDATED %%%
@article{Giner2019Jul, @article{Hollett2019Aug,
author = {Giner, Emmanuel and Scemama, Anthony and Toulouse, Julien and Loos, Pierre-Fran{\c{c}}ois}, author = {Hollett, Joshua W. and Loos, Pierre-Fran{\c{c}}ois},
title = {{Chemically Accurate Excitation Energies With Small Basis Sets}}, title = {{Capturing static and dynamic correlation with $\Delta \text{NO}$-MP2 and $\Delta \text{NO}$-CCSD}},
journal = {arXiv}, journal = {arXiv},
year = {2019}, year = {2019},
month = {Jul}, month = {Aug},
eprint = {1907.01245}, eprint = {1908.09914},
url = {https://arxiv.org/abs/1907.01245} url = {https://arxiv.org/abs/1908.09914}
} }
@article{Burton_2019,
doi = {10.1021/acs.jctc.9b00441},
url = {https://doi.org/10.1021%2Facs.jctc.9b00441},
year = 2019,
month = {aug},
publisher = {American Chemical Society ({ACS})},
author = {Hugh G. A. Burton and Alex J.W. Thom},
title = {A General Approach for Multireference Ground and Excited States using Non-Orthogonal Configuration Interaction},
journal = {Journal of Chemical Theory and Computation}
}
@article{Dash_2019,
doi = {10.1021/acs.jctc.9b00476},
url = {https://doi.org/10.1021%2Facs.jctc.9b00476},
year = 2019,
month = {aug},
publisher = {American Chemical Society ({ACS})},
author = {Monika Dash and Jonas Feldt and Saverio Moroni and Anthony Scemama and Claudia Filippi},
title = {Excited States with Selected Configuration Interaction-Quantum Monte Carlo: Chemically Accurate Excitation Energies and Geometries},
journal = {Journal of Chemical Theory and Computation}
}
%%%% PUBLISHED PAPERS %%%% PUBLISHED PAPERS
@article{Giner2019Oct,
author = {Giner, Emmanuel and Scemama, Anthony and Toulouse, Julien and Loos, Pierre-Fran{\c{c}}ois},
title = {{Chemically accurate excitation energies with small basis sets}},
journal = {J. Chem. Phys.},
volume = {151},
number = {14},
pages = {144118},
year = {2019},
month = {Oct},
issn = {0021-9606},
publisher = {American Institute of Physics},
doi = {10.1063/1.5122976}
}
@article{Burton2019Sep,
author = {Burton, Hugh G. A. and Thom, Alex J. W.},
title = {{General Approach for Multireference Ground and Excited States Using Nonorthogonal Configuration Interaction}},
journal = {J. Chem. Theory Comput.},
volume = {15},
number = {9},
pages = {4851--4861},
year = {2019},
month = {Sep},
issn = {1549-9618},
publisher = {American Chemical Society},
doi = {10.1021/acs.jctc.9b00441}
}
@article{Dash_2019,
author = {Dash, Monika and Feldt, Jonas and Moroni, Saverio and Scemama, Anthony and Filippi, Claudia},
title = {{Excited States with Selected Configuration Interaction-Quantum Monte Carlo: Chemically Accurate Excitation Energies and Geometries}},
journal = {J. Chem. Theory Comput.},
volume = {15},
number = {9},
pages = {4896--4906},
year = {2019},
month = {Sep},
issn = {1549-9618},
publisher = {American Chemical Society},
doi = {10.1021/acs.jctc.9b00476}
}
@article{Ferte_2019, @article{Ferte_2019,
doi = {10.1063/1.5082638}, doi = {10.1063/1.5082638},
url = {https://doi.org/10.1063%2F1.5082638}, url = {https://doi.org/10.1063%2F1.5082638},

View File

@ -115,7 +115,7 @@ create an |EZFIO| database with the 6-31G basis set:
.. code:: bash .. code:: bash
qp create_ezfio -b "6-31G" hcn.xyz -o hcn qp create_ezfio -b "6-31g" hcn.xyz -o hcn
The EZFIO database now contains data relative to the nuclear coordinates The EZFIO database now contains data relative to the nuclear coordinates
and the atomic basis set: and the atomic basis set:

View File

@ -1,7 +1,7 @@
# Configuration of IRPF90 package # Configuration of IRPF90 package
# Set the path of IRPF90 here: # Set the path of IRPF90 here:
export IRPF90_PATH=${QP_ROOT}/external/irpf90-v1.7.5 export IRPF90_PATH=${QP_ROOT}/external/irpf90-v1.7.6
export PATH=${PATH}:${IRPF90_PATH}/bin export PATH=${PATH}:${IRPF90_PATH}/bin
export IRPF90=${IRPF90_PATH}/bin/irpf90 export IRPF90=${IRPF90_PATH}/bin/irpf90

View File

@ -7,82 +7,61 @@ Type for bits strings
list of Bits list of Bits
*) *)
type t = Bit.t list type t = int64 array
let n_int = Array.length
(* Create a zero bit list *)
let zero n_int =
Array.make (N_int_number.to_int n_int) 0L
(* String representation *) (* String representation *)
let to_string b = let to_string b =
let rec do_work accu = function let int64_to_string x =
| [] -> accu String.init 64 (fun i ->
| head :: tail -> if Int64.logand x @@ Int64.shift_left 1L i <> 0L then
let new_accu = (Bit.to_string head) ^ accu '+'
in do_work new_accu tail else
'-')
in in
do_work "" b Array.map int64_to_string b
|> Array.to_list
|> String.concat ""
let of_string ?(zero='0') ?(one='1') s = let of_string ?(zero='0') ?(one='1') s =
List.init (String.length s) (String.get s) let n_int = ( (String.length s - 1) lsr 6 ) + 1 in
|> List.rev_map ( fun c -> let result = Array.make n_int 0L in
if (c = zero) then Bit.Zero String.iteri (fun i c ->
else if (c = one) then Bit.One if c = one then
else (failwith ("Error in bitstring ") ) ) begin
let iint = i lsr 6 in (* i / 64 *)
let k = i - (iint lsl 6) in
result.(iint) <- Int64.logor result.(iint) @@ Int64.shift_left 1L k;
end) s;
result
let of_string_mp s = let of_string_mp = of_string ~zero:'-' ~one:'+'
List.init (String.length s) (String.get s)
|> List.rev_map (function
| '-' -> Bit.Zero
| '+' -> Bit.One
| _ -> failwith ("Error in bitstring ") )
(* Create a bit list from an int64 *) (* Create a bit list from an int64 *)
let of_int64 i = let of_int64 i = [| i |]
let rec do_work accu = function
| 0L -> Bit.Zero :: accu |> List.rev
| 1L -> Bit.One :: accu |> List.rev
| i ->
let b =
match (Int64.logand i 1L ) with
| 0L -> Bit.Zero
| 1L -> Bit.One
| _ -> raise (Failure "i land 1 not in (0,1)")
in
do_work (b :: accu) (Int64.shift_right_logical i 1)
in
let adjust_length result =
let rec do_work accu = function
| 64 -> List.rev accu
| i when i>64 -> raise (Failure "Error in of_int64 > 64")
| i when i<0 -> raise (Failure "Error in of_int64 < 0")
| i -> do_work (Bit.Zero :: accu) (i+1)
in
do_work (List.rev result) (List.length result)
in
adjust_length (do_work [] i)
(* Create an int64 from a bit list *) (* Create an int64 from a bit list *)
let to_int64 l = let to_int64 = function
assert ( (List.length l) <= 64) ; | [| i |] -> i
let rec do_work accu = function | _ -> failwith "N_int > 1"
| [] -> accu
| Bit.Zero::tail -> do_work Int64.(shift_left accu 1) tail
| Bit.One::tail -> do_work Int64.(logor one (shift_left accu 1)) tail
in do_work Int64.zero (List.rev l)
(* Create a bit list from a list of int64 *)
let of_int64_list l =
List.map of_int64 l
|> List.concat
(* Create a bit list from an array of int64 *) (* Create a bit list from an array of int64 *)
let of_int64_array l = external of_int64_array : int64 array -> t = "%identity"
Array.map of_int64 l external to_int64_array : t -> int64 array = "%identity"
|> Array.to_list
|> List.concat
(* Create a bit list from a list of int64 *)
let of_int64_list l =
Array.of_list l |> of_int64_array
(* Compute n_int *) (* Compute n_int *)
@ -91,101 +70,64 @@ let n_int_of_mo_num mo_num =
N_int_number.of_int ( (mo_num-1)/bit_kind_size + 1 ) N_int_number.of_int ( (mo_num-1)/bit_kind_size + 1 )
(* Create a zero bit list *)
let zero n_int =
let n_int = N_int_number.to_int n_int in
let a = Array.init n_int (fun i-> 0L) in
of_int64_list ( Array.to_list a )
(* Create an int64 list from a bit list *) (* Create an int64 list from a bit list *)
let to_int64_list l = let to_int64_list l =
let rec do_work accu buf counter = function to_int64_array l |> Array.to_list
| [] ->
begin
match buf with
| [] -> accu
| _ -> (List.rev buf)::accu
end
| i::tail ->
if (counter < 64) then
do_work accu (i::buf) (counter+1) tail
else
do_work ( (List.rev (i::buf))::accu) [] 1 tail
in
let l = do_work [] [] 1 l
in
List.rev_map to_int64 l
(* Create an array of int64 from a bit list *)
let to_int64_array l =
to_int64_list l
|> Array.of_list
(* Create a bit list from a list of MO indices *) (* Create a bit list from a list of MO indices *)
let of_mo_number_list n_int l = let of_mo_number_list n_int l =
let n_int = N_int_number.to_int n_int in let result = zero n_int in
let length = n_int*64 in List.iter (fun j ->
let a = Array.make length (Bit.Zero) in let i = (MO_number.to_int j) - 1 in
List.iter (fun i-> a.((MO_number.to_int i)-1) <- Bit.One) l; let iint = i lsr 6 in (* i / 64 *)
Array.to_list a let k = i - (iint lsl 6) in
result.(iint) <- Int64.logor result.(iint) @@ Int64.shift_left 1L k;
) l;
result
let to_mo_number_list l = let to_mo_number_list l =
let a = Array.of_list l in let rec aux_one x shift accu = function
let mo_num = MO_number.get_max () in | -1 -> accu
let rec do_work accu = function | i -> if Int64.logand x (Int64.shift_left 1L i) <> 0L then
| 0 -> accu aux_one x shift ( (i+shift) ::accu) (i-1)
| i -> else
begin aux_one x shift accu (i-1)
let new_accu =
match a.(i-1) with
| Bit.One -> (MO_number.of_int ~max:mo_num i)::accu
| Bit.Zero -> accu
in
do_work new_accu (i-1)
end
in in
do_work [] (List.length l) Array.mapi (fun i x ->
let shift = (i lsr 6) lsl 6 + 1 in
aux_one x shift [] 63
) l
|> Array.to_list
|> List.concat
|> List.map MO_number.of_int
(* logical operations on bit_list *) (* logical operations on bit_list *)
let logical_operator2 op a b = let and_operator a b = Array.map2 Int64.logand a b
let rec do_work_binary result a b = let xor_operator a b = Array.map2 Int64.logxor a b
match a, b with let or_operator a b = Array.map2 Int64.logor a b
| [], [] -> result let not_operator b = Array.map Int64.lognot b
| [], _ | _ , [] -> raise (Failure "Lists should have same length")
| (ha::ta), (hb::tb) ->
let newbit = op ha hb
in do_work_binary (newbit::result) ta tb let pop_sign =
let mask =
(Int64.pred (Int64.shift_left 1L 63))
in in
List.rev (do_work_binary [] a b) fun x -> Int64.logand mask x
let logical_operator1 op b =
let rec do_work_unary result b =
match b with
| [] -> result
| (hb::tb) ->
let newbit = op hb
in do_work_unary (newbit::result) tb
in
List.rev (do_work_unary [] b)
let and_operator a b = logical_operator2 Bit.and_operator a b
let xor_operator a b = logical_operator2 Bit.xor_operator a b
let or_operator a b = logical_operator2 Bit.or_operator a b
let not_operator b = logical_operator1 Bit.not_operator b
let popcnt b = let popcnt b =
List.fold_left (fun accu -> function Array.fold_left (fun accu x ->
| Bit.One -> accu+1 if x >= 0L then
| Bit.Zero -> accu accu + (Z.popcount @@ Z.of_int64 x)
) 0 b else
accu + 1 + (Z.popcount @@ Z.of_int64 (pop_sign x))
) 0 b

View File

@ -1,4 +1,4 @@
type t = Bit.t list type t
(** The zero bit list *) (** The zero bit list *)
val zero : Qptypes.N_int_number.t -> t val zero : Qptypes.N_int_number.t -> t

View File

@ -25,19 +25,6 @@ let to_bitlist_couple x =
in (xa,xb) in (xa,xb)
let bitlist_to_string ~mo_num x =
let len =
MO_number.to_int mo_num
in
let s =
List.map (function
| Bit.Zero -> "-"
| Bit.One -> "+"
) x
|> String.concat ""
in
String.sub s 0 len
let of_int64_array ~n_int ~alpha ~beta x = let of_int64_array ~n_int ~alpha ~beta x =
@ -48,37 +35,29 @@ let of_int64_array ~n_int ~alpha ~beta x =
in in
if ( (Bitlist.popcnt a) <> alpha) then if ( (Bitlist.popcnt a) <> alpha) then
begin begin
let mo_num = MO_number.get_max () in
let mo_num = MO_number.of_int mo_num ~max:mo_num in
failwith (Printf.sprintf "Expected %d electrons in alpha determinant failwith (Printf.sprintf "Expected %d electrons in alpha determinant
%s" alpha (bitlist_to_string ~mo_num:mo_num a) ) %s" alpha (Bitlist.to_string a) )
end; end;
if ( (Bitlist.popcnt b) <> beta ) then if ( (Bitlist.popcnt b) <> beta ) then
begin begin
let mo_num = MO_number.get_max () in
let mo_num = MO_number.of_int mo_num ~max:mo_num in
failwith (Printf.sprintf "Expected %d electrons in beta determinant failwith (Printf.sprintf "Expected %d electrons in beta determinant
%s" beta (bitlist_to_string ~mo_num:mo_num b) ) %s" beta (Bitlist.to_string b) )
end; end;
x x
let of_bitlist_couple ?n_int ~alpha ~beta (xa,xb) = let of_bitlist_couple ~n_int ~alpha ~beta (xa,xb) =
let ba, bb = let ba, bb =
Bitlist.to_int64_array xa , Bitlist.to_int64_array xa ,
Bitlist.to_int64_array xb Bitlist.to_int64_array xb
and n_int =
match n_int with
| Some x -> x
| None -> Bitlist.n_int_of_mo_num (List.length xa)
in in
of_int64_array ~n_int ~alpha ~beta (Array.concat [ba;bb]) of_int64_array ~n_int ~alpha ~beta (Array.concat [ba;bb])
let to_string ~mo_num x = let to_string ~mo_num x =
let (xa,xb) = to_bitlist_couple x in let (xa,xb) = to_bitlist_couple x in
[ " " ; bitlist_to_string ~mo_num xa ; "\n" ; [ " " ; Bitlist.to_string xa ; "\n" ;
" " ; bitlist_to_string ~mo_num xb ] " " ; Bitlist.to_string xb ]
|> String.concat "" |> String.concat ""

View File

@ -24,7 +24,7 @@ val to_alpha_beta : t -> (int64 array)*(int64 array)
val to_bitlist_couple : t -> Bitlist.t * Bitlist.t val to_bitlist_couple : t -> Bitlist.t * Bitlist.t
(** Create from a bit list *) (** Create from a bit list *)
val of_bitlist_couple : ?n_int:Qptypes.N_int_number.t -> val of_bitlist_couple : n_int:Qptypes.N_int_number.t ->
alpha:Qptypes.Elec_alpha_number.t -> alpha:Qptypes.Elec_alpha_number.t ->
beta:Qptypes.Elec_beta_number.t -> beta:Qptypes.Elec_beta_number.t ->
Bitlist.t * Bitlist.t -> t Bitlist.t * Bitlist.t -> t

View File

@ -7,14 +7,14 @@ module Determinants_by_hand : sig
{ n_int : N_int_number.t; { n_int : N_int_number.t;
bit_kind : Bit_kind.t; bit_kind : Bit_kind.t;
n_det : Det_number.t; n_det : Det_number.t;
n_det_qp_edit : Det_number.t;
n_states : States_number.t; n_states : States_number.t;
expected_s2 : Positive_float.t; expected_s2 : Positive_float.t;
psi_coef : Det_coef.t array; psi_coef : Det_coef.t array;
psi_det : Determinant.t array; psi_det : Determinant.t array;
state_average_weight : Positive_float.t array; state_average_weight : Positive_float.t array;
} [@@deriving sexp] } [@@deriving sexp]
val read : unit -> t val read : ?full:bool -> unit -> t option
val read_maybe : unit -> t option
val write : t -> unit val write : t -> unit
val to_string : t -> string val to_string : t -> string
val to_rst : t -> Rst_string.t val to_rst : t -> Rst_string.t
@ -28,6 +28,7 @@ end = struct
{ n_int : N_int_number.t; { n_int : N_int_number.t;
bit_kind : Bit_kind.t; bit_kind : Bit_kind.t;
n_det : Det_number.t; n_det : Det_number.t;
n_det_qp_edit : Det_number.t;
n_states : States_number.t; n_states : States_number.t;
expected_s2 : Positive_float.t; expected_s2 : Positive_float.t;
psi_coef : Det_coef.t array; psi_coef : Det_coef.t array;
@ -38,8 +39,6 @@ end = struct
let get_default = Qpackage.get_ezfio_default "determinants";; let get_default = Qpackage.get_ezfio_default "determinants";;
let n_det_read_max = 10_000 ;;
let read_n_int () = let read_n_int () =
if not (Ezfio.has_determinants_n_int()) then if not (Ezfio.has_determinants_n_int()) then
Ezfio.get_mo_basis_mo_num () Ezfio.get_mo_basis_mo_num ()
@ -80,11 +79,27 @@ end = struct
|> Det_number.of_int |> Det_number.of_int
;; ;;
let read_n_det_qp_edit () =
if not (Ezfio.has_determinants_n_det_qp_edit ()) then
begin
let n_det = read_n_det () |> Det_number.to_int in
Ezfio.set_determinants_n_det_qp_edit n_det
end;
Ezfio.get_determinants_n_det_qp_edit ()
|> Det_number.of_int
;;
let write_n_det n = let write_n_det n =
Det_number.to_int n Det_number.to_int n
|> Ezfio.set_determinants_n_det |> Ezfio.set_determinants_n_det
;; ;;
let write_n_det_qp_edit n =
let n_det = read_n_det () |> Det_number.to_int in
min n_det (Det_number.to_int n)
|> Ezfio.set_determinants_n_det_qp_edit
;;
let read_n_states () = let read_n_states () =
if not (Ezfio.has_determinants_n_states ()) then if not (Ezfio.has_determinants_n_states ()) then
Ezfio.set_determinants_n_states 1 Ezfio.set_determinants_n_states 1
@ -178,7 +193,7 @@ end = struct
|> Ezfio.set_determinants_expected_s2 |> Ezfio.set_determinants_expected_s2
;; ;;
let read_psi_coef () = let read_psi_coef ~read_only () =
if not (Ezfio.has_determinants_psi_coef ()) then if not (Ezfio.has_determinants_psi_coef ()) then
begin begin
let n_states = let n_states =
@ -189,7 +204,12 @@ end = struct
~data:(List.init n_states (fun i -> if (i=0) then 1. else 0. )) ~data:(List.init n_states (fun i -> if (i=0) then 1. else 0. ))
|> Ezfio.set_determinants_psi_coef |> Ezfio.set_determinants_psi_coef
end; end;
Ezfio.get_determinants_psi_coef () begin
if read_only then
Ezfio.get_determinants_psi_coef_qp_edit ()
else
Ezfio.get_determinants_psi_coef ()
end
|> Ezfio.flattened_ezfio |> Ezfio.flattened_ezfio
|> Array.map Det_coef.of_float |> Array.map Det_coef.of_float
;; ;;
@ -202,12 +222,15 @@ end = struct
and n_states = and n_states =
States_number.to_int n_states States_number.to_int n_states
in in
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| n_det ; n_states |] ~data:c let r =
|> Ezfio.set_determinants_psi_coef Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| n_det ; n_states |] ~data:c
in
Ezfio.set_determinants_psi_coef r;
Ezfio.set_determinants_psi_coef_qp_edit r
;; ;;
let read_psi_det () = let read_psi_det ~read_only () =
let n_int = read_n_int () let n_int = read_n_int ()
and n_alpha = Ezfio.get_electrons_elec_alpha_num () and n_alpha = Ezfio.get_electrons_elec_alpha_num ()
|> Elec_alpha_number.of_int |> Elec_alpha_number.of_int
@ -233,13 +256,21 @@ end = struct
|> Ezfio.set_determinants_psi_det ; |> Ezfio.set_determinants_psi_det ;
end ; end ;
let n_int = N_int_number.to_int n_int in let n_int = N_int_number.to_int n_int in
let psi_det_array = Ezfio.get_determinants_psi_det () in let psi_det_array =
if read_only then
Ezfio.get_determinants_psi_det_qp_edit ()
else
Ezfio.get_determinants_psi_det ()
in
let dim = psi_det_array.Ezfio.dim let dim = psi_det_array.Ezfio.dim
and data = Ezfio.flattened_ezfio psi_det_array and data = Ezfio.flattened_ezfio psi_det_array
in in
assert (n_int = dim.(0)); assert (n_int = dim.(0));
assert (dim.(1) = 2); assert (dim.(1) = 2);
assert (dim.(2) = (Det_number.to_int (read_n_det ()))); if read_only then
assert (dim.(2) = (Det_number.to_int (read_n_det_qp_edit ())))
else
assert (dim.(2) = (Det_number.to_int (read_n_det ())));
Array.init dim.(2) (fun i -> Array.init dim.(2) (fun i ->
Array.sub data (2*n_int*i) (2*n_int) ) Array.sub data (2*n_int*i) (2*n_int) )
|> Array.map (Determinant.of_int64_array |> Array.map (Determinant.of_int64_array
@ -252,40 +283,45 @@ end = struct
|> Array.concat |> Array.concat
|> Array.to_list |> Array.to_list
in in
Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| N_int_number.to_int n_int ; 2 ; Det_number.to_int n_det |] ~data:data let r =
|> Ezfio.set_determinants_psi_det Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| N_int_number.to_int n_int ; 2 ; Det_number.to_int n_det |] ~data:data
in
Ezfio.set_determinants_psi_det r;
Ezfio.set_determinants_psi_det_qp_edit r
;; ;;
let read () = let read ?(full=true) () =
let n_det_qp_edit = read_n_det_qp_edit () in
let n_det = read_n_det () in
let read_only =
if full then false else n_det_qp_edit <> n_det
in
if (Ezfio.has_mo_basis_mo_num ()) then if (Ezfio.has_mo_basis_mo_num ()) then
try
Some
{ n_int = read_n_int () ; { n_int = read_n_int () ;
bit_kind = read_bit_kind () ; bit_kind = read_bit_kind () ;
n_det = read_n_det () ; n_det = read_n_det () ;
n_det_qp_edit = read_n_det_qp_edit () ;
expected_s2 = read_expected_s2 () ; expected_s2 = read_expected_s2 () ;
psi_coef = read_psi_coef () ; psi_coef = read_psi_coef ~read_only () ;
psi_det = read_psi_det () ; psi_det = read_psi_det ~read_only () ;
n_states = read_n_states () ; n_states = read_n_states () ;
state_average_weight = read_state_average_weight () ; state_average_weight = read_state_average_weight () ;
} }
with _ -> None
else else
failwith "No molecular orbitals, so no determinants" (* No molecular orbitals, so no determinants *)
;;
let read_maybe () =
let n_det =
read_n_det ()
in
if ( (Det_number.to_int n_det) < n_det_read_max ) then
try Some (read ()) with
| Failure _ -> None
else
None None
;; ;;
let write { n_int ; let write { n_int ;
bit_kind ; bit_kind ;
n_det ; n_det ;
n_det_qp_edit ;
expected_s2 ; expected_s2 ;
psi_coef ; psi_coef ;
psi_det ; psi_det ;
@ -297,9 +333,13 @@ end = struct
write_n_det n_det; write_n_det n_det;
write_n_states n_states; write_n_states n_states;
write_expected_s2 expected_s2; write_expected_s2 expected_s2;
write_psi_coef ~n_det:n_det ~n_states:n_states psi_coef ; if n_det <= n_det_qp_edit then
write_psi_det ~n_int:n_int ~n_det:n_det psi_det; begin
write_state_average_weight state_average_weight; write_n_det_qp_edit n_det;
write_psi_coef ~n_det:n_det ~n_states:n_states psi_coef ;
write_psi_det ~n_int:n_int ~n_det:n_det psi_det
end;
write_state_average_weight state_average_weight
;; ;;
@ -316,11 +356,13 @@ end = struct
|> States_number.to_int |> States_number.to_int
and ndet = and ndet =
Det_number.to_int b.n_det Det_number.to_int b.n_det
and ndet_qp_edit =
Det_number.to_int b.n_det_qp_edit
in in
let coefs_string i = let coefs_string i =
Array.init nstates (fun j -> Array.init nstates (fun j ->
let ishift = let ishift =
j*ndet j*ndet_qp_edit
in in
if (ishift < Array.length b.psi_coef) then if (ishift < Array.length b.psi_coef) then
b.psi_coef.(i+ishift) b.psi_coef.(i+ishift)
@ -331,7 +373,7 @@ end = struct
) )
|> Array.to_list |> String.concat "\t" |> Array.to_list |> String.concat "\t"
in in
Array.init ndet (fun i -> Array.init ndet_qp_edit (fun i ->
Printf.sprintf " %s\n%s\n" Printf.sprintf " %s\n%s\n"
(coefs_string i) (coefs_string i)
(Determinant.to_string ~mo_num:mo_num b.psi_det.(i) (Determinant.to_string ~mo_num:mo_num b.psi_det.(i)
@ -472,6 +514,7 @@ psi_det = %s
(* Handle determinants *) (* Handle determinants *)
let psi_det = let psi_det =
let n_int = N_int_number.of_int @@ (MO_number.get_max () - 1) / 64 + 1 in
let n_alpha = Ezfio.get_electrons_elec_alpha_num () let n_alpha = Ezfio.get_electrons_elec_alpha_num ()
|> Elec_alpha_number.of_int |> Elec_alpha_number.of_int
and n_beta = Ezfio.get_electrons_elec_beta_num () and n_beta = Ezfio.get_electrons_elec_beta_num ()
@ -483,8 +526,8 @@ psi_det = %s
begin begin
let newdet = let newdet =
(Bitlist.of_string ~zero:'-' ~one:'+' alpha , (Bitlist.of_string ~zero:'-' ~one:'+' alpha ,
Bitlist.of_string ~zero:'-' ~one:'+' beta) Bitlist.of_string ~zero:'-' ~one:'+' beta)
|> Determinant.of_bitlist_couple ~alpha:n_alpha ~beta:n_beta |> Determinant.of_bitlist_couple ~n_int ~alpha:n_alpha ~beta:n_beta
|> Determinant.sexp_of_t |> Determinant.sexp_of_t
|> Sexplib.Sexp.to_string |> Sexplib.Sexp.to_string
in in
@ -492,9 +535,6 @@ psi_det = %s
end end
| _::tail -> read_dets accu tail | _::tail -> read_dets accu tail
in in
let dets =
List.map String_ext.rev dets
in
let a = let a =
read_dets [] dets read_dets [] dets
|> String.concat "" |> String.concat ""
@ -510,9 +550,11 @@ psi_det = %s
Printf.sprintf "(n_int %d)" (N_int_number.get_max ()) Printf.sprintf "(n_int %d)" (N_int_number.get_max ())
and n_states = and n_states =
Printf.sprintf "(n_states %d)" (States_number.to_int @@ read_n_states ()) Printf.sprintf "(n_states %d)" (States_number.to_int @@ read_n_states ())
and n_det_qp_edit =
Printf.sprintf "(n_det_qp_edit %d)" (Det_number.to_int @@ read_n_det_qp_edit ())
in in
let s = let s =
String.concat "" [ header ; bitkind ; n_int ; n_states ; psi_coef ; psi_det] String.concat "" [ header ; bitkind ; n_int ; n_states ; psi_coef ; psi_det ; n_det_qp_edit ]
in in
@ -527,7 +569,9 @@ psi_det = %s
Det_number.to_int n_det_new Det_number.to_int n_det_new
in in
let det = let det =
read () match read () with
| Some x -> x
| None -> failwith "No determinants in file"
in in
let n_det_old, n_states = let n_det_old, n_states =
Det_number.to_int det.n_det, Det_number.to_int det.n_det,
@ -558,7 +602,9 @@ psi_det = %s
let extract_state istate = let extract_state istate =
Printf.printf "Extracting state %d\n" (States_number.to_int istate); Printf.printf "Extracting state %d\n" (States_number.to_int istate);
let det = let det =
read () match read () with
| Some x -> x
| None -> failwith "No determinants in file"
in in
let n_det, n_states = let n_det, n_states =
Det_number.to_int det.n_det, Det_number.to_int det.n_det,
@ -588,7 +634,9 @@ psi_det = %s
let extract_states range = let extract_states range =
Printf.printf "Extracting states %s\n" (Range.to_string range); Printf.printf "Extracting states %s\n" (Range.to_string range);
let det = let det =
read () match read () with
| Some x -> x
| None -> failwith "No determinants in file"
in in
let n_det, n_states = let n_det, n_states =
Det_number.to_int det.n_det, Det_number.to_int det.n_det,
@ -614,7 +662,8 @@ psi_det = %s
j*n_det j*n_det
in in
for i=0 to (n_det-1) do for i=0 to (n_det-1) do
det.psi_coef.(!state_shift+i) <- det.psi_coef.(i+ishift) det.psi_coef.(!state_shift+i) <-
det.psi_coef.(i+ishift)
done done
end; end;
state_shift := !state_shift + n_det state_shift := !state_shift + n_det

View File

@ -65,8 +65,15 @@ end = struct
let read_mo_num () = let read_mo_num () =
Ezfio.get_mo_basis_mo_num () let elec_alpha_num =
|> MO_number.of_int Ezfio.get_electrons_elec_alpha_num ()
in
let result =
Ezfio.get_mo_basis_mo_num ()
in
if result < elec_alpha_num then
failwith "More alpha electrons than MOs";
MO_number.of_int result
let read_mo_class () = let read_mo_class () =

View File

@ -43,7 +43,7 @@ $(QP_ROOT)/data/executables: remake_executables element_create_db.byte Qptypes.m
$(QP_ROOT)/ocaml/element_create_db.byte $(QP_ROOT)/ocaml/element_create_db.byte
external_libs: external_libs:
opam install cryptokit core opam install cryptokit sexplib
qpackage.odocl: $(MLIFILES) qpackage.odocl: $(MLIFILES)
ls $(MLIFILES) | sed "s/\.mli//" > qpackage.odocl ls $(MLIFILES) | sed "s/\.mli//" > qpackage.odocl

View File

@ -1,4 +1,4 @@
true: package(cryptokit,zmq,str,sexplib,ppx_sexp_conv,ppx_deriving,getopt) true: package(cryptokit,zarith,zmq,str,sexplib,ppx_sexp_conv,ppx_deriving,getopt)
true: thread true: thread
false: profile false: profile
<*byte> : linkdep(c_bindings.o), custom <*byte> : linkdep(c_bindings.o), custom

View File

@ -44,9 +44,12 @@ let psi_det () =
let psi_det = let psi_det =
Input.Determinants_by_hand.read () Input.Determinants_by_hand.read ()
in in
Input.Determinants_by_hand.to_rst psi_det match psi_det with
|> Rst_string.to_string | Some psi_det ->
|> print_endline Input.Determinants_by_hand.to_rst psi_det
|> Rst_string.to_string
|> print_endline
| None -> ()

View File

@ -112,9 +112,9 @@ let set ~core ~inact ~act ~virt ~del =
and av = Excitation.create_single act virt and av = Excitation.create_single act virt
in in
let single_excitations = [ ia ; aa ; av ] let single_excitations = [ ia ; aa ; av ]
|> List.map (fun x -> |> List.map (fun z ->
let open Excitation in let open Excitation in
match x with match z with
| Single (x,y) -> | Single (x,y) ->
( MO_class.to_bitlist n_int (Hole.to_mo_class x), ( MO_class.to_bitlist n_int (Hole.to_mo_class x),
MO_class.to_bitlist n_int (Particle.to_mo_class y) ) MO_class.to_bitlist n_int (Particle.to_mo_class y) )
@ -187,9 +187,10 @@ let set ~core ~inact ~act ~virt ~del =
match aa with match aa with
| Double _ -> assert false | Double _ -> assert false
| Single (x,y) -> | Single (x,y) ->
( MO_class.to_bitlist n_int (Hole.to_mo_class x) ) @ Bitlist.to_int64_list
( MO_class.to_bitlist n_int (Particle.to_mo_class y) ) ( MO_class.to_bitlist n_int ( Hole.to_mo_class x) ) @
|> Bitlist.to_int64_list Bitlist.to_int64_list
( MO_class.to_bitlist n_int (Particle.to_mo_class y) )
in in
Ezfio.set_bitmasks_n_mask_cas 1; Ezfio.set_bitmasks_n_mask_cas 1;
Ezfio.ezfio_array_of_list ~rank:3 ~dim:([| (N_int_number.to_int n_int) ; 2; 1|]) ~data:result Ezfio.ezfio_array_of_list ~rank:3 ~dim:([| (N_int_number.to_int n_int) ; 2; 1|]) ~data:result

View File

@ -6,6 +6,10 @@ type req_or_sub = REQ | SUB
let localport = 42379 let localport = 42379
let in_time_sum = ref 1.e-9
and in_size_sum = ref 0.
let () = let () =
let open Command_line in let open Command_line in
begin begin
@ -17,6 +21,10 @@ let () =
doc="Downloads the EZFIO directory." ; doc="Downloads the EZFIO directory." ;
arg=Without_arg; } ; arg=Without_arg; } ;
{ short='v' ; long="verbose" ; opt=Optional ;
doc="Prints the transfer speed." ;
arg=Without_arg; } ;
anonymous anonymous
"(EZFIO_DIR|ADDRESS)" "(EZFIO_DIR|ADDRESS)"
Mandatory Mandatory
@ -39,6 +47,9 @@ let () =
ADDRESS x ADDRESS x
in in
let verbose =
Command_line.get_bool "verbose"
in
@ -133,8 +144,8 @@ let () =
let socket_in, socket_out = let socket_in, socket_out =
match req_or_sub with match req_or_sub with
| REQ -> | REQ ->
create_socket Zmq.Socket.rep Zmq.Socket.bind addr_in, create_socket Zmq.Socket.router Zmq.Socket.bind addr_in,
create_socket Zmq.Socket.req Zmq.Socket.connect addr_out create_socket Zmq.Socket.dealer Zmq.Socket.connect addr_out
| SUB -> | SUB ->
create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in, create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in,
create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out
@ -144,19 +155,61 @@ let () =
Zmq.Socket.subscribe socket_in ""; Zmq.Socket.subscribe socket_in "";
(*
let action = let action =
if verbose then
begin
match req_or_sub with
| REQ -> (fun () ->
let msg =
Zmq.Socket.recv_all socket_in
in
let t0 = Unix.gettimeofday () in
Zmq.Socket.send_all socket_out msg;
let in_size =
float_of_int ( List.fold_left (fun accu x -> accu + String.length x) 0 msg )
/. 8192. /. 1024.
in
let msg =
Zmq.Socket.recv_all socket_out
in
let t1 = Unix.gettimeofday () in
Zmq.Socket.send_all socket_in msg;
let in_time = t1 -. t0 in
in_time_sum := !in_time_sum +. in_time;
in_size_sum := !in_size_sum +. in_size;
Printf.printf " %16.2f MiB/s -- %16.2f MiB/s\n%!" (in_size /. in_time) (!in_size_sum /. !in_time_sum);
)
| SUB -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
end
else
begin
match req_or_sub with
| REQ -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out;
Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
| SUB -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
end
in
*)
let action_in =
match req_or_sub with match req_or_sub with
| REQ -> (fun () -> | REQ -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out; | SUB -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
| SUB -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
in in
let action_out =
match req_or_sub with
| REQ -> (fun () -> Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
| SUB -> (fun () -> () )
in
let pollitem = let pollitem =
Zmq.Poll.mask_of Zmq.Poll.mask_of
[| (socket_in, Zmq.Poll.In) |] [| (socket_in, Zmq.Poll.In) ; (socket_out, Zmq.Poll.In) |]
in in
@ -166,12 +219,11 @@ let () =
Zmq.Poll.poll ~timeout:1000 pollitem Zmq.Poll.poll ~timeout:1000 pollitem
in in
match polling.(0) with match polling with
| Some Zmq.Poll.In -> action () | [| Some Zmq.Poll.In ; Some Zmq.Poll.In |] -> ( action_out () ; action_in () )
| None -> () | [| _ ; Some Zmq.Poll.In |] -> action_out ()
| Some Zmq.Poll.In_out | [| Some Zmq.Poll.In ; _ |] -> action_in ()
| Some Zmq.Poll.Out -> () | _ -> ()
done; done;
Zmq.Socket.close socket_in; Zmq.Socket.close socket_in;
@ -277,7 +329,7 @@ let () =
match arg with match arg with
| EZFIO x -> | EZFIO x ->
begin begin
Printf.sprintf "tar -zcf %s %s" temp_file x Printf.sprintf "tar --exclude=\"*.gz.*\" -zcf %s %s" temp_file x
|> Sys.command |> ignore; |> Sys.command |> ignore;
let fd = let fd =
Unix.openfile temp_file [Unix.O_RDONLY] 0o640 Unix.openfile temp_file [Unix.O_RDONLY] 0o640
@ -363,12 +415,21 @@ let () =
|> Zmq.Socket.send socket_in |> Zmq.Socket.send socket_in
in in
Printf.printf "On remote hosts, create ssh tunnel using: Printf.printf "
ssh -L %d:%s:%d -L %d:%s:%d -L %d:%s:%d %s\n%!" On remote hosts, create ssh tunnel using:
ssh -L %d:%s:%d -L %d:%s:%d -L %d:%s:%d -L %d:%s:%d %s &
Or from this host connect to clients using:
ssh -R %d:localhost:%d -R %d:localhost:%d -R %d:localhost:%d -R %d:localhost:%d <host> &
%!"
(port ) localhost (localport ) (port ) localhost (localport )
(port+1) localhost (localport+1) (port+1) localhost (localport+1)
(port+2) localhost (localport+2)
(port+9) localhost (localport+9) (port+9) localhost (localport+9)
(Unix.gethostname ()); (Unix.gethostname ())
(port ) (localport )
(port+1) (localport+1)
(port+2) (localport+2)
(port+9) (localport+9);
Printf.printf "Ready\n%!"; Printf.printf "Ready\n%!";
while !run_status do while !run_status do

View File

@ -58,7 +58,7 @@ let input_data = "
* Det_number_max : int * Det_number_max : int
assert (x > 0) ; assert (x > 0) ;
if (x > 50_00_000_000) then if (x > 50_000_000_000) then
warning \"More than 50 billion determinants\"; warning \"More than 50 billion determinants\";
* States_number : int * States_number : int

View File

@ -79,7 +79,7 @@ let get s =
| Ao_basis -> | Ao_basis ->
f Ao_basis.(read, to_rst) f Ao_basis.(read, to_rst)
| Determinants_by_hand -> | Determinants_by_hand ->
f Determinants_by_hand.(read_maybe, to_rst) f Determinants_by_hand.(read ~full:false, to_rst)
{section_to_rst} {section_to_rst}
end end
with with

View File

@ -2,6 +2,29 @@ use bitmasks
integer function number_of_holes(key_in) integer function number_of_holes(key_in)
BEGIN_DOC BEGIN_DOC
! Function that returns the number of holes in the inact space ! Function that returns the number of holes in the inact space
!
! popcnt(
! xor(
! iand(
! reunion_of_core_inact_bitmask(1,1),
! xor(
! key_in(1,1),
! iand(
! key_in(1,1),
! cas_bitmask(1,1,1))
! )
! ),
! reunion_of_core_inact_bitmask(1,1)) )
!
! (key_in && cas_bitmask)
! +---------------------+
! electrons in cas xor key_in
! +---------------------------------+
! electrons outside of cas && reunion_of_core_inact_bitmask
! +------------------------------------------------------------------+
! electrons in the core/inact space xor reunion_of_core_inact_bitmask
! +---------------------------------------------------------------------------------+
! holes
END_DOC END_DOC
implicit none implicit none
integer(bit_kind), intent(in) :: key_in(N_int,2) integer(bit_kind), intent(in) :: key_in(N_int,2)
@ -78,22 +101,6 @@ integer function number_of_holes(key_in)
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(6,2), xor(key_in(6,2),iand(key_in(6,2),cas_bitmask(6,2,1)))), reunion_of_core_inact_bitmask(6,2)) )& + popcnt( xor( iand(reunion_of_core_inact_bitmask(6,2), xor(key_in(6,2),iand(key_in(6,2),cas_bitmask(6,2,1)))), reunion_of_core_inact_bitmask(6,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(7,1), xor(key_in(7,1),iand(key_in(7,1),cas_bitmask(7,1,1)))), reunion_of_core_inact_bitmask(7,1)) )& + popcnt( xor( iand(reunion_of_core_inact_bitmask(7,1), xor(key_in(7,1),iand(key_in(7,1),cas_bitmask(7,1,1)))), reunion_of_core_inact_bitmask(7,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(7,2), xor(key_in(7,2),iand(key_in(7,2),cas_bitmask(7,2,1)))), reunion_of_core_inact_bitmask(7,2)) ) + popcnt( xor( iand(reunion_of_core_inact_bitmask(7,2), xor(key_in(7,2),iand(key_in(7,2),cas_bitmask(7,2,1)))), reunion_of_core_inact_bitmask(7,2)) )
else if(N_int == 8)then
number_of_holes = number_of_holes &
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), reunion_of_core_inact_bitmask(1,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), reunion_of_core_inact_bitmask(1,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(2,1), xor(key_in(2,1),iand(key_in(2,1),cas_bitmask(2,1,1)))), reunion_of_core_inact_bitmask(2,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(2,2), xor(key_in(2,2),iand(key_in(2,2),cas_bitmask(2,2,1)))), reunion_of_core_inact_bitmask(2,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(3,1), xor(key_in(3,1),iand(key_in(3,1),cas_bitmask(3,1,1)))), reunion_of_core_inact_bitmask(3,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(3,2), xor(key_in(3,2),iand(key_in(3,2),cas_bitmask(3,2,1)))), reunion_of_core_inact_bitmask(3,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(4,1), xor(key_in(4,1),iand(key_in(4,1),cas_bitmask(4,1,1)))), reunion_of_core_inact_bitmask(4,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(4,2), xor(key_in(4,2),iand(key_in(4,2),cas_bitmask(4,2,1)))), reunion_of_core_inact_bitmask(4,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(5,1), xor(key_in(5,1),iand(key_in(5,1),cas_bitmask(5,1,1)))), reunion_of_core_inact_bitmask(5,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(5,2), xor(key_in(5,2),iand(key_in(5,2),cas_bitmask(5,2,1)))), reunion_of_core_inact_bitmask(5,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(6,1), xor(key_in(6,1),iand(key_in(6,1),cas_bitmask(6,1,1)))), reunion_of_core_inact_bitmask(6,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(6,2), xor(key_in(6,2),iand(key_in(6,2),cas_bitmask(6,2,1)))), reunion_of_core_inact_bitmask(6,2)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(8,1), xor(key_in(8,1),iand(key_in(8,1),cas_bitmask(8,1,1)))), reunion_of_core_inact_bitmask(8,1)) )&
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(8,2), xor(key_in(8,2),iand(key_in(8,2),cas_bitmask(8,2,1)))), reunion_of_core_inact_bitmask(8,2)) )
else else
do i = 1, N_int do i = 1, N_int
number_of_holes = number_of_holes & number_of_holes = number_of_holes &
@ -108,7 +115,7 @@ integer function number_of_holes(key_in)
) & ) &
) & ) &
), reunion_of_core_inact_bitmask(i,1)) ) & ), reunion_of_core_inact_bitmask(i,1)) ) &
+ popcnt( xor( iand(reunion_of_core_inact_bitmask(i,1), xor(key_in(i,2),iand(key_in(i,2),cas_bitmask(i,1,1)))), reunion_of_core_inact_bitmask(i,1)) ) + popcnt( xor( iand(reunion_of_core_inact_bitmask(i,2), xor(key_in(i,2),iand(key_in(i,2),cas_bitmask(i,2,1)))), reunion_of_core_inact_bitmask(i,2)) )
enddo enddo
endif endif
end end

View File

@ -141,8 +141,8 @@ subroutine run_pt2_slave_small(thread,iproc,energy)
b%cur=0 b%cur=0
! ! Try to adjust n_tasks around nproc/2 seconds per job ! ! Try to adjust n_tasks around nproc/2 seconds per job
! n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0))) n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0)))
n_tasks = 1 ! n_tasks = 1
end do end do
integer, external :: disconnect_from_taskserver integer, external :: disconnect_from_taskserver

View File

@ -84,7 +84,7 @@ subroutine run_selection_slave(thread,iproc,energy)
if(ctask > 0) then if(ctask > 0) then
call sort_selection_buffer(buf) call sort_selection_buffer(buf)
! call merge_selection_buffers(buf,buf2) ! call merge_selection_buffers(buf,buf2)
print *, task_id(1), pt2(1), buf%cur, ctask !print *, task_id(1), pt2(1), buf%cur, ctask
call push_selection_results(zmq_socket_push, pt2, variance, norm, buf, task_id(1), ctask) call push_selection_results(zmq_socket_push, pt2, variance, norm, buf, task_id(1), ctask)
! buf%mini = buf2%mini ! buf%mini = buf2%mini
pt2(:) = 0d0 pt2(:) = 0d0

View File

@ -66,6 +66,12 @@ interface: ezfio
doc: Number of determinants in the current wave function doc: Number of determinants in the current wave function
type: integer type: integer
[n_det_qp_edit]
interface: ezfio
doc: Number of determinants to print in qp_edit
type: integer
interface: ezfio
[psi_coef] [psi_coef]
interface: ezfio interface: ezfio
doc: Coefficients of the wave function doc: Coefficients of the wave function
@ -78,6 +84,18 @@ doc: Determinants of the variational space
type: integer*8 type: integer*8
size: (determinants.n_int*determinants.bit_kind/8,2,determinants.n_det) size: (determinants.n_int*determinants.bit_kind/8,2,determinants.n_det)
[psi_coef_qp_edit]
interface: ezfio
doc: Coefficients of the wave function
type: double precision
size: (determinants.n_det_qp_edit,determinants.n_states)
[psi_det_qp_edit]
interface: ezfio
doc: Determinants of the variational space
type: integer*8
size: (determinants.n_int*determinants.bit_kind/8,2,determinants.n_det_qp_edit)
[expected_s2] [expected_s2]
interface: ezfio interface: ezfio
doc: Expected value of |S^2| doc: Expected value of |S^2|

View File

@ -269,7 +269,6 @@ subroutine save_natural_mos
END_DOC END_DOC
call set_natural_mos call set_natural_mos
call save_mos call save_mos
end end

View File

@ -44,6 +44,16 @@ BEGIN_PROVIDER [ integer, N_det ]
ASSERT (N_det > 0) ASSERT (N_det > 0)
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, N_det_qp_edit ]
implicit none
BEGIN_DOC
! Number of determinants to print in qp_edit
END_DOC
N_det_qp_edit = min(N_det,10000)
END_PROVIDER
BEGIN_PROVIDER [integer, max_degree_exc] BEGIN_PROVIDER [integer, max_degree_exc]
implicit none implicit none
integer :: i,degree integer :: i,degree
@ -476,7 +486,7 @@ subroutine save_wavefunction
endif endif
if (mpi_master) then if (mpi_master) then
call save_wavefunction_general(N_det,N_states,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted) call save_wavefunction_general(N_det,N_states,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
endif endif
end end
@ -504,12 +514,16 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
integer*8, allocatable :: psi_det_save(:,:,:) integer*8, allocatable :: psi_det_save(:,:,:)
double precision, allocatable :: psi_coef_save(:,:) double precision, allocatable :: psi_coef_save(:,:)
integer :: i,j,k double precision :: accu_norm
integer :: i,j,k, ndet_qp_edit
if (mpi_master) then if (mpi_master) then
ndet_qp_edit = min(ndet,N_det_qp_edit)
call ezfio_set_determinants_N_int(N_int) call ezfio_set_determinants_N_int(N_int)
call ezfio_set_determinants_bit_kind(bit_kind) call ezfio_set_determinants_bit_kind(bit_kind)
call ezfio_set_determinants_N_det(ndet) call ezfio_set_determinants_N_det(ndet)
call ezfio_set_determinants_N_det_qp_edit(ndet_qp_edit)
call ezfio_set_determinants_n_states(nstates) call ezfio_set_determinants_n_states(nstates)
call ezfio_set_determinants_mo_label(mo_label) call ezfio_set_determinants_mo_label(mo_label)
@ -522,10 +536,10 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
enddo enddo
enddo enddo
call ezfio_set_determinants_psi_det(psi_det_save) call ezfio_set_determinants_psi_det(psi_det_save)
call ezfio_set_determinants_psi_det_qp_edit(psi_det_save)
deallocate (psi_det_save) deallocate (psi_det_save)
allocate (psi_coef_save(ndet,nstates)) allocate (psi_coef_save(ndet,nstates))
double precision :: accu_norm
do k=1,nstates do k=1,nstates
do i=1,ndet do i=1,ndet
psi_coef_save(i,k) = psicoef(i,k) psi_coef_save(i,k) = psicoef(i,k)
@ -535,6 +549,18 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
call ezfio_set_determinants_psi_coef(psi_coef_save) call ezfio_set_determinants_psi_coef(psi_coef_save)
deallocate (psi_coef_save) deallocate (psi_coef_save)
allocate (psi_coef_save(ndet_qp_edit,nstates))
do k=1,nstates
do i=1,ndet_qp_edit
psi_coef_save(i,k) = psicoef(i,k)
enddo
call normalize(psi_coef_save(1,k),ndet_qp_edit)
enddo
call ezfio_set_determinants_psi_coef_qp_edit(psi_coef_save)
deallocate (psi_coef_save)
call write_int(6,ndet,'Saved determinants') call write_int(6,ndet,'Saved determinants')
endif endif
end end
@ -559,54 +585,80 @@ subroutine save_wavefunction_specified(ndet,nstates,psidet,psicoef,ndetsave,inde
integer :: N_int2 integer :: N_int2
equivalence (det_8, det_bk) equivalence (det_8, det_bk)
integer :: i,k integer :: i,j,k, ndet_qp_edit
call ezfio_set_determinants_N_int(N_int) if (mpi_master) then
call ezfio_set_determinants_bit_kind(bit_kind) ndet_qp_edit = min(ndetsave,N_det_qp_edit)
call ezfio_set_determinants_N_det(ndetsave) call ezfio_set_determinants_N_int(N_int)
call ezfio_set_determinants_n_states(nstates) call ezfio_set_determinants_bit_kind(bit_kind)
call ezfio_set_determinants_mo_label(mo_label) call ezfio_set_determinants_N_det(ndetsave)
call ezfio_set_determinants_N_det_qp_edit(ndet_qp_edit)
call ezfio_set_determinants_n_states(nstates)
call ezfio_set_determinants_mo_label(mo_label)
N_int2 = (N_int*bit_kind)/8 N_int2 = (N_int*bit_kind)/8
allocate (psi_det_save(N_int2,2,ndetsave)) allocate (psi_det_save(N_int2,2,ndetsave))
do i=1,ndetsave
do k=1,N_int
det_bk(k) = psidet(k,1,index_det_save(i))
enddo
do k=1,N_int2
psi_det_save(k,1,i) = det_8(k)
enddo
do k=1,N_int
det_bk(k) = psidet(k,2,index_det_save(i))
enddo
do k=1,N_int2
psi_det_save(k,2,i) = det_8(k)
enddo
enddo
call ezfio_set_determinants_psi_det(psi_det_save)
deallocate (psi_det_save)
allocate (psi_coef_save(ndetsave,nstates))
double precision :: accu_norm(nstates)
accu_norm = 0.d0
do k=1,nstates
do i=1,ndetsave do i=1,ndetsave
accu_norm(k) = accu_norm(k) + psicoef(index_det_save(i),k) * psicoef(index_det_save(i),k) do k=1,N_int
psi_coef_save(i,k) = psicoef(index_det_save(i),k) det_bk(k) = psidet(k,1,index_det_save(i))
enddo
do k=1,N_int2
psi_det_save(k,1,i) = det_8(k)
enddo
do k=1,N_int
det_bk(k) = psidet(k,2,index_det_save(i))
enddo
do k=1,N_int2
psi_det_save(k,2,i) = det_8(k)
enddo
enddo enddo
enddo call ezfio_set_determinants_psi_det(psi_det_save)
do k = 1, nstates call ezfio_set_determinants_psi_det_qp_edit(psi_det_save)
accu_norm(k) = 1.d0/dsqrt(accu_norm(k)) deallocate (psi_det_save)
enddo
do k=1,nstates
do i=1,ndetsave
psi_coef_save(i,k) = psi_coef_save(i,k) * accu_norm(k)
enddo
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save) allocate (psi_coef_save(ndetsave,nstates))
call write_int(6,ndet,'Saved determinants') double precision :: accu_norm(nstates)
deallocate (psi_coef_save) accu_norm = 0.d0
do k=1,nstates
do i=1,ndetsave
accu_norm(k) = accu_norm(k) + psicoef(index_det_save(i),k) * psicoef(index_det_save(i),k)
psi_coef_save(i,k) = psicoef(index_det_save(i),k)
enddo
enddo
do k = 1, nstates
accu_norm(k) = 1.d0/dsqrt(accu_norm(k))
enddo
do k=1,nstates
do i=1,ndetsave
psi_coef_save(i,k) = psi_coef_save(i,k) * accu_norm(k)
enddo
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save)
deallocate (psi_coef_save)
allocate (psi_coef_save(ndet_qp_edit,nstates))
accu_norm = 0.d0
do k=1,nstates
do i=1,ndet_qp_edit
accu_norm(k) = accu_norm(k) + psicoef(index_det_save(i),k) * psicoef(index_det_save(i),k)
psi_coef_save(i,k) = psicoef(index_det_save(i),k)
enddo
enddo
do k = 1, nstates
accu_norm(k) = 1.d0/dsqrt(accu_norm(k))
enddo
do k=1,nstates
do i=1,ndet_qp_edit
psi_coef_save(i,k) = psi_coef_save(i,k) * accu_norm(k)
enddo
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save)
deallocate (psi_coef_save)
call write_int(6,ndet,'Saved determinants')
endif
end end

View File

@ -37,6 +37,7 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2)
gama = 0.031091d0 gama = 0.031091d0
! correlation energy lsda1 ! correlation energy lsda1
call ec_only_lda_sr(0.d0,nup,ndo,e_c_lsda1) call ec_only_lda_sr(0.d0,nup,ndo,e_c_lsda1)
! correlation energy per particle ! correlation energy per particle
e_c_lsda1 = e_c_lsda1/rho e_c_lsda1 = e_c_lsda1/rho
xi = spin_d/rho xi = spin_d/rho
@ -62,6 +63,7 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2)
g_at2 = 1.d0/(1.d0 + 4.d0 * a*t*t)**0.25d0 g_at2 = 1.d0/(1.d0 + 4.d0 * a*t*t)**0.25d0
h1 = gama * phi_3 * dlog(1.d0 + w_1 * (1.d0 - g_at2)) h1 = gama * phi_3 * dlog(1.d0 + w_1 * (1.d0 - g_at2))
! interpolation function ! interpolation function
if(cst_1alph.gt.0.d0)then if(cst_1alph.gt.0.d0)then
fc_alpha = dexp(-c_1c * alpha * inv_1alph) fc_alpha = dexp(-c_1c * alpha * inv_1alph)
else else
@ -87,6 +89,7 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2)
ec_scan = e_c_1 + fc_alpha * (e_c_0 - e_c_1) ec_scan = e_c_1 + fc_alpha * (e_c_0 - e_c_1)
end end
double precision function beta_rs(rs) double precision function beta_rs(rs)
implicit none implicit none
double precision, intent(in) ::rs double precision, intent(in) ::rs

View File

@ -36,24 +36,24 @@ function run_stoch() {
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file f2.ezfio qp set_file f2.ezfio
qp set_frozen_core qp set_frozen_core
run_stoch -199.30496 1.e-4 run_stoch -199.30486 1.e-4
} }
@test "NH3" { # 10.6657s @test "NH3" { # 10.6657s
qp set_file nh3.ezfio qp set_file nh3.ezfio
qp set_mo_class --core="[1-4]" --act="[5-72]" qp set_mo_class --core="[1-4]" --act="[5-72]"
run -56.244753429144986 1.e-5 run -56.244753429144986 1.e-4
} }
@test "DHNO" { # 11.4721s @test "DHNO" { # 11.4721s
qp set_file dhno.ezfio qp set_file dhno.ezfio
qp set_mo_class --core="[1-7]" --act="[8-64]" qp set_mo_class --core="[1-7]" --act="[8-64]"
run -130.459020029816 1.e-5 run -130.459020029816 1.e-4
} }
@test "HCO" { # 12.2868s @test "HCO" { # 12.2868s
qp set_file hco.ezfio qp set_file hco.ezfio
run -113.297494345682 2.e-05 run -113.297494345682 1.e-4
} }
@test "H2O2" { # 12.9214s @test "H2O2" { # 12.9214s
@ -65,82 +65,82 @@ function run_stoch() {
@test "HBO" { # 13.3144s @test "HBO" { # 13.3144s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file hbo.ezfio qp set_file hbo.ezfio
run -100.214185815312 1.e-5 run -100.212829869715 1.e-4
} }
@test "H2O" { # 11.3727s @test "H2O" { # 11.3727s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file h2o.ezfio qp set_file h2o.ezfio
run -76.2359268957699 2.e-5 run -76.2359268957699 1.e-4
} }
@test "ClO" { # 13.3755s @test "ClO" { # 13.3755s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file clo.ezfio qp set_file clo.ezfio
run -534.546005867797 5.e-5 run -534.545881614967 1.e-4
} }
@test "SO" { # 13.4952s @test "SO" { # 13.4952s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file so.ezfio qp set_file so.ezfio
run -26.0124797722154 1.e-5 run -26.0158153138924 1.e-4
} }
@test "H2S" { # 13.6745s @test "H2S" { # 13.6745s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file h2s.ezfio qp set_file h2s.ezfio
run -398.859480581924 1.e-5 run -398.859168655255 1.e-4
} }
@test "OH" { # 13.865s @test "OH" { # 13.865s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file oh.ezfio qp set_file oh.ezfio
run -75.6119887538831 1.e-05 run -75.6120779012574 1.e-4
} }
@test "SiH2_3B1" { # 13.938ss @test "SiH2_3B1" { # 13.938ss
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file sih2_3b1.ezfio qp set_file sih2_3b1.ezfio
run -290.017539006762 1.e-5 run -290.017539006762 1.e-4
} }
@test "H3COH" { # 14.7299s @test "H3COH" { # 14.7299s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file h3coh.ezfio qp set_file h3coh.ezfio
run -115.205054063687 1.e-5 run -115.205941463667 1.e-4
} }
@test "SiH3" { # 15.99s @test "SiH3" { # 15.99s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file sih3.ezfio qp set_file sih3.ezfio
run -5.57269434557089 2.e-05 run -5.57241217753818 1.e-4
} }
@test "CH4" { # 16.1612s @test "CH4" { # 16.1612s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file ch4.ezfio qp set_file ch4.ezfio
qp set_mo_class --core="[1]" --act="[2-30]" --del="[31-59]" qp set_mo_class --core="[1]" --act="[2-30]" --del="[31-59]"
run -40.2409059687324 2.e-5 run -40.2409678239136 1.e-4
} }
@test "ClF" { # 16.8864s @test "ClF" { # 16.8864s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file clf.ezfio qp set_file clf.ezfio
run -559.170406471496 1.e-5 run -559.170272077166 1.e-4
} }
@test "SO2" { # 17.5645s @test "SO2" { # 17.5645s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file so2.ezfio qp set_file so2.ezfio
qp set_mo_class --core="[1-8]" --act="[9-87]" qp set_mo_class --core="[1-8]" --act="[9-87]"
run -41.5746738713298 5.e-5 run -41.5746738713298 1.e-4
} }
@test "C2H2" { # 17.6827s @test "C2H2" { # 17.6827s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file c2h2.ezfio qp set_file c2h2.ezfio
qp set_mo_class --act="[1-30]" --del="[31-36]" qp set_mo_class --act="[1-30]" --del="[31-36]"
run -12.3670840202635 2.e-5 run -12.3656179738175 1.e-4
} }
@test "N2" { # 18.0198s @test "N2" { # 18.0198s
@ -154,14 +154,14 @@ function run_stoch() {
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file n2h4.ezfio qp set_file n2h4.ezfio
qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-48]" qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-48]"
run -111.367234092521 2.e-5 run -111.367332681559 1.e-4
} }
@test "CO2" { # 21.1748s @test "CO2" { # 21.1748s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file co2.ezfio qp set_file co2.ezfio
qp set_mo_class --core="[1,2]" --act="[3-30]" --del="[31-42]" qp set_mo_class --core="[1,2]" --act="[3-30]" --del="[31-42]"
run -187.969676381867 1.e-5 run -187.968599504402 1.e-4
} }
@ -169,13 +169,13 @@ function run_stoch() {
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file cu_nh3_4_2plus.ezfio qp set_file cu_nh3_4_2plus.ezfio
qp set_mo_class --core="[1-24]" --act="[25-45]" --del="[46-87]" qp set_mo_class --core="[1-24]" --act="[25-45]" --del="[46-87]"
run -1862.98610987882 1.e-05 run -1862.98614665139 1.e-04
} }
@test "HCN" { # 20.3273s @test "HCN" { # 20.3273s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
qp set_file hcn.ezfio qp set_file hcn.ezfio
qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-55]" qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-55]"
run -93.0799328685679 2.e-5 run -93.0728641601823 1.e-4
} }