mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-12 22:53:29 +01:00
Merge branch 'bugfix' of github.com:QuantumPackage/qp2 into bugfix
This commit is contained in:
commit
9ef3e904de
@ -143,7 +143,7 @@ IRPF90
|
||||
to Parameters (IRP) method.
|
||||
|
||||
* Download the latest version of IRPF90
|
||||
here : `<https://github.com/scemama/irpf90/releases/latest>`_ and move
|
||||
here : `<https://gitlab.com/scemama/irpf90/-/archive/v1.7.2/irpf90-v1.7.2.tar.gz>`_ and move
|
||||
the downloaded archive in the :file:`${QP_ROOT}/external` directory
|
||||
|
||||
* Extract the archive and go into the :file:`irpf90-*` directory to run
|
||||
|
1
REPLACE
1
REPLACE
@ -834,3 +834,4 @@ qp_name potential_sr_c_alpha_ao_pbe --rename=potential_c_alpha_ao_sr_pbe
|
||||
qp_name potential_sr_c_beta_ao_pbe --rename=potential_c_beta_ao_sr_pbe
|
||||
qp_name potential_sr_xc_alpha_ao_pbe --rename=potential_xc_alpha_ao_sr_pbe
|
||||
qp_name potential_sr_xc_beta_ao_pbe --rename=potential_xc_beta_ao_sr_pbe
|
||||
qp_name disk_access_nuclear_repulsion --rename=io_nuclear_repulsion
|
||||
|
@ -1,71 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
|
||||
"""
|
||||
Creates an ssh tunnel for using slaves on another network.
|
||||
Launch a server on the front-end node of the cluster on which the master
|
||||
process runs. Then start a client ont the front-end node of the distant
|
||||
cluster.
|
||||
|
||||
Usage:
|
||||
qp_tunnel server EZFIO_DIR
|
||||
qp_tunnel client <address> EZFIO_DIR
|
||||
|
||||
Options:
|
||||
-h --help
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import zmq
|
||||
|
||||
try:
|
||||
import qp_path
|
||||
except ImportError:
|
||||
print "source .quantum_package.rc"
|
||||
raise
|
||||
|
||||
from docopt import docopt
|
||||
from ezfio import ezfio
|
||||
|
||||
|
||||
def get_address(filename):
|
||||
with open(os.path.join(filename,'work','qp_run_address'),'r') as f:
|
||||
a = f.readlines()[0].strip()
|
||||
return a
|
||||
|
||||
|
||||
def set_address(filename,address):
|
||||
with open(os.path.join(filename,'work','qp_run_address'),'r') as f:
|
||||
backup = f.readlines()
|
||||
|
||||
with open(os.path.join(filename,'work','qp_run_address'),'w') as f:
|
||||
f.write('\n'.join([address]+backup))
|
||||
|
||||
|
||||
def main_server(arguments,filename):
|
||||
destination = get_address(filename)
|
||||
print destination
|
||||
|
||||
|
||||
def main_client(arguments,filename):
|
||||
destination = arguments["<address>"]
|
||||
print destination
|
||||
|
||||
|
||||
def main(arguments):
|
||||
"""Main function"""
|
||||
|
||||
print arguments
|
||||
filename = arguments["EZFIO_DIR"]
|
||||
|
||||
if arguments["server"]:
|
||||
return main_server(arguments, filename)
|
||||
if arguments["client"]:
|
||||
return main_client(arguments, filename)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ARGUMENTS = docopt(__doc__)
|
||||
main(ARGUMENTS)
|
29
configure
vendored
29
configure
vendored
@ -290,6 +290,9 @@ EOF
|
||||
# Special commands for Travis CI
|
||||
chmod +x "${QP_ROOT}"/external/opam_installer.sh
|
||||
rm --force ${QP_ROOT}/bin/opam
|
||||
if [[ -n ${NO_CACHE} ]] ; then
|
||||
rm -rf ${HOME}/.opam
|
||||
fi
|
||||
export OPAMROOT=${HOME}/.opam
|
||||
cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup
|
||||
${QP_ROOT}/bin
|
||||
@ -310,21 +313,21 @@ EOF
|
||||
else
|
||||
# Conventional commands
|
||||
execute << EOF
|
||||
chmod +x "\${QP_ROOT}"/external/opam_installer.sh
|
||||
"\${QP_ROOT}"/external/opam_installer.sh --no-backup
|
||||
chmod +x "${QP_ROOT}"/external/opam_installer.sh
|
||||
"${QP_ROOT}"/external/opam_installer.sh --no-backup
|
||||
EOF
|
||||
execute << EOF
|
||||
rm --force \${QP_ROOT}/bin/opam
|
||||
export OPAMROOT=\${OPAMROOT:-\${QP_ROOT}/external/opam}
|
||||
echo \${QP_ROOT}/bin \
|
||||
| sh \${QP_ROOT}/external/opam_installer.sh
|
||||
rm --force ${QP_ROOT}/bin/opam
|
||||
export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam}
|
||||
echo ${QP_ROOT}/bin \
|
||||
| sh ${QP_ROOT}/external/opam_installer.sh
|
||||
EOF
|
||||
rm ${QP_ROOT}/external/opam_installer.sh
|
||||
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
|
||||
# opam switch create ocaml-base-compiler.4.07.1 || exit 1
|
||||
|
||||
opam init --verbose --yes --compiler=4.07.1 --disable-sandboxing
|
||||
eval $(opam env)
|
||||
EOF
|
||||
execute << EOF
|
||||
opam install -y \${OCAML_PACKAGES} || exit 1
|
||||
EOF
|
||||
@ -423,18 +426,18 @@ if [[ ${ZLIB} = $(not_found) ]] ; then
|
||||
fail
|
||||
fi
|
||||
|
||||
BWRAP=$(find_exe bwrap)
|
||||
if [[ ${BWRAP} = $(not_found) ]] ; then
|
||||
error "Bubblewrap (bwrap) is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
LIBCAP=$(find_lib -lcap)
|
||||
if [[ ${LIBCAP} = $(not_found) ]] ; then
|
||||
error "Libcap (libcap) is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
BWRAP=$(find_exe bwrap)
|
||||
if [[ ${BWRAP} = $(not_found) ]] ; then
|
||||
error "Bubblewrap (bwrap) is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
OPAM=$(find_exe opam)
|
||||
if [[ ${OPAM} = $(not_found) ]] ; then
|
||||
error "OPAM (ocaml) package manager is not installed."
|
||||
|
@ -8,6 +8,16 @@ S 1
|
||||
S 1
|
||||
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
|
||||
S 6
|
||||
1 642.4189200 0.0021426
|
||||
|
@ -1,14 +1,27 @@
|
||||
|
||||
HYDROGEN
|
||||
S 3
|
||||
1 18.7311370 0.03349460
|
||||
2 2.8253937 0.23472695
|
||||
3 0.6401217 0.81375733
|
||||
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.1612778 1.0000000
|
||||
1 0.1612777588E+00 1.0000000
|
||||
S 1
|
||||
1 0.0360000 1.0000000
|
||||
1 0.3600000000E-01 0.1000000000E+01
|
||||
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
|
||||
S 6
|
||||
|
@ -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
|
||||
S 6
|
||||
1 642.4189200 0.0021426
|
||||
|
@ -14,6 +14,18 @@ P 1
|
||||
P 1
|
||||
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
|
||||
S 6
|
||||
1 900.4600000 0.00228704
|
||||
|
@ -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
|
||||
S 6
|
||||
1 900.4600000 0.00228704
|
||||
|
@ -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
|
||||
S 6
|
||||
1 900.4600000 0.00228704
|
||||
|
@ -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
|
||||
S 6
|
||||
1 642.4189200 0.0021426
|
||||
|
BIN
data/qp2.png
BIN
data/qp2.png
Binary file not shown.
Before Width: | Height: | Size: 5.9 MiB After Width: | Height: | Size: 351 KiB |
BIN
data/qp2_hd.png
Normal file
BIN
data/qp2_hd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 MiB |
@ -1,6 +1,16 @@
|
||||
%%% ARXIV TO BE UPDATED %%%
|
||||
@article{Hollett2019Aug,
|
||||
author = {Hollett, Joshua W. and Loos, Pierre-Fran{\c{c}}ois},
|
||||
title = {{Capturing static and dynamic correlation with $\Delta \text{NO}$-MP2 and $\Delta \text{NO}$-CCSD}},
|
||||
journal = {arXiv},
|
||||
year = {2019},
|
||||
month = {Aug},
|
||||
eprint = {1908.09914},
|
||||
url = {https://arxiv.org/abs/1908.09914}
|
||||
}
|
||||
|
||||
@article{Giner2019Jul,
|
||||
author = {Giner, Emmanuel and Scemama, Anthony and Toulouse, Julien and Loos, Pierre-Fran{\ifmmode\mbox{\c{c}}\else\c{c}\fi}ois},
|
||||
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 = {arXiv},
|
||||
year = {2019},
|
||||
@ -9,29 +19,66 @@
|
||||
url = {https://arxiv.org/abs/1907.01245}
|
||||
}
|
||||
|
||||
@article{Dash2019May,
|
||||
author = {Dash, Monika and Feldt, Jonas and Moroni, Saverio and Scemama, Anthony and Filippi, Claudia},
|
||||
title = {{Excited states with selected CI-QMC: chemically accurate excitation energies and geometries}},
|
||||
journal = {arXiv},
|
||||
year = {2019},
|
||||
month = {May},
|
||||
eprint = {1905.06737},
|
||||
url = {https://arxiv.org/abs/1905.06737}
|
||||
}
|
||||
|
||||
@article{Burton2019May,
|
||||
author = {Burton, Hugh G. A. and Thom, Alex J. W.},
|
||||
title = {{A General Approach for Multireference Ground and Excited States using Non-Orthogonal Configuration Interaction}},
|
||||
journal = {arXiv},
|
||||
year = {2019},
|
||||
month = {May},
|
||||
eprint = {1905.02626},
|
||||
url = {https://arxiv.org/abs/1905.02626}
|
||||
}
|
||||
|
||||
|
||||
|
||||
%%%% PUBLISHED PAPERS
|
||||
@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,
|
||||
doi = {10.1063/1.5082638},
|
||||
url = {https://doi.org/10.1063%2F1.5082638},
|
||||
year = 2019,
|
||||
month = {feb},
|
||||
publisher = {{AIP} Publishing},
|
||||
volume = {150},
|
||||
number = {8},
|
||||
pages = {084103},
|
||||
author = {Anthony Fert{\'{e}} and Emmanuel Giner and Julien Toulouse},
|
||||
title = {Range-separated multideterminant density-functional theory with a short-range correlation functional of the on-top pair density},
|
||||
journal = {The Journal of Chemical Physics}
|
||||
}
|
||||
|
||||
@article{Caffarel_2019,
|
||||
doi = {10.1063/1.5114703},
|
||||
url = {https://doi.org/10.1063%2F1.5114703},
|
||||
year = 2019,
|
||||
month = {aug},
|
||||
publisher = {{AIP} Publishing},
|
||||
volume = {151},
|
||||
number = {6},
|
||||
pages = {064101},
|
||||
author = {Michel Caffarel},
|
||||
title = {Evaluating two-electron-repulsion integrals over arbitrary orbitals using zero variance Monte Carlo: Application to full configuration interaction calculations with Slater-type orbitals},
|
||||
journal = {The Journal of Chemical Physics}
|
||||
}
|
||||
|
||||
@article{Loos_2019,
|
||||
doi = {10.1021/acs.jpclett.9b01176},
|
||||
url = {https://doi.org/10.1021%2Facs.jpclett.9b01176},
|
||||
|
89
docs/source/users_guide/qp_tunnel.rst
Normal file
89
docs/source/users_guide/qp_tunnel.rst
Normal file
@ -0,0 +1,89 @@
|
||||
.. _qp_tunnel:
|
||||
|
||||
=========
|
||||
qp_tunnel
|
||||
=========
|
||||
|
||||
.. TODO
|
||||
|
||||
.. program:: qp_tunnel
|
||||
|
||||
Establishes a tunnel to allow communications between machines within
|
||||
different networks, for example multiple MPI slave jobs running on
|
||||
different clusters.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code:: bash
|
||||
|
||||
qp_tunnel [-g] (ADDRESS|EZFIO_DIR)
|
||||
|
||||
``EZFIO_DIR`` is the name of the |EZFIO| directory containing the data,
|
||||
and ``ADDRESS`` is the address of another tunnel.
|
||||
|
||||
|
||||
.. option:: -h, --help
|
||||
|
||||
Displays the help message
|
||||
|
||||
|
||||
.. option:: -g, --get-input
|
||||
|
||||
Download the EZFIO directory from the remote instance of qp_tunnel.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. code:: text
|
||||
|
||||
+-------------------+ +------------------+
|
||||
| | | |
|
||||
| N1_1 N1_2 N1_3 | | N2_1 N2_2 N2_3 |
|
||||
| | | | | | | | | |
|
||||
| +----+----+ | | +----+----+ |
|
||||
| | | | | |
|
||||
| C1 F1 | | F2 C2 |
|
||||
| +---------=----=--------+ |
|
||||
| | | |
|
||||
+-------------------+ +------------------+
|
||||
|
||||
|
||||
Imagine you have two clusters, C1 and C2. Each cluster is accessible via SSH
|
||||
on a front-end named respectively F1 and F2. Groups of nodes N1 and N2 have
|
||||
been reserved by the batch scheduling system on both clusters.
|
||||
Each node in N1 is on the same network as the other nodes of N1, but they
|
||||
can't access the network on which the nodes of N2 are.
|
||||
|
||||
1) Start a parallel simulation on the cluster C1, running on nodes N1.
|
||||
We assume that there is a shared file system, such that F1 can access
|
||||
the EZFIO directory. We also assume that F1 can communicate with the
|
||||
nodes of N1.
|
||||
|
||||
2) Run a tunnel on the front-end F1 and keep it running:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
me@f1 $ qp_tunnel my_directory.ezfio
|
||||
Connect to:
|
||||
tcp://31.122.230.47:42379
|
||||
Ready
|
||||
|
||||
3) On the front-end F2, run another instance connecting to the other one,
|
||||
which will fetch the |EZFIO| directory:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
me@f2 $ qp_tunnel --get-input tcp://31.122.230.47:42379
|
||||
Connect to:
|
||||
tcp://31.122.209.139:42379
|
||||
Communication [ OK ]
|
||||
Getting input... my_directory.ezfio ...done
|
||||
Ready
|
||||
|
||||
4) Keep the tunnel running, and you can now run a slave simulation within the
|
||||
nodes N2.
|
||||
|
||||
|
@ -115,7 +115,7 @@ create an |EZFIO| database with the 6-31G basis set:
|
||||
|
||||
.. 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
|
||||
and the atomic basis set:
|
||||
|
139
man/qp_tunnel.1
Normal file
139
man/qp_tunnel.1
Normal file
@ -0,0 +1,139 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "QP_TUNNEL" "1" "Jun 15, 2019" "2.0" "Quantum Package"
|
||||
.SH NAME
|
||||
qp_tunnel \- | Quantum Package >
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.sp
|
||||
Establishes a tunnel to allow communications between machines within
|
||||
different networks, for example multiple MPI slave jobs running on
|
||||
different clusters.
|
||||
.SH USAGE
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
qp_tunnel [\-g] (ADDRESS|EZFIO_DIR)
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
\fBEZFIO_DIR\fP is the name of the \fI\%EZFIO\fP directory containing the data,
|
||||
and \fBADDRESS\fP is the address of another tunnel.
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
Displays the help message
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-g, \-\-get\-input
|
||||
Download the EZFIO directory from the remote instance of qp_tunnel.
|
||||
.UNINDENT
|
||||
.SH EXAMPLE
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
||||
| | | |
|
||||
| N1_1 N1_2 N1_3 | | N2_1 N2_2 N2_3 |
|
||||
| | | | | | | | | |
|
||||
| +\-\-\-\-+\-\-\-\-+ | | +\-\-\-\-+\-\-\-\-+ |
|
||||
| | | | | |
|
||||
| C1 F1 | | F2 C2 |
|
||||
| +\-\-\-\-\-\-\-\-\-=\-\-\-\-=\-\-\-\-\-\-\-\-+ |
|
||||
| | | |
|
||||
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
Imagine you have two clusters, C1 and C2. Each cluster is accessible via SSH
|
||||
on a front\-end named respectively F1 and F2. Groups of nodes N1 and N2 have
|
||||
been reserved by the batch scheduling system on both clusters.
|
||||
Each node in N1 is on the same network as the other nodes of N1, but they
|
||||
can’t access the network on which the nodes of N2 are.
|
||||
.INDENT 0.0
|
||||
.IP 1. 3
|
||||
Start a parallel simulation on the cluster C1, running on nodes N1.
|
||||
We assume that there is a shared file system, such that F1 can access
|
||||
the EZFIO directory. We also assume that F1 can communicate with the
|
||||
nodes of N1.
|
||||
.IP 2. 3
|
||||
Run a tunnel on the front\-end F1 and keep it running:
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
me@f1 $ qp_tunnel my_directory.ezfio
|
||||
Connect to:
|
||||
tcp://31.122.230.47:42379
|
||||
Ready
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.IP 3. 3
|
||||
On the front\-end F2, run another instance connecting to the other one,
|
||||
which will fetch the \fI\%EZFIO\fP directory:
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
me@f2 $ qp_tunnel \-\-get\-input tcp://31.122.230.47:42379
|
||||
Connect to:
|
||||
tcp://31.122.209.139:42379
|
||||
Communication [ OK ]
|
||||
Getting input... my_directory.ezfio ...done
|
||||
Ready
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.IP 4. 3
|
||||
Keep the tunnel running, and you can now run a slave simulation within the
|
||||
nodes N2.
|
||||
.UNINDENT
|
||||
.SH AUTHOR
|
||||
A. Scemama, E. Giner
|
||||
.SH COPYRIGHT
|
||||
2019, A. Scemama, E. Giner
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
@ -34,7 +34,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.INDENT 3.5
|
||||
Rotates molecular orbitals i and j by combining them as
|
||||
$1/sqrt{2} ( phi_i + phi_j )$ and
|
||||
$1/sqrt{2} ( phi_i \- phi_j )$.
|
||||
$1/sqrt{2} ( phi_i - phi_j )$.
|
||||
.sp
|
||||
Needs:
|
||||
.INDENT 0.0
|
||||
|
55
man/test.1
Normal file
55
man/test.1
Normal file
@ -0,0 +1,55 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "TEST" "1" "Jun 15, 2019" "2.0" "Quantum Package"
|
||||
.SH NAME
|
||||
test \- | Quantum Package >
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
Calls:
|
||||
.INDENT 0.0
|
||||
.INDENT 2.0
|
||||
.IP \(bu 2
|
||||
\fBtwo_e_integrals_index()\fP
|
||||
.UNINDENT
|
||||
.INDENT 2.0
|
||||
.IP \(bu 2
|
||||
\fBtwo_e_integrals_index_reverse()\fP
|
||||
.UNINDENT
|
||||
.INDENT 2.0
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.SH AUTHOR
|
||||
A. Scemama, E. Giner
|
||||
.SH COPYRIGHT
|
||||
2019, A. Scemama, E. Giner
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
@ -1,4 +1,4 @@
|
||||
PKG core ZMQ cryptokit
|
||||
PKG core zmq cryptokit
|
||||
B _build/
|
||||
|
||||
|
||||
|
214
ocaml/Bitlist.ml
214
ocaml/Bitlist.ml
@ -7,82 +7,61 @@ Type for bits strings
|
||||
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 *)
|
||||
let to_string b =
|
||||
let rec do_work accu = function
|
||||
| [] -> accu
|
||||
| head :: tail ->
|
||||
let new_accu = (Bit.to_string head) ^ accu
|
||||
in do_work new_accu tail
|
||||
let int64_to_string x =
|
||||
String.init 64 (fun i ->
|
||||
if Int64.logand x @@ Int64.shift_left 1L i <> 0L then
|
||||
'+'
|
||||
else
|
||||
'-')
|
||||
in
|
||||
do_work "" b
|
||||
Array.map int64_to_string b
|
||||
|> Array.to_list
|
||||
|> String.concat ""
|
||||
|
||||
|
||||
let of_string ?(zero='0') ?(one='1') s =
|
||||
List.init (String.length s) (String.get s)
|
||||
|> List.rev_map ( fun c ->
|
||||
if (c = zero) then Bit.Zero
|
||||
else if (c = one) then Bit.One
|
||||
else (failwith ("Error in bitstring ") ) )
|
||||
let n_int = ( (String.length s - 1) lsr 6 ) + 1 in
|
||||
let result = Array.make n_int 0L in
|
||||
String.iteri (fun i c ->
|
||||
if c = one then
|
||||
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 =
|
||||
List.init (String.length s) (String.get s)
|
||||
|> List.rev_map (function
|
||||
| '-' -> Bit.Zero
|
||||
| '+' -> Bit.One
|
||||
| _ -> failwith ("Error in bitstring ") )
|
||||
let of_string_mp = of_string ~zero:'-' ~one:'+'
|
||||
|
||||
|
||||
(* Create a bit list from an int64 *)
|
||||
let of_int64 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)
|
||||
|
||||
let of_int64 i = [| i |]
|
||||
|
||||
(* Create an int64 from a bit list *)
|
||||
let to_int64 l =
|
||||
assert ( (List.length l) <= 64) ;
|
||||
let rec do_work accu = function
|
||||
| [] -> 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)
|
||||
let to_int64 = function
|
||||
| [| i |] -> i
|
||||
| _ -> failwith "N_int > 1"
|
||||
|
||||
|
||||
(* 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 *)
|
||||
let of_int64_array l =
|
||||
Array.map of_int64 l
|
||||
|> Array.to_list
|
||||
|> List.concat
|
||||
external of_int64_array : int64 array -> t = "%identity"
|
||||
external to_int64_array : t -> int64 array = "%identity"
|
||||
|
||||
|
||||
(* Create a bit list from a list of int64 *)
|
||||
let of_int64_list l =
|
||||
Array.of_list l |> of_int64_array
|
||||
|
||||
|
||||
(* 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 )
|
||||
|
||||
|
||||
(* 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 *)
|
||||
let to_int64_list l =
|
||||
let rec do_work accu buf counter = function
|
||||
| [] ->
|
||||
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
|
||||
to_int64_array l |> Array.to_list
|
||||
|
||||
(* 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 *)
|
||||
let of_mo_number_list n_int l =
|
||||
let n_int = N_int_number.to_int n_int in
|
||||
let length = n_int*64 in
|
||||
let a = Array.make length (Bit.Zero) in
|
||||
List.iter (fun i-> a.((MO_number.to_int i)-1) <- Bit.One) l;
|
||||
Array.to_list a
|
||||
let result = zero n_int in
|
||||
List.iter (fun j ->
|
||||
let i = (MO_number.to_int j) - 1 in
|
||||
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;
|
||||
) l;
|
||||
result
|
||||
|
||||
|
||||
let to_mo_number_list l =
|
||||
let a = Array.of_list l in
|
||||
let mo_num = MO_number.get_max () in
|
||||
let rec do_work accu = function
|
||||
| 0 -> accu
|
||||
| i ->
|
||||
begin
|
||||
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
|
||||
let rec aux_one x shift accu = function
|
||||
| -1 -> accu
|
||||
| i -> if Int64.logand x (Int64.shift_left 1L i) <> 0L then
|
||||
aux_one x shift ( (i+shift) ::accu) (i-1)
|
||||
else
|
||||
aux_one x shift accu (i-1)
|
||||
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 *)
|
||||
let logical_operator2 op a b =
|
||||
let rec do_work_binary result a b =
|
||||
match a, b with
|
||||
| [], [] -> result
|
||||
| [], _ | _ , [] -> 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 and_operator a b = Array.map2 Int64.logand a b
|
||||
let xor_operator a b = Array.map2 Int64.logxor a b
|
||||
let or_operator a b = Array.map2 Int64.logor a b
|
||||
let not_operator b = Array.map Int64.lognot b
|
||||
|
||||
|
||||
|
||||
let pop_sign =
|
||||
let mask =
|
||||
(Int64.pred (Int64.shift_left 1L 63))
|
||||
in
|
||||
List.rev (do_work_binary [] a b)
|
||||
|
||||
|
||||
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
|
||||
fun x -> Int64.logand mask x
|
||||
|
||||
|
||||
let popcnt b =
|
||||
List.fold_left (fun accu -> function
|
||||
| Bit.One -> accu+1
|
||||
| Bit.Zero -> accu
|
||||
) 0 b
|
||||
Array.fold_left (fun accu x ->
|
||||
if x >= 0L then
|
||||
accu + (Z.popcount @@ Z.of_int64 x)
|
||||
else
|
||||
accu + 1 + (Z.popcount @@ Z.of_int64 (pop_sign x))
|
||||
) 0 b
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
type t = Bit.t list
|
||||
type t
|
||||
|
||||
(** The zero bit list *)
|
||||
val zero : Qptypes.N_int_number.t -> t
|
||||
|
@ -3,7 +3,8 @@ open Sexplib.Std
|
||||
|
||||
type t = int64 array [@@deriving sexp]
|
||||
|
||||
let to_int64_array (x:t) = (x:int64 array)
|
||||
external to_int64_array : t -> int64 array = "%identity"
|
||||
external of_int64_array_no_check : int64 array -> t = "%identity"
|
||||
|
||||
|
||||
let to_alpha_beta x =
|
||||
@ -24,19 +25,6 @@ let to_bitlist_couple x =
|
||||
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 =
|
||||
@ -47,38 +35,29 @@ let of_int64_array ~n_int ~alpha ~beta x =
|
||||
in
|
||||
if ( (Bitlist.popcnt a) <> alpha) then
|
||||
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
|
||||
%s" alpha (bitlist_to_string ~mo_num:mo_num a) )
|
||||
%s" alpha (Bitlist.to_string a) )
|
||||
end;
|
||||
if ( (Bitlist.popcnt b) <> beta ) then
|
||||
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
|
||||
%s" beta (bitlist_to_string ~mo_num:mo_num b) )
|
||||
%s" beta (Bitlist.to_string b) )
|
||||
end;
|
||||
x
|
||||
|
||||
let of_int64_array_no_check 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 =
|
||||
Bitlist.to_int64_array xa ,
|
||||
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
|
||||
of_int64_array ~n_int ~alpha ~beta (Array.concat [ba;bb])
|
||||
|
||||
|
||||
let to_string ~mo_num x =
|
||||
let (xa,xb) = to_bitlist_couple x in
|
||||
[ " " ; bitlist_to_string ~mo_num xa ; "\n" ;
|
||||
" " ; bitlist_to_string ~mo_num xb ]
|
||||
[ " " ; Bitlist.to_string xa ; "\n" ;
|
||||
" " ; Bitlist.to_string xb ]
|
||||
|> String.concat ""
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ val to_alpha_beta : t -> (int64 array)*(int64 array)
|
||||
val to_bitlist_couple : t -> Bitlist.t * Bitlist.t
|
||||
|
||||
(** 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 ->
|
||||
beta:Qptypes.Elec_beta_number.t ->
|
||||
Bitlist.t * Bitlist.t -> t
|
||||
|
@ -7,14 +7,14 @@ module Determinants_by_hand : sig
|
||||
{ n_int : N_int_number.t;
|
||||
bit_kind : Bit_kind.t;
|
||||
n_det : Det_number.t;
|
||||
n_det_qp_edit : Det_number.t;
|
||||
n_states : States_number.t;
|
||||
expected_s2 : Positive_float.t;
|
||||
psi_coef : Det_coef.t array;
|
||||
psi_det : Determinant.t array;
|
||||
state_average_weight : Positive_float.t array;
|
||||
} [@@deriving sexp]
|
||||
val read : unit -> t
|
||||
val read_maybe : unit -> t option
|
||||
val read : ?full:bool -> unit -> t option
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
@ -28,6 +28,7 @@ end = struct
|
||||
{ n_int : N_int_number.t;
|
||||
bit_kind : Bit_kind.t;
|
||||
n_det : Det_number.t;
|
||||
n_det_qp_edit : Det_number.t;
|
||||
n_states : States_number.t;
|
||||
expected_s2 : Positive_float.t;
|
||||
psi_coef : Det_coef.t array;
|
||||
@ -38,8 +39,6 @@ end = struct
|
||||
|
||||
let get_default = Qpackage.get_ezfio_default "determinants";;
|
||||
|
||||
let n_det_read_max = 10_000 ;;
|
||||
|
||||
let read_n_int () =
|
||||
if not (Ezfio.has_determinants_n_int()) then
|
||||
Ezfio.get_mo_basis_mo_num ()
|
||||
@ -80,11 +79,27 @@ end = struct
|
||||
|> 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 =
|
||||
Det_number.to_int n
|
||||
|> 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 () =
|
||||
if not (Ezfio.has_determinants_n_states ()) then
|
||||
Ezfio.set_determinants_n_states 1
|
||||
@ -178,7 +193,7 @@ end = struct
|
||||
|> Ezfio.set_determinants_expected_s2
|
||||
;;
|
||||
|
||||
let read_psi_coef () =
|
||||
let read_psi_coef ~read_only () =
|
||||
if not (Ezfio.has_determinants_psi_coef ()) then
|
||||
begin
|
||||
let n_states =
|
||||
@ -189,24 +204,33 @@ end = struct
|
||||
~data:(List.init n_states (fun i -> if (i=0) then 1. else 0. ))
|
||||
|> Ezfio.set_determinants_psi_coef
|
||||
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
|
||||
|> Array.map Det_coef.of_float
|
||||
;;
|
||||
|
||||
let write_psi_coef ~n_det ~n_states c =
|
||||
let n_det = Det_number.to_int n_det
|
||||
and c = Array.to_list c
|
||||
|> List.map Det_coef.to_float
|
||||
and c =
|
||||
Array.map Det_coef.to_float c
|
||||
|> Array.to_list
|
||||
and n_states =
|
||||
States_number.to_int n_states
|
||||
in
|
||||
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| n_det ; n_states |] ~data:c
|
||||
|> Ezfio.set_determinants_psi_coef
|
||||
let r =
|
||||
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 ()
|
||||
and n_alpha = Ezfio.get_electrons_elec_alpha_num ()
|
||||
|> Elec_alpha_number.of_int
|
||||
@ -232,19 +256,26 @@ end = struct
|
||||
|> Ezfio.set_determinants_psi_det ;
|
||||
end ;
|
||||
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
|
||||
and data = Ezfio.flattened_ezfio psi_det_array
|
||||
in
|
||||
assert (n_int = dim.(0));
|
||||
assert (dim.(1) = 2);
|
||||
assert (dim.(2) = (Det_number.to_int (read_n_det ())));
|
||||
List.init dim.(2) (fun i ->
|
||||
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.sub data (2*n_int*i) (2*n_int) )
|
||||
|> List.map (Determinant.of_int64_array
|
||||
|> Array.map (Determinant.of_int64_array
|
||||
~n_int:(N_int_number.of_int n_int)
|
||||
~alpha:n_alpha ~beta:n_beta )
|
||||
|> Array.of_list
|
||||
;;
|
||||
|
||||
let write_psi_det ~n_int ~n_det d =
|
||||
@ -252,40 +283,45 @@ end = struct
|
||||
|> Array.concat
|
||||
|> Array.to_list
|
||||
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
|
||||
|> Ezfio.set_determinants_psi_det
|
||||
let r =
|
||||
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
|
||||
try
|
||||
Some
|
||||
{ n_int = read_n_int () ;
|
||||
bit_kind = read_bit_kind () ;
|
||||
n_det = read_n_det () ;
|
||||
n_det_qp_edit = read_n_det_qp_edit () ;
|
||||
expected_s2 = read_expected_s2 () ;
|
||||
psi_coef = read_psi_coef () ;
|
||||
psi_det = read_psi_det () ;
|
||||
psi_coef = read_psi_coef ~read_only () ;
|
||||
psi_det = read_psi_det ~read_only () ;
|
||||
n_states = read_n_states () ;
|
||||
state_average_weight = read_state_average_weight () ;
|
||||
}
|
||||
with _ -> None
|
||||
else
|
||||
failwith "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
|
||||
(* No molecular orbitals, so no determinants *)
|
||||
None
|
||||
;;
|
||||
|
||||
let write { n_int ;
|
||||
bit_kind ;
|
||||
n_det ;
|
||||
n_det_qp_edit ;
|
||||
expected_s2 ;
|
||||
psi_coef ;
|
||||
psi_det ;
|
||||
@ -297,9 +333,13 @@ end = struct
|
||||
write_n_det n_det;
|
||||
write_n_states n_states;
|
||||
write_expected_s2 expected_s2;
|
||||
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;
|
||||
write_state_average_weight state_average_weight;
|
||||
if n_det <= n_det_qp_edit then
|
||||
begin
|
||||
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
|
||||
and ndet =
|
||||
Det_number.to_int b.n_det
|
||||
and ndet_qp_edit =
|
||||
Det_number.to_int b.n_det_qp_edit
|
||||
in
|
||||
let coefs_string i =
|
||||
Array.init nstates (fun j ->
|
||||
let ishift =
|
||||
j*ndet
|
||||
j*ndet_qp_edit
|
||||
in
|
||||
if (ishift < Array.length b.psi_coef) then
|
||||
b.psi_coef.(i+ishift)
|
||||
@ -331,7 +373,7 @@ end = struct
|
||||
)
|
||||
|> Array.to_list |> String.concat "\t"
|
||||
in
|
||||
Array.init ndet (fun i ->
|
||||
Array.init ndet_qp_edit (fun i ->
|
||||
Printf.sprintf " %s\n%s\n"
|
||||
(coefs_string i)
|
||||
(Determinant.to_string ~mo_num:mo_num b.psi_det.(i)
|
||||
@ -363,7 +405,7 @@ Determinants ::
|
||||
"
|
||||
(b.expected_s2 |> Positive_float.to_string)
|
||||
(b.n_det |> Det_number.to_string)
|
||||
(b.state_average_weight |> Array.to_list |> List.map Positive_float.to_string |> String.concat "\t")
|
||||
(b.state_average_weight |> Array.map Positive_float.to_string |> Array.to_list |> String.concat "\t")
|
||||
det_text
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
@ -387,10 +429,10 @@ psi_det = %s
|
||||
(b.n_states |> States_number.to_string)
|
||||
(b.expected_s2 |> Positive_float.to_string)
|
||||
(b.state_average_weight |> Array.to_list |> List.map Positive_float.to_string |> String.concat ",")
|
||||
(b.psi_coef |> Array.to_list |> List.map Det_coef.to_string
|
||||
(b.psi_coef |> Array.map Det_coef.to_string |> Array.to_list
|
||||
|> String.concat ", ")
|
||||
(b.psi_det |> Array.to_list |> List.map (Determinant.to_string
|
||||
~mo_num) |> String.concat "\n\n")
|
||||
(b.psi_det |> Array.map (Determinant.to_string ~mo_num) |> Array.to_list
|
||||
|> String.concat "\n\n")
|
||||
;;
|
||||
|
||||
let of_rst r =
|
||||
@ -472,6 +514,7 @@ psi_det = %s
|
||||
|
||||
(* Handle determinants *)
|
||||
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 ()
|
||||
|> Elec_alpha_number.of_int
|
||||
and n_beta = Ezfio.get_electrons_elec_beta_num ()
|
||||
@ -483,8 +526,8 @@ psi_det = %s
|
||||
begin
|
||||
let newdet =
|
||||
(Bitlist.of_string ~zero:'-' ~one:'+' alpha ,
|
||||
Bitlist.of_string ~zero:'-' ~one:'+' beta)
|
||||
|> Determinant.of_bitlist_couple ~alpha:n_alpha ~beta:n_beta
|
||||
Bitlist.of_string ~zero:'-' ~one:'+' beta)
|
||||
|> Determinant.of_bitlist_couple ~n_int ~alpha:n_alpha ~beta:n_beta
|
||||
|> Determinant.sexp_of_t
|
||||
|> Sexplib.Sexp.to_string
|
||||
in
|
||||
@ -492,9 +535,6 @@ psi_det = %s
|
||||
end
|
||||
| _::tail -> read_dets accu tail
|
||||
in
|
||||
let dets =
|
||||
List.map String_ext.rev dets
|
||||
in
|
||||
let a =
|
||||
read_dets [] dets
|
||||
|> String.concat ""
|
||||
@ -510,9 +550,11 @@ psi_det = %s
|
||||
Printf.sprintf "(n_int %d)" (N_int_number.get_max ())
|
||||
and 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
|
||||
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
|
||||
|
||||
|
||||
@ -527,7 +569,9 @@ psi_det = %s
|
||||
Det_number.to_int n_det_new
|
||||
in
|
||||
let det =
|
||||
read ()
|
||||
match read () with
|
||||
| Some x -> x
|
||||
| None -> failwith "No determinants in file"
|
||||
in
|
||||
let n_det_old, n_states =
|
||||
Det_number.to_int det.n_det,
|
||||