Changeset 760


Ignore:
Timestamp:
Sep 20, 2012 9:58:16 PM (9 years ago)
Author:
toby
Message:

try to deal with unrecognized space group symbols

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r746 r760  
    385385                        #                 +' with format '+ rd.formatName)
    386386                        continue
    387                     if flag: break # success reading
     387                    if flag:
     388                        if rd.warnings:
     389                            self.ErrorDialog('Read Warning','The '+ rd.formatName+
     390                                             ' reader reported a warning message:\n\n'+
     391                                             rd.warnings)
     392                        break # success reading
    388393                else:
    389394                    self.ErrorDialog('Read Error','No reader is able to read from file '+filename+msg)
  • trunk/GSASIIIO.py

    r697 r760  
    735735            SpGrp = EXPphase[key][:15].strip()
    736736            E,SGData = G2spc.SpcGroup(SpGrp)
     737            if E:
     738                E,SGData = G2spc.SpcGroup('P 1') # unlikely to need this
    737739        elif 'OD    ' in key:
    738740            SHdata = EXPphase[key].split() # may not have all 9 values
     
    830832            SpGrp = S[55:65]
    831833            E,SGData = G2spc.SpcGroup(SpGrp)
     834            # space group processing failed, try to look up name in table
     835            if E:
     836                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
     837                if SpGrp:
     838                    E,SGData = G2spc.SpcGroup(SpGrp)
    832839            while E:
    833840                print G2spc.SGErrors(E)
     
    10881095        self.strictExtension = strictExtension
    10891096        self.warnings = ''
    1090         self.errors = ''
    10911097        # used for readers that will use multiple passes to read
    10921098        # more than one data block
  • trunk/GSASIIspc.py

    r740 r760  
    881881    #returns the thermal motion tensor U from Uij as numpy array
    882882    return np.array([[Uij[0],Uij[3],Uij[4]],[Uij[3],Uij[1],Uij[5]],[Uij[4],Uij[5],Uij[2]]])
     883
     884def StandardizeSpcName(spcgroup):
     885    '''Accept a spacegroup name where spaces may have not been used
     886    in the names according to the GSAS convention (spaces between symmetry
     887    for each axis) and return the space group name as used in GSAS
     888    '''
     889    rspc = spcgroup.replace(' ','').upper()
     890    # deal with rhombohedral and hexagonal setting designations
     891    rhomb = ''
     892    if rspc[-1:] == 'R':
     893        rspc = rspc[:-1]
     894        rhomb = ' R'
     895    if rspc[-1:] == 'H': # hexagonal is assumed and thus can be ignored
     896        rspc = rspc[:-1]
     897    # look for a match in the spacegroup lists
     898    for i in spglist.values():
     899        for spc in i:
     900            if rspc == spc.replace(' ','').upper():
     901                return spc + rhomb
     902    # how about the post-2002 orthorhombic names?
     903    for i,spc in sgequiv_2002_orthorhombic:
     904        if rspc == i.replace(' ','').upper():
     905            return spc
     906    # not found
     907    return ''
     908
    883909   
    884910'''A dictionary of space groups as ordered and named in the pre-2002 International
     
    925951        ),
    926952    'Cmmm':('C 2 2 21','C 2 2 2','C m m 2','C m c 21','C c c 2','C m 2 m','C 2 m m',
    927         'C m 2 a','C 2 m b','C 2 c m','C c 2 m','C 2 c m','C c 2 m',
     953        'C m 2 a','C 2 m b','C 2 c m','C c 2 m','C 2 c m','C c 2 m', # check: C c 2 m & C c 2 m twice
    928954        'C m c a','C m m m','C c c m','C m m a','C c c a','C m c m',),
    929955    'Immm':('I 2 2 2','I 21 21 21','I m m m',
     
    936962    'Fmmm':('F 2 2 2','F m m m', 'F d d d',
    937963        'F m m 2','F m 2 m','F 2 m m',
    938         'F d d 2','F d 2 d','F d 2 d',),
     964        'F d d 2','F d 2 d','F 2 d d',),
    939965    'P4/mmm':('P 4','P 41','P 42','P 43','P -4','P 4/m','P 42/m','P 4/n','P 42/n',
    940966        'P 4 2 2','P 4 21 2','P 41 2 2','P 41 21 2','P 42 2 2',
  • trunk/imports/G2phase_CIF.py

    r643 r760  
    126126                blknm = str_blklist[selblk]
    127127                blk = cf[str_blklist[selblk]]
     128                E = True
    128129                SpGrp = blk.get("_symmetry_space_group_name_H-M")
    129                 if SpGrp:
    130                      E,SGData = G2spc.SpcGroup(SpGrp)
     130                # try normalizing the space group, see if we can pick the space group out of a table
     131                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
     132                if SpGrpNorm:
     133                    E,SGData = G2spc.SpcGroup(SpGrpNorm)
     134                # nope, try the space group "out of the Box"
     135                if E and SpGrp:
     136                    E,SGData = G2spc.SpcGroup(SpGrp)
    131137                if E:
    132                     self.warnings += ' ERROR in space group symbol '+SpGrp
    133                     self.warnings += ' N.B.: make sure spaces separate axial fields in symbol'
     138                    self.warnings += 'ERROR in space group symbol '+SpGrp
     139                    self.warnings += '\nAre there spaces separating axial fields?\n\nError msg: '
    134140                    self.warnings += G2spc.SGErrors(E)
    135                 else:
    136                     self.Phase['General']['SGData'] = SGData
     141                    SGData = G2IO.SGData # P 1
     142                self.Phase['General']['SGData'] = SGData
    137143                # cell parameters
    138144                cell = []
Note: See TracChangeset for help on using the changeset viewer.