Last change
on this file since 41c2f1 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:
578 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # calculates mass of a molecule in a XYZ file
|
---|
4 |
|
---|
5 | ELEMENTSDB="/home/heber/workspace/ESPACK/bin/elements.db"
|
---|
6 |
|
---|
7 | if [ -z "$1" ]; then
|
---|
8 | echo "Usage $0 <XYZ file>"
|
---|
9 | exit 1
|
---|
10 | else
|
---|
11 | XYZ="$1"
|
---|
12 | fi
|
---|
13 |
|
---|
14 | elements=(`grep -v ^# ${ELEMENTSDB} | awk -F" " {'print $2'}`)
|
---|
15 | masses=(`grep -v ^# ${ELEMENTSDB} | awk -F" " {'print $7'}`)
|
---|
16 |
|
---|
17 | i=0
|
---|
18 | totalmass=0
|
---|
19 | while [ $i -lt ${#elements[*]} ]; do
|
---|
20 | nr=`grep -E "^${elements[$i]}[[:space:]]+" $XYZ | wc -l`
|
---|
21 | totalmass=`echo "$totalmass $nr ${masses[$i]}" | awk -F" " {'print $1+$2*$3'}`
|
---|
22 | let i=$i+1
|
---|
23 | done
|
---|
24 |
|
---|
25 | echo "Totalmass is $totalmass atomicunits"
|
---|
26 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.