Changeset 1136
- Timestamp:
- Nov 6, 2013 1:03:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIstrMath.py ¶
r1134 r1136 636 636 Uij = np.array(G2lat.U6toUij(Uijdata)) 637 637 bij = Mast*Uij.T 638 blkSize = 100 #no. of reflections in a block 639 nRef = refDict['RefList'].shape[0] 638 640 if not len(refDict['FF']): #no form factors - 1st time thru StructureFactor 639 641 if 'N' in calcControls[hfx+'histType']: … … 645 647 refDict['FF']['El'] = dat.keys() 646 648 refDict['FF']['FF'] = np.ones((len(refDict['RefList']),len(dat))) 647 refDict['ifNew'] = True 649 for iref,ref in enumerate(refDict['RefList']): 650 SQ = 1./(2.*ref[4])**2 651 dat = G2el.getFFvalues(FFtables,SQ) 652 refDict['FF']['FF'][iref] *= dat.values() 648 653 #reflection processing begins here - big arrays! 649 try: 650 refl = refDict['RefList'] 654 iBeg = 0 655 while iBeg < nRef: 656 iFin = min(iBeg+blkSize,nRef) 657 refl = refDict['RefList'][iBeg:iFin] 651 658 H = refl.T[:3] 652 659 SQ = 1./(2.*refl.T[4])**2 653 660 SQfactor = 4.0*SQ*twopisq 654 661 Bab = np.repeat(parmDict[phfx+'BabA']*np.exp(-parmDict[phfx+'BabU']*SQfactor),len(SGT)) 655 if refDict['ifNew']: #no form factors - 1st time thru StructureFactor656 for iref in range(len(refl)):657 if 'X' in calcControls[hfx+'histType']:658 dat = G2el.getFFvalues(FFtables,SQ[iref])659 refDict['FF']['FF'][iref] *= dat.values()660 refDict['ifNew'] = False661 662 Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata]) 662 FF = np.repeat(refDict['FF']['FF'] .T[Tindx].T,len(SGT),axis=0)663 FF = np.repeat(refDict['FF']['FF'][iBeg:iFin].T[Tindx].T,len(SGT),axis=0) 663 664 Uniq = np.reshape(np.inner(H.T,SGMT),(-1,3)) 664 665 Phi = np.inner(H.T,SGT).flatten() … … 681 682 fasq = fas**2 682 683 fbsq = fbs**2 #imaginary 683 except MemoryError: 684 print '**** ERROR - insufficient memory for this size problem; try 64-bit version of GSAS-II****' 685 return 686 refl.T[9] = np.sum(fasq,axis=0)+np.sum(fbsq,axis=0) 687 refl.T[10] = atan2d(fbs[0],fas[0]) 684 refl.T[9] = np.sum(fasq,axis=0)+np.sum(fbsq,axis=0) 685 refl.T[10] = atan2d(fbs[0],fas[0]) 686 iBeg += blkSize 688 687 689 688 def StructureFactorDerv(refDict,G,hfx,pfx,SGData,calcControls,parmDict): … … 1893 1892 depDerivDict[j] = np.zeros(shape=(len(refDict['RefList']))) 1894 1893 wdf = np.zeros(len(refDict['RefList'])) 1894 time0 = time.time() 1895 1895 if calcControls['F**2']: 1896 1896 for iref,ref in enumerate(refDict['RefList']): … … 1951 1951 # now process derivatives in constraints 1952 1952 G2mv.Dict2Deriv(varylist,depDerivDict,dMdvh) 1953 print 'matrix build time: %.3f'%(time.time()-time0) 1953 1954 1954 1955 if dlg:
Note: See TracChangeset
for help on using the changeset viewer.