From e4b1f333dc58da232b7672b29bf68608d144fcc1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 25 Dec 2018 10:55:40 +0100 Subject: [PATCH] Updated tests --- scripts/qp_test | 11 ++-- .../ezfio_files/10.convert.bats | 0 src/fci/{fci.bats => 30.fci.bats} | 5 +- src/hartree_fock/{hf.bats => 20.hf.bats} | 9 ++++ tests/bats/pseudo.bats | 53 ------------------- 5 files changed, 20 insertions(+), 58 deletions(-) rename tests/bats/convert.bats => src/ezfio_files/10.convert.bats (100%) rename src/fci/{fci.bats => 30.fci.bats} (80%) rename src/hartree_fock/{hf.bats => 20.hf.bats} (82%) delete mode 100644 tests/bats/pseudo.bats diff --git a/scripts/qp_test b/scripts/qp_test index ccab6083..9ed90424 100755 --- a/scripts/qp_test +++ b/scripts/qp_test @@ -31,15 +31,18 @@ def main(arguments): def append_bats(dirname, filenames): for f in filenames: if f.endswith(".bats"): - l_bats.append( os.path.join(dirname,f) ) + number, _ = f.split('.',1) + l_bats.append( (int(number), os.path.join(dirname,f)) ) if arguments["-a"]: for (dirname, _, filenames) in os.walk(QP_SRC, followlinks=False) : - append_bats(dirname, filenames) + if "IRPF90_temp" not in dirname: + append_bats(dirname, filenames) else: for (dirname, _, filenames) in os.walk(os.getcwd(), followlinks=False) : - append_bats(dirname, filenames) - print l_bats + if "IRPF90_temp" not in dirname: + append_bats(dirname, filenames) + l_bats = [ y for x,y in sorted(l_bats) ] # Execute tests os.chdir(QP_TESTS) diff --git a/tests/bats/convert.bats b/src/ezfio_files/10.convert.bats similarity index 100% rename from tests/bats/convert.bats rename to src/ezfio_files/10.convert.bats diff --git a/src/fci/fci.bats b/src/fci/30.fci.bats similarity index 80% rename from src/fci/fci.bats rename to src/fci/30.fci.bats index f4df41d3..96f9ea45 100644 --- a/src/fci/fci.bats +++ b/src/fci/30.fci.bats @@ -31,5 +31,8 @@ function run_FCI() { run_FCI h2o.ezfio 2000 -76.1249493055975 -76.1258779921351 } - +@test "FCI H2O VDZ pseudo" { + qp_set_mo_class h2o_pseudo.ezfio -core "[1]" -act "[2-12]" -del "[13-23]" + run_FCI h2o_pseudo.ezfio 2000 -17.0399259074535 -17.0400550838545 +} diff --git a/src/hartree_fock/hf.bats b/src/hartree_fock/20.hf.bats similarity index 82% rename from src/hartree_fock/hf.bats rename to src/hartree_fock/20.hf.bats index 893b9257..105539de 100644 --- a/src/hartree_fock/hf.bats +++ b/src/hartree_fock/20.hf.bats @@ -51,3 +51,12 @@ function run_HF() { run_HF h2o.ezfio -0.760270218692179E+02 } +#=== H2O Pseudo +@test "init H2O VDZ pseudo" { + run_init h2o.xyz "-p bfd -b vdz-bfd" h2o_pseudo.ezfio +} + +@test "SCF H2O VDZ pseudo" { + run_HF h2o_pseudo.ezfio -16.9483703905461 +} + diff --git a/tests/bats/pseudo.bats b/tests/bats/pseudo.bats deleted file mode 100644 index 4199f73a..00000000 --- a/tests/bats/pseudo.bats +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bats - -source $QP_ROOT/tests/bats/common.bats.sh - -function run_init() { - cp "${QP_ROOT}/tests/input/$1" . - qp_create_ezfio_from_xyz $1 -o $3 $2 - qp_edit -c $3 -} - - -function run_HF() { - thresh=1.e-7 - test_exe scf || skip - qp_edit -c $1 - ezfio set_file $1 - ezfio set hartree_fock thresh_scf 2.e-8 - qp_run scf $1 - energy="$(ezfio get hartree_fock energy)" - eq $energy $2 $thresh -} - - -function run_FCI() { - thresh=5.e-5 - test_exe fci || skip - qp_edit -c $1 - ezfio set_file $1 - ezfio set perturbation do_pt2 True - ezfio set determinants n_det_max $2 - ezfio set davidson threshold_davidson 1.e-10 - - qp_run fci $1 - energy="$(ezfio get FCI energy | tr '[]' ' ')" - eq $energy $3 $thresh - energy_pt2="$(ezfio get FCI energy_pt2 | tr '[]' ' ')" - eq $energy_pt2 $4 $thresh -} - -#=== H2O Pseudo -@test "init H2O VDZ pseudo" { - run_init h2o.xyz "-p bfd -b vdz-bfd" h2o_pseudo.ezfio -} - -@test "SCF H2O VDZ pseudo" { - run_HF h2o_pseudo.ezfio -16.9483703905461 -} - -@test "FCI H2O VDZ pseudo" { - qp_set_mo_class h2o_pseudo.ezfio -core "[1]" -act "[2-12]" -del "[13-23]" - run_FCI h2o_pseudo.ezfio 2000 -17.0399259074535 -17.0400550838545 -} -