Skip to content

Commit d9dbfea

Browse files
committed
defo geometry fixes
1 parent 5e1207e commit d9dbfea

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

GSASII/GSASIIphsGUI2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def OnVvec(event):
332332
Obj.SetValue(deformationData[-dId]['V'])
333333
G2G.G2MessageBox(G2frame,'ERROR: V-vector zero or parallel to U','Invalid vector choice')
334334
return
335-
if nl.det(UVmat) < 0.: #ensure right hand
335+
if nl.det(UVmat) < 0.: #insure right hand
336336
UVmat *= -1.
337337
deformationData[-dId]['V'] = Obj.GetValue()
338338
data['Deformations'][-dId]['UVmat'] = UVmat
@@ -343,7 +343,7 @@ def OnAtSel(event):
343343
wx.CallAfter(UpdateDeformation,G2frame,data,dId)
344344

345345
def Kappa(deformation,orbSizer,dId,orb,kname,Indx):
346-
orbSizer.Add(G2G.ValidatedTxtCtrl(deformation,orb[1][kname],0,nDig=(8,3),xmin=0.5,xmax=1.5))
346+
orbSizer.Add(G2G.ValidatedTxtCtrl(deformation,orb[1][kname],0,nDig=(8,3),xmin=0.5,xmax=3.0))
347347
Tcheck = wx.CheckBox(deformation,-1,'Refine?')
348348
Tcheck.SetValue(orb[1][kname][1])
349349
Tcheck.Bind(wx.EVT_CHECKBOX,OnDeformRef)
@@ -618,6 +618,7 @@ def OnAtCol(event):
618618
for i in range(nB): orbSizer.Add((5,5),0)
619619
Dsizer(deformation,orbSizer,Names,dId,orb,Indx)
620620
mainSizer.Add(orbSizer)
621+
G2frame.GetStatusBar().SetStatusText('On plot: RGB = XYZ',1)
621622

622623
G2phsG.SetPhaseWindow(deformation,mainSizer)
623624

GSASII/GSASIIplot.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6747,6 +6747,34 @@ def RenderRBtriplet(orig,Q,Bmat,symAxis=None):
67476747
GL.glDisable(GL.GL_COLOR_MATERIAL)
67486748
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1])
67496749

6750+
def RenderTriplet(orig,Rmat,Bmat):
6751+
'''draw an axes triplet located at the origin of a deformation atom
6752+
and with the x, y & z axes drawn as red, green and blue.
6753+
'''
6754+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.7,.7,.7,1])
6755+
GL.glEnable(GL.GL_COLOR_MATERIAL)
6756+
GL.glLineWidth(3)
6757+
GL.glEnable(GL.GL_BLEND)
6758+
GL.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA)
6759+
GL.glEnable(GL.GL_LINE_SMOOTH)
6760+
GL.glPushMatrix()
6761+
GL.glTranslate(*orig)
6762+
GL.glBegin(GL.GL_LINES)
6763+
lines = np.inner(np.inner(np.eye(3),Rmat),Bmat)*.75
6764+
colors = [Rd,Gr,Bl]
6765+
# lines along axial directions
6766+
for line,color in zip(lines,colors):
6767+
GL.glColor3ubv(color)
6768+
GL.glVertex3fv(np.zeros(3))
6769+
GL.glVertex3fv(line)
6770+
GL.glEnd()
6771+
GL.glPopMatrix()
6772+
GL.glColor4ubv([0,0,0,0])
6773+
GL.glDisable(GL.GL_LINE_SMOOTH)
6774+
GL.glDisable(GL.GL_BLEND)
6775+
GL.glDisable(GL.GL_COLOR_MATERIAL)
6776+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1])
6777+
67506778
def RenderPlane(plane,color):
67516779
fade = list(color) + [.25,]
67526780
GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_AMBIENT_AND_DIFFUSE,fade)
@@ -7351,11 +7379,13 @@ def Draw(caller='',Fade=[],NPkey=False):
73517379
atcolor = atColor*255
73527380
defParms = deformationData[atom[ci]]
73537381
SytSym = G2spc.SytSym(atom[cx:cx+3],SGData)[0]
7354-
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73557382
SHC = defParms[0][1]
73567383
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
7384+
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73577385
SGC = nl.inv(G2lat.CrysM2CartM(Amat,Bmat,SGM))
73587386
UVMat = np.inner(defCtrls['UVmat'],SGC.T)
7387+
UVMat1 = np.inner(defCtrls['UVmat'].T,SGC.T).T
7388+
RenderTriplet([x,y,z],UVMat1,Bmat)
73597389
Npsi,Ngam = 60,30
73607390
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
73617391
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 incl

0 commit comments

Comments
 (0)