Skip to content

Commit 22f94e0

Browse files
committed
fix deformation plotting for Slater/Bessel
Allow additional harmonics for Slater
1 parent 93f64e8 commit 22f94e0

File tree

2 files changed

+46
-15
lines changed

2 files changed

+46
-15
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12034,7 +12034,8 @@ def OnPlotAtm(event):
1203412034
neigh = G2mth.FindAllNeighbors(data,atom[ct-1],AtNames)
1203512035
deform = deformationData[dId]
1203612036
UVmat = deformationData[-dId]['UVmat']
12037-
G2plt.PlotDeform(G2frame,generalData,atom[ct-1],atom[ct],deform,UVmat,neigh)
12037+
radial = deformationData[-dId]['Radial']
12038+
G2plt.PlotDeform(G2frame,generalData,atom[ct-1],atom[ct],deform,UVmat,radial,neigh)
1203812039

1203912040
def OnDelAtm(event):
1204012041
Obj = event.GetEventObject()
@@ -12121,6 +12122,28 @@ def Dsizer(deformation,orbSizer,dId,orb,Indx):
1212112122
Tcheck.Bind(wx.EVT_CHECKBOX,OnDeformRef)
1212212123
Indx[Tcheck.GetId()] = [dId,iorb,item]
1212312124
orbSizer.Add(Tcheck)
12125+
12126+
def OnNewHarm(event):
12127+
Obj = event.GetEventObject()
12128+
dId = Indx[Obj.GetId()]
12129+
atom = atomData[AtLookUp[dId]]
12130+
for harm in data['Deformations'][dId]:
12131+
if 'Sl' in harm[0]:
12132+
Harm = harm
12133+
Order = 1
12134+
Hkeys = list(Harm[1].keys())
12135+
orders = [int(item[2]) for item in Hkeys if 'D' in item]
12136+
if len(orders):
12137+
Order = max(orders)+1
12138+
cofNames,cofSgns = G2lat.GenRBCoeff(atom[cs],'1',Order) #sytsym, RBsym = '1'
12139+
cofNames = [name.replace('C','D') for name in cofNames]
12140+
cofTerms = {name:[0.0,False] for name in cofNames if str(Order) in name}
12141+
for name in cofNames:
12142+
if str(Order) in name and '0' not in name:
12143+
negname = name.replace(',',',-')
12144+
cofTerms.update({negname:[0.0,False]})
12145+
Harm[1].update(cofTerms)
12146+
wx.CallAfter(UpdateDeformation,dId)
1212412147

1212512148
# UpdateDeformation executable code starts here
1212612149
alpha = ['A','B','C','D','E','F','G','H',]
@@ -12233,6 +12256,11 @@ def Dsizer(deformation,orbSizer,dId,orb,Indx):
1223312256
Vvec.Bind(wx.EVT_COMBOBOX,OnVvec)
1223412257
Indx[Vvec.GetId()] = dId
1223512258
oriSizer.Add(Vvec,0,WACV)
12259+
if 'Slater' in data['Deformations'][-dId]['Radial']:
12260+
newHarm = wx.Button(deformation,label='Add harmonic')
12261+
newHarm.Bind(wx.EVT_BUTTON,OnNewHarm)
12262+
Indx[newHarm.GetId()] = dId
12263+
oriSizer.Add(newHarm,0,WACV)
1223612264
mainSizer.Add(oriSizer)
1223712265

1223812266
orbSizer = wx.FlexGridSizer(0,9,2,2)
@@ -12272,7 +12300,7 @@ def Dsizer(deformation,orbSizer,dId,orb,Indx):
1227212300
if 'D' in item:
1227312301
nItem += 1
1227412302
Dsizer(deformation,orbSizer,dId,orb,Indx)
12275-
if nItem in [2,4,6,8,10]:
12303+
if nItem in [2,4,6,8,10,12,14]:
1227612304
for i in range(3): orbSizer.Add((5,5),0)
1227712305
for i in range(3): orbSizer.Add((5,5),0)
1227812306
continue

GSASII/GSASIIplot.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,22 +3394,25 @@ def OnKeyPress(event):
33943394
Page.canvas.draw()
33953395

33963396
#### PlotDeform ######################################################################################
3397-
def PlotDeform(G2frame,general,atName,atType,deform,UVmat,neigh):
3397+
def PlotDeform(G2frame,general,atName,atType,deform,UVmat,radial,neigh):
33983398
''' Plot deformation atoms & neighbors
33993399
'''
34003400
SHC = {}
3401-
# Nek3 = 1.0
3402-
Nek3 = 0.0
34033401
for item in deform:
3404-
if '<j0>' in item[0]:
3405-
# if 's' in item[0] or 'd' in item[0]:
3406-
# Nek3 = item[1]['Ne'][0]*item[1]['kappa'][0]**3
3407-
continue
3408-
if 'kappa' in item[1]:
3409-
kappa = item[1]['kappa'][0]
3410-
for trm in item[1]:
3411-
if 'D(' in trm:
3412-
SHC[trm.replace('D','C')] = [item[1][trm][0],True,kappa]
3402+
if 'Be' in radial and 'Sl' not in item[0]:
3403+
if '<j0>' in item[0]:
3404+
continue
3405+
if 'kappa' in item[1]:
3406+
kappa = item[1]['kappa'][0]
3407+
for trm in item[1]:
3408+
if 'D(' in trm:
3409+
SHC[trm.replace('D','C')] = [item[1][trm][0],True,kappa]
3410+
elif 'Sl' in radial and 'Sl' in item[0]:
3411+
if 'kappa' in item[1]:
3412+
kappa = item[1]['kappa'][0]
3413+
for trm in item[1]:
3414+
if 'D(' in trm:
3415+
SHC[trm.replace('D','C')] = [item[1][trm][0],True,kappa]
34133416
plotType = atName+' deformation'
34143417
G2frame.G2plotNB.Delete(plotType)
34153418
new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(plotType,'3d')
@@ -3423,7 +3426,7 @@ def PlotDeform(G2frame,general,atName,atType,deform,UVmat,neigh):
34233426
Z = 0.5*np.outer(np.ones(np.size(PHI)),npcosd(PSI))
34243427
XYZ = np.array([X.flatten(),Y.flatten(),Z.flatten()])
34253428
RAP = G2mth.Cart2Polar(XYZ[0],XYZ[1],XYZ[2])
3426-
P = np.zeros((31,31))*Nek3
3429+
P = np.zeros((31,31))
34273430
for shc in SHC:
34283431
p = 2.*SHC[shc][0]*SHC[shc][2]**3*G2lat.KslCalc(shc,RAP[1],RAP[2]).reshape((31,31))
34293432
P += p**2

0 commit comments

Comments
 (0)