Skip to content

Commit

Permalink
Format snb-run info messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Nov 3, 2024
1 parent e3cce49 commit 22f5521
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions shakenbreak/SnB_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ SnB_run_loop() {
if ((errors > 0)) || { ((pos_energies > 0)) && { (($(echo "$energy_diff_to_unperturbed > 1" | bc -l))) || [[ "$i" == *"Unperturbed"* ]]; }; }; then # if there are positive energies or errors in OUTCAR, and at least 1 eV higher than Unperturbed
if [[ "$i" == *"Unperturbed"* ]]; then
# positive energies / errors for Unperturbed structure, indicates pathological defect structure
echo "Positive energies or forces error encountered for ${i%/}. "
echo "This typically indicates the initial defect structure supplied to ShakeNBreak is highly unstable, often with bond lengths smaller than the ionic radii."
echo "Positive energies or forces error encountered for ${i%/}. This typically indicates the initial defect structure supplied to ShakeNBreak is highly unstable, often with bond lengths smaller than the ionic radii."
echo "Please check this defect structure and/or the relaxation output files."
builtin cd .. || return
continue
Expand Down Expand Up @@ -154,30 +153,26 @@ SnB_run_loop() {

# check if multiple <=single-step OUTCARs present, and CONTCAR empty/less than 9 lines or same as POSCAR
if check_multiple_single_step_outcars && { [[ ! -f "CONTCAR" ]] || { [[ -f "CONTCAR" ]] && { [[ $(wc -l < "CONTCAR") -le 9 ]] || diff -q "POSCAR" "CONTCAR" >/dev/null; }; }; }; then
echo "Previous run for ${i%?} did not yield more than one ionic step, and multiple OUTCARs with <=1 ionic "
echo "steps present, suggesting poor convergence. Recommended to manually check the VASP output files for this!"
echo "Previous run for ${i%?} did not yield more than one ionic step, and multiple OUTCARs with <=1 ionic steps present, suggesting poor convergence. Recommended to manually check the VASP output files for this!"
fi

# check if more than 2 OUTCARs present - might indicate tricky relaxation
if check_many_outcars; then
# echo "More than 2 OUTCARs present for ${i%?}, suggesting tricky relaxation. "
#sed -i.bak 's/IBRION.*/IBRION = 1/g' INCAR && rm -f INCAR.bak # sometimes helps to change IBRION if relaxation taking long
# Check total number of ionic steps in all OUTCARs
num_ionic_steps=$(grep entropy= OUTCAR* | wc -l) # use wc -l rather than grep -c because multiple files
if [ -f ../Unperturbed/OUTCAR ]; then # only compare if Unperturbed folder present
# If equal or higher than 150, compare to final energy in Unperturbed OUTCAR
if ((num_ionic_steps >= 150)) && (($(echo "$energy_diff_to_unperturbed > 2" | bc -l))); then
# If energy difference to Unperturbed is higher than 2 eV, rename to _High_Energy and continue
echo "More than 150 ionic steps present for ${i%?}. The energy difference to last structure in Unperturbed relaxation"
echo "is higher than 2 eV, indicating that ${i%?} is stuck in a high energy basin. "
echo "More than 150 ionic steps present for ${i%?}. The energy difference to last structure in Unperturbed relaxation is higher than 2 eV, indicating that ${i%?} is stuck in a high energy basin. "
echo "Renaming to ${i%?}_High_Energy and continuing."
builtin cd .. || return
mv "${i%/}" "${i%/}_High_Energy"
continue
# If higher than 500 ionic steps, energy not changing significantly and higher energy than Unperturbed, rename to _High_Energy and continue
elif ((num_ionic_steps > 500)) && (($(echo "${energy_diff#-} > -0.002" | bc -l))) && (($(echo "$energy_diff_to_unperturbed > 0.5" | bc -l))); then
echo "More than 500 ionic steps present for ${i%?} and energy higher than Unperturbed, "
echo "indicating that ${i%?} won't lead to an energy-lowering structure. "
echo "More than 500 ionic steps present for ${i%?} and energy higher than Unperturbed, indicating that ${i%?} won't lead to an energy-lowering structure. "
echo "Renaming to ${i%?}_High_Energy and continuing."
builtin cd .. || return
mv "${i%/}" "${i%/}_High_Energy"
Expand Down

0 comments on commit 22f5521

Please sign in to comment.