Changeset 1973
- Timestamp:
- Sep 17, 2015 10:59:11 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r1970 r1973 924 924 ################################################################################ 925 925 926 def Modulation(waveTypes,SSUniq,S SPhi,FSSdata,XSSdata,USSdata,SStauM,Mast):926 def Modulation(waveTypes,SSUniq,SGT,FSSdata,XSSdata,USSdata,SStauM,Mast): 927 927 import pypowder as pwd 928 928 929 929 nxs = np.newaxis 930 glTau,glWt = pwd.pygauleg(0.,1.,32) 931 932 def expModInt(H,A,B): 933 tau = np.arange(1.,A.shape[1]+1)[:,nxs]*glTau #waves x 32 934 XmodA = np.swapaxes(A,1,2)[:,:,nxs]*np.sin(twopi*tau.T) #atoms X pos X 32 X waves 935 XmodB = np.swapaxes(B,1,2)[:,:,nxs]*np.cos(twopi*tau.T) 936 Xmod = np.sum(XmodA+XmodB,axis=-1) #atoms X pos X 32; sum waves 937 #Xmod is ParSup in J2K - values match after Calcm2 with klic=-1 938 D = H[:,3][:,nxs]*tau[0,nxs] 939 HdotX = np.inner(np.swapaxes(Xmod,1,2),H[:,:3])+D.T #atoms X 32 X ops 940 sinHA = np.sum(np.sin(twopi*HdotX)*glWt[nxs,:,nxs],axis=1) 930 glTau,glWt = pwd.pygauleg(0.,1.,32) #get Gauss-Legendre intervals & weights 931 932 def expModInt(H,Af,Bf,Ax,Bx,Au,Bu,S): 933 ''' 934 H: array ops X hklt 935 Ax: array atoms X waves X xyz 936 Bx: array atoms X waves X xyz 937 S: array ops 938 ''' 939 nx = 1 940 if 'Fourier' in waveTypes: 941 nx = 0 942 XmodZ = 0 943 else: 944 nx = 1 945 if 'Sawtooth' in wavwTypes: 946 XmodZ = 0 947 else: 948 XmodZ = 0 949 tau = np.arange(1.,Ax.shape[1]+1-nx)[:,nxs]*glTau #waves x 32 950 XmodA = Ax[:,nx:,:,nxs]*np.sin(twopi*tau[nxs,:,nxs,:]) #atoms X waves X pos X 32 951 XmodB = Bx[:,nx:,:,nxs]*np.cos(twopi*tau[nxs,:,nxs,:]) #atoms X waves X pos X 32 952 Xmod = np.sum(XmodA+XmodB+XmodZ,axis=1) #atoms X pos X 32; sum waves 953 D = H[:,3][:,nxs]*(glTau[nxs,:]+S[:,nxs]) #m*tau; ops X 32 954 HdotX = np.inner(np.swapaxes(Xmod,1,2),H[0,:3])[:,:,nxs]+D.T[nxs,:,:] #atoms X 32 X ops 955 sinHA = np.sum(np.sin(twopi*HdotX)*glWt[nxs,:,nxs],axis=1) #atoms X ops 941 956 cosHA = np.sum(np.cos(twopi*HdotX)*glWt[nxs,:,nxs],axis=1) 957 # GSASIIpath.IPyBreak() 942 958 943 # GSASIIpath.IPyBreak() 944 return cosHA.T,sinHA.T 959 return cosHA.T,sinHA.T #ops X atoms 945 960 946 961 Smult,TauT = SStauM # both atoms x SGops 947 m = SSUniq.T[3]948 962 Ax = np.array(XSSdata[:3]).T #atoms x waves x sin pos mods 949 963 Bx = np.array(XSSdata[3:]).T #...cos pos mods 950 964 Af = np.array(FSSdata[0]).T #sin frac mods x waves x atoms 951 965 Bf = np.array(FSSdata[1]).T #cos frac mods... 952 Ab = Mast*np.array(G2lat.U6toUij(USSdata[:6])).T #atoms x waves x sin Uij mods 953 Bb = Mast*np.array(G2lat.U6toUij(USSdata[6:])).T #...cos Uij mods 954 if Ax.ndim > 2: 955 GpA = np.array(expModInt(SSUniq,Ax,Bx)) 956 else: 957 GpA = np.array(expModInt(SSUniq,Ax[:,np.newaxis,:],Bx[:,np.newaxis,:])) 966 Au = Mast*np.array(G2lat.U6toUij(USSdata[:6])).T #atoms x waves x sin Uij mods 967 Bu = Mast*np.array(G2lat.U6toUij(USSdata[6:])).T #...cos Uij mods 968 GpA = np.array(expModInt(SSUniq,Af,Bf,Ax,Bx,Au,Bu,SGT)) 958 969 return GpA # SGops x atoms 959 970 -
trunk/GSASIIplot.py
r1969 r1973 1430 1430 elif (G2frame.PatternTree.GetItemText(PickId) == 'Reflection Lists' or \ 1431 1431 'PWDR' in G2frame.PatternTree.GetItemText(PickId)) and xpos: 1432 Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists')) 1433 pick = str(G2frame.itemPicked).split('(')[1].strip(')') 1434 if 'line' not in pick: #avoid data points, etc. 1435 data = G2frame.PatternTree.GetItemPyData(PatternId) 1436 num = Phases.keys().index(pick) 1437 if num: 1438 data[0]['refDelt'] = -(event.ydata-Pattern[0]['refOffset'])/(num*Ymax) 1439 else: #1st row of refl ticks 1440 data[0]['refOffset'] = event.ydata 1432 Id = G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists') 1433 # GSASIIpath.IPyBreak() 1434 if Id: 1435 Phases = G2frame.PatternTree.GetItemPyData(Id) 1436 pick = str(G2frame.itemPicked).split('(')[1].strip(')') 1437 if 'line' not in pick: #avoid data points, etc. 1438 data = G2frame.PatternTree.GetItemPyData(PatternId) 1439 num = Phases.keys().index(pick) 1440 if num: 1441 data[0]['refDelt'] = -(event.ydata-Pattern[0]['refOffset'])/(num*Ymax) 1442 else: #1st row of refl ticks 1443 data[0]['refOffset'] = event.ydata 1441 1444 PlotPatterns(G2frame,plotType=plottype) 1442 1445 G2frame.itemPicked = None -
trunk/GSASIIstrMath.py
r1970 r1973 629 629 if parm in parmDict: 630 630 keys[key][m][iatm] = parmDict[parm] 631 return waveTypes,FSSdata .squeeze(),XSSdata.squeeze(),USSdata.squeeze(),MSSdata.squeeze()631 return waveTypes,FSSdata,XSSdata,USSdata,MSSdata 632 632 633 633 def GetSSTauM(SGOps,SSOps,pfx,calcControls,XData): … … 983 983 waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict) 984 984 SStauM = list(GetSSTauM(SGData['SGOps'],SSGData['SSGOps'],pfx,calcControls,Xdata)) 985 SST = SSGT[:,3] 985 986 if SGData['SGInv']: 986 987 SStauM[0] = np.hstack((SStauM[0],SStauM[0])) 987 988 SStauM[1] = np.hstack((SStauM[1],SStauM[1])) 989 SST = np.hstack((SST,-SST)) 988 990 modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']]) 989 991 FF = np.zeros(len(Tdata)) … … 1033 1035 Phi = np.hstack((Phi,-Phi)) 1034 1036 SSPhi = np.hstack((SSPhi,-SSPhi)) 1035 GfpuA = G2mth.Modulation(waveTypes,SSUniq,SSPhi,FSSdata,XSSdata,USSdata,SStauM,Mast) 1037 # GSASIIpath.IPyBreak() 1038 GfpuA = G2mth.Modulation(waveTypes,SSUniq,SST,FSSdata,XSSdata,USSdata,SStauM,Mast) 1036 1039 phase = twopi*(np.inner(Uniq,(dXdata.T+Xdata.T))+Phi[:,np.newaxis]) 1037 1040 sinp = np.sin(phase) … … 1044 1047 fa = np.array([(FF+FP-Bab)*cosp*Tcorr,-FPP*sinp*Tcorr]) #2 x sym x atoms 1045 1048 fb = np.array([(FF+FP-Bab)*sinp*Tcorr,FPP*cosp*Tcorr]) 1046 # GSASIIpath.IPyBreak()1047 1049 fa *= GfpuA 1048 1050 fb *= GfpuA
Note: See TracChangeset
for help on using the changeset viewer.