Changeset 970
- Timestamp:
- Jun 27, 2013 10:55:13 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r965 r970 2318 2318 x0 = schedule.getstart_temp(best_state) 2319 2319 else: 2320 #x0 = random.uniform(size=len(x0))*(upper-lower) + lower2320 x0 = random.uniform(size=len(x0))*(upper-lower) + lower 2321 2321 best_state.x = None 2322 2322 best_state.cost = numpy.Inf … … 2332 2332 fqueue = [100, 300, 500, 700] 2333 2333 iters = 0 2334 while 1: 2334 keepGoing = True 2335 while keepGoing: 2336 retval = 0 2335 2337 for n in xrange(dwell): 2336 2338 current_state.x = schedule.update_guess(last_state.x) … … 2351 2353 best_state.x = last_state.x.copy() 2352 2354 best_state.cost = last_state.cost 2353 break2355 retval = 5 2354 2356 schedule.update_temp() 2355 2357 iters += 1 … … 2361 2363 # 3) maxiter is set and we are past it 2362 2364 # 4) maxaccept is set and we are past it 2365 # 5) user canceled run via progress bar 2363 2366 2364 2367 fqueue.append(squeeze(last_state.cost)) 2365 2368 fqueue.pop(0) 2366 2369 af = asarray(fqueue)*1.0 2370 if retval == 5: 2371 print ' User terminated run; incomplete MC/SA' 2372 keepGoing = False 2373 break 2367 2374 if all(abs((af-af[0])/af[0]) < feps): 2368 2375 retval = 0 … … 2588 2595 # phase = np.inner(Uniq,Xdata) #hx+ky+lz 2589 2596 # phase += Phi[:,np.newaxis] #hx+ky+lz+phi 2590 # if len(Uniq) == 3: print 'python',phase2591 2597 # cosp = np.cos(twopi*phase) 2592 2598 # fas = np.sum(FF*cosp) 2593 # print fas2594 2599 # if ifInv: 2595 2600 # fbs = 0. … … 2597 2602 # sinp = np.sin(twopi*phase) 2598 2603 # fbs = np.sum(FF*sinp) 2599 # return (fas**2+fbs**2)*mul 2600 2604 # return (fas**2+fbs**2)*mul 2605 2601 2606 def mcsaCalc(values,refList,rcov,ifInv,RBdata,varyList,parmDict): 2602 2607 ''' Compute structure factors for all h,k,l for phase … … 2618 2623 t0 = time.time() 2619 2624 refl[5] = mcsasfCalc(ifInv,Tdata,Mdata,Xdata,refl[3],refl[7],refl[8],refl[9]) 2620 # refl[5] *= calcMDcorr(MDval,MDaxis,Uniq,Gmat) 2625 # refl[5] *= calcMDcorr(MDval,MDaxis,Uniq,Gmat) 2621 2626 tsum += (time.time()-t0) 2622 2627 sumFcsq += refl[5] … … 2751 2756 x0 = [parmDict[val] for val in varyList] 2752 2757 ifInv = SGData['SGInv'] 2753 results = anneal(mcsaCalc,x0,args=(refs,rcov,ifInv,RBdata,varyList,parmDict), 2758 results = anneal(mcsaCalc,x0,args=(refs,rcov,ifInv,RBdata,varyList,parmDict), 2754 2759 schedule=MCSA['Algorithm'], full_output=True, 2755 2760 T0=MCSA['Annealing'][0], Tf=MCSA['Annealing'][1],dwell=MCSA['Annealing'][2], -
trunk/GSASIIphsGUI.py
r966 r970 4388 4388 Result,tsum = G2mth.mcsaSearch(data,RBdata,reflType,reflData,covData,pgbar) 4389 4389 MCSAdata['Results'].append(Result) 4390 print ' MC/SA run completed: %d residual: %.3f%% '%(i,100*Result[2])4390 print ' MC/SA run completed: %d residual: %.3f%% SFcalc time: %.2fs'%(i,100*Result[2],tsum) 4391 4391 tsf += tsum 4392 4392 print ' Structure factor time: %.2f'%(tsf)
Note: See TracChangeset
for help on using the changeset viewer.