#!/bin/tcsh

setenv FeffPath /home/fer/src/Feff/f9_develop/feff90/bin/MPI

# Create a hosts file
cat > mpd.hosts << END
n7
n8
n9
n10
END

# Calculate the number of daemons
setenv NDAEMONS `wc -l mpd.hosts | sed 's/ .*$//g'`

# Start the daemons
mpdboot -n $NDAEMONS -f mpd.hosts

# Number of Processors
setenv NP 16

mpiexec -n $NP $FeffPath/rdinp   >&  feff.log
mpiexec -n $NP $FeffPath/dmdw    >>& feff.log
mpiexec -n $NP $FeffPath/atomic  >>& feff.log
mpiexec -n $NP $FeffPath/pot     >>& feff.log
mpiexec -n $NP $FeffPath/ldos    >>& feff.log
mpiexec -n $NP $FeffPath/screen  >>& feff.log
mpiexec -n $NP $FeffPath/xsph    >>& feff.log
mpiexec -n $NP $FeffPath/fms     >>& feff.log
mpiexec -n $NP $FeffPath/mkgtr   >>& feff.log
mpiexec -n $NP $FeffPath/path    >>& feff.log
mpiexec -n $NP $FeffPath/genfmt  >>& feff.log
mpiexec -n $NP $FeffPath/ff2x    >>& feff.log
mpiexec -n $NP $FeffPath/sfconv  >>& feff.log
mpiexec -n $NP $FeffPath/eels    >>& feff.log

# Quit all the daemons
mpdallexit

