Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Hi I want to write a shell script for energy and volume calculations for different lattice constants. For convergence of energy,using siesta. can anyone help I tried this work manually but now want to write a shell program,using sed commands. I tried a lot but not succeeded.

please tell me the shorter way. I may take Lattice constant from 3.60 to 4.40 and SZ plorizations for MgO.

#!/usr/bin/env bash 
SIESTA=~code/sanabin/siesta
#
#
name=amin+'(IT-1)'*delta | bc
a0=4.0 | bc
amin==0.92*$a0
amax=1.10*$a0
IT=1
MAXIT=5
MAXITm1=$MAXIT-1
delta=($amax-$amin)/$MAXITm1

#
while  [ $IT -le $MAXIT ] ; 

#
do

mkdir $name
cp input.fdf $name
cp *.psf $name
cd $name
sed 's/LatticeConstant "Ang"/$name/' <input.fdf>name.fdf
$SIESTA < $name.fdf > $name.out
Total=$(grep 'siesta:         Total =' out | cut -c25-40)
#---------
cd ..
done
exit

I tried this but not working :(

share|improve this question
2  
This question is offtopic here. It would be on topic on Stack Overflow and we could migrate it, but not in its current form. Journeyman Geek fixed your formatting, but the first paragraph is still completely unreadable. Please improve it, then we'll attempt to migrate it. –  gronostaj Oct 8 '13 at 10:32
    
I don't know the working of your real question, but i found some mistakes in your script they are 1) name=amin+'(IT-1)'*delta | bc – here the amin will be a variable so you must use $amin name=$($amin+'(IT-1)'*delta | bc). 2) replace the line delta=($amax-$amin)/$MAXITm1 as delta=$(($amax-$amin)/$MAXITm1). –  mailer Dec 23 '13 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.