fixed bugs

This commit is contained in:
Emmanuel Giner 2019-01-11 19:42:53 +01:00
commit 3725952d59
47 changed files with 2272 additions and 1395 deletions

View File

@ -246,7 +246,7 @@ OCaml
.. code:: bash
opam install cryptokit zmq core sexplib ppx_sexp_conv ppx_deriving
opam install ocamlbuild cryptokit zmq core sexplib ppx_sexp_conv ppx_deriving getopt
EZFIO

9
TODO
View File

@ -55,3 +55,12 @@ Refaire les benchmarks
# Documentation de qpsh
# Documentation de /etc
# Toto
Selection d'etats avec qp_edit --state
singles_alpha_csc_idx, singles_alpha_size | git diff
Environment variables dans qp_run (prefix,etc)
Si un provider est un programme, generer une page a lui tout seul avec le man
Options obligatoires dans Command_line.ml

4
configure vendored
View File

@ -37,6 +37,7 @@ EOF
}
PACKAGES=""
OCAML_PACKAGES="ocamlbuild cryptokit zmq core sexplib ppx_sexp_conv ppx_deriving getopt"
while : ; do
case "$1" in
@ -233,8 +234,7 @@ EOF
--yes --comp=4.07.0
eval $(${QP_ROOT}/bin/opam env)
opam install -y ocamlbuild cryptokit zmq core sexplib \
ppx_sexp_conv ppx_deriving
opam install -y ${OCAML_PACKAGES}
elif [[ ${PACKAGE} = ezfio ]] ; then

View File

@ -1,6 +1,9 @@
default:
./auto_generate.py
make -C ../ html
rm -rf ../build/man/
make -C ../ man
cp -r ../build/man/* $(QP_ROOT)/man/
clean:
make -C ../ clean
rm modules/*.rst

View File

@ -157,10 +157,14 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'quantumpackage', 'Quantum Package Documentation',
[author], 1)
]
man_pages = []
qpdoc = ' | Quantum Package >'
import os
for f in os.listdir("users_guide"):
name = f.split('.')[0]
if name not in ["index","quickstart"]:
filename = os.path.join("users_guide",name)
man_pages.append( (filename, name, qpdoc, [author], 1) )
# -- Options for Texinfo output ----------------------------------------------

View File

@ -39,6 +39,7 @@
programmers_guide/programming
programmers_guide/ezfio
/programmers_guide/plugins
programmers_guide/index
programmers_guide/plugins

View File

@ -52,6 +52,7 @@ Providers
---------
<<<<<<< HEAD
.. c:var:: ao_potential_alpha_xc
.. code:: text

View File

@ -60,6 +60,122 @@ Providers
---------
.. c:var:: ao_potential_alpha_xc
.. code:: text
double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num)
double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num)
File: :file:`pot_functionals.irp.f`
.. c:var:: ao_potential_beta_xc
.. code:: text
double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num)
double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num)
File: :file:`pot_functionals.irp.f`
.. c:var:: e_correlation_dft
.. code:: text
double precision :: e_correlation_dft
File: :file:`pot_functionals.irp.f`
.. c:var:: e_exchange_dft
.. code:: text
double precision :: e_exchange_dft
File: :file:`pot_functionals.irp.f`
.. c:var:: fock_matrix_alpha_no_xc_ao
.. code:: text
double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num)
double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num)
File: :file:`fock_matrix_rs_ks.irp.f`
Mono electronic an Coulomb matrix in AO basis set
.. c:var:: fock_matrix_beta_no_xc_ao
.. code:: text
double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num)
double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num)
File: :file:`fock_matrix_rs_ks.irp.f`
Mono electronic an Coulomb matrix in AO basis set
.. c:var:: fock_matrix_energy
.. code:: text
double precision :: rs_ks_energy
double precision :: two_electron_energy
double precision :: one_electron_energy
double precision :: fock_matrix_energy
double precision :: trace_potential_xc
File: :file:`rs_ks_energy.irp.f`
Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity.
.. c:var:: one_electron_energy
.. code:: text
double precision :: rs_ks_energy
double precision :: two_electron_energy
double precision :: one_electron_energy
double precision :: fock_matrix_energy
double precision :: trace_potential_xc
File: :file:`rs_ks_energy.irp.f`
Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity.
.. c:var:: rs_ks_energy
.. code:: text
@ -77,11 +193,59 @@ Providers
.. c:var:: trace_potential_xc
.. code:: text
double precision :: rs_ks_energy
double precision :: two_electron_energy
double precision :: one_electron_energy
double precision :: fock_matrix_energy
double precision :: trace_potential_xc
File: :file:`rs_ks_energy.irp.f`
Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity.
.. c:var:: two_electron_energy
.. code:: text
double precision :: rs_ks_energy
double precision :: two_electron_energy
double precision :: one_electron_energy
double precision :: fock_matrix_energy
double precision :: trace_potential_xc
File: :file:`rs_ks_energy.irp.f`
Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity.
Subroutines / functions
-----------------------
.. c:function:: check_coherence_functional
.. code:: text
subroutine check_coherence_functional
File: :file:`rs_ks_scf.irp.f`
.. c:function:: rs_ks_scf
.. code:: text

View File

@ -329,6 +329,20 @@ Subroutines / functions
.. c:function:: reorder_core_orb
.. code:: text
subroutine reorder_core_orb
File: :file:`track_orb.irp.f`
routines that takes the current :c:data:`mo_coef` and reorder the core orbitals (see :c:data:`list_core` and :c:data:`n_core_orb`) according to the overlap with :c:data:`mo_coef_begin_iteration`
.. c:function:: reorder_core_orb
.. code:: text

View File

@ -10,7 +10,7 @@ Index of Modules
:glob:
/modules/*
/programmers_guide/plugins
/programmers_guide/qp_*
.. Auto-generated file

View File

@ -1391,4 +1391,4 @@ Index of Subroutines/Functions
* :c:func:`zmq_put_psi_det_beta_unique`
* :c:func:`zmq_put_psi_det_size`
* :c:func:`zmq_selection`
* :c:func:`zmq_set_running`
* :c:func:`zmq_set_running`

View File

@ -29,11 +29,19 @@ Usage:
"
}
#function test_ezfio()
#{
# if [[ ! -d ${EZFIO_FILE} ]] ; then
# echo "qp: cannot access ${EZFIO_FILE}: No such file or directory"
# return 1
# fi
#}
function qp()
{
case $1 in
"has"|"set"|"get"|"set_file"|"unset_file")
ezfio $@
ezfio $@
;;
"set_frozen_core")
@ -43,9 +51,9 @@ function qp()
"create_ezfio_from_xyz")
shift
[[ -n $EZFIO_FILE ]] && ezfio unset_file
NAME=$(qp_create_ezfio_from_xyz $@)
if [[ -d $NAME ]] ; then
[[ -d $EZFIO_FILE ]] && ezfio unset_file
ezfio set_file $NAME
else
echo $NAME | more
@ -77,6 +85,11 @@ function qp()
qp_mpirun $@ ${EZFIO_FILE}
;;
"man")
shift
man $QP_ROOT/man/${1}.?
;;
*)
_qp_usage
;;
@ -125,6 +138,10 @@ _Complete()
COMPREPLY=( $(compgen -W "-h -core -inact -act -virt -del" -- $cur ) )
return 0
;;
man)
COMPREPLY=( $(compgen -W "$(cd ${QP_ROOT}/man ; \ls | sed '/\.[1-9] / /')" -- $cur ) )
return 0
;;
set|has|get)
COMPREPLY=( $(compgen -W "$(cd ${EZFIO_FILE} ; \ls -d */ | sed 's|/||g')" -- $cur ) )
return 0
@ -141,6 +158,10 @@ _Complete()
else
case "${prev}" in
man)
COMPREPLY=( $(compgen -W "$(cd ${QP_ROOT}/man ; echo * | sed 's|\.[1-9] | |g')" -- $cur ) )
return 0
;;
set_file)
COMPREPLY=( $(compgen -W "$(\ls -d */ | sed 's|/||g')" -- ${cur} ) )
return 0
@ -151,6 +172,7 @@ _Complete()
;;
*)
COMPREPLY=( $(compgen -W 'set_file \
man \
create_ezfio_from_xyz \
-h' -- $cur ) )
return 0

0
man/.gitignore vendored Normal file
View File

76
man/configure.1 Normal file
View File

