Hex, Bugs and More Physics | Emre S. Tasci

a blog about physics, computation, computational physics and materials…

Pettifor Map 2000 Edition

April 9, 2008 Posted by Emre S. Tasci

Suppose you have the formulas, structures and temperature and pressure of the measuring environment stored in your database. Here are some steps to draw a 2000 version of the Pettifor Map.

First of all, here is what my formula table in the database looks like:

The information in molA and molB columns are populated from formulas using the following MySQL commands:



AB
UPDATE dbl014 SET molA=1, molB=1 WHERE val1 NOT REGEXP "[0-9]"

AB[0-9]
UPDATE `dbl014` SET molA=1 WHERE val1 NOT REGEXP "[0-9][A-Z]" AND molA IS NULL

A[0-9]B
UPDATE `dbl014` SET molB=1 WHERE val1 NOT REGEXP "[0-9]$" AND molB IS NULL

A2B
UPDATE `dbl014` SET molA=2 WHERE val1 REGEXP "[A-z]2[A-z]" AND molB =1

AB2
UPDATE `dbl014` SET molB=2 WHERE val1 REGEXP "[A-z]2$" AND molA =1

But we will be focusing only to the AB compositon today.

In addition, I have another table where I store information about elements:

So I can go between Symbol to Atomic Number to Mendeleev Number as I please..

Here is what I did:

* Retrieved the complete list of AB compositions.

* Retrieved the reported structures and the temperature and pressure of the entries for each composition.

* Filtered the ones that weren’t measured/calculated at ambient pressure

* Also recorded each component’s Mendeleev number, so at the end I obtained the following table where formula and structure information is enumerated (for instance, the values you see in the formula column are nothing but the ids of the formulas you can see in the first figure):

 

* Next, selected those that were measured in ambient temperature (something like SELECT * FROM db.table GROUP BY structure, formula WHERE temp=298)

* Builded a histogram for structure populations, took the first 10 most populated structures as distinct and joining the rest as "other" (assigned structure number of "0"). By the way, here are the top 20 structures for AB compositions with the first number in parentheses showing its rank among binary compounds while the second is the number AB compositions registered in that structure type:

 1 — NaCl,cF8,225 (4) (347)
 2 — CsCl,cP2,221 (7) (306)
 3 — TlI,oS8,63 (14) (126)
 4 — FeB-b,oP8,62 (32) (69)
 5 — NiAs,hP4,194 (16) (62)
 6 — ZnS,cF8,216 (9) (51)
 7 — CuAu,tP2,123 (44) (42)
 8 — CuTi,tP2,123 (76) (34)
 9 — Cu,cF4,225 (3) (34)
10 — FeAs,oP8,62 (51) (30)
11 — ZnO,hP4,186 (23) (28)
12 — W,cI2,229 (2) (26)
13 — FeSi,cP8,198 (57) (25)
14 — Mg,hP2,194 (5) (25)
15 — NaPb,tI64,142 (207) (14)
16 — ZrCl,hR12,166 (365) (14)
17 — NaO,hP12,189 (208) (13)
18 — AuCd,oP4,51 (121) (10)
19 — WC,hP2,187 (138) (10)
20 — DyAl,oP16,57 (149) (10)

* Wrote these data into a file ("str_wo_temp.txt" for further references) with [a] | [b] | [structure] being the columns as in :
79  100 11
26  93  11
24  93  11
73  92  11
78  100 11
27  64  0
66  92  0
12  97  0
53  101 0
61  86  4
31  84  4
23  85  4
32  85  4
33  85  4
27  85  4

so it was piece of a cake (not that easy, actually 8) to plot this using gnuplot :

