Changeset 3208
- Timestamp:
- Dec 27, 2017 10:41:30 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r3187 r3208 1628 1628 Spos = atom[-1]['SS1']['Spos'] 1629 1629 Sadp = atom[-1]['SS1']['Sadp'] 1630 if generalData['Type'] == 'magnetic': 1631 Smag = atom[-1]['SS1']['Smag'] 1632 atmom = np.array(atom[cx+4:cx+7]) 1630 1633 indx = FindAtomIndexByIDs(drawAtoms,dci,[atom[cia+8],],True) 1631 1634 for ind in indx: … … 1637 1640 wave = np.zeros(3) 1638 1641 uwave = np.zeros(6) 1642 mom = np.zeros(3) 1639 1643 #how do I handle Sfrac? - fade the atoms? 1640 1644 if len(Sfrac): … … 1665 1669 if len(scof): 1666 1670 wave += np.sum(posFourier(tauT,np.array(scof),np.array(ccof)),axis=1) 1671 if generalData['Type'] == 'magnetic' and len(Smag): 1672 scof = [] 1673 ccof = [] 1674 for i,spos in enumerate(Smag): 1675 scof.append(spos[0][:3]) 1676 ccof.append(spos[0][3:]) 1677 if len(scof): 1678 mom += np.sum(posFourier(tauT,np.array(scof),np.array(ccof)),axis=1) 1667 1679 if len(Sadp): 1668 1680 scof = [] … … 1679 1691 X = G2spc.ApplyStringOps(opr,SGData,atxyz+wave) 1680 1692 drawatom[dcx:dcx+3] = X 1693 if generalData['Type'] == 'magnetic': 1694 M = G2spc.ApplyStringOpsMom(opr,SGData,atmom+mom) 1695 drawatom[dcx+3:dcx+6] = M 1681 1696 return drawAtoms,Fade 1682 1697 … … 3297 3312 Vol = cell[6] 3298 3313 im = 0 3299 if generalData[' Type'] in ['modulated','magnetic',]:3314 if generalData['Modulated'] == True: 3300 3315 im = 1 3301 3316 Hmax = np.asarray(G2lat.getHKLmax(dmin,SGData,A),dtype='i')+1 -
trunk/GSASIIphsGUI.py
r3197 r3208 371 371 self.newCell[2:5] = [A[2,2],90.,90.] 372 372 a,b = G2lat.cell2AB(self.newCell[:6]) 373 self.Trans = np.inner(a.T,B) #correct!373 self.Trans = np.inner(a.T,B).T #correct! 374 374 self.ifConstr = False 375 375 self.newSpGrp = 'P 1' … … 422 422 Nops *= 2 423 423 SGData['SpnFlp'] = Nops*[1,] 424 # if self.Phase['General']['Type'] in ['modulated',]:425 # self.Phase['General']['SuperSg'] = SetDefaultSSsymbol()426 # self.Phase['General']['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1]427 424 428 425 def OnTest(event): … … 1148 1145 elif generalData['Type'] == 'magnetic': 1149 1146 generalData['AtomPtrs'] = [3,1,10,12] 1150 if generalData[' Type'] in ['modulated',]:1147 if generalData['Modulated']: 1151 1148 generalData['Modulated'] = True 1152 generalData['Type'] = 'nuclear'1153 1149 if 'Super' not in generalData: 1154 1150 generalData['Super'] = 1 … … 1764 1760 OprNames = G2spc.GenMagOps(SGData)[0] 1765 1761 else: 1766 if not len(GenSym) :1762 if not len(GenSym) or SGData['SGGray']: 1767 1763 magSizer.Add(wx.StaticText(General,label=' No spin inversion allowed'),0,WACV) 1764 OprNames,SpnFlp = G2spc.GenMagOps(SGData) 1768 1765 else: 1769 1766 spinColor = ['black','red'] … … 1853 1850 Choice = [] 1854 1851 for item in SSChoice: 1855 E,SSG = G2spc.SSpcGroup(generalData['SGData'],item) 1852 if generalData['SGData']['SGGray']: 1853 E,SSG = G2spc.SSpcGroup(generalData['SGData'],item+'s') 1854 else: 1855 E,SSG = G2spc.SSpcGroup(generalData['SGData'],item) 1856 1856 if SSG: Choice.append(item) 1857 1857 if SSChoice: … … 2634 2634 if colM: 2635 2635 SytSym,Mul,Nop,dupDir = G2spc.SytSym(atomData[row][colX:colX+3],SGData) 2636 CSI = G2spc.GetCSpqinel(SytSym,SpnFlp,dupDir) 2636 CSI = [] 2637 if not SGData['SGGray']: 2638 CSI = G2spc.GetCSpqinel(SytSym,SpnFlp,dupDir) 2637 2639 # print (SytSym,Nop,SpnFlp[Nop],CSI,dupDir) 2638 2640 for i in range(3): … … 4735 4737 'radiusFactor':0.85,'contourLevel':1.,'bondRadius':0.1,'ballScale':0.33, 4736 4738 'vdwScale':0.67,'ellipseProb':50,'sizeH':0.50,'unitCellBox':True, 4737 'showABC':True,'selectedAtoms':[],'Atoms':[],'oldxy':[], 4739 'showABC':True,'selectedAtoms':[],'Atoms':[],'oldxy':[],'magMult':1.0, 4738 4740 'bondList':{},'viewDir':[1,0,0],'Plane':[[0,0,1],False,False,0.0,[255,255,0]]} 4739 4741 V0 = np.array([0,0,1]) … … 5436 5438 opNum = G2spc.GetOpNum(item[2],SGData) 5437 5439 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 5438 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat)*nl.det(M)*SpnFlp[opNum-1] 5440 if SGData['SGGray']: 5441 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat)*nl.det(M) 5442 else: 5443 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat)*nl.det(M)*SpnFlp[opNum-1] 5439 5444 atom[cs-1] = str(item[2])+'+' \ 5440 5445 +str(item[3][0])+','+str(item[3][1])+','+str(item[3][2]) … … 5629 5634 bondRadiusTxt.SetLabel(' Bond radius, A: '+'%.2f'%(drawingData['bondRadius'])) 5630 5635 G2plt.PlotStructure(G2frame,data) 5636 5637 def OnMagMult(event): 5638 drawingData['magMult'] = magMult.GetValue()/100. 5639 magMultTxt.SetLabel(' Mag. mom. mult.: '+'%.2f'%(drawingData['magMult'])) 5640 G2plt.PlotStructure(G2frame,data) 5631 5641 5632 5642 def OnContourLevel(event): … … 5701 5711 bondRadius.Bind(wx.EVT_SLIDER, OnBondRadius) 5702 5712 slideSizer.Add(bondRadius,1,wx.EXPAND|wx.RIGHT) 5713 5714 if generalData['Type'] == 'magnetic': 5715 magMultTxt = wx.StaticText(drawOptions,-1,' Mag. mom. mult.: '+'%.2f'%(drawingData['magMult'])) 5716 slideSizer.Add(magMultTxt,0,WACV) 5717 magMult = wx.Slider(drawOptions,style=wx.SL_HORIZONTAL,value=int(100*drawingData['magMult'])) 5718 magMult.SetRange(10,500) 5719 magMult.Bind(wx.EVT_SLIDER, OnMagMult) 5720 slideSizer.Add(magMult,1,wx.EXPAND|wx.RIGHT) 5703 5721 5704 5722 if generalData['Map']['rhoMax']: -
trunk/GSASIIplot.py
r3175 r3208 6767 6767 6768 6768 if generalData['Type'] == 'magnetic': 6769 magMult = drawingData.get('magMult',1.0) 6769 6770 SymOp = int(atom[cs-1].split('+')[0]) 6770 6771 OpNum = G2spc.GetOpNum(SymOp,SGData)-1 6771 Moment = np.array(atom[cx+3:cx+6]) 6772 Moment = np.array(atom[cx+3:cx+6])*magMult 6772 6773 color = (Wt-Bc)/255. 6773 if SpnFlp[OpNum] < 0:6774 if not SGData['SGGray'] and SpnFlp[OpNum] < 0: 6774 6775 color = Rd/255. 6775 6776 RenderMoment(x,y,z,Moment,color) -
trunk/GSASIIscriptable.py
r3207 r3208 642 642 if 'Modulated' not in data['General']: 643 643 data['General']['Modulated'] = False 644 if 'modulated' in data['General']['Type']:645 data['General']['Modulated'] = True646 data['General']['Type'] = 'nuclear'644 # if 'modulated' in data['General']['Type']: 645 # data['General']['Modulated'] = True 646 # data['General']['Type'] = 'nuclear' 647 647 648 648 … … 691 691 elif generalData['Type'] == 'magnetic': 692 692 generalData['AtomPtrs'] = [3,1,10,12] 693 if generalData['Type'] in ['modulated',]: 694 generalData['Modulated'] = True 693 if generalData['Modulated']: 695 694 generalData['Type'] = 'nuclear' 696 695 if 'Super' not in generalData: -
trunk/GSASIIspc.py
r3200 r3208 46 46 * 'SpGrp': space group symbol, slightly cleaned up 47 47 * 'SGFixed': True if space group data can not be changed, e.g. from magnetic cif; otherwise False 48 * 'SGGray': True if 1' in symbol - gray group for mag. incommensurate phases 48 49 * 'SGLaue': one of '-1', '2/m', 'mmm', '4/m', '4/mmm', '3R', 49 50 '3mR', '3', '3m1', '31m', '6/m', '6/mmm', 'm3', 'm3m' … … 70 71 if ':R' in SGSymbol: 71 72 SGSymbol = SGSymbol.replace(':',' ') #get rid of ':' in R space group symbols from some cif files 73 SGData['SGGray'] = False 74 if "1'" in SGSymbol: #set for incommensurate magnetic 75 SGData['SGGray'] = True 76 SGSymbol = SGSymbol.replace("1'",'') 72 77 SGSymbol = SGSymbol.split(':')[0] #remove :1/2 setting symbol from some cif files 73 78 import pyspg … … 884 889 magSym[j] += "'" 885 890 Ptsym[j-1] += "'" 886 el se:891 elif len(GenSym): 887 892 if 'c' not in magSym[2]: 888 893 i,j = [1,2] … … 1374 1379 ''' 1375 1380 GenSymList = ['','s','0s','s0', '00s','0s0','s00','s0s','ss0','0ss','q00','0q0','00q','qq0','q0q', '0qq', 1376 'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s' ]1381 'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s',] 1377 1382 ''' 1378 1383 sym = ''.join(gensym) 1384 if SGData['SGGray'] and sym in ['s','0s','00s','000s','0000s']: 1385 return True 1386 if SGData.get('SGGray',False): 1387 if sym[-1] == 's': 1388 sym = sym[:-1] 1389 if sym == '': 1390 return True 1391 else: 1392 return False 1379 1393 # monoclinic - all done 1380 1394 if str(SSGKl) == '[-1]' and sym == 's': … … 1447 1461 LaueList = ['-1','2/m','mmm','4/m','4/mmm','3R','3mR','3','3m1','31m','6/m','6/mmm','m3','m3m'] 1448 1462 GenSymList = ['','s','0s','s0', '00s','0s0','s00','s0s','ss0','0ss','q00','0q0','00q','qq0','q0q', '0qq', 1449 'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s' ]1463 'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s','0000s'] 1450 1464 Fracs = {'1/2':0.5,'1/3':1./3,'1':1.0,'0':0.,'s':.5,'t':1./3,'q':.25,'h':1./6,'a':0.,'b':0.,'g':0.} 1451 1465 LaueId = LaueList.index(SGData['SGLaue']) … … 1459 1473 return 'Error in superspace symbol '+SSymbol,None 1460 1474 if ''.join(gensym) not in GenSymList: 1461 return 'unknown generator symbol '+''.join(gensym),None 1475 if SGData['SGGray'] and ''.join(gensym[:-1]) not in GenSymList: 1476 return 'unknown generator symbol '+''.join(gensym),None 1462 1477 try: 1463 1478 LaueModId = LaueModList.index(''.join(modsym)) … … 1470 1485 if SGData['SGLaue'] in ['2/m','mmm']: 1471 1486 SSGKl = fixMonoOrtho() 1472 if len(gensym) and len(gensym) != len(SSGKl): 1487 Ngen = len(gensym) 1488 if SGData.get('SGGray',False): 1489 Ngen -= 1 1490 if len(gensym) and Ngen != len(SSGKl): 1473 1491 return 'Wrong number of items in generator symbol '+''.join(gensym),None 1474 1492 if not checkGen(gensym): 1475 1493 return 'Generator '+''.join(gensym)+' not consistent with space group '+SGData['SpGrp'],None 1476 gensym = specialGen(gensym ,modsym)1477 genQ = [Fracs[mod] for mod in gensym ]1494 gensym = specialGen(gensym[:Ngen],modsym) 1495 genQ = [Fracs[mod] for mod in gensym[:Ngen]] 1478 1496 if not genQ: 1479 1497 genQ = [0,0,0,0] … … 1511 1529 ''' 1512 1530 modsym,gensym = SSymbol.replace(' ','').split(')') 1531 modsym = modsym.replace(',','') 1532 if "1'" in modsym: 1533 gensym = gensym[:-1] 1534 modsym = modsym.replace("1'",'') 1513 1535 if gensym in ['0','00','000','0000']: #get rid of extraneous symbols 1514 1536 gensym = '' … … 2835 2857 else: 2836 2858 cellA = np.zeros(3) 2837 newMom = -(np.inner(Mom,M).T)*SGData['SpnFlp'][nA-1]*nl.det(M) #why -? 2859 if SGData['SGGray']: 2860 newMom = -(np.inner(Mom,M).T)*nl.det(M) 2861 else: 2862 newMom = -(np.inner(Mom,M).T)*SGData['SpnFlp'][nA-1]*nl.det(M) 2838 2863 return newMom 2839 2864 … … 2904 2929 rspc = rspc[:-1] 2905 2930 rhomb = ' R' 2931 gray = '' 2932 if "1'" in rspc: 2933 gray = " 1'" 2934 rspc = rspc[:-2] 2906 2935 elif rspc[-1:] == 'H': # hexagonal is assumed and thus can be ignored 2907 2936 rspc = rspc[:-1] … … 2910 2939 for spc in i: 2911 2940 if rspc == spc.replace(' ','').upper(): 2912 return spc +rhomb2941 return spc+gray+rhomb 2913 2942 # how about the post-2002 orthorhombic names? 2914 2943 if rspc in sgequiv_2002_orthorhombic: 2915 return sgequiv_2002_orthorhombic[rspc] 2944 return sgequiv_2002_orthorhombic[rspc]+gray 2916 2945 else: 2917 2946 # not found … … 3088 3117 'Pm3m': ('P 2 3','P 21 3','P m 3','P n 3','P a 3','P 4 3 2','P 42 3 2', 3089 3118 'P 43 3 2','P 41 3 2','P -4 3 m','P -4 3 n','P m 3 m','P n 3 n', 3090 'P m 3 n','P n 3 m', ),3119 'P m 3 n','P n 3 m','P n -3 n','P n -3 m','P m -3 n',), 3091 3120 'Im3m':('I 2 3','I 21 3','I m -3','I a -3', 'I 4 3 2','I 41 3 2', 3092 'I -4 3 m', 'I -4 3 d','I m -3 m','I m 3 m','I a -3 d', ),3121 'I -4 3 m', 'I -4 3 d','I m -3 m','I m 3 m','I a -3 d','I n -3 n'), 3093 3122 'Fm3m':('F 2 3','F m -3','F d -3','F 4 3 2','F 41 3 2','F -4 3 m', 3094 3123 'F -4 3 c','F m -3 m','F m 3 m','F m -3 c','F d -3 m','F d -3 c',), -
trunk/imports/G2phase_CIF.py
r3199 r3208 157 157 MSSpGrp = blk.get("_space_group.magn_ssg_name_BNS",'') 158 158 if not MSSpGrp: 159 MSSpGrp = blk.get("_space_group.magn_ssg_name",'') 159 MSSpGrp = blk.get("_space_group.magn_ssg_name",'') 160 160 if not MSSpGrp: 161 161 msg = 'No incommensurate space group name was found in the CIF.' … … 177 177 if magnetic: 178 178 sspgrp = MSSpGrp.split('(') 179 SpGrp = sspgrp[0].replace("1'",'') 180 SpGrp = G2spc.StandardizeSpcName(SpGrp) 179 sspgrp[1] = "("+sspgrp[1] 180 SpGrp = G2spc.StandardizeSpcName(sspgrp[0]) 181 self.MPhase['General']['Type'] = 'magnetic' 182 self.MPhase['General']['AtomPtrs'] = [3,1,10,12] 181 183 else: 182 184 sspgrp = sspgrp.split('(') 185 sspgrp[1] = "("+sspgrp[1] 183 186 SpGrp = sspgrp[0] 184 187 SpGrp = G2spc.StandardizeSpcName(SpGrp) 185 188 self.Phase['General']['Type'] = 'nuclear' 186 SuperSg = '('+sspgrp[1].replace('\\','') 189 if not SpGrp: 190 print (sspgrp) 191 self.warnings += 'No space group name was found in the CIF.' 192 return False 193 SuperSg = sspgrp[1].replace('\\','') 187 194 SuperVec = [[0,0,.1],False,4] 188 195 else: #not incommensurate … … 206 213 self.MPhase['General']['Type'] = 'magnetic' 207 214 self.MPhase['General']['AtomPtrs'] = [3,1,10,12] 215 if not SpGrp: 216 print (MSpGrp) 217 self.warnings += 'No space group name was found in the CIF.' 218 return False 208 219 else: 209 220 SpGrp = SpGrp.replace('_','') 210 221 self.Phase['General']['Type'] = 'nuclear' 211 if not SpGrp:212 print (sspgrp)213 self.warnings += 'No space group name was found in the CIF.'214 return False215 222 #process space group symbol 216 223 E,SGData = G2spc.SpcGroup(SpGrp) … … 256 263 self.MPhase['General']['SGData']['SpnFlp'] = censpn 257 264 self.MPhase['General']['SGData']['MagSpGrp'] = MSpGrp 258 self.MPhase['General']['SGData']['MagPtGp'] = blk.get('_space_group.magn_point_group') 265 MagPtGp = blk.get('_space_group.magn_point_group') 266 if not MagPtGp: 267 MagPtGp = blk.get('_space_group_magn.point_group_name') 268 self.MPhase['General']['SGData']['MagPtGp'] = MagPtGp 259 269 # GenSym,GenFlg = G2spc.GetGenSym(SGData) 260 270 # self.MPhase['General']['SGData']['GenSym'] = GenSym … … 270 280 E,SSGData = G2spc.SSpcGroup(SGData,SuperSg) 271 281 self.Phase['General']['SSGData'] = SSGData 282 if magnetic: 283 self.MPhase['General']['SGData'] = SGData 284 # self.MPhase['General']['SGData']['SpnFlp'] = censpn 285 self.MPhase['General']['SGData']['MagSpGrp'] = MSSpGrp.replace(',','').replace('\\','') 286 self.MPhase['General']['SGData']['MagPtGp'] = blk.get('_space_group.magn_point_group') 287 self.MPhase['General']['SSGData'] = SSGData 288 # GenSym,GenFlg = G2spc.GetGenSym(SGData) 289 # self.MPhase['General']['SGData']['GenSym'] = GenSym 290 # self.MPhase['General']['SGData']['GenFlg'] = GenFlg 291 272 292 273 293 # cell parameters … … 328 348 displSloop = None 329 349 displFloop = None 350 MagFloop = None 330 351 displSdict = {} 331 352 displFdict = {} 353 MagFdict = {} 332 354 UijFloop = None 333 355 UijFdict = {} … … 347 369 UijFloop = blk.GetLoop('_atom_site_U_Fourier_atom_site_label') 348 370 UijFdict = dict(UijFloop.items()) 371 if blk.get('_atom_site_moment_Fourier_atom_site_label'): 372 MagFloop = blk.GetLoop('_atom_site_moment_Fourier_atom_site_label') 373 MagFdict = dict(MagFloop.items()) 349 374 self.Phase['Atoms'] = [] 350 375 if magnetic: … … 413 438 if Super: 414 439 Sfrac = [] 415 Sadp = []440 Sadp = np.zeros((4,12)) 416 441 Spos = np.zeros((4,6)) 442 Smag = np.zeros((4,6)) 417 443 nim = -1 418 444 waveType = 'Fourier' … … 435 461 if UijFdict: 436 462 nim = -1 437 Sadp = np.zeros((4,12))438 463 for i,item in enumerate(UijFdict['_atom_site_u_fourier_atom_site_label']): 439 464 if item == atomlist[0]: … … 446 471 val = UijFdict['_atom_site_u_fourier_param_cos'][i] 447 472 Sadp[im-1][ix+6] = cif.get_number_with_esd(val)[0] 473 if nim >= 0: 474 Sadp = [[sadp,False] for sadp in Sadp[:nim]] 475 else: 476 Sadp = [] 477 if MagFdict: 478 nim = -1 479 for i,item in enumerate(MagFdict['_atom_site_moment_fourier_atom_site_label']): 480 if item == atomlist[0]: 481 waveType = 'Fourier' 482 ix = ['x','y','z'].index(MagFdict['_atom_site_moment_fourier_axis'][i]) 483 im = int(MagFdict['_atom_site_moment_fourier_wave_vector_seq_id'][i]) 484 if im != nim: 485 nim = im 486 val = MagFdict['_atom_site_moment_fourier_param_sin'][i] 487 Smag[im-1][ix] = cif.get_number_with_esd(val)[0] 488 val = MagFdict['_atom_site_moment_fourier_param_cos'][i] 489 Smag[im-1][ix+3] = cif.get_number_with_esd(val)[0] 448 490 if nim >= 0: 449 S adp = [[sadp,False] for sadp in Sadp[:nim]]491 Smag = [[smag,False] for smag in Smag[:nim]] 450 492 else: 451 Sadp = [] 452 453 SSdict = {'SS1':{'waveType':waveType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':[]}} 493 Smag = [] 494 SSdict = {'SS1':{'waveType':waveType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}} 495 if magnetic and atomlist[0] in magatomlabels: 496 matomlist.append(SSdict) 454 497 atomlist.append(SSdict) 455 498 if len(atomlbllist) != len(self.Phase['Atoms']): … … 472 515 self.MPhase['General']['Name'] = name.strip()[:20]+' mag' 473 516 self.MPhase['General']['Super'] = Super 517 if Super: 518 self.MPhase['General']['Modulated'] = True 519 self.MPhase['General']['SuperVec'] = SuperVec 520 self.MPhase['General']['SuperSg'] = SuperSg 521 self.MPhase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1] 474 522 else: 475 523 self.MPhase = None 476 524 if Super: 477 self.Phase['General'][' Type'] = 'modulated'525 self.Phase['General']['Modulated'] = True 478 526 self.Phase['General']['SuperVec'] = SuperVec 479 527 self.Phase['General']['SuperSg'] = SuperSg
Note: See TracChangeset
for help on using the changeset viewer.