@@ -9580,7 +9580,7 @@ def OnTLSRef(event):
95809580 thermSizer.Add(Tcheck,0,WACV)
95819581 return thermSizer
95829582
9583- def LocationSizer(RBObj,rbType):
9583+ def LocationSizer(RBObj,rbType,rbId ):
95849584
95859585 def OnOrigRef(event):
95869586 RBObj['Orig'][1] = Ocheck.GetValue()
@@ -9655,6 +9655,21 @@ def OnOrien(*args, **kwargs):
96559655 except ValueError:
96569656 pass
96579657
9658+ def OnSymRadioSet(event):
9659+ '''Set the polar axis for the sp. harm. as
9660+ RBdata['Spin'][RBId]['symAxis']. This may never be
9661+ set, so use RBdata['Spin'][RBId].get('symAxis') to
9662+ access this so the default value is [0,0,1].
9663+ '''
9664+ Obj = event.GetEventObject()
9665+ axis = ([1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1])[Obj.GetSelection()]
9666+ RBObj['symAxis'] = axis
9667+ A,V = G2mth.Q2AVdeg(RBObj['Orient'][0])
9668+ ApplyAV(A,V)
9669+ data['Drawing']['Atoms'] = []
9670+ UpdateDrawAtoms(G2frame,data)
9671+ G2plt.PlotStructure(G2frame,data)
9672+
96589673 SGData = data['General']['SGData']
96599674 rbSizer = wx.BoxSizer(wx.VERTICAL)
96609675 topSizer = wx.FlexGridSizer(0,7,5,5)
@@ -9725,6 +9740,17 @@ def OnOrien(*args, **kwargs):
97259740 sytsymtxt = wx.StaticText(RigidBodies,label='%s site symmetry: %s, multiplicity: %d '%(Name,Sytsym,Mult))
97269741 rbSizer.Add(topSizer)
97279742 rbSizer.Add(sytsymtxt)
9743+ choices = [' x ',' y ',' z ','x+y','x+y+z']
9744+ RBObj['symAxis'] = RBObj.get('symAxis',[0,0,1]) #set default as 'z'
9745+ try:
9746+ symax = dict(zip([str(x) for x in [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1]]],choices))[str(RBObj['symAxis'])]
9747+ except KeyError:
9748+ symax = ' z '
9749+ symRadioSet = wx.RadioBox(RigidBodies,choices=choices,label='RB polar axis is aligned along:')
9750+ symRadioSet.SetStringSelection(symax)
9751+ symRadioSet.Bind(wx.EVT_RADIOBOX, OnSymRadioSet)
9752+ Indx[symRadioSet.GetId()] = rbId
9753+ rbSizer.Add(symRadioSet)
97289754 return rbSizer
97299755
97309756 def SpnrbSizer(RBObj,spnIndx):
@@ -9747,17 +9773,6 @@ def OnDelSpnRB(event):
97479773 G2plt.PlotStructure(G2frame,data)
97489774 wx.CallAfter(FillRigidBodyGrid,True)
97499775
9750- def OnSymRadioSet(event):
9751- '''Set the polar axis for the sp. harm. as
9752- RBdata['Spin'][RBId]['symAxis']. This may never be
9753- set, so use RBdata['Spin'][RBId].get('symAxis') to
9754- access this so the default value is [0,0,1].
9755- '''
9756- Obj = event.GetEventObject()
9757- axis = ([1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1])[Obj.GetSelection()]
9758- RBObj['symAxis'] = axis
9759- G2plt.PlotStructure(G2frame,data)
9760-
97619776 def OnAddShell(event):
97629777 rbNames = []
97639778 rbIds = {}
@@ -9965,15 +9980,7 @@ def OnSliceShell(event):
99659980 Indx[hidesh.GetId()] = 0
99669981 topLine.Add(hidesh,0,WACV)
99679982 sprbSizer.Add(wx.StaticText(RigidBodies,label='Spinning RB orientation parameters for %s:'%RBObj['RBname'][0]))
9968- sprbSizer.Add(LocationSizer(RBObj,'Spin'))
9969- choices = [' x ',' y ',' z ','x+y','x+y+z']
9970- RBObj['symAxis'] = RBObj.get('symAxis',[0,0,1]) #set default as 'z'
9971- symax = dict(zip([str(x) for x in [[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1]]],choices))[str(RBObj['symAxis'])]
9972- symRadioSet = wx.RadioBox(RigidBodies,choices=choices,label='Sp harm polar axis is aligned along:')
9973- symRadioSet.SetStringSelection(symax)
9974- symRadioSet.Bind(wx.EVT_RADIOBOX, OnSymRadioSet)
9975- Indx[symRadioSet.GetId()] = rbId
9976- sprbSizer.Add(symRadioSet)
9983+ sprbSizer.Add(LocationSizer(RBObj,'Spin',rbId))
99779984 plotLine = wx.BoxSizer(wx.HORIZONTAL)
99789985 RBObj['useAtColor'] = RBObj.get('useAtColor',True)
99799986 atColor = wx.CheckBox(RigidBodies,label='Use atom color?')
@@ -10073,7 +10080,7 @@ def OnDelResRB(event):
1007310080 topLine.Add(wx.StaticText(RigidBodies,-1,
1007410081 ' (variables '+varname+')'),0,WACV)
1007510082 resrbSizer.Add(topLine)
10076- resrbSizer.Add(LocationSizer(RBObj,'Residue'))
10083+ resrbSizer.Add(LocationSizer(RBObj,'Residue',rbId ))
1007710084 if len(RBObj['Torsions']):
1007810085 resrbSizer.Add(wx.StaticText(RigidBodies,-1,'Torsions:'),0)
1007910086 torSizer = wx.FlexGridSizer(0,8,5,5)
@@ -10162,7 +10169,7 @@ def OnDelVecRB(event):
1016210169 Indx[delRB.GetId()] = rbId
1016310170 topLine.Add(delRB,0,WACV)
1016410171 vecrbSizer.Add(topLine)
10165- vecrbSizer.Add(LocationSizer(RBObj,'Vector'))
10172+ vecrbSizer.Add(LocationSizer(RBObj,'Vector',rbId ))
1016610173 members = 'Rigid body members: '
1016710174 for Id in RBObj['Ids']:
1016810175 members += data['Atoms'][AtLookUp[Id]][ct-1].strip()+', '
0 commit comments