Changeset 3568


Ignore:
Timestamp:
Aug 23, 2018 3:40:51 PM (3 years ago)
Author:
vondreele
Message:

finish interface with k-SUBGROUPSMAG output - selection of space group & transformation to make magnetic phase

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r3474 r3568  
    400400def GetUnique(Phase,atCodes):
    401401   
    402     def noDuplicate(xyzA,XYZ,Amat):
    403         if True in [np.allclose(np.inner(Amat,xyzA),np.inner(Amat,xyzB),atol=0.05) for xyzB in XYZ]:
     402    def noDuplicate(xyzA,XYZ):
     403        if True in [np.allclose(xyzA,xyzB,atol=0.0002) for xyzB in XYZ]:
    404404            return False
    405405        return True
    406406
    407407    cx,ct,cs,cia = Phase['General']['AtomPtrs']
    408     cell = Phase['General']['Cell'][1:7]
    409     Amat,Bmat = cell2AB(cell)
    410408    SGData = Phase['General']['SGData']
    411409    Atoms = Phase['Atoms']
     
    422420            xyz = XYZ[ind]
    423421            for jnd in range(Ind):
    424                 if Atoms[ind][ct] == Atoms[jnd][ct]:
     422                if Atoms[ind][ct-1] == Atoms[jnd][ct-1]:
    425423                    if ind != jnd and Indx[jnd]:                       
    426424                        Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True)
    427425                        xyzs = np.array([equiv[0] for equiv in Equiv])
    428                         Indx[jnd] = noDuplicate(xyz,xyzs,Amat)
     426                        Indx[jnd] = noDuplicate(xyz,xyzs)
    429427    Ind = []
    430428    for ind in Indx:
  • trunk/GSASIImath.py

    r3434 r3568  
    36603660    norm = 1./(np.sqrt(3.)*np.sqrt(2.*np.pi)**3)
    36613661   
    3662 #    def noDuplicate(xyz,peaks,Amat):
    3663 #        XYZ = np.inner(Amat,xyz)
    3664 #        if True in [np.allclose(XYZ,np.inner(Amat,peak),atol=0.5) for peak in peaks]:
    3665 #            print ' Peak',xyz,' <0.5A from another peak'
    3666 #            return False
    3667 #        return True
    3668 #                           
    36693662    def fixSpecialPos(xyz,SGData,Amat):
    36703663        equivs = G2spc.GenAtom(xyz,SGData,Move=True)
  • trunk/GSASIIphsGUI.py

    r3565 r3568  
    572572        self.panel = wx.Panel(self)
    573573        Indx = {}
    574         Mstr = ['Mx','My','Mz']
     574        Mstr = [' Mx ',' My ',' Mz ']
    575575        mainSizer = wx.BoxSizer(wx.VERTICAL)
    576576       
     
    578578        atmSizer = wx.FlexGridSizer(0,2,5,5)
    579579        for iuse,[use,atom,mxyz] in enumerate(zip(self.Use,self.Atoms,self.atMxyz)):
    580             mstr = ['___','___','___']
     580            mstr = [' __ ',' __ ',' __ ']
    581581            for i,mx in enumerate(mxyz):
    582582                if mx:
     
    587587            useChk.Bind(wx.EVT_CHECKBOX, OnUseChk)
    588588            atmSizer.Add(useChk,0,WACV)
    589             text = '  %s %10.5f %10.5f %10.5f %4s %4s %4s   '%(atom[0],atom[3],atom[4],atom[5],mstr[0],mstr[1],mstr[2])
     589            text = '  %5s %10.5f %10.5f %10.5f %4s %4s %4s   '%(atom[0],atom[3],atom[4],atom[5],mstr[0],mstr[1],mstr[2])
    590590            atmSizer.Add(wx.StaticText(self.panel,label=text),0,WACV)
    591591        mainSizer.Add(atmSizer)
     
    24422442        for magdata in magData:
    24432443            if magdata['Keep']:
     2444                trans = G2spc.Trans2Text(magdata['Trans'])
     2445                vec = G2spc.Latt2text([magdata['Uvec'],])
    24442446                magKeep.append(magdata)
    2445                 magchoices.append(magdata['Name'])
     2447                magchoices.append('%s %s %s'%(magdata['Name'],trans,vec))
    24462448        if not len(magKeep):
    24472449            G2frame.ErrorDialog('Magnetic phase selection error','No magnetic phases found; be sure to "Keep" some')
     
    24492451        dlg = wx.SingleChoiceDialog(G2frame,'Select magnetic space group','Make new magnetic phase',magchoices)
    24502452        if dlg.ShowModal() == wx.ID_OK:
    2451             vvec = np.zeros(3)
     2453            vvec = np.zeros(3)  #spg2origins
    24522454            magchoice = magKeep[dlg.GetSelection()]
    2453             phaseName = magchoice['Name']+ 'mag'
     2455            phaseName = magchoice['Name']+ ' mag'
    24542456            newPhase = copy.deepcopy(data)
    24552457            del newPhase['magPhases']
     2458            generalData = newPhase['General']
     2459            generalData['SGData'] = copy.deepcopy(magchoice['SGData'])           
     2460            generalData['Cell'][1:] = magchoice['Cell']
     2461            SGData = generalData['SGData']
    24562462            newPhase,atCodes = G2lat.TransformPhase(data,newPhase,magchoice['Trans'],magchoice['Uvec'],vvec,True)
    2457             detTrans = np.abs(nl.det(magchoice['Trans']))
    2458             generalData = newPhase['General']
    2459             generalData['SGData'] = copy.deepcopy(magchoice['SGData'])
    2460             SGData = generalData['SGData']
     2463           
     2464
     2465#            for item in SGData: print(item,SGData[item])
     2466
    24612467            Atoms = newPhase['Atoms']
    24622468            atMxyz = []
     
    24652471                CSI = G2spc.GetCSpqinel(SGData['SpnFlp'],dupDir)
    24662472                atMxyz.append(CSI[0])
     2473               
    24672474            dlg = UseMagAtomDialog(G2frame,Atoms,atCodes,atMxyz)
    24682475            try:
     
    24742481            finally:
    24752482                dlg.Destroy()
     2483        else:
     2484            return
    24762485        NShkl = len(G2spc.MustrainNames(SGData))
    24772486        NDij = len(G2spc.HStrainNames(SGData))
    24782487        UseList = newPhase['Histograms']
     2488        detTrans = np.abs(nl.det(magchoice['Trans']))
    24792489        for hist in UseList:
    24802490            UseList[hist]['Scale'] /= detTrans      #scale by 1/volume ratio
  • trunk/GSASIIpwdGUI.py

    r3566 r3568  
    34413441                SpGrp = G2spc.StandardizeSpcName(SpGp)
    34423442                phase['SGData'] = G2spc.SpcGroup(SpGrp)[1]
    3443                 G2spc.GetSGSpin(phase['SGData'],result[0])
     3443                phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
     3444                phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData'])
    34443445                phase['BNSlatt'] = phase['SGData']['SGLatt']
    34453446                if result[1]:
     
    34473448                    BNSsym = G2spc.GetGenSym(phase['SGData'])[2]
    34483449                    phase['SGData']['BNSlattsym'] = [phase['BNSlatt'],BNSsym[phase['BNSlatt']]]
    3449                     G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym'])   
     3450                    G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym']) 
    34503451                phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData'])
    34513452                phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData'])
    3452                 OprNames,SpnFlp = G2spc.GenMagOps(phase['SGData'])
    3453                 phase['SGData']['SpnFlp'] = SpnFlp
     3453                phase['SGData']['SpnFlp'] = G2spc.GenMagOps(phase['SGData'])[1]
    34543454                magcells.append(phase)
    34553455            magcells[0]['Use'] = True
     
    37393739        mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label='\n Magnetic cells from Bilbao k-SUBGROUPSMAG:'),0,WACV)
    37403740        rowLabels = []
    3741         colLabels = ['Space Gp.','Try','Keep','a','b','c','alpha','beta','gamma','Volume']
    3742         Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \
    3743             3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
     3741        colLabels = ['Space Gp.','Try','Keep','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']
     3742        Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+ \
     3743            3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
    37443744        table = []
    37453745        for phase in magcells:
    37463746            rowLabels.append('')
    37473747            cell  = list(phase['Cell'])
    3748             row = [phase['Name'],phase['Use'],phase['Keep'],]+cell
     3748            trans = G2spc.Trans2Text(phase['Trans'])
     3749            vec = G2spc.Latt2text([phase['Uvec'],])
     3750            row = [phase['Name'],phase['Use'],phase['Keep'],trans,vec]+cell
    37493751            table.append(row)
    37503752        MagCellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
  • trunk/GSASIIspc.py

    r3565 r3568  
    206206    if SGData['SGLatt'] == 'R':
    207207        if SGData['SGPtGrp'] in ['3',]:
     208            SGData['SGSpin'] = 3*[1,]
     209        elif SGData['SGPtGrp'] in  ['-3','32','3m']:
    208210            SGData['SGSpin'] = 4*[1,]
    209         elif SGData['SGPtGrp'] in  ['-3','32','3m']:
     211        elif SGData['SGPtGrp'] in  ['-3m',]:
    210212            SGData['SGSpin'] = 5*[1,]
    211         elif SGData['SGPtGrp'] in  ['-3m',]:
    212             SGData['SGSpin'] = 6*[1,]
    213213       
    214214    else:
     
    824824    elif 'F' in SGData['SGLatt']:
    825825        if SGData['SGSys'] in ['monoclinic','orthorhombic','cubic','triclinic']:
    826             BNSsym = {'F_s':[.5,.5,.5]}
     826            BNSsym = {'F_S':[.5,.5,.5]}
    827827           
    828828    elif 'R' in SGData['SGLatt']:
     
    834834    BNS = BNSlatt[0]
    835835    A = np.array(BNSlatt[1])
     836    Laue = SGData['SGLaue']
    836837    SGCen = SGData['SGCen']
    837838    if '_a' in BNS:
     
    849850    elif '_I' in BNS:
    850851        Tmat *= 2.0
    851         SGData['SGSpin'][-1] = -1
    852         if 'R' in BNS:
     852        if 'R' in Laue:
    853853            SGData['SGSpin'][-1] = -1
    854     elif '_s' in BNS:
     854        else:
     855            SGData['SGSpin'].append(-1)
     856    elif '_S' in BNS:
    855857        SGData['SGSpin'][-1] = -1
    856858        SGData['SGSpin'] += [-1,-1,-1,]
     
    10831085    magSym[0] = SGData.get('BNSlattsym',[SGData['SGLatt'],[0,0,0]])[0]
    10841086    return ' '.join(magSym)
     1087
     1088def Trans2Text(Trans):
     1089    "from transformation matrix to text"
     1090    cells = ['a','b','c']
     1091    Text = ''
     1092    for row in Trans:
     1093        for i in [0,1,2]:
     1094            if row[i]:
     1095                Text += str(int(row[i]))+cells[i]
     1096        Text += ','
     1097        Text = Text.replace('1','')
     1098    return Text[:-1]
    10851099
    10861100def Text2MT(mcifOpr,CIF=True):
Note: See TracChangeset for help on using the changeset viewer.