Changeset 1484
 Timestamp:
 Sep 3, 2014 10:34:01 AM (8 years ago)
 Location:
 trunk
 Files:

 19 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIpwd.py
r1474 r1484 788 788 dRdS = np.zeros(6) 789 789 for i in range(6): 790 dSij = Sij[:] 791 dSij[i] += delt 792 dRdS[i] = (ellipseSize(H,dSij,GB)lenR)/delt 790 Sij[i] = delt 791 lenM = ellipseSize(H,Sij,GB) 792 Sij[i] += 2.*delt 793 lenP = ellipseSize(H,Sij,GB) 794 Sij[i] = delt 795 dRdS[i] = (lenPlenM)/(2.*delt) 793 796 return lenR,dRdS 794 797 
trunk/GSASIIstrMath.py
r1482 r1484 1159 1159 def GetSampleSigGam(refl,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict): 1160 1160 'Needs a doc string' 1161 if 'C' in calcControls[hfx+'histType']: 1161 if 'C' in calcControls[hfx+'histType']: #All checked & OK 1162 1162 costh = cosd(refl[5]/2.) 1163 1163 #crystallite size … … 1191 1191 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1192 1192 Mgam = 0.018*refl[4]**2*tand(refl[5]/2.)*np.sqrt(Sum)/np.pi 1193 elif 'T' in calcControls[hfx+'histType']: 1193 elif 'T' in calcControls[hfx+'histType']: #All checked & OK 1194 1194 #crystallite size 1195 if calcControls[phfx+'SizeType'] == 'isotropic': 1196 Sgam = 1.e4*parmDict[hfx+'difC']* parmDict[phfx+'Size;i']1197 elif calcControls[phfx+'SizeType'] == 'uniaxial': 1195 if calcControls[phfx+'SizeType'] == 'isotropic': #OK 1196 Sgam = 1.e4*parmDict[hfx+'difC']*refl[4]**2/parmDict[phfx+'Size;i'] 1197 elif calcControls[phfx+'SizeType'] == 'uniaxial': #OK 1198 1198 H = np.array(refl[:3]) 1199 1199 P = np.array(calcControls[phfx+'SizeAxis']) 1200 1200 cosP,sinP = G2lat.CosSinAngle(H,P,G) 1201 Sgam = 1.e4*parmDict[hfx+'difC']* (parmDict[phfx+'Size;i']*parmDict[phfx+'Size;a'])1202 Sgam /= np.sqrt((sinP*parmDict[phfx+'Size;a'])**2+(cosP*parmDict[phfx+'Size;i'])**2)1203 else: #ellipsoidal crystallites 1201 Sgam = 1.e4*parmDict[hfx+'difC']*refl[4]**2/(parmDict[phfx+'Size;i']*parmDict[phfx+'Size;a']) 1202 Sgam *= np.sqrt((sinP*parmDict[phfx+'Size;a'])**2+(cosP*parmDict[phfx+'Size;i'])**2) 1203 else: #ellipsoidal crystallites #OK 1204 1204 Sij =[parmDict[phfx+'Size:%d'%(i)] for i in range(6)] 1205 1205 H = np.array(refl[:3]) 1206 1206 lenR = G2pwd.ellipseSize(H,Sij,GB) 1207 Sgam = 1.e4*parmDict[hfx+'difC']* (refl[4]**2*lenR)1207 Sgam = 1.e4*parmDict[hfx+'difC']*refl[4]**2/lenR 1208 1208 #microstrain 1209 if calcControls[phfx+'MustrainType'] == 'isotropic': 1209 if calcControls[phfx+'MustrainType'] == 'isotropic': #OK 1210 1210 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Mustrain;i'] 1211 elif calcControls[phfx+'MustrainType'] == 'uniaxial': 1211 elif calcControls[phfx+'MustrainType'] == 'uniaxial': #OK 1212 1212 H = np.array(refl[:3]) 1213 1213 P = np.array(calcControls[phfx+'MustrainAxis']) … … 1216 1216 Sa = parmDict[phfx+'Mustrain;a'] 1217 1217 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]*Si*Sa/np.sqrt((Si*cosP)**2+(Sa*sinP)**2) 1218 else: #generalized  P.W. Stephens model 1218 else: #generalized  P.W. Stephens model OK 1219 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1219 1220 Sum = 0 1220 Strms = G2spc.MustrainCoeff(refl[:3],SGData)1221 1221 for i,strm in enumerate(Strms): 1222 1222 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1223 Mgam = 1.e6*parmDict[hfx+'difC']* refl[4]**2*Sum1223 Mgam = 1.e6*parmDict[hfx+'difC']*np.sqrt(Sum)*refl[4]**3 1224 1224 1225 1225 gam = Sgam*parmDict[phfx+'Size;mx']+Mgam*parmDict[phfx+'Mustrain;mx'] … … 1232 1232 gamDict = {} 1233 1233 sigDict = {} 1234 if 'C' in calcControls[hfx+'histType']: 1234 if 'C' in calcControls[hfx+'histType']: #All checked & OK 1235 1235 costh = cosd(refl[5]/2.) 1236 1236 tanth = tand(refl[5]/2.) … … 1246 1246 Si = parmDict[phfx+'Size;i'] 1247 1247 Sa = parmDict[phfx+'Size;a'] 1248 gami = (1.8*wave/np.pi)/(Si*Sa)1248 gami = 1.8*wave/(costh*np.pi*Si*Sa) 1249 1249 sqtrm = np.sqrt((sinP*Sa)**2+(cosP*Si)**2) 1250 1250 Sgam = gami*sqtrm 1251 gam = Sgam/costh 1252 dsi = (gami*Si*cosP**2/(sqtrm*costh)gam/Si) 1253 dsa = (gami*Sa*sinP**2/(sqtrm*costh)gam/Sa) 1251 dsi = gami*Si*cosP**2/sqtrmSgam/Si 1252 dsa = gami*Sa*sinP**2/sqtrmSgam/Sa 1254 1253 gamDict[phfx+'Size;i'] = dsi*parmDict[phfx+'Size;mx'] 1255 1254 gamDict[phfx+'Size;a'] = dsa*parmDict[phfx+'Size;mx'] … … 1302 1301 gamDict[phfx+'Mustrain;mx'] = Mgam 1303 1302 sigDict[phfx+'Mustrain;mx'] = 2.*Mgam**2*(1.parmDict[phfx+'Mustrain;mx'])/ateln2 1304 else: #'T'OF 1305 if calcControls[phfx+'SizeType'] == 'isotropic': 1306 Sgam = 1.e4*parmDict[hfx+'difC']* parmDict[phfx+'Size;i']1307 gamDict[phfx+'Size;i'] = 1.e4*parmDict[hfx+'difC']*parmDict[phfx+'Size;mx']1308 sigDict[phfx+'Size;i'] = 2.e4*parmDict[hfx+'difC']*Sgam*(1.parmDict[phfx+'Size;mx'])**2/ateln21309 elif calcControls[phfx+'SizeType'] == 'uniaxial': 1310 const = 1.e4* refl[4]*parmDict[hfx+'difC']1303 else: #'T'OF  All checked & OK 1304 if calcControls[phfx+'SizeType'] == 'isotropic': #OK 1305 Sgam = 1.e4*parmDict[hfx+'difC']*refl[4]**2/parmDict[phfx+'Size;i'] 1306 gamDict[phfx+'Size;i'] = Sgam*parmDict[phfx+'Size;mx']/parmDict[phfx+'Size;i'] 1307 sigDict[phfx+'Size;i'] = 2.*Sgam**2*(1.parmDict[phfx+'Size;mx'])**2/(ateln2*parmDict[phfx+'Size;i']) 1308 elif calcControls[phfx+'SizeType'] == 'uniaxial': #OK 1309 const = 1.e4*parmDict[hfx+'difC']*refl[4]**2 1311 1310 H = np.array(refl[:3]) 1312 1311 P = np.array(calcControls[phfx+'SizeAxis']) … … 1314 1313 Si = parmDict[phfx+'Size;i'] 1315 1314 Sa = parmDict[phfx+'Size;a'] 1316 gami = const *(Si*Sa)1315 gami = const/(Si*Sa) 1317 1316 sqtrm = np.sqrt((sinP*Sa)**2+(cosP*Si)**2) 1318 Sgam = gami /sqtrm1319 dsi = gami*Si*cosP**2/sqtrm**31320 dsa = gami*Sa*sinP**2/sqtrm**31321 gamDict[phfx+'Size;i'] = const*parmDict[phfx+'Size;mx']*Sa/8.1322 gamDict[phfx+'Size;a'] = const*parmDict[phfx+'Size;mx']*Si/8.1317 Sgam = gami*sqtrm 1318 dsi = gami*Si*cosP**2/sqtrmSgam/Si 1319 dsa = gami*Sa*sinP**2/sqtrmSgam/Sa 1320 gamDict[phfx+'Size;i'] = dsi*parmDict[phfx+'Size;mx'] 1321 gamDict[phfx+'Size;a'] = dsa*parmDict[phfx+'Size;mx'] 1323 1322 sigDict[phfx+'Size;i'] = 2.*dsi*Sgam*(1.parmDict[phfx+'Size;mx'])**2/ateln2 1324 1323 sigDict[phfx+'Size;a'] = 2.*dsa*Sgam*(1.parmDict[phfx+'Size;mx'])**2/ateln2 1325 else: # ellipsoidal crystallites1326 const = 1.e4*parmDict[hfx+'difC'] 1324 else: #OK ellipsoidal crystallites 1325 const = 1.e4*parmDict[hfx+'difC']*refl[4]**2 1327 1326 Sij =[parmDict[phfx+'Size:%d'%(i)] for i in range(6)] 1328 1327 H = np.array(refl[:3]) … … 1332 1331 gamDict[item] = (const/lenR**2)*dRdS[i]*parmDict[phfx+'Size;mx'] 1333 1332 sigDict[item] = 2.*Sgam*(const/lenR**2)*dRdS[i]*(1.parmDict[phfx+'Size;mx'])**2/ateln2 1334 gamDict[phfx+'Size;mx'] = Sgam 1335 sigDict[phfx+'Size;mx'] = 2.*Sgam**2*(1.parmDict[phfx+'Size;mx'])/ateln2 1333 gamDict[phfx+'Size;mx'] = Sgam #OK 1334 sigDict[phfx+'Size;mx'] = 2.*Sgam**2*(1.parmDict[phfx+'Size;mx'])/ateln2 #OK 1336 1335 1337 1336 #microstrain derivatives 1338 1337 if calcControls[phfx+'MustrainType'] == 'isotropic': 1339 1338 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Mustrain;i'] 1340 gamDict[phfx+'Mustrain;i'] = 1.e6*refl[4]*parmDict[hfx+'difC']*parmDict[phfx+'Mustrain;mx'] 1341 sigDict[phfx+'Mustrain;i'] = 2. e6*refl[4]*parmDict[hfx+'difC']*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln21339 gamDict[phfx+'Mustrain;i'] = 1.e6*refl[4]*parmDict[hfx+'difC']*parmDict[phfx+'Mustrain;mx'] #OK 1340 sigDict[phfx+'Mustrain;i'] = 2.*Mgam**2*(1.parmDict[phfx+'Mustrain;mx'])**2/(ateln2*parmDict[phfx+'Mustrain;i']) 1342 1341 elif calcControls[phfx+'MustrainType'] == 'uniaxial': 1343 1342 H = np.array(refl[:3]) … … 1346 1345 Si = parmDict[phfx+'Mustrain;i'] 1347 1346 Sa = parmDict[phfx+'Mustrain;a'] 1348 gami = 1.e6*parmDict[hfx+'difC']* Si*Sa1347 gami = 1.e6*parmDict[hfx+'difC']*refl[4]*Si*Sa 1349 1348 sqtrm = np.sqrt((Si*cosP)**2+(Sa*sinP)**2) 1350 1349 Mgam = gami/sqtrm 1351 1350 dsi = gami*Si*cosP**2/sqtrm**3 1352 1351 dsa = gami*Sa*sinP**2/sqtrm**3 1353 gamDict[phfx+'Mustrain;i'] = (Mgam/Si+dsi)*parmDict[phfx+'Mustrain;mx'] *refl[4]1354 gamDict[phfx+'Mustrain;a'] = (Mgam/Sa+dsa)*parmDict[phfx+'Mustrain;mx'] *refl[4]1355 sigDict[phfx+'Mustrain;i'] = 2* refl[4]*(Mgam/Si+dsi)*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln21356 sigDict[phfx+'Mustrain;a'] = 2* refl[4]*(Mgam/Sa+dsa)*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln21357 else: #generalized  P.W. Stephens model 1352 gamDict[phfx+'Mustrain;i'] = (Mgam/Si+dsi)*parmDict[phfx+'Mustrain;mx'] 1353 gamDict[phfx+'Mustrain;a'] = (Mgam/Sa+dsa)*parmDict[phfx+'Mustrain;mx'] 1354 sigDict[phfx+'Mustrain;i'] = 2*(Mgam/Si+dsi)*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1355 sigDict[phfx+'Mustrain;a'] = 2*(Mgam/Sa+dsa)*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1356 else: #generalized  P.W. Stephens model OK 1358 1357 pwrs = calcControls[phfx+'MuPwrs'] 1359 1358 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1360 const = 1.e6*parmDict[hfx+'difC']*refl[4]** 21361 sum = 01359 const = 1.e6*parmDict[hfx+'difC']*refl[4]**3 1360 Sum = 0 1362 1361 for i,strm in enumerate(Strms): 1363 sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1364 gamDict[phfx+'Mustrain:'+str(i)] = const*strm*parmDict[phfx+'Mustrain;mx'] 1365 sigDict[phfx+'Mustrain:'+str(i)] = \ 1366 2.*const*term*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1367 Mgam = const*sum 1362 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1363 gamDict[phfx+'Mustrain:'+str(i)] = strm*parmDict[phfx+'Mustrain;mx']/2. 1364 sigDict[phfx+'Mustrain:'+str(i)] = strm*(1.parmDict[phfx+'Mustrain;mx'])**2 1365 Mgam = const*np.sqrt(Sum) 1368 1366 for i in range(len(Strms)): 1369 sigDict[phfx+'Mustrain:'+str(i)] *= Mgam 1367 gamDict[phfx+'Mustrain:'+str(i)] *= Mgam/Sum 1368 sigDict[phfx+'Mustrain:'+str(i)] *= const**2/ateln2 1370 1369 gamDict[phfx+'Mustrain;mx'] = Mgam 1371 1370 sigDict[phfx+'Mustrain;mx'] = 2.*Mgam**2*(1.parmDict[phfx+'Mustrain;mx'])/ateln2 … … 1590 1589 Ssig,Sgam = GetSampleSigGam(refl,0.0,G,GB,SGData,hfx,phfx,calcControls,parmDict) 1591 1590 sig += Ssig 1592 sig = max(0.001,sig)1593 1591 gam += Sgam 1594 gam = max(0.001,gam)1595 1592 return sig,gam 1596 1593 
trunk/fsource/powsubs/epsvoigt.for
r829 r1484 49 49 !CODE: 50 50 51 SQSGT = MAX(SQRT(SIG),0.0 1)52 GAM = MAX(GAM,0. 1)51 SQSGT = MAX(SQRT(SIG),0.00001) 52 GAM = MAX(GAM,0.00001) 53 53 FWHG = STOFW*SQSGT 54 54 PGL = FWHG**5
Note: See TracChangeset
for help on using the changeset viewer.