#!/bin/sh
#
#BSUB -a intelmpi			# Bu satiri silmeyin
#BSUB       			# LSF stdout dosyasi ismi .%J.out
#BSUB  			# LSF stderr dosyasi ismi .%J.err
#BSUB -q salim.ciraci.q			# kuyruk ismi 
#BSUB -m karadeniz_e1			# -m unam_bladez OR -m n_anadolu
#BSUB -n 8        			# islemci sayisi 4 8 16 32
#BSUB -R "span[ptile=8]"		#
#BSUB -J a8-b2-yb 				# LSF is ismi
ncpu=8
################################################################################



mkdir cont   # read the comment at he end of this script.

for i in `seq -w 0.0 2.5 5.0`  
do


cp -r cont $i
cd $i
cp ../*.psf .
cp ../elec.TSHS .
cp ../POSITIONS.fdf .

cat > INPUT.fdf <<EOF
SystemName    scat                                                                                                                     
SystemLabel   scat

%block kgrid_Monkhorst_Pack
  1   0   0    0.0
  0   1   0    0.0
  0   0   3    0.0
%endblock kgrid_Monkhorst_Pack


xc.functional           GGA                     
xc.authors              PBE                     

MeshCutoff              300.00000000 Ry 
SolutionMethod Transiesta                       
OccupationFunction      MP                      
ElectronicTemperature   300 K                   

SpinPolarized           F                       
FixSpin                 F                       

MaxSCFIterations        1000                    
#DM.Tolerance           1.d-5                   
DM.NumberPulay          6                       
DM.NumberBroyden        0                       
DM.MixingWeight         0.1000000000            
DM.OccupancyTolerance   0.1000000000E-11        
DM.NumberKick           0                       
DM.KickMixingWeight     0.5000000000            
DM.Tolerance            0.1000000000E-03        

UseSaveData             T                       
                  
MD.NumCGsteps           0                        
MD.TypeOfRun            CG                       
MD.VariableCell         F                        
MD.MaxCGDispl           0.2000000000  Bohr       
MD.MaxForceTol          0.05 eV/Ang              
#MD.MaxStressTol         0.0001 eV/Ang**3        


Diag.ParallelOverK      F                                                
PAO.EnergyShift         50 meV                    
PAO.SplitNorm           0.1500000000              
PAO.BasisType           split                     
PAO.BasisSize           SZP          
                          

WriteMullikenPop                0
WriteBands                      F
SaveRho                         F
SaveElectrostaticPotential      F
SaveTotalPotential              F
WriteCoorXmol                   T


                                                                                                                               
%block ChemicalSpeciesLabel
    1  6 C-GGA
%endblock ChemicalSpeciesLabel 

%include POSITIONS.fdf


# Transiesta information
SolutionMethod Transiesta 
# GENGF OPTIONS
TS.ComplexContour.Emin        -28 eV 
TS.ComplexContour.NPoles       16
TS.ComplexContour.NCircle      16
TS.ComplexContour.NLine        10 
# BIAS OPTIONS
TS.biasContour.NumPoints       10


# TS OPTIONS
TS.Voltage $i  eV

# TBT OPTIONS
TS.TBT.Emin -3 eV
TS.TBT.Emax +3 eV
TS.TBT.NPoints 500
TS.TBT.NEigen 3
TS.TBT.Eta        0.000001 Ry

# Write electrode hamiltonian
TS.SaveHS   .true.
TS.SaveLead .true.



# LEFT ELECTRODE
TS.HSFileLeft  ./elec.TSHS 
TS.NumUsedAtomsLeft   14
TS.BufferAtomsLeft    14

# RIGHT ELECTRODE
TS.HSFileRight  ./elec.TSHS 
TS.NumUsedAtomsRight  14
TS.BufferAtomsRight   14

==================================================
==================================================

EOF


/root/Desktop/siesta/Obj/transiesta < INPUT.fdf  | tee OUTPUT.fdf 


cd ..
rm -rf cont 
mkdir cont

cp  ./$i/scat.TSDE ./$i/scat.TSHS ./$i/scat.DM  cont  # copy these files for continuation of the next bias step.



done

