#!/bin/sh
#
# This script runs TALYS in each /org directory
# and creates in each sample directory a directory new
#
files=`find . -name input | grep org`
homedir=`pwd`
#
for  f  in  ${files}
do
   dir=`dirname ${f}`
   cd ${dir}
   pwd
	rm -r ../new
	mkdir -p ../new
	cp ${homedir}/${dir}/input ../new
	if [ -f energies ] ; then
	   cp ${homedir}/${dir}/energies ../new
	fi
	if [ -f omp241am.neu ] ; then
	   cp ${homedir}/${dir}/omp241am.neu ../new
	fi
	if [ -f pb.omp ] ; then
	   cp ${homedir}/${dir}/pb.omp ../new
	fi
	talys<input>output
   cd $homedir
done
