Changeset 1060 for trunk/GSASIImath.py
 Timestamp:
 Sep 19, 2013 4:31:46 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r1058 r1060 402 402 for tor,seq in zip(RBObj['Torsions'],RBRes['rbSeq']): 403 403 QuatA = AVdeg2Q(tor[0],Cart[seq[0]]Cart[seq[1]]) 404 for ride in seq[3]: 405 Cart[ride] = prodQVQ(QuatA,Cart[ride]Cart[seq[1]])+Cart[seq[1]] 404 Cart[seq[3]] = prodQVQ(Quata,(Cart[seq[3]]Cart[seq[1]]).T).T+Cart[seq[1]] 405 # for ride in seq[3]: 406 # Cart[ride] = prodQVQ(QuatA,Cart[ride]Cart[seq[1]])+Cart[seq[1]] 406 407 XYZ = np.zeros_like(Cart) 407 408 for i,xyz in enumerate(Cart): … … 2564 2565 for itor,seq in enumerate(RBRes['rbSeq']): 2565 2566 QuatA = AVdeg2Q(parmDict[pfx+'Tor'+str(itor)],Cart[seq[0]]Cart[seq[1]]) 2567 # Cart[seq[3]] = prodQVQ(QuatA,Cart[seq[3]]Cart[seq[1]])+Cart[seq[1]] 2566 2568 for ride in seq[3]: 2567 2569 Cart[ride] = prodQVQ(QuatA,Cart[ride]Cart[seq[1]])+Cart[seq[1]] … … 2741 2743 nRef = len(refs) 2742 2744 pfx = str(data['pId'])+'::PWLref:' 2743 if covData['freshCOV'] and generalData['doPawley'] :2745 if covData['freshCOV'] and generalData['doPawley'] and MCSA.get('newDmin',True): 2744 2746 covMatrix = covData['covMatrix'] 2745 2747 rcov = np.zeros((nRef,nRef)) … … 2766 2768 MCSA['rcov'] = rcov 2767 2769 covData['freshCOV'] = False 2770 MCSA['newDmin'] = False 2768 2771 else: 2769 2772 rcov = MCSA['rcov'] … … 2838 2841 q=r+ai+bj+ck 2839 2842 """ 2840 VP = np.zeros(3)2841 2843 T2 = Q[0]*Q[1] 2842 2844 T3 = Q[0]*Q[2] … … 2848 2850 T9 = Q[2]*Q[3] 2849 2851 T10 = Q[3]*Q[3] 2850 VP[0] = 2.*((T8+T10)*V[0]+(T6T4)*V[1]+(T3+T7)*V[2])+V[0] 2851 VP[1] = 2.*((T4+T6)*V[0]+(T5+T10)*V[1]+(T9T2)*V[2])+V[1] 2852 VP[2] = 2.*((T7T3)*V[0]+(T2+T9)*V[1]+(T5+T8)*V[2])+V[2] 2853 return VP 2852 M = np.array([[T8+T10,T6T4,T3+T7],[T4+T6,T5+T10,T9T2],[T7T3,T2+T9,T5+T8]]) 2853 VP = 2.*np.inner(M,V) 2854 return VP+V 2854 2855 2855 2856 def Q2Mat(Q): … … 2878 2879 ''' 2879 2880 Q = np.zeros(4) 2880 d = n p.sqrt(np.sum(np.array(V)**2))2881 d = nl.norm(np.array(V)) 2881 2882 if d: 2882 2883 V /= d … … 2893 2894 ''' 2894 2895 Q = np.zeros(4) 2895 d = n p.sqrt(np.sum(np.array(V)**2))2896 d = nl.norm(np.array(V)) 2896 2897 if d: 2897 2898 V /= d … … 2920 2921 V /= np.sin(A/2.) 2921 2922 return A,V 2923 2924 def randomQ(r0,r1,r2,r3): 2925 ''' create random quaternion from 4 random numbers in range (1,1) 2926 ''' 2927 sum = 0 2928 Q = np.array(4) 2929 Q[0] = r0 2930 sum += Q[0]**2 2931 Q[1] = np.sqrt(1.sum)*r1 2932 sum += Q[1]**2 2933 Q[2] = np.sqrt(1.sum)*r2 2934 sum += Q[2]**2 2935 Q[3] = np.sqrt(1.sum)*np.where(r3<0.,1.,1.) 2936 return Q 2937 2938 def randomAVdeg(r0,r1,r2,r3): 2939 ''' create random angle (deg),vector from 4 random number in range (1,1) 2940 ''' 2941 return Q2AVdeg(randomQ(r0,r1,r2,r3)) 2922 2942 2923 2943 def makeQuat(A,B,C):
Note: See TracChangeset
for help on using the changeset viewer.