TABLE OF CONTENTS


::pwtk::cpi::get

SYNOPSIS

proc ::pwtk::cpi::get {} {

PURPOSE

Return the content of the cp.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 atomic species specified in ATOMIC_SPECIES card
are not equal; filtering out unused atom   ic species"
        }
    
        # EXCEPTION: starting from QE v4.0, the cp.x aborts if unused
        # atomic species are specified, which is what we don't want:
        # filter-out unused species
        
        ATOMIC_SPECIES [::pwtk::pwi::filterAtomicSpecies]
        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 {}
        
        ::pwtk::input::clear_

        # remove AUTOPILOT
        set input_flow_ [regsub -all -- AUTOPILOT $input_flow_list {}]
        foreach name $input_flow_ {     
            loadDefaults_ $name
            ::pwtk::input::appendInput_ $name
        }
        set result [::pwtk::input::get_]
        
        # handle AUTOPILOT
        set autopilot [::pwtk::input::cardGetContent AUTOPILOT]
        if { $autopilot != {} } {
            append result "AUTOPILOT\n"
            append result [string trimright $autopilot]\n
            append result "ENDRULES\n"            
        }
    }
    # at this point, unfiltered ATOMIC_SPECIES are restored

    unset all_atomic_species
    
    return $result
}