Skip to content

Instantly share code, notes, and snippets.

@singularitti
Last active April 8, 2019 02:33
Show Gist options
  • Save singularitti/c7fa96934061cc6058fbf0556666b066 to your computer and use it in GitHub Desktop.
Save singularitti/c7fa96934061cc6058fbf0556666b066 to your computer and use it in GitHub Desktop.
Check whether vc-relax of QE is finished #Shell #QE #tool
#!/usr/bin/env bash
# This script checks whether the vc-relax output gives correct result,
# by examining if there is "End final coordinates" in the output.
# Helpful guides: https://github.com/koalaman/shellcheck/wiki/SC2045,
# http://jafrog.com/2013/11/23/colors-in-terminal.html,
# and https://github.com/koalaman/shellcheck/wiki/SC2068
folders=()
for folder in "$@"; do
[[ -d $folder ]] || break # handle the case of no vc_* folders
folders+=($folder)
done
printf '%s\n' "${folders[@]}"
for folder in "${folders[@]}"; do
(
cd "$folder" || return
(
cd vc_relax || return
echo -e "\033[34;1m" "I am entering folder: $folder" "\033[0m"
if grep -q "End final coordinates" ./*.out; then
echo -e "\033[32;1m" "Found \"End final coordinates\", finished!" "\033[0m"
elif grep -q "Maximum number of iterations reached, stopping" ./*.out; then
echo -e "\033[35;1m" "Maximum number of iterations reached!" "\033[0m"
elif [ -f CRASH ]; then
echo -e "\033[38;5;198m" "CRASH file found!" "\033[0m"
fi
)
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment