Changeset 3191


Ignore:
Timestamp:
Dec 13, 2017 8:26:51 AM (5 years ago)
Author:
vondreele
Message:

fix integer divides in responding to unit cell changes on Unit Cells window
show StarFile? errors from cif importer
add missing nonstandard space group symbols for face centered orthorhombics
begin implementation of cif import magnetic phases into 2 phase result

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElem.py

    r3164 r3191  
    197197    if El not in atmdata.XrayFF and El not in atmdata.MagFF:
    198198        if ElS not in atmdata.XrayFF:
    199             print('Atom type '+El+' not found, using UNK')
    200             return # not sure what this element should be!
     199            print('Atom type '+El+' not found, using H')
     200            ElS = 'H'
     201#            return # not sure what this element should be!
    201202        print('Atom type '+El+' not found, using '+ElS)
    202203        El = ElS
  • trunk/GSASIIdataGUI.py

    r3187 r3191  
    803803            else:
    804804                if singlereader:
     805                    msg += '\n'+rd.warnings
    805806                    print(u'The '+ rd.formatName+u' reader was not able to read file '+filename+msg)
    806807                    try:
  • trunk/GSASIIpwdGUI.py

    r3175 r3191  
    28152815        ObjId = cellList.index(Obj.GetId())
    28162816        valObj = valDict[Obj.GetId()]
    2817         if ObjId/2 < 3:
     2817        if ObjId//2 < 3:
    28182818            move = Obj.GetValue()*0.01
    28192819        else:
     
    28212821        Obj.SetValue(0)
    28222822        value = float(valObj.GetValue())+move 
    2823         SetCellValue(valObj,ObjId/2,value)
     2823        SetCellValue(valObj,ObjId//2,value)
    28242824        OnHklShow(event)
    28252825       
     
    28492849            value = max(1.0,float(Obj.GetValue()))
    28502850        except ValueError:
    2851             if ObjId/2 < 3:               #bad cell edge - reset
    2852                 value = controls[6+ObjId/2]
     2851            if ObjId//2 < 3:               #bad cell edge - reset
     2852                value = controls[6+ObjId//2]
    28532853            else:                       #bad angle
    28542854                value = 90.
  • trunk/GSASIIspc.py

    r3186 r3191  
    29802980        'C m c 21','C c m 21','C c c 2','C m 2 m','C 2 m m',
    29812981        'C m 2 a','C 2 m b','C c 2 m','C 2 c m','C c 2 a','C 2 c b',
    2982         'C m c m','C m c a','C c m b',
     2982        'C m c m','C c m m','C m c a','C c m b',
    29832983        'C m m m','C c c m','C m m a','C m m b','C c c a','C c c b',),
     2984    'Ammm':('A 21 2 2','A 2 2 2','A 2 m m',
     2985        'A 21 m a','A 21 a m','A 2 a a','A m 2 m','A m m 2',
     2986        'A b m 2','A c 2 m','A m a 2','A m 2 a','A b a 2','A c 2 a',
     2987        'A m m a','A m a m','A b m a','A c a m',
     2988        'A m m m','A m a a','A b m m','A c m m','A c a a','A b a a',),
     2989    'Bmmm':('B 2 21 2','B 2 2 2','B m 2 m',
     2990        'B m 21 b','B b 21 m','B b 2 b','B m m 2','B 2 m m',
     2991        'B 2 c m','B m a 2','B 2 m b','B b m 2','B 2 c b','B b a 2',
     2992        'B b m m','B m m b','B b c m','B m a b',
     2993        'B m m m','B b m b','B m a m','B m c m','B b a b','B b c b',),
    29842994    'Immm':('I 2 2 2','I 21 21 21',
    29852995        'I m m 2','I m 2 m','I 2 m m',
  • trunk/imports/G2phase_CIF.py

    r3186 r3191  
    5555        while self.Phase['ranId'] in usedRanIdList:
    5656            self.Phase['ranId'] = ran.randint(0,sys.maxsize)
     57        self.MPhase = G2obj.SetNewPhase(Name='new phase') # create a new empty phase dict
     58        # make sure the ranId is really unique!
     59        while self.MPhase['ranId'] in usedRanIdList:
     60            self.MPhase['ranId'] = ran.randint(0,sys.maxsize)
    5761        returnstat = False
    5862        cellitems = (
     
    7478        try:
    7579            cf = G2obj.ReadCIF(filename)
    76         except:
    77             msg = 'Unreadable cif file'
     80        except cif.StarError as msg:
     81            msg  = 'Unreadable cif file\n'+str(msg)
    7882            self.errors = msg
    7983            self.warnings += msg
     
    109113                    choice[-1] += '1 atom'
    110114                else:
    111                     choice[-1] += ('%d' % nd) + ' atoms'
     115                    choice[-1] += ('%d' % na) + ' atoms'
    112116                choice[-1] += ', cell: '
    113117                fmt = "%.2f,"
     
    131135            E = True
    132136            Super = False
    133             if blk.get("_space_group_ssg_name",''):
     137            moddim = int(blk.get("_cell_modulation_dimension",'0'))
     138            if moddim:
    134139                Super = True
     140                if moddim > 1:
     141                    msg = 'more than 3+1 super symmetry is not allowed in GSAS-II'
     142                    self.errors = msg
     143                    self.warnings += msg
     144                    return False
     145                if blk.get('_cell_subsystems_number'):
     146                    msg = 'Composite super structures not allowed in GSAS-II'
     147                    self.errors = msg
     148                    self.warnings += msg
     149                    return False
     150                sspgrp = blk.get("_space_group_ssg_name",'')
     151                if 'X' in sspgrp:
     152                    self.warnings += '\nAd hoc incommensurate space group '+sspgrp+' is not allowed in GSAS-II'
     153                    self.errors = 'Ad hoc incommensurate space groups not allowed in GSAS-II'
     154                    return False
    135155            magnetic = False
    136156            self.Phase['General']['Type'] = 'nuclear'
     
    139159                SpGrp = blk.get("_space_group_name_H-M_alt",'')
    140160            if not SpGrp:
    141                 SpGrp = blk.get("_parent_space_group.name_H-M",'')
     161                MSpGrp = blk.get("_space_group.magn_name_BNS",'')
     162                SpGrp = MSpGrp.replace("'",'')
     163                if '_' in SpGrp: SpGrp = SpGrp.split('_')[1]
    142164                if SpGrp:   #TODO need to decide if read nuclear phase or magnetic phase
    143165                    magnetic = True
    144                     self.Phase['General']['Type'] = 'magnetic'
    145                     self.Phase['General']['AtomPtrs'] = [3,1,10,12]
     166                    self.MPhase['General']['Type'] = 'magnetic'
     167                    self.MPhase['General']['AtomPtrs'] = [3,1,10,12]
    146168            if Super:
    147                 sspgrp = blk.get("_space_group_ssg_name",'').split('(')
     169                sspgrp = blk.get("_space_group_ssg_name",'')
     170                sspgrp = sspgrp.split('(')
    148171                SpGrp = sspgrp[0]
    149172                SuperSg = '('+sspgrp[1].replace('\\','')
     
    152175            SpGrp = SpGrp.replace('_','')
    153176            # try normalizing the space group, to see if we can pick the space group out of a table
     177            if Super:
     178                SpGrp = G2spc.StandardizeSpcName(SpGrp)
     179                if not SpGrp:
     180                    msg = 'GSAS-II failed to find space group symbol; not a valid cif file'
     181                    self.errors = msg
     182                    self.warnings += msg
     183                    return False
     184            if not SpGrp:
     185                msg = 'GSAS-II failed to find space group symbol; not a valid cif file'
     186                self.errors = msg
     187                self.warnings += msg
     188                return False
    154189            E,SGData = G2spc.SpcGroup(SpGrp)
    155190            if E and SpGrp:
     
    165200                else:
    166201                    self.warnings += 'ERROR in space group symbol '+SpGrp
    167                     if 'X' in SpGrp:
    168                         self.warnings += '\nAd hoc incommensurate space groups not allowed in GSAS-II'
    169202                    self.warnings += '\nThe space group has been set to "P 1". '
    170203                    self.warnings += "Change this in phase's General tab."
     
    173206                SGData = G2obj.P1SGData # P 1
    174207            self.Phase['General']['SGData'] = SGData
     208            if magnetic:
     209                self.MPhase['General']['SGData'] = SGData               
    175210            if Super:
    176211                E,SSGData = G2spc.SSpcGroup(SGData,SuperSg)
     
    188223            Volume = G2lat.calc_V(G2lat.cell2A(cell))
    189224            self.Phase['General']['Cell'] = [False,]+cell+[Volume,]
     225            if magnetic:
     226                self.MPhase['General']['Cell'] = [False,]+cell+[Volume,]               
    190227            if Super:
    191                 if int(blk.get('_cell_modulation_dimension','')) > 1:
    192                     msg = 'more than 3+1 super symmetry is not allowed in GSAS-II'
    193                     self.errors = msg
    194                     self.warnings += msg
    195                     return False
    196228                waveloop = blk.GetLoop('_cell_wave_vector_seq_id')
    197229                waveDict = dict(waveloop.items())
     
    224256                displSloop = None
    225257                displFloop = None
    226                 dispSdict = {}
    227                 dispFdict = {}
     258                displSdict = {}
     259                displFdict = {}
    228260                UijFloop = None
    229261                UijFdict = {}
     
    244276                    UijFdict = dict(UijFloop.items())
    245277            self.Phase['Atoms'] = []
     278            if magnetic:
     279                self.MPhase['Atoms'] = []
    246280            G2AtomDict = {  '_atom_site_type_symbol' : 1,
    247281                            '_atom_site_label' : 0,
     
    320354                    Spos = np.zeros((4,6))
    321355                    nim = -1
    322                     for i,item in enumerate(displFdict['_atom_site_displace_fourier_atom_site_label']):
    323                         if item == atomlist[0]:
    324                             waveType = 'Fourier'                               
    325                             ix = ['x','y','z'].index(displFdict['_atom_site_displace_fourier_axis'][i])
    326                             im = int(displFdict['_atom_site_displace_fourier_wave_vector_seq_id'][i])
    327                             if im != nim:
    328                                 nim = im
    329                             val = displFdict['_atom_site_displace_fourier_param_sin'][i]
    330                             Spos[im-1][ix] = cif.get_number_with_esd(val)[0]
    331                             val = displFdict['_atom_site_displace_fourier_param_cos'][i]
    332                             Spos[im-1][ix+3] = cif.get_number_with_esd(val)[0]
     356                    waveType = 'Fourier'                               
     357                    if displFdict:
     358                        for i,item in enumerate(displFdict['_atom_site_displace_fourier_atom_site_label']):
     359                            if item == atomlist[0]:
     360                                waveType = 'Fourier'                               
     361                                ix = ['x','y','z'].index(displFdict['_atom_site_displace_fourier_axis'][i])
     362                                im = int(displFdict['_atom_site_displace_fourier_wave_vector_seq_id'][i])
     363                                if im != nim:
     364                                    nim = im
     365                                val = displFdict['_atom_site_displace_fourier_param_sin'][i]
     366                                Spos[im-1][ix] = cif.get_number_with_esd(val)[0]
     367                                val = displFdict['_atom_site_displace_fourier_param_cos'][i]
     368                                Spos[im-1][ix+3] = cif.get_number_with_esd(val)[0]
    333369                    if nim >= 0:
    334370                        Spos = [[spos,False] for spos in Spos[:nim]]
Note: See TracChangeset for help on using the changeset viewer.