Changeset 1062 for trunk/GSASIImath.py
 Timestamp:
 Sep 20, 2013 3:28:58 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r1061 r1062 2530 2530 return np.array(Mdata) 2531 2531 2532 def GetAtomTX(RBdata,parmDict): 2532 def GetAtomT(RBdata,parmDict): 2533 'Needs a doc string' 2534 atNo = parmDict['atNo'] 2535 nfixAt = parmDict['nfixAt'] 2536 Tdata = atNo*[' ',] 2537 for iatm in range(nfixAt): 2538 parm = ':'+str(iatm)+':Atype' 2539 if parm in parmDict: 2540 Tdata[iatm] = aTypes.index(parmDict[parm]) 2541 iatm = nfixAt 2542 for iObj in range(parmDict['nObj']): 2543 pfx = str(iObj)+':' 2544 if parmDict[pfx+'Type'] in ['Vector','Residue']: 2545 if parmDict[pfx+'Type'] == 'Vector': 2546 RBRes = RBdata['Vector'][parmDict[pfx+'RBId']] 2547 nAtm = len(RBRes['rbVect'][0]) 2548 else: #Residue 2549 RBRes = RBdata['Residue'][parmDict[pfx+'RBId']] 2550 nAtm = len(RBRes['rbXYZ']) 2551 for i in range(nAtm): 2552 Tdata[iatm] = aTypes.index(RBRes['rbTypes'][i]) 2553 iatm += 1 2554 elif parmDict[pfx+'Type'] == 'Atom': 2555 atNo = parmDict[pfx+'atNo'] 2556 parm = pfx+'Atype' #remove extra ':' 2557 if parm in parmDict: 2558 Tdata[atNo] = aTypes.index(parmDict[parm]) 2559 iatm += 1 2560 else: 2561 continue #skips March Dollase 2562 return Tdata 2563 2564 def GetAtomX(RBdata,parmDict): 2533 2565 'Needs a doc string' 2534 2566 Bmat = parmDict['Bmat'] 2535 2567 atNo = parmDict['atNo'] 2536 2568 nfixAt = parmDict['nfixAt'] 2537 Tdata = atNo*[' ',]2538 2569 Xdata = np.zeros((3,atNo)) 2539 keys = {':A type':Tdata,':Ax':Xdata[0],':Ay':Xdata[1],':Az':Xdata[2]}2570 keys = {':Ax':Xdata[0],':Ay':Xdata[1],':Az':Xdata[2]} 2540 2571 for iatm in range(nfixAt): 2541 2572 for key in keys: 2542 2573 parm = ':'+str(iatm)+key 2543 2574 if parm in parmDict: 2544 if key == ':Atype': 2545 keys[key][iatm] = aTypes.index(parmDict[parm]) 2546 else: 2547 keys[key][iatm] = parmDict[parm] 2575 keys[key][iatm] = parmDict[parm] 2548 2576 iatm = nfixAt 2549 2577 for iObj in range(parmDict['nObj']): … … 2567 2595 Qori = AVdeg2Q(parmDict[pfx+'Qa'],[parmDict[pfx+'Qi'],parmDict[pfx+'Qj'],parmDict[pfx+'Qk']]) 2568 2596 Pos = np.array([parmDict[pfx+'Px'],parmDict[pfx+'Py'],parmDict[pfx+'Pz']]) 2569 Xdata.T[iatm:iatm+len(Cart)] = np.inner(prodQVQ(Qori,Cart),Bmat)+Pos 2570 for i in range(len(Cart)): 2571 Tdata[iatm] = aTypes.index(RBRes['rbTypes'][i]) 2572 iatm += 1 2597 Xdata.T[iatm:iatm+len(Cart)] = np.inner(Bmat.T,prodQVQ(Qori,Cart)).T+Pos 2598 iatm += len(Cart) 2573 2599 elif parmDict[pfx+'Type'] == 'Atom': 2574 2600 atNo = parmDict[pfx+'atNo'] … … 2576 2602 parm = pfx+key[1:] #remove extra ':' 2577 2603 if parm in parmDict: 2578 if key == ':Atype': 2579 keys[key][atNo] = aTypes.index(parmDict[parm]) 2580 else: 2581 keys[key][atNo] = parmDict[parm] 2604 keys[key][atNo] = parmDict[parm] 2582 2605 iatm += 1 2583 2606 else: 2584 2607 continue #skips March Dollase 2585 return Tdata,Xdata.T2608 return Xdata.T 2586 2609 2587 2610 def getAllTX(Tdata,Mdata,Xdata,SGM,SGT): … … 2626 2649 parmDict.update(dict(zip(varyList,values))) #update parameter tables 2627 2650 t0 = time.time() 2628 Xdata = GetAtom TX(RBdata,parmDict)[1]#get new atom coords from RB2651 Xdata = GetAtomX(RBdata,parmDict) #get new atom coords from RB 2629 2652 tsum += (time.time()t0) 2630 2653 allX = getAllX(Xdata,SGM,SGT) #fill unit cell  dups. OK … … 2644 2667 refList[6] = refList[4]refList[5] 2645 2668 M = np.inner(refList[6],np.inner(rcov,refList[6])) 2646 # print M,parmDict['sumFosq'],np.sum(refList[6]**2),np.sum(refList[4]**2)2647 # print np.sum(refList[6]**2)/np.sum(refList[4]**2)2648 2669 return M/np.sum(refList[4]**2) 2649 2670 … … 2694 2715 parmDict['nObj'] = len(MCSAObjs) 2695 2716 aTypes = list(aTypes) 2696 Tdata,Xdata = GetAtomTX(RBdata,parmDict) 2717 Tdata = GetAtomT(RBdata,parmDict) 2718 Xdata = GetAtomX(RBdata,parmDict) 2697 2719 Mdata = GetAtomM(Xdata,SGData) 2698 2720 allT,allM = getAllTX(Tdata,Mdata,Xdata,SGM,SGT)[:2]
Note: See TracChangeset
for help on using the changeset viewer.