Changeset 1061


Ignore:
Timestamp:
Sep 20, 2013 11:34:41 AM (8 years ago)
Author:
vondreele
Message:

speedup for MCSA 3x faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r1060 r1061  
    402402        for tor,seq in zip(RBObj['Torsions'],RBRes['rbSeq']):
    403403            QuatA = AVdeg2Q(tor[0],Cart[seq[0]]-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]]
     404            Cart[seq[3]] = prodQVQ(QuatA,(Cart[seq[3]]-Cart[seq[1]]))+Cart[seq[1]]
    407405    XYZ = np.zeros_like(Cart)
    408406    for i,xyz in enumerate(Cart):
     
    442440                for itor,seq in enumerate(RBRes['rbSeq']):
    443441                    QuatA = AVdeg2Q(model['Tor'][0][itor],Cart[seq[0]]-Cart[seq[1]])
    444                     for ride in seq[3]:
    445                         Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]]
     442                    Cart[seq[3]] = prodQVQ(QuatA,(Cart[seq[3]]-Cart[seq[1]]))+Cart[seq[1]]
    446443            if model['MolCent'][1]:
    447444                Cart -= model['MolCent'][0]
     
    25652562                    for itor,seq in enumerate(RBRes['rbSeq']):
    25662563                        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]]
    2568                         for ride in seq[3]:
    2569                             Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]]
     2564                        Cart[seq[3]] = prodQVQ(QuatA,Cart[seq[3]]-Cart[seq[1]])+Cart[seq[1]]
    25702565                if parmDict[pfx+'MolCent'][1]:
    25712566                    Cart -= parmDict[pfx+'MolCent'][0]
    25722567                Qori = AVdeg2Q(parmDict[pfx+'Qa'],[parmDict[pfx+'Qi'],parmDict[pfx+'Qj'],parmDict[pfx+'Qk']])
    25732568                Pos = np.array([parmDict[pfx+'Px'],parmDict[pfx+'Py'],parmDict[pfx+'Pz']])
    2574                 for i,x in enumerate(Cart):
    2575                     X = np.inner(Bmat,prodQVQ(Qori,x))+Pos
    2576                     for j in range(3):
    2577                         Xdata[j][iatm] = X[j]
     2569                Xdata.T[iatm:iatm+len(Cart)] = np.inner(prodQVQ(Qori,Cart),Bmat)+Pos
     2570                for i in range(len(Cart)):
    25782571                    Tdata[iatm] = aTypes.index(RBRes['rbTypes'][i])
    25792572                    iatm += 1
     
    28512844    T10 = -Q[3]*Q[3]
    28522845    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)
     2846    VP = 2.*np.inner(V,M)
    28542847    return VP+V
    28552848   
Note: See TracChangeset for help on using the changeset viewer.