In [2]:

```
#initiation of variables
a= 0.48#let side of a unit cell
b = 0.46# let side of a unit cell
c = 0.40 # let side of a unit cell
p_x = 1.0/4
p_y = 1
p_z = 1.0/2
#calculation
qa = a*p_x # distance of point along x axis from origin in nm
rb = b*p_y # distance of point along y axis from origin in nm
sc = c*p_z # distance of point along z axis from origin
#result
print" Point P (%.2f" %p_x,"%.2f" %p_y,"%.2f" %p_z,") corresponds to",
print " %.2fnm" %qa,"%.2fnm" %rb,"%.2fnm " %sc
```

In [5]:

```
#initiation of variable
print"\n\nPoint \t Fractional Length\t Point \n"
print"Number \t x axix\t y axix\ z axix \t Coordinate"
n = 1 # serial number
for x in range (0,2) :
for y in range (0,2) :
for z in range (0,2) :
print "%d\t" %n," %.1f" %x," %0.1f" %y," %.1f" %y," %.1f" %x," %.1f"%y," %.1f "%z
n = n+1
x = 0.5# x coordinate for center point
y = 0.5# y coordinate for center point
z = 0.5# y coordinate for center point
print "%d\t" %n," %.1f" %x," %0.1f" %y," %.1f" %y," %.1f" %x," %.1f"%y," %.1f "%z
print "sequence of point number is changed to make problem programable "
```

In [7]:

```
#initiation of variable
a = 1.0 # let side of a unit cell
b = 1.0 # let side of a unit cell
c = 1.0 # let side of a unit cell
x_proj = 0.5*a # x coordinate of point
y_proj = 1.0*b # y coordinate of point
z_proj = 0.0*c # z coordinate of point
#calculation
k = 1.0/x_proj
x_reduction = x_proj*k # reduction in x direction
y_reduction = y_proj*k # reduction in x direction
z_reduction = z_proj*k # reduction in x direction
print " Indices of direction are as [%d" %x_reduction," %d" %y_reduction," %d" %z_reduction,"]"
```

In [17]:

```
#initiation of variable
import numpy as np
#solving for a point on the vector
a=5.0;
O=[0,0,0] #origin
a=[1,-1,0] # co-ordinate of the assumed point
A= [x * 5 for x in a]
#calcualtion
OA=np.subtract(A,O); #vector
OA=[x * 1.0/5 for x in OA]
#result
print "the resultant vector in [x,y,z] respectively",OA
print "while in notation negative value is indicated by a bar over it"
```

In [18]:

```
#initiation of variable
u1 = 1.0 # Unit cell parameter
v1 = 1.0 # Unit cell parameter
w1 = 1.0 # Unit cell parameter
#calcualtion
u_1 = 1.0/3*(2*u1-v1)
v_1 = 1.0/3*(2*v1-u1)
t_1 = -(u_1+v_1)
w_1 = w1
k = 1.0/u_1
u = u_1*k
v = v_1*k
w = w_1*k
t = t_1*k
#result
print" Indices of direction are as [%d" %u," %d" %v," %d" %t," %d" %w,"]"
print "while in notation negative value is indicated by a bar over it"
```

In [19]:

```
#initiation of variable
a = 1.0# let side of a unit cell
b = 1.0 # let side of a unit cell
c = 1.0 # let side of a unit cell
#calcualtion
x_proj = 0.0 # x coordinate of point
y_proj = -1.0*b # y coordinate of point
z_proj = 0.5*c # z coordinate of point
x_reduction = x_proj*a # reduction in x direction
y_reduction = 1.0/y_proj# reduction in x direction
z_reduction = 1.0/z_proj # reduction in x direction
#result
print " Indices of direction are as [%d" %x_reduction," %d" %y_reduction," %d" %z_reduction,"]"
print "while in notation negative value is indicated by a bar over it"
```

In [1]:

```
#initiation of variable
print "its a theoritical problem so only steps are shown how to solve the question"
print "In order to construct the figure we assume some lines that are normal to planes and from the intersection of lines we construct new planes"
A=[0,-1,1] # normal to one place
B=[1,0,1] #assumed normal of top plane
C=[-1,0,-1] #normal of the bottom plane
#result
print "from the question line ef is the intersection of plane",A, "and top plane and line gh intersection of plane",A,"bottom plane similar intersection has to be taken with front and back cell to find out the line eg and fh"
```

In [21]:

```
#initiation of variable
u1 = 1.0 # Unit cell parameter
v1 = -1.0 # Unit cell parameter
w1 = 1.0 # Unit cell parameter
#calcualtion
u_1 = 1.0/3*(2*u1-v1)
v_1 = 1.0/3*(2*v1-u1)
t_1 = -(u_1+v_1)
w_1 = w1
k = 1.0/u_1
u = u_1*k
v = v_1*k
w = w_1*k
t = t_1*k
#result
print" Indices of direction are as [%d" %u," %d" %v," %d" %t," %d" %w,"]"
print "while in notation negative value is indicated by a bar over it"
print " in book the notation used [h k i l] but in the solution [u v t w] is used to maintain uniformity]"
```