Ignore:
Timestamp:
Sep 18, 2017 8:52:24 AM (6 years ago)
Author:
vondreele
Message:

implement rigid body reference vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r3065 r3079  
    15141514        else:
    15151515            rbXYZ = np.array(rbXYZ)-np.array(rbXYZ[0])
     1516            Xxyz = rbXYZ[1]
     1517            X = Xxyz/np.sqrt(np.sum(Xxyz**2))
     1518            Yxyz = rbXYZ[2]
     1519            Y = Yxyz/np.sqrt(np.sum(Yxyz**2))
     1520            Mat = G2mth.getRBTransMat(X,Y)
     1521            rbXYZ = np.inner(Mat,rbXYZ).T
    15161522            data['Residue'][rbId] = {'RBname':'UNKRB','rbXYZ':rbXYZ,'rbTypes':rbTypes,
    15171523                'atNames':atNames,'rbRef':[0,1,2,False],'rbSeq':[],'SelSeq':[0,0],'useCount':0}
     
    18501856                    rbData['rbTypes'] = newTypes
    18511857                    rbData['rbXYZ'] = newXYZ
     1858                G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults)
    18521859                wx.CallAfter(UpdateResidueRB)
    18531860                   
     
    19171924
    19181925            def OnRefSel(event):
     1926               
    19191927                Obj = event.GetEventObject()
    19201928                iref,res,jref = Indx[Obj.GetId()]
     
    19271935                for i,ref in enumerate(RefObjs[jref]):
    19281936                    ref.SetItems([atNames[j] for j in refChoice[rbId][i]])
    1929                     ref.SetValue(atNames[rbData['rbRef'][i]])
     1937                    ref.SetValue(atNames[rbData['rbRef'][i]])                   
     1938                rbXYZ = rbData['rbXYZ']
    19301939                if not iref:     #origin change
    1931                     rbXYZ = rbData['rbXYZ']
    19321940                    rbXYZ -= rbXYZ[ind]
    1933                     res.ClearSelection()
    1934                     resTable = res.GetTable()
    1935                     for r in range(res.GetNumberRows()):
    1936                         row = resTable.GetRowValues(r)
    1937                         row[2:4] = rbXYZ[r]
    1938                         resTable.SetRowValues(r,row)
    1939                     res.ForceRefresh()
    1940                     G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults)
     1941                #TODO - transform all atom XYZ by axis choices
     1942                Xxyz = rbXYZ[rbData['rbRef'][1]]
     1943                X = Xxyz/np.sqrt(np.sum(Xxyz**2))
     1944                Yxyz = rbXYZ[rbData['rbRef'][2]]
     1945                Y = Yxyz/np.sqrt(np.sum(Yxyz**2))
     1946                Mat = G2mth.getRBTransMat(X,Y)
     1947                rbXYZ = np.inner(Mat,rbXYZ).T
     1948                rbData['rbXYZ'] = rbXYZ
     1949                res.ClearSelection()
     1950                resTable = res.GetTable()
     1951                for r in range(res.GetNumberRows()):
     1952                    row = resTable.GetRowValues(r)
     1953                    row[2:4] = rbXYZ[r]
     1954                    resTable.SetRowValues(r,row)
     1955                res.ForceRefresh()
     1956                G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults)
    19411957               
    19421958            Types = 2*[wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]
Note: See TracChangeset for help on using the changeset viewer.