source: util/src/CalculateDensity.sh.in@ 47548d

Last change on this file since 47548d was 13088d, checked in by Frederik Heber <heber@…>, 16 years ago

Small changes in the scripts

CalculateDensity: prefix was wrongly set
CalculateMass: atomicmassunit is the correct name from units, not atomicmass

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!@SHELL@
2#
3# calculates the density of a molecule contained in a espack config file
4
5exec_prefix=@prefix@
6MOLECUILDER="@bindir@/molecuilder"
7
8if [ -z $1 ]; then
9 echo "Usage: $0 <config file>"
10 echo "We assume, that there is also an xyz file to the config file."
11 exit 1
12else
13 config=$1
14 if [ ! -e $config ]; then
15 echo "Config file $config does not exist!"
16 exit 1
17 fi
18fi
19
20# if xyz is missing, call molecuilder to create it
21if [ ! -e ${config}.xyz ]; then
22 echo "Config xyz file ${config}.xyz does not exist, creating it"
23 $MOLECUILDER ${config} -t 0. 0. 0.
24fi
25
26mass=`/home/heber/workspace/ESPACK/bin/CalculateMass.sh ${config}.xyz | awk -F" " {'print $3'}`
27echo "Mass is $mass atomicmassunit"
28boxlengths=`grep ^Box --after-context=3 ${config} | tail -n 3`
29volume=`echo $boxlengths | awk -F" " {'print $1*$3*$6'}`
30if [ `grep IsAngstroem ${config} | awk -F" " {'print $2'}` == "1" ]; then
31 unit="angstrom^3"
32else
33 unit="atomiclength^3"
34fi
35echo "Volume is $volume $unit"
36density=`units "$mass atomicmassunit / $volume $unit" "g/cm^3" | grep \* | awk -F" " {'print $2'}`
37echo "Density is $density g/cm^3"
38
39exit 0
Note: See TracBrowser for help on using the repository browser.