| 
            Last change
 on this file since 774ae8 was             a0bcf1, checked in by Frederik Heber <heber@…>, 18 years ago           | 
        
        
          | 
             
-initial commit 
-Minimum set of files needed from ESPACK SVN repository 
-Switch to three tantamount package parts instead of all relating to pcp (as at some time Ralf's might find inclusion as well) 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100755
               
             
           | 
        
        
          | 
            File size:
            946 bytes
           | 
        
      
      
| Rev | Line |   | 
|---|
| [a0bcf1] | 1 | #!/bin/sh
 | 
|---|
 | 2 | #
 | 
|---|
 | 3 | # extracts a .xyz-file from a pcp config file
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | if [ -z "$1" ]; then
 | 
|---|
 | 6 |         echo "Usage: $0 <config> [output.xyz]"
 | 
|---|
 | 7 | else
 | 
|---|
 | 8 |         config=$1
 | 
|---|
 | 9 |         if [ ! -z "$2" ]; then
 | 
|---|
 | 10 |                 output=$2
 | 
|---|
 | 11 |         else
 | 
|---|
 | 12 |                 output="$1.xyz"
 | 
|---|
 | 13 |         fi
 | 
|---|
 | 14 | fi
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | echo -n "Retrieving Ion types ..."
 | 
|---|
 | 17 | ions=`grep '^Ion_Type.[^_]' $config | awk -F"\t" {'print $9'}`
 | 
|---|
 | 18 | ionnumber=`grep '^Ion_Type.[^_]' $config | awk -F"\t" {'print $2'}`
 | 
|---|
 | 19 | OLDIFS=$IFS
 | 
|---|
 | 20 | IFS='
 | 
|---|
 | 21 | '
 | 
|---|
 | 22 | i=1
 | 
|---|
 | 23 | number=0
 | 
|---|
 | 24 | declare -a types
 | 
|---|
 | 25 | for ion in $ions; do
 | 
|---|
 | 26 |         types[$i]=$ion
 | 
|---|
 | 27 |         let i=$i+1
 | 
|---|
 | 28 | done
 | 
|---|
 | 29 | i=1
 | 
|---|
 | 30 | for nr in $ionnumber; do
 | 
|---|
 | 31 |         let number=$number+$nr
 | 
|---|
 | 32 |         echo -n "${types[$i]} ($nr)"
 | 
|---|
 | 33 |         let i=$i+1
 | 
|---|
 | 34 | done
 | 
|---|
 | 35 | IFS=$OLDIFS
 | 
|---|
 | 36 | echo done
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | echo "Converting $config to $output...done"
 | 
|---|
 | 39 | # Schreibe Kopf
 | 
|---|
 | 40 | echo "$number" >$output
 | 
|---|
 | 41 | echo -e "\tgenerated with config2xyz from $config" >>$output
 | 
|---|
 | 42 | # Fuege Ionen dran
 | 
|---|
 | 43 | j=1
 | 
|---|
 | 44 | while [ $j -lt $i ]; do
 | 
|---|
 | 45 |         `grep ^Ion_Type${j}_ $config | awk -F" " {'print $1"\t"$2"\t"$3"\t"$4'} | sed -e "s#Ion_Type${j}_[0-9]*#${types[$j]}#" >>$output`
 | 
|---|
 | 46 |         let j=$j+1
 | 
|---|
 | 47 | done
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | exit 0
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.