Skip to content

Commit a572793

Browse files
committed
improve deformation GUI
1 parent 13b43cd commit a572793

File tree

2 files changed

+39
-14
lines changed

2 files changed

+39
-14
lines changed

GSASII/GSASIIlattice.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,12 +2399,12 @@ def RBChk(sytsym,L,M):
23992399
if not L%2 and not (M//2)%2: return True,1.0
24002400
elif sytsym == '4/mmm(z)':
24012401
if not L%2 and not M%4: return True,1.0
2402-
elif sytsym == '3' or sytsym == '3(111)':
2402+
elif sytsym in ['3','3(111)']:
24032403
if not M%3: return True,1.0 #P?
2404-
elif sytsym == '-3' or sytsym == '-3(111)':
2404+
elif sytsym in ['-3','-3(111)']:
24052405
if not L%2 and not M%3: return True,1.0 #P?
24062406
elif sytsym in ['32','32(100)','32(111)']:
2407-
if not M%3: return True,-1.0**L
2407+
if not M%3: return True,-1.0**(L-M)
24082408
elif sytsym == '32(120)':
24092409
if not M%3: return True,-1.0**(L-M)
24102410
elif sytsym in ['3m','3m(100)','3m(111)']:
@@ -2427,7 +2427,7 @@ def RBChk(sytsym,L,M):
24272427
if M%2: return True,1.0
24282428
elif 'mmm' in sytsym :
24292429
if not L%2 and not M%2: return True,1.0
2430-
elif sytsym == '2(x)' or sytsym == '2(100)':
2430+
elif sytsym in ['2(x)','2(100)']:
24312431
return True,-1.0**(L-M)
24322432
elif sytsym == '2(y)':
24332433
return True,-1.0**L

GSASII/GSASIIphsGUI.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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:'))

0 commit comments

Comments
 (0)