set term wxt
set palette rgb 33,13,10
set view map
splot "str_wo_temp.txt" with points palette pt 5 ps 0.6
set xtics rotate by 90
set xtics("He" 1, "Ne     " 2, "Ar" 3, "Kr     " 4, "Xe" 5, "Rn     " 6, "Fr" 7, "Cs     " 8, "Rb"   9, "K     " 10, "Na" 11, "Li     " 12, "Ra" 13, "Ba     " 14, "Sr" 15, "Ca     " 16, "Yb" 17,        "Eu     " 18, "Sc" 19, "Lu     " 20, "Tm" 21, "Er     " 22, "Ho" 23, "Dy     " 24, "Y" 25, "Tb     " 26, "Gd" 27, "Sm     " 28, "Pm" 29, "Nd     " 30, "Pr" 31, "Ce     " 32, "La" 33, "Lr     " 34, "No" 35, "Md     " 36, "Fm" 37, "Es     " 38, "Cf" 39, "Bk     " 40, "Cm" 41, "Am     " 42, "Pu" 43,      "Np     " 44, "U" 45, "Pa     " 46, "Th" 47, "Ac     " 48, "Zr" 49, "Hf     " 50, "Ti" 51, "Ta     " 52, "Nb" 53, "V     " 54, "W" 55, "Mo     " 56, "Cr" 57, "Re     " 58, "Tc" 59, "Mn     " 60, "Fe"   61, "Ru     " 62, "Os" 63, "Co     " 64, "Rh" 65, "Ir     " 66, "Ni" 67, "Pt     " 68, "Pd" 69,      "Au     " 70, "Ag" 71, "Cu     " 72, "Mg" 73, "Hg     " 74, "Cd" 75, "Zn     " 76, "Be" 77, "Tl      " 78, "In" 79, "Al     " 80, "Ga" 81, "Pb     " 82, "Sn" 83, "Ge     " 84, "Si" 85, "B     " 86,     "Bi" 87, "Sb     " 88, "As" 89, "P     " 90, "Po" 91, "Te     " 92, "Se" 93, "S     " 94, "C" 95,    "At     " 96, "I" 97, "Br     " 98, "Cl" 99, "N     " 100, "O" 101, "F     " 102, "H" 103)
set ytics("He" 1, "Ne     " 2, "Ar" 3, "Kr     " 4, "Xe" 5, "Rn     " 6, "Fr" 7, "Cs     " 8, "Rb"   9, "K     " 10, "Na" 11, "Li     " 12, "Ra" 13, "Ba     " 14, "Sr" 15, "Ca     " 16, "Yb" 17,        "Eu     " 18, "Sc" 19, "Lu     " 20, "Tm" 21, "Er     " 22, "Ho" 23, "Dy     " 24, "Y" 25, "Tb     " 26, "Gd" 27, "Sm     " 28, "Pm" 29, "Nd     " 30, "Pr" 31, "Ce     " 32, "La" 33, "Lr     " 34, "No" 35, "Md     " 36, "Fm" 37, "Es     " 38, "Cf" 39, "Bk     " 40, "Cm" 41, "Am     " 42, "Pu" 43,      "Np     " 44, "U" 45, "Pa     " 46, "Th" 47, "Ac     " 48, "Zr" 49, "Hf     " 50, "Ti" 51, "Ta     " 52, "Nb" 53, "V     " 54, "W" 55, "Mo     " 56, "Cr" 57, "Re     " 58, "Tc" 59, "Mn     " 60, "Fe"   61, "Ru     " 62, "Os" 63, "Co     " 64, "Rh" 65, "Ir     " 66, "Ni" 67, "Pt     " 68, "Pd" 69,      "Au     " 70, "Ag" 71, "Cu     " 72, "Mg" 73, "Hg     " 74, "Cd" 75, "Zn     " 76, "Be" 77, "Tl      " 78, "In" 79, "Al     " 80, "Ga" 81, "Pb     " 82, "Sn" 83, "Ge     " 84, "Si" 85, "B     " 86,     "Bi" 87, "Sb     " 88, "As" 89, "P     " 90, "Po" 91, "Te     " 92, "Se" 93, "S     " 94, "C" 95,    "At     " 96, "I" 97, "Br     " 98, "Cl" 99, "N     " 100, "O" 101, "F     " 102, "H" 103)
set xtics font "Helvatica,8"
set ytics font "Helvatica,8"
set xrange [0:103]
set yrange [0:103]
#set term postscript enhanced color
#set output "pettifor.ps"
replot

