source: util/src/CalculateDensity.sh@ 3f0c46

Last change on this file since 3f0c46 was 41c2f1, checked in by Frederik Heber <heber@…>, 17 years ago

Two new shell scripts to calculate mass (with elements.db) and the resulting density (with volume out of BoxLength)

  • Property mode set to 100755
File size: 783 bytes
Line 
1#!/bin/sh
2#
3# calculates the density of a molecule contained in a espack config file
4
5if [ -z $1 ]; then
6 echo "Usage: $0 <config file>"
7 echo "We assume, that there is also an xyz file to the config file."
8 exit 1
9else
10 config=$1
11fi
12
13mass=`/home/heber/workspace/ESPACK/bin/CalculateMass.sh ${config}.xyz | awk -F" " {'print $3'}`
14echo "Mass is $mass atomicmassunit"
15boxlengths=`grep ^Box --after-context=3 ${config} | tail -n 3`
16volume=`echo $boxlengths | awk -F" " {'print $1*$3*$6'}`
17if [ `grep IsAngstroem ${config} | awk -F" " {'print $2'}` == "1" ]; then
18 unit="angstrom^3"
19else
20 unit="atomiclength^3"
21fi
22echo "Volume is $volume $unit"
23density=`units "$mass atomicmassunit / $volume $unit" "g/cm^3" | grep \* | awk -F" " {'print $2'}`
24echo "Density is $density g/cm^3"
25
26exit 0
Note: See TracBrowser for help on using the repository browser.