9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-10-16 04:31:32 +02:00

Merge pull request #1 from QuantumPackage/develop

First merge to set up read the docs. Still beta version.
This commit is contained in:
Anthony Scemama 2019-01-25 15:01:53 +01:00 committed by GitHub
commit 08283385ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
995 changed files with 581576 additions and 4 deletions

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
*.irp.f linguist-language=IRPF90
*.f linguist-language=Fortran
*.ml linguist-language=Ocaml
*.sh linguist-language=Bash
*.py linguist-language=Python

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
config/ifort.cfg
quantum_package_static.tar.gz
build.ninja
.ninja_log
.ninja_deps
bin/
lib/
config/qp_create_ninja.pickle
src/*/.gitignore
ezfio_interface.irp.f
share

39
.travis.yml Normal file
View File

@ -0,0 +1,39 @@
#sudo: true
#before_script:
# - sudo apt-get update -q
# - sudo apt-get remove curl
# - sudo apt-get remove zlib1g-dev
# - sudo apt-get install autoconf
# - sudo rm /usr/local/bin/bats
os: linux
dist: trusty
sudo: false
compiler: gfortran
addons:
apt:
packages:
- gfortran
- gcc
- liblapack-dev
- libblas-dev
env:
- OPAMROOT=$HOME/.opam
cache:
directories:
- $HOME/.opam/
language: python
python:
- "2.7"
script:
- ./configure --install all --config ./config/travis.cfg
- source ./quantum_package.rc ; ninja -j 1 -v
- source ./quantum_package.rc ; qp_test -a

32
CITATION.cff Normal file
View File

@ -0,0 +1,32 @@
# YAML 1.2
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.0.3
message: If you use this software, please cite it using these metadata.
title: Quantum Package
doi: 10.5281/zenodo.825872
authors:
- given-names: Anthony
family-names: Scemama
affiliation: Laboratoire de Chimie et Physique Quantiques / CNRS
- given-names: Yann
family-names: Garniron
affiliation: Laboratoire de Chimie et Physique Quantiques / CNRS
- given-names: Michel
family-names: Caffarel
affiliation: Laboratoire de Chimie et Physique Quantiques / CNRS
- given-names: Thomas
family-names: Applencourt
affiliation: Argonne National Lab
- given-names: Kevin
family-names: Gasperich
affiliation: Argonne National Lab
- given-names: Anouar
family-names: Benali
affiliation: Argonne National Lab
- given-names: Emmanuel
family-names: Giner
affiliation: Laboratoire de Chimie Theorique / CNRS
version: '2.0'
date-released: 2019-02-11
repository-code: https://github.com/QuantumPackage/qp2
license: AGPL-3.0-or-later

32
GITHUB.md Normal file
View File

@ -0,0 +1,32 @@
GitHub Branches
===============
master
The current up-to-date working branch, that users download It should
only contain the latest release and bug fixes.
documentation
It is a fork of the *master* branch, but with the `/docs` directory
containing the sources built properly for the ReadTheDocs website
documentation.
develop
It is a fork of the *master* branch with new developments that will be
merged in the *master* branch for the next release.
gh-pages
This is an independent branch, containing only the web site of QP2.
# How to make a bug fix
[git-flow](https://nvie.com/posts/a-successful-git-branching-model)
should be used:
[![git-flow]](https://nvie.com/img/git-model@2x.png)
For each bug fix, create a new branch. Then, when the bug is fixed and
the test are all OK, merge (squash) the bug fix commits in both the
*master* and the *develop* branches.

289
INSTALL.rst Normal file
View File

@ -0,0 +1,289 @@
============
Installation
============
The |qp| can be downloaded on GitHub as an `archive
<https://github.com/LCPQ/quantum_package/releases/latest>`_ or as a `git
repository <https://github.com/LCPQ/quantum_package>`_.
.. code:: bash
git clone https://github.com/LCPQ/quantum_package
Before anything, go into your :file:`quantum_package` directory and run
.. code:: bash
./configure
This script will create the :file:`quantum_package.rc` bash script, which
sets all the environment variables required for the normal operation of the
*Quantum Package*.
Running this script will also tell you which external dependencies are missing
and need to be installed.
When all dependencies have been installed, ( the :command:`configure` will tell you)
source the :file:`quantum_package.rc` in order to load all environment variables and compile the |QP|.
Requirements
============
- Linux OS
- Fortran compiler : GNU Fortran, Intel Fortran or IBM XL Fortran
- `GNU make`_
- `Autoconf`_
- `Python`_ > 2.6
- |IRPF90| : Fortran code generator
- |EZFIO| : Easy Fortran Input/Output library generator
- |BLAS| and |LAPACK|
- `Zlib`_
- `GNU Patch`_
- |ZeroMQ| : networking library
- |OCaml| compiler with |OPAM| package manager
- |Ninja| : a parallel build system
When all the dependencies have been installed, go into the :file:`config`
directory, and copy the configuration file that corresponds to your
architecture. Modify it if needed, and run :command:`configure` with
:option:`configure -c`.
.. code:: bash
cp ./config/gfortran.example config/gfortran.cfg
./configure -c config/gfortran.cfg
.. note::
The ``popcnt`` instruction accelerates *a lot* the programs, so the
SSE4.2, AVX or AVX2 instruction sets should be enabled in the
configuration file if possible.
Help for installing external dependencies
=========================================
Using the :command:`configure` executable
-----------------------------------------
The :command:`configure` executable can help you in installing the minimal dependencies you will need to compile the |QP|.
The command is to be used as follows:
.. code:: bash
./configure --install <package>
The following packages are supported by the :command:`configure` installer:
* ninja
* irpf90
* zeromq
* f77zmq
* ocaml ( :math:`\approx` 10 minutes)
* ezfio
* docopt
* resultsFile
* bats
Example:
.. code:: bash
./configure -i ezfio
.. note::
When installing the ocaml package, you will be asked the location of where it should be installed.
A safe option is to enter the path proposed by the |QP|:
QP>> Please install it here: /your_quantum_package_directory/bin
So just enter the proposition of the |QP| and press enter.
If the :command:`configure` executable fails to install a specific dependency
-----------------------------------------------------------------------------
If the :command:`configure` executable does not succeed to install a specific dependency,
there are some proposition of how to download and install the minimal dependencies to compile and use the |QP|
Before doing anything below, try to install the packages with your package manager
(:command:`apt`, :command:`yum`, etc)
Ninja
-----
*Ninja* is a build system (like GNU make), with a focus on speed.
* Download the latest binary version of Ninja
here : `<https://github.com/ninja-build/ninja/releases/latest>`_
* Unzip the ninja-linux.zip file, and move the ninja binary into
the :file:`${QP_ROOT}/bin` directory.
IRPF90
------
*IRPF90* is a Fortran code generator for programming using the Implicit Reference
to Parameters (IRP) method.
* Download the latest version of IRPF90
here : `<https://github.com/scemama/irpf90/releases/latest>`_ and move
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive and go into the :file:`irpf90-*` directory to run
:command:`make`
.. note::
The :envvar:`IRPF90_PATH` variable may need to be updated in the configuration
file :file:`${QP_ROOT}/etc/irpf90.rc`.
ZeroMQ and its Fortran binding
------------------------------
*ZeroMQ* is a high-performance asynchronous messaging library.
* Download the latest stable version of ZeroMQ
here : `<https://github.com/zeromq/libzmq/releases/latest>`_ and move the
downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`zeromq-*` directory and run
the following commands
.. code:: bash
./configure --prefix="${QP_ROOT}" --without-libsodium
make
make install
* Download the Fortran binding
here : `<https://github.com/zeromq/f77_zmq/releases/latest>`_ and move
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`f77_zmq-*` directory and run
the following commands
.. code:: bash
export ZMQ_H=${QP_ROOT}/include/zmq.h
make
cp libf77zmq.a ${QP_ROOT}/lib
cp libf77zmq.so ${QP_ROOT}/lib
* Copy the :file:`f77_zmq_free.h` file in the ``ZMQ`` module as follows:
.. code:: bash
cp f77_zmq_free.h ${QP_ROOT}/src/ZMQ/f77_zmq.h
Zlib
----
*Zlib* is the compression library used by *gzip*.
* Download the latest version of Zlib here:
`<https://www.zlib.net/zlib-1.2.11.tar.gz>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`zlib-*` directory and run
the following commands
.. code:: bash
./configure --prefix=${QP_ROOT}
make
make install
OCaml
-----
*OCaml* is a general purpose programming language with an emphasis on expressiveness and safety.
* Download the installer of the OPAM package manager here :
`<https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh>`_
and move it in the :file:`${QP_ROOT}/external` directory
* If you use OCaml only with the |qp|, you can install the OPAM directory
containing the compiler and all the installed libraries in the
:file:`${QP_ROOT}/external` directory as
.. code:: bash
export OPAMROOT=${QP_ROOT}/external/opam
* Run the installer
.. code:: bash
echo ${QP_ROOT}/bin
${QP_ROOT}/external/opam_installer.sh --no-backup --fresh
You the :command:`opam` command can be installed in the :file:`${QP_ROOT}/bin`
directory. To do this, take the output of ``echo ${QP_ROOT}/bin`` and
use it as an answer to where :command:`opam` should be installed.
* Install the OCaml compiler
.. code:: bash
opam init --disable-sandboxing --comp=4.07.0
eval `${QP_ROOT}/bin/opam env`
* Install the required external OCaml libraries
.. code:: bash
opam install ocamlbuild cryptokit zmq core sexplib ppx_sexp_conv ppx_deriving getopt
EZFIO
-----
*EZFIO* is the Easy Fortran Input/Output library generator.
* Download EZFIO here : `<https://gitlab.com/scemama/EZFIO/-/archive/master/EZFIO-master.tar.gz>`_ and move
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, and rename it as :file:`${QP_ROOT}/external/ezfio`
Docopt
------
*Docopt* is a Python package defining a command-line interface description language.
If you have *pip* for Python2, you can do
.. code:: bash
pip2 install --user docopt
Otherwise,
* Download the archive here : `<https://github.com/docopt/docopt/releases/tag/0.6.2>`_
* Extract the archive
* Copy :file:`docopt-0.6.2/docopt.py` in the :file:`${QP_ROOT}/scripts` directory

View File

@ -629,12 +629,12 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Quantum Package
Copyright (C) 2019 Anthony Scemama, Emmanuel Giner
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
default: build.ninja
bash -c "source quantum_package.rc ; ninja"
build.ninja:
@bash -c ' echo '' ; echo xxxxxxxxxxxxxxxxxx ; echo "The QP is not configured yet. Please run the ./configure command" ; echo xxxxxxxxxxxxxxxxxx ; echo '' ; ./configure --help' | more

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# Quantum Package
A programming environment for wave function methods
![QP](https://raw.githubusercontent.com/QuantumPackage/qp2/master/data/qp2.png)
# Getting started
* [Visit the web site](https://quantumpackage.github.io/qp2)
* [Download the latest release](http://github.com/QuantumPackage/qp2/releases)
* [Read the documentation](https://quantum-package-scemamamaster.readthedocs.io/) **TODO**
# Build status
* Master: [![Build Status](https://travis-ci.org/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2)
* Development branch : [![Build Status](https://travis-ci.org/QuantumPackage/qp2.svg?branch=develop)](https://travis-ci.org/QuantumPackage/qp2)
# Credits
* [CNRS](http://www.cnrs.fr)
* [Laboratoire de Chimie et Physique Quantiques](http://lcpq.ups-tlse.fr)
* [Laboratoire de Chimie Théorique](http://www.lct.jussieu.fr)
* [Argonne Leadership Computing Facility](http://alcf.anl.gov)
* [CALMIP](https://www.calmip.univ-toulouse.fr)

185
REPLACE Normal file
View File

@ -0,0 +1,185 @@
# This file contains all the renamings that occured between qp1 and qp2.
qp_name mo_mono_elec_integral --rename=mo_mono_elec_integrals
qp_name mo_nucl_elec_integral --rename=mo_nucl_elec_integrals
qp_name mo_kinetic_integral --rename=mo_kinetic_integrals
qp_name disk_access_mo_one_integrals --replace="io_mo_one_e_integrals"
qp_name disk_access_mo_one_integrals --rename="io_mo_one_e_integrals"
qp_name disk_access_ao_one_integrals --rename="io_ao_one_e_integrals"
qp_name ao_mono_elec_integral --rename="ao_one_e_integrals"
qp_name disk_access_ao_integrals --rename="io_ao_two_e_integrals"
qp_name disk_access_mo_integrals --rename="io_mo_two_e_integrals"
qp_name io_mo_integrals --rename="io_mo_two_e_integrals"
qp_name io_ao_integrals --rename="io_ao_two_e_integrals"
qp_name read_ao_integrals --rename="read_ao_two_e_integrals"
qp_name read_mo_integrals --rename="read_mo_two_e_integrals"
qp_name write_mo_integrals --rename="write_mo_two_e_integrals"
qp_name write_ao_integrals --rename="write_ao_two_e_integrals"
qp_name ao_two_e_integrals --rename="ao_two_e_ints"
qp_name mo_two_e_integrals --rename="mo_two_e_ints"
qp_name mo_two_e_erf_integrals --rename="mo_two_e_erf_ints"
qp_name ao_two_e_erf_integrals --rename="ao_two_e_erf_ints"
qp_name ezfio_set_mo_two_e_ints_io_mo_integrals -r ezfio_set_mo_two_e_ints_io_mo_two_e_integrals
qp_name ezfio_set_ao_two_e_ints_io_ao_integrals -r ezfio_set_ao_two_e_ints_io_ao_two_e_integrals
qp_name mo_tot_num -r mo_num
qp_name ezfio_set_mo_basis_mo_tot_num -r ezfio_set_mo_basis_mo_num
qp_name ezfio_get_mo_basis_mo_tot_num -r ezfio_get_mo_basis_mo_num
qp_name ezfio_set_ao_two_e_integrals_disk_access_ao_integrals -r ezfio_set_ao_two_e_integrals_io_ao_two_e_integrals
qp_name ezfio_set_mo_two_e_integrals_disk_access_mo_integrals -r ezfio_set_mo_two_e_integrals_io_mo_two_e_integrals
qp_name ezfio_set_mo_two_e_integrals_io_mo_two_e_integrals -r ezfio_set_mo_two_e_ints_io_mo_two_e_integrals
qp_name ezfio_get_mo_two_e_integrals_io_mo_two_e_integrals -r ezfio_get_mo_two_e_ints_io_mo_two_e_integrals
qp_name ezfio_set_ao_two_e_integrals_io_ao_two_e_integrals -r ezfio_set_ao_two_e_ints_io_ao_two_e_integrals
qp_name ezfio_get_ao_two_e_integrals_io_ao_two_e_integrals -r ezfio_get_ao_two_e_ints_io_ao_two_e_integrals
qp_name ezfio_set_ao_two_e_erf_integrals_disk_access_ao_integrals_erf -r ezfio_set_ao_two_e_erf_ints_io_ao_two_e_integrals_erf
qp_name ezfio_set_mo_two_e_erf_integrals_disk_access_mo_integrals_erf -r ezfio_set_mo_two_e_erf_ints_io_mo_two_e_integrals_erf
qp_name disk_access_ao_integrals_erf io_ao_integrals_erf
qp_name disk_access_ao_integrals_erf -r io_ao_integrals_erf
qp_name disk_access_mo_integrals_erf -r io_mo_integrals_erf
qp_name write_mo_integrals_erf -r write_mo_two_e_integrals_erf
qp_name read_mo_integrals_erf -r read_mo_two_e_integrals_erf
qp_name ao_integrals_n_e
qp_name ao_nucl_elec_interals -r ao_integrals_n_e
qp_name ao_nucl_elec_integrals -r ao_integrals_n_e
qp_name ao_nucl_elec_integrals_per_atom -r ao_integrals_n_e_per_atom
qp_name bi_elec_ref_bitmask_energy -r ref_bitmask_two_e_energy
qp_name mono_elec_ref_bitmask_energy -r ref_bitmask_one_e_energy
qp_name kinetic_ref_bitmask_energy -r ref_bitmask_kinetic_energy
qp_name nucl_elec_ref_bitmask_energy -r ref_bitmask_e_n_energy
qp_name disk_access_ao_integrals_erf
qp_name mo_bielec_integral_jj
qp_name mo_bielec_integral_jj -r mo_two_e_integrals_jj
qp_name mo_bielec_integral_jj_anti -r mo_two_e_integrals_jj_anti
qp_name mo_bielec_integral_jj_anti_from_ao -r mo_two_e_integrals_jj_anti_from_ao
qp_name mo_bielec_integral_jj_anti_exchange -r mo_two_e_integrals_jj_exchange
qp_name mo_bielec_integral_jj_exchange -r mo_two_e_integrals_jj_exchange
qp_name mo_bielec_integral_jj_exchange_from_ao -r mo_two_e_integrals_jj_exchange_from_ao
qp_name mo_bielec_integral_vv_anti_from_ao -r mo_two_e_integrals_vv_anti_from_ao
qp_name mo_bielec_integral_vv_exchange_from_ao -r mo_two_e_integrals_vv_exchange_from_ao
qp_name mo_bielec_integral_vv_from_ao -r mo_two_e_integrals_vv_from_ao
qp_name mo_bielec_integrals_erf_in_map -r mo_two_e_integrals_erf_in_map
qp_name mo_bielec_integrals_in_map -r mo_two_e_integrals_in_map
qp_name ao_bielec_integrals_in_map -r ao_two_e_integrals_in_map
qp_name ao_bielec_integrals_erf_in_map -r ao_two_e_integrals_erf_in_map
qp_name mo_mono_elec_integrals -r mo_one_e_integrals
qp_name mo_nucl_elec_integrals -r mo_integrals_n_e
qp_name mo_nucl_elec_integrals_per_atom -r mo_integrals_n_e_per_atom
qp_name I_x1_pol_mult_mono_elec -r I_x1_pol_mult_one_e
qp_name I_x2_pol_mult_mono_elec -r I_x2_pol_mult_one_e
qp_name give_polynom_mult_center_mono_elec give_polynomial_mult_center_one_e
qp_name give_polynom_mult_center_mono_elec -r give_polynomial_mult_center_one_e
qp_name give_polynom_mult_center_mono_elec_erf -r give_polynomial_mult_center_one_e_erf
qp_name give_polynom_mult_center_mono_elec_erf_opt -r give_polynomial_mult_center_one_e_erf_opt
qp_name i_H_j_mono_spin_monoelec -r i_H_j_mono_spin_one_e
qp_name diag_H_mat_elem_monoelec -r diag_H_mat_elem_one_e
qp_name i_H_j_monoelec -r i_H_j_one_e
qp_name get_mo_bielec_integral -r get_two_e_integral
qp_name ao_bielec_integrals_in_map_slave_tcp -r ao_two_e_integrals_in_map_slave_tcp
qp_name get_ao_bielec_integrals_non_zero -r get_ao_two_e_integrals_non_zero
qp_name bielec
qp_name bielec -r two-electron
qp_name ao_bielec_integral -r ao_two_e_integral
qp_name compute_ao_bielec_integrals -r compute_ao_two_e_integrals
qp_name mo_bielec_integral_jj_from_ao -r mo_two_e_integral_jj_from_ao
qp_name bielec_tmp_1 -r two_e_tmp_1
qp_name bielec_tmp_2 -r two_e_tmp_2
qp_name bielec_tmp_3 -r two_e_tmp_3
qp_name mo_bielec_integrals_index -r mo_two_e_integrals_index
qp_name bielec_tmp_0_idx -r two_e_tmp_0_idx
qp_name bielec_tmp_0 -r two_e_tmp_0
qp_name get_ao_bielec_integrals -r get_ao_two_e_integrals
qp_name bielectronic -r two-electron
qp_name bielec_integrals_index -r two_e_integrals_index
qp_name mo_bielec_integral -r mo_two_e_integral
qp_name mo_bielec_integrals_ij -r mo_two_e_integrals_ij
qp_name get_mo_bielec_integrals_ij -r get_mo_two_e_integrals_ij
qp_name get_mo_bielec_integrals_i1j1 -r get_mo_two_e_integrals_i1j1
qp_name get_mo_bielec_integrals_coulomb -r get_mo_two_e_integrals_coulomb
qp_name get_mo_bielec_integrals_coulomb_ii -r get_mo_two_e_integrals_coulomb_ii
qp_name get_mo_bielec_integrals_exch_ii -r get_mo_two_e_integrals_exch_ii
qp_name get_mo_bielec_integrals -r get_mo_two_e_integrals
qp_name get_ao_bielec_integrals_erf -r get_ao_two_e_integrals_erf
qp_name save_erf_bielec_ints_mo_into_ints_mo -r save_erf_two_e_ints_mo_into_ints_mo
qp_name get_mo_bielec_integral_erf -r get_mo_two_e_integral_erf
qp_name get_ao_bielec_integral_erf -r get_ao_two_e_integral_erf
qp_name bielec_integrals_index_reverse -r two_e_integrals_index_reverse
qp_name get_mo_bielec_integrals_erf -r get_mo_two_e_integrals_erf
qp_name ao_bielec_integral_schwartz -r ao_two_e_integral_schwartz
qp_name get_mo_bielec_integrals_erf_ij -r get_mo_two_e_integrals_erf_ij
qp_name get_mo_bielec_integrals_erf_i1j1 -r get_mo_two_e_integrals_erf_i1j1
qp_name get_mo_bielec_integral_schwartz -r get_mo_two_e_integral_schwartz
qp_name get_ao_bielec_integrals_erf_non_zero -r get_ao_two_e_integrals_erf_non_zero
qp_name compute_ao_bielec_integrals_erf -r compute_ao_two_e_integrals_erf
qp_name mo_bielec_integrals_erf_index -r mo_two_e_integrals_erf_index
qp_name get_mo_bielec_integrals_erf_exch_ii -r get_mo_two_e_integrals_erf_exch_ii
qp_name get_mo_bielec_integrals_erf_coulomb_ii -r get_mo_two_e_integrals_erf_coulomb_ii
qp_name mo_bielec_integral_erf -r mo_two_e_integral_erf
qp_name i_H_j_bielec -r i_H_j_two_e
qp_name H_S2_u_0_bielec_nstates_openmp_work -r H_S2_u_0_two_e_nstates_openmp_work
qp_name H_S2_u_0_bielec_nstates_openmp_work_1 -r H_S2_u_0_two_e_nstates_openmp_work_1
qp_name H_S2_u_0_bielec_nstates_openmp_work_2 -r H_S2_u_0_two_e_nstates_openmp_work_2
qp_name H_S2_u_0_bielec_nstates_openmp_work_3 -r H_S2_u_0_two_e_nstates_openmp_work_3
qp_name H_S2_u_0_bielec_nstates_openmp_work_4 -r H_S2_u_0_two_e_nstates_openmp_work_4
qp_name H_S2_u_0_bielec_nstates_openmp -r H_S2_u_0_two_e_nstates_openmp
qp_name ac_operator_bielec -r ac_operator_two_e
qp_name aa_operator_bielec -r aa_operator_two_e
qp_name a_operator_bielec -r a_operator_two_e
qp_name u_0_H_u_0_bielec -r u_0_H_u_0_two_e
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int #-r "H_S2_u_0_two_e_nstates_openmp_work_$N_int"
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int -r "H_S2_u_0_two_e_nstates_openmp_work_$N_int"
qp_name ao_bielec_integral_erf -r ao_two_e_integral_erf
qp_name psi_energy_bielec -r psi_energy_two_e
qp_name ao_bielec_integrals_in_map_slave_inproc -r ao_two_e_integrals_in_map_slave_inproc
qp_name ao_bielec_integrals_in_map_collector -r ao_two_e_integrals_in_map_collector
qp_name ao_bielec_integral_schwartz_accel -r ao_two_e_integral_schwartz_accel
qp_name get_ao_bielec_integral -r get_ao_two_e_integral
qp_name ao_bielec_integrals_in_map_slave -r ao_two_e_integrals_in_map_slave
qp_name ao_bielec_integral_erf_schwartz -r ao_two_e_integral_erf_schwartz
qp_name ao_bielec_integral_schwartz_accel_erf -r ao_two_e_integral_schwartz_accel_erf
qp_name ao_bielec_integrals_erf_in_map_slave_tcp -r ao_two_e_integrals_erf_in_map_slave_tcp
qp_name ao_bielec_integrals_erf_in_map_slave -r ao_two_e_integrals_erf_in_map_slave
qp_name ao_bielec_integrals_erf_in_map_slave_inproc -r ao_two_e_integrals_erf_in_map_slave_inproc
qp_name ao_bielec_integrals_erf_in_map_collector -r ao_two_e_integrals_erf_in_map_collector
qp_name save_erf_bielec_ints_ao_into_ints_ao -r save_erf_two_e_ints_ao_into_ints_ao
qp_name save_erf_bi_elec_integrals_mo -r save_erf_two_e_integrals_mo
qp_name ao_bi_elec_integral_beta -r ao_two_e_integral_beta
qp_name ao_bi_elec_integral_alpha -r ao_two_e_integral_alpha
qp_name ao_bi_elec_integral_alpha_tmp -r ao_two_e_integral_alpha_tmp
qp_name ao_bi_elec_integral_beta_tmp -r ao_two_e_integral_beta_tmp
qp_name data_one_body_alpha_dm_mo -r data_one_body_dm_alpha_mo
qp_name data_one_body_beta_dm_mo -r data_one_body_dm_beta_mo
qp_name one_body_dm_alpha_ao_for_dft -r one_e_dm_alpha_ao_for_dft
qp_name one_body_dm_alpha_at_r -r one_e_dm_alpha_at_r
qp_name one_body_dm_ao_alpha -r one_e_dm_ao_alpha
qp_name one_body_dm_ao_beta -r one_e_dm_ao_beta
qp_name one_body_dm_average_mo_for_dft -r one_e_dm_average_mo_for_dft
qp_name one_body_dm_beta_ao_for_dft -r one_e_dm_beta_ao_for_dft
qp_name one_body_dm_beta_at_r -r one_e_dm_beta_at_r
qp_name one_body_dm_dagger_mo_spin_index -r one_e_dm_dagger_mo_spin_index
qp_name one_body_dm_mo -r one_e_dm_mo
qp_name one_body_dm_mo_alpha -r one_e_dm_mo_alpha
qp_name one_body_dm_mo_alpha_average -r one_e_dm_mo_alpha_average
qp_name one_body_dm_mo_alpha_for_dft -r one_e_dm_mo_alpha_for_dft
qp_name one_body_dm_mo_beta -r one_e_dm_mo_beta
qp_name one_body_dm_mo_beta_average -r one_e_dm_mo_beta_average
qp_name one_body_dm_mo_beta_for_dft -r one_e_dm_mo_beta_for_dft
qp_name one_body_dm_mo_diff -r one_e_dm_mo_diff
qp_name one_body_dm_mo_for_dft -r one_e_dm_mo_for_dft
qp_name one_body_dm_mo_spin_index -r one_e_dm_mo_spin_index
qp_name one_body_grad_2_dm_alpha_at_r -r one_e_grad_2_dm_alpha_at_r
qp_name one_body_grad_2_dm_beta_at_r -r one_e_grad_2_dm_beta_at_r
qp_name one_body_spin_density_ao -r one_e_spin_density_ao
qp_name one_body_spin_density_mo -r one_e_spin_density_mo
qp_name one_electron_energy -r one_e_energy
qp_name one_dm_alpha_in_r -r one_e_dm_alpha_in_r
qp_name one_dm_and_grad_alpha_in_r -r one_e_dm_and_grad_alpha_in_r
qp_name one_dm_and_grad_beta_in_r -r one_e_dm_and_grad_beta_in_r
qp_name one_dm_beta_in_r -r one_e_dm_beta_in_r
qp_name ezfio_set_aux_quantities_data_one_body_alpha_dm_mo -r ezfio_set_aux_quantities_data_one_e_alpha_dm_mo
qp_name ezfio_set_aux_quantities_data_one_body_beta_dm_mo -r ezfio_set_aux_quantities_data_one_e_beta_dm_mo
qp_name data_one_body_dm_alpha_mo -r data_one_e_dm_alpha_mo
qp_name data_one_body_dm_beta_mo -r data_one_e_dm_beta_mo
qp_name save_one_body_dm -r save_one_e_dm
qp_name ezfio_set_aux_quantities_data_one_e_alpha_dm_mo -r ezfio_set_aux_quantities_data_one_e_dm_alpha_mo
qp_name ezfio_set_aux_quantities_data_one_e_beta_dm_mo -r ezfio_set_aux_quantities_data_one_e_dm_beta_mo
qp_name two_electron_energy -r two_e_energy

60
TODO Normal file
View File

@ -0,0 +1,60 @@
# qpsh
* Faire que le slave de Hartree-fock est le calcul des integrales AO en parallele
# Web/doc
* Creer une page web pas trop degueu et la mettre ici : http://lcpq.github.io/quantum_package
* Creer une page avec la liste de tous les exectuables
# Exterieur
* Molden format : http://cheminf.cmbi.ru.nl/molden/molden_format.html : read+write. Thomas est dessus
* Un module pour lire les integrales Moleculaires depuis un FCIDUMP
* Un module pour lire des integrales Atomiques (voir module de Mimi pour lire les AO Slater)
* Format Fchk (gaussian)
# Tests:
* Extrapolation
* DFT
# User doc:
* Videos:
+) RHF
* Renvoyer a la doc des modules : c'est pour les programmeurs au depart!
* Mettre le mp2 comme exercice
* Interfaces : molden/fcidump
* Natural orbitals
* Parameters for Hartree-Fock
* Parameters for Davidson
* Running in parallel
# Programmers doc:
* Example : Simple Hartree-Fock program from scratch
* Examples : subroutine example_module
# Config file for Cray
# EZFIO sans fork
Refaire les benchmarks
# Documentation de qpsh
# Documentation de /etc
# Extrapolation qui prend aussi en compe la variance? a tester
Parler dans le papier de rPT2
# Toto
Re-design de qp command
Doc: plugins et qp_plugins
Ajouter les symetries dans devel

0
bin/.gitignore vendored Normal file
View File

368
bin/qp_convert_output_to_ezfio Executable file
View File

@ -0,0 +1,368 @@
#!/usr/bin/env python2
"""
convert output of GAMESS/GAU$$IAN to ezfio
Usage:
qp_convert_output_to_ezfio [-o EZFIO_DIR] FILE
Options:
-o --output=EZFIO_DIR Produced directory
by default is FILE.ezfio
"""
import sys
import os
from functools import reduce
from ezfio import ezfio
from docopt import docopt
try:
QP_ROOT = os.environ["QP_ROOT"]
QP_EZFIO = os.environ["QP_EZFIO"]
except KeyError:
print "Error: QP_ROOT environment variable not found."
sys.exit(1)
else:
sys.path = [QP_EZFIO + "/Python",
QP_ROOT + "/install/resultsFile",
QP_ROOT + "/install",
QP_ROOT + "/scripts"] + sys.path
try:
from resultsFile import *
except:
print "Error: resultsFile Python library not installed"
sys.exit(1)
def write_ezfio(res, filename):
res.clean_uncontractions()
ezfio.set_file(filename)
# _
# |_ | _ _ _|_ ._ _ ._ _
# |_ | (/_ (_ |_ | (_) | | _>
#
print "Electrons\t...\t",
ezfio.set_electrons_elec_alpha_num(res.num_alpha)
ezfio.set_electrons_elec_beta_num(res.num_beta)
print "OK"
#
# |\ | _ | _ o
# | \| |_| (_ | (/_ |
#
print "Nuclei\t\t...\t",
# ~#~#~#~ #
# I n i t #
# ~#~#~#~ #
charge = []
coord_x = []
coord_y = []
coord_z = []
# ~#~#~#~#~#~#~ #
# P a r s i n g #
# ~#~#~#~#~#~#~ #
for a in res.geometry:
charge.append(a.charge)
if res.units == 'BOHR':
coord_x.append(a.coord[0])
coord_y.append(a.coord[1])
coord_z.append(a.coord[2])
else:
coord_x.append(a.coord[0] / a0)
coord_y.append(a.coord[1] / a0)
coord_z.append(a.coord[2] / a0)
# ~#~#~#~#~ #
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_nuclei_nucl_num(len(res.geometry))
ezfio.set_nuclei_nucl_charge(charge)
# Transformt H1 into H
import re
p = re.compile(ur'(\d*)$')
label = [p.sub("", x.name).capitalize() for x in res.geometry]
ezfio.set_nuclei_nucl_label(label)
ezfio.set_nuclei_nucl_coord(coord_x + coord_y + coord_z)
print "OK"
# _
# /\ _ _ |_) _. _ o _
# /--\ (_) _> |_) (_| _> | _>
#
print "AOS\t\t...\t",
# ~#~#~#~ #
# I n i t #
# ~#~#~#~ #
import string
at = []
num_prim = []
power_x = []
power_y = []
power_z = []
coefficient = []
exponent = []
res.convert_to_cartesian()
# ~#~#~#~#~#~#~ #
# P a r s i n g #
# ~#~#~#~#~#~#~ #
for b in res.basis:
c = b.center
for i, atom in enumerate(res.geometry):
if atom.coord == c:
at.append(i + 1)
num_prim.append(len(b.prim))
s = b.sym
power_x.append(string.count(s, "x"))
power_y.append(string.count(s, "y"))
power_z.append(string.count(s, "z"))
coefficient.append(b.coef)
exponent.append([p.expo for p in b.prim])
# ~#~#~#~#~ #
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_ao_basis_ao_num(len(res.basis))
ezfio.set_ao_basis_ao_nucl(at)
ezfio.set_ao_basis_ao_prim_num(num_prim)
ezfio.set_ao_basis_ao_power(power_x + power_y + power_z)
# ~#~#~#~#~#~#~ #
# P a r s i n g #
# ~#~#~#~#~#~#~ #
prim_num_max = ezfio.get_ao_basis_ao_prim_num_max()
for i in range(len(res.basis)):
coefficient[
i] += [0. for j in range(len(coefficient[i]), prim_num_max)]
exponent[i] += [0. for j in range(len(exponent[i]), prim_num_max)]
coefficient = reduce(lambda x, y: x + y, coefficient, [])
exponent = reduce(lambda x, y: x + y, exponent, [])
coef = []
expo = []
for i in range(prim_num_max):
for j in range(i, len(coefficient), prim_num_max):
coef.append(coefficient[j])
expo.append(exponent[j])
# ~#~#~#~#~ #
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_ao_basis_ao_coef(coef)
ezfio.set_ao_basis_ao_expo(expo)
ezfio.set_ao_basis_ao_basis("Read by resultsFile")
print "OK"
# _
# |\/| _ _ |_) _. _ o _
# | | (_) _> |_) (_| _> | _>
#
print "MOS\t\t...\t",
# ~#~#~#~ #
# I n i t #
# ~#~#~#~ #
MoTag = res.determinants_mo_type
ezfio.set_mo_basis_mo_label('Orthonormalized')
MO_type = MoTag
allMOs = res.mo_sets[MO_type]
# ~#~#~#~#~#~#~ #
# P a r s i n g #
# ~#~#~#~#~#~#~ #
try:
closed = [(allMOs[i].eigenvalue, i) for i in res.closed_mos]
active = [(allMOs[i].eigenvalue, i) for i in res.active_mos]
virtual = [(allMOs[i].eigenvalue, i) for i in res.virtual_mos]
except:
closed = []
virtual = []
active = [(allMOs[i].eigenvalue, i) for i in range(len(allMOs))]
closed = map(lambda x: x[1], closed)
active = map(lambda x: x[1], active)
virtual = map(lambda x: x[1], virtual)
MOindices = closed + active + virtual
MOs = []
for i in MOindices:
MOs.append(allMOs[i])
mo_num = len(MOs)
while len(MOindices) < mo_num:
MOindices.append(len(MOindices))
MOmap = list(MOindices)
for i in range(len(MOindices)):
MOmap[i] = MOindices.index(i)
energies = []
for i in xrange(mo_num):
energies.append(MOs[i].eigenvalue)
if res.occ_num is not None:
OccNum = []
for i in MOindices:
OccNum.append(res.occ_num[MO_type][i])
while len(OccNum) < mo_num:
OccNum.append(0.)
MoMatrix = []
sym0 = [i.sym for i in res.mo_sets[MO_type]]
sym = [i.sym for i in res.mo_sets[MO_type]]
for i in xrange(len(sym)):
sym[MOmap[i]] = sym0[i]
MoMatrix = []
for i in xrange(len(MOs)):
m = MOs[i]
for coef in m.vector:
MoMatrix.append(coef)
while len(MoMatrix) < len(MOs[0].vector)**2:
MoMatrix.append(0.)
# ~#~#~#~#~ #
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_mo_basis_mo_num(mo_num)
ezfio.set_mo_basis_mo_occ(OccNum)
ezfio.set_mo_basis_mo_coef(MoMatrix)
print "OK"
print "Pseudos\t\t...\t",
try:
lmax = 0
nucl_charge_remove = []
klocmax = 0
kmax = 0
nucl_num = len(res.geometry)
for ecp in res.pseudo:
lmax_local = ecp['lmax']
lmax = max(lmax_local, lmax)
nucl_charge_remove.append(ecp['zcore'])
klocmax = max(klocmax, len(ecp[str(lmax_local)]))
for l in range(lmax_local):
kmax = max(kmax, len(ecp[str(l)]))
lmax = lmax-1
ezfio.set_pseudo_pseudo_lmax(lmax)
ezfio.set_pseudo_nucl_charge_remove(nucl_charge_remove)
ezfio.set_pseudo_pseudo_klocmax(klocmax)
ezfio.set_pseudo_pseudo_kmax(kmax)
pseudo_n_k = [[0 for _ in range(nucl_num)] for _ in range(klocmax)]
pseudo_v_k = [[0. for _ in range(nucl_num)] for _ in range(klocmax)]
pseudo_dz_k = [[0. for _ in range(nucl_num)] for _ in range(klocmax)]
pseudo_n_kl = [[[0 for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)]
pseudo_v_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)]
pseudo_dz_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)]
for ecp in res.pseudo:
lmax_local = ecp['lmax']
klocmax = len(ecp[str(lmax_local)])
atom = ecp['atom']-1
for kloc in range(klocmax):
try:
v, n, dz = ecp[str(lmax_local)][kloc]
pseudo_n_k[kloc][atom] = n-2
pseudo_v_k[kloc][atom] = v
pseudo_dz_k[kloc][atom] = dz
except:
pass
for l in range(lmax_local):
for k in range(kmax):
try:
v, n, dz = ecp[str(l)][k]
pseudo_n_kl[l][k][atom] = n-2
pseudo_v_kl[l][k][atom] = v
pseudo_dz_kl[l][k][atom] = dz
except:
pass
ezfio.set_pseudo_pseudo_n_k(pseudo_n_k)
ezfio.set_pseudo_pseudo_v_k(pseudo_v_k)
ezfio.set_pseudo_pseudo_dz_k(pseudo_dz_k)
ezfio.set_pseudo_pseudo_n_kl(pseudo_n_kl)
ezfio.set_pseudo_pseudo_v_kl(pseudo_v_kl)
ezfio.set_pseudo_pseudo_dz_kl(pseudo_dz_kl)
n_alpha = res.num_alpha
n_beta = res.num_beta
for i in range(nucl_num):
charge[i] -= nucl_charge_remove[i]
n_alpha -= nucl_charge_remove[i]/2
n_beta -= nucl_charge_remove[i]/2
ezfio.set_nuclei_nucl_charge(charge)
ezfio.set_electrons_elec_alpha_num(n_alpha)
ezfio.set_electrons_elec_beta_num(n_beta)
except:
ezfio.set_pseudo_do_pseudo(False)
else:
ezfio.set_pseudo_do_pseudo(True)
print "OK"
def get_full_path(file_path):
file_path = os.path.expanduser(file_path)
file_path = os.path.expandvars(file_path)
file_path = os.path.abspath(file_path)
return file_path
if __name__ == '__main__':
ARGUMENTS = docopt(__doc__)
FILE = get_full_path(ARGUMENTS['FILE'])
if ARGUMENTS["--output"]:
EZFIO_FILE = get_full_path(ARGUMENTS["--output"])
else:
EZFIO_FILE = "{0}.ezfio".format(FILE)
try:
RES_FILE = getFile(FILE)
except:
raise
else:
print FILE, 'recognized as', str(RES_FILE).split('.')[-1].split()[0]
write_ezfio(RES_FILE, EZFIO_FILE)
sys.stdout.flush()
if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0:
print """Warning: You need to run
qp run save_ortho_mos
to be sure your MOs will be orthogonal, which is not the case when
the MOs are read from output files (not enough precision in output)."""

47
bin/qp_e_conv_fci Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
file=$1
if [[ -z ${QP_ROOT} ]] ; then
>&2 echo "please source quantum_package.rc"
exit 1
fi
source ${QP_ROOT}/quantum_package.rc
qp_run print_e_conv $1
nstates=`cat ${1}/determinants/n_states`
echo $nstates
for i in $(seq 1 $nstates) ; do
out=${1}.${i}.conv
cat << EOF > ${out}.plt
set term pdf
set output "$out.pdf"
set log x
set xlabel "Number of determinants"
set ylabel "Total Energy (a.u.)"
plot "$out" w lp title "E_{var} state $i", "$out" u 1:3 w lp title "E_{var} + PT2 state $i"
EOF
gnuplot ${out}.plt
#rm ${out}.plt
done
for i in $(seq 2 $nstates) ; do
out=${1}.${i}.delta_e.conv
cat << EOF > ${out}.plt
set term pdf
set output "$out.pdf"
set log x
set xlabel "Number of determinants"
set ylabel "Energy difference (a.u.)"
plot "$out" w lp title "Delta E_{var} state $i", "$out" u 1:3 w lp title "Delta E_{var} + PT2 state $i"
EOF
gnuplot ${out}.plt
# rm ${out}.plt
done

229
bin/qp_export_as_tgz Executable file
View File

@ -0,0 +1,229 @@
#!/bin/bash
#
# Creates a self-contained binary distribution in the form of a tar.gz file
#
# Mon Nov 26 22:57:50 CET 2018
#
function help() {
cat << EOF
In some HPC facilities, the access to the internet is limited for security
reasons. In such an environment, the installation of QP is sometimes very
painful because the OCaml compiler and the libraries can't be installed by a
non-root user.
This command creates a self-contained binary distribution in the form of a
tar.gz file that can be copied on another machine.
Usage:
$(basename $0) [-h|--help]
Options:
-h --help Prints the help message
Note:
There can be conflicts due to the version of Glibc. The machine on which |QP| is
compiled should be the oldest one.
EOF
exit 0
}
function error() {
>&2 echo "$(basename $0): $@"
exit 2
}
while true ; do
case "$1" in
"")
break;;
-h|-help|--help)
help;;
*)
echo $(basename $0)": unknown option $1, try --help"
exit 2;;
esac
shift
done
set -x
# Check the QP_ROOT directory
if [[ -z ${QP_ROOT} ]] ; then
echo "The QP_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QP_ROOT}
if [[ -f quantum_package.rc \
&& -f README.md \
&& -d src \
&& -d etc \
&& -d man \
&& -d bin \
&& -d ocaml \
&& -d external \
&& -d scripts ]] ; then
: # OK, this is a quantum_package directory
else
error "This doesn't look like a quantum_package directory"
exit 1
fi
# Build all sources
ninja
if [[ $? -ne 0 ]] ; then
error "Error building ${dir}"
fi
# Copy the files in the static directory
QPACKAGE_STATIC=${QP_ROOT}/quantum_package_static
function find_libs () {
for i in "$@" ; do
ldd $i
done \
| sort \
| grep '/' \
| cut --delimiter=' ' --fields=3 \
| uniq
}
function find_exec () {
find ${QP_ROOT}/$1 -perm /u+x -type f
}
echo "Creating root of static directory"
# ---------------------------------
rm --recursive --force -- "${QPACKAGE_STATIC}"
mkdir --parents -- ${QPACKAGE_STATIC}/{bin,etc,man,lib,extra_lib,external}
if [[ $? -ne 0 ]] ; then
error "Error creating ${QPACKAGE_STATIC}/{bin,lib,etc,man,extra_lib,external}"
exit 1
fi
echo "Copying binary files"
# --------------------
FORTRAN_EXEC=$(find_exec src)
if [[ -z $FORTRAN_EXEC ]] ; then
error 'No Fortran binaries found.'
exit 1
fi
OCAML_EXEC=$(find_exec ocaml | grep .native )
if [[ -z $OCAML_EXEC ]] ; then
error 'No ocaml binaries found.'
exit 1
fi
cp -- ${FORTRAN_EXEC} ${OCAML_EXEC} ${QPACKAGE_STATIC}/bin
if [[ $? -ne 0 ]] ; then
error "Error in cp -- ${FORTRAN_EXEC} ${OCAML_EXEC} ${QPACKAGE_STATIC}/bin"
exit 1
fi
(
cd ${QPACKAGE_STATIC}/bin
for i in *.native ; do
mv "$i" $(basename "$i" .native)
done
)
cp ${QP_ROOT}/bin/qp_* ${QPACKAGE_STATIC}/bin
cp ${QP_ROOT}/bin/qpsh ${QPACKAGE_STATIC}/bin
cp --recursive -- ${QP_ROOT}/data ${QPACKAGE_STATIC}/data
for i in ${FORTRAN_EXEC} ; do
i=$(basename $i)
echo $i \$QP_ROOT/bin/$i
done > ${QPACKAGE_STATIC}/data/executables
mkdir --parents -- ${QPACKAGE_STATIC}/src/bitmask
cp ${QP_ROOT}/src/Bitmask/bitmasks_module.f90 ${QPACKAGE_STATIC}/src/bitmask
echo "Copying dynamic libraries"
# --------------------------
MKL_LIBS=$(find_libs ${FORTRAN_EXEC} \
| grep libmkl \
| head -1)
if [[ -n ${MKL_LIBS} ]]
then
MKL_LIBS=$(dirname ${MKL_LIBS})
MKL_LIBS=$(ls ${MKL_LIBS}/libmkl_{def,avx,avx2}.so)
fi
ALL_LIBS=$(find_libs ${OCAML_EXEC} ${FORTRAN_EXEC})
for i in ${ALL_LIBS} ${MKL_LIBS} ; do
cp -- ${i} ${QPACKAGE_STATIC}/extra_lib
done
if [[ $? -ne 0 ]] ; then
echo 'cp -- ${ALL_LIBS} ${MKL_LIBS} ${QPACKAGE_STATIC}/extra_lib'
exit 1
fi
cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} \
${QPACKAGE_STATIC}/lib/
#
echo "Copying scripts directory"
# -------------------------
cp --recursive -- ${QP_ROOT}/scripts ${QPACKAGE_STATIC}/
if [[ $? -ne 0 ]] ;
then
error 'cp --recursive -- ${QP_ROOT}/scripts ${QPACKAGE_STATIC}/'
exit 1
fi
#
echo "Copying external libraries"
# --------------------------
cp --recursive -- ${QP_ROOT}/external/Python ${QPACKAGE_STATIC}/external/
mkdir ${QPACKAGE_STATIC}/external/ezfio
cp --recursive -- ${QP_ROOT}/external/ezfio/Python ${QPACKAGE_STATIC}/external/ezfio/
cp --recursive -- ${QP_ROOT}/external/ezfio/Bash ${QPACKAGE_STATIC}/external/ezfio/
cp --recursive -- ${QP_ROOT}/man/* ${QPACKAGE_STATIC}/man/
echo "Creating quantum_package.rc"
# ---------------------------
cp ${QP_ROOT}/quantum_package.rc ${QPACKAGE_STATIC}/
cp ${QP_ROOT}/etc/* ${QPACKAGE_STATIC}/etc/
cat << EOF > ${QPACKAGE_STATIC}/etc/00.qp_root.rc
export QP_ROOT="\$( cd \$(dirname \\\${BASH_SOURCE}) ; cd .. ; pwd -P )"
EOF
echo "Creating the archive"
# --------------------
tar --create --gzip --file "${QPACKAGE_STATIC}".tar.gz quantum_package_static && \
rm --recursive --force -- "${QPACKAGE_STATIC}"
if [[ $? -ne 0 ]] ; then
error 'tar --create --gzip --file "${QPACKAGE_STATIC}".tar.gz "${QPACKAGE_STATIC}" &&
rm --recursive --force -- "${QPACKAGE_STATIC}"'
exit 1
fi
echo "Done : ${QPACKAGE_STATIC}.tar.gz"

94
bin/qp_mpirun Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
function error() {
>&2 echo "$(basename $0): $@"
exit 2
}
set -e
PROG=$1
INPUT=$2
case ${PROG} in
-h|--help)
exec qp_run --help
;;
esac
NODES=($(mpirun hostname))
# Test that there is one MPI process per node
NPROC=$(echo ${NODES[@]} | tr ' ' '\n' | sort | wc -l)
NUNIQ=$(echo ${NODES[@]} | tr ' ' '\n' | sort | uniq | wc -l)
if [[ $NPROC != $NUNIQ ]] ; then
error "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error:
There are more than one process per host.
In your SLURM script file, use:
#SBATCH --nodes=$NPROC
#SBATCH --ntasks-per-node=1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"
exit -1
fi
# Check if quantum_package.rc is sourced
if [[ -z ${QP_ROOT} ]] ; then
echo "Error: quantum_package.rc is not sourced"
exit -1
fi
source ${QP_ROOT}/quantum_package.rc
# Get host names
MASTER_NODE=${NODES[0]}
SLAVE_NODES=$(echo ${NODES[@]:1}| tr ' ' ',')
if [[ $NPROC -gt 1 ]] ; then
echo "Master : $MASTER_NODE"
echo "Slaves : $SLAVE_NODES"
fi
# Check if the integrals can be read
qp set_file $INPUT
RW=$(qp get mo_two_e_ints io_mo_two_e_integrals)
if [[ $RW != Read ]] ; then
echo "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Warning:
Two-electron integrals were not saved to disk in a previous run.
If the 4-index transformation takes time, you may consider
killing this job and running
qp_run four_idx_transform $INPUT
as a single-node job before re-submitting the current job.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"
fi
rm --force -- "${INPUT}"/work/qp_run_address
set -x
mpiexec.hydra -n 1 -hosts "$MASTER_NODE" qp_run $PROG $INPUT &
if [[ $NPROC -gt 1 ]] ; then
while [[ ! -f $INPUT/work/qp_run_address ]] ; do
sleep 1
done
sleep 10
echo "Starting slaves"
mpiexec.hydra -n $((${SLURM_NTASKS}-1)) -hosts "$SLAVE_NODES" \
qp_run --slave="$PROG" $INPUT > $INPUT.slaves.out
fi
wait

104
bin/qp_name Executable file
View File

@ -0,0 +1,104 @@
#!/usr/bin/env python2
"""
Displays the names of all the files in which the provider/subroutine/function
given as argument is used. With the -r flag, the name can be changed in the
whole quantum package.
Usage:
qp_name <name> [-r <new_name> | --rename=<new_name>]
Options:
-h Prints the help message
-r <new_name> --rename=<new_name> Renames the provider /
subroutine / function and all
its occurences
Note:
It is safe to create a commit before renaming a provider, and then to
check what has changed using git diff.
"""
import re
import sys
import os
try:
from docopt import docopt
from qp_path import QP_SRC, QP_ROOT
except ImportError:
print "source .quantum_package.rc"
raise
def main(arguments):
"""Main function"""
# Check that name exist in */IRPF90_man
print "Checking that name exists..."
all_modules = os.listdir(QP_SRC)
f = arguments["<name>"]+".l"
found = False
for mod in all_modules:
if os.path.isdir(os.path.join(QP_SRC, mod, "IRPF90_man")):
for filename in os.listdir(os.path.join(QP_SRC, mod, "IRPF90_man")):
if filename == f:
found = True
break
if found: break
if not found:
print "Error:"
print "The variable/subroutine/function \""+arguments["<name>"] \
+ "\" was not found in the sources."
print "Did you compile the code at the root?"
print "Continue? [y/N] ",
cont = sys.stdin.read(1).strip() in ["y", "Y"]
if not cont:
print "Aborted"
sys.exit(1)
# Now search in all the files
if arguments["--rename"]:
print "Replacing..."
else:
print "Searching..."
name = re.compile(r"\b"+arguments["<name>"]+r"\b", re.IGNORECASE)
for mod in all_modules:
dirname = os.path.join(QP_SRC, mod)
if not os.path.isdir(dirname):
continue
for filename in os.listdir(dirname):
if "." not in filename:
continue
filename = os.path.join(dirname, filename)
if not os.path.isfile(filename):
continue
with open(filename, "r") as f:
f_in = f.read()
if name.search(f_in):
print filename
if arguments["--rename"]:
f_new = name.sub(arguments["--rename"], f_in)
with open(filename, "w") as f:
f.write(f_new)
print "Done"
with open(os.path.join(QP_ROOT, "REPLACE"), 'a') as f:
print >>f, "qp_name "+" ".join(sys.argv[1:])
if __name__ == '__main__':
ARGS = docopt(__doc__)
main(ARGS)

