#!/bin/bash
# 
# Parallel script produced by bolt
#        Resource: ARCHER2 (HPE Cray EX (128-core per node))
#    Batch system: Slurm
#
# bolt is written by EPCC (http://www.epcc.ed.ac.uk)
#
#SBATCH --nodes=4
#SBATCH --tasks-per-node=128
#SBATCH --cpus-per-task=1
#SBATCH --job-name=p_-8.5
#SBATCH --account=e89-ic_m
#SBATCH --partition=standard
#SBATCH --qos=standard
#SBATCH --time=06:0:0
module  load castep
pre='-8'
for p in $pre
do

###########################################################################


cp TiO2_unit_geom.$p-out.cell TiO2_unit_phonon.$p.cell

cat >> TiO2_unit_phonon.$p.cell << EOF
phonon_kpoint_mp_grid 7 7 13
%BLOCK PHONON_fine_KPOINT_LIST
`awk '{print $1 FS $2 FS $3 FS}' qpoint.dat`
%ENDBLOCK PHONON_fine_KPOINT_LIST
snap_to_symmetry
EOF

cat > TiO2_unit_phonon.$p.param << EOF
task PHONON+EFIELD
iprint : 2
continuation : default
PHONON_SUM_RULE_METHOD : none
PHONON_CALC_LO_TO_SPLITTING : FALSE
PHONON_FINE_METHOD : INTERPOLATE
cut_off_energy    : 1350 eV
opt_strategy      : speed
num_dump_cycles   : 0
xc_functional     : LDA
elec_energy_tol : 1.0e-12 ev
ELEC_EIGENVALUE_TOL : 1.0e-12 eV
ELEC_FORCE_TOL : 1e-6 eV/ang
PHONON_ENERGY_TOL : 1.0e-6 eV/ang**2
EFIELD_ENERGY_TOL : 1.0e-6 ang**3
fix_occupancy : true
MAX_SCF_CYCLES : 600
EFIELD_MAX_CYCLES : 600
PHONON_MAX_CYCLES : 600
EOF
srun --distribution=block:block --hint=nomultithread castep.mpi TiO2_unit_phonon.$p
cp TiO2_unit_phonon.$p.castep 15.15.15.$p.castep
done
