Skip to content

Commit

Permalink
Merge pull request #88 from michele-casula/devel
Browse files Browse the repository at this point in the history
adding DMC Tmoves test
  • Loading branch information
kousuke-nakano authored Feb 22, 2024
2 parents 00fbaf6 + 9d6502d commit a020501
Show file tree
Hide file tree
Showing 8 changed files with 604 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ if(EXT_TOOLS AND EXT_QMC)
add_subdirectory(test_lrdmc_dltm)
add_subdirectory(test_lrdmc_la)
add_subdirectory(test_lrdmc_tmove)


#DMC-Tmoves
add_subdirectory(test_dmc_tmoves)

# MD
add_subdirectory(test_MD_classical_vmc)
add_subdirectory(test_MD_quantum_vmc)
Expand Down
26 changes: 26 additions & 0 deletions test/test_dmc_tmoves/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)

foreach( EXECUTABLE IN LISTS EXECUTABLES_S_L
EXECUTABLES_P_L )
if( ${EXECUTABLE} MATCHES turborvb-.*)
if( ${EXECUTABLE} MATCHES ".*-serial" )
set( PREFIX "" )
add_test_dependency_tree(
NAME "Test DMC Tmoves run (${EXECUTABLE})"
COMMAND ${BASH_EXECUTABLE} cm.test.sh $<TARGET_FILE:${EXECUTABLE}> $<TARGET_FILE:readf> NA 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 (${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}"
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
# DEPENDENCY_TREE ${PARENT_DIR}
# )
# endif()
endif()

endforeach()
10 changes: 10 additions & 0 deletions test/test_dmc_tmoves/REFERENCE_fortXXI
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-0.621267594198E+01 0.400985403844E+01 0.100000000000E+01
-0.612361718212E+01 0.401108594707E+01 0.200000000000E+01
-0.597148528109E+01 0.400897979256E+01 0.300000000000E+01
-0.589877347678E+01 0.400732737251E+01 0.400000000000E+01
-0.580321289213E+01 0.400595045346E+01 0.500000000000E+01
-0.580012564823E+01 0.400649346246E+01 0.600000000000E+01
-0.567099157340E+01 0.400374165481E+01 0.700000000000E+01
-0.559008276135E+01 0.400248428156E+01 0.800000000000E+01
-0.552517362808E+01 0.400226947011E+01 0.900000000000E+01
-0.543683279574E+01 0.400032969798E+01 0.100000000000E+02
57 changes: 57 additions & 0 deletions test/test_dmc_tmoves/cm.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
set -euo pipefail

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
else
PREFIX=""
fi
else
source ../settings.sh
fi

if [ ! -f "$TURBORVB" ]; then
echo "Executable $TURBORVB does not exists"
exit 1
fi

echo " DMC with Tmoves after single particle diffusion TEST "
echo " dir=test_dmc_tmoves"
$PREFIX $TURBORVB < datasfn.d > $OUT
[ $? -eq 0 ] && echo " Run without non-zero exit code" || exit 1

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
echo " Errors in output:"
grep ERR $OUT
exit 1
fi

#check energies
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

#diff fort.21
echo " Compares fort.21_roundoff and REFERENCE_fortXXI_roundoff."
echo " If you do not see any "diff" here, they are consistent."

if [ $(diff fort.21_roundoff REFERENCE_fortXXI_roundoff | wc -l) -gt 0 ]; then
diff fort.21_roundoff REFERENCE_fortXXI_roundoff
exit 1
elif [ $FORCEFN == NA ]; then
exit 0
else
exit 0
fi

20 changes: 20 additions & 0 deletions test/test_dmc_tmoves/datasfn.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
&simulation
itestr4=-3 ! 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
/
&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
/
&readio
wherescratch='old'
/
&parameters
/
213 changes: 213 additions & 0 deletions test/test_dmc_tmoves/fort.10
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# Nelup #Nel # Ion
3 4 1
# Shell Det. # Shell Jas.
11 0
# Jas 2body # Det # 3 body atomic par.
-6 11 0
# Det mat. =/0 # Jas mat. =/0
75 0
# Eq. Det atomic par. # Eq. 3 body atomic. par.
11 0
# unconstrained iesfree,iessw,ieskinr,I/O flag
0 36 0 0
# Ion coordinates
4.00000000000000 6.00000000000000 0.000000000000000E+000
0.000000000000000E+000 0.000000000000000E+000
# Constraints for forces: ion - coordinate
# Parameters Jastrow two body
1 0.623718363833333
# Parameters atomic wf
1 1 16
1 3.95109750985687
1 1 16
1 0.317287559012332
1 1 16
1 0.120123149130549
1 1 16
1 0.752167665135425
1 1 16
1 4.83420846941310
3 1 36
1 0.807069454551756
3 1 36
1 0.104770860679397
3 1 36
1 0.304405567375243
3 1 36
1 6.75805433169480
3 1 36
1 2.19065750387804
5 1 37
1 1.79837034279688
# Parameters atomic Jastrow wf
# Occupation atomic orbitals
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
# Occupation atomic orbitals Jastrow
# Nonzero values of detmat
1 2 -2.62885781587197
1 3 -0.821146377707990
1 4 -1.50786778822164
1 5 -0.237931839627528
2 2 3.09284431122107
2 3 1.18849124768215
2 4 2.55951504738581
2 5 1.60754696069172
3 3 0.210657121320606
3 4 0.960890370363254
3 5 0.463684994087173
4 4 2.10949642638303
4 5 0.738953573761255
5 5 -0.203938995681163
6 6 -0.236919860401304
7 7 -0.236919860401304
8 8 -0.236919860401304
6 9 -1.411203953701510E-002
7 10 -1.411203953701510E-002
8 11 -1.411203953701510E-002
6 12 -0.181997044876954
7 13 -0.181997044876954
8 14 -0.181997044876954
6 15 -7.222887494010630E-002
7 16 -7.222887494010630E-002
8 17 -7.222887494010630E-002
6 18 -0.217791918757999
7 19 -0.217791918757999
8 20 -0.217791918757999
9 9 -1.417937271712770E-002
10 10 -1.417937271712770E-002
11 11 -1.417937271712770E-002
9 12 -2.092622949980960E-002
10 13 -2.092622949980960E-002
11 14 -2.092622949980960E-002
9 15 -2.944096746454070E-003
10 16 -2.944096746454070E-003
11 17 -2.944096746454070E-003
9 18 -1.020341638229640E-002
10 19 -1.020341638229640E-002
11 20 -1.020341638229640E-002
12 12 -0.196390578534401
13 13 -0.196390578534401
14 14 -0.196390578534401
12 15 -3.566624126486210E-002
13 16 -3.566624126486210E-002
14 17 -3.566624126486210E-002
12 18 -0.123611496967959
13 19 -0.123611496967959
14 20 -0.123611496967959
15 15 -5.310194074550770E-003
16 16 -5.310194074550770E-003
17 17 -5.310194074550770E-003
15 18 -4.178293845346270E-002
16 19 -4.178293845346270E-002
17 20 -4.178293845346270E-002
18 18 -8.714058690479320E-002
19 19 -8.714058690479320E-002
20 20 -8.714058690479320E-002
21 21 -2.659423776505300E-002
22 22 -2.659423776505300E-002
23 23 -2.659423776505300E-002
24 24 -2.659423776505300E-002
25 25 -2.659423776505300E-002
9 26 0.384058924470031
10 27 0.384058924470031
12 26 0.948790250834314
13 27 0.948790250834314
15 26 0.155278687263796
16 27 0.155278687263796
18 26 0.523372098581465
19 27 0.523372098581465
1 1 1.00000000000000
6 26 1.00000000000000
7 27 1.00000000000000
# Grouped par. in the chosen ordered basis
1 1 2
1 1 3
1 1 4
1 1 5
1 2 2
1 2 3
1 2 4
1 2 5
1 3 3
1 3 4
1 3 5
1 4 4
1 4 5
1 5 5
3 6 6 7 7 8
8
3 6 9 7 10 8
11
3 6 12 7 13 8
14
3 6 15 7 16 8
17
3 6 18 7 19 8
20
3 9 9 10 10 11
11
3 9 12 10 13 11
14
3 9 15 10 16 11
17
3 9 18 10 19 11
20
3 12 12 13 13 14
14
3 12 15 13 16 14
17
3 12 18 13 19 14
20
3 15 15 16 16 17
17
3 15 18 16 19 17
20
3 18 18 19 19 20
20
5 21 21 22 22 23
23 24 24 25 25
2 9 26 10 27
2 12 26 13 27
2 15 26 16 27
2 18 26 19 27
-1 1 1
-2 6 26 7 27
# Nonzero values of jasmat
# Eq. par. in the 3-body Jastrow in the chosen basis
# Eq. par. in the atomic Det par. in the chosen basis
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
# Eq. par. in the atomic 3-body par. in the chosen basis
Loading

0 comments on commit a020501

Please sign in to comment.