Changeset 4602


Ignore:
Timestamp:
Oct 17, 2020 9:05:15 AM (3 years ago)
Author:
vondreele
Message:

add molecular (RB) center option

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r4594 r4602  
    27732773                data['Residue'][resRBsel] = {'RBname':rbName,'rbXYZ':rbXYZ,'rbTypes':rbTypes,
    27742774                    'atNames':atNames,'rbRef':[nOrig-1,mRef-1,nRef-1,True],'rbSeq':rbSeq,
    2775                     'SelSeq':[0,0],'useCount':0}
     2775                    'SelSeq':[0,0],'useCount':0,'molCent':None}
    27762776                data['RBIds']['Residue'].append(resRBsel)
    27772777                print ('Rigid body '+rbName+' added')
     
    28512851            name = G2obj.MakeUniqueLabel(name,namelist)
    28522852            data['Residue'][resRBsel] = {'RBname':name,'rbXYZ':rbXYZ,'rbTypes':rbTypes,
    2853                 'atNames':atNames,'rbRef':[0,1,2,False],'rbSeq':[],'SelSeq':[0,0],'useCount':0}
     2853                'atNames':atNames,'rbRef':[0,1,2,False],'rbSeq':[],'SelSeq':[0,0],'useCount':0,'molCent':False}
    28542854            data['RBIds']['Residue'].append(resRBsel)
    28552855            print ('Rigid body UNKRB added')
     
    30503050            magSizer.Add(magValue,0,WACV)
    30513051            magSizer.Add((5,0),)
    3052             magref = wx.CheckBox(VectorRBDisplay,-1,label=' Refine?')
     3052            magref = wx.CheckBox(VectorRBDisplay,label=' Refine?')
    30533053            magref.SetValue(rbData['VectRef'][imag])
    30543054            magref.Bind(wx.EVT_CHECKBOX,OnRBVectorRef)
     
    32933293                rbXYZ = np.inner(Mat,rbXYZ).T
    32943294                rbData['rbXYZ'] = rbXYZ
     3295                rbData['molCent'] = False
    32953296                res.ClearSelection()
    32963297                resTable = res.GetTable()
     
    33003301                    resTable.SetRowValues(r,row)
    33013302                res.ForceRefresh()
     3303                molcent.SetValue(False)
    33023304                G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults)
     3305               
     3306            def OnMolCent(event):
     3307                rbData['molCent'] = not rbData['molCent']
     3308                if rbData['molCent']:
     3309                    Obj = event.GetEventObject()
     3310                    res = Indx[Obj.GetId()]
     3311                    rbXYZ = rbData['rbXYZ']
     3312                    rbCent = np.array([np.sum(rbXYZ[:,0]),np.sum(rbXYZ[:,1]),np.sum(rbXYZ[:,2])])/rbXYZ.shape[0]
     3313                    rbXYZ -= rbCent
     3314                    rbData['rbXYZ'] = rbXYZ
     3315                    res.ClearSelection()
     3316                    resTable = res.GetTable()
     3317                    for r in range(res.GetNumberRows()):
     3318                        row = resTable.GetRowValues(r)
     3319                        row[2:4] = rbXYZ[r]
     3320                        resTable.SetRowValues(r,row)
     3321                    res.ForceRefresh()
     3322                    G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults)
     3323                   
    33033324               
    33043325            Types = 2*[wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]
     
    33513372                    refAtmSizer.Add(refSel,0,WACV)
    33523373                RefObjs.append(refObj)
     3374                if 'molCent' not in rbData: rbData['molCent'] = False           #patch
     3375                molcent = wx.CheckBox(ResidueRBDisplay,label=' Use RB center?')
     3376                molcent.SetValue(rbData['molCent'])
     3377                molcent.Bind(wx.EVT_CHECKBOX,OnMolCent)
     3378                Indx[molcent.GetId()] = resGrid
     3379                refAtmSizer.Add(molcent,0,WACV)
    33533380           
    33543381            mainSizer = wx.BoxSizer(wx.VERTICAL)
  • trunk/GSASIIphsGUI.py

    r4601 r4602  
    43744374                    for angles in AngArray:
    43754375                        Angles += [item[2][0] for item in AngArray[angles]]
    4376                     G2plt.PlotBarGraph(G2frame,Angles,Xname='$\mathsf{Angles,{^o}}$',
     4376                    G2plt.PlotBarGraph(G2frame,Angles,Xname=r'$\mathsf{Angles,{^o}}$',
    43774377                        Title='Bond angles about %s'%Atypes,PlotName='%s Angles'%Atypes)
    43784378                    print('Total number of angles about %s is %d'%(Atypes,len(Angles)))
     
    1002410024            topLine.Add(delRB,0,WACV)
    1002510025            symAxis = RBObj.get('symAxis')
    10026             if symAxis:
     10026            if np.any(symAxis):
    1002710027                if symAxis[0] == symAxis[1] == symAxis[2]:
    1002810028                    lbl = 'x+y+z'
Note: See TracChangeset for help on using the changeset viewer.