Skip to content

Commit 4b9f952

Browse files
committed
fix bug in reflectometry data
implement drawing of deformation surface on ball like atoms - not complete
1 parent adefe19 commit 4b9f952

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12186,6 +12186,16 @@ def OnDelHarm(event):
1218612186
del Harm[1][item]
1218712187
wx.CallAfter(UpdateDeformation,dId)
1218812188

12189+
def OnShowDef(event):
12190+
dId = Indx[event.GetEventObject().GetId()]
12191+
deformationData[-dId]['showDef'] = not deformationData[-dId]['showDef']
12192+
G2plt.PlotStructure(G2frame,data)
12193+
12194+
def OnAtCol(event):
12195+
dId = Indx[event.GetEventObject().GetId()]
12196+
deformationData[-dId]['atColor'] = not deformationData[-dId]['atColor']
12197+
G2plt.PlotStructure(G2frame,data)
12198+
1218912199
# UpdateDeformation executable code starts here
1219012200
alpha = ['A','B','C','D','E','F','G','H',]
1219112201
generalData = data['General']
@@ -12246,6 +12256,18 @@ def OnDelHarm(event):
1224612256
plotAtm.Bind(wx.EVT_BUTTON,OnPlotAtm)
1224712257
Indx[plotAtm.GetId()] = dId
1224812258
lineSizer.Add(plotAtm,0,WACV)
12259+
deformationData[-dId]['showDef'] = deformationData[-dId].get('showDef',False)
12260+
deformationData[-dId]['atColor'] = deformationData[-dId].get('atColor',True)
12261+
showDef = wx.CheckBox(deformation,label='show def.?')
12262+
showDef.SetValue(deformationData[-dId]['showDef'])
12263+
Indx[showDef.GetId()] = dId
12264+
showDef.Bind(wx.EVT_CHECKBOX,OnShowDef)
12265+
lineSizer.Add(showDef,0,WACV)
12266+
atCol = wx.CheckBox(deformation,label='use atom colors?')
12267+
atCol.SetValue(deformationData[-dId]['atColor'])
12268+
Indx[atCol.GetId()] = dId
12269+
atCol.Bind(wx.EVT_CHECKBOX,OnAtCol)
12270+
lineSizer.Add(atCol,0,WACV)
1224912271
delAtm = wx.Button(deformation,label='Delete')
1225012272
delAtm.Bind(wx.EVT_BUTTON,OnDelAtm)
1225112273
Indx[delAtm.GetId()] = dId

GSASII/GSASIIplot.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7204,13 +7204,6 @@ def Draw(caller='',Fade=[],NPkey=False):
72047204
radius = ballScale*drawingData['sizeH']
72057205
else:
72067206
radius = 0.0
7207-
# elif 'Q' in atom[ct]: #spinning rigid body - set shell color
7208-
# for Srb in RBdata.get('Spin',[]):
7209-
# if Srb == generalData['SpnIds'][atom[ci]]:
7210-
# fade = True
7211-
# Info = G2elem.GetAtomInfo(RBdata['Spin'][Srb]['atType'])
7212-
# atColor = [Info['Color'],]
7213-
# break
72147207
else:
72157208
if 'vdW' in atom[cs]:
72167209
radius = vdwScale*vdWRadii[atNum]
@@ -7254,7 +7247,33 @@ def Draw(caller='',Fade=[],NPkey=False):
72547247
else:
72557248
RenderSphere(x,y,z,radius[ish][0],atColor[ish],True,shape=[60,30])
72567249
else:
7257-
RenderSphere(x,y,z,radius,atColor)
7250+
#### put deformation texture on sphere here
7251+
if atom[ci] in deformationData:
7252+
defCtrls = deformationData[-atom[ci]]
7253+
defParms = deformationData[atom[ci]]
7254+
SytSym = G2spc.SytSym(atom[cx:cx+3],SGData)[0]
7255+
if defCtrls.get('showDef',False):
7256+
useAtColor = defCtrls.get('atColor',True)
7257+
atcolor = None
7258+
if useAtColor:
7259+
atcolor = atColor*255
7260+
if defCtrls['Radial'] == 'Slater':
7261+
SHC = defParms[0][1]
7262+
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
7263+
UVMat = defCtrls['UVmat']
7264+
Npsi,Ngam = 90,45
7265+
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
7266+
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 ncl
7267+
GAM = GAM.flatten()*180./Ngam #polar 0-180 incl
7268+
Rp,PSIp,GAMp = G2mth.RotPolbyM(np.ones_like(PSI),PSI,GAM,UVMat)
7269+
P = G2lat.SHarmcal(SytSym,SHC,PSIp,GAMp).reshape((Npsi,Ngam))
7270+
if np.min(P) < np.max(P):
7271+
P = (P-np.min(P))/(np.max(P)-np.min(P))
7272+
RenderTextureSphere(x,y,z,radius,atcolor,shape=[Npsi,Ngam],Texture=P.T,ifFade=False)
7273+
else:
7274+
RenderSphere(x,y,z,radius,atColor)
7275+
else:
7276+
RenderSphere(x,y,z,radius,atColor)
72587277
if 'sticks' in atom[cs]:
72597278
RenderBonds(x,y,z,Bonds,bondR,bndColor)
72607279
elif 'ellipsoids' in atom[cs]:
@@ -7540,7 +7559,7 @@ def OnFocus(event):
75407559
mcsaTypes = np.reshape(mcsaTypes,(nuniq*neqv))
75417560
mcsaBonds = FindPeaksBonds(mcsaXYZ)
75427561
drawAtoms = drawingData.get('Atoms',[])
7543-
7562+
deformationData = data.get('Deformations',{})
75447563
mapData = {'MapType':False, 'rho':[]}
75457564
showBonds = False
75467565
if 'Map' in generalData:

GSASII/GSASIIpwdplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ def onPartialConfig(event):
17091709
G2frame.dataWindow.moveDiffCurve.Enable(False)
17101710
G2frame.dataWindow.moveTickLoc.Enable(False)
17111711
G2frame.dataWindow.moveTickSpc.Enable(False)
1712-
elif 'SAS' in plottype:
1712+
elif plottype in ['SASD','REFD']:
17131713
Page.phaseList = Phases = []
17141714
elif G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Reflection Lists','Limits']:
17151715
# get reflection positions for other places where they are displayed

0 commit comments

Comments
 (0)