#!/bin/sh

BIN_DIR=/apps/spack/bell/apps/quantum-espresso/6.6-gcc-9.3.0-52dru3i/bin
PSEUDO_DIR=/scratch/bell/tay2/QE-Simulations/pseudo/potpaw_PBE/ 
MYPWD=/scratch/bell/tay2/Ti2C_r3m/r3m_ECo1
TMP_DIR=${MYPWD}/tmp 
EXAMPLE_DIR=/scratch/bell/tay2/Ti2C_r3m/r3m_ECo1
PW_COMMAND=$BIN_DIR/pw.x

cd $EXAMPLE_DIR

# self-consistent calculation at Gamma
cat > si_scf_head.in << EOF
&control
    calculation = 'scf'
    title='r_3m'
    prefix='r_3m',
    pseudo_dir = '$PSEUDO_DIR',
    outdir='$TMP_DIR',

 /
 &system
    ibrav=  2, a= 3.087, b= 3.087, c= 14.471, nat= 9, ntyp= 2,
    ecutwfc= 50.0, ecutrho=200.0, occupations='smearing', 
    degauss=0.01, edir=3, eamp=0.0, eopreg=0.1, emaxpos=0.6,  
 /
 &electrons
 /
ATOMIC_SPECIES
Ti 47.86700  Ti.pbe-spn-kjpaw_psl.1.0.0.UPF
C  12.01100  C.pbe-n-kjpaw_psl.1.0.0.UPF

ATOMIC_POSITIONS angstrom
Ti            0.0000000000        0.0000000000        0.2459090000
Ti            0.6666670000        0.3333330000        0.0874240000
Ti            0.6666670000        0.3333330000        0.5792420000
Ti            0.3333330000        0.6666670000        0.4207580000
Ti            0.3333330000        0.6666670000        0.9125760000
Ti            0.0000000000        0.0000000000        0.7540910000
C             0.3333330000        0.6666670000        0.1666670000
C             1.0000000000        1.0000000000        0.5000000000
C             0.6666670000        0.3333330000        0.8333330000

K_POINTS {automatic}
 2  2  2  0 0 0

EOF

$PW_COMMAND < si_scf_head.in > si_scf_head.out 
