1#!/bin/sh
2
3##set -x
4#
5# Run "partial atom" example
6#
7# Argument: SIESTA execution string
8#
9# Optional environmental SYMBOL:  OBJDIR
10# This is essential if the argument 'SIESTA' does not refer to a typical installation
11#
12# The script is passed the (probably relative) path to the siesta
13# executable, and maybe with a "mpirun" prefix
14#
15SIESTA="$1"
16#
17# Now we try to guess how to build the 'fractional' executable in Util
18
19# Extract last component of the executable, in case of mpirun-style string
20REL_PATH=$(echo ${SIESTA} | awk '{print $NF}')
21EXEC_PREFIX=$(echo ${SIESTA} | awk '{$NF=""; print}')
22REL_PATH=$(which ${REL_PATH})
23NAME=$(basename ${REL_PATH})
24EXEC_DIR=$(dirname ${REL_PATH})
25#
26# Find absolute path -------
27pushd ${EXEC_DIR} ; ABS_EXEC_DIR=$(pwd) ; popd
28#---------------------------
29ABS=${ABS_EXEC_DIR}/${NAME}
30COMPILATION_DIR=$(basename ${ABS_EXEC_DIR})
31echo "Running script with SIESTA=$EXEC_PREFIX $ABS"
32#
33# Make sure we can use the program location info...
34# Use the sentinel .siesta file in modern versions
35#
36if [  -f $ABS_EXEC_DIR/.siesta ] ; then
37    OBJDIR=${OBJDIR:-$COMPILATION_DIR}
38else
39    if [ -z $OBJDIR ] ; then
40      echo "${ABS_EXEC_DIR} does not look like a compilation dir"
41      echo "Need to specify OBJDIR"
42      exit
43    fi
44fi
45echo "Using OBJDIR=$OBJDIR to build 'fractional'"
46#
47
48fractional=../../../../Util/VCA/fractional
49#
50cp ../../Pseudos/O.psf .
51
52## if [ ! -x $fractional ] ; then
53# Compile always
54  echo "Compiling $fractional..."
55  (cd ../../../../Util/VCA ; make OBJDIR="$OBJDIR" clean fractional) > /dev/null
56##   echo -n "Please compile 'fractional' in "
57##   echo "Util/VCA before running this test"
58##   exit 1
59##fi
60
61echo "==> Running $fractional"
62$fractional O  0.5
63
64#
65cat > Job.fdf << EOF
66SystemName          Oxypartial
67SystemLabel         oxypartial
68NumberOfAtoms       2
69NumberOfSpecies     1
70
71MeshCutoff 200 Ry
72
73%block ChemicalSpeciesLabel
74 1  201  O-Fraction-0.50000      # Species index, atomic number, species label
75%endblock ChemicalSpeciesLabel
76%block SyntheticAtoms
77 1  
78 2 2 3 4
79 1.0 2.0 0.0 0.0
80%endblock SyntheticAtoms
81
82%block PAO.basis
83O-Fraction-0.50000  2                 # Species label, number of l-shells
84 n=2   0   2                         # n, l, Nzeta 
85 0.0 0.0   
86   1.000      1.000   
87 n=2   1   2 P   1                   # n, l, Nzeta, Polarization, NzetaPol
88   4.139      2.740   
89   1.000      1.000   
90%endblock PAO.Basis
91
92DM.NumberPulay 4
93
94Spin.Polarized T
95
96AtomicCoordinatesFormat  Ang
97%block AtomicCoordinatesAndAtomicSpecies
98 0.000  0.000  0.000  1
99 0.000  0.000  1.200  1
100%endblock AtomicCoordinatesAndAtomicSpecies
101
102MD.TypeOfRun Broyden
103MD.NumCGSteps 40
104EOF
105#
106echo "==> Running $SIESTA"
107$SIESTA < Job.fdf > Job.out
108cp Job.out ../partial.out
109
110