Skip to content

Commit 3e41e00

Browse files
committed
fix to Slater deformation calc - now seems to work
1 parent 22f94e0 commit 3e41e00

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

GSASII/GSASIIstrMath.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,9 @@ def MakePolar(Orient,QB):
552552
atFlg.append(1.0)
553553
orbTable = ORBtables[Atype][orKeys[0]] # should point at either Sl core or a Bessel core
554554
ffOrb = {item:orbTable[item] for item in orbTable if item not in ['Slater','ZSlater','NSlater','SZE','popCore','popVal']}
555-
FFcore = G2el.ScatFac(ffOrb,SQR) #core
556-
FFtot = np.zeros_like(FFcore)
555+
print(iAt,orKeys,orbs)
556+
FFcore = G2el.ScatFac(ffOrb,SQR) #core; same for Sl & Be
557+
FFval = np.zeros_like(FFcore)
557558
for orb in orbs:
558559
if 'UVmat' in orb or 'Radial' in orb: #problem of orb = '0'
559560
continue
@@ -565,35 +566,33 @@ def MakePolar(Orient,QB):
565566
orbTable = ORBtables[Atype][orKeys[int(orb)]]
566567
ffOrb = {item:orbTable[item] for item in orbTable if item not in ['Slater','ZSlater','NSlater','SZE','popCore','popVal']}
567568
ff = Ne*G2el.ScatFac(ffOrb,SQk)
569+
# print(orb,ff[:20])
568570
dffdk = G2el.ScatFacDer(ffOrb,SQk)
569571
dSH = 0.0
570-
if '<j0>' in orKeys[int(orb)]:
571-
dSH = 1.0
572-
for term in orbs[orb]:
573-
if 'B' in radial: #'Bessel'
572+
if 'B' in radial: #'Bessel' - works ok, I think
573+
if '<j0>' in orKeys[int(orb)]:
574+
dSH = 1.0
575+
for term in orbs[orb]:
574576
if 'D(' in term:
575577
item = term.replace('D','C')
576578
SH = G2lat.KslCalc(item,Th,Ph)
577-
FFtot += SH*orbs[orb][term]*ff
579+
FFval += SH*orbs[orb][term]*ff
578580
name = 'A%s%s:%d'%(term,orb,iAt)
579581
dFFdS[name] = SH*ff
580582
dSH += SH*orbs[orb][term]
581583
elif 'Ne' in term:
582584
name = 'ANe%s:%d'%(orb,iAt)
583585
dFFdS[name] = ff/Ne
584-
if 'j0' in orKeys[int(orb)]:
585-
FFtot += ff
586-
else: #'Slater'
587-
if 'Ne' in term:
588-
name = 'ANe%s:%d'%(orb,iAt)
589-
dFFdS[name] = ff/Ne
590-
if 'core' in orKeys[int(orb)] or 's' in orKeys[int(orb)]:
591-
FFtot += ff
592-
continue
593-
elif 'D(' in term:
586+
FFval += ff
587+
else: #'Slater'
588+
name = 'ANe%s:%d'%(orb,iAt)
589+
dFFdS[name] = ff/Ne
590+
FFval += ff
591+
for term in orbs[orb]:
592+
if 'D(' in term: #skip 'Ne'
594593
item = term.replace('D','C')
595594
SH = G2lat.KslCalc(item,Th,Ph)
596-
FFtot += SH*orbs[orb][term]*ff
595+
FFval += SH*orbs[orb][term]*ff
597596
name = 'A%s%s:%d'%(term,orb,iAt)
598597
dFFdS[name] = SH*ff
599598
dSH += SH*orbs[orb][term]
@@ -602,7 +601,8 @@ def MakePolar(Orient,QB):
602601
dFFdS[name] += -2.0*Ne*SQk*dSH*dffdk/kappa
603602
else:
604603
dFFdS[name] = -2.0*Ne*SQk*dSH*dffdk/kappa
605-
FF[:,iAt] = FFcore+FFtot
604+
print(FFval[:20])
605+
FF[:,iAt] = FFcore+FFval
606606
else:
607607
atFlg.append(0.)
608608
if ifDeriv:

0 commit comments

Comments
 (0)