-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriteorbMC
More file actions
executable file
·52 lines (47 loc) · 942 Bytes
/
Copy pathwriteorbMC
File metadata and controls
executable file
·52 lines (47 loc) · 942 Bytes
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
#!/bin/bash
# split comma-separated orbital coefficients file to max $NNUM values in a row
# and decorate with the MOLCAS info
NNUM=5
UHF=0
ORIGIN=0
IFS='' read -r line < "$1"
IFS=',' read -ra dimsym <<< "$line"
#echo $dimsym, number of symmetries: ${#dimsym[*]}
# Molcas head
echo "#INPORB 2.2"
echo "#INFO"
echo "* Molpro orbitals"
echo $UHF ${#dimsym[*]} $ORIGIN
echo ${dimsym[*]}
echo ${dimsym[*]}
echo "*read from the Molpro file"
echo "#ORB"
awk -F"[, ]" -v nnum=$NNUM -v dimstr="${dimsym[*]}" '
BEGIN {
ndim=split(dimstr,dims," ");
sym=1;
orb=1;
}
(NR>1 && NF>0){
printf "%s %d %d\n", "* ORBITAL", sym, orb;
len=0;
for(i=1;i<=NF;i++){
if ($i!="") {
if (substr($i,1,1) == "-")
printf " %s", $i;
else
printf " %s", $i;
len++;
if (len>=nnum || i==NF){
printf "\n";
len=0;
}
}
}
++orb;
if (orb>dims[sym]) {
++sym;
orb=1;
}
}
' "$1"