### This is generated by ctrlgenM1.py from ctrls 

###  Try "lmf-MPIK --help", to see all effective category and token.
###
###  CAUTION: For GW calculations, you have to generate GWinput by mkGWIN_lmf2.
###          Repeat it when you change MTO settings ---> <PRODUCTBASIS> section is affected
###
VERS    LM=7 FP=7        # version check. Fixed.

IO      SHOW=T VERBOS=35 TIM=0,0 #Use TIM=3,3 or more for debug (to show which routines go through).
             # SHOW=T shows readin data (and default setting at the begining of console output)
         # It is useful to check ctrl is read in correctly or not (equivalent with --show option).
         # larger VERBOSE gives more detailed console output.

SYMGRP find   # 'find' evaluate space-group symmetry (just from lattice) automatically.
              #
              # Usually 'find is OK', but lmf may use lower symmetry
          # if you did not supply accurate structure.
              # 'lmchk foobar --pr60' shows, what symmetry is recognized.
              # See file://Document/Manual/CaterogyAndToken.org
              # To read its results.
              # If symmetry of electronic system has lower symmetry than the lattice symmetry,
              # we need to choose lower symmetry than 'find' gives.

%const kmxa=5  # =radial degree of freedom to expand eigenfuncitons in tail sites.
               #  kmxa=5 is good for pwemax \sim 4 or less.
               # larger kmxa is better but time-consuming. A rule of thumb: kmxa>pwemax in Ry.

               # Enlarge this, when your enlarge pwemax, and check little dependence on kmxa. 
#id  = C
%const bohr=0.529177 a= 3.56683/bohr
STRUC
     ALAT={a} 
     PLAT=0 0.5 0.5  0.5 0 0.5  0.5 0.5 0 
     NL=4  NBAS= 2  NSPEC=1
SITE
     ATOM=C POS=0.0 0.0 0.0
     ATOM=C POS=0.25 0.25 0.25
SPEC
    ATOM=C Z=6 R=1.42
      EH=-1 -1 -1  RSMH=0.71 0.71 0.71 
      EH2=-2 -2  RSMH2=0.71 0.71 
      KMXA={kmxa}  LMX=3 LMXA=4 NMCORE=1
      #MMOM=0 0 1 0 #s,p,d,f initial condition
      #NOTE: lmfa(rhocor) generates spin-averaged rho for any MMOM,jun2012
      #Q=0 0.5 1 0 #s,p,d,f initial condition 
      #MMOM and Q are to set electron population. grep conf: in lmfa output



% const pwemax=3 nk1=8 nk2=8 nk3=8 nit=80  gmax=12  nspin=1 metal=3 so=0 xcfun=1 ssig=.8 tetra=T 
BZ    #ZBAK=0.1 For exmple, at Si ZBAK=0.1 gives 8-0.1=7.9 total electrons
      NKABC={nk1} {nk2} {nk3} # division of BZ for q points.
      METAL={metal}
                # METAL=3 is safe setting (double path method but not repeat diagonalization), 
                # no problem even for insulator.
                # For insulator, METAL=0 may be a little faster.

              DOSMAX=1.5 NPTS=2001 SAVDOS=T
                # These are used to plot total dos, and pdos.
                # DOSMAX: is the maximum of the total dos plot. It is relative to the Fermi energy.
                #   Corresponding mimimum is automatically chosen to cover all valence states.
                # NPTS: division of plots. To get a high-energy resolution plot, use large NPTS.
                #
        # To get better plot, Use large NKABC (even after converged).
                # Larger NKABC may give smoother plot. Use large enough NKABC.
                #
                # NOTE: current version automatically enfoce TETRA=T and MEAL=3 for --pdos and --tdos
                # ---TOTAL DOS plot---      
                # you can use job_tdos_nspin*.
                # It just do lmf --tdos foobar; then you have dos.tot.foobar, and we can plot it.
                #  
                # --- PDOS plot --
                # you can do folloings by job_pdos_nspin*
                # run lmf --pdos foobar  (this stops quickly, or write SYMOPS (only e) in it by hand.)
                #     echo 1| qg4gw      (this is needed to generate QGpsi for no symmetry).
                #     lmf --pdos foobar  (it is a little time-consuming since we do not use symmetry).
                #     lmdos --pdos foobar

             # KNOWN BUG: For a hydrogen in a large cell, METAL=0 for (NSPIN=2 MMOM=1 0 0) 
             # results in non-magnetic solution. Use METAL=3 for a while in this case.

      TETRA={tetra} N=-1 W=0.01 !FSMOM below W=0.01 means T=1573K (N=-1 means W is temperature in Ry.)
      #  are for molecules. No tetrahedron integration. (Smearing)
