TABLE OF CONTENTS


::pwtk::atomRadius

SYNOPSIS

proc ::pwtk::atomRadius {args} {

USAGE

    atomRadius  [-pm | -angs | -bohr]  elem  [radtype]

DESCRIPTION

Get the $radType atomic radius for element $elem.

OPTIONS

ARGUMENTS

SOURCE

    variable angs2bohr
    
    set nargmin 1
    set nargmax 2
    set usage "?-angs | -bohr | -pm?  element ?radType?"    
    set options {
        {angs "angstrom (default)"}
        {bohr "bohr"}
        {pm   "pico-meter"}
    }
    parseOpt_

    set elem [lindex $args 0]
    set type [lindex $args 1]
    if { $type == {} } {
        set type cov
    }    

    if { $opt(angs)*$opt(bohr) + $opt(angs)*$opt(pm) + $opt(bohr)*$opt(pm) > 0 } {
        ::pwtk::error "only one of -angs, -bohr, -pm options must be specified, but got $args_" 1
    }

    set conv 0.01; # pm-to-angs (DEFAULT)  
    if { $opt(bohr) } {
        set conv [expr 0.01*$angs2bohr]; # pm-to-bohr
    } elseif { $opt(pm) } {
        set conv 1.0
    }
    
    switch -glob -- $type {
        emp*  {
            set ir 3;  # index of R in the atomData
            set rr 200; # unknown-element R (in pp)
        }
        calc* {
            set ir 4
            set rr 200
        }
        vdw* - van* {
            set ir 5
            set rr 300
        }
        cov*  {
            set ir 6
            set rr 200
        }
        default {
            ::pwtk::error "unknown radius type \"$radType\", must be one of emprirical, calculated, covalent, vdw or van-der-waals" 1
        }
    }

    if { [string is integer -strict $elem] } {
        set ie 0
    } else {
        set ie 1
    }

    foreach atom $::pwtk::atomDataList {
        if { $elem == [lindex $atom $ie] } {            
            return [expr $conv*[lindex $atom $ir]]
        }
    }

    # if we came here, element is not known
    ::pwtk::warning "unknown element \"$elem\"; PWTK only knows elements up to No.96"
    return [expr $conv*$rr]
}