TABLE OF CONTENTS


33-difden-OAl

DESCRIPTION

This example shows how to calculate the charge density difference of O/Al(001)-2x2:

    \Delta n(r) = n_{O/Al(001}(r) - [n_O(r) + n_{Al(001)}(r)]

using the PWTK's DIFDEN (aka difference density) workflow.

Before performing a DIFDEN calculation, the O/Al(001) system is relaxed so that the DIDFDEN is performed on the optimized coordinates.

EXAMPLE SOURCE FILE

difden-OAl.pwtk

SOURCE

# load the scf.OAl.in pw.x input file with ::pwtk::pwi::load_fromPWI
load_fromPWI scf.OAl.in

#------------------------------------------------------------------------
# 1. make a pw.x relaxation
#------------------------------------------------------------------------

# to avoid affecting the input data for calculations following the
# relaxation, let's use the input-data stacking (N.B. 'input_pushpop'
# is a shortcut to ::pwtk::input::pushpop)

input_pushpop {
    CONTROL { calculation = 'relax' }
    IONS    {}
    runPW relax.OAl001-2x2
}

# load the optimized coordinates from the elax.OAl001-2x2.out output
# file with ::pwtk::pwi::ATOMIC_POSITIONS_fromPWO

ATOMIC_POSITIONS_fromPWO relax.OAl001-2x2.out


#------------------------------------------------------------------------
# 2. DIFDEN calculation
#------------------------------------------------------------------------

# pp.x specs to calculate 3D charge density into the XSF file

INPUTPP {
    plot_num = 0
}
PLOT {
   iflag = 3
   output_format = 5
   fileout = 'difden.OAl001-2x2.xsf'
}


# We need to instuct DIFDEN how to calculate charge density difference.
#
# Description of variables:
#   segment(*) -- list of atoms composing the segment 
#                 Example syntax: "all" -- means all atoms
#                                 "1-"  -- means all atoms (i.e. from 1 to the end)"
#                                 "1 3-5 7-" means atoms 1, 3 4 5, and from 7 to the end
#   name(*)    -- name of the segment
#   weight(*)  -- weight of the segment
   
DIFDEN {
    name(1)    = OAl001-2x2
    segment(1) = all
    weight(1)  = 1.0

    name(2)    = O
    segment(2) = 1
    weight(2)  = -1.0

    name(3)    = Al001-2x2
    segment(3) = 2-
    weight(3)  = -1.0
}

# A standalone oxygen atom (segment #2) is spin-polarized.
#
# To instruct PWTK to perform spin-polarized calculation for segment #2, use
# 'difden_segmentSpec', a shortcut to ::pwtk::difden::segmentSpecialization

difden_segmentSpec 2 {
    SYSTEM { nspin = 2, starting_magnetization(O) = 1 }
}

# DIFDEN workflow is run with 'difden_run', which is a shortcut to ::pwtk::difden::run

difden_run difden.OAl001-2x2

print "to visualize the resulting XSF file, e.g. use:   xcrysden -r 2 --xsf difden.OAl001-2x2.xsf"