Changeset 3716
- Timestamp:
- Nov 4, 2018 8:21:47 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r3711 r3716 1379 1379 1380 1380 #how do I do Uij's for most Trans? 1381 As = ['A0','A1','A2','A3','A4','A5'] 1382 Aids = [[0,0,'A0'],[1,1,'A1'],[2,2,'A2'],[0,1,'A3'],[0,2,'A4'],[1,2,'A5']] 1383 DepConsDict = dict(zip(As,[[],[],[],[],[],[]])) 1384 for iA,Aid in enumerate(Aids): 1385 GT = np.zeros((3,3)) 1386 if abs(nAcof[iA]) > 1.e-8: 1387 GT[Aid[0],Aid[1]] = 1 1388 nGT = G2lat.prodMGMT(GT,Trans) 1389 nAT = G2lat.Gmat2A(nGT) 1390 for ia,nA in enumerate(nAT): 1391 if abs(nA) > 1.e-8 and abs(nAcof[ia]) > 1.e-8: 1392 parm = SetUniqAj(npId,As[ia],nSGData['SGLaue']) 1393 DepConsDict[Aid[2]].append([nA,G2obj.G2VarObj(parm)]) 1381 #unfortunately, this doesn't always work! 1382 # As = ['A0','A1','A2','A3','A4','A5'] 1383 # Aids = [[0,0,'A0'],[1,1,'A1'],[2,2,'A2'],[0,1,'A3'],[0,2,'A4'],[1,2,'A5']] 1384 # DepConsDict = dict(zip(As,[[],[],[],[],[],[]])) 1385 # for iA,Aid in enumerate(Aids): 1386 # GT = np.zeros((3,3)) 1387 # if abs(nAcof[iA]) > 1.e-8: 1388 # GT[Aid[0],Aid[1]] = 1. 1389 # nGT = G2lat.prodMGMT(GT,Trans) 1390 # nAT = G2lat.Gmat2A(nGT) 1391 # for ia,nA in enumerate(nAT): 1392 # if abs(nA) > 1.e-8 and abs(nAcof[ia]) > 1.e-8: 1393 # parm = SetUniqAj(npId,As[ia],nSGData['SGLaue']) 1394 # DepConsDict[Aid[2]].append([nA,G2obj.G2VarObj(parm)]) 1394 1395 conStrings = [] 1395 1396 for iA,Asi in enumerate(As): -
trunk/GSASIIlattice.py
r3686 r3716 468 468 if result[1]: 469 469 BNSlatt += '_'+result[1] 470 if 'P_S' in BNSlatt: BNSlatt = 'P_c' #triclinic fix 470 471 phase['SGData']['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]] 471 472 G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym']) -
trunk/GSASIIphsGUI.py
r3714 r3716 2527 2527 UCdata = list(G2frame.GPXtree.GetItemPyData(UnitCellsId)) 2528 2528 magData = UCdata[5] 2529 baseList = UCdata[0][16] 2529 2530 magKeep = [] 2530 2531 magIds = [] 2531 2532 magchoices = [] 2532 2533 ifMag = False 2533 for mid,magdata in enumerate(magData): 2534 itemList = [phase.get('gid',ip+1) for ip,phase in enumerate(magData)] 2535 phaseDict = dict(zip(itemList,magData)) 2536 for im,mid in enumerate(baseList): 2537 magdata = phaseDict[mid] 2534 2538 if magdata['Keep']: 2535 2539 if 'magAtms' in magdata: 2536 2540 ifMag = True 2537 magdata['No.'] = mid+12541 magdata['No.'] = im+1 2538 2542 trans = G2spc.Trans2Text(magdata['Trans']) 2539 2543 vec = G2spc.Latt2text([magdata['Uvec'],]) 2540 2544 magKeep.append(magdata) 2541 2545 magIds.append(mid) 2542 magchoices.append('(%d) %s; (%s) + (%s)'%( mid+1,magdata['Name'],trans,vec))2546 magchoices.append('(%d) %s; (%s) + (%s)'%(im+1,magdata['Name'],trans,vec)) 2543 2547 if not len(magKeep): 2544 2548 G2frame.ErrorDialog('Subgroup/magnetic phase selection error','No magnetic phases found; be sure to "Keep" some') -
trunk/GSASIIpwdGUI.py
r3712 r3716 82 82 ###### class definitions 83 83 ################################################################################ 84 85 class SubCellsDialog(wx.Dialog): 86 def __init__(self,parent,title,items,phaseDict): 87 wx.Dialog.__init__(self,parent,-1,title, 88 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE) 89 self.panel = None 90 self.items = items 91 self.phaseDict = phaseDict 92 93 self.Draw() 94 95 def Draw(self): 96 if self.panel: self.panel.Destroy() 97 self.panel = wx.Panel(self) 98 rowLabels = [str(i+1) for i in range(len(self.items))] 99 colLabels = ['Space Gp','Try','Keep','Uniq','nConj','nSup','Trans','Vec','a','b','c','alpha','beta','gamma','Volume'] 100 Types = [wg.GRID_VALUE_STRING,]+2*[wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_STRING,]+ \ 101 3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2'] 102 table = [] 103 for ip in self.items: 104 phase = self.phaseDict[ip] 105 natms = phase.get('nAtoms',1) 106 try: 107 nConj = len(phase['altList']) 108 nSup = len(phase['supList']) 109 except KeyError: 110 nConj = 0 111 nSup = 0 112 cell = list(phase['Cell']) 113 trans = G2spc.Trans2Text(phase['Trans']) 114 vec = G2spc.Latt2text([phase['Uvec'],]) 115 row = [phase['Name'],phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell 116 table.append(row) 117 CellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 118 mainSizer = wx.BoxSizer(wx.VERTICAL) 119 magDisplay = G2G.GSGrid(self.panel) 120 magDisplay.SetTable(CellsTable, True) 121 # magDisplay.Bind(wg.EVT_GRID_CELL_LEFT_CLICK,RefreshMagCellsGrid) 122 # magDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK,OnRefreshKeep) 123 magDisplay.AutoSizeColumns(False) 124 for r in range(magDisplay.GetNumberRows()): 125 for c in range(magDisplay.GetNumberCols()): 126 if c in [1,2]: 127 magDisplay.SetReadOnly(r,c,isReadOnly=False) 128 else: 129 magDisplay.SetReadOnly(r,c,isReadOnly=True) 130 mainSizer.Add(magDisplay,0,WACV) 131 132 OkBtn = wx.Button(self.panel,-1,"Ok") 133 OkBtn.Bind(wx.EVT_BUTTON, self.OnOk) 134 btnSizer = wx.BoxSizer(wx.HORIZONTAL) 135 btnSizer.Add((20,20),1) 136 btnSizer.Add(OkBtn) 137 btnSizer.Add((20,20),1) 138 139 mainSizer.Add(btnSizer,0,wx.EXPAND|wx.BOTTOM|wx.TOP, 10) 140 self.panel.SetSizer(mainSizer) 141 self.panel.Fit() 142 self.Fit() 143 144 def OnOk(self,event): 145 parent = self.GetParent() 146 parent.Raise() 147 self.Destroy() 148 # self.EndModal(wx.ID_OK) 84 149 85 150 class RDFDialog(wx.Dialog): … … 3411 3476 controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(UnitCellsId) 3412 3477 r,c = event.GetRow(),event.GetCol() 3478 br = baseList[r] 3479 phase = phaseDict[br] 3413 3480 if magcells: 3414 3481 if c == 0: 3415 r = event.GetRow()3416 phase = magcells[r]3417 3482 mSGData = phase['SGData'] 3418 3483 text,table = G2spc.SGPrint(mSGData,AddInv=True) … … 3430 3495 for i in range(len(magcells)): 3431 3496 magcells[i]['Use'] = False 3497 for i in range(len(baseList)): 3432 3498 MagCellsTable.SetValue(i,c,False) 3433 3499 MagCellsTable.SetValue(r,c,True) 3434 3500 magDisplay.ForceRefresh() 3435 magcells[r]['Use'] = True3436 mSGData = magcells[r]['SGData']3437 A = G2lat.cell2A( magcells[r]['Cell'][:6])3501 phase['Use'] = True 3502 mSGData = phase['SGData'] 3503 A = G2lat.cell2A(phase['Cell'][:6]) 3438 3504 G2frame.HKL = G2pwd.getHKLpeak(1.0,mSGData,A,Inst) 3439 3505 G2plt.PlotPatterns(G2frame,extraKeys=KeyList) … … 3441 3507 if MagCellsTable.GetValue(r,c): 3442 3508 MagCellsTable.SetValue(r,c,False) 3443 magcells[r]['Keep'] = False3509 phase['Keep'] = False 3444 3510 else: 3445 magcells[r]['Keep'] = True3511 phase['Keep'] = True 3446 3512 MagCellsTable.SetValue(r,c,True) 3447 3513 magDisplay.ForceRefresh() 3448 3514 elif c ==3: 3449 r = event.GetRow()3450 3515 maxequiv = magcells[0].get('maxequiv',100) 3451 p hase = magcells[r]3452 mSGData = magcells[r]['SGData']3516 pname = '(%d) %s'%(br,phase['Name']) 3517 mSGData = phase['SGData'] 3453 3518 Uvec = phase['Uvec'] 3454 3519 Trans = phase['Trans'] 3455 3520 ifMag = False 3456 if 'magAtms' in magcells[r]:3521 if 'magAtms' in phase: 3457 3522 ifMag = True 3458 allmom = magcells[r].get('allmom',False)3459 magAtms = magcells[r].get('magAtms','')3523 allmom = phase.get('allmom',False) 3524 magAtms = phase.get('magAtms','') 3460 3525 mAtoms = TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv) 3461 3526 else: … … 3469 3534 Atms.append(atom[:2]+['',]+atom[2:5]) 3470 3535 AtCods.append('1') 3471 if 'magAtms' in magcells[r]:3536 if 'magAtms' in phase: 3472 3537 MagSytSym = G2spc.MagSytSym(SytSym,dupDir,mSGData) 3473 3538 CSI = G2spc.GetCSpqinel(mSGData['SpnFlp'],dupDir) … … 3476 3541 CSI = G2spc.GetCSxinel(SytSym) 3477 3542 atMxyz.append([SytSym,CSI[0]]) 3478 G2phsG.UseMagAtomDialog(G2frame,magcells[r]['Name'],Atms,AtCods,atMxyz,ifMag=ifMag,ifOK=True).ShowModal() 3543 G2phsG.UseMagAtomDialog(G2frame,pname,Atms,AtCods,atMxyz,ifMag=ifMag,ifOK=True).ShowModal() 3544 elif c in [4,5]: 3545 if 'altList' not in phase: return 3546 if c == 4: 3547 title = 'Conjugacy list for '+phase['Name'] 3548 items = phase['altList'] 3549 3550 elif c == 5: 3551 title = 'Super groups list list for '+phase['Name'] 3552 items = phase['supList'] 3553 if not items[0]: 3554 wx.MessageBox(phase['Name']+' is a maximal subgroup',caption='Super group is parent',style=wx.ICON_INFORMATION) 3555 return 3556 3557 SubCellsDialog(G2frame,title,items,phaseDict).ShowModal() 3558 3479 3559 data = [controls,bravais,cells,dminx,ssopt,magcells] 3480 3560 G2frame.GPXtree.SetItemPyData(UnitCellsId,data) … … 3486 3566 if c == 2: 3487 3567 testAtoms = ['',]+list(set([atom[1] for atom in controls[15]])) 3488 allmom = magcells[0].get('allmom',False) 3489 magAtms = magcells[0].get('magAtms','') 3490 maxequiv = magcells[0].get('maxequiv',100) 3491 dlg = G2G.MultiDataDialog(G2frame,title='Keep options', 3492 prompts=['max unique','test for mag. atoms','all have moment',], 3493 values=[maxequiv,'',allmom],limits=[[1,100],testAtoms,[True,False]], 3494 formats=['%d','choice','bool']) 3568 ifMag = False 3569 maxequiv = magcells[0]['maxequiv'] 3570 maximal = False 3571 if 'magAtms' in magcells[0]: 3572 ifMag = True 3573 allmom = magcells[0]['allmom'] 3574 magAtms = magcells[0]['magAtms'] 3575 dlg = G2G.MultiDataDialog(G2frame,title='Keep options', 3576 prompts=['max unique','test for mag. atoms','all have moment','only maximal subgroups',], 3577 values=[maxequiv,'',allmom,False],limits=[[1,100],testAtoms,[True,False],[True,False]], 3578 formats=['%d','choice','bool','bool']) 3579 else: 3580 dlg = G2G.MultiDataDialog(G2frame,title='Keep options', 3581 prompts=['max unique','only maximal subgroups',], 3582 values=[maxequiv,False],limits=[[1,100],[True,False],], 3583 formats=['%d','bool',]) 3495 3584 if dlg.ShowModal() == wx.ID_OK: 3496 maxequiv,atype,allmom = dlg.GetValues() 3497 magAtms = [atom for atom in controls[15] if atom[1] == atype] 3498 for phase in magcells: 3585 if ifMag: 3586 maxequiv,atype,allmom,maximal = dlg.GetValues() 3587 magAtms = [atom for atom in controls[15] if atom[1] == atype] 3588 else: 3589 maxequiv,maximal = dlg.GetValues() 3590 dlg = wx.ProgressDialog('Setting Keep flags','Processing '+magcells[0]['Name'],len(magcells), 3591 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME) 3592 for ip,phase in enumerate(magcells): 3593 dlg.Update(ip,newmsg='Processing '+phase['Name']) 3499 3594 Uvec = phase['Uvec'] 3500 3595 Trans = phase['Trans'] 3501 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv)) 3596 if ifMag: 3597 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv,maximal)) 3598 else: 3599 phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv,maximal)) 3600 dlg.Destroy() 3502 3601 data = controls,bravais,cells,dminx,ssopt,magcells 3503 3602 G2frame.GPXtree.SetItemPyData(UnitCellsId,data) … … 3609 3708 wx.CallAfter(UpdateUnitCellsGrid,G2frame,data) 3610 3709 3611 def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100 ):3710 def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100,maximal=False): 3612 3711 found = False 3712 anymom = False 3613 3713 phase['Keep'] = False 3614 3714 if not magAtms: … … 3629 3729 CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir) 3630 3730 if any(CSI[0]): 3631 phase['Keep']= True3731 anymom = True 3632 3732 if allmom: 3633 3733 if not any(CSI[0]): … … 3636 3736 uAtms = G2lat.GetUnique(Phase,atCodes)[0] 3637 3737 natm = len(uAtms) 3638 if natm > maxequiv or found: #too many allowed atoms found 3639 phase['Keep'] = False 3738 if anymom and natm <= maxequiv and not found: 3739 phase['Keep'] = True 3740 if maximal and phase['supList'][0]: 3741 phase['Keep'] = False 3640 3742 return uAtms 3641 3743 3642 def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100): 3643 phase['Keep'] = False 3644 if not magAtms: 3645 phase['Keep'] = True 3646 return [] 3744 def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100,maximal=False): 3745 phase['Keep'] = True 3647 3746 invTrans = nl.inv(Trans) 3648 3747 atCodes = [] … … 3660 3759 if natm > maxequiv: #too many allowed atoms found 3661 3760 phase['Keep'] = False 3761 if maximal and phase['supList'][0]: 3762 phase['Keep'] = False 3662 3763 return uAtms 3663 3764 3664 3765 def OnRunSubs(event): 3665 import kSUBGROUPSMAG as kMAG3766 import SUBGROUPS as kSUB 3666 3767 G2frame.dataWindow.RunSubGroupsMag.Enable(False) 3667 3768 pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List') … … 3712 3813 doi: 10.1146/annurev-matsci-070214-021008''',caption='Bilbao SUBGROUPS',style=wx.ICON_INFORMATION) 3713 3814 3714 SUBGROUPS = kMAG.GetNonStdSubgroups(SGData,kvec[:9],star,Landau,maximal) 3815 SUBGROUPS,baseList = kSUB.GetNonStdSubgroups(SGData,kvec[:9],star,Landau) 3816 # SUBGROUPS,baseList = kMAG.GetNonStdSubgroups(SGData,kvec[:9],star,Landau,maximal) 3715 3817 wx.EndBusyCursor() 3716 3818 if SUBGROUPS is None: … … 3726 3828 return 3727 3829 controls[14] = kvec[:9] 3830 controls[16] = baseList 3728 3831 dlg = wx.ProgressDialog('SUBGROUPS results','Processing '+SUBGROUPS[0][0],len(SUBGROUPS), 3729 3832 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME) 3730 3731 3833 for ir,result in enumerate(SUBGROUPS): 3732 3834 dlg.Update(ir,newmsg='Processing '+result[0]) 3733 numbs = [eval(item+'.') for item in result[1].split()] 3734 Uvec = np.array(numbs[3::4]) 3735 Trans = np.array([numbs[:3],numbs[4:7],numbs[8:11]]).T #Bilbao gives transpose 3835 Trans = np.array(eval(result[1][0])) 3836 Uvec = np.array(eval(result[1][1])) 3736 3837 phase = G2lat.makeBilbaoPhase(result,Uvec,Trans) 3838 phase['gid'] = result[2] 3839 phase['altList'] = result[3] 3840 phase['supList'] = eval(result[4]) 3737 3841 RVT = None 3738 3842 if keepaxes: … … 3740 3844 if RVT is not None: 3741 3845 result,Uvec,Trans = RVT 3742 phase = G2lat.makeBilbaoPhase(result,Uvec,Trans)3846 phase.update(G2lat.makeBilbaoPhase(result,Uvec,Trans)) 3743 3847 phase['Cell'] = G2lat.TransformCell(controls[6:12],Trans) 3744 3848 phase['maxequiv'] = maxequiv 3745 phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv ))3849 phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv,maximal)) 3746 3850 magcells.append(phase) 3747 3851 dlg.Destroy() … … 3757 3861 3758 3862 def OnRunSubsMag(event): 3759 import kSUBGROUPSMAG as kMAG3863 import SUBGROUPS as kSUB 3760 3864 G2frame.dataWindow.RunSubGroups.Enable(False) 3761 3865 pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List') … … 3811 3915 doi: 10.1146/annurev-matsci-070214-021008''',caption='Bilbao k-SUBGROUPSMAG',style=wx.ICON_INFORMATION) 3812 3916 3813 MAXMAGN = kMAG.GetNonStdSubgroupsmag(SGData,kvec[:9],star,Landau,maximal)3917 MAXMAGN,baseList = kSUB.GetNonStdSubgroupsmag(SGData,kvec[:9],star,Landau) 3814 3918 wx.EndBusyCursor() 3815 3919 if MAXMAGN is None: … … 3825 3929 return 3826 3930 controls[14] = kvec[:9] 3931 controls[16] = baseList 3827 3932 dlg = wx.ProgressDialog('k-SUBGROUPSMAG results','Processing '+MAXMAGN[0][0],len(MAXMAGN), 3828 3933 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME) 3829 3934 3830 3935 for ir,result in enumerate(MAXMAGN): 3936 # result is SPGP,BNS,MV,itemList,altList,superList 3831 3937 dlg.Update(ir,newmsg='Processing '+result[0]) 3832 if result[0].strip().endswith("1'"): #skip gray groups 3833 continue 3834 numbs = [eval(item+'.') for item in result[2].split()] 3835 Uvec = np.array(numbs[3::4]) 3836 Trans = np.array([numbs[:3],numbs[4:7],numbs[8:11]]).T #Bilbao gives transpose 3938 Trans = np.array(eval(result[2][0])) 3939 Uvec = np.array(eval(result[2][1])) 3837 3940 phase = G2lat.makeBilbaoPhase(result[:2],Uvec,Trans,True) 3941 phase['gid'] = result[3] 3942 phase['altList'] = result[4] 3943 phase['supList'] = eval(result[5]) 3838 3944 RVT = None 3839 3945 if keepaxes: … … 3841 3947 if RVT is not None: 3842 3948 result,Uvec,Trans = RVT 3843 phase = G2lat.makeBilbaoPhase(result,Uvec,Trans,True)3949 phase.update(G2lat.makeBilbaoPhase(result,Uvec,Trans,True)) 3844 3950 phase['Cell'] = G2lat.TransformCell(controls[6:12],Trans) 3845 3951 phase['aType'] = atype … … 3847 3953 phase['magAtms'] = magAtms 3848 3954 phase['maxequiv'] = maxequiv 3849 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv ))3955 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv,maximal)) 3850 3956 magcells.append(phase) 3851 3957 dlg.Destroy() … … 3879 3985 if len(controls) < 14: #add space group if missing 3880 3986 controls.append(spaceGroups[bravaisSymb.index(controls[5])]) 3987 if len(controls) < 17: 3988 controls.append(range(1,len(magcells)+1)) 3881 3989 if len(bravais) < 16: 3882 3990 bravais += [0,0,] … … 4138 4246 gridDisplay.SetReadOnly(r,c,isReadOnly=True) 4139 4247 mainSizer.Add(gridDisplay,0,WACV) 4140 if magcells: 4248 if magcells: 4249 itemList = [phase.get('gid',ip+1) for ip,phase in enumerate(magcells)] 4250 phaseDict = dict(zip(itemList,magcells)) 4141 4251 G2frame.dataWindow.CopyCell.Enable(False) 4142 4252 kvec1 = ','.join(controls[14][:3]) 4143 4253 kvec2 = ','.join(controls[14][3:6]) 4144 4254 kvec3 = ','.join(controls[14][6:]) 4255 baseList = controls[16] 4145 4256 if 'magAtms' in magcells[0]: 4146 4257 G2frame.dataWindow.RunSubGroupsMag.Enable(True) … … 4155 4266 Label += ':' 4156 4267 mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=Label),0,WACV) 4157 rowLabels = [] 4158 for i in range(len(magcells)): rowLabels.append(str(i+1)) 4159 colLabels = ['Space Gp','Try','Keep','Uniq','Trans','Vec','a','b','c','alpha','beta','gamma','Volume'] 4160 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_LONG,wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+ \ 4268 rowLabels = [str(i+1) for i in range(len(baseList))] 4269 colLabels = ['Space Gp','Try','Keep','Uniq','nConj','nSup','Trans','Vec','a','b','c','alpha','beta','gamma','Volume'] 4270 Types = [wg.GRID_VALUE_STRING,]+2*[wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_STRING,]+ \ 4161 4271 3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2'] 4162 4272 table = [] 4163 for phase in magcells: 4273 for ip in baseList: 4274 phase = phaseDict[ip] 4164 4275 natms = phase.get('nAtoms',1) 4276 try: 4277 nConj = len(phase['altList']) 4278 nSup = len(phase['supList']) 4279 except KeyError: 4280 nConj = 0 4281 nSup = 0 4165 4282 cell = list(phase['Cell']) 4166 4283 trans = G2spc.Trans2Text(phase['Trans']) 4167 4284 vec = G2spc.Latt2text([phase['Uvec'],]) 4168 row = [phase['Name'],phase['Use'],phase['Keep'],natms, trans,vec]+cell4285 row = [phase['Name'],phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell 4169 4286 table.append(row) 4170 4287 MagCellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) -
trunk/GSASIIspc.py
r3710 r3716 1702 1702 '31m':['(00g)','(1/31/3g)'], 1703 1703 '6/m':['(00g)',], 1704 '6/mmm':['(00g)',]} 1704 '6/mmm':['(00g)',], 1705 'm3':['',],'m3m':['',]} 1705 1706 1706 1707 laueTS = {'-1':['',], … … 1713 1714 '31m':['','t00','0ss'], 1714 1715 '6/m':['','h','t','s','s0'], 1715 '6/mmm':['','h00','t00','s00','ss0','0ss','s0s','s0s0','00ss','s00s','ss00','0ss0','0s0s']} 1716 '6/mmm':['','h00','t00','s00','ss0','0ss','s0s','s0s0','00ss','s00s','ss00','0ss0','0s0s'], 1717 'm3':['',],'m3m':['',]} 1716 1718 laue = SGData['SGLaue'] 1717 1719 SSChoice = [] … … 2839 2841 dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,nxs,nxs] 2840 2842 dMTP = [] 2841 CSI = [[1,0,0],[2,0,0],[3,0,0], [4,0,0],[5,0,0],[6,0,0]],6*[[1.,0.,0.],] 2843 CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))] 2844 print(siteSym) 2842 2845 if siteSym == '1': 2843 2846 CSI = [[1,0,0],[2,0,0],[3,0,0],[4,0,0],[5,0,0],[6,0,0]],6*[[1.,0.,0.],] 2844 elif siteSym in ['-1', ]:2847 elif siteSym in ['-1','mmm',]: 2845 2848 CSI = 3*[[0,0,0],]+[[1,0,0],[2,0,0],[3,0,0]],3*[[0.,0.,0.],]+3*[[1.,0.,0.],] 2849 elif siteSym in ['4(z)','422(z)']: 2850 CSI[0][0][0] = CSI[0][4][1] = 1 2851 CSI[1][0][0] = 1.0 2852 CSI[1][4][1] = -1.0 2853 elif siteSym in ['-4m2(z)','422(z)',]: 2854 CSI[0][5][0] = 1 2855 CSI[1][5][0] = 1.0 2856 elif siteSym in ['-32(100)',]: 2857 CSI[0][2][0] = 1 2858 CSI[1][2][0] = 1.0 2859 elif siteSym in ['3',]: 2860 CSI[0][0][0] = CSI[0][3][0] = CSI[0][4][0] = 1 2861 CSI[1][0][0] = -np.sqrt(3.0) 2862 CSI[1][3][0] = 2.0 2863 CSI[1][4][0] = 1.0 2864 elif siteSym in ['622','2(100)',]: 2865 CSI[0][0][0] = CSI[0][1][0] = CSI[0][3][0] = 1 2866 CSI[1][0][0] = 1.0 2867 CSI[1][1][0] = 2.0 2868 CSI[1][3][0] = np.sqrt(3.0) 2846 2869 else: 2847 2870 #3x6x12 modulated moment array (M,Spos,tau)& force positive … … 2860 2883 dMTP.append(dMT) 2861 2884 for i in range(3): 2862 if not np.allclose(dM[i,i,:],-dMT[i,i,:]):2885 if 'm(' in siteSym and not np.allclose(dM[i,i,:],-dMT[i,i,:]): 2863 2886 msc[i] = 0 2864 if not np.allclose(dM[i,i+3,:],-dMT[i,i+3,:]): 2887 elif '2(' in siteSym and not np.allclose(dM[i,i,:],dMT[i,i,:]): 2888 msc[i] = 0 2889 if 'm(' in siteSym and not np.allclose(dM[i,i+3,:],-dMT[i,i+3,:]): 2890 msc[i+3] = 0 2891 elif '2(' in siteSym and not np.allclose(dM[i,i+3,:],dMT[i,i+3,:]): 2865 2892 msc[i+3] = 0 2866 2893 if np.any(dtau%.5) and ('1/2' in SSGData['modSymb'] or '1' in SSGData['modSymb']): … … 2884 2911 CSI[1][3:] = [0.,0.,0.],[0.,0.,0.],[0.,0.,0.] 2885 2912 if '4/mmm' in laue: 2913 if siteSym in ['4/mmm(z)',]: 2914 CSI = 3*[[0,0,0],]+[[0,0,0],[0,0,0],[1,0,0]],3*[[0.,0.,0.],]+3*[[1.,0.,0.],] 2886 2915 if np.any(dtau%.5) and '1/2' in SSGData['modSymb']: 2887 2916 if '(xy)' in siteSym: -
trunk/kSUBGROUPSMAG.py
r3686 r3716 82 82 elif tag == 'pre': 83 83 self.in_pre = False 84 self.MVs.append(self.MV.replace('\n',' ')) 85 # print('MV:') 86 # print(self.MV) 84 MV = self.MV.split() 85 MV = ['[[%s,%s,%s],[%s,%s,%s],[%s,%s,%s]]'%(MV[0],MV[4],MV[8],MV[1],MV[5],MV[9],MV[2],MV[6],MV[10]),'[%s.,%s.,%s.]'%(MV[3],MV[7],MV[11])] 86 self.MVs.append(MV) 87 # print('MV:',self.MV) 87 88 elif tag == 'sub': 88 89 self.in_sub = False … … 144 145 page = '' 145 146 print('connection error - not on internet') 146 return None 147 return None,None 147 148 if r.status_code == 200: 148 149 print('request OK') … … 152 153 page = '' 153 154 print('request failed. Reason=',r.reason) 154 return None 155 return None,None 155 156 r.close() 156 157 157 158 p = TableParser() 158 159 p.feed(page) 159 result = list(zip(p.SPGPs,p.BNSs,p.MVs)) 160 return result 160 nItms = len(p.MVs) 161 result = list(zip(p.SPGPs,p.BNSs,p.MVs,range(nItms),nItms*[[],],nItms*['[]',])) 162 return result,range(nItms) 161 163 162 164 def GetNonStdSubgroups(SGData, kvec,star=False,landau=False,maximal=False): … … 229 231 p = TableParser() 230 232 p.feed(page) 231 result = list(zip(p.SPGPs,p.MVs)) 232 return result 233 nItms = len(p.MVs) 234 result = list(zip(p.SPGPs,p.MVs,range(nItms),range(nItms),nItms*[0,])) 235 return result,range(nItms) 233 236 234 237 def test(): 235 238 SGData = G2spc.SpcGroup('p -3 m 1')[1] 236 results = GetNonStdSubgroupsmag(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' '))239 results,baseList = GetNonStdSubgroupsmag(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' ')) 237 240 if results: 238 for spgp,bns,mv in results: 239 print('Space group:',spgp, 'BNS:',bns) 240 print('MV') 241 print(mv) 242 results = GetNonStdSubgroups(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' ')) 241 for [spgp,mv,bns,gid,altList,supList] in results: 242 if gid in baseList: 243 print('Space group:',spgp, 'BNS:',bns) 244 print('MV') 245 print(mv) 246 results,baseList = GetNonStdSubgroups(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' ')) 243 247 if results: 244 for spgp,mv in results: 245 print('Space group:',spgp) 246 print('MV') 247 print(mv) 248 for [spgp,mv,gid,altList,supList] in results: 249 if gid in baseList: 250 print('Space group:',spgp) 251 print('MV') 252 print(mv) 248 253 249 254
Note: See TracChangeset
for help on using the changeset viewer.