-
Notifications
You must be signed in to change notification settings - Fork 0
/
.functions
52 lines (45 loc) · 1.12 KB
/
.functions
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
#!/usr/bin/env bash
# open folder if hx called with no arguments
hx() {
if [[ $# -eq 0 ]]; then
command hx .
else
command hx "$@"
fi
}
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# ditch the outputs of chemcraft
molv () {
for file in "$@"; do
wine /home/vport/.wine/drive_c/Chemcraft/Chemcraft.exe "$file" &> /dev/null &
done
}
# oneliner to send files and ssh to cluster
sngo() {
cs "$1" push && sshcd "$1"
}
# oneliner to optimize a structure with xtb without cluttering the current dir
xtbopt() {
local file_name="$1"
mkdir .xtbopt && cp "$file_name" .xtbopt && cd .xtbopt && xtb "$1" --opt && cp xtbopt.xyz .. && cd ..
molv xtbopt.xyz
}
checkneb() {
local file_root="$1"
plot_interp_neb "$file_root.interp" &
molv "$file_root""_MEP_trj.xyz"
}
trj_to_xyz() {
trj_file="$1"
nratoms=$(head "$trj_file" -n 1)
xyzlength=$((nratoms + 2))
xyzfile="${trj_file/_trj/}"
tail -n "$xyzlength" "$trj_file" > "$xyzfile"
}