@@ -428,7 +428,7 @@ def extendChanges(prms):
428428 RBsu [k ] = np .sqrt (np .inner (Avec .T ,np .inner (covMatrix ,Avec )))
429429 return RBsu
430430
431- def MakeSpHarmFF (HKL ,Bmat ,SHCdict ,Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ,ifDeriv = False ):
431+ def MakeSpHarmFF (HKL ,Amat , Bmat ,SHCdict ,Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ,ifDeriv = False ):
432432 ''' Computes hkl dependent form factors & derivatives from spinning rigid bodies
433433 :param array HKL: reflection hkl set to be considered
434434 :param array Bmat: inv crystal to Cartesian transfomation matrix
@@ -555,7 +555,8 @@ def MakePolar(Orient,QB):
555555 orKeys = [item for item in orKeys if 'Sl' in item ]
556556 orbs = SHCdict [iAt ]
557557 UVmat = np .inner (nl .inv (SHCdict [- iAt ]['UVmat' ]),Bmat )
558- Th ,Ph = G2lat .H2ThPh (np .reshape (HKL ,(- 1 ,3 )),UVmat ,[1. ,0. ,0. ,1. ])
558+ R ,Th ,Ph = G2lat .H2ThPh2 (np .reshape (HKL ,(- 1 ,3 )),UVmat )
559+ R = 1 / R # correct dspacings
559560 atFlg .append (1.0 )
560561 orbTable = ORBtables [Atype ][orKeys [0 ]] # should point at either Sl core or a Bessel core
561562 ffOrb = {item :orbTable [item ] for item in orbTable if item not in ['Slater' ,'ZSlater' ,'NSlater' ,'SZE' ,'popCore' ,'popVal' ]}
@@ -1214,7 +1215,7 @@ def StructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict):
12141215 #FF has to have the Bessel*Sph.Har.*atm form factor for each refletion in Uniq for Q atoms; otherwise just normal FF
12151216 #this must be done here. NB: same place for non-spherical atoms; same math except no Bessel part.
12161217 if pfx in SHCdict :
1217- MakeSpHarmFF (Uniq ,Bmat ,SHCdict [pfx ],Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ) #Not Amat!
1218+ MakeSpHarmFF (Uniq ,Amat , Bmat ,SHCdict [pfx ],Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ) #Not Amat!
12181219 Bab = np .repeat (parmDict [phfx + 'BabA' ]* np .exp (- parmDict [phfx + 'BabU' ]* SQfactor ),len (SGT )* len (TwinLaw ))
12191220 if 'T' in calcControls [hfx + 'histType' ]: #fa,fb are 2 X blkSize X nTwin X nOps x nAtoms
12201221 fa = np .array ([np .reshape (((FF + FP ).T - Bab ).T ,cosp .shape )* cosp * Tcorr ,- np .reshape (Flack * FPP ,sinp .shape )* sinp * Tcorr ])
@@ -1337,7 +1338,7 @@ def StructureFactorDerv2(refDict,G,hfx,pfx,SGData,calcControls,parmDict):
13371338 Hij = np .array ([Mast * np .multiply .outer (U ,U ) for U in np .reshape (Uniq ,(- 1 ,3 ))]) #Nref*Nops,3,3
13381339 Hij = np .reshape (np .array ([G2lat .UijtoU6 (uij ) for uij in Hij ]),(- 1 ,len (SGT ),6 )) #Nref,Nops,6
13391340 if pfx in SHCdict :
1340- dffdsh ,atFlg = MakeSpHarmFF (Uniq ,Bmat ,SHCdict [pfx ],Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ,True )
1341+ dffdsh ,atFlg = MakeSpHarmFF (Uniq ,Amat , Bmat ,SHCdict [pfx ],Tdata ,hType ,FFtables ,ORBtables ,BLtables ,FF ,SQ ,True )
13411342 if len (dffdSH ):
13421343 for item in dffdSH :
13431344 dffdSH [item ] = np .concatenate ((dffdSH [item ],dffdsh [item ]))
0 commit comments