source: util/CreateFromXYZ.sh.in@ bd7b85

Last change on this file since bd7b85 was 76b3dc, checked in by Frederik Heber <heber@…>, 17 years ago

.csv files of linear response values are written on first level, appended on all latters. No more .L1.csv.

Essentially, this is a fix, as it was meant to be like that before. Level in filename is not needed anymore as we are writing the correct ecut (respective to the current level) into the file. Hence, we may easily pack all into one file. This was already implemented with one of the three values but not with all and not for each PAS and non-PAS. Now, we have a if (Lev0->LevelNo == MaxLevel-2) check everywhere and OpenFile either in write or in append mode and put a header only in the former case.
Also, PAS values are now also written for the magnetic moments which was not done before (only to screen).

  • Property mode set to 100755
File size: 3.0 KB
Line 
1#!/bin/sh
2
3if [ -z "$2" ]; then
4 echo "Usage: $0 <xyzfile> <path-to-target>"
5 exit 1
6fi
7
8mol="${1}.xyz"
9#pfad="${2}/`basename ${1}`"
10pfad="$2"
11exec_prefix=@prefix@
12molecuilder=@bindir@
13pseudopot="${exec_prefix}/defaults/pseudopot"
14
15echo "Target dir is ${pfad}, using xyz file ${mol}."
16
17# Create path
18mkdir -p "${pfad}"
19
20number=`wc $mol | awk -F' ' {'print $1-2'}`
21MOL=( `tail $mol -n $number | awk -F" " {'print $1'}` )
22X=( `tail $mol -n $number | awk -F" " {'print $2'}` )
23Y=( `tail $mol -n $number | awk -F" " {'print $3'}` )
24Z=( `tail $mol -n $number | awk -F" " {'print $4'}` )
25
26cd $molecuilder
27./molecuilder "${pfad}/main_pcp_linux" -p ${pfad}/${mol} 2>/dev/null
28
29echo "Scaling by 1.8897261 ..."
30./molecuilder "${pfad}/main_pcp_linux" -s 1.8897261
31
32echo "Translating within boundary box (5.,5.,5.) ..."
33./molecuilder "${pfad}/main_pcp_linux" -g 5. 5. 0.
34
35echo "changing path"
36sed -i -e "s#defaultpath.*\# \(.*\)#defaultpath\t${pfad}/\t\# \1#" -e "s#pseudopotpath.*\# \(.*\)#pseudopotpath\t${pseudopot}/\t\# \1#" "${pfad}/main_pcp_linux"
37
38echo -n "Creating list of elements ... "
39elements=( `more "${pfad}/main_pcp_linux" | grep -v ^# | grep -v 'Ion_Type.*_.*' | grep Ion_Type | awk -F"\t" {'print $3'}` )
40factors=( `more "${pfad}/main_pcp_linux" | grep -v ^# | grep -v 'Ion_Type.*_.*' | grep Ion_Type | awk -F"\t" {'print $2'}` )
41maxtypes=`more "${pfad}/main_pcp_linux" | grep MaxTypes | awk -F"\t" {'print $2'}`
42echo "done."
43
44echo -n "Calculating number of orbitals needed ..."
45orbitals=0
46i=0
47while [ "$i" -lt "$maxtypes" ]; do
48 #echo "Checking on element ${elements[$i]}"
49 if [ "${elements[$i]}" -lt "10" ]; then
50 zahl=`head -n 1 $pseudopot/pseudo.0${elements[$i]} | awk -F" " {'print $1'}`
51 zahl=`awk "BEGIN { print $zahl; }"`
52 else
53 zahl=`head -n 1 $pseudopot/pseudo.${elements[$i]} | awk -F" " {'print $1'}`
54 zahl=`awk "BEGIN { print $zahl; }"`
55 fi
56 let zahl="$zahl*${factors[$i]}"
57 let orbitals="$orbitals+$zahl"
58 let i=$i+1
59done
60orbitalrest=`awk "BEGIN { print $orbitals % 2; }"`
61orbitals=`awk "BEGIN { print $orbitals / 2; }"`
62echo "done."
63echo "Suggested SpinType: $orbitalrest"
64
65echo -n " changing ..."
66if [ "$orbitalrest" == "0" ]; then
67 # even number: calculate with doubly occupied
68 sed -i -e "s#^PsiType\t\t.*#PsiType\t\t0#" "${pfad}/main_pcp_linux"
69else
70 # odd number: calculate with single occupation (at least two Psi processes needed)
71 sed -i -e "s#^PsiType\t\t.*#PsiType\t\t1#" "${pfad}/main_pcp_linux"
72 sed -i -e "s#^ProcPEPsi\t\t.*#ProcPEPsi\t\t2#" "${pfad}/main_pcp_linux"
73fi
74sed -i -e "s#^PsiMaxNoDown\t.*#PsiMaxNoDown\t$orbitals#" "${pfad}/main_pcp_linux"
75sed -i -e "s#^MaxPsiDouble\t.*#MaxPsiDouble\t$orbitals#" "${pfad}/main_pcp_linux"
76sed -i -e "s#^MaxMinStopStep\t.*#MaxMinStopStep\t$orbitals#" "${pfad}/main_pcp_linux"
77sed -i -e "s#^InitMaxMinStopStep\t.*#InitMaxMinStopStep\t$orbitals#" "${pfad}/main_pcp_linux"
78# add odd rest upon SpinUp state number
79let orbitals=$orbitals+$orbitalrest
80sed -i -e "s#^PsiMaxNoUp\t.*#PsiMaxNoUp\t$orbitals#" "${pfad}/main_pcp_linux"
81
82echo "done."
Note: See TracBrowser for help on using the repository browser.