Changeset 984 for trunk


Ignore:
Timestamp:
Apr 15, 2010 1:31:04 PM (11 years ago)
Author:
toby
Message:

Address ticket #1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/addcmds.tcl

    r977 r984  
    16131613}
    16141614
     1615set expgui(atmtypelist) {}
     1616proc GetAtmTypes {} {
     1617    set ::expgui(atmtypelist) {}
     1618    set ::expgui(magtypelist) {}
     1619    catch {
     1620        set fp [open [file join $::expgui(gsasdir) data atmdata.dat] r]
     1621        while {[gets $fp line] >= 0} {
     1622            set token [string toupper [string trim [string range $line 2 8]]]
     1623            if {$token == ""} continue
     1624            # nuclear/magnetic
     1625            if {[lindex $token 1] == "N" || [lindex $token 1] == "M"} {
     1626                set magarr([lindex $token 0]) 1
     1627                continue
     1628            }
     1629            if {[string is integer $token]} continue
     1630            if {[string first "_" $token] != -1} {
     1631                set sp [split $token "_"]
     1632                if {[lindex $sp 1] == ""} continue
     1633                if {! [string is integer [lindex $sp 1]]} continue
     1634            }
     1635            set tmparr([string toupper $token]) 1
     1636        }
     1637        set ::expgui(atmtypelist) [array names tmparr]
     1638        set ::expgui(magtypelist) [array names magarr]
     1639        close $fp
     1640    } errmsg
     1641    if {$::expgui(debug) && $errmsg != ""} {
     1642        puts "GetAtmTypes error: $errmsg"
     1643    }
     1644}
     1645
    16151646# Validate the atoms in the atoms add/phase replace box
    16161647# returns a null string on error or a list of atoms
     
    16361667        AG+2 CD CD+2 CD_112 CD_113 CD_114 CD_116 IN IN+3 IN_113 IN_115 SN SN+2
    16371668        SN+4 SB SB+3 SB+5 TE I I-1 I_127 XE CS CS+1 CS_133 BA BA+2 LA LA+3 CE
    1638         CE+3 CE+4 PR PR+3 PR+4 PR_141 ND ND+3 PM PM+3 PM_147 SM SM+3 SM_152
     1669        CE+3 CE+4 PR PR+3 PR+4 PR_141 ND ND+3 PM PM+3 SM SM+3 SM_152
    16391670        SM_154 EU EU+2 EU+3 EU_153 GD GD+3 GD_160 TB TB+3 TB_159 DY DY+3 HO
    16401671        HO+3 HO_165 ER ER+3 TM TM+3 TM_169 YB YB+2 YB+3 LU LU+3 HF HF+4 TA
    16411672        TA+5 TA_181 W W+6 RE OS OS+4 IR IR+3 IR+4 PT PT+2 PT+4 AU AU+1 AU+3
    16421673        AU_197 HG HG+1 HG+2 TL TL+1 TL+3 PB PB+2 PB+4 BI BI+3 BI+5 BI_209 PO
    1643         PO_210 AT AT_210 RN RN_222 FR FR_223 RA RA+2 RA_226 AC AC+3 AC_227 TH
     1674        AT AT_210 RN RN_222 FR FR_223 RA RA+2 RA_226 AC AC+3 AC_227 TH
    16441675        TH+4 TH_232 PA PA_231 U U+3 U+4 U+6 U_235 U_238 NP NP+3 NP+4 NP+6
    16451676        NP_237 PU PU+3 PU+4 PU+6 PU_239 PU_240 PU_242 AM AM_243 CM CM_244 BK
     
    16611692        }
    16621693        if {[lsearch $validatmtypes [string toupper $type]] == -1} {
    1663             append err "  line $row: Atom type $type is not defined for x-rays in GSAS. If you are fitting magnetic scattering, this could be defined. If so, use a different type and use EXPEDT to change the type back.\n\n"
     1694            if {[llength $expgui(atmtypelist)] == 0} GetAtmTypes
     1695            if {[lsearch $expgui(atmtypelist) [string toupper $type]] == -1} {
     1696                if {[lsearch $expgui(magtypelist) [string toupper $type]] == -1} {
     1697                    append err "  line $row: Atom type $type is not defined in GSAS.\n\n"
     1698                } else {
     1699                    append err "  line $row: Atom type $type is not defined for x-rays in GSAS, but is defined for magnetic/nuclear scattering. If you want to use this symbol choose a different type here and change it later in EXPEDT.\n\n"
     1700                }
     1701            }
    16641702        }
    16651703        set name [string trim [$np.e${row}n get]]
Note: See TracChangeset for help on using the changeset viewer.