コード例 #1
0
ファイル: sxrd_mult.py プロジェクト: klauer/genx
 def calc_fb(self, h, k, l):
     '''Calculate the structure factors from the bulk
     '''
     dinv = self.unit_cell.abs_hkl(h, k, l)
     x, y, z, el, u, oc, c = self.bulk._extract_values()
     oc = oc/float(len(self.bulk_sym))
     f = sxrd._get_f(self.inst, el, dinv)
     # Calculate the "shape factor" for the CTRs
     eff_thick = self.unit_cell.c/np.sin(self.inst.alpha*np.pi/180.0)
     alpha = (2.82e-5*self.inst.wavel*eff_thick/self.unit_cell.vol()*
                                           np.sum(f.imag,1))
     denom = np.exp(2.0*np.pi*1.0J*l)*np.exp(-alpha) - 1.0
     # Delta functions to remove finite size effect in hk plane
     delta_funcs=(abs(h - np.round(h)) < 1e-12)*(
         abs(k - np.round(k)) < 1e-12)
     # Sum up the uc struct factors
     f_u = np.sum(oc*f*np.exp(-2*np.pi**2*u*dinv[:, np.newaxis]**2)*
                  np.sum([np.exp(2.0*np.pi*1.0J*(
                         h[:,np.newaxis]*sym_op.trans_x(x, y) +
                         k[:,np.newaxis]*sym_op.trans_y(x, y) +
                         l[:,np.newaxis]*z [np.newaxis, :]))
                  for sym_op in self.bulk_sym], 0)
                 ,1)
     # Putting it all togheter
     fb = f_u/denom*delta_funcs
                    
     return fb
コード例 #2
0
ファイル: sxrd_mult.py プロジェクト: klauer/genx
 def calc_fslab(self, slablist, sym, h, k, l):
     '''Calculate the structure factors from the bulk
     '''
     dinv = self.unit_cell.abs_hkl(h, k, l)
     x, y, z, u, oc, el, t_lay = self._extract_slab_values(slablist, 
                                                           sym)
     oc = oc/float(len(sym))
     f = sxrd._get_f(self.inst, el, dinv)
     # Sum up the uc struct factors
     f_u = np.sum(oc*f*np.exp(-2*np.pi**2*u*dinv[:, np.newaxis]**2)*
                  np.sum([np.exp(2.0*np.pi*1.0J*(
                         h[:,np.newaxis]*sym_op.trans_x(x, y) +
                         k[:,np.newaxis]*sym_op.trans_y(x, y) +
                         l[:,np.newaxis]*z [np.newaxis, :]))
                  for sym_op in sym], 0)
                 ,1)
     #return f_u, (z.max() - z.min())*np.ones(l.shape)
     return f_u, t_lay*np.ones(l.shape)