306
bin/qp_plugins Executable file
View File

@ -0,0 +1,306 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage:
qp_plugins list [-iuq]
qp_plugins download <url>
qp_plugins install <name>...
qp_plugins uninstall <name>
qp_plugins create -n <name> [-r <repo>] [<needed_modules>...]
Options:
list List
-i --installed only the installed plugins
-u --uninstalled only the uninstalled plugins
-q --repositories the external repositories
download <url> Download an external repository.
The URL points to a tar.gz file or a git repository:
http://example.com/site/example.tar.gz
git@gitlab.com:user/example_repository
install Install a plugin
uninstall Uninstall a plugin
create
-n --name=<name> Create a new plugin named <name>
-r --repository=<repo> Name of the repository in which to create the plugin
"""
import sys
import os
import subprocess
try:
from docopt import docopt
from module_handler import ModuleHandler, get_dict_child
from module_handler import get_l_module_descendant
from qp_path import QP_SRC, QP_PLUGINS, QP_DATA, QP_ROOT
except ImportError:
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc"
print "(`source ${QP_ROOT}/quantum_package.rc`)"
print sys.exit(1)
def save_new_module(path, l_child):
"""Creates a new module"""
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# N E E D E D _ C H I L D R E N _ M O D U L E S #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
try:
os.makedirs(path)
except OSError:
print "The module ({0}) already exists...".format(path)
sys.exit(1)
with open(os.path.join(path, "NEED"), "w") as f:
f.write(" ".join(l_child))
f.write("\n")
# ~#~#~#~#~#~#~ #
# R E A D _ M E #
# ~#~#~#~#~#~#~ #
module_name = os.path.basename(path)
header = "{0}\n{1}\n{0}\n".format("=" * len(module_name), module_name)
with open(os.path.join(path, "README.rst"), "w") as f:
f.write(header + "\n")
with open(os.path.join(path, ".gitignore"), "w") as f:
with open(os.path.join(QP_DATA, "module_gitignore"), "r") as g:
data = g.read()
f.write(data)
with open(os.path.join(path, "%s.irp.f"%(module_name)), "w") as f:
f.write("program {0}".format(module_name))
f.write("""
implicit none
BEGIN_DOC
! TODO : Put the documentation of the program here
END_DOC
print *, 'Hello world'
end
""")
def main(arguments):
"""Main function"""
arguments["<name>"] = [os.path.normpath(name) for name in arguments["<name>"]]
if arguments["list"]:
if arguments["--repositories"]:
l_result = [f for f in os.listdir(QP_PLUGINS) \
if f not in [".gitignore", "local"] ]
for repo in sorted(l_result):
print repo
else:
# Search in QP_PLUGINS all directories with a NEED file
l_tmp = [dirname for (dirname, _, filenames) in \
os.walk(QP_PLUGINS, followlinks=False) \
for f in filenames if f == 'NEED' and \
"IRPF90_temp" not in dirname]
# Find directories which contain modules
l_tmp = [os.path.split(f) for f in l_tmp]
d_tmp = {}
repo_of_plugin = {}
for (x, y) in l_tmp:
d_tmp[x] = y
repo_of_plugin[y] = x.replace(QP_PLUGINS+'/','')
l_repository = d_tmp.keys()
m_instance = ModuleHandler(l_repository)
l_plugins = [module for module in m_instance.l_module]
l_result = l_plugins
if arguments["--installed"] or arguments["--uninstalled"]:
# Search in src all symbolic links that are modules
l_installed = [f for f in os.listdir(QP_SRC) \
if (os.path.islink(os.path.join(QP_SRC, f)) \
and f != ".gitignore")]
if arguments["--installed"]:
l_result = [f for f in l_plugins if f in l_installed]
elif arguments["--uninstalled"]:
l_result = [f for f in l_plugins if f not in l_installed]
for module in sorted(l_result):
print "%-30s %-30s"%(module, repo_of_plugin[module])
if arguments["create"]:
m_instance = ModuleHandler([QP_SRC])
l_children = arguments["<needed_modules>"]
name = arguments["--name"]
if arguments["--repository"]:
repository = arguments["--repository"]
else:
repository = "local"
path = os.path.join(QP_PLUGINS, repository, name)
print "Created plugin:"
print path, '\n'
for children in l_children:
if children not in m_instance.dict_descendant:
print "Error: {0} is not a valid module.".format(children)
sys.exit(1)
print "Needed modules:"
print l_children, '\n'
print "This corresponds to using the following modules:"
print l_children + m_instance.l_descendant_unique(l_children), '\n'
print "Which is reduced to:"
l_child_reduce = m_instance.l_reduce_tree(l_children)
print l_child_reduce, '\n'
print "Installation",
save_new_module(path, l_child_reduce)
print " [ OK ]"
print ""
arguments["create"] = False
arguments["install"] = True
main(arguments)
elif arguments["download"]:
url = arguments["<url>"]
is_repo = not(url.endswith(".tar.gz") or \
url.endswith(".tgz") or \
url.endswith(".zip"))
os.chdir(QP_PLUGINS)
if is_repo:
subprocess.check_call(["git", "clo