@SET Project        H28
@SET V_bias_volt    0.0
@SET Temperature    10.0
# The following two parameters are computed automatically during the NEGF run.
# You can use keywords 'FERMI_LEVEL' to give this value and skip calculation
# or 'FERMI_LEVEL'+'REFINE_FERMI_LEVEL' to compute starting from this value.
# If 'FERMI_LEVEL' is not given, it is calculated automatically.
# 'V_SHIFT' is used to give initial value.
@SET Fermi_level   -0.22306314
@SET V_shift        0.00011054
@SET basis_set_path BASIS_SET
! BASIS_MOLOPT BASIS_SET
@SET potential_path GTH_POTENTIALS
@SET xc_functional  pade
!PBE pade
@SET cutoff         100
@SET added_mos      -1
@SET max_scf        50
@SET eps_scf        1e-8
@SET lx             6.0
@SET ly             6.0
!---------------------------------------------------------------------------------------------------
&GLOBAL
  EXTENDED_FFT_LENGTHS .true.
  PREFERRED_DIAG_LIBRARY SL
  PRINT_LEVEL LOW  #SILENT #LOW #MEDIUM #HIGH #DEBUG
  PROJECT ${Project}
  RUN_TYPE NEGF
&END GLOBAL

&NEGF
  # Integration lower bound (in Hartree)
  ENERGY_LBOUND -2.0
  !clenshaw-curtis simpson
  # Maximum error in each matrix element of the density matrix
  EPS_DENSITY 1e-5
  # 'simpson' is slower, but works without FFTW3 library
  # clenshaw-curtis is faster, but requires FFTW3 library
  INTEGRATION_METHOD simpson
  !EPS_SCF        1e-5
  MAX_SCF 100
  # Number of parallel processes per energy point.
  # 'NPROC_POINT 1' means that if you run this job using 8 MPI processes,
  # than Green's functions at up to 8 (8 / NPROC_POINT) energy points
  # will be computed simultaneously.
  #
  NPROC_POINT 1
  !EPS_GREEN      1e-5
  !ETA            1e-7
  # Boundary conditions define solution of the Poisson equation up to
  # an additive constant, which affects Hamiltonian matrix elements within
  # the NEGF procedure. The following parameters control evaluation of
  # the correct shift in Hartree potential:
  #   * V_SHIFT           -- initial guess for the shift
  #   * V_SHIFT_MAX_ITERS -- maximal number of iterations
  V_SHIFT ${V_shift}
  V_SHIFT_MAX_ITERS 100
  &CONTACT
    ELECTRIC_POTENTIAL [eV] ${V_bias_volt}/2
    FERMI_LEVEL ${Fermi_level}
    REFINE_FERMI_LEVEL
    TEMPERATURE [K] ${Temperature}
    &BULK_REGION
      # Atomic indices (and/or names of molecular fragments) that belong to the electrode contact region.
      !MOLNAME L1 L2
      LIST 1..8
      # List of atoms that belong to the primary and secondary unit cells of the 1st contact.
      # Primary and secondary unit cells can be defined in any order.
      # They should be adjusted to each other and should not overlap.
      #
      # As matrix blocks should correspond to ones for the electrode contact region,
      # in actual calculation you may want to use a longer chain, e.g.
      #    L1    L2    L3    L4    L5    L6 .
      #              cell1  cell2
      # Alternatively, instead of the below CELL sections, a separate bulk FORCE_EVAL section
      # for the contact can be set up and the keyword FORCE_EVAL_SECTION should be set accordingly
      # (see the test file regtest-negf-2/H28_k.inp).
      &CELL
        !MOLNAME L1
        LIST 1..4
      &END CELL
      &CELL
        !MOLNAME L2
        LIST 5..8
      &END CELL
    &END BULK_REGION
    &SCREENING_REGION
      !MOLNAME L0
      LIST 9..12
    &END SCREENING_REGION
  &END CONTACT
  &CONTACT
    ELECTRIC_POTENTIAL [eV] -${V_bias_volt}/2
    FERMI_LEVEL ${Fermi_level}
    REFINE_FERMI_LEVEL
    TEMPERATURE [K] ${Temperature}
    # the second semi-infinite electrode
    &BULK_REGION
      MOLNAME R1 R2
      &CELL
        MOLNAME R1
      &END CELL
      &CELL
        MOLNAME R2
      &END CELL
    &END BULK_REGION
    &SCREENING_REGION
      MOLNAME R0
    &END SCREENING_REGION
  &END CONTACT
  # Density mixing is not needed in zero-bias case, as NEGF self-consistent
  # procedure will converge in one iteration. However, when an external bias
  # is applied, a density mixing scheme in inverse space is typically
  # much stable then the default direct mixing of new and old density matrices.
  &MIXING
    ALPHA 0.2
    METHOD broyden_mixing
    NBUFFER 8
  &END MIXING
  &PRINT
    &DOS
      FILENAME device
      FROM_ENERGY [eV] -15
      N_GRIDPOINTS 401
      TILL_ENERGY [eV] 15
    &END DOS
    &PROGRAM_RUN_INFO low
      PRINT_LEVEL debug
      ! high debug
    &END PROGRAM_RUN_INFO
    &TRANSMISSION
      FILENAME transm
      FROM_ENERGY [eV] -15
      N_GRIDPOINTS 401
      TILL_ENERGY [eV] 15
    &END TRANSMISSION
  &END PRINT
  &SCATTERING_REGION
    MOLNAME S
    !LIST 13..16
  &END SCATTERING_REGION
  #DISABLE_CACHE
