Changeset 2062
- Timestamp:
- Nov 21, 2015 9:45:03 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r1943 r2062 227 227 rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]}) 228 228 rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False) 229 badPhaseParms = ['Ax','Ay','Az','Amul','AI/A','Atype','SHorder','mV0','mV1','mV2','waveType','Vol',] 229 230 globalList = rbDict.keys() 230 231 globalList.sort() … … 240 241 phaseList = [] 241 242 for item in phaseDict: 242 if item.split(':')[2] not in ['Ax','Ay','Az','Amul','AI/A','Atype','SHorder']:243 if item.split(':')[2] not in badPhaseParms: 243 244 phaseList.append(item) 244 245 phaseList.sort() -
trunk/GSASIImath.py
r2061 r2062 1098 1098 return A 1099 1099 1100 def posZigZag(tau,Toff,slopes): 1101 Tau = (tau-Toff)%1. 1102 A = np.where(Tau <= 0.5,slopes[:,np.newaxis]*Tau,slopes[:,np.newaxis]*(1.-Tau)) 1100 def posZigZag(tau,Tmm,XYZmax): 1101 DT = Tmm[1]-Tmm[0] 1102 slopeUp = 2.*XYZmax/DT 1103 slopeDn = 2.*XYZmax/(1.-DT) 1104 A = np.array([np.where(Tmm[0] < t%1. <= Tmm[1],-XYZmax+slopeUp*((t-Tmm[0])%1.),XYZmax-slopeDn*((t-Tmm[1])%1.)) for t in tau]) 1105 return A 1106 1107 def posBlock(tau,Tmm,XYZmax): 1108 A = np.array([np.where(Tmm[0] < t%1. <= Tmm[1],-XYZmax,XYZmax) for t in tau]) 1103 1109 return A 1104 1110 … … 1158 1164 ccof = [] 1159 1165 for i,spos in enumerate(Spos): 1160 if waveType in [' Sawtooth','ZigZag'] and not i:1161 T off = spos[0][0]1162 slopes = np.array(spos[0][1:])1163 if waveType == ' Sawtooth':1164 wave = posSawtooth(tauT,Toff,slopes)1166 if waveType in ['ZigZag','Block'] and not i: 1167 Tminmax = spos[0][:2] 1168 XYZmax = np.array(spos[0][2:]) 1169 if waveType == 'Block': 1170 wave = np.array(posBlock([tauT,],Tminmax,XYZmax))[0] 1165 1171 elif waveType == 'ZigZag': 1166 wave = posZigZag(tauT,Toff,slopes)1172 wave = np.array(posZigZag([tauT,],Tminmax,XYZmax))[0] 1167 1173 else: 1168 1174 scof.append(spos[0][:3]) 1169 1175 ccof.append(spos[0][3:]) 1170 wave += np.sum(posFourier(tauT,np.array(scof),np.array(ccof),smul),axis=1) 1176 if len(scof): 1177 wave += np.sum(posFourier(tauT,np.array(scof),np.array(ccof),smul),axis=1) 1171 1178 if len(Sadp): 1172 1179 scof = [] -
trunk/GSASIIobj.py
r1924 r2062 1187 1187 s = 'Hist='+ShortHistNames.get(l[1],'? #'+str(l[1])) 1188 1188 l[-1] += ' #'+str(l[3]) 1189 elif l[4] is not None: # rigid body parameter 1189 elif l[4] is not None: # rigid body parameter or modulation parm 1190 1190 lbl = ShortPhaseNames.get(l[0],'phase?') 1191 s = "Res #"+str(l[3])+" body #"+str(l[4])+" in "+str(lbl) 1191 if 'RB' in l[2]: #rigid body parm 1192 s = "Res #"+str(l[3])+" body #"+str(l[4])+" in "+str(lbl) 1193 else: #modulation parm 1194 s = 'Atom %s wave %s in %s'%(LookupAtomLabel(l[0],l[3])[0],l[4],lbl) 1192 1195 elif l[3] is not None: # atom parameter, 1193 1196 lbl = ShortPhaseNames.get(l[0],'phase?') … … 1324 1327 'Fsin' : 'Sin site fraction modulation', 1325 1328 'Fcos' : 'Cos site fraction modulation', 1326 'Fzero' : 'Crenel function offset', 1329 'Fzero' : 'Crenel function offset', #may go away 1327 1330 'Fwid' : 'Crenel function width', 1328 'Tzero' : 'Sawtooth/ZigZag location', 1329 '([XYZ])slope': 'Sawtooth/ZigZag slope for \\1', 1331 'Tmin' : 'ZigZag/Block min location', 1332 'Tmax' : 'ZigZag/Block max location', 1333 '([XYZ])max': 'ZigZag/Block max value for \\1', 1330 1334 '([XYZ])sin' : 'Sin position wave for \\1', 1331 1335 '([XYZ])cos' : 'Cos position wave for \\1', -
trunk/GSASIIphsGUI.py
r2050 r2062 2377 2377 iatm,item = Indx[Obj.GetId()] 2378 2378 nt = numVals[Stype] 2379 if not len(atomData[iatm][-1][SS][item]) and waveType in [' Sawtooth',] and Stype == 'Spos':2380 nt = 42379 if not len(atomData[iatm][-1][SS][item]) and waveType in ['ZigZag','Block'] and Stype == 'Spos': 2380 nt = numVals[waveType] 2381 2381 atomData[iatm][-1][SS][item].append([[0.0 for i in range(nt)],False]) 2382 2382 UpdateWavesData() … … 2387 2387 try: 2388 2388 val = float(Obj.GetValue()) 2389 if waveType in ['ZigZag','Block'] and Stype == 'Spos' and ival < 2: 2390 if ival == 1: #Tmax 2391 val = min(1.0,max(0.0,val)) 2392 elif ival == 0: #Tmin 2393 val = max(-1.,min(val,atomData[iatm][-1][SS][item][iwave][0][1])) 2389 2394 except ValueError: 2390 2395 val = atomData[iatm][-1][SS][item][iwave][0][ival] … … 2410 2415 Indx[waveAdd.GetId()] = [iatm,Stype] 2411 2416 waveHead.Add(waveAdd,0,WACV) 2417 waveAdd.Bind(wx.EVT_CHECKBOX, OnAddWave) 2418 Indx[waveAdd.GetId()] = [iatm,Stype] 2419 waveHead.Add(waveAdd,0,WACV) 2412 2420 waveSizer.Add(waveHead) 2421 # print atm[0],waveBlk 2413 2422 if len(waveBlk): 2414 2423 nFour = 0 … … 2429 2438 Waves = wx.FlexGridSizer(0,4,5,5) 2430 2439 elif Stype == 'Spos': 2431 if waveType in [' Sawtooth',] and not iwave:2440 if waveType in ['ZigZag','Block'] and not iwave: 2432 2441 names = Names[6:] 2433 Waves = wx.FlexGridSizer(0, 6,5,5)2442 Waves = wx.FlexGridSizer(0,7,5,5) 2434 2443 waveName = waveType 2435 2444 else: … … 2482 2491 mainSizer = wx.BoxSizer(wx.VERTICAL) 2483 2492 typeNames = {'Sfrac':' Site fraction','Spos':' Position','Sadp':' Thermal motion','Smag':' Magnetic moment'} 2484 numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6 }2485 posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','T zero','Xslope','Yslope','Zslope']2493 numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6,'ZigZag':5,'Block':5} 2494 posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','Tmin','Tmax','Xmax','Ymax','Zmax'] 2486 2495 adpNames = ['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin', 2487 2496 'U11cos','U22cos','U33cos','U12cos','U13cos','U23cos'] 2488 2497 magNames = ['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos'] 2489 2498 fracNames = ['Fsin','Fcos','Fzero','Fwid'] 2490 waveTypes = ['Fourier',' Sawtooth','Crenel/Fourier']2499 waveTypes = ['Fourier','ZigZag','Block','Crenel/Fourier'] 2491 2500 Labels = {'Spos':posNames,'Sfrac':fracNames,'Sadp':adpNames,'Smag':magNames} 2492 2501 mainSizer.Add(wx.StaticText(waveData,label=' Incommensurate propagation wave data:'),0,WACV) … … 2499 2508 mainSizer.Add(AtomSizer(SS,atm)) 2500 2509 for Stype in ['Sfrac','Spos','Sadp','Smag']: 2501 if atm[cia] != 'A' and Stype == 'Sadp': #Uiso can't have modulations! 2510 if atm[cia] != 'A' and Stype == 'Sadp': #Uiso can't have modulations! (why not?) 2502 2511 continue 2503 2512 if generalData['Type'] != 'magnetic' and Stype == 'Smag': … … 3022 3031 Uij = G2spc.U2Uij(np.inner(np.inner(M,G2spc.Uij2U(Uij)),M)) 3023 3032 atom[cuij:cuij+6] = Uij 3024 atomData.append(atom )3033 atomData.append(atom[:cuij+9]) #not SS stuff 3025 3034 finally: 3026 3035 dlg.Destroy() … … 3092 3101 numAtoms = len(atomData) 3093 3102 cx,ct,cs,ci = data['Drawing']['atomPtrs'] 3103 cij = ci+2 3094 3104 generalData = data['General'] 3095 3105 SGData = generalData['SGData'] … … 3115 3125 newAtom[cx:cx+3] = xyz 3116 3126 newAtom[cx+3] = G2spc.StringOpsProd(oprB,newOp,SGData) 3117 atomData.append(newAtom )3127 atomData.append(newAtom[:cij+9]) #not SS stuff 3118 3128 finally: 3119 3129 wx.EndBusyCursor() … … 3155 3165 atom[cx:cx+3] = Opp[key] 3156 3166 atom[cx+3] = cell 3157 atomData.append(atom[: ])3167 atomData.append(atom[:cuij+9]) #not SS stuff 3158 3168 else: 3159 3169 result = G2spc.GenAtom(XYZ,SGData,False,Move=True) … … 3170 3180 atom[cx:cx+3] = Opp[key] 3171 3181 atom[cx+3] = cell 3172 atomData.append(atom[: ])3182 atomData.append(atom[:cuij+9]) #not SS stuff 3173 3183 data['Drawing']['Atoms'] = atomData 3174 3184 finally: -
trunk/GSASIIplot.py
r2060 r2062 3111 3111 ccof = [] 3112 3112 for i,spos in enumerate(Spos): 3113 if waveType in [' Sawtooth','ZigZag'] and not i:3114 T off = spos[0][0]3115 slopes = np.array(spos[0][1:])3116 if waveType == ' Sawtooth':3117 wave = G2mth.pos Sawtooth(tau,Toff,slopes)3113 if waveType in ['ZigZag','Block'] and not i: 3114 Tminmax = spos[0][:2] 3115 XYZmax = np.array(spos[0][2:]) 3116 if waveType == 'Block': 3117 wave = G2mth.posBlock(tau,Tminmax,XYZmax).T 3118 3118 elif waveType == 'ZigZag': 3119 wave = G2mth.posZigZag(tau,T off,slopes)3119 wave = G2mth.posZigZag(tau,Tminmax,XYZmax).T 3120 3120 else: 3121 3121 scof.append(spos[0][:3]) … … 4513 4513 SetPeakRoll(dirDict[key]) 4514 4514 SetMapPeaksText(mapPeaks) 4515 elif key in ['M',]and generalData['Type'] in ['modulated','magnetic']: #make a movie file 4516 G2frame.tau = 0. 4517 for i in range(10): 4518 G2frame.tau += 0.1 4519 G2frame.G2plotNB.status.SetStatusText('Modulation tau = %.2f'%(G2frame.tau),1) 4520 data['Drawing']['Atoms'],Fade = G2mth.ApplyModulation(data,G2frame.tau) #modifies drawing atom array! 4521 SetDrawAtomsText(data['Drawing']['Atoms']) 4522 G2phG.FindBondsDraw(data) #rebuild bonds & polygons 4523 if not np.any(Fade): 4524 Fade += 1 4525 Draw('key down',Fade) 4515 4526 elif key in ['+','-','=','0'] and generalData['Type'] in ['modulated','magnetic']: 4516 4527 if keyBox: … … 5352 5363 choice = [' save as/key:','jpeg','tiff','bmp','c: center on 1/2,1/2,1/2','n: next','p: previous'] 5353 5364 if generalData['Type'] in ['modulated','magnetic',] and len(drawAtoms): 5354 choice += ['+: increase tau','-: decrease tau','0: set tau = 0'] 5365 choice += ['+: increase tau','-: decrease tau','0: set tau = 0'] #add 'm: make modulation movie' 5355 5366 5356 5367 Tx,Ty,Tz = drawingData['viewPoint'][0] -
trunk/GSASIIspc.py
r2061 r2062 1493 1493 return A 1494 1494 1495 def posZigZag(tau,Toff,slopes): 1496 Tau = (tau-Toff)%1. 1497 A = np.where(Tau <= 0.5,slopes[:,np.newaxis]*Tau,slopes[:,np.newaxis]*(1.-Tau)) 1495 def posZigZag(tau,Tmm,XYZmax): 1496 DT = Tmm[1]-Tmm[0] 1497 slopeUp = 2.*XYZmax/DT 1498 slopeDn = 2.*XYZmax/(1.-DT) 1499 A = np.array([np.where(Tmm[0] < t%1. <= Tmm[1],-XYZmax+slopeUp*((t-Tmm[0])%1.),XYZmax-slopeDn*((t-Tmm[1])%1.)) for t in tau]) 1500 return A 1501 1502 def posBlock(tau,Tmm,XYZmax): 1503 A = np.array([np.where(Tmm[0] < t <= Tmm[1],XYZmax,-XYZmax) for t in tau]) 1498 1504 return A 1499 1505 … … 1549 1555 def DoXYZ(): 1550 1556 delt4 = np.ones(4)*0.001 1557 delt5 = np.ones(5)*0.001 1551 1558 delt6 = np.eye(6)*0.001 1552 1559 if 'Fourier' in waveType: … … 1558 1565 CSI = [np.array([[1,0,0],[2,0,0],[3,0,0],[4,0,0]]), 1559 1566 np.array([[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0]])] 1560 elif waveType == 'ZigZag': 1561 dX = posZigZag(tau,delt4[0],delt4[1:]) 1562 CSI = [np.array([[1,0,0],[2,0,0],[3,0,0],[4,0,0]]), 1563 np.array([[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0]])] 1567 elif waveType in ['ZigZag','Block']: 1568 if waveType == 'ZigZag': 1569 dX = posZigZag(tau,delt5[:2],delt5[2:]) 1570 else: 1571 dX = posBlock(tau,delt5[:2],delt5[2:]) 1572 CSI = [np.array([[1,0,0],[2,0,0],[3,0,0],[4,0,0],[5,0,0]]), 1573 np.array([[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0],[1.0,.0,.0]])] 1564 1574 XSC = np.ones(6,dtype='i') 1565 1575 dXTP = [] … … 1574 1584 dXT = posSawtooth(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,np.newaxis,np.newaxis] 1575 1585 elif waveType == 'ZigZag': 1576 dXT = posZigZag(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,np.newaxis,np.newaxis] 1586 dXT = posZigZag(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,np.newaxis,np.newaxis] 1587 elif waveType == 'Block': 1588 dXT = posBlock(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,np.newaxis,np.newaxis] 1577 1589 dXT = np.inner(sop[0],dXT.T) # X modulations array(3x6x49) -> array(3x49x6) 1578 1590 dXT = np.swapaxes(dXT,1,2) # back to array(3x6x49) -
trunk/GSASIIstrIO.py
r1996 r2062 1168 1168 stiw = str(i)+':'+str(iw) 1169 1169 if Stype == 'Spos': 1170 if waveType in [' Sawtooth',] and not iw:1171 names = [pfx+'T zero:'+stiw,pfx+'Xslope:'+stiw,pfx+'Yslope:'+stiw,pfx+'Zslope:'+stiw]1172 equivs = [[], [],[],[]]1170 if waveType in ['ZigZag','Block',] and not iw: 1171 names = [pfx+'Tmin:'+stiw,pfx+'Tmax:'+stiw,pfx+'Xmax:'+stiw,pfx+'Ymax:'+stiw,pfx+'Zmax:'+stiw] 1172 equivs = [[],[], [],[],[]] 1173 1173 else: 1174 1174 names = [pfx+'Xsin:'+stiw,pfx+'Ysin:'+stiw,pfx+'Zsin:'+stiw, … … 1565 1565 cx,ct,cs,cia = General['AtomPtrs'] 1566 1566 print >>pFile,'\n Modulation waves' 1567 names = {'Sfrac':['Fsin','Fcos','Fzero','Fwid'],'Spos':['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','T zero','Xslope','Yslope','Zslope'],1567 names = {'Sfrac':['Fsin','Fcos','Fzero','Fwid'],'Spos':['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','Tmin','Tmax','Xmax','Ymax','Zmax'], 1568 1568 'Sadp':['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin','U11cos','U22cos', 1569 1569 'U33cos','U12cos','U13cos','U23cos'],'Smag':['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos']} … … 1586 1586 nt = 6 1587 1587 ot = 0 1588 if waveType in [' Sawtooth',] and not iw:1589 nt = 41588 if waveType in ['ZigZag','Block',] and not iw: 1589 nt = 5 1590 1590 ot = 6 1591 1591 for j in range(nt): … … 1905 1905 stiw = str(i)+':'+str(iw) 1906 1906 if Stype == 'Spos': 1907 if waveType in [' Sawtooth',] and not iw:1908 names = ['T zero:'+stiw,'Xslope:'+stiw,'Yslope:'+stiw,'Zslope:'+stiw]1907 if waveType in ['ZigZag','Block',] and not iw: 1908 names = ['Tmin:'+stiw,'Tmax:'+stiw,'Xmax:'+stiw,'Ymax:'+stiw,'Zmax:'+stiw] 1909 1909 else: 1910 1910 names = ['Xsin:'+stiw,'Ysin:'+stiw,'Zsin:'+stiw,
Note: See TracChangeset
for help on using the changeset viewer.