1
2
3
4
5
6
7 '''
8 Structure class and function for operating on it
9
10 Treats the ordering of features along a two dimentional rectilinear lattice
11 structure with the born approximation providing the scattering resulting from
12 a rectilinear lattice of particles on a substrate
13
14 '''
15
16
17 from numpy import shape,ones,sin,empty
19 '''
20 This contains variables to define the sample rectilinear lattice
21
22 Dx,Dy (Angstrom)
23 width,length of a single unit cell
24 nx,ny (integer)
25 number of repeat unit cells in x,y direction
26
27 '''
28 - def __init__(self,Dx = None,Dy = None,nx = 50, ny = None):
29 '''
30 Dy defaults to Dx
31 ny defaults to nx
32 '''
33 self.Dx = Dx
34 self.Dy = Dy if Dy is not None else Dx
35 self.nx = nx
36 self.ny = ny if ny is not None else nx
37
38 - def eval(self,qx,qy,qz):
39
40 RIFz = ones(qz.shape);
41 RIFxyz = empty([len(qx),len(qy),len(qz)],'d')
42
43 for i,qxi in enumerate(qx):
44 for j,qyj in enumerate(qy):
45
46
47 RIFxi = par_lattice(qxi,self.Dx,self.nx)
48 RIFyj = par_lattice(qyj,self.Dy,self.ny)
49 RIFxz = RIFxi * RIFz
50 RIFxyz[i,j,:] = RIFxz * RIFyj
51
52 return RIFxyz
53
55
56 RIFz = ones(qz.shape);
57 RIFxyz = empty([len(qx),len(qy),len(qz)],'d')
58
59 for i,qxi in enumerate(qx):
60 for j,qyj in enumerate(qy):
61
62
63 RIFxi = par_lattice(qxi,struc.Dx,struc.nx)
64 RIFyj = par_lattice(qyj,struc.Dy,struc.ny)
65 RIFxz = RIFxi * RIFz
66 RIFxyz[i,j,:] = RIFxz * RIFyj
67
68 return RIFxyz
69
71 """
72 Attempts to Calculate the Structure Factor of the sin portion of chucks
73 equations.
74 """
75
76 if q == 0:
77 RIF = domain**2
78 else:
79 RIF = (sin((q*lattice_param*domain)/2)) / (sin((q*lattice_param)/2))
80
81 return RIF
82
83
84
85
87 from numpy import array
88 s = Rectilinear(nx = 12)
89 assert s.ny == 12, "expected ny = nx"
90
91 lattice = Rectilinear(Dx = 3, nx = 2)
92 qx,qy,qz = array([1]),array([1]),array([1])
93 v = structure_loop(qx,qy,qz,lattice)
94 v = lattice.eval(qx,qy,qz)
95
96 c = (sin((1*3*2)/2)) / (sin((1*3)/2))
97 assert abs(v - c**2)< 1e-15, "expected %g but got %g" %(v,c**2)
98 if __name__ == "__main__":
99 test()
100