@@ -12114,6 +12114,7 @@ def OnNewHarm(event):
1211412114 Obj = event.GetEventObject()
1211512115 dId = Indx[Obj.GetId()]
1211612116 atom = atomData[AtLookUp[dId]]
12117+ sytsym = atom[cs].strip()
1211712118 for harm in data['Deformations'][dId]:
1211812119 if 'Sl' in harm[0]:
1211912120 Harm = harm
@@ -12122,7 +12123,11 @@ def OnNewHarm(event):
1212212123 orders = [int(item[2]) for item in Hkeys if 'D' in item]
1212312124 if len(orders):
1212412125 Order = max(orders)+1
12125- cofNames,cofSgns = G2lat.GenRBCoeff(atom[cs],'1',Order) #sytsym, RBsym = '1'
12126+ cofNames = []
12127+ while not len(cofNames) and Order < 5:
12128+ cofNames,cofSgns = G2lat.GenRBCoeff(sytsym,'1',Order) #sytsym, RBsym = '1'
12129+ Order += 1
12130+ Order -= 1
1212612131 cofNames = [name.replace('C','D') for name in cofNames]
1212712132 cofTerms = {name:[0.0,False] for name in cofNames if str(Order) in name}
1212812133 for name in cofNames:
@@ -12131,7 +12136,21 @@ def OnNewHarm(event):
1213112136 cofTerms.update({negname:[0.0,False]})
1213212137 Harm[1].update(cofTerms)
1213312138 wx.CallAfter(UpdateDeformation,dId)
12134-
12139+
12140+ def OnDelHarm(event):
12141+ Obj = event.GetEventObject()
12142+ dId = Indx[Obj.GetId()]
12143+ for harm in data['Deformations'][dId]:
12144+ if 'Sl' in harm[0]:
12145+ Harm = harm
12146+ Hkeys = list(Harm[1].keys())
12147+ if len(Hkeys) > 1: #always an "Ne"
12148+ maxord = max([int(item[2]) for item in Hkeys if 'D' in item])
12149+ for item in Hkeys:
12150+ if 'D' in item and int(item[2]) == maxord:
12151+ del Harm[1][item]
12152+ wx.CallAfter(UpdateDeformation,dId)
12153+
1213512154 # UpdateDeformation executable code starts here
1213612155 alpha = ['A','B','C','D','E','F','G','H',]
1213712156 generalData = data['General']
@@ -12188,6 +12207,16 @@ def OnNewHarm(event):
1218812207 neigh = G2mth.sortArray(neigh,2) #sort by dist
1218912208 lineSizer = wx.BoxSizer(wx.HORIZONTAL)
1219012209 lineSizer.Add(wx.StaticText(deformation,label=' For atom %s, site sym %s:'%(atom[ct-1],atom[cs])),0,WACV)
12210+ plotAtm = wx.Button(deformation,label='Plot')
12211+ plotAtm.Bind(wx.EVT_BUTTON,OnPlotAtm)
12212+ Indx[plotAtm.GetId()] = dId
12213+ lineSizer.Add(plotAtm,0,WACV)
12214+ delAtm = wx.Button(deformation,label='Delete')
12215+ delAtm.Bind(wx.EVT_BUTTON,OnDelAtm)
12216+ Indx[delAtm.GetId()] = dId
12217+ lineSizer.Add(delAtm,0,WACV)
12218+ mainSizer.Add(lineSizer)
12219+ lineSizer = wx.BoxSizer(wx.HORIZONTAL)
1219112220 names = []
1219212221 if not len(neigh):
1219312222 lineSizer.Add(wx.StaticText(deformation,label=' No neighbors found; Do Set bond parms to expand search'),0,WACV)
@@ -12208,14 +12237,6 @@ def OnNewHarm(event):
1220812237 UVvec[dId] += [neigh[1][3]/neigh[1][2],(neigh[0][3]+neigh[1][3])/np.sqrt(neigh[0][2]**2+neigh[1][2]**2),] #B, A+B
1220912238 if Nneigh == 4:
1221012239 UVvec[dId] += [(neigh[0][3]+neigh[1][3]+neigh[2][3])/np.sqrt(neigh[0][2]**2+neigh[1][2]**2+neigh[2][2]**2),] #A+B+C
12211- plotAtm = wx.Button(deformation,label='Plot')
12212- plotAtm.Bind(wx.EVT_BUTTON,OnPlotAtm)
12213- Indx[plotAtm.GetId()] = dId
12214- lineSizer.Add(plotAtm,0,WACV)
12215- delAtm = wx.Button(deformation,label='Delete')
12216- delAtm.Bind(wx.EVT_BUTTON,OnDelAtm)
12217- Indx[delAtm.GetId()] = dId
12218- lineSizer.Add(delAtm,0,WACV)
1221912240 mainSizer.Add(lineSizer)
1222012241 matSizer = wx.BoxSizer(wx.HORIZONTAL)
1222112242 Mchoice = ["A: X'=U, Y'=(UxV)xU & Z'=UxV","B: X'=U, Y'=UxV & Z'=Ux(UxV)"]
@@ -12249,6 +12270,10 @@ def OnNewHarm(event):
1224912270 newHarm.Bind(wx.EVT_BUTTON,OnNewHarm)
1225012271 Indx[newHarm.GetId()] = dId
1225112272 oriSizer.Add(newHarm,0,WACV)
12273+ delHarm = wx.Button(deformation,label='Delete highest harmonic')
12274+ delHarm.Bind(wx.EVT_BUTTON,OnDelHarm)
12275+ Indx[delHarm.GetId()] = dId
12276+ oriSizer.Add(delHarm,0,WACV)
1225212277 mainSizer.Add(oriSizer)
1225312278 G2G.HorizontalLine(mainSizer,deformation)
1225412279 mainSizer.Add(wx.StaticText(deformation,label=' Deformation parameters:'))
@@ -12281,18 +12306,22 @@ def OnNewHarm(event):
1228112306 elif deformationData[-dId]['Radial'] == 'Slater' and 'Sl ' in orb[0]:
1228212307 orbSizer.Add(wx.StaticText(deformation,label=orb[0]+' Ne:'))
1228312308 NeSizer(deformation,orbSizer,dId,orb,Indx)
12309+ Np = 2
1228412310 if 'kappa' in orb[1]:
1228512311 orbSizer.Add(wx.StaticText(deformation,label=' kappa:'))
1228612312 Kappa(deformation,orbSizer,dId,orb,Indx)
12287- nItem = 0
12313+ Np = 1
12314+ for i in range(3*Np): orbSizer.Add((5,5),0)
12315+ iD = 1
1228812316 for item in orb[1]:
1228912317 if 'D' in item:
12290- nItem += 1
12318+ if iD < int(item[2]):
12319+ iD = int(item[2])
12320+ nItems = orbSizer.GetItemCount()%9
12321+ if nItems:
12322+ nB = 9-nItems
12323+ for i in range(nB): orbSizer.Add((5,5),0)
1229112324 Dsizer(deformation,orbSizer,dId,orb,Indx)
12292- if nItem in [2,4,6,8,10,12,14]:
12293- for i in range(3): orbSizer.Add((5,5),0)
12294- for i in range(3): orbSizer.Add((5,5),0)
12295- continue
1229612325 mainSizer.Add(orbSizer)
1229712326
1229812327 SetPhaseWindow(deformation,mainSizer)
0 commit comments