1#!/bin/sh
2
3# run from directory where this script is
4cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
5EXAMPLE_DIR=`pwd`
6
7# check whether echo has the -e option
8if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi
9
10$ECHO
11$ECHO "$EXAMPLE_DIR : starting"
12$ECHO
13$ECHO "This example shows how to use the FFTTXlib library to perform"
14$ECHO "3D Fourier transform in a scalar and parallel setup."
15
16# set the needed environment variables
17. ../../environment_variables
18
19# required executables and pseudopotentials
20BIN_LIST="fft_test0.x fft_test.x"
21
22BIN_DIR="../../"
23
24$ECHO
25$ECHO "  executables directory: $BIN_DIR"
26$ECHO "  checking that needed directories and files exist...\c"
27
28# check for directories
29for DIR in "$BIN_DIR" ; do
30    if test ! -d $DIR ; then
31        $ECHO
32        $ECHO "ERROR: $DIR not existent or not a directory"
33        $ECHO "Aborting"
34        exit 1
35    fi
36done
37for DIR in "$TMP_DIR" "$EXAMPLE_DIR/results" ; do
38    if test ! -d $DIR ; then
39        mkdir $DIR
40    fi
41done
42cd $EXAMPLE_DIR/results
43
44# check for executables
45for FILE in $BIN_LIST ; do
46    if test ! -x $BIN_DIR/$FILE ; then
47        $ECHO
48        $ECHO "ERROR: $BIN_DIR/$FILE not existent or not executable"
49        $ECHO "Aborting"
50        exit 1
51    fi
52done
53
54$ECHO " done"
55
56# how to run executables
57PW_COMMAND="$PARA_PREFIX $BIN_DIR/fft_test0.x $PARA_POSTFIX"
58$ECHO "$PARA_PREFIX $BIN_DIR/fft_test0.x   >  fft_test0.out "
59$PARA_PREFIX $BIN_DIR/fft_test0.x   >  fft_test0.out
60
61$ECHO
62$ECHO "$EXAMPLE_DIR : done"
63