Changeset 1480
- Timestamp:
- Aug 27, 2014 12:59:17 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r1478 r1480 400 400 UseList[item]['Mustrain'][1][1] = 1000.0 401 401 elif name == 'generalized': 402 muiso = 1000. 403 cell = generalData['Cell'][1:7] 404 vals = G2spc.Muiso2Shkl(muiso,SGData,cell) 402 405 nTerm = len(UseList[item]['Mustrain'][4]) 403 406 for i in range(nTerm): 404 UseList[item]['Mustrain'][4][i] = 0.01407 UseList[item]['Mustrain'][4][i] = vals[i] 405 408 G2plt.PlotSizeStrainPO(G2frame,data) 406 409 wx.CallAfter(UpdateDData,G2frame,DData,data) -
trunk/GSASIIplot.py
r1475 r1480 2406 2406 uvw = np.inner(A.T,xyz) 2407 2407 Strm = np.array(G2spc.MustrainCoeff(uvw,SGData)) 2408 sum = np.sum(np.multiply(Shkl,Strm))2409 sum = np.where(sum > 0.01,sum,0.01)2410 sum = np.sqrt(sum)*math.pi/.18 #centidegrees to radians!2411 return sum*xyz2408 Sum = np.sum(np.multiply(Shkl,Strm)) 2409 Sum = np.where(Sum > 0.01,Sum,0.01) 2410 Sum = np.sqrt(Sum) 2411 return Sum*xyz 2412 2412 2413 2413 Shkl = np.array(coeff[4]) -
trunk/GSASIIspc.py
r1471 r1480 18 18 import numpy.ma as ma 19 19 import numpy.linalg as nl 20 import scipy.optimize as so 20 21 import math 21 22 import sys … … 25 26 GSASIIpath.SetVersionNumber("$Revision$") 26 27 import pyspg 28 29 npsind = lambda x: np.sin(x*np.pi/180.) 30 npcosd = lambda x: np.cos(x*np.pi/180.) 27 31 28 32 def SpcGroup(SGSymbol): … … 731 735 732 736 def Muiso2Shkl(muiso,SGData,cell): 733 "this is to convert isotropic mustrain to generalized Shkls - doesn't work just now"737 "this is to convert isotropic mustrain to generalized Shkls" 734 738 import GSASIIlattice as G2lat 735 from scipy.optimize import fmin736 739 A = G2lat.cell2AB(cell)[0] 737 def minMus(Shkl,H,muiso,SGData,A): 740 741 def minMus(Shkl,muiso,H,SGData,A): 738 742 U = np.inner(A.T,H) 739 S = np.array(MustrainCoeff(H.T,SGData)) 740 sum = np.sqrt(np.sum(np.multiply(S,Shkl))) 741 return abs(muiso-sum*H) 743 S = np.array(MustrainCoeff(U,SGData)) 744 Sum = np.sqrt(np.sum(np.multiply(S,Shkl[:,np.newaxis]),axis=0)) 745 rad = np.sqrt(np.sum((Sum[:,np.newaxis]*H)**2,axis=1)) 746 return (muiso-rad)**2 747 742 748 laue = SGData['SGLaue'] 749 PHI = np.linspace(0.,360.,60,True) 750 PSI = np.linspace(0.,180.,60,True) 751 X = np.outer(npsind(PHI),npsind(PSI)) 752 Y = np.outer(npcosd(PHI),npsind(PSI)) 753 Z = np.outer(np.ones(np.size(PHI)),npcosd(PSI)) 754 HKL = np.dstack((X,Y,Z)) 743 755 if laue in ['m3','m3m']: 744 H = [[1,0,0],[1,1,0]] 745 S0 = [0.01,0.01] 756 S0 = [1000.,1000.] 746 757 elif laue in ['6/m','6/mmm','3m1']: 747 H = [[1,0,0],[0,0,1],[1,0,1]] 748 S0 = [0.01,0.01,0.01] 758 S0 = [1000.,1000.,1000.] 749 759 elif laue in ['31m','3']: 750 H = [[1,0,0],[0,0,1],[1,0,1],[1,1,1]] 751 S0 = [0.01,0.01,0.01,0.01] 760 S0 = [1000.,1000.,1000.,1000.] 752 761 elif laue in ['3R','3mR']: 753 H = [[1,0,0],[1,1,0],[1,0,1],[1,1,1]] 754 S0 = [0.01,0.01,0.01,0.01] 762 S0 = [1000.,1000.,1000.,1000.] 755 763 elif laue in ['4/m','4/mmm']: 756 H = [[1,0,0],[0,0,1],[1,1,0],[1,0,1]] 757 S0 = [0.01,0.01,0.01,0.01] 764 S0 = [1000.,1000.,1000.,1000.] 758 765 elif laue in ['mmm']: 759 H = [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,0,1],[0,1,1]] 760 S0 = [0.01,0.01,0.01,0.01,0.01,0.01] 766 S0 = [1000.,1000.,1000.,1000.,1000.,1000.] 761 767 elif laue in ['2/m']: 762 H = [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,0,1],[0,1,1]] 763 if uniq == 'a': 764 H.append([0,1,-1]) 765 H.append([0,-2,1]) 766 elif uniq == 'b': 767 H.append([1,0,-1]) 768 H.append([-2,0,1]) 769 elif uniq == 'c': 770 H.append([1,-1,0]) 771 H.append([-2,1,0]) 772 H.append([1,1,1]) 773 S0 = [9*[0.01,]] 768 S0 = [1000.,1000.,1000.,0.,0.,0.,0.,0.,0.] 774 769 else: 775 H = [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,0,1],[0,1,1], 776 [-1,1,0],[1,0,-1],[0,-1,1],[1,-2,0],[-2,0,1],[0,1,-2], 777 [1,-1,1],[-1, 1, 1],[1,-1,1]] 778 S0 = [15*[0.01,]] 779 H = np.array(H) 770 S0 = [1000.,1000.,1000.,1000.,1000., 1000.,1000.,1000.,1000.,1000., 771 1000.,1000.,0.,0.,0.] 780 772 S0 = np.array(S0) 781 return fmin(minMus,S0,(H,muiso,SGData,A)) 773 HKL = np.reshape(HKL,(-1,3)) 774 result = so.leastsq(minMus,S0,(np.ones(HKL.shape[0])*muiso,HKL,SGData,A)) 775 return result[0] 782 776 783 777 def SytSym(XYZ,SGData): -
trunk/GSASIIstrMath.py
r1479 r1480 1190 1190 for i,strm in enumerate(Strms): 1191 1191 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1192 Mgam = refl[4]**2*tand(refl[5]/2.)*np.sqrt(Sum)1192 Mgam = 0.018*refl[4]**2*tand(refl[5]/2.)*np.sqrt(Sum)/np.pi 1193 1193 elif 'T' in calcControls[hfx+'histType']: 1194 1194 #crystallite size … … 1289 1289 sigDict[phfx+'Mustrain;a'] = 2*(Mgam/Sa+dsa)*Mgam*(1.-parmDict[phfx+'Mustrain;mx'])**2/ateln2 1290 1290 else: #generalized - P.W. Stephens model 1291 const = refl[4]**2*tanth1291 const = 0.018*refl[4]**2*tanth/np.pi 1292 1292 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1293 1293 Sum = 0
Note: See TracChangeset
for help on using the changeset viewer.