TABLE OF CONTENTS


::pwtk::nebi::get

SYNOPSIS

proc ::pwtk::nebi::get {} {

PURPOSE

Return the content of the neb.x input.

SOURCE

    variable input_flow_list
    variable all_atomic_species

    set all_atomic_species [::pwtk::input::cardGetContent ATOMIC_SPECIES]

    ::pwtk::input::pushpop {
        
        # check the ntyp vs ATOMIC_SPECIES compatibility
        
        if { [::pwtk::pwi::getNTyp] != [::pwtk::input::namelistGetVarValue SYSTEM ntyp] } {
            pwtk::infoMsg "ntyp and number of species specified in ATOMIC_SPECIES card are not equal;
filtering out unused atomic species"
        }
        
        # starting from QE v4.0, the pw.x aborts if unused atomic species
        # are specified, which is what we don't want: filter-out unused
        # species
        
        ATOMIC_SPECIES [::pwtk::pwi::filterAtomicSpecies ::pwtk::nebi::getAtmSymbList]
        SYSTEM " ntyp = [::pwtk::pwi::getNTyp] "
        
        # convenient feature: make a dummy call to ELECTRONS as this
        # namelist must be always present, even if it is empty
        
        ELECTRONS {}

        set    input_ "BEGIN\n"    
        append input_ "BEGIN_PATH_INPUT\n"
        append input_ [::pwtk::input::namelistGet PATH]
        append input_ [::pwtk::input::cardGet CLIMBING_IMAGES]
        append input_ "END_PATH_INPUT\n\n"
        
        append input_ "BEGIN_ENGINE_INPUT\n"
        # namelists
        foreach name $::pwtk::pwi::namelist_flow_list { 
            ::pwtk::pwi::loadDefaults_ $name
            append input_ [::pwtk::input::namelistGet $name]
        }
        
        # cards: 
        # strip ATOMIC_POSITIONS from ::pwtk::pwi::card_flow_list because
        # ATOMIC_POSITIONS are handled below
        
        set cards [regsub -all -- ATOMIC_POSITIONS $::pwtk::pwi::card_flow_list {}]
        foreach name $cards {
            ::pwtk::pwi::loadDefaults_ $name
            append input_ [::pwtk::input::cardGet $name]
        }
        
        if { [info exists ::pwtk::input::card(POSITIONS)] } {
            # NEB atomic positions are specified with nex syntax via POSITIONS { ... } card
            append input_ "BEGIN_POSITIONS\n"
            append input_ [::pwtk::input::cardGetContent POSITIONS]
            append input_ "END_POSITIONS\n"
        } else {
            # try with old pw.x syntax via ATOMIC_POSITIONS that use the "first_image", "intermediate_image", "last_image" ...
            append input_ "BEGIN_POSITIONS\n"
            append input_ [::pwtk::input::cardGetContent ATOMIC_POSITIONS]
            append input_ "END_POSITIONS\n"
        }
        
        append input_ "END_ENGINE_INPUT\n"    
        append input_ "END\n"
        
        set result $input_
    }
    # at this point, unfiltered ATOMIC_SPECIES are restored

    unset all_atomic_species
    
    return $result
}