!
!  Tests level shifting, printing embedding potential cubes
!  and adding a constant part to the embedding potential
!
&GLOBAL
  PROJECT  h4_h8_pbe_pbe0_4_const
  PRINT_LEVEL HIGH
  RUN_TYPE ENERGY
&END GLOBAL
&MULTIPLE_FORCE_EVALS
   FORCE_EVAL_ORDER 2 3 4 5
   MULTIPLE_SUBSYS T
&END
&FORCE_EVAL
    METHOD EMBED
    &EMBED
       NGROUPS 1
       &MAPPING
          &FORCE_EVAL_EMBED
             &FRAGMENT 1
                1 2
             &END
             &FRAGMENT 2
                3 4
             &END
             &FRAGMENT 3
                1 4
             &END
          &END
          &FORCE_EVAL 1
             &FRAGMENT 1
                1 2
                MAP 1
              &END
          &END
          &FORCE_EVAL 2
             &FRAGMENT 1
                1 2
                MAP 2
             &END
          &END
          &FORCE_EVAL 3
             &FRAGMENT 1
                1 4
                MAP 3
              &END
          &END
          &FORCE_EVAL 4
             &FRAGMENT 1
                1 2
                MAP 2
             &END
          &END
       &END
    &END EMBED
  &SUBSYS
    &CELL
      ABC [angstrom]  4.000   4.000  4.000
      PERIODIC NONE
    &END CELL
    &KIND H
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q1
      POTENTIAL  GTH-HF-q1
    &END KIND
    &KIND O
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q6
      POTENTIAL  GTH-HF-q6
    &END KIND
    &COORD
H    6.7935     6.0     4.0
H    7.3225     6.0     4.0
H    6.2645     6.0     4.0
H    5.7355     6.0     4.0
    &END
  &END SUBSYS
&END FORCE_EVAL

! Subsys 1

&FORCE_EVAL
  METHOD Quickstep
  &DFT
    &PRINT
       &E_DENSITY_CUBE MEDIUM
       &END
    &END
    BASIS_SET_FILE_NAME  BASIS_RI_cc-TZ
    !POTENTIAL_FILE_NAME  GTH_POTENTIALS
    POTENTIAL_FILE_NAME   HF_POTENTIALS
    &POISSON
      PERIODIC NONE
      POISSON_SOLVER WAVELET
    &END POISSON
    &MGRID
      CUTOFF  100
      REL_CUTOFF  20
    &END MGRID
    &QS
      METHOD GPW
    &END QS
    &SCF
      &OT
       PRECONDITIONER FULL_ALL
      &END
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 100
      &PRINT
        &RESTART OFF
        &END
      &END
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom]  4.000   4.000  4.000
      PERIODIC NONE
    &END CELL
    &KIND H
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q1
      POTENTIAL  GTH-HF-q1
    &END KIND
    &COORD
H    6.7935     6.0     4.0
H    7.3225     6.0     4.0
    &END
  &END SUBSYS
&END FORCE_EVAL

! Subsys 2

&FORCE_EVAL
  METHOD Quickstep
  &DFT
    &PRINT
       &E_DENSITY_CUBE MEDIUM
       &END
    &END
    BASIS_SET_FILE_NAME  BASIS_RI_cc-TZ
    !POTENTIAL_FILE_NAME  GTH_POTENTIALS
    POTENTIAL_FILE_NAME   HF_POTENTIALS
    &POISSON
      PERIODIC NONE
      POISSON_SOLVER WAVELET
    &END POISSON
    &MGRID
      CUTOFF  100
      REL_CUTOFF  20
    &END MGRID
    &QS
      CLUSTER_EMBED_SUBSYS .TRUE.
      METHOD GPW
    &END QS
    &SCF
      &OT
       PRECONDITIONER FULL_ALL
      &END
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 100
      &PRINT
        &RESTART OFF
        &END
      &END
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom]  4.000   4.000  4.000
      PERIODIC NONE
    &END CELL
    &KIND H
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q1
      POTENTIAL  GTH-HF-q1
    &END KIND
    &KIND O
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q6
      POTENTIAL  GTH-HF-q6
    &END KIND
    &COORD
