Changeset 3219


Ignore:
Timestamp:
Jan 11, 2018 2:27:40 PM (5 years ago)
Author:
vondreele
Message:

fix import mag commensurate structures - all drawn correctly now
modulated mags not correct yet

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3216 r3219  
    891891                psub = self.GPXtree.AppendItem(parent=sub,text=PhaseName)
    892892                self.GPXtree.SetItemPyData(psub,rd.MPhase)
    893             except AttributeError:
     893            except (AttributeError,TypeError):
    894894                pass
    895895            self.GPXtree.Expand(self.root) # make sure phases are seen
  • trunk/GSASIImath.py

    r3215 r3219  
    16131613    '''
    16141614    generalData = data['General']
     1615    cell = generalData['Cell'][1:7]
     1616    ABC = np.array(cell[:3])
     1617    G,g = G2lat.cell2Gmat(cell)
    16151618    SGData = generalData['SGData']
    16161619    SSGData = generalData['SSGData']
     
    16351638        for ind in indx:
    16361639            drawatom = drawAtoms[ind]
    1637             dratxyz = np.array(drawatom[dcx:dcx+3])
    16381640            opr = drawatom[dcs-1]
    1639             sop,ssop,icent = G2spc.OpsfromStringOps(opr,SGData,SSGData)
    1640             sdet,ssdet,dtau,dT,tauT = G2spc.getTauT(tau,sop,ssop,dratxyz,modul)
     1641            sop,ssop,icent,cent,unit = G2spc.OpsfromStringOps(opr,SGData,SSGData)
     1642            drxyz = (np.inner(sop[0],atxyz)+sop[1])*icent+cent+np.array(unit)
     1643            sdet,ssdet,dtau,dT,tauT = G2spc.getTauT(tau,sop,ssop,drxyz,modul)
    16411644            tauT *= icent       #invert wave on -1
    16421645            wave = np.zeros(3)
  • trunk/GSASIIphsGUI.py

    r3215 r3219  
    8787        if len(Cents) > 1:
    8888            cents = text[-1].split(';')
     89        lentable = len(self.table)
    8990        for line in text:
    9091            mainSizer.Add(wx.StaticText(self.panel,label='     %s     '%(line)),0,WACV)
     
    103104                    tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0)
    104105                    Red = True
     106                    lentable //= 2
    105107                    j = 0
    106108                    continue
     
    116118                        tableSizer.Add(text,0,WACV)
    117119                text = wx.StaticText(self.panel,label=' (%s) '%(self.names[j]))
    118                 if self.spins[j+ic*len(self.table)] < 0 or Red:
     120                if self.spins[j+ic*lentable] < 0 or Red:
    119121                    text.SetForegroundColour('Red')
    120122                tableSizer.Add(text,0,WACV)
     
    11551157                generalData['AtomPtrs'] = [3,1,10,12]
    11561158        if generalData['Modulated']:
     1159            if 'SGGray' not in generalData['SGData']:
     1160                generalData['SGData']['SGGray'] = False
    11571161            generalData['Modulated'] = True
    11581162            if 'Super' not in generalData:
    11591163                generalData['Super'] = 1
    1160                 generalData['SuperVec'] = [[0,0,.1],False,4]
     1164                generalData['SuperVec'] = [[0.,0.,0.],False,4]
    11611165                generalData['SSGData'] = {}
    11621166            if '4DmapData' not in generalData:
     
    13391343                        wx.CallAfter(UpdateGeneral)
    13401344                    elif generalData['Type'] == 'magnetic':
     1345                        generalData['AtomPtrs'] = [3,1,10,12]
    13411346                        SGData = generalData['SGData']
    13421347                        Nops = len(SGData['SGOps'])*len(SGData['SGCen'])
     
    14681473                            if 'Super' not in generalData:
    14691474                                generalData['Super'] = 1
    1470                                 generalData['SuperVec'] = [[0,0,.1],False,4]
     1475                                generalData['SuperVec'] = [[0.,0.,0.],False,4]
    14711476                                generalData['SSGData'] = {}
    14721477                            if '4DmapData' not in generalData:
     
    17571762                text[0] = ' Magnetic Space Group: '+SGData['MagSpGrp']
    17581763                text[3] = ' The magnetic lattice point group is '+SGData['MagPtGp']
    1759                 if SGData['SGGray']:
     1764                if SGData['SGGray'] and "1'" not in text[0]:
    17601765                    text[0] += " 1'"
    17611766                    text[3] += "1'"
     
    17651770            Indx = {}
    17661771            MagSym = SGData['MagSpGrp']
    1767             if SGData['SGGray']:
     1772            if SGData['SGGray'] and "1'" not in MagSym:
    17681773                MagSym += " 1'"
    17691774            magSizer = wx.BoxSizer(wx.VERTICAL)
     
    18061811            def OnSuperGp(event):   #for HKLF needs to reject SSgps not agreeing with modVec!
    18071812                event.Skip()
    1808                 SSymbol = superGp.GetValue()
    1809                 E,SSGData = G2spc.SSpcGroup(generalData['SGData'],SSymbol)
     1813                try:
     1814                    SSymbol = superGp.GetValue()
     1815                except AttributeError:
     1816                    SSymbol = superGp.GetLabel()
     1817                SSGData = generalData['SSGData']
     1818                if not generalData['SGData']['SGFixed']:
     1819                    E,SSGData = G2spc.SSpcGroup(generalData['SGData'],SSymbol)
    18101820                if SSGData:
    18111821                    Vec = generalData['SuperVec'][0]     #(3+1) only
     
    18361846            modSizer = wx.BoxSizer(wx.HORIZONTAL)
    18371847            modSizer.Add(wx.StaticText(General,label=' '+name.capitalize()+' structure controls: '),0,WACV)
    1838             modSizer.Add(wx.StaticText(General,label=' Superspace group: %s '%generalData['SGData']['SpGrp']),0,WACV)
     1848            SpGrp = generalData['SGData']['SpGrp']
     1849            if generalData['SGData']['SGGray']:
     1850                SpGrp += " 1'"
     1851            modSizer.Add(wx.StaticText(General,label=' Superspace group: %s '%SpGrp),0,WACV)
    18391852            SSGptgp = generalData['SGData']['SGLatt']+generalData['SGData']['SGPtGrp']
    18401853            SSChoice = G2spc.ptssdict.get(SSGptgp,[])
     1854            if generalData['SGData']['SGGray']:
     1855                SSChoice = [item+'s' for item in SSChoice]
    18411856            Choice = []
    1842             for item in SSChoice:
    1843                 if generalData['SGData'].get('SGGray',False):
    1844                     E,SSG = G2spc.SSpcGroup(generalData['SGData'],item+'s')                   
    1845                 else:
     1857            if not generalData['SGData']['SGFixed']:
     1858                for item in SSChoice:
    18461859                    E,SSG = G2spc.SSpcGroup(generalData['SGData'],item)
    1847                 if SSG: Choice.append(item)
    1848             if SSChoice:
     1860                    if SSG: Choice.append(item)
     1861            if len(Choice):
    18491862                superGp = wx.ComboBox(General,value=generalData['SuperSg'],choices=Choice,style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER)
    18501863                superGp.Bind(wx.EVT_TEXT_ENTER,OnSuperGp)
    18511864                superGp.Bind(wx.EVT_COMBOBOX,OnSuperGp)
    1852             else:   #nonstandard space group symbol not in my dictionary
    1853                 superGp = wx.TextCtrl(General,value=generalData['SuperSg'],style=wx.TE_PROCESS_ENTER)
    1854                 superGp.Bind(wx.EVT_TEXT_ENTER,OnSuperGp)                       
     1865            else:
     1866                superGp = wx.StaticText(General,label=generalData['SuperSg'])
    18551867            modSizer.Add(superGp,0,WACV)
    18561868            modSizer.Add((5,5),0)
     
    22052217            G2frame.dataWindow.GeneralCalc.Enable(G2G.wxID_MULTIMCSA,False)
    22062218            G2frame.dataWindow.GeneralCalc.Enable(G2G.wxID_4DCHARGEFLIP,True)
    2207             mainSizer.Add(ModulatedSizer(generalData['Type']))
     2219            mainSizer.Add(ModulatedSizer(generalData['Type']+' modulated'))
    22082220            G2G.HorizontalLine(mainSizer,General)
    22092221        else:
     
    23002312            if r < 0:                          #double click on col label! Change all atoms!
    23012313                noSkip = True
     2314                parms = ''
    23022315                if Atoms.GetColLabelValue(c) == 'refine':
    23032316                    Type = generalData['Type']
     
    23812394                elif Atoms.GetColLabelValue(c) == 'Uiso':       #this needs to ask for value
    23822395                    pass                                        #& then change all 'I' atoms
     2396                else:
     2397                    return
    23832398                if noSkip:
    23842399                    ui = colLabels.index('U11')
     
    29933008                mom = np.array(atom[7:10])
    29943009                Mom = G2spc.ApplyStringOpsMom(opr,SGData,mom)
    2995                 atomInfo = oldatom[:5]+list(Mom)+oldatom[8:]   
     3010                if atom[12] == 'A':                   
     3011                    X,U = G2spc.ApplyStringOps(opr,SGData,atom[3:6],atom[14:20])
     3012                    atomInfo = [atom[:2]+list(X)+list(Mom)+oldatom[8:12]+atom[12:14]+list(U)+oldatom[20:]][0]
     3013                else:
     3014                    X = G2spc.ApplyStringOps(opr,SGData,atom[3:6])
     3015                    atomInfo = [atom[:2]+list(X)+list(Mom)+oldatom[8:12]+atom[12:]+oldatom[20:]][0]
    29963016            else:
    29973017                atomInfo = [atom[:2]+atom[3:6]+atom[7:10]+['1',]+['vdW balls',]+
     
    52335253                        XYZ = np.array(atomData[ind][cx:cx+3])
    52345254                        XYZ = np.inner(M,XYZ)+T
    5235                         if Inv:
     5255                        if Inv and not SGData['SGFixed']:
    52365256                            XYZ = -XYZ
    52375257                        XYZ = XYZ+cent+Cell
     
    53485368                        XYZ = np.array(atomData[ind][cx:cx+3])
    53495369                        XYZ = np.inner(M,XYZ)+T
    5350                         if Inv:
     5370                        if Inv and not SGData['SGFixed']:
    53515371                            XYZ = -XYZ
    53525372                        XYZ = XYZ+cent+Cell
  • trunk/GSASIIplot.py

    r3215 r3219  
    57185718    generalData = data['General']
    57195719    cell = generalData['Cell'][1:7]
    5720     ABC = np.array(cell[1:4])
     5720    ABC = np.array(cell[0:3])
    57215721    Vol = generalData['Cell'][7:8][0]
    57225722    Amat,Bmat = G2lat.cell2AB(cell)         #Amat - crystal to cartesian, Bmat - inverse
     
    58155815                    raise Exception("PIL/pillow Image module not found")
    58165816            projFile = G2frame.GSASprojectfile
    5817             Fname = (os.path.splitext(projFile)[0]+'.'+mode).replace('*','+')
     5817            if projFile:
     5818                Fname = (os.path.splitext(projFile)[0]+'.'+mode).replace('*','+')
     5819            else:
     5820                dlg = wx.FileDialog(G2frame, 'Choose graphics save file',
     5821                    wildcard='Graphics file (*.'+mode+')|*.'+mode,style=wx.FD_OPEN| wx.CHANGE_DIR)
     5822                try:
     5823                    if dlg.ShowModal() == wx.ID_OK:
     5824                        Fname = dlg.GetPath()
     5825                finally:
     5826                    dlg.Destroy()           
    58185827            size = Page.canvas.GetSize()
    58195828            GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
     
    59175926            G2frame.tau = 0.
    59185927            for i in range(100):
    5919                 G2frame.tau += 0.1
     5928                G2frame.tau += 0.02
    59205929                G2frame.tau %= 1.
    59215930                G2frame.G2plotNB.status.SetStatusText('Modulation tau = %.2f'%(G2frame.tau),1)
     
    59465955                    G2frame.tau = 0.
    59475956                elif key in ['+','=']:
    5948                     G2frame.tau += 0.1
     5957                    G2frame.tau += 0.05
    59495958                elif key == '-':
    5950                     G2frame.tau -= 0.1
     5959                    G2frame.tau -= 0.05
    59515960                G2frame.tau %= 1.   #force 0-1 range; makes loop
    59525961                G2frame.G2plotNB.status.SetStatusText('Modulation tau = %.2f'%(G2frame.tau),1)
  • trunk/GSASIIspc.py

    r3215 r3219  
    968968    XYZ = {'x':[1,0,0],'-x':[-1,0,0],'y':[0,1,0],'-y':[0,-1,0],'z':[0,0,1],'-z':[0,0,-1],
    969969           'x-y':[1,-1,0],'-x+y':[-1,1,0],}
    970 #    TRA = {'+1/2':0.5,'+1/4':.25,'+3/4':.75,'+1/3':1./3.,'+2/3':2./3.,'+1/6':1./6.,'+5/6':5./6.,
    971 #           '+1/9'}
    972970    ops = mcifOpr.split(",")
    973971    M = []
     
    984982    spnflp = 1
    985983    if '-1' in ops[3]:
     984        spnflp = -1
     985    return np.array(M),np.array(T),spnflp
     986           
     987def MagSSText2MTS(mcifOpr):
     988    "From magnetic super space group cif text returns matrix/translation + spin flip"
     989    XYZ = {'x1':[1,0,0,0],'-x1':[-1,0,0,0],'x2':[0,1,0,0],'-x2':[0,-1,0,0],'x3':[0,0,1,0],'-x3':[0,0,-1,0],
     990           'x1-x2':[1,-1,0,0],'-x1+x2':[-1,1,0,0],'x4':[0,0,0,1],'-x4':[0,0,0,-1],
     991           '-x1+x4':[-1,0,0,1],'-x2+x4':[0,-1,0,1]}
     992    ops = mcifOpr.split(",")
     993    M = []
     994    T = []
     995    for op in ops[:4]:
     996        ip = len(op)
     997        if '/' in op:
     998            ip = op.index('/')-2
     999            T.append(eval(op[ip:]))
     1000        else:
     1001            T.append(0.)
     1002        M.append(XYZ[op[:ip]])
     1003    spnflp = 1
     1004    if '-1' in ops[4]:
    9861005        spnflp = -1
    9871006    return np.array(M),np.array(T),spnflp
     
    10331052    opNum = abs(Opr)%100
    10341053    cent = abs(Opr)//100
    1035     if Opr < 0:
     1054    if Opr < 0 and not SGData['SGFixed']:
    10361055        opNum += Nops
    10371056    if SGData['SGInv'] and not SGData['SGFixed']:
     
    13881407                    gensym = 'ss0'
    13891408        return gensym
    1390                    
    1391     def checkGen(gensym):
    1392         '''
    1393     GenSymList = ['','s','0s','s0', '00s','0s0','s00','s0s','ss0','0ss','q00','0q0','00q','qq0','q0q', '0qq',
    1394         'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s',]
    1395         '''
    1396         sym = ''.join(gensym)
    1397         if SGData['SGGray'] and sym in ['s','0s','00s','000s','0000s']:
    1398             return True
    1399         if SGData.get('SGGray',False):
    1400             if sym and sym[-1] == 's':
    1401                 sym = sym[:-1]
    1402                 if sym == '':
    1403                     return True
    1404             else:
    1405                 sym += 's'
    1406                 return True
    1407 # monoclinic - all done
    1408         if str(SSGKl) == '[-1]' and sym == 's':
    1409             return False
    1410         elif SGData['SGPtGrp'] in ['2/m',]:
    1411             if str(SSGKl) == '[-1, 1]' and sym == '0s':
    1412                 return False
    1413             elif str(SSGKl) == '[1, -1]' and sym == 's0':
    1414                 return False
    1415 #orthorhombic - all
    1416         elif SGData['SGPtGrp'] in ['222',] and sym not in ['','s00','0s0','00s']:
    1417             return False
    1418         elif SGData['SGPtGrp'] in ['2mm','m2m','mm2','mmm'] and sym not in ['',]+GenSymList[4:16]:
    1419             return False
    1420 #tetragonal - all done
    1421         elif SGData['SGPtGrp'] in ['4',] and sym not in ['','s','q']:
    1422             return False
    1423         elif SGData['SGPtGrp'] in ['-4',] and sym not in ['',]:
    1424             return False             
    1425         elif SGData['SGPtGrp'] in ['4/m',] and sym not in ['','s0','q0']:
    1426             return False
    1427         elif SGData['SGPtGrp'] in ['422',] and sym not in ['','q00','s00']:
    1428             return False         
    1429         elif SGData['SGPtGrp'] in ['4mm',] and sym not in ['','ss0','s0s','0ss','00s','qq0','qqs']:
    1430             return False
    1431         elif SGData['SGPtGrp'] in ['-4m2',] and sym not in ['','0s0','0q0']:
    1432             return False
    1433         elif SGData['SGPtGrp'] in ['-42m',] and sym not in ['','0ss','00q',]:
    1434             return False
    1435         elif SGData['SGPtGrp'] in ['4/mmm',] and sym not in ['','s00s','s0s0','00ss','000s',]:
    1436             return False
    1437 #trigonal/rhombohedral - all done
    1438         elif SGData['SGPtGrp'] in ['3',] and sym not in ['','t']:
    1439             return False
    1440         elif SGData['SGPtGrp'] in ['-3',] and sym not in ['',]:
    1441             return False
    1442         elif SGData['SGPtGrp'] in ['32',] and sym not in ['','t0']:
    1443             return False
    1444         elif SGData['SGPtGrp'] in ['321','312'] and sym not in ['','t00']:
    1445             return False
    1446         elif SGData['SGPtGrp'] in ['3m','-3m'] and sym not in ['','0s']:
    1447             return False
    1448         elif SGData['SGPtGrp'] in ['3m1','-3m1'] and sym not in ['','0s0']:
    1449             return False
    1450         elif SGData['SGPtGrp'] in ['31m','-31m'] and sym not in ['','00s']:
    1451             return False
    1452 #hexagonal - all done
    1453         elif SGData['SGPtGrp'] in ['6',] and sym not in ['','s','h','t']:
    1454             return False
    1455         elif SGData['SGPtGrp'] in ['-6',] and sym not in ['',]:
    1456             return False
    1457         elif SGData['SGPtGrp'] in ['6/m',] and sym not in ['','s0']:
    1458             return False
    1459         elif SGData['SGPtGrp'] in ['622',] and sym not in ['','h00','t00','s00']:
    1460             return False         
    1461         elif SGData['SGPtGrp'] in ['6mm',] and sym not in ['','ss0','s0s','0ss']:
    1462             return False
    1463         elif SGData['SGPtGrp'] in ['-6m2',] and sym not in ['','0s0']:
    1464             return False
    1465         elif SGData['SGPtGrp'] in ['-62m',] and sym not in ['','00s']:
    1466             return False
    1467         elif SGData['SGPtGrp'] in ['6/mmm',] and sym not in ['','s00s','s0s0','00ss']:
    1468             return False
    1469         return True
    1470        
     1409                           
    14711410    LaueModList = [
    14721411        'abg','ab0','ab1/2','a0g','a1/2g',  '0bg','1/2bg','a00','a01/2','a1/20',
     
    15041443    if len(gensym) and Ngen != len(SSGKl):
    15051444        return 'Wrong number of items in generator symbol '+''.join(gensym),None
    1506 #    if not checkGen(gensym):
    1507 #        return 'Generator '+''.join(gensym)+' not consistent with space group '+SGData['SpGrp'],None
    15081445    gensym = specialGen(gensym[:Ngen],modsym)
    15091446    genQ = [Fracs[mod] for mod in gensym[:Ngen]]
     
    15121449    SSGData = {'SSpGrp':SGData['SpGrp']+SSymbol,'modQ':modQ,'modSymb':modsym,'SSGKl':SSGKl}
    15131450    SSCen = np.zeros((len(SGData['SGCen']),4))
    1514     for icen,cen in enumerate(SGData['SGCen']):
    1515         SSCen[icen,0:3] = cen
    1516     SSCen[0] = np.zeros(4)
     1451    if SGData['SGFixed']:
     1452        for icen,cen in enumerate(SGData['SGCen']):
     1453            SSCen[icen] = cen
     1454    else:
     1455        for icen,cen in enumerate(SGData['SGCen']):
     1456            SSCen[icen,0:3] = cen
     1457        SSCen[0] = np.zeros(4)
    15171458    SSGData['SSGCen'] = SSCen
    15181459    SSGData['SSGOps'] = []
     
    15201461        T = np.zeros(4)
    15211462        ssop = np.zeros((4,4))
    1522         ssop[:3,:3] = op[0]
    1523         T[:3] = op[1]
     1463        if SGData['SGFixed']:
     1464            ssop = op[0]
     1465            T = op[1]
     1466        else:
     1467            ssop[:3,:3] = op[0]
     1468            T[:3] = op[1]
    15241469        SSGData['SSGOps'].append([ssop,T])
    15251470    E,Result = genSSGOps()
     
    16321577    modQ = [Fracs[mod] for mod in modSymb]
    16331578    if newMod:
    1634         newVec = [0.1 if (vec == 0.0 and mod in ['a','b','g']) else vec for [vec,mod] in zip(Vec,modSymb)]
     1579        newVec = Vec
     1580        if not np.any(Vec):
     1581            newVec = [0.1 if (vec == 0.0 and mod in ['a','b','g']) else vec for [vec,mod] in zip(Vec,modSymb)]
    16351582        return [Q if mod not in ['a','b','g'] and vec != Q else vec for [vec,mod,Q] in zip(newVec,modSymb,modQ)],  \
    16361583            [True if mod in ['a','b','g'] else False for mod in modSymb]
     
    17801727                    U = np.inner(M,np.inner(U,M).T)
    17811728                    newUij = U2Uij(U)
    1782                 if invers:
     1729                if invers and not SGData['SGFixed']:
    17831730                    XT = -XT
    17841731                XT += C
     
    21672114   
    21682115def getTauT(tau,sop,ssop,XYZ,wave=np.zeros(3)):
    2169     phase = 2.*np.pi*np.sum(XYZ*wave)
     2116    phase = 4.*np.pi*np.sum(XYZ*wave)
    21702117    ssopinv = nl.inv(ssop[0])
    21712118    mst = ssopinv[3][:3]
     
    21902137    Ax[0] = abs(Ax[0])
    21912138    nA = Ax[0]%100-1
    2192     return SGOps[nA],SSGOps[nA],iC
     2139    nC = Ax[0]//100
     2140    unit = [0,0,0]
     2141    if len(Ax) > 1:
     2142        unit = eval('['+Ax[1]+']')
     2143    return SGOps[nA],SSGOps[nA],iC,SGData['SGCen'][nC],unit
    21932144   
    21942145def GetSSfxuinel(waveType,nH,XYZ,SGData,SSGData,debug=False):
     
    31393090        'P -6 2 c','P 6/m m m','P 6/m c c','P 63/m c m','P 63/m m c',),
    31403091    'Pm3m': ('P 2 3','P 21 3','P m 3','P n 3','P a 3','P 4 3 2','P 42 3 2',
    3141         'P 43 3 2','P 41 3 2','P -4 3 m','P -4 3 n','P m 3 m','P n 3 n',
     3092        'P 43 3 2','P 41 3 2','P -4 3 m','P -4 3 n','P m 3 m','P m -3 m','P n 3 n',
    31423093        'P m 3 n','P n 3 m','P n -3 n','P n -3 m','P m -3 n',),
    31433094    'Im3m':('I 2 3','I 21 3','I m -3','I a -3', 'I 4 3 2','I 41 3 2',
  • trunk/GSASIIstrMath.py

    r3157 r3219  
    31333133            #??
    31343134        Dij = GetDij(phfx,SGData,parmDict)
    3135         A = [parmDict[pfx+'A%d'%(i)]+Dij[i] for i in range(6)]
     3135        A = [parmDict[pfx+'A%d'%(i)]+Dij[i] for i in range(6)]  #TODO: need to do someting if Dij << 0.
    31363136        G,g = G2lat.A2Gmat(A)       #recip & real metric tensors
    31373137        if np.any(np.diag(G)<0.) or np.any(np.isnan(A)):
  • trunk/imports/G2phase_CIF.py

    r3215 r3219  
    239239                SGData = G2obj.P1SGData # P 1
    240240            self.Phase['General']['SGData'] = SGData
    241 
    242             if magnetic and not Super:
    243                 SGData['SGFixed'] = True
    244                 try:
    245                     sgoploop = blk.GetLoop('_space_group_symop_magn.id')
    246                     sgcenloop = blk.GetLoop('_space_group_symop_magn_centering.id')
    247                     opid = sgoploop.GetItemPosition('_space_group_symop_magn_operation.xyz')[1]
    248                     centid = sgcenloop.GetItemPosition('_space_group_symop_magn_centering.xyz')[1]                   
    249                 except KeyError:        #old mag cif names
    250                     sgoploop = blk.GetLoop('_space_group_symop.magn_id')
    251                     sgcenloop = blk.GetLoop('_space_group_symop.magn_centering_id')
    252                     opid = sgoploop.GetItemPosition('_space_group_symop.magn_operation_xyz')[1]
    253                     centid = sgcenloop.GetItemPosition('_space_group_symop.magn_centering_xyz')[1]
    254                 SGData['SGOps'] = []
    255                 SGData['SGCen'] = []
    256                 spnflp = []
    257                 for op in sgoploop:
    258                     M,T,S = G2spc.MagText2MTS(op[opid])
    259                     SGData['SGOps'].append([np.array(M,dtype=float),T])
    260                     spnflp.append(S)
    261                 censpn = []
    262                 for cent in sgcenloop:
    263                     M,C,S = G2spc.MagText2MTS(cent[centid])
    264                     SGData['SGCen'].append(C)
    265                     censpn += list(np.array(spnflp)*S)
    266                 self.MPhase['General']['SGData'] = SGData
    267                 self.MPhase['General']['SGData']['SpnFlp'] = censpn
    268                 self.MPhase['General']['SGData']['MagSpGrp'] = MSpGrp
    269                 MagPtGp = blk.get('_space_group.magn_point_group')
    270                 if not MagPtGp:
    271                     MagPtGp = blk.get('_space_group_magn.point_group_name')
    272                 self.MPhase['General']['SGData']['MagPtGp'] = MagPtGp
    273 #                GenSym,GenFlg = G2spc.GetGenSym(SGData)
    274 #                self.MPhase['General']['SGData']['GenSym'] = GenSym
    275 #                self.MPhase['General']['SGData']['GenFlg'] = GenFlg
    276 
    277241            if Super:
    278242                E,SSGData = G2spc.SSpcGroup(SGData,SuperSg)
     
    288252#                    self.MPhase['General']['SGData']['SpnFlp'] = censpn
    289253                    self.MPhase['General']['SGData']['MagSpGrp'] = MSSpGrp.replace(',','').replace('\\','')
    290                     self.MPhase['General']['SGData']['MagPtGp'] = blk.get('_space_group.magn_point_group')
     254#                    self.MPhase['General']['SGData']['MagPtGp'] = blk.get('_space_group.magn_point_group')
     255#                    if not self.MPhase['General']['SGData']['MagPtGp']:
     256#                        self.MPhase['General']['SGData']['MagPtGp'] = blk.get('_space_group.magn_point_group_name')
    291257                    self.MPhase['General']['SSGData'] = SSGData
    292258    #                GenSym,GenFlg = G2spc.GetGenSym(SGData)
    293259    #                self.MPhase['General']['SGData']['GenSym'] = GenSym
    294260    #                self.MPhase['General']['SGData']['GenFlg'] = GenFlg
     261
     262            if magnetic:    #replace std operaors with those from cif file - probably not the same!
     263                SGData['SGFixed'] = True
     264                SGData['SGOps'] = []
     265                SGData['SGCen'] = []
     266                if Super:
     267                    SSGData['SSGOps'] = []
     268                    SSGData['SSGCen'] = []
     269                    try:
     270                        sgoploop = blk.GetLoop('_space_group_symop_magn_ssg_operation.id')
     271                        sgcenloop = blk.GetLoop('_space_group_symop_magn_ssg_centering.id')
     272                        opid = sgoploop.GetItemPosition('_space_group_symop_magn_ssg_operation.algebraic')[1]
     273                        centid = sgcenloop.GetItemPosition('_space_group_symop_magn_ssg_centering.algebraic')[1]                   
     274                    except KeyError:        #old mag cif names
     275                        sgoploop = blk.GetLoop('_space_group_symop.magn_ssg_id')
     276                        sgcenloop = blk.GetLoop('_space_group_symop.magn_ssg_centering_id')
     277                        opid = sgoploop.GetItemPosition('_space_group_symop.magn_ssg_operation_algebraic')[1]
     278                        centid = sgcenloop.GetItemPosition('_space_group_symop.magn_ssg_centering_algebraic')[1]
     279                    spnflp = []
     280                    for op in sgoploop:
     281                        M,T,S = G2spc.MagSSText2MTS(op[opid])
     282                        SSGData['SSGOps'].append([np.array(M,dtype=float),T])
     283                        SGData['SGOps'].append([np.array(M,dtype=float)[:3,:3],T[:3]])
     284                        spnflp.append(S)
     285                    censpn = []
     286                    for cent in sgcenloop:
     287                        M,C,S = G2spc.MagSSText2MTS(cent[centid])
     288                        SSGData['SSGCen'].append(C)
     289                        if not C[3]:
     290                            SGData['SGCen'].append(C[:3])
     291                        censpn += list(np.array(spnflp)*S)
     292                    self.MPhase['General']['SSGData'] = SSGData
     293                else:   
     294                    try:
     295                        sgoploop = blk.GetLoop('_space_group_symop_magn.id')
     296                        sgcenloop = blk.GetLoop('_space_group_symop_magn_centering.id')
     297                        opid = sgoploop.GetItemPosition('_space_group_symop_magn_operation.xyz')[1]
     298                        centid = sgcenloop.GetItemPosition('_space_group_symop_magn_centering.xyz')[1]                   
     299                    except KeyError:        #old mag cif names
     300                        sgoploop = blk.GetLoop('_space_group_symop.magn_id')
     301                        sgcenloop = blk.GetLoop('_space_group_symop.magn_centering_id')
     302                        opid = sgoploop.GetItemPosition('_space_group_symop.magn_operation_xyz')[1]
     303                        centid = sgcenloop.GetItemPosition('_space_group_symop.magn_centering_xyz')[1]
     304                    spnflp = []
     305                    for op in sgoploop:
     306                        M,T,S = G2spc.MagText2MTS(op[opid])
     307                        SGData['SGOps'].append([np.array(M,dtype=float),T])
     308                        spnflp.append(S)
     309                    censpn = []
     310                    for cent in sgcenloop:
     311                        M,C,S = G2spc.MagText2MTS(cent[centid])
     312                        SGData['SGCen'].append(C)
     313                        censpn += list(np.array(spnflp)*S)
     314                self.MPhase['General']['SGData'] = SGData
     315                self.MPhase['General']['SGData']['SpnFlp'] = censpn
     316                self.MPhase['General']['SGData']['MagSpGrp'] = MSpGrp
     317                MagPtGp = blk.get('_space_group.magn_point_group')
     318                if not MagPtGp:
     319                    MagPtGp = blk.get('_space_group.magn_point_group_name')
     320                if not MagPtGp:
     321                    MagPtGp = blk.get('_space_group_magn.point_group_name')
     322                self.MPhase['General']['SGData']['MagPtGp'] = MagPtGp
     323
    295324                   
    296325
     
    532561                    self.MPhase['General']['SuperVec'] = SuperVec
    533562                    self.MPhase['General']['SuperSg'] = SuperSg
    534                     self.MPhase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
    535563            else:
    536564                self.MPhase = None
     
    539567                self.Phase['General']['SuperVec'] = SuperVec
    540568                self.Phase['General']['SuperSg'] = SuperSg
    541                 self.Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
     569                if not self.Phase['General']['SGData']['SGFixed']:
     570                    self.Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
    542571            if not self.isodistort_warnings:
    543572                if blk.get('_iso_displacivemode_label') or blk.get('_iso_occupancymode_label'):
Note: See TracChangeset for help on using the changeset viewer.