Skip to content

Commit e5f36a1

Browse files
committed
fixes for deformation stuff
1 parent b8bad92 commit e5f36a1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7992,9 +7992,9 @@ def ClearFrozen(event):
79927992
G2frame.dataWindow.SetDataSize()
79937993
# G2frame.SendSizeEvent()
79947994

7995-
#### Main PWDR panel ########################################################
7995+
#### Main PWDR & HKLF panel ########################################################
79967996
def UpdatePWHKPlot(G2frame,kind,item):
7997-
'''Called when the histogram main tree entry is called. Displays the
7997+
'''Called when the PWDR & HKLF histogram main tree entry is called. Displays the
79987998
histogram weight factor, refinement statistics for the histogram
79997999
and the range of data for a simulation.
80008000

GSASII/GSASIIlattice.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,8 +2989,8 @@ def SetUVvec(Neigh):
29892989
return UVvec,UVchoice
29902990

29912991
def SHarmcal(SytSym,SHFln,psi,gam):
2992-
'''Perform a surface spherical harmonics computation.
2993-
Presently only used for plotting
2992+
'''Perform a surface spherical harmonics computation & return sum of squares.
2993+
Only used for plotting
29942994
Note that the the number of gam values must either be 1 or must match psi
29952995
29962996
:param str SytSym: site symmetry - only looking for cubics
@@ -3008,9 +3008,8 @@ def SHarmcal(SytSym,SHFln,psi,gam):
30083008
if SytSym in ['m3m','m3','43m','432','23'] or 'c' in trm:
30093009
Ksl = CubicSHarm(l,m,psi,gam)
30103010
else:
3011-
# p = SHFln[term][2]
30123011
Ksl = SphHarmAng(l,m,1.0,psi,gam)
3013-
SHVal += SHFln[term][0]*Ksl
3012+
SHVal += (SHFln[term][0]*Ksl)**2
30143013
return SHVal
30153014

30163015
def KslCalc(trm,psi,gam):

GSASII/GSASIIplot.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,6 +3492,7 @@ def OnKeyPress(event):
34923492
def PlotDeform(G2frame,general,atName,atType,deform,UVmat,radial,neigh):
34933493
''' Plot deformation atoms & neighbors
34943494
'''
3495+
Bohr = 0.529177
34953496
SHC = {}
34963497
for item in deform:
34973498
if 'Be' in radial and 'Sl' not in item[0]:
@@ -3526,8 +3527,8 @@ def PlotDeform(G2frame,general,atName,atType,deform,UVmat,radial,neigh):
35263527
p = 2.*SHC[shc][0]*SHC[shc][2]**3*(G2lat.KslCalc(shc,RAP[1],RAP[2])**2).reshape((31,31))
35273528
P += p
35283529
if not np.any(P):
3529-
P = np.ones((31,31))
3530-
# P *= P
3530+
P = np.zeros((31,31))
3531+
P += Bohr
35313532
color = np.array(general['Color'][general['AtomTypes'].index(atType)])/255.
35323533
Plot.plot_surface(X*P,Y*P,Z*P,rstride=1,cstride=1,color=color,linewidth=1)
35333534
for atm in neigh[0]:
@@ -7363,12 +7364,12 @@ def Draw(caller='',Fade=[],NPkey=False):
73637364
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
73647365
SGC = G2lat.CrysM2CartM(Amat,Bmat,SGM)
73657366
UVMat = np.inner(defCtrls['UVmat'],SGC)
7366-
Npsi,Ngam = 90,45
7367+
Npsi,Ngam = 91,46
73677368
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
7368-
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 incl
7369-
GAM = GAM.flatten()*180./Ngam #polar 0-180 incl
7369+
PSI = PSI.flatten()*360./(Npsi-1) #azimuth 0-360 incl
7370+
GAM = GAM.flatten()*180./(Ngam-1) #polar 0-180 incl
73707371
Rp,PSIp,GAMp = G2mth.RotPolbyM(np.ones_like(PSI),PSI,GAM,UVMat) #TODO: needs symmetry operation for equiv. positions
7371-
P = G2lat.SHarmcal(SytSym,SHC,PSIp,GAMp).reshape((Npsi,Ngam))**2
7372+
P = G2lat.SHarmcal(SytSym,SHC,PSIp,GAMp).reshape((Npsi,Ngam))
73727373
if np.min(P) < np.max(P):
73737374
P = (P-np.min(P))/(np.max(P)-np.min(P))
73747375
RenderTextureSphere(x,y,z,radius,atcolor,shape=[Npsi,Ngam],Texture=P.T,ifFade=False)

0 commit comments

Comments
 (0)