&END NEGF

&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME ${basis_set_path}
    POTENTIAL_FILE_NAME ${potential_path}
    &MGRID
      CUTOFF ${cutoff}
    &END MGRID
    &POISSON
      PERIODIC xyz
    &END POISSON
    &PRINT
      &DOS
        NLUMO -1
        &PDOS
          COMPONENTS T
        &END PDOS
      &END DOS
    &END PRINT
    &SCF
      !atomic restart
      ADDED_MOS ${added_mos}
      EPS_SCF ${eps_scf}
      MAX_SCF ${max_scf}
      SCF_GUESS restart
      &MIXING
        ALPHA 0.3
        METHOD broyden_mixing
        NBUFFER 8
      &END MIXING
      &PRINT
        &RESTART
          FILENAME RESTART
        &END RESTART
        #&PROGRAM_RUN_INFO silent
        #&END
        #&DETAILED_ENERGY silent
        #&END
      &END PRINT
      &SMEAR
        ELECTRONIC_TEMPERATURE [K] ${Temperature}
        METHOD fermi_dirac
      &END SMEAR
    &END SCF
    &XC
      &XC_FUNCTIONAL ${xc_functional}
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC ${lx} ${ly} 42.
      PERIODIC xyz
    &END CELL
    &COORD
      H        0.00000000       0.00000000       0.00000000 L2
      H        0.00000000       0.00000000       1.50000000 L2
      H        0.00000000       0.00000000       3.00000000 L2
      H        0.00000000       0.00000000       4.50000000 L2
      H        0.00000000       0.00000000       6.00000000 L1
      H        0.00000000       0.00000000       7.50000000 L1
      H        0.00000000       0.00000000       9.00000000 L1
      H        0.00000000       0.00000000      10.50000000 L1
      H        0.00000000       0.00000000      12.00000000 L0
      H        0.00000000       0.00000000      13.50000000 L0
      H        0.00000000       0.00000000      15.00000000 L0
      H        0.00000000       0.00000000      16.50000000 L0
      H        0.00000000       0.00000000      18.00000000 S
      H        0.00000000       0.00000000      19.50000000 S
      H        0.00000000       0.00000000      21.00000000 S
      H        0.00000000       0.00000000      22.50000000 S
      H        0.00000000       0.00000000      24.00000000 R0
      H        0.00000000       0.00000000      25.50000000 R0
      H        0.00000000       0.00000000      27.00000000 R0
      H        0.00000000       0.00000000      28.50000000 R0
      H        0.00000000       0.00000000      30.00000000 R1
      H        0.00000000       0.00000000      31.50000000 R1
      H        0.00000000       0.00000000      33.00000000 R1
      H        0.00000000       0.00000000      34.50000000 R1
      H        0.00000000       0.00000000      36.00000000 R2
      H        0.00000000       0.00000000      37.50000000 R2
      H        0.00000000       0.00000000      39.00000000 R2
      H        0.00000000       0.00000000      40.50000000 R2
      #    H        0.00000000       0.00000000      42.00000000 R3
      #    H        0.00000000       0.00000000      43.50000000 R3
      #    H        0.00000000       0.00000000      45.00000000 R3
      #    H        0.00000000       0.00000000      46.50000000 R3
    &END COORD
    &KIND H
      BASIS_SET SZV-GTH-PADE
      ! SZV-GTH-PADE DZV-ALL-PADE DZVP-ALL-PADE SZV-MOLOPT-GTH
      POTENTIAL GTH-PADE-q1
      !GTH-PADE-q1 GTH-PBE-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL
