# Changeset 3568

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

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

Location:
trunk
Files:
5 edited

Unmodified
Removed
• ## trunk/GSASIIlattice.py

 r3474 def GetUnique(Phase,atCodes): def noDuplicate(xyzA,XYZ,Amat): if True in [np.allclose(np.inner(Amat,xyzA),np.inner(Amat,xyzB),atol=0.05) for xyzB in XYZ]: def noDuplicate(xyzA,XYZ): if True in [np.allclose(xyzA,xyzB,atol=0.0002) for xyzB in XYZ]: return False return True cx,ct,cs,cia = Phase['General']['AtomPtrs'] cell = Phase['General']['Cell'][1:7] Amat,Bmat = cell2AB(cell) SGData = Phase['General']['SGData'] Atoms = Phase['Atoms'] xyz = XYZ[ind] for jnd in range(Ind): if Atoms[ind][ct] == Atoms[jnd][ct]: if Atoms[ind][ct-1] == Atoms[jnd][ct-1]: if ind != jnd and Indx[jnd]: Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) xyzs = np.array([equiv[0] for equiv in Equiv]) Indx[jnd] = noDuplicate(xyz,xyzs,Amat) Indx[jnd] = noDuplicate(xyz,xyzs) Ind = [] for ind in Indx:
• ## trunk/GSASIImath.py

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

 r3565 self.panel = wx.Panel(self) Indx = {} Mstr = ['Mx','My','Mz'] Mstr = [' Mx ',' My ',' Mz '] mainSizer = wx.BoxSizer(wx.VERTICAL) atmSizer = wx.FlexGridSizer(0,2,5,5) for iuse,[use,atom,mxyz] in enumerate(zip(self.Use,self.Atoms,self.atMxyz)): mstr = ['___','___','___'] mstr = [' __ ',' __ ',' __ '] for i,mx in enumerate(mxyz): if mx: useChk.Bind(wx.EVT_CHECKBOX, OnUseChk) atmSizer.Add(useChk,0,WACV) 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]) 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]) atmSizer.Add(wx.StaticText(self.panel,label=text),0,WACV) mainSizer.Add(atmSizer) for magdata in magData: if magdata['Keep']: trans = G2spc.Trans2Text(magdata['Trans']) vec = G2spc.Latt2text([magdata['Uvec'],]) magKeep.append(magdata) magchoices.append(magdata['Name']) magchoices.append('%s %s %s'%(magdata['Name'],trans,vec)) if not len(magKeep): G2frame.ErrorDialog('Magnetic phase selection error','No magnetic phases found; be sure to "Keep" some') dlg = wx.SingleChoiceDialog(G2frame,'Select magnetic space group','Make new magnetic phase',magchoices) if dlg.ShowModal() == wx.ID_OK: vvec = np.zeros(3) vvec = np.zeros(3)  #spg2origins magchoice = magKeep[dlg.GetSelection()] phaseName = magchoice['Name']+ 'mag' phaseName = magchoice['Name']+ ' mag' newPhase = copy.deepcopy(data) del newPhase['magPhases'] generalData = newPhase['General'] generalData['SGData'] = copy.deepcopy(magchoice['SGData']) generalData['Cell'][1:] = magchoice['Cell'] SGData = generalData['SGData'] newPhase,atCodes = G2lat.TransformPhase(data,newPhase,magchoice['Trans'],magchoice['Uvec'],vvec,True) detTrans = np.abs(nl.det(magchoice['Trans'])) generalData = newPhase['General'] generalData['SGData'] = copy.deepcopy(magchoice['SGData']) SGData = generalData['SGData'] #            for item in SGData: print(item,SGData[item]) Atoms = newPhase['Atoms'] atMxyz = [] CSI = G2spc.GetCSpqinel(SGData['SpnFlp'],dupDir) atMxyz.append(CSI[0]) dlg = UseMagAtomDialog(G2frame,Atoms,atCodes,atMxyz) try: finally: dlg.Destroy() else: return NShkl = len(G2spc.MustrainNames(SGData)) NDij = len(G2spc.HStrainNames(SGData)) UseList = newPhase['Histograms'] detTrans = np.abs(nl.det(magchoice['Trans'])) for hist in UseList: UseList[hist]['Scale'] /= detTrans      #scale by 1/volume ratio
• ## trunk/GSASIIpwdGUI.py

 r3566 SpGrp = G2spc.StandardizeSpcName(SpGp) phase['SGData'] = G2spc.SpcGroup(SpGrp)[1] G2spc.GetSGSpin(phase['SGData'],result[0]) phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData']) phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData']) phase['BNSlatt'] = phase['SGData']['SGLatt'] if result[1]: BNSsym = G2spc.GetGenSym(phase['SGData'])[2] phase['SGData']['BNSlattsym'] = [phase['BNSlatt'],BNSsym[phase['BNSlatt']]] G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym']) G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym']) phase['SGData']['GenSym'],phase['SGData']['GenFlg'],BNSsym = G2spc.GetGenSym(phase['SGData']) phase['SGData']['MagSpGrp'] = G2spc.MagSGSym(phase['SGData']) OprNames,SpnFlp = G2spc.GenMagOps(phase['SGData']) phase['SGData']['SpnFlp'] = SpnFlp phase['SGData']['SpnFlp'] = G2spc.GenMagOps(phase['SGData'])[1] magcells.append(phase) magcells[0]['Use'] = True mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label='\n Magnetic cells from Bilbao k-SUBGROUPSMAG:'),0,WACV) rowLabels = [] colLabels = ['Space Gp.','Try','Keep','a','b','c','alpha','beta','gamma','Volume'] Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \ 3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2'] colLabels = ['Space Gp.','Try','Keep','Trans','Vec','a','b','c','alpha','beta','gamma','Volume'] Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+ \ 3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2'] table = [] for phase in magcells: rowLabels.append('') cell  = list(phase['Cell']) row = [phase['Name'],phase['Use'],phase['Keep'],]+cell trans = G2spc.Trans2Text(phase['Trans']) vec = G2spc.Latt2text([phase['Uvec'],]) row = [phase['Name'],phase['Use'],phase['Keep'],trans,vec]+cell table.append(row) MagCellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
• ## trunk/GSASIIspc.py

 r3565 if SGData['SGLatt'] == 'R': if SGData['SGPtGrp'] in ['3',]: SGData['SGSpin'] = 3*[1,] elif SGData['SGPtGrp'] in  ['-3','32','3m']: SGData['SGSpin'] = 4*[1,] elif SGData['SGPtGrp'] in  ['-3','32','3m']: elif SGData['SGPtGrp'] in  ['-3m',]: SGData['SGSpin'] = 5*[1,] elif SGData['SGPtGrp'] in  ['-3m',]: SGData['SGSpin'] = 6*[1,] else: elif 'F' in SGData['SGLatt']: if SGData['SGSys'] in ['monoclinic','orthorhombic','cubic','triclinic']: BNSsym = {'F_s':[.5,.5,.5]} BNSsym = {'F_S':[.5,.5,.5]} elif 'R' in SGData['SGLatt']: BNS = BNSlatt[0] A = np.array(BNSlatt[1]) Laue = SGData['SGLaue'] SGCen = SGData['SGCen'] if '_a' in BNS: elif '_I' in BNS: Tmat *= 2.0 SGData['SGSpin'][-1] = -1 if 'R' in BNS: if 'R' in Laue: SGData['SGSpin'][-1] = -1 elif '_s' in BNS: else: SGData['SGSpin'].append(-1) elif '_S' in BNS: SGData['SGSpin'][-1] = -1 SGData['SGSpin'] += [-1,-1,-1,] magSym[0] = SGData.get('BNSlattsym',[SGData['SGLatt'],[0,0,0]])[0] return ' '.join(magSym) def Trans2Text(Trans): "from transformation matrix to text" cells = ['a','b','c'] Text = '' for row in Trans: for i in [0,1,2]: if row[i]: Text += str(int(row[i]))+cells[i] Text += ',' Text = Text.replace('1','') return Text[:-1] def Text2MT(mcifOpr,CIF=True):
Note: See TracChangeset for help on using the changeset viewer.