&GLOBAL
  PRINT_LEVEL MEDIUM
  PROJECT h_h_pbe_pbe0_roks
  RUN_TYPE ENERGY
&END GLOBAL

&MULTIPLE_FORCE_EVALS
  FORCE_EVAL_ORDER 2 3 4 5
  MULTIPLE_SUBSYS T
&END MULTIPLE_FORCE_EVALS

&FORCE_EVAL
  METHOD EMBED
  &EMBED
    NGROUPS 1
    &MAPPING
      &FORCE_EVAL 1
        &FRAGMENT 1
          1 1
          MAP 1
        &END FRAGMENT
      &END FORCE_EVAL
      &FORCE_EVAL 2
        &FRAGMENT 1
          1 1
          MAP 2
        &END FRAGMENT
      &END FORCE_EVAL
      &FORCE_EVAL 3
        &FRAGMENT 1
          1 2
          MAP 3
        &END FRAGMENT
      &END FORCE_EVAL
      &FORCE_EVAL 4
        &FRAGMENT 1
          1 1
          MAP 2
        &END FRAGMENT
      &END FORCE_EVAL
      &FORCE_EVAL_EMBED
        &FRAGMENT 1
          1 1
        &END FRAGMENT
        &FRAGMENT 2
          2 2
        &END FRAGMENT
        &FRAGMENT 3
          1 2
        &END FRAGMENT
      &END FORCE_EVAL_EMBED
    &END MAPPING
  &END EMBED
  &SUBSYS
    &CELL
      ABC [angstrom] 5.000 5.000 5.000
    &END CELL
    &COORD
      H      1.75  2.75  0.0
      H      1.75  4.25  0.0
    &END COORD
    &KIND H
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q1
    &END KIND
    &KIND O
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q6
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

! Subsys 1
&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME BASIS_RI_cc-TZ
    MULTIPLICITY 2
    POTENTIAL_FILE_NAME HF_POTENTIALS
    ROKS .TRUE.
    &MGRID
      CUTOFF 100
      REL_CUTOFF 20
    &END MGRID
    &POISSON
    &END POISSON
    &QS
      EPS_DEFAULT 1.0E-15
      EPS_PGF_ORB 1.0E-30
      METHOD GPW
    &END QS
    &SCF
      MAX_SCF 100
      SCF_GUESS ATOMIC
      &PRINT
        &RESTART OFF
        &END RESTART
      &END PRINT
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom] 5.000 5.000 5.000
    &END CELL
    &COORD
      H      1.75  2.75  0.0
    &END COORD
    &KIND H
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

! Subsys 2
&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME BASIS_RI_cc-TZ
    MULTIPLICITY 2
    POTENTIAL_FILE_NAME HF_POTENTIALS
    ROKS .TRUE.
    &MGRID
      CUTOFF 100
      REL_CUTOFF 20
    &END MGRID
    &POISSON
    &END POISSON
    &QS
      CLUSTER_EMBED_SUBSYS .TRUE.
      EPS_DEFAULT 1.0E-15
      EPS_PGF_ORB 1.0E-30
      METHOD GPW
    &END QS
    &SCF
      MAX_SCF 100
      SCF_GUESS ATOMIC
      &PRINT
        &RESTART OFF
        &END RESTART
      &END PRINT
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom] 5.000 5.000 5.000
    &END CELL
    &COORD
      H      1.75  4.25  0.0
    &END COORD
    &KIND H
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

! Total system
&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME BASIS_RI_cc-TZ
    POTENTIAL_FILE_NAME HF_POTENTIALS
    &MGRID
      CUTOFF 100
      REL_CUTOFF 20
    &END MGRID
    &POISSON
    &END POISSON
    &PRINT
      &E_DENSITY_CUBE LOW
      &END E_DENSITY_CUBE
    &END PRINT
    &QS
      EPS_DEFAULT 1.0E-15
      EPS_PGF_ORB 1.0E-30
      METHOD GPW
      REF_EMBED_SUBSYS .TRUE.
      &OPT_EMBED
        DENS_CONV_INT 0.6
        DENS_CONV_MAX 0.1
        GRID_OPT .FALSE.
        N_ITER 50
        OPTIMIZER LEVEL_SHIFT
        REG_LAMBDA 0.00001
        SPIN_DENS_CONV_INT 1.5
        SPIN_DENS_CONV_MAX 0.15
      &END OPT_EMBED
    &END QS
    &SCF
      MAX_SCF 100
      SCF_GUESS ATOMIC
      &PRINT
        &RESTART OFF
        &END RESTART
      &END PRINT
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom] 5.000 5.000 5.000
    &END CELL
    &COORD
      H      1.75  2.75  0.0
      H      1.75  3.75  0.0
    &END COORD
    &KIND H
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

! Higher level calculation on subsys 2
&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME BASIS_RI_cc-TZ
    MULTIPLICITY 2
    POTENTIAL_FILE_NAME HF_POTENTIALS
    ROKS .TRUE.
    &MGRID
      CUTOFF 100
      REL_CUTOFF 20
    &END MGRID
    &POISSON
    &END POISSON
    &QS
      EPS_DEFAULT 1.0E-15
      EPS_PGF_ORB 1.0E-30
      HIGH_LEVEL_EMBED_SUBSYS
      METHOD GPW
    &END QS
    &SCF
      MAX_SCF 100
      SCF_GUESS ATOMIC
      &PRINT
        &RESTART OFF
        &END RESTART
      &END PRINT
    &END SCF
    &XC
      &HF
        FRACTION 0.25
        &INTERACTION_POTENTIAL
          CUTOFF_RADIUS 2.45
          POTENTIAL_TYPE TRUNCATED
          T_C_G_DATA t_c_g.dat
        &END INTERACTION_POTENTIAL
      &END HF
      &XC_FUNCTIONAL PBE
        &PBE
          SCALE_C 1.0
          SCALE_X 0.75
        &END PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom] 5.000 5.000 5.000
    &END CELL
    &COORD
      H      1.75  4.25 0.0
    &END COORD
    &KIND H
      BASIS_SET ORB cc-TZ
      BASIS_SET RI_AUX RI_TZ
      POTENTIAL GTH-HF-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL
