-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_potcar.sh
54 lines (47 loc) · 1.27 KB
/
generate_potcar.sh
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
#!/bin/bash
# Set current directory as the working directory
cd "$(pwd)"
# Remove current POTCAR and reveal the headlines of a file named POSCAR
rm -i POTCAR
head POSCAR
# Ask for the input "which is the element line"
read -p "Which is the element line? " element_line
# Extract elements from the specified line
elements=$(sed -n "${element_line}p" POSCAR)
# Loop over each element to perform the required operations
for element in $elements; do
case $element in
C)
new_name="C_GW_new"
;;
Li)
new_name="Li_sv_GW"
;;
H)
new_name="H_GW"
;;
O)
new_name="O_GW_new"
;;
N)
new_name="N_GW_new"
;;
He)
new_name="He"
;;
S)
new_name="S_GW"
;;
F)
new_name="F_GW_new"
;;
*)
# If there's no matching rule for the element, we skip the iteration
echo "No matching rule for element: $element"
continue
;;
esac
# Concatenate the POTCAR into the working directory's POTCAR
cat "/path/to/your/potcar/bank/$new_name/POTCAR" >> POTCAR
done
echo "POTCAR file has been generated/updated."