Changeset 517
- Timestamp:
- Mar 9, 2012 3:10:26 PM (12 years ago)
- Location:
- MPbranch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
MPbranch/GSASIIlattice.py
r432 r517 1019 1019 1020 1020 def Glnh(Start,SHCoef,psi,gam,SamSym): 1021 # Start is not used 1021 1022 import pytexture as ptx 1022 1023 RSQPI = 0.5641895835478 1023 1024 SQ2 = 1.414213562373 1024 1025 if Start: 1026 ptx.pyqlmninit() 1027 Start = False 1025 InitTexture() 1028 1026 Fln = np.zeros(len(SHCoef)) 1029 1027 for i,term in enumerate(SHCoef): … … 1042 1040 1043 1041 def Flnh(Start,SHCoef,phi,beta,SGData): 1042 # Start is not used 1044 1043 import pytexture as ptx 1045 1044 … … 1047 1046 RSQPI = 0.5641895835478 1048 1047 SQ2 = 1.414213562373 1049 1050 if Start: 1051 ptx.pyqlmninit() 1052 Start = False 1048 InitTexture() 1053 1049 Fln = np.zeros(len(SHCoef)) 1054 1050 for i,term in enumerate(SHCoef): … … 1447 1443 if H not in hklN: 1448 1444 print H,' missing from hkl from GSASII' 1449 1450 1451 1445 1446 TextureInit = False 1447 def InitTexture(): 1448 '''A routine to initialize the texture routines only once''' 1449 global TextureInit 1450 if not TextureInit: 1451 import pytexture as ptx 1452 ptx.pyqlmninit() 1453 TextureInit = True 1452 1454 1453 1455 if __name__ == '__main__': -
MPbranch/GSASIIpath.py
r280 r517 1 # determine a binary path for the pyd files based on the host OS and the python version, 2 # path is relative to location of the script that is called as well as this file 3 # this must be imported before anything that imports any .pyd/.so file for GSASII 1 ''' determine a binary path for the pyd files based on the host OS and the python version, 2 path is relative to location of the script that is called as well as this file 3 this must be imported before anything that imports any .pyd/.so file for GSASII 4 5 also determine if GSAS-II is being run interactively''' 6 4 7 import os.path as ospath 5 8 import sys 6 9 import platform 10 11 # Find the name of the main routine and if we are running interactively (true if GSASII.py) 12 import __main__ 13 GSAS2interactive = False 14 try: 15 if ospath.split(__main__.__file__)[1].lower() == "gsasii.py": 16 GSAS2interactive = True 17 except: 18 pass 19 20 # define the path to where GSAS-II source files are found from the location of 21 # the current file 22 path2GSAS2 = ospath.dirname(ospath.realpath(__file__)) 23 7 24 bindir = None 8 25 if sys.platform == "win32": … … 18 35 else: 19 36 bindir = 'binlinux%d.%d' % sys.version_info[0:2] 20 for loc in sys.path[0], ospath.split(__file__)[0]:37 for loc in sys.path[0],path2GSAS2: 21 38 if bindir: 22 39 if ospath.exists(ospath.join(loc,bindir)) and ospath.join(loc,bindir) not in sys.path: -
MPbranch/GSASIIplot.py
r496 r517 1157 1157 '''Plot 3D mustrain/size/preferred orientation figure. In this instance data is for a phase 1158 1158 ''' 1159 # Start is not used -- fix later 1159 1160 1160 1161 PatternId = G2frame.PatternId … … 1162 1163 SGData = generalData['SGData'] 1163 1164 SGLaue = SGData['SGLaue'] 1164 if Start: #initialize the spherical harmonics qlmn arrays 1165 ptx.pyqlmninit() 1166 Start = False 1165 G2lat.InitTexture() 1167 1166 MuStrKeys = G2spc.MustrainNames(SGData) 1168 1167 cell = generalData['Cell'][1:] -
MPbranch/GSASIIstruct.py
r514 r517 41 41 ''' 42 42 Controls = {'deriv type':'analytic Hessian','max cyc':3, 43 'max Hprocess': 1,44 'max Rprocess': 2,43 'max Hprocess':2, 44 'max Rprocess':1, 45 45 'min dM/M':0.0001,'shift factor':1.} 46 46 file = open(GPXfile,'rb') … … 2338 2338 2339 2339 def getPowderProfile(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup): 2340 if (calcControls['max Hprocess'] <= 1 and calcControls['max Rprocess'] > 1:2340 if calcControls['max Hprocess'] <= 1 and calcControls['max Rprocess'] > 1: 2341 2341 mpPool = mp.Pool() 2342 #print 'multiprocess function call' 2343 #else: 2344 #print 'single thread function call' 2342 2345 hId = Histogram['hId'] 2343 2346 hfx = ':%d:'%(hId) … … 2388 2391 calcControls['max Rprocess'] == 1 or 2389 2392 mp.cpu_count() < 2 or len(refList) < 2 * chunk): 2390 print 'single thread function',hId,len(refList)2391 2393 res = ComputeReflectionProfile( 2392 2394 (0,refList,x,Phase,calcControls,wave,G,g,GB,Vst, … … 2396 2398 yc[iBeg:iFin] += yct 2397 2399 else: 2398 print 'multiprocess function',hId,len(refList)2399 2400 argList = [] 2400 2401 for i in range(0,len(refList),chunk): … … 2604 2605 2605 2606 def getPowderProfileDerv(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup): 2606 if (calcControls['max Hprocess'] <= 1 and calcControls['max Rprocess'] > 1:2607 if calcControls['max Hprocess'] <= 1 and calcControls['max Rprocess'] > 1: 2607 2608 mpPool = mp.Pool() 2609 #print 'mp derivs' 2610 #else: 2611 #print 'single thread derivs' 2608 2612 # create a list of dependent variables and set up a dictionary to hold their derivatives 2609 2613 dependentVars = G2mv.GetDependentVars() … … 2667 2671 calcControls['max Rprocess'] == 1 or 2668 2672 mp.cpu_count() < 2 or len(refList) < 2 * chunk): 2669 print 'single thread derivs'2670 2673 TdepDerivDict, TdMdv, iBegO, iFinO = ComputeReflectionDerivative( 2671 2674 (0,refList,x,dependentVars,varylist,dFdvDict, … … 2676 2679 depDerivDict[j] += TdepDerivDict[j] 2677 2680 else: 2678 print 'multiprocess derivs'2679 2681 argList = [] 2680 2682 for iref in range(0,len(refList),chunk): … … 2720 2722 2721 2723 def ComputePowderHessian(args): 2724 G2lat.InitTexture() #initialize fortran arrays for spherical harmonics 2722 2725 Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup = args 2723 2726 hId = Histogram['hId'] … … 2797 2800 2798 2801 def ComputePowderProfile(args): 2802 G2lat.InitTexture() #initialize fortran arrays for spherical harmonics 2799 2803 Histogram,parmdict,varylist,Phases,calcControls,pawleyLookup,histkey = args 2800 2804 hId = Histogram['hId'] … … 2874 2878 ) 2875 2879 if MaxProcess > 1: 2876 mpPool = mp.Pool( )2880 mpPool = mp.Pool(1) 2877 2881 for (xB,xF,ycSect,ybSect,RL,histkey 2878 2882 ) in mpPool.imap_unordered(ComputePowderProfile,argList): … … 2887 2891 Histogram['sumwYo'] = np.sum(w[xB:xF]*y[xB:xF]**2) 2888 2892 sumwYo += Histogram['sumwYo'] 2889 2890 2893 yc[xB:xF] = ycSect 2891 2894 yb[xB:xF] = ybSect … … 2934 2937 2935 2938 def Refine(GPXfile,dlg): 2936 import pytexture as ptx 2937 ptx.pyqlmninit() #initialize fortran arrays for spherical harmonics 2938 2939 G2lat.InitTexture() #initialize fortran arrays for spherical harmonics 2939 2940 ShowBanner() 2940 2941 varyList = [] … … 3080 3081 3081 3082 def SeqRefine(GPXfile,dlg): 3082 import pytexture as ptx 3083 ptx.pyqlmninit() #initialize fortran arrays for spherical harmonics 3084 3083 G2lat.InitTexture() #initialize fortran arrays for spherical harmonics 3085 3084 ShowBanner() 3086 3085 print ' Sequential Refinement'
Note: See TracChangeset
for help on using the changeset viewer.