Skip to content

Commit 7291f2e

Browse files
committed
Allow H/D selection for atom site fraction apportioning
change to spin RB calc
1 parent f0afffd commit 7291f2e

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5201,7 +5201,7 @@ def AtomModify(event):
52015201
if dlg.ShowModal() == wx.ID_OK:
52025202
parm = dlg.GetValue()
52035203
for r in indx:
5204-
if not Atoms.IsReadOnly(r,0): #not if in RB!
5204+
# if not Atoms.IsReadOnly(r,0): #not if in RB!
52055205
atomData[r][cid] = parm
52065206
SetupGeneral()
52075207
FillAtomsGrid(Atoms)
@@ -5572,13 +5572,15 @@ def OnFracSplit(event):
55725572
cx,ct,cs,ci = G2mth.getAtomPtrs(data)
55735573
indx = getAtomSelections(Atoms,ct-1)
55745574
if indx:
5575+
B2 = {}
55755576
atomData = data['Atoms']
55765577
PE = G2elemGUI.PickElement(G2frame,oneOnly=True)
55775578
if PE.ShowModal() == wx.ID_OK:
55785579
Atype2 = PE.Elem.strip()
55795580
AtomInfo2 = G2elem.GetAtomInfo(Atype2)
55805581
FF2 = G2elem.GetFFtable([Atype2])[Atype2]
5581-
B2 = AtomInfo2['Isotopes']['Nat. Abund.']['SL'][0]
5582+
for iso in AtomInfo2['Isotopes']:
5583+
B2[iso] = AtomInfo2['Isotopes'][iso]['SL'][0]
55825584
PE.Destroy()
55835585
SQ = 0.0
55845586
PE2 = G2G.SingleFloatDialog(G2frame,'form factor','Enter sinth/lam for atom frac split',SQ)
@@ -5588,24 +5590,36 @@ def OnFracSplit(event):
55885590
ff2 = G2elem.ScatFac(FF2,SQ**2)
55895591
print(' X-ray site fractions for sin(th)/lam = %.3f'%SQ)
55905592
for ind in indx:
5591-
Aname1 = atomData[ind][ct-1]
5592-
Atype1 = G2elem.FixValence(atomData[ind][ct])
5593-
Afrac = atomData[ind][cx+3]
5594-
Amult = float(atomData[ind][cx+5])
5595-
AtomInfo1 = G2elem.GetAtomInfo(Atype1)
5596-
if Atype1 == Atype2:
5597-
print('ERROR - 2nd atom type must be different from selected atom')
5598-
continue
5599-
FF1 = G2elem.GetFFtable([Atype1])[Atype1]
5600-
ff1 = G2elem.ScatFac(FF1,SQ**2)
5601-
B1 = AtomInfo1['Isotopes']['Nat. Abund.']['SL'][0]
5593+
Aname1 = atomData[ind][ct-1]
5594+
Atype1 = G2elem.FixValence(atomData[ind][ct])
5595+
if Atype1 == 'Q':
5596+
PE = G2elemGUI.PickElement(G2frame,oneOnly=False)
5597+
if PE.ShowModal() == wx.ID_OK:
5598+
Atype1 = PE.Elem.strip()
5599+
PE.Destroy()
5600+
Afrac = atomData[ind][cx+3]
5601+
Amult = float(atomData[ind][cx+5])
5602+
AtomInfo1 = G2elem.GetAtomInfo(Atype1)
5603+
if Atype1 == Atype2:
5604+
print('ERROR - 2nd atom type must be different from selected atom')
5605+
continue
5606+
FF1 = G2elem.GetFFtable([Atype1])[Atype1]
5607+
ff1 = G2elem.ScatFac(FF1,SQ**2)
5608+
if ff1 != ff2:
56025609
frac1 = (ff1*Afrac-ff2)/(ff1-ff2)
5603-
bfrac1 = (B1*Afrac-B2)/(B1-B2)
56045610
print(' For %s: X-ray based site fractions %s = %.3f, %.3f/cell; %s = %.3f, %.3f/cell' \
5605-
%(Aname1,Atype1,frac1,frac1*Amult,Atype2,(1.-frac1),(1.-frac1)*Amult))
5606-
print(' neutron based site fractions %s = %.3f, %.3f/cell; %s = %.3f, %.3f/cell\n' \
5607-
%(Atype1,bfrac1,bfrac1*Amult,Atype2,(1.-bfrac1),(1.-bfrac1)*Amult))
5608-
5611+
%(Aname1,Atype1,frac1,frac1*Amult,Atype2,(1.-frac1),(1.-frac1)*Amult))
5612+
5613+
B1 = AtomInfo1['Isotopes']['Nat. Abund.']['SL'][0]
5614+
for iso in B2:
5615+
if B1 != B2[iso]:
5616+
bfrac1 = (B1*Afrac-B2[iso])/(B1-B2[iso])
5617+
atype2 = Atype2
5618+
if 'nat' not in iso:
5619+
atype2 += '_%s'%iso
5620+
print(' neutron based site fractions %s = %.3f, %.3f/cell; %s = %.3f, %.3f/cell' \
5621+
%(Atype1,bfrac1,bfrac1*Amult,atype2,(1.-bfrac1),(1.-bfrac1)*Amult))
5622+
56095623
def OnValidProtein(event):
56105624

56115625
def pickHandler(resName):

GSASII/GSASIIstrMath.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,9 @@ def MakePolar(Orient,QB):
453453

454454
dFFdS = {}
455455
atFlg = []
456-
# R,Th,Ph = G2lat.H2ThPh2(np.reshape(HKL,(-1,3)),Bmat)
457456
SQR = np.repeat(SQ,HKL.shape[1])
458457
for iAt,Atype in enumerate(Tdata):
459-
if 'Q' in Atype:
460-
# R,Th,Ph = G2lat.H2ThPh2(np.reshape(HKL,(-1,3)),Bmat)
458+
if 'Q' in Atype: #spinning RB
461459
atFlg.append(1.0)
462460
SHdat = SHCdict[iAt]
463461
symAxis = np.array(SHdat['symAxis'])
@@ -527,7 +525,7 @@ def MakePolar(Orient,QB):
527525
SHMk = G2lat.KslCalc(item,ThMk,PhMk)
528526
BS = 1.0
529527
if 'Q' in Atm:
530-
BS = sp.spherical_jn(l,1.0) #Slater term here?
528+
BS = sp.spherical_jn(l,1.0)/(4.*np.pi) #Slater term here?
531529
else:
532530
BS = sp.spherical_jn(l,QR*R)/(4.*np.pi) #Bessel function
533531
BSP = sp.spherical_jn(l,QR*(R+0.01))/(4.*np.pi)
@@ -547,7 +545,7 @@ def MakePolar(Orient,QB):
547545
dFFdS[Oiname] = dSHdOi
548546
dFFdS[Ojname] = dSHdOj
549547
dFFdS[Okname] = dSHdOk
550-
elif iAt in SHCdict and 'X' in hType:
548+
elif iAt in SHCdict and 'X' in hType: #X-ray deformation
551549
radial = SHCdict[-iAt]['Radial']
552550
orKeys = [item for item in ORBtables[Atype] if item not in ['Slater','ZSlater','NSlater','SZE','popCore','popVal']]
553551
if 'B' in radial:

0 commit comments

Comments
 (0)