and voila (or the real one with the accent which I couldn’t manage to 8) ! So here is the updated Pettifor Map for you (and for the AB compositons 8) But mind you, it doesn’t contain possible entries after year 2000.

 

You can plot the "same" map with Octave somewhat as follows (since I’m a newbie in Octave myself, I’ll take you as far as I could go – from there on, you’re on your own 8)

First, load the data file into a matrix:

load str_wo_temp.txt

then map this matrix contents into another matrix with the first (a) and second (b) columns being the new matrix’s column and row number and the third column (structure) being the value:

for i = 1:length(str_wo_temp)

      A(str_wo_temp(i,1),str_wo_temp(i,2)) = str_wo_temp(i,3);

endfor

now, finally we can plot the density matrix:

imagesc(A)

which produces:

Oh, don’t be so picky about the labels and that thing called "legend"! 8) (By the way, if you know how to add those, please let me know, too – I haven’t started googling around the issue for the moment..)

 

While I was at it, I also plotted a 3-D Pettifor Map with the z-axis representing the temperature at which the structure was determined. This time, instead of saving all the data into one file, I saved the [a] [b] [temp] values into "structure name" files. Then, I picked up the most populated structure types (i.e., the ones contating the most lines) and moved the remaining into a temporary folder where I issued the

cat *.txt > others.txt

command. Then plotted this 3D map via gnuplot with the following command:
splot "NaCl,cF8,225.txt", "CsCl,cP2,221.txt", "TlI,oS8,63.txt", "FeB-b,oP8,62.txt", "NiAs,hP4,194.txt", "ZnS,cF8,216.txt", "FeAs,oP8,62.txt", "Cu,cF4,225.txt", "W,cI2,229.txt", "CuTi,tP2,123.txt", "CuAu,tP2,123.txt", "ZnO,hP4,186.txt", "Mg,hP2,194.txt", "FeSi,cP8,198.txt", "GeS,oP8,62.txt", "NaPb,tI64,142.txt", "AuCd,oP4,51.txt", "ZrCl,hR12,166.txt", "NaO,hP12,189.txt", "CuI,cF20,216.txt", "DyAl,oP16,57.txt", "InBi,tP4,129.txt", "PbO,tP4,129.txt", "CoO,tI4,139.txt", "WC,hP2,187.txt", "MoC,hP8,194.txt", "NaTl,cF16,227.txt", "GeTe,hR6,160.txt", "Sn,tI4,141.txt", "HgIn,hR6,166.txt", "In,tI2,139.txt", "PdBi,mP16,4.txt", "Nd,hP4,194.txt", "CuTi,tP4,129.txt", "NaP,oP16,19.txt", "HgS,hP6,152.txt", "CoSn,hP6,191.txt", "KGe,cP64,218.txt", "HgCl,tI8,139.txt", "AgI,cI38,229.txt", "others.txt"

  Here are two snapshots:

 

I’m planning to include a java version of this 3D map where you can more easily read what you are looking…

Octave Functions for Information Gain (Mutual Information)

April 7, 2008 Posted by Emre S. Tasci

Here is some set of functions freshly coded in GNU Octave that deal with Information Gain and related quantities.

For theoretical background and mathematica correspondence of the functions refer to : A Crash Course on Information Gain & some other DataMining terms and How To Get There (my 21/11/2007dated post)

function [t r p] =  est_members(x)

Finds the distinct members of given vector x returns 3 vectors r, t and p where :

r : ordered unique member list
t : number of occurences of each element in r
p : probability of each element in r

 Example :

octave:234> x
x =
   1   2   3   3   2   1   1

octave:235> [r t p] = est_members(x)
r =
   1   2   3
t =
   3   2   2
p =
   0.42857   0.28571   0.28571

 

function C = est_scent(z,x,y,y_n) 

Calculates the specific conditional entropy H(X|Y=y_n)

It is assumed that:
  X is stored in the x. row of z
  Y is stored in the y. row of z

Example :

octave:236> y
y =
   1   2   1   1   2   3   2

