TABLE OF CONTENTS


::pwtk::eos::EOS

SYNOPSIS

proc ::pwtk::eos::EOS {content} { 

PURPOSE

The input data for the EOS calculation are specified by means of the EOS namelist. This proc is the implementation of the EOS namelist and performs various checks on "input" variables.

ARGUMENTS

   EOS {
           mode = auto
           a0   = 7.2 
           ...
   }

Default values for EOS input variables are defined in eos.tcl config file.

DESCRIPTION of EOS variables:

mode == auto: lattice-parameter scan range is automatically determined, and npoints scf calculations is performed in this range. The following optional variables may be specified:

mode == range: lattice-parameter is scanned in the specified range, as determined by the following two variables:

mode == stepwise: lattice-parameter is scanned in stepwise fashion, starting at amin with increments da:

SUMMARY of EOS namelist:

* mode == auto:

    EOS {
           mode = auto
        npoints = integer-number (OPTIONAL)
             a0 = real-value     (OPTIONAL)
             B0 = small|medium|high|real-value (OPTIONAL)
            da0 = real-value     (OPTIONAL)
      scale_min = real-value     (OPTIONAL)
      scale_max = real-value     (OPTIONAL)
    }    

* mode == range:

    EOS {
           mode = range
        npoints = integer-number (OPTIONAL)
           amin = real-value     (REQUIRED)
           amax = real-value     (REQUIRED)
    }

* mode == stepwise:

    EOS {
           mode = stepwise
        npoints = integer-number (OPTIONAL)
           amin = real-value     (REQUIRED)
             da = real-value     (REQUIRED)
    }

SOURCE

    ::pwtk::input::namelist EOS $content 

    # parse the input data for EOS calculation and perform some checks

    variable eos
    variable eos_default

    foreach var [::pwtk::input::namelistVars_ EOS] {

        set value [::pwtk::input::namelistGetVarValue EOS $var 1]

        # this is to allow:  EOS { value = }
        if { $value == "" } {
            if { [info exists eos_default($var)] } {
                set eos($var) $eos_default($var)
            }
            continue
        }
        
        switch -exact -- [string tolower $var] {
            restart {
                set value [string trim $value .]
                if { ! [string is boolean $value] } {
                    ::pwtk::error "wrong value for EOS's restart variable, must be boolean, but got $value"
                } else {
                    set eos(restart) $value
                }
            }
            use_stress {
                set value [string trim $value .]
                if { ! [string is boolean $value] } {
                    ::pwtk::error "wrong value for EOS's use_stress variable, must be boolean, but got $value"
                } else {
                    set eos(use_stress) $value
                }
            }
            use_estimator_points {
                set value [string trim $value .]
                if { ! [string is boolean $value] } {
                    ::pwtk::error "wrong value for EOS's use_estimator_points variable, must be boolean, but got $value"
                } else {
                    set eos(use_estimator_points) $value
                }
            }
            mode {
                if { [regexp (auto|range|stepwise) $value] } {
                    set eos(mode) $value
                } else {
                    ::pwtk::error "wrong mode for EOS calculation: ${value}, must be one of auto, range, or stepwise"
                }
            }
            b0 {
                if { [regexp (high|medium|small) $value] } {
                    set eos(B0) $eos(B0_$value)
                } elseif { [::pwtk::is_double $value] } {
                    set value [pwtk::mathParser $value]
                    if { $value < 5 || $value > 5000 } {
                        ::pwtk::error "B0 value, ${value} kbar, out of acceptable range, must be witin \[5,5000\] kbar"
                    }
                    set eos(B0) $value
                } else {
                    ::pwtk::error "wrong value of B0 for ALAR calculation: ${value}, must be one of high, medium, small, or real-number in kbar"
                }
            }
            a0 - scale_min - scale_max - amin - amax - da - da0 {                
                if { [::pwtk::is_double $value] } {
                    set value [pwtk::mathParser $value]
                    set eos($var) $value
                } else {
                    ::pwtk::error "wrong value of $var for EOS calculation: ${value}, must be a real-number"
                }
                # additional number checks
                if { [regexp (a0|amin|amax|scale_min) $var] && $value < 0.5 } {
                    ::pwtk::error "increase $var, which is too small, ${value}"
                } elseif { $var == "scale_max" && $value > 2.0 } {
                    ::pwtk::error "scale_max is too big: ${value}, should be lower than 2.0, say, around 1.10"
                }               
            }
            npoints {
                if { [::pwtk::is_int $value] } {
                    set value [expr $value]
                    if { $value < 4 } {
                        ::pwtk::error "npoints must be >= 4"
                    }
                    set eos($var) $value
                } else {
                    ::pwtk::error "wrong value of $var for EOS calculation: ${value}, must be an integer-number"
                }
            }
            default {
                ::pwtk::error "wrong EOS's variable name: $var"
            }
        }
    }

    # additional after tests: before running check that a0 > 0.5 && da < 0.5*a0
}