Changeset 2493
- Timestamp:
- Oct 17, 2016 10:30:33 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r2431 r2493 151 151 scaleVal.Bind(wx.EVT_KILL_FOCUS,OnScaleVal) 152 152 scaleSizer.Add(scaleVal,0,WACV) 153 if 'PWDR' in G2frame.hist and generalData['Type'] != 'magnetic': 154 wtSum = G2pwd.PhaseWtSum(G2frame,G2frame.hist) 155 weightFr = UseList[G2frame.hist]['Scale'][0]*generalData['Mass']/wtSum 156 scaleSizer.Add(wx.StaticText(DData,label=' Wt. fraction: %.3f'%(weightFr)),0,WACV) 153 157 return scaleSizer 154 158 -
trunk/GSASIIpwd.py
r2481 r2493 62 62 npT2q = lambda tth,wave: 2.0*np.pi*npT2stl(tth,wave) #=2pi*d* 63 63 ateln2 = 8.0*math.log(2.0) 64 64 65 ################################################################################ 66 #### Powder utilities 67 ################################################################################ 68 69 def PhaseWtSum(G2frame,histo): 70 ''' 71 Calculate sum of phase mass*shase fraction for PWDR data (exclude magnetic phases) 72 73 :param G2frame: GSASII main frame structure 74 :param str histo: histogram name 75 :returns sum(scale*mass) for phases in histo 76 ''' 77 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() 78 wtSum = 0.0 79 for phase in Phases: 80 if Phases[phase]['General']['Type'] != 'magnetic': 81 if histo in Phases[phase]['Histograms']: 82 mass = Phases[phase]['General']['Mass'] 83 phFr = Phases[phase]['Histograms'][histo]['Scale'][0] 84 wtSum += mass*phFr 85 return wtSum 86 87 ################################################################################ 65 88 #GSASII pdf calculation routines 89 ################################################################################ 66 90 67 91 def Transmission(Geometry,Abs,Diam): -
trunk/GSASIIstrMath.py
r2492 r2493 774 774 else: 775 775 mphase = phase 776 # mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']]) 777 mphase = np.array([mphase for cen in SGData['SGCen']]) 776 mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']]) 778 777 mphase = np.concatenate(mphase,axis=1) #Nref,full Nop,Natm 779 778 sinm = np.sin(mphase) #ditto - match magstrfc.for … … 1050 1049 SGT = np.array([ops[1] for ops in SGData['SGOps']]) 1051 1050 Ncen = len(SGData['SGCen']) 1051 Nops = len(SGMT) 1052 1052 FFtables = calcControls['FFtables'] 1053 1053 BLtables = calcControls['BLtables'] … … 1065 1065 if SGData['SGInv']: 1066 1066 Gdata = np.hstack((Gdata,-Gdata)) #inversion if any 1067 Gdata = np. repeat(Gdata,Ncen,axis=1) #dup over cell centering1067 Gdata = np.hstack([Gdata for icen in range(Ncen)]) #dup over cell centering 1068 1068 Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata #flip vectors according to spin flip 1069 1069 Gdata = np.inner(Amat,Gdata.T) #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen … … 1085 1085 dFdfr = np.zeros((nRef,mSize)) 1086 1086 dFdx = np.zeros((nRef,mSize,3)) 1087 dFdmx = np.zeros((nRef,mSize,3)) 1087 1088 dFdui = np.zeros((nRef,mSize)) 1088 1089 dFdua = np.zeros((nRef,mSize,6)) … … 1135 1136 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 1136 1137 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1137 TMcorr = 0.5 *0.539*Tcorr[:,0,:]*MF*len(SGMT)/Mdata#Nref,Natm1138 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(2*Nops*Ncen) #Nref,Natm #Nref,Natm 1138 1139 if SGData['SGInv']: 1139 1140 mphase = np.hstack((phase,-phase)) 1141 TMcorr = TMcorr/2. 1140 1142 else: 1141 1143 mphase = phase 1142 1144 mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']]) 1143 # GSASIIpath.IPyBreak()1144 1145 mphase = np.concatenate(mphase,axis=1) #Nref,Nop,Natm 1145 1146 sinm = np.sin(mphase) #ditto - match magstrfc.for … … 1148 1149 HM = HM/np.sqrt(np.sum(HM**2,axis=0)) #Gdata = MAGS & HM = UVEC in magstrfc.for both OK 1149 1150 eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0) 1150 Q = -HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]+Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK1151 fam = Q*TMcorr[nxs,:,nxs,:]* SGData['MagMom'][nxs,nxs,:,nxs]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:] #ditto1152 fbm = Q*TMcorr[nxs,:,nxs,:]* SGData['MagMom'][nxs,nxs,:,nxs]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:] #ditto1151 Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK 1152 fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:] #ditto 1153 fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:] #ditto 1153 1154 fams = np.sum(np.sum(fam,axis=-1),axis=-1) #xyz,Nref 1154 1155 fbms = np.sum(np.sum(fbm,axis=-1),axis=-1) #ditto 1155 1156 Hij = np.hstack((Hij,Hij)) 1157 # GSASIIpath.IPyBreak() 1156 1158 if 'T' in calcControls[hfx+'histType']: 1157 1159 fa = np.array([fot*cosp,-np.reshape(Flack*FPP,sinp.shape)*sinp*Tcorr]) … … 1166 1168 #sum below is over Uniq 1167 1169 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 1168 dfadfr = np.sum(fam /occ,axis=-2) #array(refBlk,nAtom) Fdata != 0 avoids /0. problem1170 dfadfr = np.sum(fams/occ,axis=-2) #array(refBlk,nAtom) Fdata != 0 avoids /0. problem 1169 1171 dfadba = np.sum(-cosm*TMcorr[:,nxs,:],axis=-2) #array(refBlk,nAtom) 1170 1172 dfadx = np.sum(twopi*Uniq[:,nxs,:,:]*np.swapaxes(fax[0],-2,-1)[:,:,:,nxs],axis=-2) 1171 dfadui = np.sum(-SQfactor[:,nxs,nxs]*fam ,axis=-2) #array(Ops,refBlk,nAtoms)1172 dfadua = np.sum(-Hij[nxs,:,:,nxs,:]*fam [:,:,:,:,nxs],axis=-3)1173 dfadui = np.sum(-SQfactor[:,nxs,nxs]*fams,axis=-2) #array(Ops,refBlk,nAtoms) 1174 dfadua = np.sum(-Hij[nxs,:,:,nxs,:]*fams[:,:,:,:,nxs],axis=-3) 1173 1175 else: 1174 1176 dfadfr = np.sum(fa/occ,axis=-2) #array(2,refBlk,nAtom) Fdata != 0 avoids /0. problem
Note: See TracChangeset
for help on using the changeset viewer.