# This script can be run in parallel to the time-evolution script (run_teo.sh) in the symmps-example repository
# Input parameter is the directory to the path where the executables are located

EXEC_DIR=$1

DT=0.1
T_START=0
T_END=20

# do some cleanups
rm log/sym-scalar-product.*

#measure Sz-expectation values, waiting until the next time-step has been written
for TIME in $(LANG=en seq -f %f $( echo ${T_START}+${DT} | bc ) ${DT} ${T_END})
do
        STATE="teo/state."${TIME}
        while [ ! -e ${STATE} ]
        do
		echo "waiting for file ${STATE}"
                sleep 5
        done
        ${EXEC_DIR}/link/sym-scalar-product -i lattice.complex -t ${TIME} -O '' -o 'Sz' -k "${STATE}" -d teo
done
