Changeset 1587 for trunk/GSASIIindex.py


Ignore:
Timestamp:
Nov 27, 2014 9:34:45 AM (8 years ago)
Author:
vondreele
Message:

use successive approx. to get d from TOF
allow sorting on a,b,c,alp,bet,gam, vol & m20 in cell indexed table
put in derivatives for fitCell inside indexing routine - better accuracy & speed
add a couple more orthos to SS table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIindex.py

    r1585 r1587  
    244244    return X
    245245               
    246 def sortVolume(cells):
     246def sortCells(cells,col):
    247247    #cells is M20,X20,Bravais,a,b,c,alp,bet,gam,volume
    248     #sort smallest volume 1st
     248    #sort smallest a,b,c,alpha,beta,gamma or volume 1st
    249249    T = []
    250250    for i,M in enumerate(cells):
    251         T.append((M[9],i))
     251        T.append((M[col],i))
    252252    D = dict(zip(T,cells))
    253253    T.sort()
     
    256256        X.append(D[key])
    257257    return X
     258   
     259def findMV(peaks,HKL,ssopt):
     260#    import basinhopping as bh
     261    print ssopt
     262    return ssopt['ModVec']
    258263               
    259264def IndexPeaks(peaks,HKL):
     
    405410        Qc = G2lat.calc_rDsq(H,A)
    406411        return (Qo-Qc)*d**Pwr
     412       
     413    def dervFit(values,ibrav,d,H,Pwr):
     414        if ibrav in [0,1,2]:
     415            derv = [H[0]*H[0]+H[1]*H[1]+H[2]*H[2],]
     416        elif ibrav in [3,4,]:
     417            derv = [H[0]*H[0]+H[1]*H[1]+H[0]*H[1],H[2]*H[2]]
     418        elif ibrav in [5,6]:
     419            derv = [H[0]*H[0]+H[1]*H[1],H[2]*H[2]]
     420        elif ibrav in [7,8,9,10]:
     421            derv = [H[0]*H[0],H[1]*H[1],H[2]*H[2]]
     422        elif ibrav in [11,12]:
     423            derv = [H[0]*H[0],H[1]*H[1],H[2]*H[2],H[0]*H[2]]
     424        else:
     425            derv = [H[0]*H[0],H[1]*H[1],H[2]*H[2],H[0]*H[1],H[0]*H[2],H[1]*H[2]]
     426        derv = -np.array(derv)
     427        return (derv*d**Pwr).T
    407428   
    408429    Peaks = np.array(peaks).T
    409    
    410430    values = A2values(ibrav,A)
    411     result = so.leastsq(errFit,values,full_output=True,ftol=0.0001,
     431    result = so.leastsq(errFit,values,Dfun=dervFit,full_output=True,ftol=0.000001,
    412432        args=(ibrav,Peaks[7],Peaks[4:7],Pwr))
    413433    A = Values2A(ibrav,result[0])
Note: See TracChangeset for help on using the changeset viewer.