H    6.2645     6.0     4.0
H    5.7355     6.0     4.0
    &END
  &END SUBSYS
&END FORCE_EVAL

! Total system

&FORCE_EVAL
  METHOD Quickstep
  &DFT
    &PRINT
       &E_DENSITY_CUBE MEDIUM
       &END
    &END
    BASIS_SET_FILE_NAME  BASIS_RI_cc-TZ
    !BASIS_SET_FILE_NAME  HFX_BASIS
    !POTENTIAL_FILE_NAME  GTH_POTENTIALS
    POTENTIAL_FILE_NAME   HF_POTENTIALS
    &POISSON
      PERIODIC NONE
      POISSON_SOLVER WAVELET
    &END POISSON
    &MGRID
      CUTOFF  100
      REL_CUTOFF  20
    &END MGRID
    &QS
      REF_EMBED_SUBSYS .TRUE.
      METHOD GPW
      &OPT_EMBED
         REG_LAMBDA 0.00001
         N_ITER 50
         TRUST_RAD 0.1
         DENS_CONV_INT 1.35
         DENS_CONV_MAX 0.2
         POT_GUESS Fermi_Amaldi
         OPTIMIZER LEVEL_SHIFT
         GRID_OPT .FALSE.
         &EMBED_POT_CUBE MEDIUM
         &END
      &END
    &END QS
    &SCF
      &OT
       PRECONDITIONER FULL_ALL
      &END
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 100
      &PRINT
        &RESTART OFF
        &END
      &END
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom]  4.000   4.000  4.000
      PERIODIC NONE
    &END CELL
    &KIND H
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      POTENTIAL  GTH-HF-q1
    &END KIND
    &COORD
H    6.7935     6.0     4.0
H    7.3225     6.0     4.0
H    6.2645     6.0     4.0
H    5.7355     6.0     4.0
    &END
  &END SUBSYS
&END FORCE_EVAL

! Higher level calculation on subsys 2

&FORCE_EVAL
  METHOD Quickstep
  &DFT
    &PRINT
       &E_DENSITY_CUBE MEDIUM
       &END
    &END
    BASIS_SET_FILE_NAME  BASIS_RI_cc-TZ
    !POTENTIAL_FILE_NAME  GTH_POTENTIALS
    POTENTIAL_FILE_NAME   HF_POTENTIALS
    &POISSON
      PERIODIC NONE
      POISSON_SOLVER WAVELET
    &END POISSON
    &MGRID
      CUTOFF  100
      REL_CUTOFF  20
    &END MGRID
    &QS
      HIGH_LEVEL_EMBED_SUBSYS
      METHOD GPW
    &END QS
    &SCF
      &OT
       PRECONDITIONER FULL_ALL
      &END
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 100
      &PRINT
        &RESTART OFF
        &END
      &END
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
          &PBE
             SCALE_X 0.75
             SCALE_C 1.0
          &END
      &END XC_FUNCTIONAL
      &HF
        FRACTION 0.25
        &INTERACTION_POTENTIAL
           POTENTIAL_TYPE TRUNCATED
           CUTOFF_RADIUS  4.95
           T_C_G_DATA  t_c_g.dat
         &END

      &END
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom]  4.000   4.000  4.000
      PERIODIC NONE
    &END CELL
    &KIND H
      BASIS_SET  cc-DZ
      BASIS_SET RI_AUX  RI_TZ
      !POTENTIAL  GTH-PBE-q1
      POTENTIAL  GTH-HF-q1
    &END KIND
    &COORD
H    6.2645     6.0     4.0
H    5.7355     6.0     4.0
    &END
  &END SUBSYS
&END FORCE_EVAL

