10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-09-27 03:51:01 +02:00

Added many test files

This commit is contained in:
Anthony Scemama 2018-12-28 16:09:36 +01:00
parent 55eb3a8301
commit 3974f18dcd
27 changed files with 244 additions and 32 deletions

View File

@ -39,7 +39,7 @@ 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_ROOT
from qp_path import QP_SRC, QP_PLUGINS, QP_ROOT, QP_DATA
except ImportError:
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc"
print "(`source ${QP_ROOT}/quantum_package.rc`)"
@ -73,6 +73,11 @@ def save_new_module(path, l_child):
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("""

View File

@ -10,8 +10,9 @@ except:
print "source quantum_package.rc"
sys.exit(1)
else:
QP_SRC = os.path.join(QP_ROOT, "src")
QP_EZFIO = os.environ["QP_EZFIO"]
QP_SRC = os.path.join(QP_ROOT, "src")
QP_PLUGINS = os.path.join(QP_ROOT, "plugins")
QP_EZFIO = os.environ["QP_EZFIO"]
QP_OCAML = os.path.join(QP_ROOT, "ocaml")
QP_TESTS = os.path.join(QP_ROOT, "tests")
QP_OCAML = os.path.join(QP_ROOT, "ocaml")
QP_TESTS = os.path.join(QP_ROOT, "tests")
QP_DATA = os.path.join(QP_ROOT, "data")

View File

@ -0,0 +1,108 @@
#!/usr/bin/env bats
source $QP_ROOT/tests/bats/common.bats.sh
function run {
INPUT=$1
EZ=${INPUT/.xyz/.ezfio}
MULT=$2
CHARGE=$3
BASIS=$4
if [[ -n $5 ]] ; then
PSEUDO="-p $5"
fi
cp ${QP_ROOT}/tests/input/$INPUT .
rm -rf $EZ
qp_create_ezfio_from_xyz $INPUT -b "$BASIS" -m $MULT -c $CHARGE $PSEUDO -o $EZ
qp_edit -c $EZ
}
@test "qp_create c2h2.xyz" {
run c2h2.xyz 1 0 vdz-bfd bfd
}
@test "qp_create clo.xyz" {
run clo.xyz 2 0 cc-pvdz
}
@test "qp_create dhno.xyz" {
run dhno.xyz 2 0 chipman-dzp
}
@test "qp_create h3coh.xyz" {
run h3coh.xyz 1 0 6-31g
}
@test "qp_create hcn.xyz" {
run hcn.xyz 1 0 aug-cc-pvdz
}
@test "qp_create n2.xyz" {
run n2.xyz 1 0 cc-pvtz
}
@test "qp_create sih2_3b1.xyz" {
run sih2_3b1.xyz 1 0 6-31g
}
@test "qp_create so.xyz" {
run so.xyz 3 0 vdz-bfd bfd
}
@test "qp_create ch4.xyz" {
run ch4.xyz 1 0 aug-cc-pvtz
}
@test "qp_create co2.xyz" {
run co2.xyz 1 0 cc-pvdz
}
@test "qp_create f2.xyz" {
run f2.xyz 1 0 "Def2-TZVP"
}
@test "qp_create h2o.xyz" {
run h2o.xyz 1 0 cc-pvdz
}
@test "qp_create hco.xyz" {
run hco.xyz 2 0 "Ahlrichs VDZ"
}
@test "qp_create nh3.xyz" {
run nh3.xyz 1 0 cc-pvdz
}
@test "qp_create sih3.xyz" {
run sih3.xyz 2 0 vdz-bfd bfd
}
@test "qp_create clf.xyz" {
run clf.xyz 1 0 cc-pvdz
}
@test "qp_create h2o2.xyz" {
run h2o2.xyz 1 0 cc-pvdz
}
@test "qp_create h2s.xyz" {
run h2s.xyz 1 0 cc-pvdz
}
@test "qp_create hbo.xyz" {
run hbo.xyz 1 0 cc-pvtz
}
@test "qp_create n2h4.xyz" {
run n2h4.xyz 1 0 cc-pvdz
}
@test "qp_create oh.xyz" {
run oh.xyz 2 0 "Roos Augmented Double Zeta ANO"
}
@test "qp_create so2.xyz" {
run so2.xyz 1 0 vtz-bfd bfd
}

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bats
source $QP_ROOT/tests/bats/common.bats.sh
function run {
INPUT=$1
EZ=${INPUT}.ezfio
cp ${QP_ROOT}/tests/input/$INPUT .
qp_convert_output_to_ezfio $INPUT
qp_edit -c $EZ
}
#=== Convert
@test "gamess convert hbo.gms.out" {
run hbo.gms.out
}
@test "g09 convert h2o.log" {
run h2o.log
}
@test "gamess convert cu_nh3_4_2plus.gms.out" {
run cu_nh3_4_2plus.gms.out
}

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bats
source $QP_ROOT/tests/bats/common.bats.sh
#=== Convert
@test "gamess convert HBO.out" {
cp ${QP_ROOT}/tests/input/HBO.out .
qp_convert_output_to_ezfio HBO.out
qp_edit -c HBO.out.ezfio
ezfio set_file HBO.out.ezfio
qp_run scf HBO.out.ezfio
# Check energy
energy="$(ezfio get hartree_fock energy)"
eq $energy -100.0185822590964 1.e-10
}
@test "g09 convert H2O.log" {
cp ${QP_ROOT}/tests/input/h2o.log .
qp_convert_output_to_ezfio h2o.log
qp_edit -c h2o.log.ezfio
ezfio set_file h2o.log.ezfio
qp_run scf h2o.log.ezfio
# Check energy
energy="$(ezfio get hartree_fock energy)"
eq $energy -76.0270218704265 1E-10
}

6
tests/input/c2h2.xyz Normal file
View File

@ -0,0 +1,6 @@
4
C2H2 Geo: Experiment Mult: 1 symmetry: 14
C 0.0 0.0 0.6013
C 0.0 0.0 -0.6013
H 0.0 0.0 1.6644
H 0.0 0.0 -1.6644

7
tests/input/ch4.xyz Normal file
View File

@ -0,0 +1,7 @@
5
CH4 Geo: Experiment Mult: 1 symmetry: 10
C 0.0 0.0 0.0
H 0.6276 0.6276 0.6276
H 0.6276 -0.6276 -0.6276
H -0.6276 0.6276 -0.6276
H -0.6276 -0.6276 0.6276

4
tests/input/clf.xyz Normal file
View File

@ -0,0 +1,4 @@
2
ClF Geo: Experiment Mult: 1 symmetry: 26
Cl 0.0 0.0 1.6283
F 0.0 0.0 0.0

4
tests/input/clo.xyz Normal file
View File

@ -0,0 +1,4 @@
2
ClO Geo: Experiment Mult: 2 symmetry: 25
Cl 0.0 0.0 1.5696
O 0.0 0.0 0.0

5
tests/input/co2.xyz Normal file
View File

@ -0,0 +1,5 @@
3
CO2 Geo: Experiment Mult: 1 symmetry: 22
C 0.0 0.0 0.0
O 0.0 0.0 1.1621
O 0.0 0.0 -1.1621

4
tests/input/f2.xyz Normal file
View File

@ -0,0 +1,4 @@
2
F2 Geo: Experiment Mult: 1 symmetry: 18
F 0.0 0.0 0.0
F 0.0 0.0 1.4119

6
tests/input/h2o2.xyz Normal file
View File

@ -0,0 +1,6 @@
4
H2O2 Geo: Experiment Mult: 1 symmetry: 18
H 0.819 0.817 0.422
H -0.819 -0.817 0.422
O 0.0 0.7375 -0.0528
O 0.0 -0.7375 -0.0528

5
tests/input/h2s.xyz Normal file
View File

@ -0,0 +1,5 @@
3
H2S Geo: Experiment Mult: 1 symmetry: 18
H 0.0 0.9569 0.9208
H 0.0 -0.9569 0.9208
S 0.0 0.0 0.0

8
tests/input/h3coh.xyz Normal file
View File

@ -0,0 +1,8 @@
6
H3COH Geo: Experiment Mult: 1 symmetry: 18
C -0.0503 0.6685 0.0
H -1.0807 1.0417 0.0
H 0.465 1.0417 0.8924
H 0.465 1.0417 -0.8924
H 0.8544 -1.0677 0.0
O -0.0503 -0.7585 0.0

5
tests/input/hcn.xyz Normal file
View File

@ -0,0 +1,5 @@
3
HCN Geo: Experiment Mult: 1 symmetry: 14
C 0.0 0.0 0.0
H 0.0 0.0 1.064
N 0.0 0.0 -1.156

5
tests/input/hco.xyz Normal file
View File

@ -0,0 +1,5 @@
3
HCO Geo: Experiment Mult: 2 symmetry: 15
C 0.0 0.0 0.0
H 1.08 0.0 0.0
O -0.5899 1.0427 0.0

4
tests/input/n2.xyz Normal file
View File

@ -0,0 +1,4 @@
2
N2 Geo: Experiment Mult: 1 symmetry: 14
N 0.0 0.0 0.5488
N 0.0 0.0 -0.5488

8
tests/input/n2h4.xyz Normal file
View File

@ -0,0 +1,8 @@
6
N2H4 Geo: Experiment Mult: 1 symmetry: 18
H -0.447 1.0031 0.7562
H 0.447 -1.0031 0.7562
H 0.9663 1.0031 0.0301
H -0.9663 -1.0031 0.0301
N 0.0 0.723 -0.1123
N 0.0 -0.723 -0.1123

6
tests/input/nh3.xyz Normal file
View File

@ -0,0 +1,6 @@
4
NH3 Geo: Experiment Mult: 1 symmetry: 10
H 0.0 -0.9377 -0.3816
H 0.8121 0.4689 -0.3816
H -0.8121 0.4689 -0.3816
N 0.0 0.0 0.0

4
tests/input/oh.xyz Normal file
View File

@ -0,0 +1,4 @@
2
OH Geo: Experiment Mult: 2 symmetry: 9
H 0.0 0.0 0.9697
O 0.0 0.0 0.0

5
tests/input/sih2_3b1.xyz Normal file
View File

@ -0,0 +1,5 @@
3
SiH2_3B1 Geo: Experiment Mult: 3 symmetry: 16
H 0.0 1.273174 -0.665412
H 0.0 -1.273174 -0.665412
Si 0.0 0.0 0.095059

6
tests/input/sih3.xyz Normal file
View File

@ -0,0 +1,6 @@
4
SiH3 Geo: Experiment Mult: 2 symmetry: 17
H 0.0 1.3928 -0.382
H 1.2062 -0.6964 -0.382
H -1.2062 -0.6964 -0.382
Si 0.0 0.0 0.0819

4
tests/input/so.xyz Normal file
View File

@ -0,0 +1,4 @@
2
SO Geo: Experiment Mult: 3 symmetry: 24
O 0.0 0.0 1.4811
S 0.0 0.0 0.0

5
tests/input/so2.xyz Normal file
View File

@ -0,0 +1,5 @@
3
SO2 Geo: Experiment Mult: 1 symmetry: 32
O 0.0 1.2371 0.7215
O 0.0 -1.2371 0.7215
S 0.0 0.0 0.0