Skip to content

Commit 1260aa9

Browse files
committed
make defo complex for proper calculation. Defo imag derivs not correct yet.
1 parent 14a8d7b commit 1260aa9

3 files changed

Lines changed: 117 additions & 94 deletions

File tree

GSASII/GSASIIconstrGUI.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,11 +1444,17 @@ def UpdateConstraintPanel(panel,typ):
14441444
btn = wx.Button(panel, wx.ID_ANY, 'Show Errors')
14451445
btn.Bind(wx.EVT_BUTTON,lambda event: G2G.ShowScrolledInfo(panel,errmsg,header='Error info'))
14461446
butSizer.Add(btn,0,wx.ALIGN_CENTER_VERTICAL)
1447-
btn.Enable(len(errmsg) > 0)
1447+
try:
1448+
btn.Enable(len(errmsg) > 0)
1449+
except NameError:
1450+
pass
14481451
btn = wx.Button(panel, wx.ID_ANY, 'Show Warnings')
14491452
butSizer.Add(btn,0,wx.ALIGN_CENTER_VERTICAL)
14501453
btn.Bind(wx.EVT_BUTTON,lambda event: G2G.ShowScrolledInfo(panel,warnmsg.replace('&','&&')))
1451-
btn.Enable(len(warnmsg) > 0)
1454+
try:
1455+
btn.Enable(len(warnmsg) > 0)
1456+
except NameError:
1457+
pass
14521458
btn = wx.Button(panel, wx.ID_ANY, 'Show generated constraints')
14531459
butSizer.Add(btn,0,wx.ALIGN_CENTER_VERTICAL)
14541460
txt = G2mv.VarRemapShow(linelen=999).replace('&','&&')

GSASII/GSASIIlattice.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,7 +2991,7 @@ def SHarmcal(SytSym,SHFln,psi,gam):
29912991
SHVal += (SHFln[term][0]*Ksl)
29922992
return SHVal
29932993

2994-
def KslCalc(trm,psi,gam,RI=False):
2994+
def KslCalc(trm,psi,gam):
29952995
'''Compute one angular part term in spherical harmonics
29962996
29972997
:param str trm:sp. harm term name in the form of 'C(l,m)' or 'C(l,m)c' for cubic
@@ -3002,21 +3002,9 @@ def KslCalc(trm,psi,gam,RI=False):
30023002
'''
30033003
l,m = eval(trm.strip('C').strip('c'))
30043004
if 'c' in trm:
3005-
if not RI:
3006-
return CubicSHarm(l,m,psi,gam)
3007-
else:
3008-
return CubicSHarm(l,m,psi,gam),0.0
3009-
3005+
return CubicSHarm(l,m,psi,gam)
30103006
else:
3011-
if not RI:
3012-
return SphHarmAng(l,m,1.0,psi,gam)
3013-
else:
3014-
try:
3015-
#### TODO: this will be deprecated in scipy 1.17.0
3016-
ylmp = SQ2*spsp.sph_harm(m,l,rpd*psi,rpd*gam)*(-1)**m #wants radians; order then degree
3017-
except AttributeError: #new one sph_harm_y in scipy 1.15.1 but buggy?
3018-
ylmp = SQ2*spsp.sph_harm_y(l,m,rpd*psi,rpd*gam)*(-1)**m #order L,M makes more sense
3019-
return np.real(ylmp),np.imag(ylmp)
3007+
return SphHarmAng(l,m,1.0,psi,gam)
30203008

30213009
def SphHarmAng(L,M,P,Th,Ph):
30223010
''' Compute spherical harmonics values using scipy.special.sph_harm

0 commit comments

Comments
 (0)