From 33d59cf93578498acff42952a3e1c26f306abeb9 Mon Sep 17 00:00:00 2001 From: Otto Kohulak Date: Sun, 7 May 2023 22:23:19 +0200 Subject: [PATCH 1/5] Add YOT test for VMC --- test/test_vmc/CMakeLists.txt | 26 +++++++++++++++++--- test/test_vmc/cm.test1.sh | 21 ++++++++-------- test/test_vmc/{cm.test2.sh => cm.test_ad.sh} | 0 test/test_vmc/datasvmc_yot.d | 23 +++++++++++++++++ 4 files changed, 57 insertions(+), 13 deletions(-) rename test/test_vmc/{cm.test2.sh => cm.test_ad.sh} (100%) create mode 100755 test/test_vmc/datasvmc_yot.d diff --git a/test/test_vmc/CMakeLists.txt b/test/test_vmc/CMakeLists.txt index 7686c72..263ce4f 100644 --- a/test/test_vmc/CMakeLists.txt +++ b/test/test_vmc/CMakeLists.txt @@ -7,7 +7,7 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "" ) add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX} + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc.d serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) @@ -16,17 +16,37 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc.d mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) endif() + if( ${EXT_GPU} ) + if( ${EXECUTABLE} MATCHES ".*-serial" ) + set( PREFIX "" ) + add_test_dependency_tree( + NAME "Test VMC run, forcing yes_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc_yot.d serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + if( ${EXECUTABLE} MATCHES ".*-mpi" ) + set( PREFIX "mpirun -np 2" ) + add_test_dependency_tree( + NAME "Test VMC run, forcing yes_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc_yot.d mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + endif() endif() if( ${EXECUTABLE} MATCHES testad*) add_test_dependency_tree( NAME "Test VMC (AD) run" - COMMAND ${BASH_EXECUTABLE} cm.test2.sh $ + COMMAND ${BASH_EXECUTABLE} cm.test_ad.sh $ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) diff --git a/test/test_vmc/cm.test1.sh b/test/test_vmc/cm.test1.sh index c9d8346..f0b7569 100755 --- a/test/test_vmc/cm.test1.sh +++ b/test/test_vmc/cm.test1.sh @@ -5,15 +5,16 @@ if [[ $# -gt 0 ]]; then TURBORVB=$1 READF=$2 FORCEVMC=$3 - OUT=$4 - OUT_FORCEVMC=$5 - TRUEOUT=$6 - TRUEOUT_FORCEMVC=$7 - REF_FORT21=$8 - REF_FORCEVMC=$9 - ROUND_OFF=${10} - if [[ $# -gt 10 ]]; then - PREFIX=${11} + IN=$4 + OUT=$5 + OUT_FORCEVMC=$6 + TRUEOUT=$7 + TRUEOUT_FORCEMVC=$8 + REF_FORT21=$9 + REF_FORCEVMC=${10} + ROUND_OFF=${11} + if [[ $# -gt 11 ]]; then + PREFIX=${12} else PREFIX="" fi @@ -29,7 +30,7 @@ fi #cd vmc echo " VMC and VMC forces TEST " echo " dir=test_vmc" -$PREFIX $TURBORVB < datasvmc.d > $OUT +$PREFIX $TURBORVB < $IN > $OUT [ $? -eq 0 ] && echo " Run without non-zero exit code" || exit 1 #check energies diff --git a/test/test_vmc/cm.test2.sh b/test/test_vmc/cm.test_ad.sh similarity index 100% rename from test/test_vmc/cm.test2.sh rename to test/test_vmc/cm.test_ad.sh diff --git a/test/test_vmc/datasvmc_yot.d b/test/test_vmc/datasvmc_yot.d new file mode 100755 index 0000000..2406e7d --- /dev/null +++ b/test/test_vmc/datasvmc_yot.d @@ -0,0 +1,23 @@ +&simulation +ngen=10 +nscra=2 +nbra=10 +iseedr=25113183 +yesfast=2 +max_target=0 +/ +&pseudo +nintpsa=6 +npsamax=1 +/ +&vmc +tstep=3.3 +!epscut=0.0 +/ +&readio +iread=3 +/ +¶meters +ieskin=1 +warp=.false. +/ From c4bac20b4bd1a3e79172fce07669774ff02b6ce4 Mon Sep 17 00:00:00 2001 From: Otto Kohulak Date: Sun, 7 May 2023 23:46:29 +0200 Subject: [PATCH 2/5] Add YOT test for LRDMC --- test/test_lrdmc/CMakeLists.txt | 24 ++++++++++++++++++++++-- test/test_lrdmc/cm.test1.sh | 15 ++++++++------- test/test_lrdmc/datasfn_yot.d | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 9 deletions(-) create mode 100755 test/test_lrdmc/datasfn_yot.d diff --git a/test/test_lrdmc/CMakeLists.txt b/test/test_lrdmc/CMakeLists.txt index 9ffc344..b6108b9 100644 --- a/test/test_lrdmc/CMakeLists.txt +++ b/test/test_lrdmc/CMakeLists.txt @@ -7,7 +7,7 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "" ) add_test_dependency_tree( NAME "Test LRDMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) @@ -16,11 +16,31 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test LRDMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn.d mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) endif() + if( ${EXT_GPU} ) + if( ${EXECUTABLE} MATCHES ".*-serial" ) + set( PREFIX "" ) + add_test_dependency_tree( + NAME "Test LRDMC run, forcing yet_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn_yot.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + if( ${EXECUTABLE} MATCHES ".*-mpi" ) + set( PREFIX "mpirun -np 2" ) + add_test_dependency_tree( + NAME "Test LRDMC run, forcing yet_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn_yot.d mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + endif() endif() if( ${EXECUTABLE} MATCHES testad*) diff --git a/test/test_lrdmc/cm.test1.sh b/test/test_lrdmc/cm.test1.sh index f1e348c..e81b3fc 100755 --- a/test/test_lrdmc/cm.test1.sh +++ b/test/test_lrdmc/cm.test1.sh @@ -5,12 +5,13 @@ if [[ $# -gt 0 ]]; then TURBORVB=$1 READF=$2 FORCEFN=$3 - OUT=$4 - TRUEOUT=$5 - REF_FORT21=$6 - ROUND_OFF=$7 - if [[ $# -gt 7 ]]; then - PREFIX=$8 + IN=$4 + OUT=$5 + TRUEOUT=$6 + REF_FORT21=$7 + ROUND_OFF=$8 + if [[ $# -gt 8 ]]; then + PREFIX=$9 else PREFIX="" fi @@ -25,7 +26,7 @@ fi echo " LRDMC without 3-4body TEST " echo " dir=test_lrdmc" -$PREFIX $TURBORVB < datasfn.d > $OUT +$PREFIX $TURBORVB < $IN > $OUT [ $? -eq 0 ] && echo " Run without non-zero exit code" || exit 1 echo " Calculate local energies:'0 1 1 1' | readf.x" diff --git a/test/test_lrdmc/datasfn_yot.d b/test/test_lrdmc/datasfn_yot.d new file mode 100755 index 0000000..057a0c3 --- /dev/null +++ b/test/test_lrdmc/datasfn_yot.d @@ -0,0 +1,34 @@ +&simulation +itestr4=-6 ! LRDMC option +ngen=10 ! Number of branching +nscra=5 !Recomputing by scratch determinant each nscra accepted moves +nw=64 ! Number of walkers +iseedr=536473883 ! Initial random number +kappar=6.d0 +ksq=0.5d0 +!yesfast=0 +max_target=0 +/ +&pseudo +nintpsa=6 ! 6 points integration pseudo +npsamax=1 ! Max number of atoms closer than 2 rc (pseudo core radius). +/ +&dmclrdmc +tbra=0.1d0 ! DMC time between consecutive branching +etry=-5.42d0 ! Guess of the energy +plat(2)=1.2d0 ! eta in LRDMC eta = 1 + O(a^2) +plat(1)=-0.16d0 +alat=0.25d0 ! lattice space a +parcutg=0 ! Standard LRDMC +alat2=2.64575131106459d0 +iesrandoma=.false. +yes_fastbranch=.true. +/ +&readio +wherescratch='old' +/ +¶meters +epsbas=1d-7 +ieser=1 ! Energy +isfix=1 ! Variance +/ From 42b11ad600cdcce0319532fd974e818d75c18f1f Mon Sep 17 00:00:00 2001 From: Otto Kohulak Date: Sun, 7 May 2023 23:55:56 +0200 Subject: [PATCH 3/5] Add YOT test for LRDMC Tilted --- test/test_lrdmc_tilted/CMakeLists.txt | 24 +++++++++++++++-- test/test_lrdmc_tilted/cm.test1.sh | 15 ++++++----- test/test_lrdmc_tilted/datasfn_yot.d | 39 +++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 test/test_lrdmc_tilted/datasfn_yot.d diff --git a/test/test_lrdmc_tilted/CMakeLists.txt b/test/test_lrdmc_tilted/CMakeLists.txt index 060aeb7..ec79050 100644 --- a/test/test_lrdmc_tilted/CMakeLists.txt +++ b/test/test_lrdmc_tilted/CMakeLists.txt @@ -7,7 +7,7 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "" ) add_test_dependency_tree( NAME "Test LRDMC TILTED run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) @@ -16,11 +16,31 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test LRDMC TILTED run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn.d mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) endif() + if( ${EXT_GPU} ) + if( ${EXECUTABLE} MATCHES ".*-serial" ) + set( PREFIX "" ) + add_test_dependency_tree( + NAME "Test LRDMC TILTED run, forcing yes_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn_yot.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + if( ${EXECUTABLE} MATCHES ".*-mpi" ) + set( PREFIX "mpirun -np 2" ) + add_test_dependency_tree( + NAME "Test LRDMC TILTED run, forcing yes_ontarget (${EXECUTABLE})" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasfn_yot.d mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDENCY_TREE ${PARENT_DIR} + ) + endif() + endif() endif() endforeach() diff --git a/test/test_lrdmc_tilted/cm.test1.sh b/test/test_lrdmc_tilted/cm.test1.sh index e16dfe7..7e7cb5b 100755 --- a/test/test_lrdmc_tilted/cm.test1.sh +++ b/test/test_lrdmc_tilted/cm.test1.sh @@ -5,12 +5,13 @@ if [[ $# -gt 0 ]]; then TURBORVB=$1 READF=$2 FORCEFN=$3 - OUT=$4 - TRUEOUT=$5 - REF_FORT21=$6 - ROUND_OFF=$7 - if [[ $# -gt 7 ]]; then - PREFIX=$8 + IN=$4 + OUT=$5 + TRUEOUT=$6 + REF_FORT21=$7 + ROUND_OFF=$8 + if [[ $# -gt 8 ]]; then + PREFIX=$9 else PREFIX="" fi @@ -25,7 +26,7 @@ fi echo " LRDMC PBC TILTED TEST " echo " dir=test_lrdmc_tilted" -$PREFIX $TURBORVB < datasfn.d > $OUT +$PREFIX $TURBORVB < $IN > $OUT [ $? -eq 0 ] && echo " Run with non-zero exit code" || exit 1 echo " Calculate local energies:'0 1 1 1' | readf.x" diff --git a/test/test_lrdmc_tilted/datasfn_yot.d b/test/test_lrdmc_tilted/datasfn_yot.d new file mode 100644 index 0000000..3ca8bd3 --- /dev/null +++ b/test/test_lrdmc_tilted/datasfn_yot.d @@ -0,0 +1,39 @@ +&simulation +itestr4=-6 ! LRDMC option +ngen=10 ! Number of branching +nscra=5 !Recomputing by scratch determinant each nscra accepted moves +nw=8 ! Number of walkers +iseedr=536473883 ! Initial random number +kappar=6.d0 +ksq=0.5d0 +membig=.false. +membigcpu=.false. +!yesfast=0 +yes_sparse_choose=.false. +yes_sparse=.true. +max_target=0 +/ +&pseudo +nintpsa=6 ! 6 points integration pseudo +!npsamax=1 ! Max number of atoms closer than 2 rc (pseudo core radius). +/ +&dmclrdmc +tbra=0.01d0 ! DMC time between consecutive branching +etry=-5.42d0 ! Guess of the energy +plat(1)=-0.16d0 +plat(2)=1.2d0 ! eta in LRDMC eta = 1 + O(a^2) +alat=0.25d0 ! lattice space a +parcutg=0 ! Standard LRDMC +alat2=2.64575131106459d0 +iesrandoma=.false. +yes_fastbranch=.false. +/ +&readio +wherescratch='old' +/ +¶meters +epsbas=1.d-6 +ieser=1 ! Energy +isfix=1 ! Variance +yes_scemama=.false. +/ From 6badfd629efc936908707d737491ea9c90f5e6b0 Mon Sep 17 00:00:00 2001 From: Otto Kohulak Date: Mon, 8 May 2023 10:17:00 +0200 Subject: [PATCH 4/5] WIP --- test/test_vmc/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/test_vmc/CMakeLists.txt b/test/test_vmc/CMakeLists.txt index 263ce4f..af9a8f7 100644 --- a/test/test_vmc/CMakeLists.txt +++ b/test/test_vmc/CMakeLists.txt @@ -7,7 +7,14 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "" ) add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc.d serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX} + COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ + READF=$ + INPUT_TURBORVB=datasvmc.d + OUTPUT_TURBORVB=serial.out + OUTPUT_REF=out_true.o + FORT21_REF=REFERENCE_fortXXI + ROUND_OFF=6 + EXECUTE_PREFIX=${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) @@ -16,7 +23,14 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc.d mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ + READF=$ + INPUT_TURBORVB=datasvmc.d + OUTPUT_TURBORVB=mpi_np2.out + OUTPUT_REF=out_true_mpi_np2.o + FORT21_REF=REFERENCE_fortXXI_mpi_np2 + ROUND_OFF=6 + EXECUTE_PREFIX=${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) From 1f5cc04264e250a488802e473c4fbc6080211046 Mon Sep 17 00:00:00 2001 From: Otto Kohulak Date: Mon, 8 May 2023 11:21:41 +0200 Subject: [PATCH 5/5] CTest now passes key-value pairs instead of arguments --- .gitignore | 2 ++ test/test_vmc/CMakeLists.txt | 22 ++++++++++++--- test/test_vmc/cm.test1.sh | 53 ++++++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 1487e8b..9115e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -110,6 +110,8 @@ test/test_vmc*/**/pip0.d test/test_vmc*/**/randseed.000000 test/test_vmc*/**/serial.out test/test_vmc*/**/mpi_np2.out +test/test_vmc*/**/serial_yot.out +test/test_vmc*/**/mpi_np2_yot.out test/test_vmc*/**/turborvb.scratch test/test_vmc*/**/tmp1 test/test_vmc*/**/tmp2 diff --git a/test/test_vmc/CMakeLists.txt b/test/test_vmc/CMakeLists.txt index af9a8f7..624d4fb 100644 --- a/test/test_vmc/CMakeLists.txt +++ b/test/test_vmc/CMakeLists.txt @@ -8,7 +8,7 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ - READF=$ + READF=$ INPUT_TURBORVB=datasvmc.d OUTPUT_TURBORVB=serial.out OUTPUT_REF=out_true.o @@ -23,7 +23,7 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test VMC run (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ + COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ READF=$ INPUT_TURBORVB=datasvmc.d OUTPUT_TURBORVB=mpi_np2.out @@ -40,7 +40,14 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "" ) add_test_dependency_tree( NAME "Test VMC run, forcing yes_ontarget (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc_yot.d serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX} + COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ + READF=$ + INPUT_TURBORVB=datasvmc_yot.d + OUTPUT_TURBORVB=serial_yot.out + OUTPUT_REF=out_true.o + FORT21_REF=REFERENCE_fortXXI + ROUND_OFF=6 + EXECUTE_PREFIX=${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) @@ -49,7 +56,14 @@ foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L set( PREFIX "mpirun -np 2" ) add_test_dependency_tree( NAME "Test VMC run, forcing yes_ontarget (${EXECUTABLE})" - COMMAND ${BASH_EXECUTABLE} cm.test1.sh $ $ NA datasvmc_yot.d mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}" + COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$ + READF=$ + INPUT_TURBORVB=datasvmc_yot.d + OUTPUT_TURBORVB=mpi_np2_yot.out + OUTPUT_REF=out_true_mpi_np2.o + FORT21_REF=REFERENCE_fortXXI_mpi_np2 + ROUND_OFF=6 + EXECUTE_PREFIX=${PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCY_TREE ${PARENT_DIR} ) diff --git a/test/test_vmc/cm.test1.sh b/test/test_vmc/cm.test1.sh index f0b7569..279ae91 100755 --- a/test/test_vmc/cm.test1.sh +++ b/test/test_vmc/cm.test1.sh @@ -1,25 +1,36 @@ #!/bin/bash set -euo pipefail +# Set default values +TURBORVB=turborvb-serial.x +READF=readf.x +FORCEVMC=NA +INPUT_TURBORVB=datas.input +OUTPUT_TURBORVB=out +OUTPUT_FORCEVMC=out_forcevmc +OUTPUT_REF=out_true +OUTPUT_FORCEVMC_REF=out_forcevmc_true +FORT21_REF=fort.21_true +FORCEVMC_REF=force_vmc_true +ROUND_OFF=6 +EXECUTE_PREFIX="" + if [[ $# -gt 0 ]]; then - TURBORVB=$1 - READF=$2 - FORCEVMC=$3 - IN=$4 - OUT=$5 - OUT_FORCEVMC=$6 - TRUEOUT=$7 - TRUEOUT_FORCEMVC=$8 - REF_FORT21=$9 - REF_FORCEVMC=${10} - ROUND_OFF=${11} - if [[ $# -gt 11 ]]; then - PREFIX=${12} - else - PREFIX="" - fi + for ARG in "$@"; do + if [[ $ARG =~ ^([^=]+)=([^\']*)$ ]]; then + + KEY="${BASH_REMATCH[1]}" + VALUE="${BASH_REMATCH[2]}" + + eval "${KEY}='${VALUE}'" + else + echo "Uknown argument ${ARG}" + echo "Parameters has to be in key value pairs: $0 [key1=value1] [key2=value2] ..." + exit 1 + fi + done else - source ../settings.sh + source ../settings.sh fi if [ ! -f "$TURBORVB" ]; then @@ -30,22 +41,22 @@ fi #cd vmc echo " VMC and VMC forces TEST " echo " dir=test_vmc" -$PREFIX $TURBORVB < $IN > $OUT +$EXECUTE_PREFIX $TURBORVB < $INPUT_TURBORVB > $OUTPUT_TURBORVB [ $? -eq 0 ] && echo " Run without non-zero exit code" || exit 1 #check energies echo " Calculate local energies:'0 1 1 1' | readf.x" echo "0 1 1 1" | $READF >& /dev/null -if [ $(grep -c ERR $OUT) -gt 0 ]; then +if [ $(grep -c ERR $OUTPUT_TURBORVB) -gt 0 ]; then echo " Errors in output:" - echo `grep ERR $OUT` + echo `grep ERR $OUTPUT_TURBORVB` exit 1 fi echo " Rounds off values in fort.21 < 10**-${ROUND_OFF}". cat fort.21 | awk -v ROUND_OFF=${ROUND_OFF} '{printf("%.*f %.*f %.*f\n", ROUND_OFF, $1, ROUND_OFF, $2, ROUND_OFF, $3)}' > fort.21_roundoff -cat ${REF_FORT21} | awk -v ROUND_OFF=${ROUND_OFF} '{printf("%.*f %.*f %.*f\n", ROUND_OFF, $1, ROUND_OFF, $2, ROUND_OFF, $3)}' > REFERENCE_fortXXI_roundoff +cat ${FORT21_REF} | awk -v ROUND_OFF=${ROUND_OFF} '{printf("%.*f %.*f %.*f\n", ROUND_OFF, $1, ROUND_OFF, $2, ROUND_OFF, $3)}' > REFERENCE_fortXXI_roundoff #diff fort.21 echo " Compares fort.21_roundoff and REFERENCE_fortXXI_roundoff."