TABLE OF CONTENTS
::pwtk::pwi::alat
SYNOPSIS
proc ::pwtk::pwi::alat {} {
PURPOSE
Get the value of "alat" in Bohr (i.e. celldm(1) or A, depending on which is specified). If neither is specified, the alat is deduced from CELL_PARAMETERS, but if CELL_PARAMETERS are not defined, 0.0 is returned.
BEWARE
For ibrav==0 && (CELL_PARAMETERS angstrom|bohr), the size of the 1st lattice vector is used to calculate alat.
RETURN VALUE
The value of "alat" in bohr units or 0.0 if alat is undefined.
SOURCE
set A [::pwtk::pwi::aA] set alat [::pwtk::input::namelistGetVarValue SYSTEM celldm(1)] if { $A != "" && $alat != "" } { pwtk::error "both A and celldm(1) are specified. Specify only one of them!" 1 } if { $A != "" } { set alat [expr $::pwtk::angs2bohr * $A] } # take care of ibrav == 0 set ibrav [::pwtk::pwi::ibrav] if { $ibrav == 0 || $ibrav eq "" } { # Problem: # for ibrav==0, "alat" either depends on (celldm(1) or A) or on # the size of the 1st vector in "CELL_PARAMETERS angstrom | bohr", # but "alat" may be queried before CELL_PARAMETERS are defined or # in the CELL_PARAMETER definition itself. # # Solution: # if CELL_PARAMETER is undefined, assume "CELL_PARAMETERS alat" # else calculate alat from CELL_PARAMETERS angstrom | bohr set unit [::pwtk::input::cardGetFlags CELL_PARAMETERS trim] set cell [::pwtk::input::cardGetContent CELL_PARAMETERS] if { $cell eq {} } { set unit alat } else { set a [::pwtk::norm3 [lrange $cell 0 2]] } # from input_pw.html: # if neither unit nor lattice parameter are specified, 'bohr' # is assumed - DEPRECATED, will no longer be allowed # if { $unit eq {} && $alat eq {} } { set unit bohr } # N.B.: # for CELL_PERAMETERS without unit: if celldm(1) or A is # defined, it implies CELL_PERAMETERS in alat and alat was # already obtained above if { [string match *angstrom* $unit] } { set alat [expr {$::pwtk::angs2bohr*$a}] } if { [string match *bohr* $unit] } { set alat $a } } # if alat is not set, return 0.0 if { $alat == "" } { set alat 0.0 } return $alat }