Changeset 971 for trunk/GSASIImath.py
 Timestamp:
 Jun 28, 2013 9:05:31 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r970 r971 2318 2318 x0 = schedule.getstart_temp(best_state) 2319 2319 else: 2320 x0 = random.uniform(size=len(x0))*(upperlower) + lower2320 # x0 = random.uniform(size=len(x0))*(upperlower) + lower 2321 2321 best_state.x = None 2322 2322 best_state.cost = numpy.Inf … … 2426 2426 for p in procs: 2427 2427 p.join() 2428 2429 2428 return resultlist 2430 2431 2429 2432 2430 def mcsaSearch(data,RBdata,reflType,reflData,covData,pgbar): … … 2577 2575 sumMD = len(Uniq) 2578 2576 if MDval != 1.0: 2577 VA = MDaxis/np.sqrt(np.inner(MDaxis,np.inner(G,MDaxis))) 2578 DB = np.sqrt(np.dot(Uniq[0],np.inner(G,Uniq[0]))) 2579 2579 for H in Uniq: 2580 cosP ,sinP = G2lat.CosSinAngle(H,MDaxis,G)2581 A = 1.0/np.sqrt( (MDval*cosP)**2+sinP**2/MDval)2580 cosP2 = np.dot(VA,np.inner(G,H/DB)) 2581 A = 1.0/np.sqrt(cosP2*MDval**2+(1.cosP2)/MDval) 2582 2582 sumMD += A**3 2583 sumMD = np.sum(1./np.sqrt((MDval*cosP)**2+sinP**2/MDval)**3)2584 2583 return sumMD/len(Uniq) 2585 2584 … … 2589 2588 mul,len(FFs),FFs,len(Uniq),Uniq.flatten(),Phi) 2590 2589 return Icalc 2591 # FF = np.zeros(len(Tdata))2592 # for i,j in enumerate(Tdata): #NB: generator here is slower!2593 # FF[i] = FFs[j]2594 # FF *= Mdata/len(Phi) #FF*occ2595 # phase = np.inner(Uniq,Xdata) #hx+ky+lz2596 # phase += Phi[:,np.newaxis] #hx+ky+lz+phi2597 # cosp = np.cos(twopi*phase)2598 # fas = np.sum(FF*cosp)2599 # if ifInv:2600 # fbs = 0.2601 # else:2602 # sinp = np.sin(twopi*phase)2603 # fbs = np.sum(FF*sinp)2604 # return (fas**2+fbs**2)*mul2605 2590 2606 2591 def mcsaCalc(values,refList,rcov,ifInv,RBdata,varyList,parmDict): … … 2623 2608 t0 = time.time() 2624 2609 refl[5] = mcsasfCalc(ifInv,Tdata,Mdata,Xdata,refl[3],refl[7],refl[8],refl[9]) 2625 #refl[5] *= calcMDcorr(MDval,MDaxis,Uniq,Gmat)2610 refl[5] *= calcMDcorr(MDval,MDaxis,Uniq,Gmat) 2626 2611 tsum += (time.time()t0) 2627 2612 sumFcsq += refl[5]
Note: See TracChangeset
for help on using the changeset viewer.