@SET project      li_chain

@SET v_bias_volt  0.0
@SET temperature  293.0

# The following two parameters are computed automatically during the NEGF run.
# You can uncomment keywords 'FERMI_LEVEL' and 'V_SHIFT' to skip these stages.
@SET fermi_level -0.08987575
@SET v_shift      0.00280782

@SET basis_set_path BASIS_MOLOPT
@SET potential_path GTH_POTENTIALS
@SET basis_set_li   SZV-MOLOPT-SR-GTH
@SET potential_li   GTH-PADE-q3

@SET xc_functional  pade

@SET cutoff         80
@SET added_mos      100
@SET max_scf        50
@SET eps_scf        1e-4

@SET lx             5.0
@SET ly             5.0

&GLOBAL
  PROJECT              ${project}
  RUN_TYPE             negf
  PRINT_LEVEL          low
  EXTENDED_FFT_LENGTHS .true.
&END GLOBAL

&NEGF
   &CONTACT
      &BULK_REGION
         # Atomic indices (and/or names of molecular fragments) that belong to the bulk contact region.
         MOLNAME L1 L2

         # List of atoms that belong to the primary and secondary bulk 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 bulk contact,
         # 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-fft/li_chain_kp.inp).
         &CELL
            MOLNAME L1
         &END CELL

         &CELL
            MOLNAME L2
         &END CELL
      &END
      &SCREENING_REGION
         MOLNAME L0
      &END

      FERMI_LEVEL  ${fermi_level}

      ELECTRIC_POTENTIAL [eV] ${v_bias_volt}/2
      TEMPERATURE [K] ${temperature}
    &END CONTACT

    &CONTACT
      # the second semi-infinite electrode

      &BULK_REGION
         MOLNAME R1 R2

         &CELL
            MOLNAME R1
         &END CELL

         &CELL
            MOLNAME R2
         &END CELL
      &END

      &SCREENING_REGION
         MOLNAME R0
      &END

      FERMI_LEVEL  ${fermi_level}

      ELECTRIC_POTENTIAL [eV] -${v_bias_volt}/2
      TEMPERATURE [K] ${temperature}
    &END CONTACT

    &SCATTERING_REGION
       MOLNAME S
    &END SCATTERING_REGION

    # 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

    # Integration lower bound (in Hartree)
    ENERGY_LBOUND -2.0

    # slower, but works without FFTW3 library
    INTEGRATION_METHOD simpson

    # Maximum error in each matrix element of the density matrix
    EPS_DENSITY    1e-5

    MAX_SCF        16

    # 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   20

    &PRINT
       &DOS
          FILENAME device
          FROM_ENERGY -0.2
          TILL_ENERGY  0.1
          N_GRIDPOINTS 301
       &END
       &TRANSMISSION
          FILENAME transm
          FROM_ENERGY -0.2
          TILL_ENERGY  0.1
          N_GRIDPOINTS 301
       &END
    &END

    # 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
&END NEGF

&FORCE_EVAL
  METHOD Quickstep

  &DFT
    BASIS_SET_FILE_NAME ${basis_set_path}
    POTENTIAL_FILE_NAME ${potential_path}

    &MGRID
      CUTOFF ${cutoff}
    &END MGRID

    &SCF
      MAX_SCF   ${max_scf}
      EPS_SCF   ${eps_scf}
      SCF_GUESS atomic
      ADDED_MOS ${added_mos}

      &SMEAR
         ELECTRONIC_TEMPERATURE [K] ${temperature}
         METHOD fermi_dirac
      &END SMEAR

      &MIXING
         ALPHA   0.3
         METHOD  broyden_mixing
         NBUFFER 8
      &END MIXING

      &PRINT
         &RESTART
            FILENAME RESTART_0
         &END RESTART
      &END PRINT
    &END SCF

    &POISSON
       PERIODIC xyz
    &END POISSON

    &XC
      &XC_FUNCTIONAL ${xc_functional}
      &END XC_FUNCTIONAL
    &END XC
  &END DFT

  &SUBSYS
    &CELL
      ABC    ${lx} ${ly} 83.720
      PERIODIC xyz
    &END CELL

    &COORD
 Li            0.00000000           0.00000000           0.00000000 L2
 Li            0.00000000           0.00000000           2.99000000 L2
 Li            0.00000000           0.00000000           5.98000000 L2
 Li            0.00000000           0.00000000           8.97000000 L2
 Li            0.00000000           0.00000000          11.96000000 L1
 Li            0.00000000           0.00000000          14.95000000 L1
 Li            0.00000000           0.00000000          17.94000000 L1
 Li            0.00000000           0.00000000          20.93000000 L1
 Li            0.00000000           0.00000000          23.92000000 L0
 Li            0.00000000           0.00000000          26.91000000 L0
 Li            0.00000000           0.00000000          29.90000000 L0
 Li            0.00000000           0.00000000          32.89000000 L0
 Li            0.00000000           0.00000000          35.88000000 S
 Li            0.00000000           0.00000000          38.87000000 S
 Li            0.00000000           0.00000000          41.86000000 S
 Li            0.00000000           0.00000000          44.85000000 S
 Li            0.00000000           0.00000000          47.84000000 R0
 Li            0.00000000           0.00000000          50.83000000 R0
 Li            0.00000000           0.00000000          53.82000000 R0
 Li            0.00000000           0.00000000          56.81000000 R0
 Li            0.00000000           0.00000000          59.80000000 R1
 Li            0.00000000           0.00000000          62.79000000 R1
 Li            0.00000000           0.00000000          65.78000000 R1
 Li            0.00000000           0.00000000          68.77000000 R1
 Li            0.00000000           0.00000000          71.76000000 R2
 Li            0.00000000           0.00000000          74.75000000 R2
 Li            0.00000000           0.00000000          77.74000000 R2
 Li            0.00000000           0.00000000          80.73000000 R2
    &END COORD

    &KIND Li
      BASIS_SET ${basis_set_li}
      POTENTIAL ${potential_li}
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

