Changeset 2401
- Timestamp:
- Jul 29, 2016 3:52:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r2341 r2401 1029 1029 'Name':Name, 1030 1030 'Type':'nuclear', 1031 'Modulated':False, 1031 1032 'AtomPtrs':[3,1,7,9], 1032 1033 'SGData':SGData, … … 1053 1054 } 1054 1055 if Super and Super.get('Use',False): 1055 phaseData['General'].update({' Type':'modulated','Super':True,'SuperSg':Super['ssSymb']})1056 phaseData['General'].update({'Modulated':True,'Super':True,'SuperSg':Super['ssSymb']}) 1056 1057 phaseData['General']['SSGData'] = G2spc.SSpcGroup(SGData,Super['ssSymb']) 1057 1058 phaseData['General']['SuperVec'] = [Super['ModVec'],False,Super['maxH']] -
trunk/GSASIIctrls.py
r2379 r2401 3839 3839 ['StartingGSASII', 'Starting GSAS.htm', 'Starting GSAS-II'], 3840 3840 3841 ['LabData', 'Laboratory X.htm', 'Fitting laboratory X-ray powder data for fluoroapatite'], 3842 ['CWNeutron', 'Neutron CW Powder Data.htm', 'CW Neutron Powder fit for Yttrium-Iron Garnet'], 3843 3841 3844 ['FitPeaks', 'Fit Peaks.htm', 'Fitting individual peaks & autoindexing'], 3845 ['CFjadarite', 'Charge Flipping in GSAS.htm', ' Charge Flipping structure solution for jadarite'], 3846 ['CFsucrose', 'Charge Flipping - sucrose.htm',' Charge Flipping structure solution for sucrose'], 3842 3847 ['BkgFit', 'FitBkgTut.htm', 'Fitting the Starting Background using Fixed Points'], 3843 3848 3844 ['CWNeutron', 'Neutron CW Powder Data.htm', 'CW Neutron Powder fit for Yttrium-Iron Garnet'],3845 ['LabData', 'Laboratory X.htm', 'Fitting laboratory X-ray powder data for fluoroapatite'],3846 3849 ['CWCombined', 'Combined refinement.htm', 'Combined X-ray/CW-neutron refinement of PbSO4'], 3847 3850 ['TOF-CW Joint Refinement', 'TOF combined XN Rietveld refinement in GSAS.htm', 'Combined X-ray/TOF-neutron Rietveld refinement'], … … 3854 3857 3855 3858 ['CFXraySingleCrystal', 'CFSingleCrystal.htm', 'Charge Flipping structure solution with Xray single crystal data'], 3856 ['CFjadarite', 'Charge Flipping in GSAS.htm', 'Charge Flipping structure solution for jadarite'],3857 ['CFsucrose', 'Charge Flipping - sucrose.htm', 'Charge Flipping structure solution for sucrose'],3858 3859 ['TOF Charge Flipping', 'Charge Flipping with TOF single crystal data in GSASII.htm', 'Charge flipping with neutron TOF single crystal data'], 3859 ['MCsimanneal', 'MCSA in GSAS.htm', 'Monte-Carlo simulated annealing structure '],3860 ['MCsimanneal', 'MCSA in GSAS.htm', 'Monte-Carlo simulated annealing structure determination'], 3860 3861 3861 3862 ['MerohedralTwins', 'Merohedral twin refinement in GSAS.htm', 'Merohedral twin refinements'], 3862 3863 3863 3864 ['2DCalibration', 'Calibration of an area detector in GSAS.htm', 'Calibration of an area detector'], 3864 ['2DIntegration', 'Integration of area detector data in GSAS.htm', ' Integration of area detector data'],3865 ['2DIntegration', 'Integration of area detector data in GSAS.htm', ' Integration of area detector data'], 3865 3866 ['TOF Calibration', 'Calibration of a TOF powder diffractometer.htm', 'Calibration of a Neutron TOF diffractometer'], 3866 3867 ['TOF Single Crystal Refinement', 'TOF single crystal refinement in GSAS.htm', 'Single crystal refinement from TOF data'], … … 3869 3870 ['2DTexture', 'Texture analysis of 2D data in GSAS-II.htm', 'Texture analysis of 2D data'], 3870 3871 3872 ['SAsize', 'Small Angle Size Distribution.htm', 'Small angle x-ray data size distribution (alumina powder)'], 3873 ['SAfit', 'Fitting Small Angle Scattering Data.htm', ' Fitting small angle x-ray data (alumina powder)'], 3871 3874 ['SAimages', 'Small Angle Image Processing.htm', 'Image Processing of small angle x-ray data'], 3872 ['SAfit', 'Fitting Small Angle Scattering Data.htm', 'Fitting small angle x-ray data (alumina powder)'],3873 ['SAsize', 'Small Angle Size Distribution.htm', 'Small angle x-ray data size distribution (alumina powder)'],3874 3875 ['SAseqref', 'Sequential Refinement of Small Angle Scattering Data.htm', 'Sequential refinement with small angle scattering data'], 3875 3876 … … 4035 4036 dlg.EndModal(wx.ID_OK) 4036 4037 dlg = wx.Dialog(self,wx.ID_ANY, 4037 'Select a tutorial to view ',4038 'Select a tutorial to view. NB: indented ones require prerequisite', 4038 4039 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 4039 4040 pnl = wx.Panel(dlg) -
trunk/GSASIIpath.py
r2378 r2401 451 451 print err 452 452 return False 453 print ("Files installed at: "+loadpath) 453 454 return True 454 455 -
trunk/GSASIIphsGUI.py
r2311 r2401 219 219 if 'AtomPtrs' not in generalData: 220 220 generalData['AtomPtrs'] = [3,1,7,9] 221 if generalData['Type'] == 'macromolecular':221 if generalData['Type'] == 'macromolecular': 222 222 generalData['AtomPtrs'] = [6,4,10,12] 223 if generalData['Type'] in ['modulated','magnetic',]: 223 elif generalData['Type'] == 'magnetic': 224 generalData['AtomPtrs'] = [3,1,10,12] 225 if generalData['Type'] in ['modulated',]: 226 generalData['Modulated'] = True 227 generalData['Type'] = 'nuclear' 224 228 if 'Super' not in generalData: 225 229 generalData['Super'] = 1 … … 229 233 generalData['4DmapData'] = mapDefault.copy() 230 234 generalData['4DmapData'].update({'MapType':'Fobs'}) 235 if 'Modulated' not in generalData: 236 generalData['Modulated'] = False 231 237 if 'HydIds' not in generalData: 232 238 generalData['HydIds'] = {} … … 316 322 if General.GetSizer(): 317 323 General.GetSizer().Clear(True) 318 phaseTypes = ['nuclear','m odulated','magnetic','macromolecular','faulted']324 phaseTypes = ['nuclear','magnetic','macromolecular','faulted'] 319 325 SetupGeneral() 320 326 generalData = data['General'] … … 369 375 generalData['Type'] = TypeTxt.GetValue() 370 376 pages = [G2frame.dataDisplay.GetPageText(PageNum) for PageNum in range(G2frame.dataDisplay.GetPageCount())] 371 if generalData['Type'] in ['modulated','magnetic']: 372 if 'SuperSg' not in generalData: 373 generalData['SuperSg'] = SetDefaultSSsymbol() 374 generalData['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1] 375 if 'MC/SA' in pages: 376 pass 377 # G2frame.dataDisplay.DeletePage(pages.index('MC/SA')) #this crashes!! 378 if 'Layers' in pages: 379 pass 380 # G2frame.dataDisplay.DeletePage(pages.index('Layers')) 381 if 'Wave Data' not in pages: 382 G2frame.waveData = wx.ScrolledWindow(G2frame.dataDisplay) 383 G2frame.dataDisplay.InsertPage(3,G2frame.waveData,'Wave Data') 384 Id = wx.NewId() 385 TabSelectionIdDict[Id] = 'Wave Data' 386 wx.CallAfter(UpdateGeneral) 387 elif generalData['Type'] == 'faulted': 377 if generalData['Type'] == 'faulted': 388 378 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadDIFFaX, id=G2gd.wxID_LOADDIFFAX) 389 379 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSimulate, id=G2gd.wxID_LAYERSIMULATE) … … 445 435 msg = 'Space Group Information' 446 436 G2gd.SGMessageBox(General,msg,text,table).Show() 447 if generalData[' Type'] in ['modulated',]:437 if generalData['Modulated']: 448 438 generalData['SuperSg'] = SetDefaultSSsymbol() 449 439 generalData['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1] … … 456 446 atom[cx+5] = Mult 457 447 wx.CallAfter(UpdateGeneral) 448 449 def OnModulated(event): 450 if not len(generalData['AtomTypes']): #can change only if no atoms! 451 pages = [G2frame.dataDisplay.GetPageText(PageNum) for PageNum in range(G2frame.dataDisplay.GetPageCount())] 452 if generalData['Type'] in ['nuclear','magnetic']: 453 generalData['Modulated'] = modulated.GetValue() 454 if generalData['Modulated']: 455 if 'SuperSg' not in generalData: 456 generalData['SuperSg'] = SetDefaultSSsymbol() 457 generalData['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1] 458 if 'Super' not in generalData: 459 generalData['Super'] = 1 460 generalData['SuperVec'] = [[0,0,.1],False,4] 461 generalData['SSGData'] = {} 462 if '4DmapData' not in generalData: 463 generalData['4DmapData'] = mapDefault.copy() 464 generalData['4DmapData'].update({'MapType':'Fobs'}) 465 if 'MC/SA' in pages: 466 pass 467 # G2frame.dataDisplay.DeletePage(pages.index('MC/SA')) #this crashes!! 468 if 'Layers' in pages: 469 pass 470 # G2frame.dataDisplay.DeletePage(pages.index('Layers')) 471 if 'Wave Data' not in pages: 472 G2frame.waveData = wx.ScrolledWindow(G2frame.dataDisplay) 473 G2frame.dataDisplay.InsertPage(3,G2frame.waveData,'Wave Data') 474 Id = wx.NewId() 475 TabSelectionIdDict[Id] = 'Wave Data' 476 else: 477 if 'Wave Data' in pages: 478 G2frame.dataDisplay.DeletePage(pages.index('Wave Data')) 479 wx.CallAfter(UpdateGeneral) 480 else: 481 G2frame.ErrorDialog('Modulation type change error','Can change modulation only if there are no atoms') 482 modulated.SetValue(generalData['Modulated']) 458 483 459 484 nameSizer = wx.BoxSizer(wx.HORIZONTAL) … … 472 497 SGTxt.Bind(wx.EVT_TEXT_ENTER,OnSpaceGroup) 473 498 nameSizer.Add(SGTxt,0,WACV) 499 if generalData['Type'] in ['nuclear','magnetic']: 500 modulated = wx.CheckBox(General,label='Modulated? ') 501 modulated.SetValue(generalData['Modulated']) 502 modulated.Bind(wx.EVT_CHECKBOX,OnModulated) 503 nameSizer.Add(modulated,0,WACV) 474 504 return nameSizer 475 505 … … 684 714 denSizer.Add(mattTxt,0,WACV) 685 715 return denSizer,denTxt,mattTxt 716 717 def MagSizer(): 718 719 def OnSpinOp(event): 720 Obj = event.GetEventObject() 721 isym = Indx[Obj.GetId()] 722 SGData['SGSpin'][isym] = Obj.GetValue() 723 wx.CallAfter(UpdateGeneral) 724 725 SGData = generalData['SGData'] 726 Indx = {} 727 MagSym = generalData['SGData']['SpGrp'].split() 728 magSizer = wx.BoxSizer(wx.VERTICAL) 729 magSizer.Add(wx.StaticText(General,label=' Magnetic spin operator selection:'),0,WACV) 730 magSizer.Add(wx.StaticText(General,label='NB: UNDER CONSTRUCTION - DO NOT USE'),0,WACV) 731 if not len(GenSym): 732 magSizer.Add(wx.StaticText(General,label=' No spin inversion allowed'),0,WACV) 733 return magSizer 734 spinSizer = wx.BoxSizer(wx.HORIZONTAL) 735 spinColor = ['black','red'] 736 for isym,sym in enumerate(GenSym): 737 spinSizer.Add(wx.StaticText(General,label='%s: '%(sym.strip())),0,WACV) 738 spinOp = wx.ComboBox(General,value=SGData['SGSpin'][isym],choices=spinColor, 739 style=wx.CB_READONLY|wx.CB_DROPDOWN) 740 Indx[spinOp.GetId()] = isym 741 spinOp.Bind(wx.EVT_COMBOBOX,OnSpinOp) 742 spinSizer.Add(spinOp,0,WACV) 743 MagSym = G2spc.MagSGSym(SGData) 744 spinSizer.Add(wx.StaticText(General,label=' Magnetic space group: '+MagSym),0,WACV) 745 magSizer.Add(spinSizer) 746 return magSizer 686 747 687 748 def PawleySizer(): … … 1188 1249 G2G.HorizontalLine(mainSizer,General) 1189 1250 1190 if generalData['Type'] in ['modulated','magnetic',]: 1251 if generalData['Type'] == 'magnetic': 1252 GenSym,GenFlg = G2spc.GetGenSym(generalData['SGData']) 1253 mainSizer.Add(MagSizer()) 1254 G2G.HorizontalLine(mainSizer,General) 1255 1256 if generalData['Modulated']: 1191 1257 G2frame.dataFrame.GeneralCalc.Enable(G2gd.wxID_SINGLEMCSA,False) 1192 1258 G2frame.dataFrame.GeneralCalc.Enable(G2gd.wxID_MULTIMCSA,False) … … 1227 1293 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName) 1228 1294 G2frame.PatternTree.SetItemPyData(sub,newPhase) 1229 # G2gd.MovePatternTreeToGrid(G2frame,sub) #bring up new phase General tab1230 1295 1231 1296 ################################################################################ … … 1247 1312 if Atoms.GetColLabelValue(c) == 'refine': 1248 1313 Type = generalData['Type'] 1249 if Type in ['nuclear','macromolecular',' modulated','faulted',]:1314 if Type in ['nuclear','macromolecular','faulted',]: 1250 1315 choice = ['F - site fraction','X - coordinates','U - thermal parameters'] 1251 1316 elif Type in ['magnetic',]: … … 1398 1463 Atoms.SetCellStyle(r,ci,WHITE,False) 1399 1464 SetupGeneral() 1465 elif Atoms.GetColLabelValue(c) in ['Mx','My','Mz']: 1466 pass 1400 1467 elif Atoms.GetColLabelValue(c) == 'I/A': #note use of text color to make it vanish! 1401 1468 if atomData[r][c] == 'I': … … 1626 1693 wg.GRID_VALUE_CHOICE+AAchoice, 1627 1694 wg.GRID_VALUE_STRING] + Types 1695 elif generalData['Type'] == 'magnetic': 1696 colLabels = colLabels[:7]+['Mx','My','Mz']+colLabels[7:] 1697 Types = Types[:7]+3*[wg.GRID_VALUE_FLOAT+':10,4',]+Types[7:] 1628 1698 SGData = data['General']['SGData'] 1629 1699 G2frame.dataFrame.SetStatusText('') … … 1668 1738 Sytsym,Mult = G2spc.SytSym([x,y,z],SGData) 1669 1739 if generalData['Type'] == 'macromolecular': 1670 atomData.append([0,Name,'',Name,El,'',x,y,z,1 ,Sytsym,Mult,'I',0.10,0,0,0,0,0,0,atId])1740 atomData.append([0,Name,'',Name,El,'',x,y,z,1.,Sytsym,Mult,'I',0.10,0,0,0,0,0,0,atId]) 1671 1741 elif generalData['Type'] in ['nuclear','faulted',]: 1672 atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1673 elif generalData['Type'] in ['modulated','magnetic',]: 1674 atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId,[],[], 1675 {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]) 1742 if generalData['Modulated']: 1743 atomData.append([Name,El,'',x,y,z,1.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId,[],[], 1744 {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]) 1745 else: 1746 atomData.append([Name,El,'',x,y,z,1.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1747 elif generalData['Type'] == 'magnetic': 1748 if generalData['Modulated']: 1749 atomData.append([Name,El,'',x,y,z,1.,0.,0.,0.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId,[],[], 1750 {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]) 1751 else: 1752 atomData.append([Name,El,'',x,y,z,1.,0.,0.,0.,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1753 1676 1754 SetupGeneral() 1677 1755 data['Drawing']['Atoms'] = [] … … 1858 1936 generalData = data['General'] 1859 1937 SGData = generalData['SGData'] 1860 if generalData['Type'] in ['nuclear',' modulated','faulted',]:1938 if generalData['Type'] in ['nuclear','faulted',]: 1861 1939 if oldatom: 1862 1940 opr = oldatom[5] … … 1871 1949 ['',]+[[255,255,255],]+atom[9:]+[[],[]]][0] 1872 1950 ct,cs = [1,8] #type & color 1951 elif generalData['Type'] == 'magnetic': 1952 atomInfo = [atom[:2]+atom[3:6]+atom[7:10]+['1',]+['vdW balls',]+ 1953 ['',]+[[255,255,255],]+atom[12:]+[[],[]]][0] 1954 ct,cs = [1,11] #type & color 1873 1955 elif generalData['Type'] == 'macromolecular': 1874 1956 try: … … 1894 1976 atomData.insert(indx,[0,Name,'',Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.10,0,0,0,0,0,0,atId]) 1895 1977 elif generalData['Type'] in ['nuclear','faulted',]: 1896 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1897 elif generalData['Type'] in ['modulated','magnetic']: 1898 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[], 1899 {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]) 1900 SetupGeneral() 1978 if generalData['Modulated']: 1979 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[], 1980 {'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]) 1981 else: 1982 atomData.insert(indx,[Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1983 SetupGeneral() 1901 1984 data['Drawing']['Atoms'] = [] 1902 1985 UpdateDrawAtoms() … … 3593 3676 drawingData['showRigidBodies'] = True 3594 3677 cx,ct,cs,ci = [0,0,0,0] 3595 if generalData['Type'] in ['nuclear',' modulated','faulted',]:3678 if generalData['Type'] in ['nuclear','faulted',]: 3596 3679 cx,ct,cs,ci = [2,1,6,17] #x, type, style & index 3597 3680 elif generalData['Type'] == 'macromolecular': 3598 3681 cx,ct,cs,ci = [5,4,9,20] #x, type, style & index 3599 3682 elif generalData['Type'] == 'magnetic': 3600 cx,ct,cs,ci = [2,1,6,20] #x, type, style & index 3601 # elif generalData['Type'] == 'modulated': 3602 # ????? for future 3683 cx,ct,cs,ci = [2,1,9,20] #x, type, style & index 3603 3684 drawingData['atomPtrs'] = [cx,ct,cs,ci] 3604 3685 if not drawingData.get('Atoms'): … … 3867 3948 labelChoice = [' ','type','name','number','residue','1-letter','chain'] 3868 3949 Types[9] = wg.GRID_VALUE_CHOICE+": ,type,name,number,residue,1-letter,chain" 3950 elif generalData['Type'] == 'magnetic': 3951 colLabels = colLabels[:5]+['Mx','My','Mz']+colLabels[5:] 3952 Types = Types[:5]+3*[wg.GRID_VALUE_FLOAT+':10,4',]+Types[5:] 3869 3953 table = [] 3870 3954 rowLabels = [] … … 6740 6824 rowLabels = [] 6741 6825 for i in range(len(PawleyPeaks)): rowLabels.append(str(i)) 6742 if generalData[' Type'] in ['modulated','magnetic',]:6826 if generalData['Modulated']: 6743 6827 colLabels = ['h','k','l','m','mul','d','refine','Fsq(hkl)','sig(Fsq)'] 6744 6828 Types = 5*[wg.GRID_VALUE_LONG,]+[wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,]+ \ … … 6771 6855 PawleyPeaks = [] 6772 6856 HKLd = np.array(G2lat.GenHLaue(dmin,SGData,A)) 6773 if generalData[' Type'] in ['modulated','magnetic',]:6857 if generalData['Modulated']: 6774 6858 Vec,x,maxH = generalData['SuperVec'] 6775 6859 SSGData = G2spc.SSpcGroup(SGData,generalData['SuperSg'])[1] … … 6810 6894 generalData = data['General'] 6811 6895 im = 0 6812 if generalData[' Type'] in ['modulated','magnetic',]:6896 if generalData['Modulated']: 6813 6897 im = 1 6814 6898 HistoNames = filter(lambda a:Histograms[a]['Use']==True,Histograms.keys()) … … 6868 6952 PatternId,'Reflection Lists'))[PhaseName]['RefList'] 6869 6953 im = 0 6870 if data['General'][' Type'] in ['modulated','magnetic',]:6954 if data['General']['Modulated']: 6871 6955 im = 1 6872 6956 Inv = data['General']['SGData']['SGInv'] … … 7096 7180 pgbar.Destroy() 7097 7181 else: 7098 if generalData[' Type'] in ['modulated',]:7182 if generalData['Modulated']: 7099 7183 dim = '4D ' 7100 7184 G2mth.Fourier4DMap(data,ReflData) … … 7354 7438 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.LayerData) 7355 7439 UpdateLayerData() 7356 elif text == 'Wave Data' and data['General'][' Type'] in ['modulated','magnetic']:7440 elif text == 'Wave Data' and data['General']['Modulated']: 7357 7441 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.WavesData) 7358 7442 UpdateWavesData() … … 7435 7519 G2frame.dataFrame.Bind(wx.EVT_MENU, OnReImport, id=id) 7436 7520 # Wave Data 7437 if data['General'][' Type'] in ['modulated','magnetic']:7521 if data['General']['Modulated']: 7438 7522 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.WavesData) 7439 7523 G2frame.dataFrame.Bind(wx.EVT_MENU, OnWaveVary, id=G2gd.wxID_WAVEVARY) … … 7511 7595 if 'dict' in str(type(data['MCSA']['Results'])): 7512 7596 data['MCSA']['Results'] = [] 7597 if 'Modulated' not in data['General']: 7598 data['General']['Modulated'] = False 7599 if 'modulated' in data['General']['Type']: 7600 data['General']['Modulated'] = True 7601 data['General']['Type'] = 'nuclear' 7602 7513 7603 #end patch 7514 7604 … … 7536 7626 G2frame.dataDisplay.AddPage(Atoms,'Atoms') 7537 7627 Pages.append('Atoms') 7538 if data['General'][' Type'] in ['modulated','magnetic']:7628 if data['General']['Modulated']: 7539 7629 G2frame.waveData = wx.ScrolledWindow(G2frame.dataDisplay) 7540 7630 G2frame.dataDisplay.AddPage(G2frame.waveData,'Wave Data') … … 7551 7641 G2frame.dataDisplay.AddPage(drawAtoms,'Draw Atoms') 7552 7642 Pages.append('Draw Atoms') 7553 if data['General']['Type'] not in [' modulated','magnetic','faulted',]:7643 if data['General']['Type'] not in ['faulted',] and not data['General']['Modulated']: 7554 7644 RigidBodies = wx.ScrolledWindow(G2frame.dataDisplay) 7555 7645 G2frame.dataDisplay.AddPage(RigidBodies,'RB Models') … … 7559 7649 G2frame.dataDisplay.AddPage(MapPeaks,'Map peaks') 7560 7650 Pages.append('Map peaks') 7561 if data['General']['Type'] not in [' modulated','magnetic','faulted',]:7651 if data['General']['Type'] not in ['faulted',] and not data['General']['Modulated']: 7562 7652 G2frame.MCSA = wx.ScrolledWindow(G2frame.dataDisplay) 7563 7653 G2frame.dataDisplay.AddPage(G2frame.MCSA,'MC/SA') -
trunk/GSASIIplot.py
r2375 r2401 4751 4751 B4mat = np.concatenate((np.concatenate((Bmat,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0) 4752 4752 SGData = generalData['SGData'] 4753 if generalData[' Type'] in ['modulated','magnetic']:4753 if generalData['Modulated']: 4754 4754 SSGData = generalData['SSGData'] 4755 4755 Mydir = generalData['Mydir'] … … 4943 4943 SetPeakRoll(dirDict[key]) 4944 4944 SetMapPeaksText(mapPeaks) 4945 elif key in ['M',]and generalData[' Type'] in ['modulated','magnetic']: #make a movie file4945 elif key in ['M',]and generalData['Modulated']: #make a movie file 4946 4946 G2frame.tau = 0. 4947 4947 for i in range(10): … … 4954 4954 Fade += 1 4955 4955 Draw('key down',Fade) 4956 elif key in ['+','-','=','0'] and generalData[' Type'] in ['modulated','magnetic']:4956 elif key in ['+','-','=','0'] and generalData['Modulated']: 4957 4957 if keyBox: 4958 4958 OnKeyPressed(event) … … 4968 4968 except AttributeError: #if from OnKeyBox above 4969 4969 key = str(event.key).upper() 4970 if key in ['+','-','=','0'] and generalData[' Type'] in ['modulated','magnetic']:4970 if key in ['+','-','=','0'] and generalData['Modulated']: 4971 4971 if key == '0': 4972 4972 G2frame.tau = 0. … … 5794 5794 else: 5795 5795 choice = [' save as/key:','jpeg','tiff','bmp','c: center on 1/2,1/2,1/2','n: next','p: previous'] 5796 if generalData[' Type'] in ['modulated','magnetic',] and len(drawAtoms):5796 if generalData['Modulated'] and len(drawAtoms): 5797 5797 choice += ['+: increase tau','-: decrease tau','0: set tau = 0'] #add 'm: make modulation movie' 5798 5798 -
trunk/GSASIIspc.py
r2367 r2401 93 93 SGData['SGCen'] = np.array(([0,0,0],[1./3.,2./3.,2./3.],[2./3.,1./3.,1./3.])) 94 94 SGData['SGOps'] = [] 95 SGData['SGGen'] = [] 96 SGData['SGSpin'] = [] 95 97 for i in range(SGInfo[5]): 96 98 Mat = np.array(SGInfo[6][i]) 97 99 Trns = np.array(SGInfo[7][i]) 98 100 SGData['SGOps'].append([Mat,Trns]) 101 SGData['SGGen'].append(int(SGInfo[8][i])) 102 SGData['SGSpin'].append('black') 99 103 if SGData['SGLaue'] in '-1': 100 104 SGData['SGSys'] = SysSym[0] … … 115 119 SGData['SGPolax'] = SGpolar(SGData) 116 120 SGData['SGPtGrp'],SGData['SSGKl'] = SGPtGroup(SGData) 117 return SGInfo[ 8],SGData121 return SGInfo[-1],SGData 118 122 119 123 def SGErrors(IErr): … … 417 421 for l in SGPrint(A): 418 422 print l 423 424 def GetGenSym(SGData): 425 ''' 426 Get the space group generator symbols 427 :param SGData: from :func:`SpcGroup` 428 LaueSym = ('-1','2/m','mmm','4/m','4/mmm','3R','3mR','3','3m1','31m','6/m','6/mmm','m3','m3m') 429 LattSym = ('P','A','B','C','I','F','R') 430 UniqSym = ('','','a','b','c','',) 431 432 ''' 433 if SGData['SGInv']: 434 if SGData['SGLaue'] in ['-1','2/m','mmm']: 435 Ibar = 7 436 elif SGData['SGLaue'] in ['4/m','4/mmm']: 437 Ibar = 1 438 elif SGData['SGLaue'] in ['3R','3mR','3','3m1','31m','6/m','6/mmm']: 439 Ibar = 15 #8+4+2+1 440 else: 441 Ibar = 4 442 Ibarx = Ibar&14 443 else: 444 Ibarx = 8 445 if SGData['SGLaue'] in ['-1','2/m','mmm','m3','m3m']: 446 Ibarx = 0 447 moregen = [] 448 for gen in SGData['SGGen']: 449 if SGData['SGLaue'] in ['m3','m3m']: 450 if gen in [1,2,4]: gen = 4 451 elif gen < 7: gen = 0 452 elif SGData['SGLaue'] in ['4/m','4/mmm','3R','3mR','3','3m1','31m','6/m','6/mmm']: 453 if gen == 2: gen = 4 454 elif gen in [3,5]: gen = 3 455 elif gen == 6: 456 if SGData['SGLaue'] in ['4/m','4/mmm']: gen = 128 457 else: gen = 16 458 elif not SGData['SGInv'] and gen == 12: gen = 8 459 elif not SGData['SGInv'] and SGData['SGLaue'] in ['3','3m1','31m','6/m','6/mmm'] and gen == 1 : gen = 24 460 if gen == 99: 461 if SGData['SGLaue'] in ['3m1','31m','6/m','6/mmm']: gen = 3 462 elif SGData['SGLaue'] == 'm3m': gen = 12 463 else: gen = 8 464 elif gen == 98: 465 if SGData['SGLaue'] in ['3m1','31m','6/m','6/mmm']: gen = 4 466 else: gen = 8 467 elif not SGData['SGInv'] and gen == 23 and SGData['SGLaue'] in ['m3','m3m']: gen = 24 468 elif gen >= 16 and gen != 128: 469 if not SGData['SGInv']: gen = 31 470 else: gen = gen^Ibarx 471 if SGData['SGInv']: 472 if gen < 128: 473 moregen.append(gen^Ibar) 474 else: 475 moregen.append(1) 476 SGData['SGGen'] += moregen 477 OprNames = [GetOprPtrName(str(irtx))[1] for irtx in PackRot(SGData['SGOps'])] 478 if SGData['SGInv']: 479 OprNames += [GetOprPtrName(str(-irtx))[1] for irtx in PackRot(SGData['SGOps'])] 480 Nsyms = len(SGData['SGOps']) 481 if SGData['SGInv']: Nsyms *= 2 482 UsymOp = [] 483 OprFlg = [] 484 if Nsyms in [1,3]: NunqOp = 0 #Triclinic acentric OR trigonal 3 485 elif Nsyms == 2: #Centric triclinic or acentric momoclinic 486 NunqOp = 1 487 UsymOp.append(OprNames[1]) 488 OprFlg.append(SGData['SGGen'][1]) 489 elif Nsyms == 4: #Point symmetry 2/m, 222, 22m, or 4 490 if '4z' in OprNames[1]: #Point symmetry 4 or -4 491 NunqOp = 1 492 UsymOp.append(OprNames[1]) 493 OprFlg.append(SGData['SGGen'][1]) 494 elif not SGData['SGInv']: #Acentric Orthorhombic 495 if 'm' in OprNames[1:4]: #22m, 2m2 or m22 496 NunqOp = 2 497 if '2' in OprNames[1]: #Acentric orthorhombic, 2mm 498 UsymOp.append(OprNames[2]) 499 OprFlg.append(SGData['SGGen'][2]) 500 UsymOp.append(OprNames[3]) 501 OprFlg.append(SGData['SGGen'][3]) 502 elif '2' in OprNames[2]: #Acentric orthorhombic, m2m 503 UsymOp.append(OprNames[1]) 504 OprFlg.append(SGData['SGGen'][1]) 505 UsymOp.append(OprNames[3]) 506 OprFlg.append(SGData['SGGen'][3]) 507 else: #Acentric orthorhombic, mm2 508 UsymOp.append(OprNames[1]) 509 OprFlg.append(SGData['SGGen'][1]) 510 UsymOp.append(OprNames[2]) 511 OprFlg.append(SGData['SGGen'][2]) 512 else: #Acentric orthorhombic, 222 513 NunqOp = -3 514 SGData['SGGen'][1:] = [4,2,1] 515 UsymOp.append(OprNames[1]) 516 OprFlg.append(SGData['SGGen'][1]) 517 UsymOp.append(OprNames[2]) 518 OprFlg.append(SGData['SGGen'][2]) 519 UsymOp.append(OprNames[3]) 520 OprFlg.append(SGData['SGGen'][3]) 521 else: #Centric Monoclinic 522 NunqOp = 2 523 UsymOp.append(OprNames[1]) 524 OprFlg.append(SGData['SGGen'][1]) 525 UsymOp.append(OprNames[3]) 526 OprFlg.append(SGData['SGGen'][3]) 527 elif Nsyms == 6: #Point symmetry 32, 3m or 6 528 NunqOp = 1 529 if '6' in OprNames[1]: #Hexagonal 6/m Laue symmetry 530 UsymOp.append(OprNames[1]) 531 OprFlg.append(SGData['SGGen'][1]) 532 else: #Trigonal 533 UsymOp.append(OprNames[4]) 534 OprFlg.append(SGData['SGGen'][3]) 535 if '2100' in OprNames[1]: UsymOp[-1] = ' 2100 ' 536 elif Nsyms == 8: #Point symmetry mmm, 4/m, or 422, etc 537 if '4' in OprNames[1]: #Tetragonal 538 NunqOp = 2 539 if SGData['SGInv']: #4/m 540 UsymOp.append(OprNames[1]) 541 OprFlg.append(SGData['SGGen'][1]) 542 UsymOp.append(OprNames[6]) 543 OprFlg.append(SGData['SGGen'][6]) 544 else: 545 if 'x' in OprNames[4]: #4mm type group 546 UsymOp.append(OprNames[4]) 547 OprFlg.append(5) 548 UsymOp.append(OprNames[7]) 549 OprFlg.append(7) 550 else: #-42m, -4m2, and 422 type groups 551 UsymOp.append(OprNames[5]) 552 OprFlg.append(7) 553 UsymOp.append(OprNames[6]) 554 OprFlg.append(18) 555 else: #Orthorhombic, mmm 556 NunqOp = 3 557 UsymOp.append(OprNames[1]) 558 OprFlg.append(SGData['SGGen'][1]) 559 UsymOp.append(OprNames[2]) 560 OprFlg.append(SGData['SGGen'][2]) 561 UsymOp.append(OprNames[7]) 562 OprFlg.append(SGData['SGGen'][7]) 563 elif Nsyms == 12 and '3' in OprNames[1]: #Trigonal 564 NunqOp = 2 565 UsymOp.append(OprNames[3]) 566 OprFlg.append(SGData['SGGen'][3]) 567 UsymOp.append(OprNames[9]) 568 OprFlg.append(SGData['SGGen'][9]) 569 elif Nsyms == 12 and '6' in OprNames[1]: #Hexagonal 570 NunqOp = 2 571 if 'mz' in OprNames[9]: #6/m 572 UsymOp.append(OprNames[1]) 573 OprFlg.append(SGData['SGGen'][1]) 574 UsymOp.append(OprNames[6]) 575 OprFlg.append(SGData['SGGen'][6]) 576 else: #6mm, -62m, -6m2 or 622 577 UsymOp.append(OprNames[6]) 578 OprFlg.append(17) 579 if 'm' in OprNames[1]: OprFlg[-1] = 20 580 UsymOp.append(OprNames[7]) 581 OprFlg.append(23) 582 elif Nsyms in [16,24]: 583 if '3' in OprNames[1]: 584 NunqOp = 1 585 UsymOp.append('') 586 OprFlg.append(SGData['SGGen'][3]) 587 for i in range(Nsyms): 588 if 'mx' in OprNames[i]: 589 UsymOp[-1] = OprNames[i] 590 elif 'm11' in OprNames[i]: 591 UsymOp[-1] = OprNames[i] 592 elif '211' in OprNames[i]: 593 UsymOp[-1] = OprNames[i] 594 OprFlg[-1] = 24 595 else: #4/mmm or 6/mmm 596 NunqOp = 3 597 UsymOp.append(' mz ') 598 OprFlg.append(1) 599 if '4' in OprNames[1]: #4/mmm 600 UsymOp.append(' mx ') 601 OprFlg.append(19) 602 UsymOp.append(' m110 ') 603 OprFlg.append(21) 604 else: #6/mmm 605 UsymOp.append(' m110 ') 606 OprFlg.append(3) 607 UsymOp.append(' m+-0 ') 608 OprFlg.append(7) 609 else: #System is cubic 610 if Nsyms == 48: 611 NunqOp = 2 612 UsymOp.append(' mx ') 613 OprFlg.append(3) 614 UsymOp.append(' m110 ') 615 OprFlg.append(23) 616 else: 617 NunqOp = 0 618 ncv = len(SGData['SGCen']) 619 if ncv > 1: 620 for icv in range(ncv): 621 if icv: 622 if SGData['SGCen'][icv][0] == 0.5: 623 if SGData['SGCen'][icv][1] == 0.5: 624 if SGData['SGCen'][icv][2] == 0.5: 625 UsymOp.append(' Icen ') 626 else: 627 UsymOp.append(' Ccen ') 628 else: 629 UsymOp.append(' Bcen ') 630 elif SGData['SGCen'][icv][1] == 0.5: 631 UsymOp.append(' Acen ') 632 else: 633 UsymOp.append(' Rcen ') 634 return UsymOp,OprFlg 635 636 def MagSGSym(SGData): 637 SGLaue = SGData['SGLaue'] 638 SpnFlp = SGData['SGSpin'] 639 if not len(SpnFlp): 640 return SGData['SpGrp'] 641 print SGData['SpGrp'],': ',SGData['SGGen'],SpnFlp 642 magSym = SGData['SpGrp'].split() 643 if len(SpnFlp) == 1: 644 if 'red' == SpnFlp[-1]: 645 magSym[1] += "'" 646 return ' '.join(magSym) 647 648 649 return ' '.join(magSym) 419 650 420 651 ################################################################################ … … 2023 2254 return result[0] 2024 2255 2256 def PackRot(SGOps): 2257 IRT = [] 2258 for ops in SGOps: 2259 M = ops[0] 2260 irt = 0 2261 for j in range(2,-1,-1): 2262 for k in range(2,-1,-1): 2263 irt *= 3 2264 irt += M[k][j] 2265 IRT.append(int(irt)) 2266 return IRT 2267 2025 2268 def SytSym(XYZ,SGData): 2026 2269 ''' … … 2035 2278 2036 2279 ''' 2037 def PackRot(SGOps):2038 IRT = []2039 for ops in SGOps:2040 M = ops[0]2041 irt = 02042 for j in range(2,-1,-1):2043 for k in range(2,-1,-1):2044 irt *= 32045 irt += M[k][j]2046 IRT.append(int(irt))2047 return IRT2048 2049 2280 SymName = '' 2050 2281 Mult = 1 -
trunk/GSASIIstrIO.py
r2245 r2401 890 890 line = ' res no residue chain'+line 891 891 print >>pFile,line 892 if General['Type'] in ['nuclear','m odulated','magnetic','faulted',]:892 if General['Type'] in ['nuclear','magnetic','faulted',]: 893 893 print >>pFile,135*'-' 894 894 for i,at in enumerate(Atoms): … … 1076 1076 SSGtext = [] #no superstructure 1077 1077 im = 0 1078 if General[' Type'] in ['modulated','magnetic']:1078 if General['Modulated']: 1079 1079 im = 1 #refl offset 1080 1080 Vec,vRef,maxH = General['SuperVec'] … … 1163 1163 eqv[1] /= coef 1164 1164 G2mv.StoreEquivalence(name,equiv[1:]) 1165 if General[' Type'] in ['modulated','magnetic']:1165 if General['Modulated']: 1166 1166 AtomSS = at[-1]['SS1'] 1167 1167 waveType = AtomSS['waveType'] … … 1254 1254 PrintRBObjects(resRBData,vecRBData) 1255 1255 PrintAtoms(General,Atoms) 1256 if General[' Type'] in ['modulated','magnetic']:1256 if General['Modulated']: 1257 1257 PrintWaves(General,Atoms) 1258 1258 print >>pFile,'\n Unit cell: a = %.5f'%(cell[1]),' b = %.5f'%(cell[2]),' c = %.5f'%(cell[3]), \ … … 1837 1837 print >>pFile,sigstr 1838 1838 ik = 6 #for Pawley stuff below 1839 if General[' Type'] in ['modulated','magnetic']:1839 if General['Modulated']: 1840 1840 ik = 7 1841 1841 Vec,vRef,maxH = General['SuperVec'] … … 1909 1909 ind = General['AtomTypes'].index(at[ct]) 1910 1910 General['Mass'] += General['AtomMass'][ind]*at[cx+3]*at[cx+5] 1911 if General[' Type'] in ['modulated','magnetic']:1911 if General['Modulated']: 1912 1912 AtomSS = at[-1]['SS1'] 1913 1913 waveType = AtomSS['waveType'] … … 1941 1941 1942 1942 PrintAtomsAndSig(General,Atoms,atomsSig) 1943 if General[' Type'] in ['modulated','magnetic']:1943 if General['Modulated']: 1944 1944 PrintWavesAndSig(General,Atoms,wavesSig) 1945 1945 … … 2080 2080 cell = Phases[phase]['General']['Cell'][1:7] 2081 2081 A = G2lat.cell2A(cell) 2082 if Phases[phase]['General'][' Type'] in ['modulated','magnetic']:2082 if Phases[phase]['General']['Modulated']: 2083 2083 SSGData = Phases[phase]['General']['SSGData'] 2084 2084 Vec,x,maxH = Phases[phase]['General']['SuperVec'] … … 2195 2195 Uniq = [] 2196 2196 Phi = [] 2197 if Phases[phase]['General'][' Type'] in ['modulated','magnetic']:2197 if Phases[phase]['General']['Modulated']: 2198 2198 ifSuper = True 2199 2199 HKLd = np.array(G2lat.GenSSHLaue(dmin,SGData,SSGData,Vec,maxH,A)) -
trunk/GSASIIstrMath.py
r2240 r2401 3115 3115 Phase = Phases[phase] 3116 3116 im = 0 3117 if Phase['General'][' Type'] in ['modulated','magnetic']:3117 if Phase['General']['Modulated']: 3118 3118 im = 1 3119 3119 pId = Phase['pId'] … … 3251 3251 SGMT = np.array([ops[0].T for ops in SGData['SGOps']]) 3252 3252 im = 0 3253 if Phase['General'][' Type'] in ['modulated','magnetic']:3253 if Phase['General']['Modulated']: 3254 3254 SSGData = Phase['General']['SSGData'] 3255 3255 SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']]) … … 3430 3430 SGMT = np.array([ops[0].T for ops in SGData['SGOps']]) 3431 3431 im = 0 3432 if Phase['General'][' Type'] in ['modulated','magnetic']:3432 if Phase['General']['Modulated']: 3433 3433 SSGData = Phase['General']['SSGData'] 3434 3434 SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']]) … … 3688 3688 SGData = Phase['General']['SGData'] 3689 3689 im = 0 3690 if Phase['General'][' Type'] in ['modulated','magnetic']:3690 if Phase['General']['Modulated']: 3691 3691 SSGData = Phase['General']['SSGData'] 3692 3692 SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']]) … … 3979 3979 if parmDict[phfx+'Scale'] < 0.: 3980 3980 parmDict[phfx+'Scale'] = .001 3981 if Phase['General'][' Type'] in ['modulated','magnetic']:3981 if Phase['General']['Modulated']: 3982 3982 SSGData = Phase['General']['SSGData'] 3983 3983 SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']]) -
trunk/fsource/pyspg.for
r341 r2401 2 2 3 3 SUBROUTINE SGFORPY(SPG,LAUE,SGINV,SGLATT,SGUNIQ,SGPOL, 4 1 SGNOPS,SGMTRX,SGTRNS, IERR)4 1 SGNOPS,SGMTRX,SGTRNS,SGGEN,IERR) 5 5 Cf2py intent(in) SPG 6 6 Cf2py intent(out) LAUE … … 12 12 Cf2py intent(out) SGMTRX 13 13 Cf2py intent(out) SGTRNS 14 Cf2py intent(out) SGGEN 14 15 Cf2py intent(out) IERR 15 16 16 17 CHARACTER*(20) SPG 17 18 INTEGER*4 LAUE,SGINV,SGLATT,SGUNIQ,SGNOPS,IERR,SGNCEN 18 REAL*4 SGMTRX(24,3,3),SGTRNS(24,3) 19 REAL*4 SGMTRX(24,3,3),SGTRNS(24,3),SGGEN(24) 19 20 REAL*4 RT(5,4,25),CEN(3,4) 20 21 INTEGER*4 JRT(3,5,24) … … 30 31 END DO 31 32 END DO 33 SGGEN(K) = JRT(3,5,K) 32 34 END DO 33 35 RETURN -
trunk/imports/G2phase.py
r2116 r2401 260 260 self.warnings += '\nThe GSAS space group was not interpreted(!) and has been set to "P 1".' 261 261 self.warnings += "Change this in phase's General tab." 262 elif 'SPNFLP' in key: 263 spin = {'1':'black','-1':'red'} 264 SpnFlp = [spin[s.strip()] for s in EXPphase[key].split()] 262 265 elif 'OD ' in key: 263 266 SHdata = EXPphase[key].split() # may not have all 9 values … … 276 279 shNcof = int(SHvals[1]) 277 280 Atoms = [] 278 if Ptype == 'nuclear':281 if Ptype in ['nuclear','magnetic',]: 279 282 for key in keyList: 280 283 if 'AT' in key: … … 296 299 Atom.append(ran.randint(0,sys.maxint)) 297 300 Atoms.append(Atom) 301 elif key[11:] == 'M' and key[6:8] == 'AT': 302 S = EXPphase[key] 303 Mag = [float(S[:10]),float(S[10:20]),float(S[20:30])] 304 Atoms[-1] = Atoms[-1][:7]+Mag+Atoms[-1][7:] 298 305 elif Ptype == 'macromolecular': 299 306 for key in keyList: … … 334 341 if general['Type'] =='macromolecular': 335 342 general['AtomPtrs'] = [6,4,10,12] 336 else: 343 elif general['Type'] =='magnetic': 344 general['AtomPtrs'] = [3,1,10,12] 345 general['SGData']['SGSpin'] = SpnFlp 346 else: #nuclear 337 347 general['AtomPtrs'] = [3,1,7,9] 338 348 general['SH Texture'] = textureData … … 440 450 if nqi: 441 451 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry") 442 Type = 'modulated'443 452 vec = S.split()[1:] 444 453 SuperVec = [[float(vec[i]) for i in range(3)],False,4] … … 549 558 Phase = G2IO.SetNewPhase(Name=Title,SGData=SGData,cell=cell+[Volume,]) 550 559 Phase['General']['Type'] = Type 560 Phase['General']['Modulated'] = True 551 561 Phase['General']['Super'] = nqi 552 562 Phase['General']['SuperVec'] = SuperVec
Note: See TracChangeset
for help on using the changeset viewer.