%const bzw=1e-4  fsmom=0.0
      #TETRA=0 
      #N=-1    #Negative is the Fermi distribution function W= gives temperature.
      #W=0.001 #W=0.001 corresponds to T=157K as shown in console output
               #W=0.01 is T=1573K. It makes stable convergence for molecule. 
               #Now you don't need to use NEVMX in double band-path method,
               #which obtain only eigenvalues in first-path to obtain integration weights
               #, and accumulate eigenfunctions in second path.

      #FSMOM={fsmom} real number (fixed moment method)
      #  FSMOM is for he fixed-spin moment method. 
      #  a spin-dependent potential shift is added to constrain the total magnetic moment to value 
      #  assigned by FSMOM=. Default is NULL (no FSMOM). FSMOM=0 works now (takao Dec2010)
      #  NOTE: current version is for ferro magnetic case (total mag moment) only.
      #FSMOMMETHOD=0 #only effective when FSMOM exists. #Added by t.kotani on Dec8.2010
      #  =0: original mode suitable for solids.(default)
      #  =1: discrete eigenvalue case. Calculate bias magnetic field from LUMO-HOMO gap for each spins.
      #      Not allowed to use together with HAM_SO=1 (L.S). 
      #      It seems good enough to use W=0.001. Smaller W= may cause instability.
      #For Molecule, you may also need to set FSMOM=n_up-n_dn, and FSMOMMETHOD=1 below.

      # NOINV=F (If F, we enfoce |psi_\sigma^fk|^2=|psi_\sigma^{-fk}|^2)
      #    usually judged automatically. So this is for debugging).
      # If NOINV=F, we assume H=H^* for each spin (k <-> -k symmetry). 
      #   This is the case in DFT without spin-orbit coupling.
      #   Then we use |psi_\sigma^fk|^2=|psi_\sigma^{-fk}|^2 to reduce comutational time.
      # If so/=0, lmf automatically sets NOINV=T.
      # You must get correct results evenif NOINV=T in the case of DFT without SO (for debug).
      #
      # WARN: Even if sigm exist, we use NOINV=F; exactly speaking, this is not correct.
      #       sigm without SO can cause orbital moments, that is, breaking time-reversal symmetry.
      # NOTE: because of inversion in space-group symmetry, we may have 
      #       |phi_sigm^fk|^2 = |phi_sigm^{-fk}|^2. This is not for NOINV.

ITER MIX=A5 b=.2 CONV=1e-5 CONVC=1e-5 NIT={nit} UMIX=0.2
#ITER MIX=B CONV=1e-6 CONVC=1e-6 NIT={nit}
                # MIX=A#1: Anderson mixing. #1 is the number to keep history
                # MIX=B#1: Broyden mixing (default). Unstable than Anderson mixing. But faseter. It works fine for sp bonded systems.
                #  See file://Document/Manual/CaterogyAndToken.org
                # b: is mixing ratio. smaller makes convergece path stable but slower

HAM   NSPIN={nspin}   # Set NSPIN=2 for spin-polarize case; then set SPEC_MMOM (initial guess of magnetic polarization).
      FORCES=0  # 0: no force calculation, 1: forces calculaiton 
      GMAX={gmax}   # this is for real space mesh. See GetStarted. (Real spece mesh for charge density).
                # Instead of GMAX, we can use FTMESH.
                # You need to use large enough GMAX to reproduce smooth density well.
                # Look into sugcut: shown at the top of console output. 
                # It shows required gmax for given tolelance HAM_TOL.
      REL=T     # T:Scaler relativistic, F:non rela.
      XCFUN={xcfun}
          # =1 for VWN.
                # =2 Birth-Hedin (if this variable is not set).
          #   (subs/evxc.F had a problem when =2 if rho(up)=0 or rho(down)=0).
                # =103 PBE-GGA

      PWMODE=1  # 0:  MTO basis only (LMTO) !2021feb. I set PWMODE=1 as default (for smooth bandplot). 
                # 1 : APW+MTO        (PMT)  !2022jun17 PWMODE=1 causes problem for QSGW
                #                           (even when PWMODE=1, I enforce PWMODE=11 for GWdriver mode --jobgw).
                # 2 : APW only              !   |G|cutoff 
                # 11: APW+MTO        (PMT)  ! |q+G|cutoff
                # 12: APW basis only (LAPW) ! |q+G|cutoff
                #
      PWEMAX={pwemax} # (in Ry). When you use larger pwemax more than 5, be careful
                      # about overcompleteness. In cases, e.g.Fe, you may need larger KMXA for larger PWEMAX.
                 # For sp-bonded solids, ELIND=-1 may give faster convergence.
                 # For O2 molecule, Fe, and so on, use ELIND=0(this is default).
      READP=T  # Read P,PZ values from results of atom calculation.
      PNUFIX=T # B.C. (phi'/phi) of radial functions are fixed.
      FRZWF=F #If T, fix augmentation function. This is worth to test in future. FRZWF=T may give not low-enough energy.
      #  See HAM_FRZWF, file://Document/Manual/CaterogyAndToken.org

      #For LDA+U calculation, see ecalj manual.

      RDSIG=12
      #For QSGW. you have to set them. Better to get some samples.
      # Now we use no cutoff procedure for Sigma-Vxc in lmf. (only in emax_sigm is effective in GWinput). 

      ScaledSigma={ssig} # ScaledSigma* \Sigma + (1-ScaledSigma)*Vxc^LDA
      # This is a RPA-level hybridyzation method, in contrast to the B3LYP (hartree-fock level hybridyzation)

      SO={so}   #default = 0 
      #Spin-orbit coupling (for REL=1)
      # 0 : no SO coupling
      # 1 : Add L.S to hamiltonian (but non-colinear density yet).
      # 2 : Add Lz.Sz only to hamiltonian
      #
      # For QSGW with SO=1 pertubation, run SO=1 with --rs=1,0 with NIT=1,
      #  starting from converged rst.* sigm.*  ESEAVR, and
      #  QpGpsi (it is easily generated by echo 1|qg4gw if you lost it).

      OVEPS=1d-8
      # nov2015 added. This is for removing poor linear-dependent basis in the diagonalization (H-eO)z=0
      # See cal zhev_tk3 in ecalj/lm7K/fp/bndfp.F. For using large pwemax, you may need to set OVEPS=1d-6 ~ 1d-8.
      # If you use larger OVEPS, you have smaller number of basis (APW+MTO) for expanding eigenfunctions.

# Relaxiation MODE. We calculate force by force theorem and relax.
#DYN     MODE=5 HESS=T XTOL=.001 GTOL=0 STEP=.015 NIT=20
# See file://Document/Manual/CaterogyAndToken.org
# We now have to set DYN with DYN_MODE DYN_XTOL DYN_GTOL DYN_STEP DYN_NIT
# 
