TABLE OF CONTENTS
::pwtk::difden::run
SYNOPSIS
proc ::pwtk::difden::run {head {difdenInput ""}} {
PURPOSE
Run the "difden" calculation (difden acronym stands for difference-density). Before runing the "difden" calculation, user must specify the DIFDEN namelist.
SEE ALSO
For the description of DIFDEN namelist and "difden" calculations see ::pwtk::difden::DIFDEN
ARGUMENTS
- head -- prefix for the I/O files
- difdenInput -- [OPTIONAL] content of DIFDEN namelist (i.e. specification of DIFDEN namelist omitting the "DIFDEN" keyword)
SOURCE
variable difden # load defaults for pw.x (i.e. outdir, pseudo_dir, etc ...) ::pwtk::input::push ::pwtk::pwi::loadDefaults_ CONTROL if { $difdenInput != "" } { DIFDEN $difdenInput } # print some message to stdout printTitle_ "Performing DIFDEN calculation" print_ " number of segments to compute = $difden(nsegment)\n" for {set i 1} {$i <= $difden(nsegment)} {incr i} { print_ " segment #.$i:" if { [info exists difden(name,$i)] } { print_ " segment name: $difden(name,$i)" } print_ " weight of this segment: $difden(weight,$i)" print_ " atoms belonging to this segment: $difden(segment,$i)" } puts "" # make some checks for pp.x (PLOT) calculations set nfile [::pwtk::input::namelistGetVarValue PLOT nfile] if { $nfile == "" } { set nfile $difden(nsegment) } elseif { $nfile != $difden(nsegment) } { ::pwtk::infoMsg "nfile as specified in PLOT namelist is not compatible with the number of segments specified in DIFDEN namelist, i.e., nfile=$nfile, but nsegment=$difden(nsegment) setting : PLOT \{ nfile = $difden(nsegment) \}" set nfile $difden(nsegment) } # ------------------------------------------------------ # STEP #1: perform the SCF & pp.x (INPUTPP) calculations ::pwtk::print "\nStep #.1: performing the SCF & pp.x (&INPUTPP) calculations\n" for {set i 1} {$i <= $difden(nsegment)} {incr i} { # assign atoms to the $i-th segment #set difden(atomList,$i) [::pwtk::parseRangeString $difden(segment,$i) [::pwtk::input::namelistGetVarValue SYSTEM nat]] set difden(atomList,$i) [::pwtk::parseRangeString $difden(segment,$i) [::pwtk::pwi::getNAtoms]] # run SCF pw.x && pp.x ::pwtk::difden::runSCF_INPUTPP_ $head $i } # ------------------------------------------------------ ::pwtk::input::pushpop { # prepare input file for pp.x (PLOT) calculation PLOT "nfile = $nfile" for {set i 1} {$i <= $nfile} {incr i} { PLOT "filepp($i) = '$difden(filplot,$i)' , weight($i) = $difden(weight,$i) " } ::pwtk::input::namelistClear INPUTPP # ----------------------------------------- # STEP #.2: perform PP.x (PLOT) calculation ::pwtk::print "\nStep #.2: performing the pp.x (&PLOT) calculation\n" runPP $head.plot puts "" # ----------------------------------------- } # some additional print to stdout set fileout [::pwtk::input::namelistGetVarValue PLOT fileout trim] if { $fileout != "" } { if { [file exists $fileout] } { ::pwtk::print "\nRequested differential property has been witten to file: $fileout\n" } else { ::pwtk::error "fileout $fileout does not exists;\nsee the $head.plot.out file for possible cause." } } ::pwtk::input::pop }