TABLE OF CONTENTS


::pwtk::vc-relaxSubsequent_

SYNOPSIS

proc ::pwtk::vc-relaxSubsequent_ {} {

PURPOSE

Perform subsequent (from 2nd on) calculations for a multi-pass 'vc-relax' calculation.

BEWARE: the $opt(npass), $out, and $runCmd variables must be defined!

SOURCE

    uplevel 1 {
        # prepare for subsequent calcs        
        if { $opt(npass) > 1 } {
            set head [headname $out .out]
            
            # BEWARE: for subsequent vc-relax calculations, "conv_thr" must
            # be tightened hence set conv_thr = conv_thr*upscale & upscale = 1
            set conv_thr [::pwtk::input::namelistGetVarValue ELECTRONS conv_thr]
            set upscale  [::pwtk::input::namelistGetVarValue IONS upscale]
        
            # set to default pw.x values if not defined
            ifset conv_thr 1e-6
            ifset upscale  100

            input_pushpop {
                restart off
                ELECTRONS " conv_thr = $conv_thr/$upscale "            
                IONS      " upscale = 1.0 "
            
                for {set i 2} {$i <= $opt(npass)} {incr i} {
                    file copy -force -- $head.in $head.pass-[expr $i-1].in
                
                    # make another vc-relax
                    print "Running vc-relax pass #.$i\n"
                
                    ::pwtk::pwi::CELL_PARAMETERS_and_ATOMIC_POSITIONS_fromPWO $head.out
                    $runCmd -append $head
                }
            }
        }
    }
}