Changeset 538


Ignore:
Timestamp:
Dec 4, 2009 5:07:51 PM (11 years ago)
Author:
toby
Message:

# on 2002/01/22 22:28:53, toby did:
more complete space group checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import_cif.tcl

    • Property rcs:date changed from 2001/04/03 19:13:29 to 2002/01/22 22:28:53
    • Property rcs:lines changed from +8 -5 to +38 -10
    • Property rcs:rev changed from 1.6 to 1.7
    r377 r538  
    7373    # get the space group
    7474    set spg {}
     75    set sgnum {}
    7576    set msg {}
    7677    catch {
    7778        set spg [set block${i}(_symmetry_space_group_name_h-m)]
    7879        regsub -all {'} $spg {} spg
     80        set sgtmp [string toupper $spg]
     81        # remove spaces from space group
     82        regsub -all " " $sgtmp "" sgtmp
     83        # make a copy where we treat bar 3 as the same as 3
     84        regsub -- "-3" $sgtmp "3" sgtmp3
    7985        # see if this space group exists in the table
    80         set fp [open [file join $expgui(scriptdir) spacegrp.ref] r]
    81         while {[gets $fp line] >= 0} {
    82             if {[string trim $spg] == [lindex $line 8]} {
    83                 close $fp
     86        set fp1 [open [file join \
     87                $expgui(scriptdir) spacegrp.ref] r]
     88        while {[gets $fp1 line] >= 0} {
     89            set testsg [string toupper [lindex $line 8]]
     90            regsub -all " " $testsg "" testsg
     91            if {$testsg == $sgtmp} {
     92                set spg [lindex $line 8]
     93                set sgnum [lindex $line 1]
    8494                break
    85                 set fp {}
    86             }
    87         }       
    88         if {$fp != ""} {
    89             close $fp
    90             set msg "Warning: the Space Group ($spg) may not be correctly specified for GSAS"
     95            } elseif {[lindex $line 1] >= 200} {
     96                regsub -- "-3" $testsg "3" testsg3
     97                if {$testsg3 == $sgtmp3} {
     98                    set spg [lindex $line 8]
     99                    set sgnum [lindex $line 1]
     100                    break
     101                }
     102            } elseif {[lindex $line 1] <= 18} {
     103                # monoclinic: change operators of form "1 xxx 1" to "xxx"
     104                regsub -- " 1 (.*) 1" [string toupper [lindex $line 8]] "\\1" testsg
     105                # remove spaces from space group
     106                regsub -all " " $testsg "" testsg
     107                if {$testsg == $sgtmp} {
     108                    set spg [lindex $line 8]
     109                    set sgnum [lindex $line 1]
     110                    break
     111                }
     112            }
     113            close $fp1
     114        }
     115        if {$spg == ""} {
     116            set msg "Warning: a Space Group must be specified"
     117        } elseif {$sgnum == ""} {
     118            set msg "Warning: the Space Group ($spg) is likely incorrect for GSAS"
    91119        }
    92120    }
Note: See TracChangeset for help on using the changeset viewer.