10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00

Merge branch 'LCPQ-master'

This commit is contained in:
Anthony Scemama 2016-01-26 15:08:24 +01:00
commit e2836ee5e0
10 changed files with 115 additions and 157 deletions

View File

@ -9,10 +9,11 @@ Quantum package
Set of quantum chemistry programs and libraries.
(under GNU GENERAL PUBLIC LICENSE v2)
For more information, you can visit the [wiki of the project](http://github.com/LCPQ/quantum_package/wiki>), or bellow for the installation instruction.
For more information, you can visit the [wiki of the project](http://github.com/LCPQ/quantum_package/wiki>), or below for the installation instructions.
# Installation
## Requirements
* Fortran compiler (`ifort` and `gfortran` are tested)
* Python >= 2.6
@ -30,29 +31,30 @@ For more information, you can visit the [wiki of the project](http://github.com/
For example you can type `./configure config/gfortran.cfg --production`
This command have to purpose :
This command has two purposes :
- Download and install all the requirements.
Installing OCaml and the Core library may take some time (up to 20min on an old machine).
- And create the file which contains all the tree dependencies for the binaries.
- Create the file which contains all the dependencies for the binaries.
It's not a Makefile, but a Ninja file (so don't type `make` is hopeless, type `ninja` instead)
####Compilation Flags (`<config_file>`)
`<config_file>` is the path to the file who contain all the flags useful for the compilation: like the optimization flags, the Lapack libary, etc. We have two default configure file in ``$QP_ROOT/config`` : ``ifort.cfg`` and ``gfortran.cfg``. You can edit these files to modify the compiling options.
`<config_file>` is the path to the file which contains all the compilation flags (optimization flags, Lapack libary, etc). There are two example configure files in ``$QP_ROOT/config`` : ``ifort.cfg`` and ``gfortran.cfg``. You can copy these files to create a new file adapted to your architecture.
#### What utilization of the code will you do?
* If you only want the binaries (for production workflow) use the flag
`--production` in when calling this script. It's quicker
* Else if you are a developer and you want to be able to compile specific modules use: `--development`. It will create for you the `build.ninja` in each module
`--production`. It compiles faster.
* Else if you are a developer and you want to be able to compile specific modules use: `--development`. It will create the `build.ninja` in each module.
### 2) Set environment variable
### 2) Load environment variables
source quantum_package.rc
This file contains all the environment variables needed by the quantum package both to compile and run. This should also be done before running calculations.
### Optional) Add some new module
### Optional) Add some modules
Usage: qp_module.py list (--installed|--avalaible-local|--avalaible-remote)
qp_module.py install <name>...
@ -62,61 +64,22 @@ This file contains all the environment variables needed by the quantum package b
For exemple you can type :
`qp_module.py install Full_CI`
### 3) Compiling the fortran
### 3) Compiling the Fortran
Just type `ninja` if you are in `$QP_ROOT` (or `ninja -f $QP_ROOT/build.ninja` elsewhere). The compilation will take approximately 3 min.
If you have set the `--developement` flag in a specific module you can go in
the corresponding module directory and run `ninja` to build only this module.
You can type `ninja all` in a module for compiling all the submodule
If you have set the `--developement` flag you can go in any module directory and run `ninja` to build only this particular module. You can type `ninja all` in a module to compile all the submodules.
### 4) Compiling the OCaml
cd ocaml ; make ; cd -
make -C ocaml
### 5) Testing if all is ok
cd testing_no_regression ; ./unit_test.py
cd tests ; bats bats/qp.bats
## Installing behind a firewall !
1) Download `tsocks`:
wget http://sourceforge.net/projects/tsocks/files/latest/download
mv download tsocks.tar.gz
2) Tranfer `tsocks.tar.gz` on the remote host
3) Configure `tsocks` with the proper directory for the `tsocks.conf` file:
tar -zxvf tsocks.tar.gz
cd tsocks-*
./configure --with-conf=${PWD}/tsocks.conf
4) Create the `tsocks.conf` file with the following content:
server = 127.0.0.1
server_port = 10000
5) Create the tsocks library:
make
6) Add the `libtsocks.so` to the `LD_PRELOAD` environment variable:
export LD_PRELOAD="${PWD}/libtsocks.so.1.8"
7) Create a custom curl command to set the tsocks option: open a file named
`curl`, which is accessible from your `PATH` environment variable before the
real `curl` command, and fill this file with:
#!/bin/bash
/usr/bin/curl --socks5 127.0.0.1:10000 $@
8) Start a tsocks ssh tunnel:
ssh -fN -D 10000 user@external-server.com
# Note on EZFIO.cfg
@ -126,24 +89,24 @@ You can type `ninja all` in a module for compiling all the submodule
Required:
[<provider_name>] The name of the provider in irp.f90 and in the EZFIO lib
doc:<str> The plain text documentation
type:<str> A Fancy_type supported by the ocaml.
type:<str> A type supported by the OCaml.
type `ei_handler.py get_supported_type` for a list
interface:<str> The interface is list of string sepeared by "," who can containt :
- ezfio (if you only whant the ezfiolib)
- provider (if you want the provider)
- ocaml (if you want the ocaml gestion)
interface:<str> The interface is a list of strings sepeared by "," which can contain :
- ezfio : to build the EZFIO API
- provider : to build the corresponding providers
- ocaml : to build the corresponding bindings in OCaml
Optional:
default: <str> The default value needed,
if 'ocaml' is in interface list.
default: <str> The default value,
needed if 'ocaml' is in interface list.
! No list is allowed for now !
size: <str> The size information.
(by default is one)
Example : 1, =sum(ao_num); (ao_num,3)
ATTENTION : The module and the value are separed by a "." not a "_".
For exemple (determinants.n_det)
ezfio_name: <str> The name for the EZFIO lib
Example : 1; =sum(ao_num); (ao_num,3)
WARNING : The module and the value are separed by a "." not a "_".
For example (determinants.n_det)
ezfio_name: <str> The name in the EZFIO API
(by default is <provider_name>)
ezfio_dir: <str> Will be the folder of EZFIO.
ezfio_dir: <str> Will be the directory of EZFIO.
(by default is <module_lower>)
```
@ -169,7 +132,7 @@ interface: ezfio
#### Why ?
You have two or more ezfio configuration file for the same variable. Check in `$QP_ROOT/install/config/`
You have two or more ezfio configuration files for the same variable. Check files in `$QP_ROOT/install/EZFIO/config/`
#### Fix

View File

@ -4,3 +4,6 @@ Data
This directory contains all the data files needed for the Quantum Package.
The `basis` directory contains some of the most popular basis sets, and the
`pseudo` directory contains pseudopotential data.

View File

@ -1,36 +0,0 @@
1 H Hydrogen
2 He Helium
3 Li Lithium
4 Be Beryllium
5 B Boron
6 C Carbon
7 N Nitrogen
8 O Oxygen
9 F Fluorine
10 Ne Neon
11 Na Sodium
12 Mg Magnesium
13 Al Aluminum
14 Si Silicon
15 P Phosphorus
16 S Sulfur
17 Cl Chlorine
18 Ar Argon
19 K Potassium
20 Ca Calcium
21 Sc Scandium
22 Ti Titanium
23 V Vanadium
24 Cr Chromium
25 Mn Manganese
26 Fe Iron
27 Co Cobalt
28 Ni Nickel
29 Cu Copper
30 Zn Zinc
31 Ga Gallium
32 Ge Germanium
33 As Arsenic
34 Se Selenium
35 Br Bromine
36 Kr Krypton

View File

@ -77,3 +77,4 @@ NCPUs=$(cat /proc/cpuinfo | grep -i MHz | wc -l)
${QP_ROOT}/bin/opam install -j ${NCPUs} ${PACKAGES} -y -q || exit 1
rm -f ../_build/ocaml.log

View File

@ -1,7 +1,7 @@
open Core.Std
open Qptypes
let () =
let basis ()=
let ezfio_filename =
Sys.argv.(1)
in
@ -14,7 +14,26 @@ let () =
| _ -> failwith "Error reading basis set"
in
Input.Ao_basis.to_rst basis
|> Rst_string.to_string
|> print_endline
|> Rst_string.to_string
|> print_endline
let mo ()=
let ezfio_filename =
Sys.argv.(1)
in
if (not (Sys.file_exists_exn ezfio_filename)) then
failwith "Error reading EZFIO file";
Ezfio.set_file ezfio_filename;
let mo_coef =
match Input.Mo_basis.read () with
| Some mo_coef -> mo_coef
| _ -> failwith "Error reading the mo set"
in
Input.Mo_basis.to_rst mo_coef
|> Rst_string.to_string
|> print_endline
basis ();;
mo ();;

View File

@ -17,11 +17,7 @@ if do_pseudo:
else:
print "do_pseudo False"
try:
n_det =ezfio.get_determinants_n_det()
except IOError:
n_det = 1
n_det =ezfio.get_determinants_n_det()
if n_det == 1:
print "multi_det False"
else:
@ -52,7 +48,7 @@ print "Atomic coord in Bohr"
for i,t in enumerate(zip(l_label,l_charge,l_coord_str)):
try :
l = (t[0],t[1]+zcore[i],t[2])
l = (t[0],t[1]+zcore[i],t[1])
except NameError:
l = t
print " ".join(map(str,l))
@ -197,11 +193,11 @@ if do_pseudo:
l_str.append(l_dump)
str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE {2} AND LMAX {3} ARE"
print str_.format(a,i+1,int(zcore[i]),int(len(l_str)-1))
print str_.format(a,i+1,zcore[i],len(l_str))
for i, l in enumerate(l_str):
str_ = "FOR L= {0} COEFF N ZETA"
print str_.format(int(len(l_str)-i-1))
print str_.format(len(l_str)-i-1)
for ii, ll in enumerate(l):
print " ",ii+1, ll
@ -233,4 +229,4 @@ for c, (l_det_bit_alpha, l_det_bit_beta) in zip(psi_coef,psi_det):
print bin_det
print ""
print "END_DET"
print "END_DET"

View File

@ -46,15 +46,4 @@ then
exit 1
fi
pseudo="$1"
shift
if [[ -z $pseudo ]]
then
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --treat_l --save --path="${tmpfile}" --basis="${basis}"
else
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --save --path="${tmpfile}" --basis="${basis}" --db_path="${EMSL_API_ROOT}/db/Pseudo.db"
# echo ${EMSL_API_ROOT}/EMSL_api.py get_basis_data --save --path="${tmpfile}" --basis="${basis}" --db_path="${EMSL_API_ROOT}/db/Pseudo.db" 1>&2
# echo $PWD/BASIS
fi
${EMSL_API_ROOT}/EMSL_api.py get_basis_data --treat_l --save --path="${tmpfile}" --basis="${basis}"

View File

@ -4,7 +4,7 @@
Create the pseudo potential for a given atom
Usage:
put_pseudo_in_ezfio.py <ezfio_path>
put_pseudo_in_ezfio.py <ezfio_path> <pseudo_name> [<db_dump_path>]
Help:
atom is the Abreviation of the atom
@ -28,7 +28,7 @@ import re
p = re.compile(ur'\|(\d+)><\d+\|')
def get_pseudo_str(l_atom):
def get_pseudo_str(db_dump_path,pseudo_name,l_atom):
"""
Run EMSL_local for getting the str of the pseudo potential
@ -53,7 +53,6 @@ def get_pseudo_str(l_atom):
EMSL_root = "{0}/install/emsl/".format(qpackage_root)
EMSL_path = "{0}/EMSL_api.py".format(EMSL_root)
db_path = "{0}/db/Pseudo.db".format(EMSL_root)
str_ = ""
@ -63,8 +62,8 @@ def get_pseudo_str(l_atom):
l_cmd_atom = ["--atom", a]
l_cmd_head = [EMSL_path, "get_basis_data",
"--db_path", db_path,
"--basis", "BFD-Pseudo"]
"--db_dump_path", db_dump_path,
"--basis", pseudo_name]
process = Popen(l_cmd_head + l_cmd_atom, stdout=PIPE, stderr=PIPE)
@ -180,19 +179,22 @@ def get_zeff_alpha_beta(str_ele):
#
from elts_num_ele import name_to_elec
from math import ceil, floor
z = name_to_elec[name]
z_eff = z - z_remove
alpha = (z_remove / 2)
beta = (z_remove / 2)
alpha = int(ceil(z_remove / 2.))
beta = int(floor(z_remove / 2.))
# Remove more alpha, than beta
# _
# |_) _ _|_ ._ ._
# | \ (/_ |_ |_| | | |
#
return [z_eff, alpha, beta]
return [z_remove, z_eff, alpha, beta]
def add_zero(array, size, type):
@ -224,6 +226,12 @@ def make_it_square(matrix, dim, type=float):
return matrix
def full_path(path):
path = os.path.expanduser(path)
path = os.path.expandvars(path)
path = os.path.abspath(path)
return path
if __name__ == "__main__":
arguments = docopt(__doc__)
# ___
@ -235,19 +243,22 @@ if __name__ == "__main__":
# E Z F I O #
# ~#~#~#~#~ #
ezfio_path = arguments["<ezfio_path>"]
ezfio_path = os.path.expanduser(ezfio_path)
ezfio_path = os.path.expandvars(ezfio_path)
ezfio_path = os.path.abspath(ezfio_path)
ezfio_path = full_path(arguments["<ezfio_path>"])
ezfio.set_file("{0}".format(ezfio_path))
# ~#~#~#~#~#~#~#~#~#~#~ #
# P s e u d o _ d a t a #
# ~#~#~#~#~#~#~#~#~#~#~ #
if arguments["<db_dump_path>"]:
db_dump_path = full_path(arguments["<db_dump_path>"])
else:
db_dump_path= full_path("{0}/data/BFD-Pseudo.dump".format(qpackage_root))
pseudo_name = arguments["<pseudo_name>"]
l_ele = ezfio.get_nuclei_nucl_label()
str_ = get_pseudo_str(l_ele)
str_ = get_pseudo_str(db_dump_path,pseudo_name,l_ele)
# _
# |_) _. ._ _ _
@ -257,7 +268,7 @@ if __name__ == "__main__":
l_str_ele = [str_ele for str_ele in str_.split("Element Symbol: ")
if str_ele]
for i in "l_zeff v_k n_k dz_k v_kl n_kl dz_kl".split():
for i in "l_zeff l_remove v_k n_k dz_k v_kl n_kl dz_kl".split():
exec("{0} = []".format(i))
alpha_tot = 0
@ -296,11 +307,13 @@ if __name__ == "__main__":
# Z _ e f f , a l p h a / b e t a _ e l e c #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
zeff, alpha, beta = get_zeff_alpha_beta(str_ele)
zremove, zeff, alpha, beta = get_zeff_alpha_beta(str_ele)
alpha_tot += alpha
beta_tot += beta
l_zeff.append(zeff)
l_remove.append(zremove)
# _
# /\ _| _| _|_ _ _ _ _|_ o _
# /--\ (_| (_| |_ (_) (/_ /_ | | (_)
@ -311,6 +324,7 @@ if __name__ == "__main__":
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
ezfio.nuclei_nucl_charge = l_zeff
ezfio.pseudo_nucl_charge_remove = l_remove
alpha_tot = ezfio.get_electrons_elec_alpha_num() - alpha_tot
beta_tot = ezfio.get_electrons_elec_beta_num() - beta_tot

View File

@ -1,3 +1,10 @@
[nucl_charge_remove]
doc: Nuclear charges removed
type:double precision
size: (nuclei.nucl_num)
interface: ezfio, provider
[pseudo_klocmax]
doc: test
type:integer

View File

@ -1,5 +1,9 @@
#!/usr/bin/env bats
#
# |\/| o _ _
# | | | _> (_
#
# floating point number comparison
# Compare two numbers ($1, $2) with a given precision ($3)
# If the numbers are not equal, the exit code is 1 else it is 0
@ -19,8 +23,13 @@ function eq() {
fi
}
#: "${QP_ROOT?Please source your quantum_package.rc}"
# ___
# | ._ o _|_
# _|_ | | | |_
#
source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh
TEST_DIR=${QP_ROOT}/tests/work/
@ -45,8 +54,6 @@ function test_exe() {
fi
}
function run_HF() {
thresh=1.e-8
test_exe SCF || skip
@ -72,8 +79,12 @@ function run_FCI() {
eq $energy_pt2 $4 $thresh
}
# ================== TESTS =======================
# ___
# | _ _ _|_
# | (/_ _> |_
#
#=== HBO
@test "init HBO STO-3G" {
run_init HBO.xyz "-b STO-3G" hbo.ezfio
}
@ -83,9 +94,7 @@ function run_FCI() {
}
#=== H2O
@test "init H2O cc-pVDZ" {
run_init h2o.xyz "-b cc-pvdz" h2o.ezfio
}
@ -123,9 +132,7 @@ function run_FCI() {
}
#=== H2O Pseudo
@test "init H2O VDZ pseudo" {
run_init h2o.xyz "-p bfd -b vdz-bfd" h2o_pseudo.ezfio
}
@ -138,10 +145,7 @@ function run_FCI() {
run_FCI h2o_pseudo.ezfio 2000 -17.1593409053142 -17.1699581090466
}
#=== Convert
@test "gamess convert HBO.out" {
cp ${QP_ROOT}/tests/input/HBO.out .
qp_convert_output_to_ezfio.py HBO.out
@ -163,8 +167,6 @@ function run_FCI() {
}
# TODO N_int = 1,2,3,4,5
# TODO mod(64) MOs
# TODO All G2 SCF energies