From 3974f18dcd7963d1bc9622b7edc9a164aacf84c8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 28 Dec 2018 16:09:36 +0100 Subject: [PATCH] Added many test files --- scripts/qp_plugins | 7 +- scripts/utility/qp_path.py | 9 +- src/ezfio_files/00.create.bats | 108 ++++++++++++++++++ src/ezfio_files/01.convert.bats | 24 ++++ src/ezfio_files/10.convert.bats | 27 ----- tests/input/c2h2.xyz | 6 + tests/input/ch4.xyz | 7 ++ tests/input/clf.xyz | 4 + tests/input/clo.xyz | 4 + tests/input/co2.xyz | 5 + ...ROHF_b2.gms.out => cu_nh3_4_2plus.gms.out} | 0 tests/input/f2.xyz | 4 + tests/input/h2o2.xyz | 6 + tests/input/h2s.xyz | 5 + tests/input/h3coh.xyz | 8 ++ tests/input/{HBO.out => hbo.gms.out} | 0 tests/input/{HBO.xyz => hbo.xyz} | 0 tests/input/hcn.xyz | 5 + tests/input/hco.xyz | 5 + tests/input/n2.xyz | 4 + tests/input/n2h4.xyz | 8 ++ tests/input/nh3.xyz | 6 + tests/input/oh.xyz | 4 + tests/input/sih2_3b1.xyz | 5 + tests/input/sih3.xyz | 6 + tests/input/so.xyz | 4 + tests/input/so2.xyz | 5 + 27 files changed, 244 insertions(+), 32 deletions(-) create mode 100644 src/ezfio_files/00.create.bats create mode 100644 src/ezfio_files/01.convert.bats delete mode 100644 src/ezfio_files/10.convert.bats create mode 100644 tests/input/c2h2.xyz create mode 100644 tests/input/ch4.xyz create mode 100644 tests/input/clf.xyz create mode 100644 tests/input/clo.xyz create mode 100644 tests/input/co2.xyz rename tests/input/{ROHF_b2.gms.out => cu_nh3_4_2plus.gms.out} (100%) create mode 100644 tests/input/f2.xyz create mode 100644 tests/input/h2o2.xyz create mode 100644 tests/input/h2s.xyz create mode 100644 tests/input/h3coh.xyz rename tests/input/{HBO.out => hbo.gms.out} (100%) rename tests/input/{HBO.xyz => hbo.xyz} (100%) create mode 100644 tests/input/hcn.xyz create mode 100644 tests/input/hco.xyz create mode 100644 tests/input/n2.xyz create mode 100644 tests/input/n2h4.xyz create mode 100644 tests/input/nh3.xyz create mode 100644 tests/input/oh.xyz create mode 100644 tests/input/sih2_3b1.xyz create mode 100644 tests/input/sih3.xyz create mode 100644 tests/input/so.xyz create mode 100644 tests/input/so2.xyz diff --git a/scripts/qp_plugins b/scripts/qp_plugins index 19a3f46f..0baf377f 100755 --- a/scripts/qp_plugins +++ b/scripts/qp_plugins @@ -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(""" diff --git a/scripts/utility/qp_path.py b/scripts/utility/qp_path.py index ac53f118..0844c06f 100644 --- a/scripts/utility/qp_path.py +++ b/scripts/utility/qp_path.py @@ -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") diff --git a/src/ezfio_files/00.create.bats b/src/ezfio_files/00.create.bats new file mode 100644 index 00000000..413591a2 --- /dev/null +++ b/src/ezfio_files/00.create.bats @@ -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 +} + diff --git a/src/ezfio_files/01.convert.bats b/src/ezfio_files/01.convert.bats new file mode 100644 index 00000000..31b4e2a2 --- /dev/null +++ b/src/ezfio_files/01.convert.bats @@ -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 +} diff --git a/src/ezfio_files/10.convert.bats b/src/ezfio_files/10.convert.bats deleted file mode 100644 index 5705f04c..00000000 --- a/src/ezfio_files/10.convert.bats +++ /dev/null @@ -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 -} - diff --git a/tests/input/c2h2.xyz b/tests/input/c2h2.xyz new file mode 100644 index 00000000..f6b8ea41 --- /dev/null +++ b/tests/input/c2h2.xyz @@ -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 diff --git a/tests/input/ch4.xyz b/tests/input/ch4.xyz new file mode 100644 index 00000000..ecd7077f --- /dev/null +++ b/tests/input/ch4.xyz @@ -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 diff --git a/tests/input/clf.xyz b/tests/input/clf.xyz new file mode 100644 index 00000000..48a26c04 --- /dev/null +++ b/tests/input/clf.xyz @@ -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 diff --git a/tests/input/clo.xyz b/tests/input/clo.xyz new file mode 100644 index 00000000..f4120493 --- /dev/null +++ b/tests/input/clo.xyz @@ -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 diff --git a/tests/input/co2.xyz b/tests/input/co2.xyz new file mode 100644 index 00000000..4f161cd4 --- /dev/null +++ b/tests/input/co2.xyz @@ -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 diff --git a/tests/input/ROHF_b2.gms.out b/tests/input/cu_nh3_4_2plus.gms.out similarity index 100% rename from tests/input/ROHF_b2.gms.out rename to tests/input/cu_nh3_4_2plus.gms.out diff --git a/tests/input/f2.xyz b/tests/input/f2.xyz new file mode 100644 index 00000000..9128ff54 --- /dev/null +++ b/tests/input/f2.xyz @@ -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 diff --git a/tests/input/h2o2.xyz b/tests/input/h2o2.xyz new file mode 100644 index 00000000..47066833 --- /dev/null +++ b/tests/input/h2o2.xyz @@ -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 diff --git a/tests/input/h2s.xyz b/tests/input/h2s.xyz new file mode 100644 index 00000000..5a7c7ca4 --- /dev/null +++ b/tests/input/h2s.xyz @@ -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 diff --git a/tests/input/h3coh.xyz b/tests/input/h3coh.xyz new file mode 100644 index 00000000..789f37a3 --- /dev/null +++ b/tests/input/h3coh.xyz @@ -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 diff --git a/tests/input/HBO.out b/tests/input/hbo.gms.out similarity index 100% rename from tests/input/HBO.out rename to tests/input/hbo.gms.out diff --git a/tests/input/HBO.xyz b/tests/input/hbo.xyz similarity index 100% rename from tests/input/HBO.xyz rename to tests/input/hbo.xyz diff --git a/tests/input/hcn.xyz b/tests/input/hcn.xyz new file mode 100644 index 00000000..5d6ab08c --- /dev/null +++ b/tests/input/hcn.xyz @@ -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 diff --git a/tests/input/hco.xyz b/tests/input/hco.xyz new file mode 100644 index 00000000..7472d5f5 --- /dev/null +++ b/tests/input/hco.xyz @@ -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 diff --git a/tests/input/n2.xyz b/tests/input/n2.xyz new file mode 100644 index 00000000..016732d8 --- /dev/null +++ b/tests/input/n2.xyz @@ -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 diff --git a/tests/input/n2h4.xyz b/tests/input/n2h4.xyz new file mode 100644 index 00000000..8dbad41c --- /dev/null +++ b/tests/input/n2h4.xyz @@ -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 diff --git a/tests/input/nh3.xyz b/tests/input/nh3.xyz new file mode 100644 index 00000000..aa9a16d0 --- /dev/null +++ b/tests/input/nh3.xyz @@ -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 diff --git a/tests/input/oh.xyz b/tests/input/oh.xyz new file mode 100644 index 00000000..86e7251b --- /dev/null +++ b/tests/input/oh.xyz @@ -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 diff --git a/tests/input/sih2_3b1.xyz b/tests/input/sih2_3b1.xyz new file mode 100644 index 00000000..4f33bd90 --- /dev/null +++ b/tests/input/sih2_3b1.xyz @@ -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 diff --git a/tests/input/sih3.xyz b/tests/input/sih3.xyz new file mode 100644 index 00000000..3f89f462 --- /dev/null +++ b/tests/input/sih3.xyz @@ -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 diff --git a/tests/input/so.xyz b/tests/input/so.xyz new file mode 100644 index 00000000..ee0e8641 --- /dev/null +++ b/tests/input/so.xyz @@ -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 diff --git a/tests/input/so2.xyz b/tests/input/so2.xyz new file mode 100644 index 00000000..a02e65f3 --- /dev/null +++ b/tests/input/so2.xyz @@ -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