TABLE OF CONTENTS


::pwtk::pwi::dipoleCorr

SYNOPSIS

proc ::pwtk::pwi::dipoleCorr {args} {

USAGE

   ::pwtk::pwi::dipoleCorr  ?-vac1st thicknessBohr?  ?-diplayer thicknessBohr?  ?-vac2nd thicknessBohr?  slab_thicknessBohr

PURPOSE

Set the dipole correction.

OPTIONS

ARGUMENTS

DESCRIPTION

This command presuposses that surface normal is along Z and a 2D slab structure is the following:

      z=C ----------
          |        | vac2nd
          |        |
          +--------+ diplayer 
          +--------+          
          |        | vac1st
          |        |
          +--------+ z=slab_thickness_bohr
          |//SLAB//|
      z=0 +--------+

Based on this assumption, edir=3 and the emaxpos and eopreg variables are set accordingly.

RETURN VALUE

The size of the C lattice vector in Bohr units. The C lattice vector points along the Z-direction, which is the surface-normal direction.

SOURCE

    set narg 1
    set options {
        {vac1st.arg   {} "thickness of vacuum from top of the slab to the dipole layer in Bohr"}
        {diplayer.arg {} "thickness of the dipole-layer in Bohr"}
        {vac2nd.arg   {} "thickness of vacuum from top of the dipole-layer to the bottom of the adjecent slab in Bohr"}
    }
    set usage "?-vac1st thickness?  ?-diplayer thickness?  ?-vac2nd thickness?  slab_thickness"
    ::pwtk::parseOpt_

    lassign [::pwtk::dipcorrDefault_ $opt(vac1st) $opt(diplayer) $opt(vac2nd)] opt(vac1st) opt(diplayer) opt(vac2nd)
        
    ::pwtk::checkOTypeStrict_ -vac1st $opt(vac1st) {number posreal} "positive number"
    ::pwtk::checkOTypeStrict_ -vac2nd $opt(vac2nd) {number posreal} "positive number"
    ::pwtk::checkOTypeStrict_ -diplayer $opt(diplayer) {number posreal} "positive number"

    # BEWARE: all thicknesses are in Bohr !
    set slab_height $args
  
    set dipZ [expr $slab_height + $opt(vac1st)]
    set Z    [expr $slab_height + $opt(vac1st) + $opt(diplayer) + $opt(vac2nd)]

    set emaxpos [expr $dipZ / $Z]
    set eopreg  [expr $opt(diplayer) / $Z]

    CONTROL {
        dipfield = .true.
        tefield = .true.
    }
    SYSTEM  [subst {
        edir = 3
        emaxpos = $emaxpos
        eopreg = $eopreg
    }]

    ::pwtk::print ++++ "Loading dipole correction ..."
    ::pwtk::print "------------------------------
   max slab height (including adsorbate)   = [format %6.3f $slab_height] Bohr
   vacuum thickness below the dipole layer = [format %6.3f $opt(vac1st)] Bohr
   dipole-layer thickness                  = [format %6.3f $opt(diplayer)] Bohr
   vacuum thickness above the dipole layer = [format %6.3f $opt(vac2nd)] Bohr
   size of 3rd lattice vector along Z      = [format %6.3f $Z] Bohr
   (emaxpos = [format %8.6f $emaxpos], eopreg = [format %8.6f $eopreg])
"
    return $Z
}