@ -0,0 +1,76 @@
.\" Man page generated from reStructuredText.
.
.TH "CONFIGURE" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
configure \- | 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
..
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
\&./configure [\-h | \-c <file> | \-i <package>]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-c <file>, \-\-config <file>
Define a configuration file, in :file\(ga${QP_ROOT}/config/\(ga
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-help
Print the help message
.UNINDENT
.INDENT 0.0
.TP
.B \-i <package>, \-\-install <package>
Try to install <package>. Use at your own risk.
.UNINDENT
.SH EXAMPLE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
\&./configure
\&./configure \-c config/gfortran.cfg
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

63
man/excited_states.1 Normal file
View File

@ -0,0 +1,63 @@
.\" Man page generated from reStructuredText.
.
.TH "EXCITED_STATES" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
excited_states \- | 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
It is possible to run excited states calculations with the quantum package. To
do this, set \fBdeterminants n_states\fP to the number of requested states.
The selection criterion will be the maximum of the selection criteria for each
state. If the Davidson diagonalization has difficulties to converge, increase
the \fBdavidson n_states_diag\fP value.
.sp
When computing multiple states, it is good to have the \fBdeterminants
s2_eig\fP flag \fBtrue\fP\&. This will force the Davidson algorithm to choose only
vectors with a value of \ewidehat{S^2} equal to \fBdeterminants expected_s2\fP\&.
Otherwise, different spin states will come out in the diagonalization.
.sp
The \fIQuantum Package\fP doesn\(aqt take account of the symmetry. Due to numerical noise, excited
states of different symmetries may enter in the calculation. Note that it is
possible to make state\-average calculation of states with different symmetries
and/or different spin multiplicities.
.sp
To include excited state of all possible symmetries, a simple trick is to
run a preliminary multi\-state CIS calculation using the CIS program,
and then running the selected FCI restarting from the CIS states, setting
\fBdeterminants read_wf\fP to \fBtrue\fP\&.
.sp
Usually, it is good practice to use state\-averaged natural MOs so that all
states have MOs of comparable quality. This allows for a faster convergence
of excitation energies.
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

62
man/interfaces.1 Normal file
View File

@ -0,0 +1,62 @@
.\" Man page generated from reStructuredText.
.
.TH "INTERFACES" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
interfaces \- | 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
A few interfaces to external codes are available.
.SH * -> QUANTUM PACKAGE
.INDENT 0.0
.TP
.B \fI\%GAMESS\fP / Gaussian
Using the \fI\%resultsFile\fP Python library, the geometry and MOs can be read.
This is useful to make calculations with CAS \- SCF orbitals
.UNINDENT
.SH QUANTUM PACKAGE -> *
.INDENT 0.0
.TP
.B \fI\%Molden\fP
3D plots of Molecular Orbitals
.TP
.B FCIDUMP
Interface with the FCI \- QMC program \fI\%NECI\fP, or the semi\-stochastic
Heat\-Bath CI program \fI\%Dice\fP\&.
.UNINDENT
.sp
\fI\%QMCPack\fP / \fI\%CHAMP\fP /
\fI\%QMC=Chem\fP
Trial wave functions can be used for QMC, with or without pseudo\-potentials.
These interfaces are provided as \fI\%external plugins\fP\&.
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

53
man/natural_orbitals.1 Normal file
View File

@ -0,0 +1,53 @@
.\" Man page generated from reStructuredText.
.
.TH "NATURAL_ORBITALS" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
natural_orbitals \- | 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
To produce state\-average natural orbitals, run
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_run save_natorb file.ezfio
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
The MOs will be replaced, so the two\-electron integrals and the wave function
are invalidated as well.
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

101
man/plugins.1 Normal file
View File

@ -0,0 +1,101 @@
.\" Man page generated from reStructuredText.
.
.TH "PLUGINS" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
plugins \- | 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
\fIQuantum Package\fP has very few executables out of the box. Most of the time, external
plugins need to be downloaded and installed in the \fB$QP_ROOT/plugins\fP
directory.
.sp
Plugins are usually hosted in external repositories. To dowload a plugin,
the remote repository needs to be downloaded, and the plugins of the
repository can be selected for installation.
.sp
To download an external repository of plugins, run the following command:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_plugins download http://somewhere/over/the/rainbow/ext_repo
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
This downloads a copy of the repository of external plugins \fBext_repo\fP
in \fB$QP_ROOT/plugins\fP\&.
.sp
The list of available uninstalled plugins can be seen using:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_plugins list \-u
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Now, the specific plugin \fBext_module\fP contained in the repository
\fBext_repo\fP can be installed using:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_plugins install ext_module
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
The module is now accessible via a symbolic link in \fB$QP_ROOT/src\fP,
and can be compiled as any module, running \fI\%Ninja\fP\&.
.sp
To remove the module, run
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_plugins uninstall ext_module
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

View File

@ -0,0 +1,88 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_CONVERT_OUTPUT_TO_EZFIO" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_convert_output_to_ezfio \- | 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
This Python script uses the \fI\%resultsFile\fP Python library to gather the
geometry, AOs and MOs from output files of \fI\%GAMESS\fP or Gaussian, and
puts this data in an \fI\%EZFIO\fP database. Some constraints are necessary in the
output file : the run needs to be a single point HF, DFT or CAS SCF\&.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_convert_output_to_ezfio <FILE.out> [\-o <EZFIO_DIRECTORY>]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-o <EZFIO_DIRECTORY>
Renames the \fI\%EZFIO\fP directory. If this option is not present, the default
name fill be \fB<FILE.out>.ezfio\fP
.UNINDENT
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
The following keywords are necessary for Gaussian
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
GFPRINT pop=Full
.ft P
.fi
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.SH EXAMPLE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_convert_output_to_ezfio h2o.out \-o h2o
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

View File

@ -0,0 +1,231 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_CREATE_EZFIO_FROM_XYZ" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_create_ezfio_from_xyz \- | 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
This command creates an \fI\%EZFIO\fP directory from a standard \fIxyz\fP file or from a
\fIz\-matrix\fP file in Gaussian format.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_create_ezfio_from_xyz [FLAGS] (<xyz_file> | <zmt_file>)
Flags :
\-b [\-au] [\-c int] [\-cart] [\-d float]
[\-m int] [\-o file] [\-p string] [\-help]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-b <basis_name>
Name of basis set. The basis set is defined as a single string if all the
atoms are taken from the same basis set, otherwise specific elements can be
defined as follows:
.INDENT 7.0
.INDENT 3.5
.sp
.nf
.ft C
\-b "cc\-pcvdz | H:cc\-pvdz | C:6\-31g"
\-b "cc\-pvtz | 1,H:sto\-3g | 3,H:6\-31g"
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
By default, the basis set is obtained from the local database of the \fIQuantum Package\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-au
If present, input geometry is in atomic units.
.UNINDENT
.INDENT 0.0
.TP
.B \-c <float>
Total charge of the molecule. Default is 0.
.UNINDENT
.INDENT 0.0
.TP
.B \-cart
Compute AOs in the Cartesian basis set (6d, 10f, ...)
.UNINDENT
.INDENT 0.0
.TP
.B \-d <float>
Add dummy atoms. x * (covalent radii of the atoms)
.UNINDENT
.INDENT 0.0
.TP
.B \-m <int>
Spin multiplicity (2S+1) of the molecule. Default is 1.
.UNINDENT
.INDENT 0.0
.TP
.B \-o <EZFIO_DIRECTORY>
Name of the created \fI\%EZFIO\fP directory.
.UNINDENT
.INDENT 0.0
.TP
.B \-p <string>
Name of the pseudo\-potential
.UNINDENT
.INDENT 0.0
.TP
.B \-help, \-?
Print the help text and exit
.UNINDENT
.SH USING CUSTOM ATOMIC BASIS SETS
.sp
If a file with the same name as the basis set exists, this file will be read.
For example, if the file containing the basis set is named \fBcustom.basis\fP,
and the \fIxyz\fP geometry is in \fBmolecule.xyz\fP, the following should be used:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_create_ezfio_from_xyz \-b custom.basis molecule.xyz
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Basis set files should be given in \fI\%GAMESS\fP format, where the full names of the
atoms are given, and the basis sets for each element are separated by a blank line.
Here is an example
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
HYDROGEN
S 3
1 13.0100000 0.0196850
2 1.9620000 0.1379770
3 0.4446000 0.4781480
S 1
1 0.1220000 1.0000000
P 1
1 0.7270000 1.0000000
BORON
S 8
1 4570.0000000 0.0006960
2 685.9000000 0.0053530
3 156.5000000 0.0271340
4 44.4700000 0.1013800
5 14.4800000 0.2720550
6 5.1310000 0.4484030
7 1.8980000 0.2901230
8 0.3329000 0.0143220
S 8
1 4570.0000000 \-0.0001390
2 685.9000000 \-0.0010970
3 156.5000000 \-0.0054440
4 44.4700000 \-0.0219160
5 14.4800000 \-0.0597510
6 5.1310000 \-0.1387320
7 1.8980000 \-0.1314820
8 0.3329000 0.5395260
S 1
1 0.1043000 1.0000000
P 3
1 6.0010000 0.0354810
2 1.2410000 0.1980720
3 0.3364000 0.5052300
P 1
1 0.0953800 1.0000000
D 1
1 0.3430000 1.0000000
.ft P
.fi
.UNINDENT
.UNINDENT
.SH USING CUSTOM PSEUDO-POTENTIALS
.sp
As for the basis set, if a file with the same name as the pseudo\-potential
exists, this file will be read.
For example, if the file containing the custom pseudo\-potential is named
\fBcustom.pseudo\fP, the basis set is named \fBcustom.basis\fP, and the \fIxyz\fP
geometry is in \fBmolecule.xyz\fP, the following command should be used
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_create_ezfio_from_xyz \-b custom.basis \-p custom.pseudo molecule.xyz
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Pseudo\-potential files should be given in a format very close to \fI\%GAMESS\fP
format. The first line should be formatted as \fB%s GEN %d %d\fP where the
first string is the chemical symbol, the first integer is the number of
core electrons to be removed and the second integer is LMAX+1 as in \fI\%GAMESS\fP
format.
The pseudo\-potential for each element are separated by a blank line.
Here is an example
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
Ne GEN 2 1
3
8.00000000 1 10.74945199
85.99561593 3 10.19801460
\-56.79004456 2 10.18694048
1
55.11144535 2 12.85042963
F GEN 2 1
3
7.00000000 1 11.39210685
79.74474797 3 10.74911370
\-49.45159098 2 10.45120693
1
50.25646328 2 11.30345826
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

103
man/qp_edit.1 Normal file
View File

@ -0,0 +1,103 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_EDIT" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_edit \- | 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
This command reads the content of the \fI\%EZFIO\fP directory and creates a temporary
file containing the data. The data is presented as a \fIReStructured Text\fP (rst)
document, where each section corresponds to the corresponding \fIQuantum Package\fP module.
The content of the file can be modified to change the input parameters. When
the text editor is closed, the updated data is saved into the \fI\%EZFIO\fP directory.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
The text editor which will be opened is defined by the \fBEDITOR\fP
environment variable.
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
When the wave function is too large (more than 10 000 determinants), the
determinants are not displayed.
.UNINDENT
.UNINDENT
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_edit [FLAGS] <EZFIO_DIRECTORY>
Flags :
[\-c] [\-ndet int]
[\-state int] [\-help]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-c
Checks the input data
.UNINDENT
.INDENT 0.0
.TP
.B \-ndet <int>
Truncates the wavefunction to the target number of determinants
.UNINDENT
.INDENT 0.0
.TP
.B \-state <int>
Pick the target state as a new wavefunction.
.UNINDENT
.INDENT 0.0
.TP
.B \-help
Print the help text and exits
.UNINDENT
.sp
Here is a short list of important control parameters :
.INDENT 0.0
.TP
.B read_wf
If \fBfalse\fP, initialize the calculation with a single\-determinant wave
function. If \fBtrue\fP, initialize the calculation with the wave function stored
in the \fI\%EZFIO\fP directory.
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

64
man/qp_export_as_tgz.1 Normal file
View File

@ -0,0 +1,64 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_EXPORT_AS_TGZ" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_export_as_tgz \- | 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
In some HPC facilities, the access to the internet is limited for security reasons.
In such an environment, the installation of \fIQuantum Package\fP is sometimes very painful because
the OCaml compiler and the libraries can\(aqt be installed by a non\-root user.
.sp
This command creates a self\-contained binary distribution in the form of a \fItar.gz\fP file
that can be copied on another machine.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_export_as_tgz
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
There can be conflicts due to the version of Glibc. The machine on which \fIQuantum Package\fP is
compiled should be the oldest one.
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

109
man/qp_plugins.1 Normal file
View File

@ -0,0 +1,109 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_PLUGINS" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_plugins \- | 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
This command deals with all external plugings of \fIQuantum Package\fP\&. Plugin repositories can
be downloaded, and the plugins in these repositories can be
installed/uninstalled of created.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_plugins list [ \-i | \-u | \-q ]
qp_plugins download <url>
qp_plugins install <name>...
qp_plugins uninstall <name>
qp_plugins create \-n <name> [\-r <repository>] [<needed_modules>...]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B list
List all the available plugins.
.UNINDENT
.INDENT 0.0
.TP
.B \-i
List all the \fIinstalled\fP plugins.
.UNINDENT
.INDENT 0.0
.TP
.B \-u
List all the \fIuninstalled\fP plugins.
.UNINDENT
.INDENT 0.0
.TP
.B \-q
List all the downloaded repositories.
.UNINDENT
.INDENT 0.0
.TP
.B download <url>
Download an external repository. The URL points to a tar.gz file or a
git repository, for example:
.INDENT 7.0
.IP \(bu 2
\fI\%http://example.com/site/example.tar.gz\fP
.IP \(bu 2
\fI\%git@gitlab.com\fP:user/example_repository
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B install <plugin_name>
Install the plugin \fBplugin_name\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B uninstall <plugin_name>
Uninstall the plugin \fBplugin_name\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-n <plugin_name>
Create a new plugin named \fBplugin_name\fP (in local repository by default).
.UNINDENT
.INDENT 0.0
.TP
.B \-r <repository>
Specify in which repository the new plugin will be created.
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

73
man/qp_run.1 Normal file
View File

@ -0,0 +1,73 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_RUN" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_run \- | 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
Command used to run a calculation.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_run [\-slave] [\-help] <PROGRAM> <EZFIO_DIRECTORY>
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-help
Displays the list of available \fIQuantum Package\fP programs.
.UNINDENT
.INDENT 0.0
.TP
.B \-slave
This option needs to be set when \fBPROGRAM\fP is a slave program, to accelerate
another running instance of the \fIQuantum Package\fP\&.
.UNINDENT
.SH EXAMPLE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_run FCI h2o.ezfio
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

64
man/qp_set_frozen_core.1 Normal file
View File

@ -0,0 +1,64 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_SET_FROZEN_CORE" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_set_frozen_core \- | 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
Automatically finds n, the number of core electrons. Calls
qp_set_mo_class setting all MOs as \fBActive\fP, except the n/2
first ones which are set as \fBCore\fP\&. If pseudo\-potentials are used, all the
MOs are set as \fBActive\fP\&.
.sp
For elements on the right of the periodic table, \fIqp_set_frozen_core\fP will
work as expected. But for elements on the left, a small core will be chosen. For
example, a Carbon atom will have 2 core electrons, but a Lithium atom will have
zero.
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_set_frozen_core [\-q] <EZFIO_DIRECTORY>
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-q
Prints in the standard output the number of core electrons.
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

118
man/qp_set_mo_class.1 Normal file
View File

@ -0,0 +1,118 @@
.\" Man page generated from reStructuredText.
.
.TH "QP_SET_MO_CLASS" "1" "Jan 11, 2019" "2.0" "Quantum Package"
.SH NAME
qp_set_mo_class \- | 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
This command sets the orbital classes in an \fI\%EZFIO\fP directory.
.INDENT 0.0
.TP
.B Core
MOs which are always doubly occupied
.TP
.B Deleted
MOs which are never occupied
.TP
.B Active
MOs in which any number of holes/particles can be made
.TP
.B Inactive
MOs in which only holes can be made
.TP
.B Virtual
MOs in which only particles can be made
.UNINDENT
.sp
To avoid errors, all the MOs should be given a class.
The range of MOs are given like the ranges in \fI\%SLURM\fP commands. For example,
\fB"[36\-53,72\-107,126\-131]"\fP\&.
.sp
\fBTIP:\fP
.INDENT 0.0
.INDENT 3.5
To quickly setup a frozen core calculation, the script qp_set_frozen_core
can be used.
.UNINDENT
.UNINDENT
.SH USAGE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
qp_set_mo_class [FLAGS] <EZFIO_DIRECTORY>
Flags:
[\-act range] [\-core range] [\-del range]
[\-inact range] [\-q] [\-virt range]
[\-help]
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-act <range>
Range of active orbitals
.UNINDENT
.INDENT 0.0
.TP
.B \-core <range>
Range of core orbitals
.UNINDENT
.INDENT 0.0
.TP
.B \-del <range>
Range of deleted orbitals
.UNINDENT
.INDENT 0.0
.TP
.B \-inact <range>
Range of inactive orbitals
.UNINDENT
.INDENT 0.0
.TP
.B \-q
Query: print the current masks
.UNINDENT
.INDENT 0.0
.TP
.B \-virt <range>
Range of virtual orbitals
.UNINDENT
.INDENT 0.0
.TP
.B \-help, \-?
.UNINDENT
.SH AUTHOR
A. Scemama, E. Giner
.SH COPYRIGHT
2018, A. Scemama, E. Giner
.\" Generated by docutils manpage writer.
.

161
ocaml/Command_line.ml Normal file
View File

@ -0,0 +1,161 @@
type argument = With_arg | Without_arg | With_opt_arg
let anon_args = ref []
and header_doc = ref ""
and footer_doc = ref ""
and specs = ref []
let set_header_doc s = header_doc := s
let set_footer_doc s = footer_doc := s
let dict =
let d = Hashtbl.create 67 in
d
let get x =
try Some (Hashtbl.find dict x)
with Not_found -> None
let get_bool x =
Hashtbl.mem dict x
let show_help () =
get_bool "help"
let anonymous ?(optional=false) name doc =
( ' ', name, doc,
if optional then With_opt_arg else Without_arg
)
let help () =
Format.printf "@[%s@]@.@." !header_doc;
let get_param_from_doc doc =
match Str.split (Str.regexp "[ \n\r\x0c\t]+") doc with
| param :: doc -> param, (String.concat " " doc)
| _ -> failwith "Bad format for documentation"
in
let anon =
List.filter (fun (x,_,_,_) -> x = ' ') !specs
|> List.map (fun x ->
match x with
| (_,name,doc,Without_arg) -> (name,doc,false)
| (_,name,doc,_) -> (name,doc,true)
)
in
let options =
List.filter (fun (x,_,_,_) -> x <> ' ') !specs
|> List.sort (fun (x,_,_,_) (y,_,_,_) -> Char.compare x y)
|> List.map (fun x ->
match x with
| (short,long,doc,With_arg) -> (* with arg *)
let param, doc = get_param_from_doc doc in
(Printf.sprintf "-%c %s" short param,
Printf.sprintf "--%s=%s" long param,
doc)
| (short,long,doc,Without_arg) -> (* without arg *)
(Printf.sprintf "-%c" short,
Printf.sprintf "--%s" long,
doc)
| (short,long,doc,With_opt_arg) -> (* with or without arg *)
let param, doc = get_param_from_doc doc in
(Printf.sprintf "-%c [%s]" short param,
Printf.sprintf "--%s[=%s]" long param,
doc)
)
in
let max_short =
List.map (fun (x,_,_) -> String.length x) options
|> List.fold_left max 0
in
let max_long =
List.map (fun (_,x,_) -> String.length x) options
|> List.fold_left max 0
in
let fmt_opt max_w o =
let l = String.length o in
o^(String.make (max_w-l) ' ')
in
let output_option ?(fixed_width=false) (short, long, doc) =
if fixed_width then
Format.printf "@[%s %s@]"
(fmt_opt max_short short) (fmt_opt max_long long)
else
Format.printf "@[%s|%s@]" short long
in
let output_anon ?(fixed_width=false) (name, doc, optional) =
if optional then
Format.printf "@[[%s]@]" name
else
Format.printf "@[%s@]" name
in
Format.printf "@[<v>@[<v 2>Usage:@,@,@[<hov 4>@[%s@]" Sys.argv.(0);
List.iter (fun x ->
Format.printf "@ @[[";
output_option ~fixed_width:false x;
Format.printf "]@]"
) options;
Format.printf "@ @[[--]@]";
List.iter (fun x ->
Format.printf "@ @[";
output_anon ~fixed_width:false x;
Format.printf "@]"
) anon;
Format.printf "@]@]@,@,";
Format.printf "@[<v>Arguments:@,";
Format.printf "@[<v 2>@," ;
List.iter (fun (name,doc,optional) ->
Format.printf "@[<h>";
output_anon ~fixed_width:true (name,doc,optional);
Format.printf "@ @[<v 0>%s@]@]@," doc
) anon;
Format.printf "@]@;";
Format.printf "@[<v>Options:@,";
Format.printf "@[<v 2>@," ;
List.iter (fun (short,long,doc) ->
Format.printf "@[<h>";
output_option ~fixed_width:true (short,long,doc);
Format.printf "@ @[<v 0>%s@]@]@," doc
) options;
Format.printf "@]@;";
Format.printf "@[%s@]@." !footer_doc
let set_specs specs_in =
specs := ( 'h', "help", "Prints the help message", Without_arg) :: specs_in;
let specs =
List.filter (fun (x,_,_,_) -> x != ' ') !specs
|> List.map (fun x ->
match x with
| (short, long, doc, With_arg) ->
(short, long, None, Some (fun x -> Hashtbl.replace dict long x) )
| (short, long, doc, Without_arg) ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""), None)
| (short, long, doc, With_opt_arg) ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""),
Some (fun x -> Hashtbl.replace dict long x) )
)
in
Getopt.parse_cmdline specs (fun x -> anon_args := !anon_args @ [x]);
if show_help () then
(help () ; exit 0)
let anon_args () = !anon_args

View File

@ -80,7 +80,10 @@ end = struct
;;
let write_n_det n =
Det_number.to_int n
let n_det_old =
Ezfio.get_determinants_n_det ()
in
min n_det_old (Det_number.to_int n)
|> Ezfio.set_determinants_n_det
;;

View File

@ -1,3 +1,3 @@
true: package(core,cryptokit,zmq,str,ppx_sexp_conv,ppx_deriving)
true: package(core,cryptokit,zmq,str,ppx_sexp_conv,ppx_deriving,getopt)
true: thread
false: profile

View File

@ -1,5 +1,4 @@
open Ocamlbuild_plugin;;
open Command;;
dispatch begin function
| Before_rules ->

View File

@ -1,72 +0,0 @@
open Core
let filenames =
let dir_name = Qpackage.root^"/data/basis/"
in
Sys.readdir dir_name
|> Array.map ~f:(fun x -> dir_name^x)
|> Array.to_list
;;
let clean_file filename =
let command =
Printf.sprintf "cp -f %s %s.old" filename filename
in
let () =
match Sys.command command with
| 0 -> ()
| i -> failwith (Printf.sprintf "Command %s exited with code %d\n" command i)
in
let lines =
In_channel.with_file filename ~f:In_channel.input_lines
in
Out_channel.with_file filename ~f:(fun out_channel ->
let rec loop ~do_s = function
| [] -> ()
| line :: tail ->
begin
let buffer = String.strip line
|> String.split ~on:' '
|> List.filter ~f:(fun x -> x <> "")
in
let () =
match buffer with
| [] -> Printf.fprintf out_channel "\n"
| [ atom ] -> Printf.fprintf out_channel "%s\n" atom
| [ i ; expo ; coef ] ->
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef
| [ i ; expo ; coef ; coef2 ] ->
if (do_s) then
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef
else
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef2
| [ sym ; n ] ->
if (sym = "L") then
let () =
Printf.fprintf out_channel "S %3s\n" n
in
let rec build_newlist accu = function
| (0, _)
| (_,[]) -> List.rev ((Printf.sprintf "P %3s\n" n)::accu)
| (i,head::tail) ->
build_newlist (head::accu) ( i-1, tail )
in
let newlist = build_newlist [] ((Int.of_string n),tail)
in
loop ~do_s:true newlist
else
Printf.fprintf out_channel "%s %3s\n" sym n
| _ -> ()
in
loop ~do_s:do_s tail
end
in loop ~do_s:false lines
)
;;
List.iter ~f:clean_file filenames
;;

View File

@ -2,27 +2,6 @@ open Qputils
open Qptypes
open Core
let spec =
let open Command.Spec in
empty
+> flag "o" (optional string)
~doc:"file Name of the created EZFIO file."
+> flag "b" (required string)
~doc:"string Name of basis set."
+> flag "au" no_arg
~doc:"Input geometry is in atomic units."
+> flag "c" (optional_with_default 0 int)
~doc:"int Total charge of the molecule. Default is 0."
+> flag "d" (optional_with_default 0. float)
~doc:"float Add dummy atoms. x * (covalent radii of the atoms)"
+> flag "m" (optional_with_default 1 int)
~doc:"int Spin multiplicity (2S+1) of the molecule. Default is 1."
+> flag "p" (optional string)
~doc:"string Name of the pseudopotential"
+> flag "cart" no_arg
~doc:" Compute AOs in the Cartesian basis set (6d, 10f, ...)"
+> anon ("(xyz_file|zmt_file)" %: file )
type element =
| Element of Element.t
| Int_elem of (Nucl_number.t * Element.t)
@ -660,16 +639,16 @@ let run ?o b au c d m p cart xyz_file =
end;
raise ex;
end
in print_endline ezfio_file
in
ignore @@ Sys.command ("qp_edit -c "^ezfio_file);
print_endline ezfio_file
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () -> "
=== Available basis sets ===
let () =
"=== Available basis sets ===
" ^ (list_basis ()) ^ "
@ -686,15 +665,68 @@ defined as follows:
If a file with the same name as the basis set exists, this file will be read.
Otherwise, the basis set is obtained from the database.
" )
spec
(fun o b au c d m p cart xyz_file () ->
run ?o b au c d m p cart xyz_file )
let () =
Command.run command
" |> Command_line.set_header_doc ;
[ ( 'o', "output", "file Name of the created EZFIO file.", Command_line.With_arg) ;
( 'b', "basis", "string Name of basis set.", Command_line.With_arg) ;
( 'a', "au", "Input geometry is in atomic units.", Command_line.Without_arg) ;
( 'c', "charge", "int Total charge of the molecule. Default is 0.", Command_line.With_arg) ;
( 'd', "dummy", "float Add dummy atoms. x * (covalent radii of the atoms)", Command_line.With_arg);
( 'm', "multiplicity", "int Spin multiplicity (2S+1) of the molecule. Default is 1.", Command_line.With_arg);
( 'p', "pseudo", "string Name of the pseudopotential.", Command_line.With_arg);
( 'x', "cartesian", "Compute AOs in the Cartesian basis set (6d, 10f, ...)", Command_line.Without_arg);
Command_line.anonymous "(xyz_file|zmt_file)" "input file in xyz format or z-matrix."
]
|> Command_line.set_specs ;
(* Handle options *)
let output =
Command_line.get "output"
in
let basis =
match Command_line.get "basis" with
| None -> (Command_line.help () ; failwith "Error: [-b|--basis] option is missing.")
| Some x -> x
in
let au =
Command_line.get_bool "au"
in
let charge =
match Command_line.get "charge" with
| None -> 0
| Some x -> int_of_string x
in
let dummy =
match Command_line.get "dummy" with
| None -> 0.
| Some x -> float_of_string x
in
let multiplicity =
match Command_line.get "multiplicity" with
| None -> 1
| Some n -> int_of_string n
in
let pseudo =
Command_line.get "pseudo"
in
let cart =
Command_line.get_bool "cartesian"
in
let xyz_filename =
match Command_line.anon_args () with
| [x] -> x
| _ -> (Command_line.help () ; failwith "input file is missing")
in
run ?o:output basis au charge dummy multiplicity pseudo cart xyz_filename

View File

@ -1,142 +0,0 @@
open Qputils
open Qptypes
open Core
let run ~multiplicity ezfio_file =
if (not (Sys.file_exists_exn ezfio_file)) then
failwith ("EZFIO directory "^ezfio_file^" not found");
Ezfio.set_file ezfio_file;
let d =
Input.Determinants_by_hand.read ()
in
let m =
Multiplicity.of_int multiplicity
in
let ne =
Ezfio.get_electrons_elec_alpha_num () +
Ezfio.get_electrons_elec_beta_num ()
|> Elec_number.of_int
in
let alpha, beta =
let (a,b) =
Multiplicity.to_alpha_beta ne m
in
(Elec_alpha_number.to_int a, Elec_beta_number.to_int b)
in
let n_open_shells =
alpha - beta
in
let mo_num =
Ezfio.get_mo_basis_mo_num ()
in
let build_list_of_dets ne n_closed n_open =
let init =
Array.create ~len:n_closed Bit.One
|> Array.to_list
in
let rec set_electron accu = function
| 1 -> [ Bit.One :: accu ]
| i ->
assert (i>1);
let rest =
set_electron (Bit.Zero :: accu) (i-1)
in
(Bit.One::accu) :: rest
in
let rec extend accu = function
| 0 -> List.rev accu
| i -> extend (Bit.Zero::accu) (i-1)
in
let rec set_n_electrons accu imax = function
| 0 -> []
| 1 -> set_electron accu imax
| i ->
assert (i>1);
let l =
set_electron accu (imax-1)
in
List.map ~f:(fun x -> set_n_electrons x (imax-1) (i-1)) l
|> List.concat
in
set_n_electrons init n_open ne
|> List.filter ~f:(fun x -> List.length x <= n_closed+n_open)
|> List.map ~f:(fun x -> extend x (((mo_num-1)/64+1)*64 - List.length x))
in
let alpha_new =
(Elec_number.to_int ne + 1)/2
and beta_new =
Elec_number.to_int ne/2
in
let l_alpha =
build_list_of_dets ((alpha-beta+1)/2) beta n_open_shells
in
let l_beta =
if alpha_new = beta_new then
l_alpha
else
build_list_of_dets ((alpha-beta)/2)beta n_open_shells
in
let n_int =
Bitlist.n_int_of_mo_num mo_num
in
let determinants =
List.map l_alpha ~f:(fun x -> List.map l_beta ~f:(fun y -> (x,y) ))
|> List.concat
|> List.map ~f:(fun pair -> Determinant.of_bitlist_couple ~n_int
~alpha:(Elec_alpha_number.of_int alpha_new)
~beta:(Elec_beta_number.of_int beta_new) pair )
in
let c =
Array.init (List.length determinants) (fun _ -> Det_coef.of_float ((Random.float 2.)-.1.))
in
determinants
|> List.map ~f:(fun x -> Determinant.to_string ~mo_num:(MO_number.of_int mo_num) x)
|> List.iter ~f:(fun x -> Printf.printf "%s\n\n%!" x);
let l =
List.length determinants
in
if l > 0 then
begin
let d =
let s = (Float.of_int (alpha - beta)) *. 0.5 in
let open Input.Determinants_by_hand in
{ d with n_int ;
n_det = Det_number.of_int ~min:1 ~max:l l;
expected_s2 = Positive_float.of_float (s *. (s +. 1.)) ;
psi_coef = c;
psi_det = Array.of_list determinants;
}
in
Input.Determinants_by_hand.write d;
Ezfio.set_determinants_read_wf true
end
else
Ezfio.set_determinants_read_wf false
let spec =
let open Command.Spec in
empty
+> flag "m" (required int)
~doc:"int Spin multiplicity"
+> anon ("ezfio_file" %: string)
let () =
Command.basic_spec
~summary: "Quantum Package command"
~readme:( fun () -> "
Creates an open-shell multiplet initial guess\n\n" )
spec
(fun multiplicity ezfio_file () ->
run ~multiplicity ezfio_file
)
|> Command.run ~version: Git.sha1 ~build_info: Git.message

View File

@ -1,176 +0,0 @@
open Core
open Qptypes
let get_data () =
let mos =
Input.Mo_basis.read ()
in
let molecule =
let e =
match Input.Electrons.read () with
| Some x -> x
| None -> failwith "No electrons"
in
{ Molecule.nuclei =
begin
match Input.Nuclei_by_hand.read () with
| None -> failwith "No nuclei"
| Some l -> Input.Nuclei_by_hand.to_atom_list l
end ;
Molecule.elec_alpha = e.Input.Electrons.elec_alpha_num ;
Molecule.elec_beta = e.Input.Electrons.elec_beta_num ;
}
in
let charge =
Molecule.get_charge molecule
|> Charge.to_int
and mult =
Molecule.get_multiplicity molecule
|> Multiplicity.to_int
in
let hf =
if mult = 0 then "RHF" else "ROHF"
in
let guess =
if mos = None then `Huckel else `Read
in
(mos, molecule, charge, mult, hf, guess)
let run_g09 () =
let (mos, molecule, charge, mult, hf, guess) =
get_data ()
in
let guess =
match guess with
| `Read -> "cards"
| `Huckel -> "huckel"
in
let result = [
Printf.sprintf "# %s/Gen guess=%s" hf guess;
"" ;
Molecule.name molecule ;
"" ;
Printf.sprintf "%d %d" charge mult ;
Printf.sprintf "%s" (
match String.split ~on:'\n' @@ Molecule.to_xyz molecule with
| _ :: _ :: rest -> String.concat ~sep:"\n" rest
| _ -> assert false
);
"";
begin
match Input.Ao_basis.read () with
| Some x -> Input.Ao_basis.to_basis x
| None -> failwith "No basis"
end
|> Basis.to_string ~fmt:Gto.Gaussian ~ele_array:(List.map ~f:(fun x -> x.Atom.element)
molecule.Molecule.nuclei |> Array.of_list) ;
"";
begin
match mos with
| None -> ""
| Some mos' ->
begin
Printf.sprintf "(E20.12)\n%s\n 0"
(
Array.map mos'.Input.Mo_basis.mo_coef ~f:(fun x ->
Array.map x ~f:(fun y -> Printf.sprintf "%20.12E" (MO_coef.to_float y))
|> Array.to_list
|> String.concat ~sep:"\n")
|> Array.mapi ~f:(fun i -> Printf.sprintf "%5d\n%s" (i+1))
|> Array.to_list
|> String.concat ~sep:"\n"
)
end
end;
"" ; "" ;
"" ; "" ;
]
in
List.iter ~f:(fun x -> print_endline x) result
let run_gamess () =
failwith "Not yet implemented"
(* TODO
let (mos, molecule, charge, mult, hf, guess) =
get_data ()
in
let guess =
match guess with
| `Read -> "MOREAD"
| `Huckel -> "HUCKEL"
in
and coord =
Printf.sprintf "%s" (
match String.split ~on:'\n' @@ Molecule.to_xyz molecule with
| _ :: _ :: rest -> String.concat ~sep:"\n" rest
| _ -> assert false
);
and basis =
begin
match !read_data.basis with
| None |> failwith "No basis set defined in command line"
| Some b |> b
end
and typ = !read_data.typ
and vecfile =
begin
match !read_data.filename with
| None |> ""
| Some filename |> filename
end
and nstate = !read_data.nstate
and guess = !read_data.guess
in
let system =
Gamess.{ mult ; charge ; basis ; coord }
in
Gamess.create_input ~vecfile ~system ~guess ~nstate typ
|> print_endline
*)
let spec =
let open Command.Spec in
empty
+> flag "-gamess" no_arg ~doc:"GAMESS(US) input"
+> flag "-g09" no_arg ~doc:"Gaussian 09 input"
+> anon ("ezfio_file" %: string)
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"
Exports the computed data for other programs.
")
spec
(fun gamess g09 ezfio_file () ->
let count_flags l =
List.fold_left ~f:(fun a x ->
if x then a+1 else a) ~init:0 l
in
let () =
match count_flags [ g09 ; gamess ] with
| 0 -> raise (Invalid_argument "No file format specified")
| 1 -> ()
| _ -> raise (Invalid_argument "Too many file formats specified")
in
Ezfio.set_file ezfio_file;
if g09 then
run_g09 ()
else if gamess then
run_gamess ()
)
let () =
Command.run command;
exit 0

View File

@ -1,164 +0,0 @@
open Core
open Qputils
open Qptypes
let run ?(sym="None") ?(apply="no") fc ezfio_filename =
Ezfio.set_file ezfio_filename ;
let aos =
match Input.Ao_basis.read () with
| Some aos -> aos
| None -> failwith "Unable to read AOs"
and mos =
match Input.Mo_basis.read () with
| Some mos -> mos
| None -> failwith "Unable to read MOs"
in
let rec find_power symmetry accu = function
| -1 -> accu
| i -> let new_accu =
if aos.Input.Ao_basis.ao_power.(i) = symmetry then (i::accu)
else accu
in
find_power symmetry new_accu (i-1)
and n =
(AO_number.to_int aos.Input.Ao_basis.ao_num)
and m =
(MO_number.to_int mos.Input.Mo_basis.mo_num)
and one = Positive_int.of_int 1
and zero = Positive_int.of_int 0
in
(* Indices of the px, py and pz AOs *)
let x_indices =
find_power Symmetry.Xyz.{x=one ; y=zero ; z=zero} [] (n-1)
and y_indices =
find_power Symmetry.Xyz.{x=zero ; y=one ; z=zero} [] (n-1)
and z_indices =
find_power Symmetry.Xyz.{x=zero ; y=zero ; z=one } [] (n-1)
in
(* Compute the relative weight of each MO on the px, py, pz spaces *)
let compute_weight mo_i list_aos =
let num =
List.fold_left ~f:(fun s i -> s +. (MO_coef.to_float @@ mos.Input.Mo_basis.mo_coef.(mo_i).(i)) ** 2.) ~init:0. list_aos
and denom =
Array.fold ~f:(fun s x -> s +. (MO_coef.to_float x) ** 2.) ~init:0. mos.Input.Mo_basis.mo_coef.(mo_i)
in
num /. denom
in
let result =
Array.init ~f:(fun mo_i ->
(mo_i+1,
compute_weight mo_i x_indices,
compute_weight mo_i y_indices,
compute_weight mo_i z_indices) ) m
|> Array.to_list
in
let pi, sigma =
let rec aux test_xyz (accu_pi: int list) (accu_sigma: int list) = function
| [] -> (List.rev accu_pi, List.rev accu_sigma)
| (mo_i,x,y,z)::rest ->
if test_xyz (x,y,z) then
aux test_xyz (mo_i::accu_pi) accu_sigma rest
else
aux test_xyz accu_pi (mo_i::accu_sigma) rest
in
match sym with
| "x" | "X" -> aux (fun (x,y,z) -> (x>y && x>z)) [] [] result
| "y" | "Y" -> aux (fun (x,y,z) -> (y>x && y>z)) [] [] result
| "z" | "Z" -> aux (fun (x,y,z) -> (z>x && z>y)) [] [] result
| _ -> ([],[])
in
begin
match sym with
| "x" | "X" | "y" | "Y" | "z" | "Z" ->
if apply = "cas" then
begin
let ne = Ezfio.get_electrons_elec_alpha_num () in
let command =
"qp_set_mo_class -act \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^
"]\" -core \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^
"]\" -del \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > ne) sigma) ^
"]\" " ^ ezfio_filename
in
print_endline command;
if Sys.command command <> 0 then
failwith "Command failed"
end
else if apply = "cassd" then
begin
let ne = Ezfio.get_electrons_elec_alpha_num () in
let nfc =
if fc then
let ic =
Unix.open_process_in ("qp_set_frozen_core.py -q "^ezfio_filename)
in
let result = int_of_string @@
match In_channel.input_line ic with
| Some line -> line
| None -> failwith "Failed in qp_set_frozen_core"
in
In_channel.close ic; result
else 0
in
let command =
"qp_set_mo_class" ^
( if nfc > 0 then
Printf.sprintf " -core \"[1-%d]\"" nfc else "") ^
" -inact \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > nfc && mo_i <= ne) sigma) ^ "]\"" ^
" -act \"[" ^ (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^ "]\"" ^
" -virt \"[" ^
(String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > ne) sigma) ^ "]\" " ^ ezfio_filename
in
print_endline command;
if Sys.command command <> 0 then
failwith "Command failed"
end
else
begin
Printf.printf "Pi: [";
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) pi;
Printf.printf "\b]\n\nSigma: [";
List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) sigma;
Printf.printf "\b]\n"
end
| _ -> List.iter ~f:(fun (mo_i,x,y,z) -> Printf.printf "%d: (%f,%f,%f)\n" mo_i x y z) result
end
let spec =
let open Command.Spec in
empty
+> flag "sym" (optional string)
~doc:"{x,y,z} Axis perpendicular to the plane"
+> flag "apply" (optional string)
~doc:"[cas|cassd] Set the pi space as the active space, all other MOs frozen. If [cassd] is chosen, set inactive and virtual mos."
+> flag "fc" no_arg
~doc:"freeze core MOs with -apply cassd"
+> anon ("ezfio_filename" %: string)
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"Find all the pi molecular orbitals to create a pi space.
")
spec
(fun sym apply fc ezfio_filename () -> run ?sym ?apply fc ezfio_filename)
let () =
Command.run command

View File

@ -1,93 +0,0 @@
(**
* Computes the overlap <Psi_0 | Psi_1> where both Psi_0 and Psi_1 are truncated in the set
* of common determinants and normalized
*)
open Input_determinants_by_hand
open Qptypes
let () =
let ezfio, ezfio' =
try
Sys.argv.(1), Sys.argv.(2)
with Invalid_argument _ ->
raise (Invalid_argument (Printf.sprintf
"Syntax : %s EZFIO1 EZFIO2" Sys.argv.(0)))
in
let fetch_wf ~state filename =
(* State 0 is the ground state *)
Ezfio.set_file filename;
let mo_num =
Ezfio.get_mo_basis_mo_num ()
|> MO_number.of_int
in
let d =
Determinants_by_hand.read ()
in
let n_det =
Det_number.to_int d.Determinants_by_hand.n_det
in
let state_shift =
state*n_det
in
let keys =
Array.map (Determinant.to_string ~mo_num)
d.Determinants_by_hand.psi_det
and values =
Array.map Det_coef.to_float
d.Determinants_by_hand.psi_coef
in
let hash =
Hashtbl.create n_det
in
for i=0 to n_det-1
do
Hashtbl.add hash keys.(i) values.(state_shift+i);
done;
hash
in
let overlap wf wf' =
let result, norm, norm' =
Hashtbl.fold (fun k c (accu,norm,norm') ->
let (c',c) =
try (Hashtbl.find wf' k, c)
with Caml.Not_found -> (0.,0.)
in
(accu +. c *. c' ,
norm +. c *. c ,
norm'+. c'*. c' )
) wf (0.,0.,0.)
in
result /. (sqrt (norm *. norm'))
in
let n_st1 =
Ezfio.set_file ezfio;
Ezfio.get_determinants_n_states ()
and n_st2 =
Ezfio.set_file ezfio';
Ezfio.get_determinants_n_states ()
in
Array.init n_st2 (fun i -> i)
|> Array.iter (fun state_j ->
Printf.printf "%d " (state_j+1);
let wf' =
fetch_wf ~state:state_j ezfio'
in
Array.init n_st1 (fun i -> i)
|> Array.iter (fun state_i ->
let wf =
fetch_wf ~state:state_i ezfio
in
let o =
overlap wf wf'
in
Printf.printf "%f %!" (abs_float o)
);
Printf.printf "\n%!"
)

View File

@ -1,183 +0,0 @@
open Qputils;;
open Qptypes;;
open Core;;
type input_action =
| Basis
| Nuclei
| Charge
| Multiplicity
| Electrons
;;
let create_i_action = function
| "basis" -> Basis
| "nucl" -> Nuclei
| "charge" -> Charge
| "mult" -> Multiplicity
| "elec" -> Electrons
| _ -> raise (Failure "Action should be:
* basis
* nucl
* charge
* mult
* elec
")
;;
let spec =
let open Command.Spec in
empty
+> flag "i" (optional string)
~doc:"Prints input data"
+> flag "o" (optional string)
~doc:"Prints output data"
+> anon ("ezfio_file" %: string)
;;
let run_i ~action ezfio_filename =
let action = create_i_action action in
if (not (Sys.file_exists_exn ezfio_filename)) then
failwith (ezfio_filename^" does not exist");
Ezfio.set_file ezfio_filename;
let print_basis () =
Printf.printf "%s\n" (Ezfio.get_ao_basis_ao_basis ())
in
let compute_charge () =
let input = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
in
let nucl_charge = Ezfio.get_nuclei_nucl_charge ()
|> Ezfio.flattened_ezfio |> Array.map ~f:(Float.to_int)
and n_alpha = input.Input.Electrons.elec_alpha_num
|> Elec_alpha_number.to_int
and n_beta = input.Input.Electrons.elec_beta_num
|> Elec_beta_number.to_int
in Array.fold ~init:(-n_alpha-n_beta) ~f:(fun x y -> x+y) nucl_charge
|> Charge.of_int
in
let compute_multiplicity () =
let input = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
in
let n_alpha = input.Input.Electrons.elec_alpha_num
and n_beta = input.Input.Electrons.elec_beta_num
in Multiplicity.of_alpha_beta n_alpha n_beta
in
let create_molecule () =
let nucl_num = Ezfio.get_nuclei_nucl_num ()
and nucl_charge = Ezfio.get_nuclei_nucl_charge ()
|> Ezfio.flattened_ezfio
and nucl_coord = Ezfio.get_nuclei_nucl_coord ()
|> Ezfio.flattened_ezfio
in
let nucl_label =
if (Ezfio.has_nuclei_nucl_label ()) then
Ezfio.get_nuclei_nucl_label () |> Ezfio.flattened_ezfio
else
Array.map ~f:(fun x-> x
|> Charge.of_float
|> Element.of_charge
|> Element.to_string ) nucl_charge
in
let buffer = ref "" in
for i=0 to (nucl_num-1) do
buffer := !buffer ^ (Printf.sprintf "%s %f %f %f %f\n"
nucl_label.(i)
nucl_charge.(i)
nucl_coord.(i)
nucl_coord.(i+nucl_num)
nucl_coord.(i+nucl_num+nucl_num)
)
done ;
let charge = compute_charge () in
let mult = compute_multiplicity () in
Molecule.of_xyz_string ~charge:charge ~multiplicity:mult !buffer
in
let print_nuclei () =
let molecule = create_molecule () in
print_endline (Molecule.to_string molecule)
and print_charge () =
let molecule = create_molecule () in
Printf.printf "%s" (Charge.to_string (Molecule.get_charge molecule))
and print_multiplicity () =
let molecule = create_molecule () in
Printf.printf "%s" (Multiplicity.to_string (Molecule.get_multiplicity
molecule))
and print_electrons () = ()
in
match action with
| Basis -> print_basis ()
| Nuclei -> print_nuclei ()
| Charge -> print_charge ()
| Multiplicity -> print_multiplicity ()
| Electrons -> print_electrons ()
;;
let run_o ~action ezfio_filename =
if (not (Sys.file_exists_exn ezfio_filename)) then
failwith (ezfio_filename^" does not exist");
(* Open EZFIO *)
Ezfio.set_file ezfio_filename;
;;
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"
Prints data contained into the EZFIO file.
Input data :
* basis
* nucl
* charge
* mult
* elec
Output data :
*
")
spec
(fun i o ezfio_file () ->
try
match (i,o) with
| (Some i, None) -> run_i ~action:i ezfio_file
| (None, Some o) -> run_o ~action:o ezfio_file
| (Some _, Some _) ->
raise (Failure "Error : please specify -i or -o but not both.")
| (None, None) ->
raise (Failure "Error : please specify -i or -o.")
with
| Failure msg -> print_string ("Error\n"^msg)
| _ -> ()
)
;;
let () =
Command.run command
;;

View File

@ -1,4 +1,3 @@
open Core
open Qputils
(* Environment variables :
@ -10,7 +9,7 @@ open Qputils
let print_list () =
Lazy.force Qpackage.executables
|> List.iter ~f:(fun (x,_) -> Printf.printf " * %s\n" x)
|> List.iter (fun (x,_) -> Printf.printf " * %s\n" x)
let () =
Random.self_init ()
@ -27,13 +26,13 @@ let run slave exe ezfio_file =
in
let rec try_new_port port_number =
try
List.iter [ 0;1;2;3;4;5;6;7;8;9 ] ~f:(fun i ->
List.iter (fun i ->
let address =
Printf.sprintf "tcp://%s:%d" (Lazy.force TaskServer.ip_address) (port_number+i)
in
Zmq.Socket.bind dummy_socket address;
Zmq.Socket.unbind dummy_socket address;
);
) [ 0;1;2;3;4;5;6;7;8;9 ] ;
port_number
with
| Unix.Unix_error _ -> try_new_port (port_number+100)
@ -47,21 +46,21 @@ let run slave exe ezfio_file =
in
let time_start =
Time.now ()
Core.Time.now ()
in
if (not (Sys.file_exists_exn ezfio_file)) then
if (not (Sys.file_exists ezfio_file)) then
failwith ("EZFIO directory "^ezfio_file^" not found");
let executables = Lazy.force Qpackage.executables in
if (not (List.exists ~f:(fun (x,_) -> x = exe) executables)) then
if (not (List.exists (fun (x,_) -> x = exe) executables)) then
begin
Printf.printf "\nPossible choices:\n";
List.iter executables ~f:(fun (x,_) -> Printf.printf "* %s\n%!" x);
List.iter (fun (x,_) -> Printf.printf "* %s\n%!" x) executables;
failwith ("Executable "^exe^" not found")
end;
Printf.printf "%s\n" (Time.to_string time_start);
Printf.printf "%s\n" (Core.Time.to_string time_start);
Printf.printf "===============\nQuantum Package\n===============\n\n";
Printf.printf "Git Commit: %s\n" Git.message;
Printf.printf "Git Date : %s\n" Git.date;
@ -86,10 +85,10 @@ let run slave exe ezfio_file =
if slave then
try
let address =
In_channel.read_all qp_run_address_filename
|> String.strip
Core.In_channel.read_all qp_run_address_filename
|> String.trim
in
Unix.putenv ~key:"QP_RUN_ADDRESS_MASTER" ~data:address
Unix.putenv "QP_RUN_ADDRESS_MASTER" address
with Sys_error _ -> failwith "No master is not running"
in
@ -104,23 +103,21 @@ let run slave exe ezfio_file =
let address =
Printf.sprintf "tcp://%s:%d" (Lazy.force TaskServer.ip_address) port_number
in
Unix.putenv ~key:"QP_RUN_ADDRESS" ~data:address;
Unix.putenv "QP_RUN_ADDRESS" address;
let () =
if (not slave) then
Out_channel.with_file qp_run_address_filename ~f:(
fun oc -> Out_channel.output_lines oc [address])
Core.Out_channel.with_file qp_run_address_filename ~f:(
fun oc -> Core.Out_channel.output_lines oc [address])
in
(** Run executable *)
let prefix =
match Sys.getenv "QP_PREFIX" with
| Some x -> x^" "
| None -> ""
try (Sys.getenv "QP_PREFIX")^" " with
| Not_found -> ""
and exe =
match (List.find ~f:(fun (x,_) -> x = exe) executables) with
| Some (_,x) -> x^" "
| None -> assert false
match (List.find (fun (x,_) -> x = exe) executables) with
| (_,exe) -> exe^" "
in
let exit_code =
match (Sys.command (prefix^exe^ezfio_file)) with
@ -133,37 +130,46 @@ let run slave exe ezfio_file =
if (not slave) then
Sys.remove qp_run_address_filename;
let duration = Time.diff (Time.now()) time_start
|> Time.Span.to_string in
let duration = Core.Time.diff (Core.Time.now()) time_start
|> Core.Time.Span.to_string in
Printf.printf "Wall time : %s\n\n" duration;
if (exit_code <> 0) then
exit exit_code
let spec =
let open Command.Spec in
empty
+> flag "slave" no_arg
~doc:(" Required for slave tasks")
+> anon ("executable" %: string)
+> anon ("ezfio_file" %: string)
;;
let () =
Command.basic_spec
~summary: "Quantum Package command"
~readme:( fun () -> "
Executes a Quantum Package binary file among these:\n\n"
(* Command-line specs *)
"Executes a Quantum Package binary file among these:\n\n"
^ (Lazy.force Qpackage.executables
|> List.map ~f:(fun (x,_) -> Printf.sprintf " * %s" x )
|> String.concat ~sep:"\n"
)
)
spec
(fun slave exe ezfio_file () ->
run slave exe ezfio_file
)
|> Command.run ~version: Git.sha1 ~build_info: Git.message
|> List.map (fun (x,_) -> Printf.sprintf " * %s" x )
|> String.concat "\n"
) |> Command_line.set_header_doc;
[ (
's', "slave", "Required to run slave tasks in distributed environments",
Command_line.Without_arg);
Command_line.anonymous "<EXECUTABLE>" "Name of the QP program to be run";
Command_line.anonymous "<EZFIO_FILE>" "EZFIO directory";
]
|> Command_line.set_specs ;
(* Handle options *)
if Command_line.show_help () then
exit 0;
let slave =
match Command_line.get "slave" with
| None -> false
| _ -> true
in
(* Run the program *)
match Command_line.anon_args () with
| exe :: ezfio_file :: [] -> run slave exe ezfio_file
| _ -> (Command_line.help () ; failwith "Inconsistent command line")

View File

@ -312,30 +312,40 @@ let default range =
)
let spec =
let open Command.Spec in
empty
+> flag "core" (optional string) ~doc:"range Range of core orbitals"
+> flag "inact" (optional string) ~doc:"range Range of inactive orbitals"
+> flag "act" (optional string) ~doc:"range Range of active orbitals"
+> flag "virt" (optional string) ~doc:"range Range of virtual orbitals"
+> flag "del" (optional string) ~doc:"range Range of deleted orbitals"
+> flag "q" no_arg ~doc:" Query: print the current masks"
+> anon ("ezfio_filename" %: ezfio_file)
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"Set the orbital classes in an EZFIO directory
The range of MOs has the form : \"[36-53,72-107,126-131]\"
")
spec
(fun core inact act virt del q ezfio_filename () -> run ~q ?core ?inact ?act ?virt ?del ezfio_filename )
let () =
Command.run command
"Set the orbital classes in an EZFIO directory.
The range of MOs has the form : \"[36-53,72-107,126-131]\"." |> Command_line.set_header_doc ;
[ ( 'c', "core", "range Range of core MOs", Command_line.With_opt_arg);
( 'i', "inact", "range Range of inactive MOs", Command_line.With_opt_arg);
( 'a', "act", "range Range of active MOs", Command_line.With_opt_arg);
( 'v', "virt", "range Range of virtual MOs", Command_line.With_opt_arg);
( 'd', "del", "range Range of deleted MOs", Command_line.With_opt_arg);
( 'q', "query", "Print the current MOs classes", Command_line.Without_arg);
Command_line.anonymous "<EZFIO_FILE>" "EZFIO directory";
] |> Command_line.set_specs ;
(* Handle options *)
if Command_line.show_help () then
exit 0;
let core = Command_line.get "core"
and inact = Command_line.get "inact"
and act = Command_line.get "act"
and virt = Command_line.get "virt"
and del = Command_line.get "del"
and q = Command_line.get_bool "q"
in
let ezfio_filename =
match Command_line.anon_args () with
| [x] -> x
| _ -> (Command_line.help () ; failwith "EZFIO_FILE is missing")
in
run ~q ?core ?inact ?act ?virt ?del ezfio_filename

17
qpsh
View File

@ -3,8 +3,21 @@
export QP_ROOT=$(dirname $0)
exec bash --init-file <(cat << EOF
PS1="[\u@\h \W] |\\\${EZFIO_FILE}> "
source $QP_ROOT/quantum_package.rc
[[ -f \${HOME}/.bashrc ]] && source \${HOME}/.bashrc
ESC=\$(printf "\\e")
function check_ezfio() {
if [[ -d \${EZFIO_FILE} ]] ; then
printf "\\e[0;32m|\${EZFIO_FILE}>\\e[m"
else
printf "\\e[0;31m|\${EZFIO_FILE}>\\e[m"
fi
}
PS1="\${PS1%$ }\\\$(check_ezfio) \$ "
source \${QP_ROOT}/quantum_package.rc
EOF
)

View File

@ -3,11 +3,11 @@
convert output of gamess/GAU$$IAN to ezfio
Usage:
qp_convert_output_to_ezfio.py <file.out> [-o <ezfio_directory>]
qp_convert_output_to_ezfio.py <file.out> [-o|--output <EZFIO_DIRECTORY>]
Option:
file.out is the file to check (like gamess.out)
folder.ezfio is the name you whant for the ezfio
EZFIO_DIRECTORY is the name of the produced directory
(by default is file.out.ezfio)
"""

View File

@ -132,13 +132,14 @@ let set str s =
let create_temp_file ezfio_filename fields =
let temp_filename = Filename.temp_file "qp_edit_" ".rst" in
begin
Out_channel.with_file temp_filename ~f:(fun out_channel ->
Out_channel.with_file temp_filename ~f:(fun out_channel ->
(file_header ezfio_filename) :: (List.map ~f:get fields)
|> String.concat ~sep:"\n"
|> Out_channel.output_string out_channel
)
);
at_exit (fun () -> Sys.remove temp_filename);
temp_filename
end
; temp_filename
@ -220,88 +221,116 @@ let run check_only ?ndet ?state ezfio_filename =
In_channel.with_file temp_filename ~f:(fun in_channel ->
In_channel.input_all in_channel)
in
List.iter ~f:(fun x -> set temp_string x) tasks;
(* Remove temp_file *)
Sys.remove temp_filename
List.iter ~f:(fun x -> set temp_string x) tasks
(** Remove the backup file *)
let remove_backup ezfio_filename =
let backup_filename =
Printf.sprintf "%s/work/backup.tar" ezfio_filename
in
try Sys.remove backup_filename
with _ -> ()
(** Create a backup file in case of an exception *)
let create_backup ezfio_filename =
Printf.sprintf "
rm -f %s/backup.tgz ;
tar -zcf .backup.tgz %s && mv .backup.tgz %s/backup.tgz
"
ezfio_filename ezfio_filename ezfio_filename
|> Sys.command_exn
remove_backup ezfio_filename;
let backup_filename =
Printf.sprintf "%s/work/backup.tar" ezfio_filename
in
try
Printf.sprintf "
mkdir -p %s/work ;
tar -cf .backup.tar --exclude=\"work/*\" %s && (mv .backup.tar %s || rm .backup.tar)
"
ezfio_filename ezfio_filename backup_filename
|> Sys.command_exn
with _ -> ()
(** Restore the backup file when an exception occuprs *)
let restore_backup ezfio_filename =
Printf.sprintf "tar -zxf %s/backup.tgz"
ezfio_filename
|> Sys.command_exn
let filename =
Printf.sprintf "%s/work/backup.tar" ezfio_filename
in
if Sys.file_exists_exn filename then
begin
Printf.sprintf "tar -xf %s" filename
|> Sys.command_exn;
remove_backup ezfio_filename
end
let spec =
let open Command.Spec in
empty
+> flag "-c" no_arg
~doc:"Checks the input data"
+> flag "ndet" (optional int)
~doc:"int Truncate the wavefunction to the target number of determinants"
+> flag "state" (optional int)
~doc:"int Pick the state as a new wavefunction."
+> anon ("ezfio_file" %: string)
let command =
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"
Edit input data
")
spec
(* (fun i o ezfio_file () -> *)
(*fun ezfio_file () ->
try
run ezfio_file
with
| _ msg -> print_string ("\n\nError\n\n"^msg^"\n\n")
*)
(fun c ndet state ezfio_file () ->
try
run c ?ndet ?state ezfio_file ;
(* create_backup ezfio_file; *)
with
| Failure exc
| Invalid_argument exc as e ->
begin
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
Printf.eprintf "%s\n\n" exc;
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
(* restore_backup ezfio_file; *)
raise e
end
| Assert_failure (file, line, ch) as e ->
begin
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
Printf.eprintf "Assert error in file $QP_ROOT/ocaml/%s, line %d, character %d\n\n" file line ch;
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
(* restore_backup ezfio_file; *)
raise e
end
)
let () =
Command.run command;
exit 0
(* Command-line specs *)
Command_line.set_header_doc "Opens a text editor to edit the parameters of a EZFIO directory.";
[ ( 'c', "check", "Checks the input data", Command_line.Without_arg);
( 'n', "ndet", "<int> Truncate the wavefunction to the target number of determinants",
Command_line.With_arg);
( 's', "state", "<int> Pick the state as a new wavefunction", Command_line.With_arg);
Command_line.anonymous "<EZFIO_FILE>" "EZFIO directory";
]
|> Command_line.set_specs ;
(* Handle options *)
if Command_line.show_help () then
exit 0;
let ndet =
match Command_line.get "ndet" with
| None -> None
| Some s -> (try Some (int_of_string s)
with _ -> failwith "[-n|--ndet] expects an integer")
in
let state =
match Command_line.get "state" with
| None -> None
| Some s -> (try Some (int_of_string s)
with _ -> failwith "[-s|--state] expects an integer")
in
let c =
match Command_line.get "check" with
| None -> false
| _ -> true
in
let ezfio_filename =
match Command_line.anon_args () with
| [x] -> x
| _ -> (Command_line.help () ; failwith "EZFIO_FILE is missing")
in
at_exit (fun () -> remove_backup ezfio_filename);
(* Run the program *)
try
if (not c) then create_backup ezfio_filename;
run c ?ndet ?state ezfio_filename
with
| Failure exc
| Invalid_argument exc ->
begin
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
Printf.eprintf "%s\n\n" exc;
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
restore_backup ezfio_filename;
ignore @@ exit 1
end
| Assert_failure (file, line, ch) ->
begin
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
Printf.eprintf "Assert error in file $QP_ROOT/ocaml/%s, line %d, character %d\n\n" file line ch;
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
restore_backup ezfio_filename;
ignore @@ exit 2
end;
exit 0

View File

@ -13,10 +13,10 @@ zero.
Usage:
qp_set_frozen_core [-q] <EZFIO_DIRECTORY>
qp_set_frozen_core [-q|--query] <EZFIO_DIRECTORY>
Options:
-q Prints in the standard output the number of core electrons
-q --query Prints in the standard output the number of core electrons
"""
@ -58,15 +58,15 @@ def main(arguments):
mo_num = ezfio.mo_basis_mo_num
if arguments["-q"]:
if arguments["--query"]:
print nb
sys.exit(0)
if nb == 0:
os.system( """qp_set_mo_class -act "[1-%d]" %s""" %
os.system( """qp_set_mo_class -a "[1-%d]" %s""" %
(mo_num, sys.argv[1]) )
else:
os.system( """qp_set_mo_class -core "[1-%d]" -act "[%d-%d]" %s""" %
os.system( """qp_set_mo_class -c "[1-%d]" -a "[%d-%d]" %s""" %
(nb, nb+1, mo_num, sys.argv[1]) )

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ function run() {
}
@test "SO" { # 0.539000
run so.ezfio -25.71752633718843
run so.ezfio -25.7175126082701
}
@test "HCO" { # 0.636700