#!@SHELL@ # # calculates the density of a molecule contained in a espack config file exec_prefix=@prefix@ MOLECUILDER="@bindir@/molecuilder" if [ -z $1 ]; then echo "Usage: $0 " echo "We assume, that there is also an xyz file to the config file." exit 1 else config=$1 if [ ! -e $config ]; then echo "Config file $config does not exist!" exit 1 fi fi # if xyz is missing, call molecuilder to create it if [ ! -e ${config}.xyz ]; then echo "Config xyz file ${config}.xyz does not exist, creating it" $MOLECUILDER ${config} -t 0. 0. 0. fi mass=`/home/heber/workspace/ESPACK/bin/CalculateMass.sh ${config}.xyz | awk -F" " {'print $3'}` echo "Mass is $mass atomicmassunit" boxlengths=`grep ^Box --after-context=3 ${config} | tail -n 3` volume=`echo $boxlengths | awk -F" " {'print $1*$3*$6'}` if [ `grep IsAngstroem ${config} | awk -F" " {'print $2'}` == "1" ]; then unit="angstrom^3" else unit="atomiclength^3" fi echo "Volume is $volume $unit" density=`units "$mass atomicmassunit / $volume $unit" "g/cm^3" | grep \* | awk -F" " {'print $2'}` echo "Density is $density g/cm^3" exit 0