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