Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new tests #38

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 22 additions & 2 deletions test/test_lrdmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX}
COMMAND ${BASH_EXECUTABLE} cm.test1.sh $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA datasfn.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCY_TREE ${PARENT_DIR}
)
Expand All @@ -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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}"
COMMAND ${BASH_EXECUTABLE} cm.test1.sh $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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*)
Expand Down
15 changes: 8 additions & 7 deletions test/test_lrdmc/cm.test1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
34 changes: 34 additions & 0 deletions test/test_lrdmc/datasfn_yot.d
Original file line number Diff line number Diff line change
@@ -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'
/
&parameters
epsbas=1d-7
ieser=1 ! Energy
isfix=1 ! Variance
/
24 changes: 22 additions & 2 deletions test/test_lrdmc_tilted/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX}
COMMAND ${BASH_EXECUTABLE} cm.test1.sh $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA datasfn.d serial.out out_true.o REFERENCE_fortXXI 6 ${PREFIX}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCY_TREE ${PARENT_DIR}
)
Expand All @@ -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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA mpi_np2.out out_true_mpi_np2.o REFERENCE_fortXXI_mpi_np2 6 "${PREFIX}"
COMMAND ${BASH_EXECUTABLE} cm.test1.sh $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> 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()
15 changes: 8 additions & 7 deletions test/test_lrdmc_tilted/cm.test1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
39 changes: 39 additions & 0 deletions test/test_lrdmc_tilted/datasfn_yot.d
Original file line number Diff line number Diff line change
@@ -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'
/
&parameters
epsbas=1.d-6
ieser=1 ! Energy
isfix=1 ! Variance
yes_scemama=.false.
/
54 changes: 51 additions & 3 deletions test/test_vmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA serial.out NA out_true.o NA REFERENCE_fortXXI NA 6 ${PREFIX}
COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$<TARGET_FILE:${EXECUTABLE}>
READF=$<TARGET_FILE: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}
)
Expand All @@ -16,17 +23,58 @@ 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 $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA mpi_np2.out NA out_true_mpi_np2.o NA REFERENCE_fortXXI_mpi_np2 NA 6 "${PREFIX}"
COMMAND ${BASH_EXECUTABLE} cm.test1.sh TURBORVB=$<TARGET_FILE:${EXECUTABLE}>
READF=$<TARGET_FILE: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}
)
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 TURBORVB=$<TARGET_FILE:${EXECUTABLE}>
READF=$<TARGET_FILE: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}
)
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 TURBORVB=$<TARGET_FILE:${EXECUTABLE}>
READF=$<TARGET_FILE: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}
)
endif()
endif()
endif()

if( ${EXECUTABLE} MATCHES testad*)
add_test_dependency_tree(
NAME "Test VMC (AD) run"
COMMAND ${BASH_EXECUTABLE} cm.test2.sh $<TARGET_FILE:testad>
COMMAND ${BASH_EXECUTABLE} cm.test_ad.sh $<TARGET_FILE:testad>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCY_TREE ${PARENT_DIR}
)
Expand Down
52 changes: 32 additions & 20 deletions test/test_vmc/cm.test1.sh
Original file line number Diff line number Diff line change
@@ -1,24 +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
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}
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
Expand All @@ -29,22 +41,22 @@ fi
#cd vmc
echo " VMC and VMC forces TEST "
echo " dir=test_vmc"
$PREFIX $TURBORVB < datasvmc.d > $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."
Expand Down
File renamed without changes.
Loading