summaryrefslogtreecommitdiff
path: root/2411/CH7/EX7.4/Ex7_4.sce
blob: b7c8a446e9803e58df8d06e4892fef42a67c9d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Scilab Code Ex7.4: Page-377 (2008)
clc; clear;
function p = find_cell_type(x)
    if x == 1 then
        p = 'simple cubic';
    end    
    if x == 2 then
        p = 'body centered';
    end    
    if x == 4 then 
        p = 'face centered';        
    end
endfunction
M = 130;    // Gram atomic weight of Cs, g/mole
N = 6.023e+023;    // Avogadro's number
rho = 2;    // Density of Cs, g/cc
a = 6e-008;    // Distance between two adjacent atoms in the Cs, cm
m = M/N;    // Mass of each Cs atom, g
x = rho*a^3*N/M;    // Number of Cs atoms in cubic unit cell
c_type = find_cell_type(int(x));    // Call function to determine the type of cell
printf("\nThe cubic unit cell of Cs is %s.", c_type);

// Result
// The cubic unit cell of Cs is body centered.