Skip to content

Commit fbc65e0

Browse files
committed
fix valence issue in making F000E
1 parent 297961a commit fbc65e0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

GSASII/GSASIIElem.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ def CheckElement(El):
241241
return True
242242
else:
243243
return False
244+
def StripValence(El):
245+
'Returns element symbol without valence'
246+
if '+' in El:
247+
return El.split('+')[0]
248+
elif '-' in El:
249+
return El.split('-')[0]
250+
else:
251+
return El
244252

245253
def FixValence(El):
246254
'Returns the element symbol, even when a valence is present'
@@ -906,13 +914,13 @@ def SetupGeneral(data, dirname):
906914
F000X = 0.
907915
F000N = 0.
908916
F000E = 0.
909-
EFFtables = GetEFFtable(generalData['AtomTypes']) # broken for charged species
917+
ElTypes = [StripValence(elem) for elem in generalData['AtomTypes']]
918+
EFFtables = GetEFFtable(ElTypes) # broken for charged species
910919
for i,elem in enumerate(generalData['AtomTypes']):
911920
F000X += generalData['NoAtoms'][elem]*generalData['Z']
912921
isotope = generalData['Isotope'][elem]
913922
F000N += generalData['NoAtoms'][elem]*generalData['Isotopes'][elem][isotope]['SL'][0]
914-
if elem in EFFtables:
915-
F000E += generalData['NoAtoms'][elem]*ScatFac(EFFtables[elem],0.)[0]
923+
F000E += generalData['NoAtoms'][elem]*ScatFac(EFFtables[StripValence(elem)],0.)[0]
916924
generalData['F000X'] = F000X
917925
generalData['F000N'] = F000N
918926
generalData['F000E'] = F000E

0 commit comments

Comments
 (0)