octave:237> z=[x;y]
z =
   1   2   3   3   2   1   1
   1   2   1   1   2   3   2

octave:238> est_scent(z,1,2,2)

ans =  0.63651

 

function cent = est_cent(z,x,y)

Calculates the conditional entropy H(X|Y)
It is assumed that:
 X is stored in the x. row of z
 Y is stored in the y. row of z

Example :

octave:239> est_cent(z,1,2)
ans =  0.54558

 

function ig = est_ig(z,x,y)

Calculates the Information Gain (Mutual Information) IG(X|Y) = H(X) – H(X|Y)
It is assumed that:
  X is stored in the x. row of z
  Y is stored in the y. row of z

Example :

octave:240> est_ig(z,1,2)
ans =  0.53341

 

function ig = est_ig2(x,y)
Calculates the Information Gain IG(X|Y) = H(X) – H(X|Y)

Example :

octave:186> est_ig2(x,y)
ans =  0.53341

 

function ig = est_ig2n(x,y)
Calculates the Normalized Information Gain
 IG(X|Y) = [H(X) – H(X|Y)]/min(H(X),H(Y))

Example :

octave:187> est_ig2n(x,y)
ans =  0.53116

 

function ent = est_entropy(p)

Calculates the entropy for the given probabilities vector p :
H(P) = – SUM(p_i * Log(p_i))

Example :

octave:241> p
p =
   0.42857   0.28571   0.28571

octave:242> est_entropy(p)
ans =  1.0790

 

function ent = est_entropy_from_values(x)

Calculates the entropy for the given values vector x:

