TABLE OF CONTENTS


::pwtk::::pwtk::runPW_fromXSF

SYNOPSIS

proc ::pwtk::runPW_fromXSF {args} {

USAGE

runPW_fromXSF [-fix_first n -fix_last n -fix indexList -fix_string fixString -head headName -cell] xsfFile

DESCRIPTION

Load the structure from the XSF file and make a pw.x calculation.

OPTIONS

ARGUMENTS

SOURCE

    # parse options
    
    set options {
        {fix_first.arg  {}  "fix the first Nfirst atoms, i.e., atoms from 1 to Nfirst"}
        {fix_last.arg   {}  "fix the last Nlast atoms, i.e., atoms from N-Nlast+1 to N"}
        {fix.arg        {}  "list of atoms to fix"}
        {fix_string     {0 0 0} "fix string"}
        {head.arg       {} "head-name for the pw.x I/O files"}
        {noalat            "prevent using coordinates in alat units"}
        {cell           {} "load also CELL_PARAMETERS from the XSF file (default = only coordinates)"}
    }
    array set opt [::cmdline::getoptions args $options [list [lindex [info level 0] 0] options:]]    

    # load XSF file
    
    set xsfFile [lindex $args 0]
    ::pwtk::fileMustExist $xsfFile

    # head-name of I/O file
    
    set head [file tail [file rootname $xsfFile]]
    if { $opt(head) != "" } {
        set head $opt(head)
    }

    # -alat || -noalat ?
    
    set optalat -alat
    if { $opt(noalat) } {
        set optalat -noalat
    }
    
    input_pushpop {

        # load structure from XSF file
        
        if { $opt(cell) } {
            ::pwtk::pwi::CELL_PARAMETERS_and_ATOMIC_POSITIONS_fromXSF $optalat $xsfFile
        } else {
            ::pwtk::pwi::ATOMIC_POSITIONS_fromXSF $optalat $xsfFile
        }

        # fix atoms
        
        if { $opt(fix_first) != {} } {
            if { ! [::pwtk::is_int $opt(fix_first)] } {
                ::pwtk::error "exptected integer for the value of the -fix_first option, but got $opt(fix_first)" 1
            }
            ::pwtk::pwi::fixAtoms1st $opt(fix_first) $opt(fix_string)
        }
        if { $opt(fix_last) != {} } {
            if { ! [::pwtk::is_int $opt(fix_last)] } {
                ::pwtk::error "exptected integer for the value of the -fix_last option, but got $opt(fix_last)" 1
            }
            ::pwtk::pwi::fixAtomsLast $opt(fix_last) $opt(fix_string)
        }
        if { $opt(fix) != {} } {
            ::pwtk::pwi::fixAtoms $opt(fix) $opt(fix_string)
        }

        # run the calculation
        
        runPW $head
    }
    return $head.out
}