Changeset 1060


Ignore:
Timestamp:
Sep 19, 2013 4:31:46 PM (8 years ago)
Author:
vondreele
Message:

mods to MC/SA stuff - some speedup done

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r1058 r1060  
    402402        for tor,seq in zip(RBObj['Torsions'],RBRes['rbSeq']):
    403403            QuatA = AVdeg2Q(tor[0],Cart[seq[0]]-Cart[seq[1]])
    404             for ride in seq[3]:
    405                 Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]]
     404            Cart[seq[3]] = prodQVQ(Quata,(Cart[seq[3]]-Cart[seq[1]]).T).T+Cart[seq[1]]
     405#            for ride in seq[3]:
     406#                Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]]
    406407    XYZ = np.zeros_like(Cart)
    407408    for i,xyz in enumerate(Cart):
     
    25642565                    for itor,seq in enumerate(RBRes['rbSeq']):
    25652566                        QuatA = AVdeg2Q(parmDict[pfx+'Tor'+str(itor)],Cart[seq[0]]-Cart[seq[1]])
     2567#                        Cart[seq[3]] = prodQVQ(QuatA,Cart[seq[3]]-Cart[seq[1]])+Cart[seq[1]]
    25662568                        for ride in seq[3]:
    25672569                            Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]]
     
    27412743        nRef = len(refs)
    27422744        pfx = str(data['pId'])+'::PWLref:'
    2743         if covData['freshCOV'] and generalData['doPawley']:
     2745        if covData['freshCOV'] and generalData['doPawley'] and MCSA.get('newDmin',True):
    27442746            covMatrix = covData['covMatrix']
    27452747            rcov = np.zeros((nRef,nRef))       
     
    27662768            MCSA['rcov'] = rcov
    27672769            covData['freshCOV'] = False
     2770            MCSA['newDmin'] = False
    27682771        else:
    27692772            rcov = MCSA['rcov']
     
    28382841    q=r+ai+bj+ck
    28392842    """
    2840     VP = np.zeros(3)
    28412843    T2 = Q[0]*Q[1]
    28422844    T3 = Q[0]*Q[2]
     
    28482850    T9 = Q[2]*Q[3]
    28492851    T10 = -Q[3]*Q[3]
    2850     VP[0] = 2.*((T8+T10)*V[0]+(T6-T4)*V[1]+(T3+T7)*V[2])+V[0]
    2851     VP[1] = 2.*((T4+T6)*V[0]+(T5+T10)*V[1]+(T9-T2)*V[2])+V[1]
    2852     VP[2] = 2.*((T7-T3)*V[0]+(T2+T9)*V[1]+(T5+T8)*V[2])+V[2]
    2853     return VP   
     2852    M = np.array([[T8+T10,T6-T4,T3+T7],[T4+T6,T5+T10,T9-T2],[T7-T3,T2+T9,T5+T8]])
     2853    VP = 2.*np.inner(M,V)
     2854    return VP+V
    28542855   
    28552856def Q2Mat(Q):
     
    28782879    '''
    28792880    Q = np.zeros(4)
    2880     d = np.sqrt(np.sum(np.array(V)**2))
     2881    d = nl.norm(np.array(V))
    28812882    if d:
    28822883        V /= d
     
    28932894    '''
    28942895    Q = np.zeros(4)
    2895     d = np.sqrt(np.sum(np.array(V)**2))
     2896    d = nl.norm(np.array(V))
    28962897    if d:
    28972898        V /= d
     
    29202921    V /= np.sin(A/2.)
    29212922    return A,V
     2923   
     2924def randomQ(r0,r1,r2,r3):
     2925    ''' create random quaternion from 4 random numbers in range (-1,1)
     2926    '''
     2927    sum = 0
     2928    Q = np.array(4)
     2929    Q[0] = r0
     2930    sum += Q[0]**2
     2931    Q[1] = np.sqrt(1.-sum)*r1
     2932    sum += Q[1]**2
     2933    Q[2] = np.sqrt(1.-sum)*r2
     2934    sum += Q[2]**2
     2935    Q[3] = np.sqrt(1.-sum)*np.where(r3<0.,-1.,1.)
     2936    return Q
     2937   
     2938def randomAVdeg(r0,r1,r2,r3):
     2939    ''' create random angle (deg),vector from 4 random number in range (-1,1)
     2940    '''
     2941    return Q2AVdeg(randomQ(r0,r1,r2,r3))
    29222942   
    29232943def makeQuat(A,B,C):
  • trunk/GSASIIphsGUI.py

    r1056 r1060  
    665665                    pass
    666666                dmin.SetValue("%.3f"%(MCSAdata['dmin']))          #reset in case of error
     667                MCSAdata['newDmin'] = True
    667668
    668669            def OnCycles(event):
  • trunk/GSASIIplot.py

    r1054 r1060  
    26952695                mcsaTypes.append(atyp)
    26962696        mcsaBonds = FindPeaksBonds(mcsaXYZ)       
    2697 #            mcsaXYZ,atTypes = G2mth.UpdateMCSAxyz(Bmat,MCSA)
    2698 #            XYZeq = []
    2699 #            for xyz in mcsaXYZ:
    2700 #                XYZeq += G2spc.GenAtom(xyz,SGData)[0][1:]       #skip self xyz
    2701 #           
    2702 #            mcsaBonds = FindPeaksBonds(mcsaXYZ)       
    27032697    drawAtoms = drawingData.get('Atoms',[])
    27042698    mapData = {}
Note: See TracChangeset for help on using the changeset viewer.