H(P) = -Sum(p(a_i) * Log(p(a_i))

where {a} is the set of possible values for x.

Example :

octave:243> x
x =
   1   2   3   3   2   1   1

octave:244> est_entropy_from_values(x)
ans =  1.0790


Supplementary function files:

function [t r p] =  est_members(x)
% Finds the distinct members of x
% r : ordered unique member list
% t : number of occurences of each element in r
% p : probability of each element in r
% Emre S. Tasci 7/4/2008
    t = unique(x);
    l = 0;
    for i = t
        l++;
        r(l) = length(find(x==i));
    endfor
    N = length(x);
    p = r/N;
endfunction

   
function C = est_scent(z,x,y,y_n)
% Calculates the specific conditional entropy H(X|Y=y_n)
% It is assumed that:
%   X is stored in the x. row of z
%   Y is stored in the y. row of z
%   y_n is located in the list of possible values of y
%       (i.e.   [r t p] = est_members(z(y,:))
%               y_n = r(n)
%   Emre S. Tasci 7/4/2008
[r t p] = est_members(z(x,:)(z(y,:)==y_n));
C = est_entropy(p);
endfunction

 

function cent = est_cent(z,x,y)
% Calculates the conditional entropy H(X|Y)
% It is assumed that:
%   X is stored in the x. row of z
%   Y is stored in the y. row of z
% Emre S. Tasci 7/4/2008
cent = 0;
j = 0;
[r t p] = est_members(z(y,:));
for i=r
    j++;
    cent += p(j)*est_scent(z,x,y,i);
endfor
endfunction

 

function ig = est_ig(z,x,y)
% Calculates the Information Gain IG(X|Y) = H(X) – H(X|Y)
%   X is stored in the x. row of z
%   Y is stored in the y. row of z
% Emre S. Tasci 7/4/2008
[r t p] = est_members(z(x,:));
ig = est_entropy(p) – est_cent(z,x,y);
endfunction

 

function ig = est_ig2(x,y)
% Calculates the Information Gain IG(X|Y) = H(X) – H(X|Y)
% Emre S. Tasci <e.tasci@tudelft.nl> 8/4/2008
z = [x;y];
[r t p] = est_members(z(1,:));
ig = est_entropy(p) – est_cent(z,1,2);
endfunction

 

function ig = est_ig2n(x,y)
% Calculates the Normalized Information Gain
% IG(X|Y) = [H(X) – H(X|Y)]/min(H(X),H(Y))
% Emre S. Tasci <e.tasci@tudelft.nl> 8/4/2008
z = [x;y];
[r t p] = est_members(z(1,:));
entx = est_entropy(p);
enty = est_entropy_from_values(y);
minent = min(entx,enty);
ig = (entx – est_cent(z,1,2))/minent;
endfunction

 

function ent = est_entropy(p)
% Calculates the Entropy of the given probability vector X:
%       H(X) = – Sigma(X*Log(x))
%   If you want to directly calculate the entropy from values array
%       use est_entropy_from_values(X) function
%    
% Emre S. Tasci 7/4/2008
ent = 0;
    for i = p
        ent += -i*log(i);
    endfor
endfunction

 

function ent = est_entropy_from_values(x)
% Calculates the Entropy of the given set of values X:
%       H(X) = – Sigma(p(X_i)*Log(p(X_i)))
%   If you want to calculate the entropy from probabilities array
%       use est_entropy(X) function
%    
% Emre S. Tasci 7/4/2008
ent = 0;
[r t p] = est_members(x);
    for i = p
        ent += -i*log(i);
    endfor
endfunction

Been “there” and back again…

March 27, 2008 Posted by Emre S. Tasci

Golden Remark: "If you assume formula and Pearson Symbol (along with the Space-group number) together are sufficient to identify a structure, then there is a 488 in 53766 (0.9%) probability that you are wrong. And that probability is more than enough to spoil the fun."

Been there, experienced it first hand yesterday.

 

Moral of the story : If you happen to be involved with any of the following beauties, just make sure that their twins aren’t swapping with your sweetheart. Otherwise, it is very likely that you’ll get your heart broken into two (actually into three for the ones marked with *). Checking their height-width-and shoe number works well (or directly check the volume, so to speak…)

As2O3,mP20,14
As4S3,oP28,62
AsS,mP32,14*
B2O3,hP15,144
BiI,mS16,12
BN,hP4,194
C,hP4,194
CdI2,hP18,164
CdI2,hP21,156*
CdI2,hP24,156*
CdI2,hP30,156*
CdI2,hP33,156
CdI2,hP39,156
Co2Si,oP12,62
Cr3C2,oP20,62
FeB,oP8,62
GaS,hP8,194
HgCl2,oP12,62
ICl,mP16,14
LiO,hP8,194
N2O4,cI36,204
NbSe2,hP12,187
NbTe4,tP60,75
PbI2,hP21,156
Pr5O9,mP112,14
Rh12As7,hP22,176
Se,mP32,14
SiC,hR102,160*
SN,mP8,14*
TeO2,oP24,61
Ti4O7,aP22,2
U3O8,oS22,38
U3O8,oS44,63
UF5,tI48,122
VO2,mS24,12
WO3,mP16,14
ZrO2,mP12,14

I see that it has been some time since my last entry but I hope I will be more informative from now on…

Quotes of the day

January 14, 2008 Posted by Emre S. Tasci

The Fourteen Bravais Lattices

When one relaxes the restriction to point operations and considers the full symmetry group of the Bravais lattice, there turn out to be fourteen distinct space groups that a Bravais lattice can have. Thus, from the point of view of symmetry, there are fourteen different kinds of Bravais lattice. This enumeration was first done by M.L. Frankenheim (1842). Frankenheim miscounted, however, reporting fifteen possibilities. A. Bravais (1845) was the first to count the categories correctly.

(…)

The seven crystal systems and fourteen Bravais lattices described above exhaust the possibilities. This is far from obvious (or the lattices would have been known as Frankenheim lattices).

Ashcroft, Mermin  Solid State Physics Saunders 1976 Ch. 7


 

I don’t understand why you materials scientists are so busy in working out experimentally the constitution [crystal structure and phase diagram] of multinary systems. We know the structure of the atoms [needing only Atomic Numbers], we have the laws of quantum mechanics, and we have electronic calculation machines, which can solve the pertinent equation rather quickly!

J.C. Slater, 1956 as quoted by Villars et al. Journal of Alloys and Compounds 279 (1998) 1

Protected: mP12, oP12, tP6

 Posted by Emre S. Tasci

This content is password protected. To view it please enter your password below: