TABLE OF CONTENTS
::pwtk::readNml
SYNOPSIS
proc ::pwtk::readNml {fileChannel nmlOrigName {nmlPWTKname {}} {must_exist 0} {match_first 0}} {
PURPOSE
Read the namelist from the fileChannel of e.g. opened QE input file, return its content in the PWTK syntax, and increment fileChannel to the point just after the namelist.
This routine is used internally by PWTK in load_from*** set of commands.
ARGUMENTS
- fileChannel -- QE input file to read
- nmlOrigName -- name of the namelist to read from the fileChannel
- nmlPWTKname -- (optional) if not empty, replace nmlOrigName with nmlPWTKname in the returned PWTK formated namelist.
- must_exist -- (optional) must the namelists exist (default = no)
- match_first -- (optional) if true then the first non-empty line must start with the $nmlName word (default = 0)
SIDE EFFECTS
If namelist is not present an error will be raised.
RETURN VALUE
Namelist in the PWTK syntax, e.g.,: NAMELIST { ... }
SOURCE
if { $nmlPWTKname eq {} } { set nmlName [string toupper $nmlOrigName] } else { set nmlName [string toupper $nmlPWTKname] } set nmlContent [::fnml::getContent $nmlOrigName $fileChannel $must_exist $match_first] if { $nmlContent ne {} } { return "$nmlName { [string trim $nmlContent] }\n" } else { return "" } }