Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 
name=amin+'(IT-1)'*delta | bc
a0=4.0 | bc

while  [ $IT -le $MAXIT ] ; 


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 ..

I tried this but not working :(

share|improve this question
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

You must log in to answer this question.

Browse other questions tagged .