In [1]:

```
## Find equilibrium concentration of vacancies in metals at given temperature
import math
t1 = 0. ## temperature in kelvin
t2 = 300. ## temperature in kelvin
t3 = 900.## temperature in kelvin
R = 8.314 ## universal gas constant
del_hf_al = 68. ## Enthalpy of formation of aluminium crystal in KJ
del_hf_ni = 168. ## Enthalpy of formation of nickel crystal in KJ
print("\n Example 6.1")
print'%s %.2f %s '%("\n Equilibrium concentration of vacancies of aluminium at",t1,"K is 0")
n_N = math.exp(-del_hf_al*1e3/(R*t2))
print'%s %.2f %s %.2e %s '%("\n Equilibrium concentration of vacancies of aluminium at ",t2,"K is ",n_N,"") ## answer in book is 1.45e-12
n_N = math.exp(-del_hf_al*1e3/(R*t3))
print'%s %.2f %s %.2e %s '%("\n Equilibrium concentration of vacancies of aluminium at",t3,"K is",n_N,"") ## answer in book is 1.12e-4
print'%s %.2f %s '%("\n\n Equilibrium concentration of vacancies of Nickel at ",t1,"K is 0")
n_N = math.exp(-del_hf_ni*1e3/(R*t2))
print'%s %.2f %s %.2e %s '%("\n Equilibrium concentration of vacancies of Nickel at ",t2,"K is",n_N,"")
n_N = math.exp(-del_hf_ni*1e3/(R*t3))
print'%s %.2f %s %.2e %s '%("\n Equilibrium concentration of vacancies of Nickel at",t3,"K is",n_N,"") ## answer in book is 1.78e-10
```

In [2]:

```
## Compute the line energy of dislocation
import math
a = 2.87 ## lattice parameter in angstrom
b= 2.49 ## magnitude of burgers vector in angstrom
G = 80.2 ## shear modulus in GN
print("\n Example 6.2")
E = G*1e9*(b*1e-10)**2.*1./2.
print'%s %.2e %s '%("\n Line energy of dislocation is ",E," J m^-1")
```

In [3]:

```
## calculation of down climb of crystal on heating
import math
a = 1e10## total number of edge dislocation
N = 6.023e23 ## Avogadro number
R = 8.314 ## Universal gas constant
t1 = 0. ## initial temperature in K
t2 = 1000. ## Final temperature in K
del_hf = 100. ## Enthalpy of vacancy formation in KJ
d = 2. ## length of one step in angstrom
v = 5.5e-6 ## volume of one mole crystal
print("\n Example 6.4")
n = N*math.exp(-(del_hf*1e3)/(R*(t2-t1)))/v
k = 1/(d*1e-10) ## atoms required for 1 m climb
b = n/(k*a)## average amount of climb
c = b*d*1e-10
print'%s %.2e %s '%("\n Average down climb of crystal is",c,"m")
```

In [4]:

```
## Calculate surface energy of copper crystal of type {111}
import math
E = 56.4 ## bond energy in KJ
N_a = 6.023 *(10**23); ## Avogadro’s number
n = 12. ## number of bonds
m = 3. ## number of broken bonds
N = 1.77e19 ## number of atoms in copper crystal of type {111} per m**2
print("\n Example 6.5")
b_e = 1./2.*E*1e3*n/N_a ## bond energy per atom
e_b = b_e*m/n ## energy of broken bond at surface
s_e = e_b*N ## surface enthalpy of copper
print'%s %.2f %s '%("\n Surface enthalpy of copper is ",s_e," J m^-2")
print'%s %.2f %s '%("\n Surface enthalpy of copper is ",s_e*1e3," erg cm^-2")
## Answer in book is 2490 erg cm**-2
```

In [9]:

```
## Compute the angle at the bottom of groove of a boundary
import math
Gamma_gb = 1. ## let, energy of grain boundary
Gamma_s = 3.* Gamma_gb ## energy of free surface
print("\n Example 6.6")
theta = 2.*math.acos(1./2.*(Gamma_gb/Gamma_s))
print'%s %.2f %s '%("\n Angle at the bottom of groove of a boundary is",math.ceil(theta*57.3)," degrees.")
```