-
Notifications
You must be signed in to change notification settings - Fork 22
/
run_latte
executable file
·88 lines (75 loc) · 3.83 KB
/
run_latte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
#
# Script to call the LATTE code from any external folder.
#
set -e # This will exit the script if there is any error
MY_PATH=`pwd` # Capturing the local path of the folder where we are running.
# The latte path is wherever this script is located.
# We assume this file it is located in the LATTE main directory.
LATTE_PATH=$(dirname $0)
RUN_PATH="."
if [ "${BASH_ARGV[0]}" != "" ]; then
if [ "${BASH_ARGV[0]}" == "--help" ] ; then # Display a help menu for this script.
echo -e "\n Usage:"
echo " $ run_latte --help : Displays this information."
echo " $ run_latte --setup : Setup a Latte calculation environment with sample input files."
echo " $ run_latte --setuplmp : Setup a full Lammps-Latte calculation environment with sample input files."
echo " $ run_latte --run : Runs latte taking the info located in the existing running folders."
echo " $ run_latte --clean : Cleans previous running files."
echo " $ run_latte --cleanall : Cleans previous running files including folders."
exit
elif [ "${BASH_ARGV[0]}" == "--setup" ]; then
echo -e "\n Preparing files to be used in a LATTE calculation ... \n"
mkdir -p ${RUN_PATH}/Restarts
mkdir -p ${RUN_PATH}/TBparam
mkdir -p ${RUN_PATH}/animate
mkdir -p ${RUN_PATH}/bl
cp -v ${LATTE_PATH}/TBparam/control.in ${RUN_PATH}/TBparam
cp -v ${LATTE_PATH}/MDcontroller ${RUN_PATH}/
cp -v ${LATTE_PATH}/TBparam/bondints.nonortho* ${RUN_PATH}/TBparam
cp -v ${LATTE_PATH}/TBparam/electrons.dat ${RUN_PATH}/TBparam
cp -v ${LATTE_PATH}/TBparam/ppots.nonortho* ${RUN_PATH}/TBparam
exit
elif [ "${BASH_ARGV[0]}" == "--setuplmp" ]; then
echo -e "\n Preparing files to be used in a LAMMPS-LATTE calculation ... \n"
mkdir -p ${RUN_PATH}/Restarts
mkdir -p ${RUN_PATH}/TBparam
mkdir -p ${RUN_PATH}/animate
mkdir -p ${RUN_PATH}/bl
cp -v ${LATTE_PATH}/example_lmp/latte.in ${RUN_PATH}/
cp -v ${LATTE_PATH}/TBparam/bondints.nonortho* ${RUN_PATH}/TBparam
cp -v ${LATTE_PATH}/TBparam/electrons.dat ${RUN_PATH}/TBparam
cp -v ${LATTE_PATH}/TBparam/ppots.nonortho* ${RUN_PATH}/TBparam
exit
elif [ "${BASH_ARGV[0]}" == "--run" ]; then
echo -e "\n Running LATTE with the existing files ... \n"
${LATTE_PATH}/LATTE_DOUBLE | tee "LATTE_"$MY_JOB".out" # Just run latte taking the existing folder/files.
exit
elif [ "${BASH_ARGV[0]}" == "--clean" ] ; then # Cleans all the previous calcs.
read -p "All previous results are about to be removed. Are you sure? (press ctrl+c to abort)"
set +e
echo -e "\n Cleaning previous calculation ..."
rm ${RUN_PATH}/LATTE_* ${RUN_PATH}/restartREL.dat ${RUN_PATH}/fort.*
rm ${RUN_PATH}/fittingoutput.dat ${RUN_PATH}/lastsystem* ${RUN_PATH}/restart_singlepoint.dat
rm ${RUN_PATH}/energy.out ${RUN_PATH}/trajectory* ${RUN_PATH}/gmon.out
rm ${RUN_PATH}/mylastLATTEcalc
exit
elif [ "${BASH_ARGV[0]}" == "--cleanall" ] ; then # Cleans all the previous calcs and the folders.
read -p "All previous results are about to be removed. Are you sure? (press ctrl+c to abort)"
set +e
echo -e "\n Cleaning previous calculation ..."
rm ${RUN_PATH}/LATTE_* ${RUN_PATH}/restartREL.dat ${RUN_PATH}/fort.*
rm ${RUN_PATH}/fittingoutput.dat ${RUN_PATH}/lastsystem* ${RUN_PATH}/restart_singlepoint.dat
rm ${RUN_PATH}/energy.out ${RUN_PATH}/trajectory* ${RUN_PATH}/gmon.out
rm ${RUN_PATH}/mylastLATTEcalc
rm -rf ${RUN_PATH}/Restarts ${RUN_PATH}/TBparam ${RUN_PATH}/animate ${RUN_PATH}/bl
exit
else
echo -e "\n Wrong flag or input file. Type $ run_latte --help for more information ... \n"
exit
fi
else
echo -e "\n An argument needs to be passed to run_latte script ... \n"
exit
fi
echo -e "\n End of run_latte script"