MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... ·...

201
MELTING IN HCP LATTICES PAVEL BAVLI

Transcript of MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... ·...

Page 1: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

MELTING IN HCP LATTICES

PAVEL BAVLI

Page 2: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

MELTING IN HCP LATTICES

RESEARCH THESIS

SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENTS

FOR THE DEGREE OF MASTER OF SCIENCE IN PHYSICS

PAVEL BAVLI

SUBMITTED TO THE SENATE OF THE TECHNION — ISRAEL INSTITUTE OF TECHNOLOGY

NISAN, 5769 HAIFA APRIL, 2009

Page 3: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

THIS RESEARCH THESIS WAS SUPERVISED BY DR. JOAN ADLER AND

PROF. EMIL POLTURAK UNDER THE AUSPICES OF THE PHYSICS

DEPARTMENT

ACKNOWLEDGMENT

I wish to express my gratitude to Dr. J. Adler and Prof. E. Polturak for

the excellent guidance and support during this research. I grateful to

Dr. A. Hashibon for his help and to my wife, Ira Bavli, for her support

during the research period. I would like to express my gratitude to

Dr. A. Weil for the help on NANCO and on parallel computing. I

also thank the Russell Berrie Nanotechnology Institute for providing

me with subsidised CPU time on their linux-cluster, NANCO at the

Taub Technion Computer Center.

THE GENEROUS FINANCIAL HELP OF THE TECHNION AND ISRAELI

SCIENCE FOUNDATION IS GRATEFULLY ACKNOWLEDGED

Page 4: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Contents

Abstract xvii

List of symbols 1

1 Introduction 3

2 Bulk melting 10

2.1 Lindemann criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.2 Born criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 Surface melting 16

3.1 Phenomenological thermodynamic model . . . . . . . . . . . . . . . 16

3.2 Landau model of surface premelting . . . . . . . . . . . . . . . . . . 19

3.3 Layering effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.4 Lattice theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.5 Density functional theory of surface melting . . . . . . . . . . . . . . 30

4 Numerical methods 33

4.1 Molecular Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2 The embedded atom potential . . . . . . . . . . . . . . . . . . . . . 36

iii

Page 5: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CONTENTS iv

4.3 The Hexagonal Close-Packed (HCP) structure . . . . . . . . . . . . 40

4.4 Initial and boundary conditions . . . . . . . . . . . . . . . . . . . . . 44

4.5 Predictor-corrector method . . . . . . . . . . . . . . . . . . . . . . . 45

4.6 Nose-Hoover algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 47

4.7 The isothermal-isotension ensemble (NtT) . . . . . . . . . . . . . . 50

4.8 NANCO and MPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4.9 Analysis of errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

4.10 Visualization of simulations . . . . . . . . . . . . . . . . . . . . . . . 57

5 Results: Bulk melting 59

5.1 The objective of the bulk melting simulations . . . . . . . . . . . . . 59

5.2 Initial configuration and general testing . . . . . . . . . . . . . . . . 60

5.3 Order parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

5.4 Thermal expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

6 Results & Discussion: Surface melting 77

6.1 The goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

6.2 Initial configuration and simulation - general information . . . . . . . 78

6.3 Structural order parameters . . . . . . . . . . . . . . . . . . . . . . . 83

6.4 Local density profile . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

6.5 Distance between layers . . . . . . . . . . . . . . . . . . . . . . . . . 96

6.6 RMS vibration amplitude . . . . . . . . . . . . . . . . . . . . . . . . 99

6.7 Layer occupation and energetics . . . . . . . . . . . . . . . . . . . . 103

7 Summary & Conclusions 113

A Calculation of the elastic constants 119

Page 6: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CONTENTS v

B (0001), (1010) and (1011) facets 123

C Finite size effects 129

D Computer programs 133

References 168

Hebrew Abstract b

Page 7: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

List of Figures

1.1 Schematic illustration showing, as a function of temperature, the be-

havior of the Gibbs free energy near the melting point. . . . . . . . . 4

1.2 A general scheme showing a low energy electron diffraction (LEED)

experiment, a one dimensional chain of atoms (with atomic separation

a) representing the solid in cross-section with the electron beam inci-

dent normal to the surface from the vacuum above and its reflection,

the optical path difference is also drawn. . . . . . . . . . . . . . . . . 8

1.3 Pb(110), decrease in intensity of LEED beams due to disordering. Mea-

sured intensity excluding the background is plotted against tempera-

ture [13]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.1 The measured melting temperature versus the melting temperature

estimated using the Lindemann rule [15]. . . . . . . . . . . . . . . . . 11

2.2 3D visualization of the collective appearance of the Lindemann parti-

cles at T/Tm = 0.79. (a) a few clusters with 20-200 particles (larger

black circles) against other particles (smaller gray circles) which do not

form such clusters (b) four large clusters with 219, 214, 187, and 117

particles colored with red, blue, black and gray, respectively [17]. . . . 12

2.3 The proposed variation of C44 near the melting point [18]. . . . . . . 14

vi

Page 8: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES vii

2.4 The variation of C ′ with molar volume for various metals [24]. . . . . 15

3.1 The solid-liquid and liquid-vapor interfaces, a 3d sample representa-

tion: at the bottom the solid which is ordered, a liquid state at the

center with no order but with the atoms still close to each other, and

vapour state at the top where atoms are separated by large distance. 17

3.2 Phase diagram showing the two different phases as a function of the

extrapolation length [33]. . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.3 Order parameter M(z), as O2 and s are approached from T < T ∗ [33]. 22

3.4 Density profile of the liquid surface of aluminium exhibits pronounced

oscillations at the liquid vapor interface [38]. . . . . . . . . . . . . . . 23

3.5 Comparison between the density profiles of the (111) and (110) surfaces

of a Lennard Jones crystal and gold obtained by MD simulations [39],

here ’S’, ’L’ and ’V’ stands for solid, liquid and vapour respectively.

The graphs show a solid with a thin layer of liquid. . . . . . . . . . . 24

3.6 Variation of the surface free energies as a function of the interface sep-

aration L. Upper panel: the close packed (111) face of a FCC crystal,

showing constructive interference. Lower panel: the least packed (110)

face of a FCC crystal, showing destructive interference. Corresponding

typical plots of densities ρi as a function of lattice site are shown in

the insets. In the (110) case, the periodic potential induces crystal-like

density oscillations for i > L [39]. . . . . . . . . . . . . . . . . . . . . 25

3.7 Density (vertical lines) and crystalline order (dots) profiles of the LJ

(110): (a),(b),(c) solid-gas and (d) liquid-gas systems at coexistence [44]. 28

Page 9: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES viii

3.8 Dependence of the quasiliquid layer thickness upon reduced tempera-

ture. Note the change of behavior from long range attraction (LJ) to

short range (SR) to long range repulsion (REP) [44]. . . . . . . . . . 28

3.9 Temperature dependence (T/Tm) of the surface free energy γ (units

of ǫ/σ2) of (110) and (100) Lennard Jones faces and of the liquid gas

interface and surface specific heat Cs of facet (110) (units of kB/σ2).

Note their singularity at Tm indicated on the figure by vertical dotted

line [9]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.10 Parallel-integrated density ρ⊥ (z) (full curves) and minimal density

ρm (z) (dashed curves) vs z/σ obtained from hard sphere perturba-

tion theory at the reduced temperature t = 1 − T/Tm. The densities

are in units of σ−3 [47]. (a) (111) orientation; (b) (100) orientation;

(c) (110) orientation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.1 Molecular dynamics flow chart [49]. . . . . . . . . . . . . . . . . . . . 35

4.2 Temperature-Pressure phase diagram of magnesium [83]. . . . . . . . 38

4.3 The simple hexagonal Bravais lattice. Two dimensional triangular nets

(shown in inset) are stacked directly above on another, a distance c

apart [68]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

4.4 The HCP crystal structure. It can be viewed as two simple hexagonal

Bravais lattices, displaced vertically by a distance of c/2 [68]. . . . . . 41

4.5 Miller indices for hexagonal structure. Left figure shows the 3 system

Miller indices and the right figure shows the 4 system Miller indices. . 42

4.6 The link between the first 3 indices in the 4 Miller indices system. . . 43

Page 10: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES ix

4.7 A computational cell and periodic boundary conditions [12] for bulk

simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

4.8 A scheme of NANCO architecture [55]. . . . . . . . . . . . . . . . . . 53

4.9 A graph showing the speedup on NANCO [56]. . . . . . . . . . . . . . 54

4.10 Atomic Visualization package devoloped by the Computational Physics

Group, Technion [67]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

5.1 Variation of the diagonal elements of the H matrix as a function of

time at 800K. The average value (starting from measurement 500) of

each graph and its fluctuation is given in the legend. . . . . . . . . . 60

5.2 Variation of the off-diagonal elements of H matrix in time at 800K,

the average value (starting from measurement 500) of each graph and

its fluctuation is given in the legend. . . . . . . . . . . . . . . . . . . 61

5.3 Variation of the potential energy of system for one atom with time at

800K where the energy at step 0 is the energy at 0K. The average

value (starting from step 50000) the graph and its fluctuation is given

in the legend. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

5.4 Variation of the internal pressure and temperature in time at 800K,

the average value (starting from measurement 500) of each graph and

its fluctuation are given in the legend. . . . . . . . . . . . . . . . . . . 62

5.5 Snapshots of the solid at 800K during the simulation at different time

steps. Each snapshot is identified by the step number. . . . . . . . . . 64

Page 11: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES x

5.6 Variation of the order parameters in time at 800K. The average value

(starting from measurement 500) of each graph and its fluctuation is

given in the legend. Note that the system reaches its average value

after only 50000 steps. . . . . . . . . . . . . . . . . . . . . . . . . . . 65

5.7 Variation of all five independent elastic constant in time at 800K. The

average value (starting from measurement 500) of each graph and its

fluctuation is given in the legend. Note that the system reaches its

average value after only 50000 steps. . . . . . . . . . . . . . . . . . . 65

5.8 The graphs show the average of the internal temperature and pressure

of the system, the error bars are fluctuations. . . . . . . . . . . . . . 67

5.9 The triangular structure of an HCP lattice in the XY palne. . . . . . 67

5.10 Upper graph show the order parameters vs. temperature during the

heating processes while the lower graph show the corresponding order

parameter fluctuations vs. temperature. The dashed lines are present

to guide the eye. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

5.11 Lattice parameter a vs. temperature during the heating processes.

Dashed line are the results from the simulation, solid line is a fit to

experimental results and the triangles are the available experimental

data in this temperature range. . . . . . . . . . . . . . . . . . . . . . 69

5.12 Lattice parameter c vs. temperature during the heating processes.

Dashed line are the results from the simulation, solid line is a fit to

experimental results and the triangles are the available experimental

data over this temperature range. . . . . . . . . . . . . . . . . . . . . 70

5.13 Volume of the system vs. temperature during the heating processes. . 70

5.14 Snapshots of the system during the heating processes. . . . . . . . . . 72

Page 12: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES xi

5.15 Elastic constants vs. temperature. . . . . . . . . . . . . . . . . . . . . 73

5.16 Shear moduli vs. temperature. Upper curve shows simulated results as

in Fig 5.15, lower curve shows extrapolated fit to experimental [85] re-

sults. Each group is approximated by a large red band. The difference

between the centers of the two bands is about 20GPa. . . . . . . . . 73

5.17 Shear modulus C33 vs VAtom. The square markers are the simulated C33

and the diamond marker are the corrected simulated C33, the dashed

lines are a linear fit to C33 simulated and corrected. The sqaure filled

marker is the critical volume at Tb, the filled circular marker is the

critical corrected volume at Tb and the filled triangular marker is the

corresponding experimental liquid volume at same Tb. . . . . . . . . . 75

5.18 Dashed line with circular markers shows the simulated results for solid

magnesium density vs. temperature while the solid line shows the

liquid experimental density [84] vs. temperature and the horizontal

dashed line is the liquid density at 1100K. . . . . . . . . . . . . . . . 76

6.1 Initial configuration of Mg (0001), z is the direction normal to the free

surface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

6.2 Initial configuration of Mg (1010), z is the direction normal to the free

surface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

6.3 Initial configuration of Mg (1011), z is the direction normal to the free

surface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

6.4 Illustration showing the applied boundary conditions with a free sur-

face samples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Page 13: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES xii

6.5 The two dashed turquoise lines are separated by ac√

3√4c2+3a2

and each line

hides two planes separated by about 0.4

A. . . . . . . . . . . . . . . . 81

6.6 The triangular structure of a single layer in the (0001) orientation. . . 84

6.7 Order parameter of the XY plane of the Mg c facet (0001) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

6.8 Order parameter of the z axis of the Mg c facet (0001) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

6.9 Order parameter of the x axis of the Mg a facet (1010) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

6.10 Order parameter of the y axis of the Mg a facet (1010) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

6.11 Order parameter of the z axis of the Mg a facet (1010) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

6.12 Order parameter of the x axis of the Mg s facet (1011) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

6.13 Order parameter of the y axis of the Mg s facet (1011) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

6.14 Order parameter of the z axis of the Mg s facet (1011) at various

temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

6.15 Comparison of order parameter of the layer next to the top one of the

(0001) direction as a function of temperature. . . . . . . . . . . . . . 90

6.16 Comparison of order parameter of the layer next to the top one of the

(1010) direction as a function of temperature. . . . . . . . . . . . . . 90

6.17 Comparison of order parameter of the layer next to the top one of the

(1011) direction as a function of temperature. . . . . . . . . . . . . . 91

Page 14: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES xiii

6.18 Density profile across (0001) along the z direction perpendicular to

the surface at various temperature, as indicated. y axis is normalized

relatively to maximum density profile value at low temperature. . . . 92

6.19 Density profile across (1010) along the z direction perpendicular to

the surface at various temperature, as indicated. y axis is normalized

relatively to maximum density profile value at low temperature . . . . 93

6.20 Density profile across (1011) along the z direction perpendicular to

the surface at various temperature, as indicated. y axis is normalized

relatively to maximum density profile value at low temperature . . . . 93

6.21 Distance between the neighboring layers vs. temperatue of (1011). . . 96

6.22 Interlayer distances, normalized by the center layer distance (’bulk’

distance) of c, a and s at 800K. . . . . . . . . . . . . . . . . . . . . . 97

6.23 Interlayer distances, normalized by the center layer distance (’bulk’

distance) of c, a and s at 900K. . . . . . . . . . . . . . . . . . . . . . 97

6.24 Distance between neighboring layers vs. temperature for (0001). . . . 99

6.25 Distance between neighboring layers vs. temperature for (1010). . . . 99

6.26 RMS vibration amplitude of the c facet (0001) for all three axes relative

to its starting value at 800K, each graph show a comparison between

the center sample RMS vibration amplitude with respect to the average

between the RMS vibration amplitude of the top and bottom layers. . 100

6.27 RMS vibration amplitude of the a facet (1010) for all three axes relative

to its starting value at 800K, each graph show a comparison between

the center sample RMS vibration amplitude with respect to the average

between the RMS vibration amplitude of the top and bottom layers. . 101

Page 15: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES xiv

6.28 Initial state of c facet (0001) and final state at 970K. Note how the

layers become mixed, especially the top and bottom layers. . . . . . . 101

6.29 Initial state of a facet (1010) and final state at 970K. Note how the

layers become mixed, especially the top and bottom layers. . . . . . . 102

6.30 Layer occupation of the (0001) sample as a function of temperature,

’0’ stands for the adlayer. . . . . . . . . . . . . . . . . . . . . . . . . . 104

6.31 Layer occupation of the (1010) sample as a function of temperature,

’0’ stands for the adlayer. . . . . . . . . . . . . . . . . . . . . . . . . . 104

6.32 Layer occupation of the (1011) sample as a function of temperature,

’0’ stands for the adlayer. . . . . . . . . . . . . . . . . . . . . . . . . . 105

6.33 Adlayer occupation of the (0001) sample as a function of temperature.

The dotted line is an exponential fit. . . . . . . . . . . . . . . . . . . 106

6.34 Adlayer occupation of the (1010) sample as a function of temperature.

The dotted line is an exponential fit. . . . . . . . . . . . . . . . . . . 106

6.35 Adlayer occupation of the (1011) sample as a function of temperature.

The dotted line is an exponential fit. . . . . . . . . . . . . . . . . . . 107

6.36 The activation energy of surface defects Es vs Tm for Pb, Al, Ag, Au,

Cu, Ni and Pt. The solid line is a linear regression. From ref. [10]. . . 111

B.1 Geometry of the facets [72]. . . . . . . . . . . . . . . . . . . . . . . . 124

B.2 Atomic layout of facet c in the XY plane or facet a in the XZ plane. 124

B.3 Atomic layout of facet c in the XZ plane or facet a in the XY plane. 125

B.4 Atoms layout of facet s rotated to a view point where the front atoms

conceal the atoms behind them in the XY plane. . . . . . . . . . . . 127

Page 16: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF FIGURES xv

B.5 Atoms layout of facet s in the Y Z plane and the two vector that define

the plane that its normal is facet s normal. . . . . . . . . . . . . . . . 127

B.6 Atoms layout of facet s in the XZ plane after rotation and shifting to

keep all atoms in a box. . . . . . . . . . . . . . . . . . . . . . . . . . 128

C.1 Density profile across (1011) along the z direction perpendicular to the

surface at various temperature, as indicated. . . . . . . . . . . . . . . 130

C.2 Density profile across (1010) along the z direction perpendicular to the

surface at various temperature, as indicated. . . . . . . . . . . . . . . 131

C.3 Order parameter of the z axis of the Mg a facet (1010) at various

temperatures, 40 layer are compared with 80 layers. . . . . . . . . . . 132

C.4 Zoom to Fig. C.3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Page 17: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

List of Tables

4.1 D. Y. Sun’s explicit form taken from [6], the energy and distance are

given in units of eV and A, respectively. . . . . . . . . . . . . . . . . 39

4.2 Elements with the HCP crystal structure [68]. . . . . . . . . . . . . . 42

6.1 List of nearest-neighbor atom projected distances along x, y and z,

and of surface density for all 3 facet orientations. . . . . . . . . . . . 82

6.2 Energy of surface defects (adatom-vacancy pairs) calculated using the

adlayer occupation data of the various surfaces. . . . . . . . . . . . . 107

6.3 Energy of surface defects (adatom-vacancy pairs) (results from [12]). . 108

6.4 Energy of surface defects obtained in three different ways. . . . . . . 111

6.5 The activation energy of surface defects Es vs. Tm for FCC metals.

The data is from ref. [10]. . . . . . . . . . . . . . . . . . . . . . . . . 112

xvi

Page 18: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Abstract

Melting is a fundamental process which to date is not fully understood. There is

no generally accepted physical picture, many aspects of this process remain as open

questions and challenges that need to be solved.

During the 20th century, a number of theories were proposed to explain the melting

process. Some considered melting as a homogeneous process that occurs throughout

the entire crystal. Lindemann [1] proposed the first homogenous theory saying that

melting is a result of mechanical instability of the solid caused by enhanced vibra-

tion of atoms. According to Lindemann the solid melts when the atomic thermal

vibrations exceed some fraction of interatomic spacing. Born [2] defined melting as

the vanishing of shear elastic moduli (a liquid cannot be sheared) which are related

to the mechanical stability of the crystal lattice, Born argued that when this occurs

it manifests itself in an imaginary phonon frequency and a collapse of the lattice.

More complex models were based on spontaneous thermal production of defects in-

side the lattice such as vacancies, interstitials and dislocations close to the melting

temperature which led to a collapse of the crystalline long range order [3, 4]. These

models did not take into consideration effects of inhomogeneity, such as free surfaces

and grain boundaries which may be important for melting. Only one-phase melting

or continuous melting was taken into account. The melting temperature Tm can be

xvii

Page 19: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

ABSTRACT xviii

calculated with these models but it is usually overestimated.

My aim has been to extend the understanding of the role of surfaces in the melting

transition of metals having a HCP structure. The element that was chosen is mag-

nesium which has an HCP structure at zero external pressure conditions [5]. It was

studied by means of computer simulations, using an interatomic potential proposed

by Sun et al. [6]. The bulk melting temperature, Tb, of magnesium was determined to

be 1102 ± 3K, higher than the experimental Tm = 923K. The ratio between Tb and

Tm is 1.2 which matches the prediction [7] of maximally superheated bulk melting

temperature in metallic elements.

Melting of real crystals begins at the surface, because of a lower activation energy

of a liquid phase at the surface. The thin liquid layer at the surface eliminates the

barrier for nucleation of bulk liquid preventing metastability effects such as super-

heating. Most of the theoretical models of surface melting are phenomenological, and

neglect the atomistic details of the phenomenon.

We studied surface melting at different temperatures by applying periodic bound-

ary conditions in two directions perpendicular to the surface normal which was left

free. Three low-index facets of HCP magnesium were studied, known as the c, a and

s facets. The Non-Bravais nature of the lattice affects different kinds of properties; its

influence on the s facet was the most pronounced and it surprisingly lost most of its

order 30K before the other two facets. The analysis of our simulations led us to the

general conclusion that the Born criterion describes both bulk and surface melting.

Page 20: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

List of symbols

T temperature

P pressure

V volume

N number of atoms

S entropy

E energy

C Heat capacity

G Gibbs free energy

Tm melting temperature

Pext external pressure

kB Boltzmann constant

R Gas constant

cL Lindemann constant

Gl Gibbs free energy of a liquid

Gs Gibbs free energy of a solid

Wl Number of degrees of freedom of a liquid

Ws Number of degrees of freedom of a solid

1

Page 21: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

LIST OF SYMBOLS 2

x, y, z The three Catesian coordiantes

α, β... Cartesian indeces

Page 22: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 1

Introduction

Every solid melts at a high enough temperature. For example, at atmospheric pres-

sure, molecular hydrogen melts at about 14K, ice at 273K, iron at 1810K, and

tungsten at nearly 3700K, making the latter very useful as the filament material in

light bulbs. Melting of a three dimensional (3D) solid, or its conversion from solid

to liquid, is a first-order phase transition for which a latent heat must be provided

constantly to keep the system’s temperature constant until the entire system has

transformed into the new phase. Thus, ice keeps a drink cold by absorbing its latent

heat, which causes the ice to melt gradually.

The fundamental phenomenon of melting, which all of us have witnessed, and

perhaps think we understand, does not have a generally accepted physical picture

of how the melting process occurs at an atomistic level. Many theories exist in the

literature that try to explain the process of melting.

A melting transition occurs when a particular phase becomes unstable under a

given set of thermodynamic conditions. Classical thermodynamics offers a sound

framework for understanding phase transitions in terms of free energy. The phase

3

Page 23: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 4

transition is usually described by the Gibbs free energy -G. We relate it to a particular

phase state of matter by a subscript, e.g. for a solid Gs and for a liquid Gl. The two

Gibbs free energies are equal, Gs(P, T ) = Gl(P, T ), at the melting point. The Gibbs

free energy is a continuous function of pressure, P , and temperature, T , during the

phase transitions as depicted in Fig. 1.1, but other thermodynamic quantities such

as internal energy U , entropy S, volume V and heat capacity C have discontinuous

changes. Most substances expand upon melting, meaning ∆Vm > 0. The most

common substance to behave the other way is ice [14] (also Sb, Bi, Ga).

Figure 1.1: Schematic illustration showing, as a function of temperature, thebehavior of the Gibbs free energy near the melting point.

For all known materials (except He) the entropy of the liquid phase is higher than

the entropy of the solid phase at the melting point:

∆Sm = R ln

(

Wl

Ws

)

(1.1)

where ∆Sm is the entropy difference between the two phases, R is the gas constant

and Wl and Ws are the number of degrees of freedom in the liquid and solid phases

respectively. This implies that the melting transition is a transition from an ordered

state to a less ordered state, which increases the ’randomness’ of the material. How-

ever, the thermodynamic relation cannot explain the mechanism of melting. The

Page 24: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 5

melting process is determined by the microscopic behaviour during the heating pro-

cess, implying that the melting process cannot be explained without prior knowledge

of the structure of the material.

Over time two classes of theoretical models of melting have been suggested. The

first class takes into consideration both phases, solid and liquid, and the equilibrium

between them during the melting phase is expressed by the Gibbs free energy, which

gives the melting temperature - Tm. The second class models one phase [1, 2], and

focuses on instability in the solid defining the melting temperature as the instability

temperature at which the solid becomes unstable. All these models assume the melt-

ing process to be a homogeneous one which occurs in the bulk of the solid. These

models cannot predict the correct melting temperature and usually overestimate it.

Real crystals have a finite size and are influenced by their boundaries. They start to

melt from their boundaries inward or from some defects inside the bulk (vacancies,

interstitials, dislocations, disclinations, etc) at a lower temperature than the predicted

one [3,4]. Nonetheless, these theories play an important role in the understanding of

the mechanism of melting, especially in emphasizing which scenarios of melting are

physical. The most important theories are presented in chapter 2.

The theoretical models of the second class are not totally consistent with reality,

because they take into consideration only the bulk material and explain the melt-

ing mechanism as a homogeneous breakdown of the crystal lattice. However, during

the last century, more and more experiments showed that melting is actually a het-

erogeneous phenomenon; melting starts from nucleation of the liquid phase at some

preferred sites of the solid like its surfaces, grain boundaries, large dislocations, discli-

nations and so forth. Around these sites the liquid phase continues to grow with the

rise of temperature until the melting point is reached. In common crystals the largest

Page 25: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 6

imperfect site is its free surface, making this the most likely place to influence the

melting process. A premelting of the surface offers an elegant solution to the curious

enigma of melting, especially as to why can a liquid be supercooled below the freezing

temperature but a solid cannot be superheated above the melting point. Taking clas-

sical nucleation theory into consideration one can argue that such hysteresis should

occur. The lack of superheating of solids hints at the general absence of an energy

barrier for the nucleation of a melt, a barrier which does exist for solidification.

The first researcher to suggest surfaces play an important role in initiation of the

melting process was Tammann [25]. The atoms located at the surface have minimum

number of neighbors, whereas atoms inside the bulk have the maximum number of

neighbors, thus the atoms on the surface have higher vibrational amplitudes. Conse-

quently, taking the Lindemann criterion [1] (See section 2.1) into account will give a

lower melting temperature. This case differs from melting of an ice cube floating in a

glass of water, where the ice surface melts because outside is hotter than inside. But

in most cases thin disordered layers are formed at some relatively high temperature.

In the course of history several experiments attempted to detect surface-initiated

melting phenomena but only at the end of the last century was surface melting ob-

served directly on a microscopic level while employing atomically clean, well charac-

terized surfaces. The first direct observations were made using Rutherford backscat-

tering [26] with shadowing and blocking. Later several more techniques were em-

ployed including calorimetry, electron, neutron and X-ray diffraction, microscopy,

ellipsometry, helium scattering, and even visual inspection with the naked eye. Most

experiments have been carried out near equilibrium, but even when a solid is heated

suddenly, melting still tends to be initiated at the surface [28]. Under some conditions

it is possible to force the solid to break down internally, but then the melting will

Page 26: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 7

tend to begin at internal interfaces such as grain boundaries and other defects. Most

of these techniques are based on the same principle, a low energy beam is aimed at

the desired surface. Due to the low energy of the beam, there is only a small amount

of penetration into the solid enabling us to study the surface behavior as a function

of temperature from the reflected energy. Such a layout is shown in Fig. 1.2, it

describes a one dimensional chain of atoms (with atomic separation a) representing

the solid in cross-section with the electron beam incident normal to the surface from

the vacuum above. From calculation of the optical path difference one can build a

picture of the atoms positions. Fig. 1.3 shows results from a low energy electron

diffraction (LEED) experiment performed on lead (Pb). The constant intensity we

see up to 500K suggests a similar scattering of the two beams aimed at two orienta-

tions of a FCC lead structure. The intensity of the (10) beam is consistently lower at

a given temperature above 500K then the (01) beam showing clearly the anisotropy

of disorder. Also important to notice is that the (001) plane is denser than the (110)

plane. This important experiment demonstrates that surface melting first starts on a

specific facet followed by some other facets which causes the solid to break down at

Tm.

Over the years several theoretical models were proposed for surface melting based

on phenomenological Landau theories [32–35], lattice models [36] and density func-

tion theory [37]. Chapter 3 will review some of the most important theories. These

theories were compared with simulations which hold a very important role in study-

ing surface melting at the microscopic level. Furthermore, numerous articles can be

found which try to explain the observed phenomena from more sophisticated points

of view that states that the melting is a result of one type of inner defects such as va-

cancies, interstitials, disclinations, etc. Simulations were performed on different kinds

Page 27: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 8

Figure 1.2: A general scheme showing a low energy electron diffraction (LEED)experiment, a one dimensional chain of atoms (with atomic separation a)

representing the solid in cross-section with the electron beam incident normal to thesurface from the vacuum above and its reflection, the optical path difference is also

drawn.

Figure 1.3: Pb(110), decrease in intensity of LEED beams due to disordering.Measured intensity excluding the background is plotted against temperature [13].

of elements with different types of structures and in specific surface direction; among

those are FCC [81], BCC [30] and HCP [82] lattice structures. The number of existing

studies on cubic type structures is higher because of their simplistic realization and

their simple Bravais lattice and a wide range of available experimental results, while

Page 28: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 1. INTRODUCTION 9

studies of HCP elements are more difficult to find because of their Non-Bravais lattice

structure which makes the physical system more complex to simulate and to measure

in the lab.

The theory of surface melting is not yet complete, and the evolution of layer

structure at the surface region still needs to be explored. I will use molecular dynamics

to study magnesium with the HCP structure at zero external pressure and at different

temperatures up to its melting point. This thesis is divided into two parts, one

dealing with the bulk solid without surfaces, while the second part describes three

common surfaces and their evolution during the heating process up to their melting

temperatures.

Page 29: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 2

Bulk melting

2.1 Lindemann criterion

The first theory of melting was proposed by Lindemann [1] in 1910. Lindemann

suggested a physical picture in which the atoms of the crystal vibrate around fixed

positions. The size, or amplitude, of these vibrations increases with increasing tem-

perature. At some point anharmonic effects become too large which leads atoms

to invade the space of their nearest neighbors and disturb them, igniting the melt-

ing process. Quantitative calculations of this model are not easy, hence Lindemann

suggested a simple criterion that states: a crystal will melt when the root mean vibra-

tional amplitude,√

〈u2〉, reaches some critical value. Lindemann suggested it to be

10 to 15% of the interatomic spacing. To simplify the picture, it is assumed that all

atoms vibrate about their equilibrium positions with the same Einstein frequency -

νE . Using this approximation the average thermal vibration energy can be estimated

by relying on the equipartition theorem:

E = 4π2mν2E

u2⟩

= kBT (2.1)

10

Page 30: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 2. BULK MELTING 11

where m is the atomic mass, νE is the Einstein frequency, 〈u2〉 is the mean square of

the average thermal amplitude of vibration and T is absolute temperature. Applying

the Lindermann criterion 〈u2〉 = cLa2, where cL is Lindemann’s constant, gives an

estimate for the the melting temperature of

Tm = 4π2mν2EcLa

2/kB (2.2)

From Eq. 2.1, Lindemann’s constant cL can be calculated for a specific type of

Figure 2.1: The measured melting temperature versus the melting temperatureestimated using the Lindemann rule [15].

structure from the known melting temperature of one particular crystal. A detailed

experimental examination [15] shows that cL is not a constant and the correlation

is only fair (Fig. 2.1). Lindemann’s instability criterion has also been tested in

computer simulations of bulk melting of Lennard Jones FCC crystals [17]. The results

suggest that melting occurs when a sufficiently large number of spatially correlated

destabilized atoms in the crystal (e.g. cluster of quasiliquid) are generated (Fig.

2.2). These clusters are generated homogeneously throughout the solid. Jin et al [17]

found that the Lindemann criterion is valid for the cluster and claimed that the

accumulation, growth and subsequent coalescence of the clusters of the liquid phase

Page 31: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 2. BULK MELTING 12

Figure 2.2: 3D visualization of the collective appearance of the Lindemann particlesat T/Tm = 0.79. (a) a few clusters with 20-200 particles (larger black circles)

against other particles (smaller gray circles) which do not form such clusters (b)four large clusters with 219, 214, 187, and 117 particles colored with red, blue, black

and gray, respectively [17].

is the mechanism of homogeneous bulk melting. It is important to add that the

Lindemann model and its refinements only apply to the simplest possible structures.

More sophisticated structures exhibit a vibrational complexity which rules out any

simple role of lattice stability. Another deficiency of the Lindemann model is that

it based on harmonic forces, whereas melting must involve bond breaking. Another

study [16] indicates that the Lindermann model does not adequately estimate the

pressure dependence of the melting temperature. The most serious defect of the

model is that it treats melting as a single atom effect while in reality melting is a

phase transition which is a cooperative process. In addition to all this the Lindemann

model is a one phase model. Despite the above reservations, the Lindemann criterion

was a milestone towards the understanding that the melting transition is a gradual

process.

Page 32: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 2. BULK MELTING 13

2.2 Born criterion

The second important melting model, proposed by Born [2] in 1939, is another ”single

phase theory” for the bulk. Born suggested that a liquid differs from a crystal in

having zero resistance to shear stress. The resistance to shear stress decreases with

rising temperature and the reduction of the restoration forces between atoms. The

softening of the shear moduli eventually leads to a mechanical instability of the solid

structure that ends in the collapse of the crystal lattice at a specific temperature.

Born derived the conditions for the lattice stability by analyzing the free energy of a

solid with a cubic crystalline lattice. Born argued that for a stable lattice, the free

energy must be represented by a positively defined quadratic form. This condition can

be fulfilled if the following inequalities for the shear elastic coefficients (See Appendix

A for definitions), C11, C12, C44 hold:

2C ′ = C11 − C12 > 0

C44 > 0

C11 + 2C12 > 0

(2.3)

According to Born, C44 is the first shear modulus to go to zero and the temperature

where this occurs is identified as the melting temperature, i.e. C44(Tm) = 0. Mea-

surements of elastic coefficients made by Hunter and Siegal [18] on single crystal rods

of NaCl over the temperature range from 20C to 804C (the melting point), showed

that the shear elastic moduli C ′ and C44 decrease nearly linearly with temperature,

but have non-zero values at the melting point (see Fig. 2.3). Varishni [19] made mea-

surements on a series of FCC metals and their shear elastic moduli show a decrease of

55% of C44 with respect to its value at zero temperature. This contradiction between

the Born theory and experimental results was later partly explained by the creation

Page 33: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 2. BULK MELTING 14

Figure 2.3: The proposed variation of C44 near the melting point [18].

of defects in the crystal bulk as a result of a rise in thermal energy when the melting

temperature is approached. Later, the Born stability criterion was extended by Wang

et al. [22, 23], who showed that Born neglected to take into account the contribution

of the external stress, Pext. The corrected stability criterion became:

C11 − C12 − P > 0

C44 − P > 0

C11 + 2C12 − P > 0

(2.4)

In addition Wang et al. concluded that the shear moduli C ′ vanishes before C44, and

that the condition of C ′(Tm) = 0 will give the melting temperature in some cases.

Computers and the development of simulation technique were used to test the

Born criterion by molecular dynamics simulations of bulk copper under zero external

stress. The surfaces were eliminated by the use of periodic boundary conditions [23].

The results showed that C ′ vanishes at some temperature Tf , but that temperature

is higher than the experimental melting temperature Tm, meaning Tf > Tm. This

brought Wang et al. to the conclusion that the mechanical bulk melting, proposed by

Born, is valid only for a perfect infinite crystal. A real crystal with defects and surfaces

Page 34: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 2. BULK MELTING 15

Figure 2.4: The variation of C ′ with molar volume for various metals [24].

undergoes thermodynamic melting at Tm, before it reaches the mechanical melting

point. Later Tallon [24] modified the Born criterion to reach better agreement with

the experiments. Tallon measured the shear moduli of various substances (metallic,

organic, molecular and ionic crystals) as a function of molar volume. Tallon showed,

as previous experiments did, that the shear moduli do not vanish at the melting

point, nevertheless he showed that the volume at the melting point can be predicted

by a continuous extrapolation of one of the shear modulu to the zero value at zero

external stress, Fig. 2.4. Tallon suggested that the shear modulus decreases with

an increase of the volume of the solid and that one of the shear moduli vanishes as

the critical volume is reached. At that point the entropy of the system increases

and the Gibbs free energy is lowered because each atom can access the entire system

volume due to the enhanced diffusion. A first order phase transition from solid to

liquid occurs at T = Tm. In different words, the Born picture could work if it were

possible to superheat the crystal until it reaches the molar volume of the liquid. In

practice, another mechanism of melting becomes operative at the surface of a real

crystal, which effectively lowers the melting temperature.

Page 35: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 3

Surface melting

3.1 Phenomenological thermodynamic model

Surface melting can be viewed as wetting [32], meaning the solid surface is covered

by its own melt. The degree of wetting (wettability) is characterized by the ability of

a liquid to maintain contact with a solid surface. Wetting results from intermolecular

interactions. Wettability is determined by a force balance between adhesive and

cohesive forces. Like the case of adsorption of a gas onto a hard wall one may

observe complete or incomplete wetting depending on the divergence of the quasiliquid

thickness as T → Tm. A surface that remains dry up to Tm can be looked as a

non-wetting one or to demonstrate an absence of surface melting. What makes the

surface premelt or remain dry? This is a question of energy so we need to determine

which possibility has a lower free energy. Looking at a single crystal along one of its

crystallographic planes, hkl, where h, k, l ∈ Z, a surface free energy per unit of area:

γhklsv is defined as the work needed to create a unit area of dry surface and ’sv’ refers

to a solid-vapor interface. For the premelt case the free energy is given by γhklsl + γlv

16

Page 36: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 17

at Tm (Fig. 3.1). Surface melting will only occur if there is a gain in the free energy,

meaning that:

∆γhkl ≡ γhklsv −(

γhklsl + γlv

)

> 0 (3.1)

If the term is less then zero then the surface will remain solid up to Tm. The

Figure 3.1: The solid-liquid and liquid-vapor interfaces, a 3d sample representation:at the bottom the solid which is ordered, a liquid state at the center with no order

but with the atoms still close to each other, and vapour state at the top whereatoms are separated by large distance.

sign and magnitude of ∆γhkl are a function of the material, the surface orienta-

tion and temperature. In general, facets with the largest distance between nearest

neighbors are most likely to exhibit surface melting, e.g. the (001) facet for FCC

crystals and (111) for BCC crystals. A system exhibiting complete wetting can be

described by l (T ) which is the equilibrium thickness of the quasiliquid layer at tem-

perature T . This is a result of balance between two opposite thermodynamic forces.

One force results from the quasiliquid that becomes more liquid-like as a result of

the increasing layer thickness. This translates to a gain in the free energy which is

transformed into an effective repulsive force between the solid-liquid and liquid-vapor

interface. ∆γhkl exp(

− 2lζb

)

+ Wl2

describes the effective interaction energy between

the interfaces at either side of the quasiliquid, l is the thickness of the film, ζb is

Page 37: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 18

a characteristic length scale over which the crystalline order decays [26, 27] as it is

measured from the crystal-quasiliquid interface and W is the Hamaker parameter.

The second, attractive, force between the interfaces originates in the cost in the free

energy associated with supercooling of the quasiliquid layer. The energy cost per unit

area is Lml (1 − T/Tm), where Lm is the latent heat of melting per unit volume.

The total free energy F (l) of the surface covered with a melt layer of thickness l

is:

F (l) = γhklsv + γlv + ∆γhkl exp

(

−2l

ζb

)

+W

l2+ Lml

(

1 − T

Tm

)

(3.2)

The equilibrium thickness l (T ) is the value of l for which F (l) is minimal, i.e.

dF (l)/dl = 0. From eq. 3.2, a crossover thickness lc can be defined from the

comparison of the long range contribution Wl−2 to the short range contribution

∆γhkl exp(

− 2lζb

)

. This separates the problem into two regimes. The first one is

for l (T ) ≪ lc, where the system is governed by the short range exponentially decay-

ing interactions and the equilibrium thickness is:

l (T ) =ζb2

ln

[

2∆γhkpTmLm (T − Tm) ζb

]

≃ − ln (t) (3.3)

where t = (1 − T/Tm), is a reduced temperature. The logarithmic divergence of l (T )

is typical of metals and semiconductors. The second regime l (T ) ≫ lc, i.e. applies to

rare gas crystals, where the long range force must eventually dominate the melting

behavior. The short ranged force will dampen out and one is left with Van der Waals

type dispersion forces. The resulting equilibrium thickness is:

l (T ) =

[

(Tm − T )

2TmW

]−1/3

(3.4)

For Eq. 3.4 to be physical W must be positive which according to its definition

suggests that liquid is less dense than the solid. This power law was tested in numerous

Page 38: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 19

experiments carried out with rare gas crystals, the results gave very good agreement

between the measured and theoretical results.

3.2 Landau model of surface premelting

Lipowsky [33–35] was the first to propose a model of surface melting in the frame-

work of Landau-Ginsburg theory. These models are abstract and general, and the

previously considered model (section 3.1) falls into this category. Landau theory is

based on a power series expansion in the order parameter close to the phase tran-

sition. Landau assumed the order parameter to be small, whereby guaranteeing to

keep the required symmetry of the system in the lowest order terms. The theory

works best for second order phase transitions, where the order parameter is certain to

be small. However, it can also be applied to first order phase transitions, if handled

with caution. Lipowsky assumed a semi-infinite system which undergoes a first order

phase transition at T = T ∗ in the bulk, i.e. the bulk order parameter Mb jumps to

zero at T ∗. Neverthless, the surface order parameter could continuously behave as

Ms ≃ |T − T ∗|β1.

The model considers a d-dimensional semi infinite system with a (d − 1) dimen-

sional surface. The surface normal is taken to be in the z direction. The existence

of a surface breaks the translational invariance along the z axis, resulting in the de-

pendence of the order parameter on z, meaning M = M(z). The general Landau

expansion for the free energy per unit area is:

f M =

∞∫

0

dz

[

1

2

(

dM

dz

)2

+ f (M) + δ (z) f1 (M)

]

(3.5)

where(

dMdz

)2corresponds to an increase of the free energy due to the inhomogeneity

Page 39: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 20

of the order parameter, the bulk term f(M) includes the standard bulk tricritical

point for such a system:

f (M) =1

2a (T )M2 +

1

4uM4 +

1

6vM6 (3.6)

where v > 0 and u < 0 must have these signs in order for Eq. 3.6 to have physical

meaning. This leads to a first order bulk transition at a(T ∗) ≡ a∗ = 3u2/16v and to a

jump in the order parameter from Mb = (3 |u|/4v)1/2 to 0. The last term, δ(z)f1(M),

describes the microscopic changes in the interaction parameters near the free surface.

If f1(M) is expanded in powers of M and only the first term is taken one obtains

f1 (M) =1

2a1M

2 (3.7)

where a1 > 0 is a constant called the extrapolation length and a1 is independent of

temperature. The higher terms are neglected because they do not significantly change

the results deduced from the theory.

Minimizing the free energy according to δF/δM = 0 will give:

dM

dz=√

2f (M) − 2f (Mb) (3.8)

This is a differential equation for the order parameter. Adding an implicit equation

for the surface layer one obtains:

∂f1 (M1)

∂M1=√

2f (M1 − 2f (Mb)) (3.9)

where M1 ≡ M(z = 0). From this last equation , the temperature dependence of

order parameter M1 as T → T ∗ from below is calculated:

M1 ≃

const a1 <√a∗

|T − T ∗|1/4 a1 =√a∗

|T − T ∗|1/2 a1 >√a∗

(3.10)

Page 40: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 21

Figure 3.2: Phase diagram showing the two different phases as a function of theextrapolation length [33].

Two different types of phase transition are obtained, referred to as O1 and O2,

as shown in Fig. 3.2. At the first phase transition O1, when a1 <√a∗, the order

parameter M1 shows a jump in its value like the bulk order parameter Mb. However,

at the second phase transition O2, when a1 >√a∗ and at the tricritical point s

(a1 =√a∗), the surface order parameter goes continuously to zero with the surface

exponents β1 = 1/4 and β1 = 1/2 respectively. The result is surprising because there

are no corresponding bulk exponents. Furthermore, Lipowsky discovered that a layer

of disordered phase intervenes between the free surface and the ordered bulk as T∗

is approached (Fig 3.3). This result suggests that an interface appears at z = l that

separates the disordered surface layer from the ordered phase in the bulk. Due to the

dependence l ∼ |ln (T ∗ − T )|, the interface becomes unstable when T ∗ is approached.

Such a logarithmic divergence has been found in wetting transitions according to

Landau theory. Does the O2 transition occur? To answer this question one has to

estimate the magnitude of the inverse extrapolation length a1; its value must be based

on a microscopic model. Lipowsky analyzed the semi infinite g state Potts model on

Page 41: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 22

Figure 3.3: Order parameter M(z), as O2 and s are approached from T < T ∗ [33].

a lattice by mean field theory. The Hamiltonian of the Potts model is

H =

g∑

〈ij〉Jδsi,sj

+ J1δsi,sj(3.11)

where J1 is the coupling constant for a pair of spins at the surface, J is the coupling

constant for a pair of spins in the bulk, g is the number of possible spin orientations

and the sum includes only the nearest neighbors. In the three dimensional Potts model

with three possible spin orientations, i.e. g = 3, the new continuous transition occurs

when J1 ≤ 1.1J . For real systems it is very likely that the interaction parameters

fulfill this inequality.

3.3 Layering effect

The surface premelting of the solid can be viewed as a competition between repulsive

and attractive interactions due to the solid-liquid and liquid-vapor interfaces. O.

Tomagnini et al. [39] showed how a crucial part of this interaction originates from the

layering effects near the liquid surface. The layering effect [39–41] causes the density

profile to oscillate (Fig. 3.4), these oscillations are observable at the liquid surface

of metals and semiconductors. The effect was first observed in molecular dynamics

Page 42: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 23

simulations [38] and later observed experimentally for Hg [42]. The layering effect

in metals is similar to a layering of a fluid near a wall. The liquid vapor interface

is presumed to act as a sort of a rigid wall for the liquid metal. Several models

have been proposed to explain the layering effect in metals, e.g. Rice et al. [43]

claimed that the coupling between the electronic and ionic profiles is responsible for

the density oscillations. The abrupt decay of the electron density profile is felt by the

ions, effectively, as a wall potential that forces the ions to rearrange themselves into

an order which reduces the energy cost.

Figure 3.4: Density profile of the liquid surface of aluminium exhibits pronouncedoscillations at the liquid vapor interface [38].

The oscillation is defined by a typical liquid periodicity, 2π/Q0, where Q0 is the

absolute value of the wave vector, its value being the maximum of the liquid radial

distribution function. Parallel to this oscillation, another one is present from the solid-

liquid interface, caused by the induced density fluctuation in the liquid layer caused

by crystal planes. The periodicity of this oscillation is dependent on the orientation

hkp which determines the distance between the crystal planes, a.

The two different oscillations, one caused by the liquid-vapor interface and the

other by the solid-liquid interface, overlap and interfere inside the liquid film, if the

Page 43: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 24

Figure 3.5: Comparison between the density profiles of the (111) and (110) surfacesof a Lennard Jones crystal and gold obtained by MD simulations [39], here ’S’, ’L’and ’V’ stands for solid, liquid and vapour respectively. The graphs show a solid

with a thin layer of liquid.

separation between the two interfaces is small enough. The strength of the interference

strongly depends on the orientation of the underlying crystal. Fig. 3.5 shows a

comparison between two different orientations, (111) and (110) faces of a FCC crystal,

where the first is a more close packed face then the second one. For (111) the two

periodicities match, meaning that 2π/Q0 = a and it has a constructive interference.

The constructive interference results in a strong attraction between interfaces which

leads to the absence of surface premelting. The free energy oscillates near its global

minimum; the deepest minimum of the free energy of the close packed face (111) is

at zero thickness of the quasiliquid film as it shown in Fig. 3.6. In the other case,

Page 44: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 25

2π/Q0 6= a, the interference is destructive, and the interfaces repel each other making

surface premelting observable.

Figure 3.6: Variation of the surface free energies as a function of the interfaceseparation L. Upper panel: the close packed (111) face of a FCC crystal, showing

constructive interference. Lower panel: the least packed (110) face of a FCC crystal,showing destructive interference. Corresponding typical plots of densities ρi as afunction of lattice site are shown in the insets. In the (110) case, the periodic

potential induces crystal-like density oscillations for i > L [39].

3.4 Lattice theory

A microscopic theory needs to account for the bulk phase diagram containing solid,

liquid and vapor phases, the triple point and the critical point of any substance. A.

Trayanov and E. Tosatti [44] were the first to develop a microscopic theory of surface

Page 45: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 26

melting. They took a discrete reference lattice to be a simple cubic which is composed

of two FCC sublattices, labeled as 0 and 1. Sublattice ’0’ in the initial state is full

while sublattice ’1’ is empty, having an atom in sublattice ’1’ means having an atom

in interstitial sites. They assumed the interaction to be a simple pairwise interaction

(e.g. the Lennard Jones potential with general unit definitions: ǫ is the depth of the

potential well and σ is the finite distance at which the interparticle potential is zero)

and used a mean field approach to drastically simplify their calculations. The free

energy of N atoms can be written (when assuming that the volume v0 of each cell is

small enough so that it has negligible probability of occupation by multiple atoms)

as:

ZN = vN0∑

pi

v0

....

v0

exp

[−β2

pipjU (ri, rj)

]

dr1dr2...drN = e−βF (3.12)

where U (ri, rj) is a pair wise interaction potential of a Lennard Jones type, β =

(kBT )−1 is the inverse temperature and pi = 0, 1. pi represents the site population,

0 for empty and unity for occupied. The summation∑

piis made over all possible

configurations of N atoms on the lattice sites. According to mean field theory, ZN can

be split into two sums, one the free volume term, Ω, and the other, Q, is the interaction

contribution, e.g. ZN ≈ QΩ. Continuing with the mean field approximation, the

sum is evaluated at its saddle point. The first term Ω is a function of all the atomic

motions and is a combinatorial complex function, evaluated using the effective volume

method [44].

In this model, two order parameters are defined, ρ0 is the average density and cl

is crystallinity. Both are calculated for each layer. The crystallinity in each layer l is

defined as

cl =〈p0,l〉 − 〈p1,l〉〈p0,l〉 + 〈p1,l〉

(3.13)

Page 46: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 27

where 〈p0,l〉 is the average occupation of the first reference lattice and 〈p1,l〉 is the

average occupation of the second one. The free energy is expressed in terms of density

ρl and crystallinity cl. The minimization of the free energy with respect to these

variables leads to a set of nonlinear algebraic equations with boundary conditions

suited to a solid bulk. When a system of M ≈ 400 layers is solved (resulting in

about M equations), it is found that the solution is unique, meaning that it does not

depend on the initial guess of c0l , ρ0l . The calculation shows that surface melting

occurs on both (100) and (110) facets. A thin liquid-like film gradually appears at

the surface region resulting from a sudden drop in the crystallinity from unity to zero

and gradually, with the increase of temperature, the density starts to jump abruptly

from liquid-like to solid-like (Fig. 3.7). This drastic change is probably caused by the

mean field approximation.

Surface premelting has been shown with molecular dynamics studies to have a

substantially broader transition from a solid-like to a liquid-like phase. The thickness

of the quasiliquid film increases very fast as Tm is approached, the growth depend-

ing on the range of interatomic interactions. Trayanov et al, choose to apply the

above model to a rare gas solid, thus the interactions are long range (van der Waals

potential). As a result, the thickness growth with temperature was expected to be

l ∼ (1 − T/Tm)−p, where l is the thickness of the quasiliquid film and the exponent

p = 1/3. l is defined to be equal to the number of layers whose crystallinity (Eq. 3.13)

is less than 1/2 (the interface with the solid) and the density is no less than 90% of

the bulk liquid density (the interface with the vapor). Fig 3.8 depicts the power law

dependence of the thickness on the reduced temperature (t ≡ 1 − T/Tm) predicted by

the theory. As Tm is approached, the surface free energy, γ, decreases very fast (Fig.

3.9), the anisotropy of γ diminishes with temperature and at about 0.9Tm the free

Page 47: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 28

Figure 3.7: Density (vertical lines) and crystalline order (dots) profiles of the LJ(110): (a),(b),(c) solid-gas and (d) liquid-gas systems at coexistence [44].

Figure 3.8: Dependence of the quasiliquid layer thickness upon reducedtemperature. Note the change of behavior from long range attraction (LJ) to short

range (SR) to long range repulsion (REP) [44].

Page 48: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 29

energies of both (100) and (110) surfaces merge. The total decrease of γ stands at

factor of 2 from 0.5Tm to Tm, in contrast to surface roughening (a roughening transi-

tion is a phase transition that corresponds to a morphological change in the interface

between a crystal and its fluid or vapor in thermal equilibrium), where it stands at

1% of the surface free energy γ. This model predicts a continuous transition at Tm,

with γ jumping to the value of the surface free energy of the liquid-vapor interface.

Figure 3.9: Temperature dependence (T/Tm) of the surface free energy γ (units ofǫ/σ2) of (110) and (100) Lennard Jones faces and of the liquid gas interface and

surface specific heat Cs of facet (110) (units of kB/σ2). Note their singularity at Tm

indicated on the figure by vertical dotted line [9].

A. Troyanov and E. Tosatti, the authors of this model continued their investigation

in order to understand the influence of the form of the inter atomic potential on surface

melting. To do this, they changed the sign of the Lennard Jones potential. The

physical explanation for such a change was not given, it was appanrently done to gain

better understanding of the phenomenon. The change causes a weak repulsive force

at long-range, which is feasible for a system of many body interactions to effectively

create a long range repulsion. The change turned out to have a dramatic effect

on surface melting. A few layers become disordered with the rise of temperature,

but further temperature increase does not increase the number of molten layers.

Page 49: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 30

The phenomenon is the analog of incomplete wetting and its called ”blocked surface

melting”. ”Blocked surface melting” was predicted by phenomenological theories of

surface melting [45] and observed experimentally at the Ge(111) surface [46] by Krim

et al. They concluded that the mode of growth of the quasiliquid layer is extremely

fragile and sensitive to the range and sign of the interatomic potential.

It should be recalled that the theory neglects fluctuations that may be important

to surface melting. For instance, the interfaces, solid-liquid and liquid-vapor, are

expected to meander close to Tm, i.e. have out of plane fluctuations, an effect which

at the roughening temperature is typical for all surfaces. It is hard to predict the

effect of roughening on the results of this model because roughening is a long range

phenomenon while surface melting is a short range phenomenon. It is possible that

locally, the physics is described by the surface melting when globally only roughening

matters, disregarding whether surface melting takes place or not [9].

3.5 Density functional theory of surface melting

Ohnegson et al. [47] were the first to propose a density functional theory of surface

melting. The grand canonical free energy functional Ω[ρ] is the starting point of the

density functional theory. Ω[ρ] represents a inhomogeneous system with local density

ρ (~r), temperature T and chemical potential µ. The form of the grand canonical free

energy functional is:

Ω [ρ] = Fexc [ρ] +

d3rρ (r)

Vext (r) − µ+ kBT(

ln(

Λ3ρ (r))

− 1)

(3.14)

where Λ is defined as the thermal wavelength Λ ∼(

h2

mkBT

)2

, Vext(r) is an external

potential and Fexc [ρ] = F [ρ] − Fid [ρ] is an excess free energy functional. The gen-

eral form of Fexc [ρ] is usually not known, thus making approximations necessary.

Page 50: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 31

Ohnegson [47] used the analytical Percus-Yevick expressions [48] for the excess free

energy functional of particles interacting via a Lennard-Jones potential (as in the

previous section 3.4 the same unit definitions are used here: ǫ is the depth of the

potential well and σ is the finite distance at which the interparticle potential is zero).

The difficult part is to find the equilibrium density ρeq(r) that minimizes Eq. 3.14

δΩ [ρeq (r)]/δρ = 0. This was done by a numerical method, simulated quenching [47],

which is similar to the conjugated gradient method [78] but considered to be more

efficient than the last one, when the energy landsape has many valleys.

Figure 3.10: Parallel-integrated density ρ⊥ (z) (full curves) and minimal densityρm (z) (dashed curves) vs z/σ obtained from hard sphere perturbation theory at thereduced temperature t = 1 − T/Tm. The densities are in units of σ−3 [47]. (a) (111)

orientation; (b) (100) orientation; (c) (110) orientation.

Page 51: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 3. SURFACE MELTING 32

In the same framework, surface melting and the onset of anisotropic surface dis-

ordering was investigated for the first time. A phenomenological approach cannot

be used here, i.e. taking for granted the existence of a wetting film viewed as an

undercooled liquid, the theory is required to be fully microscopic. Surface melting is

visible for each orientation but the anisotropy caused by the structure of the crystal

is evident (Fig. 3.10). Orientations that are more loosely packed are more disordered,

e.g. (110) and (100) planes of a FCC lennard Jones crystal with respect to the dense

(111) plane. The theory predicts the logarithmic growth law for the quasiliquid film

l ∼ − ln (t), which means that it determined by a short range interaction. A hystere-

sis effect was observed in the minimization of the functional for the (100) plane with

changes in the temperature, which hints at a layer by layer growth of the quasiliquid

layer via a first order surface phase transition.

Page 52: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 4

Numerical methods

4.1 Molecular Dynamics

Molecular Dynamics (MD) has become a powerful tool over the past few decades

as algorithms and computer power has developed. It is used to simulate many-body

problems that are hard or impossible to solve analytically. MD allows the study and

evaluation of physical processes in complex systems, it can verify theoretical pre-

dictions, predict and show new and unexpected phenomena [50]. MD simulations

require initial data such as the system potential, structure, velocities, ensemble, tem-

perature and so on. These values can come from theoretical models, experimental

data, physical requirements and even from the individual’s own imagination as long

as it justifiable. Once all of the above conditions are given, MD can begin. MD is a

deterministic method, therefore the system evolves over time, this control is gained

from the system’s Hamiltonian H and its derivatives which give the equations of

motion:

33

Page 53: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 34

dpidt

= −∂H∂qi

dqidt

=∂H

∂pi

(4.1)

The integration of these equations over a time step gives the particles new positions

and velocities qi and pi respectively. In classical systems the Hamitonian takes the

simplest form

H = K (pi) + V (qi) =∑

i

p2i

2m+ V (qi) (4.2)

where K(pi) is the kinetic energy and V (qi) is the potential energy which depends

only on the coordinates.

Next, an integration method is chosen. This is a finite difference scheme that

moves the particles coordinates and velocities discretely in time. The chosen inte-

grator needs to be accurate enough for the simulated system so that the numerical

results will be close enough to the real ones, and the integrator needs to be stable

without losses in the total energy (i.e. conservation of energy). This project uses the

predictor corrector integrator [50–52], (see section 4.5).

Then one needs to choose is the statistical ensemble of the system through which

the temperature, pressure and other thermodynamic quantities are controlled. In our

simulations the canonical ensemble (constant number of atoms, volume and temper-

ature - NVT) was selected and implemented with the Nose-Hoover algorithm [61]

to keep the external temperature constant (see section 4.6). The NVT ensemble

was used for the surface simulations. Another ensemble we used is the extended

isothermal-isotension ensemble (NtT) [53, 54] that holds the external pressure and

temperature constant (see section 4.7). This was used in the bulk simulation to find

the equilibrium lattice parameters of magnesium at constant temperature.

Page 54: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 35

The sequence of steps in a MD simulation are summarized in Fig. 4.1. Using this

scheme exact results for the selected potential can be obtained within the limits of

numerical precision and round off computer errors. These results need to be checked

against theoretical predictions or experimental findings. If none exist, than the data

should be checked for whether it behaves according to physical principles and if it

has a true physical meaning.

Figure 4.1: Molecular dynamics flow chart [49].

The system size simulated with MD is limited by the CPU speed and available

memory, they both determine the maximum size of the system and the amount of

time steps during which the system can evolve. Choosing a system that is too big

or a phenomenon that requires too many time steps will cause the simulation to run

for a very long time (weeks, months, years etc.) or will crash the computer due to

memory overflow. A good MD simulation is one which finds the right system size

Page 55: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 36

that will not affect the results by itself and also the right time step that will not skip

over the desired physical effect.

Today with the existing computer clusters over the world and their continued

growth, MD simulations can be explored even further. In our simulations we used

the computer cluster NANCO (See section 4.8).

4.2 The embedded atom potential

At the basis of all MD simulations stands the potential of the system, without which

the MD simulation is not defined. The most general potential is one that takes all of

the interactions between the electrons and the nuclei into account via the Coulomb

forces. This results in a long range interaction which is impossible to calculate on any

current computer. For that reason different kinds of effective potentials are adopted

that reduce the complexity level by making approximations that result in reduction

of computing time. Among them are standard Lennard Jones (LJ) potential, Finnis

Sinclair potential, Embedded Atom Potential (EAM) and others more sophisticated

potentials. The potentials differ in the number of neighbors that each atom feels, the

type of interaction, the analytic form, the fitting and etc.

The simplest potential is a pair-wise potential, like LJ:

ΦLJ (r) = 4ε

(

r

)12

−(σ

r

)6)

(4.3)

The problem with this simplest potential is that it does not give an adequate descrip-

tion for metals and their properties i.e. the potential enforces the Cauchy relation

C12 = C44, where C12 and C44 are the elastic constants. This relation is proved to be

wrong for most metals. Also for metals the pair-wise potential fails to estimate the

Page 56: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 37

structure relaxation and reconstruction around point defects, vacncies etc. Moreover

the vacancy formation energy is overestimated and has about the same value as the

bulk cohension energy.

The EAM potential has two terms, one is a pair-wise interaction like the LJ

which is the core-core interaction and the second is an effective many-body term

which contains the complex nature of metallic cohesion, the general form being:

U =

N−1∑

i=1

N∑

j=i+1

ϕ (rij) +

N∑

i=1

F (ρi) (4.4)

where ϕ(rij) is the pair-wise interaction and F (ρi) is the many-body interaction func-

tion of the electronic charge density ρi around the atom i:

ρi =

Ng∑

i6=jψ (rij) (4.5)

ψ is the contribution to the electron charge density from atom j at the location of

atom i, Ng is the number of nearest neighbors around atom i, determined by the cutoff

radius of the interactions. The cutoff radius is used to speed up the calculations, it

also sets the accuracy of the simulation results. The larger the cutoff length, the more

accurate the results. The cutoff also defines the minimal size of the simulation box. Ng

is calculated by making a neighbor list for each atom i, the list contains the neighbors

of each atom to reduce the calculation time. This list is saved and used during the

simulation, it is common to extend the list of neighbors some percentage beyond the

cutoff, in our simulation it was 25%. The list is updated every few (predefined) steps.

For our project we chose the EAM potential for magnesium that was developed by

Sun et al. [6]. The potential was developed by fitting to some experimentally measured

properties and to others calculated from first principles. These include properties for

both crystalline and liquid bulk phases, including the melting temperatures Tm for

Page 57: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 38

Figure 4.2: Temperature-Pressure phase diagram of magnesium [83].

HCP and metastable BCC solids. The potential is an extension of earlier work by

Liu et al. [59] who developed an EAM potential for Mg employing the force-matching

method. The improvement in the work of Sun et al. compared with Liu et al, is that

Liu’s potential gives rise to an HCP-BCC transition upon heating at zero pressure,

such that the coexistence between hcp Mg and the liquid phase at the hcp melting

point is metastable. Such metastability can potentially lead to artifacts in simulating

melt coexistence and crystallization kinetics. In Sun’s potential this problem was

corrected and it gives rise to stable coexistence between the HCP crystal and its

melt. Fig 4.2 shows the phase diagram of Mg as a function of temperature and

pressure. Another desirable feature of the potential is that, due to the use of the

melting temperature in its fitting, the potential yields melting properties for HCP

Mg in very reasonable agreement with experimental measurements [58].

The explicit form of the potential is given in Sun’s [6] paper, and in Table 4.1.

Page 58: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 39

Table 4.1: D. Y. Sun’s explicit form taken from [6], the energy and distance are

given in units of eV and A, respectively.

Page 59: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 40

4.3 The Hexagonal Close-Packed (HCP) structure

Figure 4.3: The simple hexagonal Bravais lattice. Two dimensional triangular nets(shown in inset) are stacked directly above on another, a distance c apart [68].

The HCP structure is not a Bravais lattice. It is constructed from two hexagonal

lattices that are shifted from each other by a constant vector. The HCP structure

can be described by a simple hexagonal Bravais lattice and a base of two points, each

point standing for an atom. The three primitive vectors are:

~a1 = ax

~a2 = a2x+

√3a2y

~a3 = cz

(4.6)

and the base is~b1 = 0

~b2 = 13~a1 + 1

3~a2 + 1

2~a3

(4.7)

where a is the distance between close atoms in the XY plane and c is the distance

between XY planes in the z direction, Fig. 4.3 shows the structure created by the

primitive cells and in Fig. 4.4 it shows what happens when a base is added to the

hexagonal structure creating a HCP structure.

Page 60: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 41

Figure 4.4: The HCP crystal structure. It can be viewed as two simple hexagonalBravais lattices, displaced vertically by a distance of c/2 [68].

The ideal value for c is

c =

8

3a = 1.63299a (4.8)

Born [69] deduced this value to be the minimum for a HCP lattice in equilibrium. In

his calculation the ideal ratio was found to correspond to the configuration in which

each atom has three atoms on each of the hexagonal planes above and below it, all at

distance a. Thus every atom has twelve nearest neighbors at distance a, six in its own

hexagonal plane and three each on the neighbouring planes. The latter does not force

all elements with a HCP structure to have this ideal ratio because the symmetry is

independent of the c/a ratio. As long as the atoms in the HCP structure are different

from hard spheres, there is no reason for it to have an ideal c/a ratio.

The reader can view some of the elements that have the HCP crystal structure

and their a, c and c/a values in table 4.2.

For this lattice the regular 3 Miller indices (hkl) were modified to 4 Miller indices

(hkil) system for the HCP structure because of its special 6-fold symmetry in the XY

plane. The normal 3 Miller indices cannot represent the symmetry of the system like

Page 61: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 42

Table 4.2: Elements with the HCP crystal structure [68].

Figure 4.5: Miller indices for hexagonal structure. Left figure shows the 3 systemMiller indices and the right figure shows the 4 system Miller indices.

in a simple cubic structure, i.e. (001) is the same as (100) or (010) but in hexagonal

type structures these directions cannot represent the 6-fold symmetry. Another good

example is the indices (100), (010) and (110), which are related by symmetry but a

simple permutation of the indices does not show this. The improved system lets one

to recognize faster and easier symmetrical planes and vectors. The ’trick’ is to define

a redundant additional axis lying in the XY plane, so that the XY plane is spanned

by three vectors, ~a1, ~a2 and ~a3, as in Fig. 4.5. These three axes make an angle of

Page 62: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 43

Figure 4.6: The link between the first 3 indices in the 4 Miller indices system.

120 with respect to one another. For a three-index plane (hkl), the intercepts on

the three axes are, respectively, a/h, a/k and a/i. The intercept on the c-axis, c/l

remains unaffected by the introduction of this redundant axis. In Fig. 4.6 it is evident

that for h, k > 0 i is negative because the intercept on the ~a3 axis is along its negative

direction −~a3. The three index plane (hkl) is then written in the four-index notation

as (hkil).

Since the (hkl) set of planes must divide the a1 into h segments each of length

a/h, and the a2 into k segments each of length a/k, they must divide the a3 into

h + k segments of length a/(h + k). Thus the index i must be equal to −(h + k), as

illustrated in the Fig. 4.6. Thus the following equality must hold:

h+ k + i = 0 (4.9)

Hence, the three-index planes (100), (010) and (110) related to one another by sym-

metry in hexagonal crystals re-index in the four-index notation as (1010), (0110) and

(1100). Now with a simple permutation of h, k and i it is possible to show planes

related to one another by symmetry in hexagonal crystals.

Page 63: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 44

4.4 Initial and boundary conditions

For each simulation run, the initial configuration was constructed according to section

4.3. This was the default structure for the bulk simulations and for the surface

simulation of the (0001) facet. The orientation of the lattice was changed for the other

two (1010) and (1011) facets, such that the free surface was always perpendicular to

the z direction. More details are in appendix B. Besides the geometrical definition,

each atom was randomly assigned a velocity and the overall velocities were modified

so that the velocity distribution behaved according to Maxwell’s distribution. In

addition, the velocities were shifted to ensure the center of mass of the system is

stationary.

The number of atoms in a molecular dynamics simulation is a function of the

program’s efficiency and the computer’s memory and speed. With our current com-

puters the simulation can include thousands of atoms. If one wants to investigate

bulk behavior, then surface phenomena are not of interest and the surface can be

eliminated using periodic boundary conditions. This is accomplished by imagining

that the N atoms in a volume V are only a small part of the entire bulk. This volume

is called the computational (or primary) cell, and the bulk is simulated to be this one

primary cell and its own replicas. The replicas are called image cells, they have the

same size and shape. This periodical repetition of the primary cell in all directions

forms a macroscopic sample, (see Fig. 4.7).

In simulations of surface melting the periodic boundary conditions were altered,

the periodicity was only kept in the x and y directions which are parallel to the free

surface. Both direction −z and z (bottom and upper layers) were kept free, effectively

creating an infinite slab of magnesium. Having two free surfaces allowed us to improve

Page 64: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 45

Figure 4.7: A computational cell and periodic boundary conditions [12] for bulksimulations.

statistics for the system.

4.5 Predictor-corrector method

The integrator chosen in our simulations is the predictor-corrector [50–52] method to

solve the second order ordinary differential equations. The equations are:

xi = fi (xi, xi, t) (4.10)

where

x =dx

dt(4.11)

and

f (t) ≡ f (x (t) , x (t) , t) (4.12)

Eq. 4.10 is the x component of Newton’s second law for atom i, there are similar

equations for the other two directions y and z. The predictor-corrector method has

Page 65: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 46

three steps: prediction, evaluation and correction. These steps are applied at each

time step of the simulation starting from the initial position xi(t) and velocity xi (t).

In further discussion all equations will refer to a single atom disregarding the index i.

Prediction

1. Predict the position x(t+ h), where h is the time step of integration:

x (t+ h) = x (t) + hx (t) + h2k−1∑

i=1

αif (t+ h (1 − i)) (4.13)

in our case we used k = 4 for which Eq. 4.13 can be written explicitly [50]:

x (t+ h) = x (t) + hx (t) +h2

2419f (t) − 10f (t− h) + 3f (t− 2h) (4.14)

2. Predict the velocties:

x (t+ h) =x (t+ h) − x (t)

h+ h

k−1∑

i=1

α′if (t+ h (1 − h)) (4.15)

for k = 4 the explicit form is

x (t+ h) =x (t+ h) − x (t)

h+

h

2427f (t) − 22f (t− h) + 7f (t− 2h) (4.16)

Evaluation

3. Evaluate the force using the predicted values:

f (t+ h) ≡ f (x (t+ h)) (4.17)

Correction

4. The last step is correction of the predicted values from the first step, the idea is

to use a combination of the predicted values with the previous data of position and

velocity:

x (t+ h) = x (t) + hx (t) + h2k−1∑

i=1

βif (t+ h (2 − h)) (4.18)

Page 66: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 47

for k = 4:

x (t+ h) = x (t) + hx (t) +h2

243f (t+ h) + 10f (t) − f (t− h) (4.19)

5. The corrected velocity (still k = 4):

x (t+ h) =x (t+ h) − x (t)

h+ h

k−1∑

i=1

β ′if (t+ h (2 − i)) (4.20)

finally:

x (t+ h) =x (t+ h) − x (t)

h+

h

247f (t+ h) + 6f (t) − f (t− h) (4.21)

The number k defines the numerical stability of the algorithm, the values for

αi, α′i, βi, β

′ii=1,2,3 were determined by Gear [52], by applying the same predictor-

corrector method to linear differential equations and analyzing the stability of the

method.

The values of αi, α′i, βi, β

′ii=1,2,3 were chosen to make the local truncation error

of order O(h4) and the global error for the second order differential equations is

order O(h3). Note that after the correction step the interactions are not reevaluated,

Haile [51] showed that the mean error of the latter is insignificant.

This method is convenient when algorithms for controlling temperature and pres-

sure are used because it computes both the position and velocity at the same time.

Moreover, the correction step accounts for a feedback mechanism which can damp

instabilities that might be introduced by the predictor step.

4.6 Nose-Hoover algorithm

In statistical mechanics the first ensemble that is taught is the NVE ensemble, which

conserves energy, E, number of particles, N and volume, V . Another important

Page 67: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 48

ensemble is the NVT ensemble where the energy conservation changes to constant

temperature T allowing the energy to change. The temperature of a system is related

to the kinetic energy of particles with the same mass by

T =2

3

EkinNkb

=2

3

1

Nkb

N∑

i=1

p2i

2m=

1

3Nkbm

N∑

i=1

p2i (4.22)

Since computer simulations began several methods were developed to control tem-

perature. These include differential, proportional, stochastic and the integral ther-

mostat [64]. The last one is also known as the extended system method or the

Nose-Hoover algorithm. It adds an additional degree of freedom into the system’s

Hamiltonian, and as a result only one more equation needs to be integrated along

with the usual spatial coordinates and momenta equations.

Nose [60] proposed a method that includes the effect of a heat bath by introducing

an additional degree of freedom. The heat bath sets the external temperature of the

system. After some time the system’s temperature would fluctuate around that of

the heat bath. In other words, kinetic energy is exchanged between the system and

the bath. Nose introduced two sets of variables, one is a real set pi, qi and the

other is a virtual set πi, ρi. The virtual set is derived from the so called Sundman’s

transformation [65]:

s =dτ

dt(4.23)

where τ is the virtual time, t is the real time and s is a resulting scaling factor, which

is treated as a dynamical variable. The transformation between the sets is:

qi = ρi

pi = πi/s(4.24)

The additional degree of freedom, representing the heat bath, is πs, it drags with it

an intrinsic mass to define correctly the Hamiltonian. The bath ’mass’ is denoted as

Page 68: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 49

Q. The general Hamiltonian can now be written in terms of virtual coordinates:

H∗ =N∑

i=1

π2i

2ms2+ U (ρi) +

π2s

2Q+ gkBT ln (s) (4.25)

where g = 3N + 1 is the number of degrees of freedom of the extended system. Nose

showed that this Hamiltonian H∗ leads to a density of probability in phase space,

corresponding to a canonical ensemble [60].

From Eq. 4.25 we obtain the following set of equations of motion

d~ρidτ

=∂H∗

∂~πi=

~πims2

(4.26)

d~πidτ

= −∂H∗

∂~ρi= −∂U

∂~ρi(4.27)

ds

dτ=∂H∗

∂πs=πsQ

(4.28)

dπsdτ

= −∂H∗

∂s=

1

s

N∑

i=1

π2i

ms2− gkBT

s(4.29)

In order to return to the real set of variables one must add a new variable ζ :

ζ = sds

dt= s

ds

dt= s

∂H∗

dπs

dt= s2πs

Q(4.30)

and then one obtains (according to Hoover [61]):

d~qidt

=~pimi

(4.31)

d~pidτ

= −∂U∂~qi

− ζ~pi (4.32)

∂ ln (s)

∂t= ζ (4.33)

dt=

1

Q

(

N∑

i=1

~p2i

m− gkBT

)

(4.34)

Equations 4.32 and 4.34 determine the behavior of the Nose-Hoover thermostat

[62]. The bath’s ’mass’, Q, determines the rate of the heat transfer. Its value should

Page 69: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 50

be set carefully, as too low a value will cause the system not to be canonical [63] and

a value too large will cause the system to behave as in the NVE ensemble. Beyond

this, choosing Q slightly differently will not change anything in the final data because

our interest is only in the average values of the measured data [11]. The user needs to

take into consideration that Q causes the data to fluctuate and its value determines

the period of the fluctuation. The more fluctuations one gets the better the average

is.

4.7 The isothermal-isotension ensemble (NtT)

An extended ensemble that was implemented in this project is the isothermal-isotension

ensemble (NtT) with a constant number of atoms. This ensemble was used for two

purposes. One, to test our potential by looking at the system behavior vs. tempera-

ture and the second to find the equilibrium shape of the computational box at each

temperature for extraction of the HCP lattice parameters a and c. This is achieved

by letting the system expand starting from an initial state at T = 0 to the chosen

temperature T . The correct way to do so is by controlling the system temperature

and pressure. By doing so we are allowing all other thermodynamical quantities such

as the shape, volume and energy of the system to fluctuate.

The NtT ensemble for molecular dynamics is a combination of two methods. The

first method is the Nose-Hoover thermostat as explained in section 4.6. The second

method was developed by Parrinello and Rahman [70]. This algorithm allows the

size and shape of the system to be changed by making them dynamical variables,

so that phase transitions can be studied in simulations. The ensemble is realized by

Page 70: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 51

introducing scaled coordinates, siα, in addition to the real ones, riα:

siα =

N=3∑

β=1

Hαβriβ (4.35)

where the Greek indices α, β are the coordinate indices α = x, y, z or α = 1, 2, 3,

the Latin indices, i, count the atoms i = 1..N and Hαβ is a transformation matrix.

The volume of the computational box is given by:

V = det (Hαβ) (4.36)

One can introduce a metric tensor Gαβ by using the Hαβ matrix:

Gαβ =3∑

γ=1

HαγHγβ = HTH (4.37)

where T stands for transpose. The distance between any two atoms i and j is given

by:

r2ij =

α

(

riα − rjα)2

=∑

α,β

(

siα − sjα)

Gαβ

(

siβ − sjβ)

(4.38)

The Lagrangian of the system has to be extended from 3N degrees of freedom

to 3N + 10 degrees of freedom, the additional 10 being for the 9 degrees of freedom

of the real H matrix and the last one is the mass scaling factor which is responsible

for keeping the system at a constant temperature. The Lagrangian form for the NtT

ensemble in molecular dynamics is:

L = K − U → LNtT = L+ LPR + LNose (4.39)

where the extra 2 terms contain the ’kinetic’ and ’potential’ of each constraint. The

first one is for the constant pressure and the second for the constant temperature,

LNose is similar to that described in section 4.6:

LNose =1

2

f 2

Q− (3N + 1) kBT0 ln f (4.40)

Page 71: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 52

where Q acts as the mass of the heat bath, kb is Boltzmann’s constant, T0 is the

bath’s temperature and f is the 10th degree of freedom that scales the mass of the

atoms. The next addition is LPR:

LPR =1

2WTr(

HT H)

− V0Tr (tε) (4.41)

where W acts as the mass of the pressure ’bath’, V0 is the volume of the MD cell in

an unstrained state, t is the external stress applied to the system and ε is the strain

tensor. The complete Lagrangian is [71]:

L = 12

N∑

i=1

3∑

α,β

mf 2siαGαβ siβ − 1

2

i,ji6=j

U (rij) + 12WTr(

HT H

)

−V0Tr (tε) + 12f2

Q− (3N + 1) kBT0 ln f

(4.42)

where m is the atomic mass. Using Eq. 4.42 and Lagrange formalism the equation

of motion can be derived:

~is = − 1

mf2

j,i6=j

∂U(rij)

∂rij

~sij

rij−G−1G− 2 f

f~si

H = W(

PintV(

HT)−1 − V0HH

−10 t(

HT0

)−1)

f = Q

(

N∑

i=1

3∑

α,β

mfsiαGαβ siβ − (3N + 1) kBT0

f

)

(4.43)

where H0 is the transformation matrix of the MD cell in an unstrained state. Pint is

the microscopic internal stress tensor having the form:

P αβint =

1

V

N∑

i=1

mf 2(

H~si

)

α

(

H~si

)

β− 1

2

i,ji6=j

∂U (rij)

∂rij(H~si)α (H~si)β

(4.44)

An important aspect to take into consideration when choosing the NtT ensemble is

that the introduction of the additional variable f and the scaling of particle velocities

or masses are contrary to the actual physical situation. However, these ways of

Page 72: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 53

controlling the energy of the system ensure the fulfillment of the ergodicity principle

according to which the time averaging over the resulting dynamical trajectory is

equivalent to the corresponding ensemble averaging.

In our system the external pressure was set to zero thus the external stress tensor

t is also equal to zero close to the melting point Tm.

4.8 NANCO and MPI

In our simulations we used the Russell Berrie Nanotechnology Institute cluster com-

puter NANCO [55]. NANCO has 128 dual-core SUN/EMET processors, 64 nodes

where each node has 2 processors, 2.2 GHz AMD Opteron 64bit, and 8GB of memory

shared between the 2 processors, for a total of 256 CPUs (cores). The computer works

under a LINUX system with a fast switch based on DDR Infiniband Interconnect.

Figure 4.8 shows an outline of NANCO’s architecture.

Figure 4.8: A scheme of NANCO architecture [55].

Page 73: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 54

The advantage of NANCO is its fast switch which enables the user to write pro-

grams in a parallel code that uses multiple cores exchanging information between

themselves. The combined work of all the cores gives faster results. The significance

of a fast switch is keeping the speedup of the parallel code as linear as possible i.e.

if a single core runs for x time, 4 cores run for x/4 time and so on. In a different

project [56] the latter was tested and confirmed on NANCO (Fig. 4.9).

Figure 4.9: A graph showing the speedup on NANCO [56].

For the purpose of designing parallel code a standard library was written for the

global use of all users around the world [57], the library name is Message Passing

Interface (MPI). MPI is included in NANCO, and is written in a way that users do

not have to study a new language and understand all the communication procedures.

They only need to learn new subprograms of the MPI library that can be called from

C, Fortran, and other programming languages. Its popularity and success comes

from its ability to hide all the network definitions and communications protocols

Page 74: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 55

from normal users and leave them with a few simple subprograms. The foundation

of this library is a small group of functions that can be used to achieve parallelism

by message passing. A message passing function is simply a function that explicitly

transmits data from one process to another, among those subprograms the two most

popular are those sending and receiving data from one processor to another. MPI is

a rich and diversified library containing many many subprograms for different kinds

of applications.

In our project we used the MPI library to divide the total number of atoms into

subgroups of atoms. Each core was assigned own unique subgroup of atoms, in each

step a core computed the new forces, velocities and coordinates of its atoms. For

each step the cores exchanged all of the relevant data with all the other cores before

continuing to the next time step. A main core was always defined to hold all the

numerical values for the purpose of data analysis. The general algorithm of the

program is:

1. Initial collective data definition and assignment for all cores (coordinates, ve-

locities, subgroups of atoms etc.).

2. Each core built a neighbor list for quick data computation for their individual

atoms, the list is updated every few steps in the main loop (in steps 5 to 10).

3. Each core computed the initial forces of their individual atoms.

4. A global update of the forces from all cores to all cores is issued.

5. Each core applied the integrator to the forces (predictor) for their individual

atoms.

6. A global update of the coordinates from all cores to all cores is issued.

Page 75: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 56

7. Each core computes the new forces of their individual atoms.

8. A thermostat is activated to hold the desired thermodynamic values constant.

9. Each core applied the integrator to the forces (corrector) for their individual

atoms.

10. A global update of the coordinates from all cores to all cores is issued.

11. Repetition of steps 5 to 10 for each of the time steps.

12. Data analysis.

4.9 Analysis of errors

It is often stated that a computer simulation generates “exact” data for a given

model. However, this is true only if we can perform an infinitely long simulation,

which is impossible in practice. Therefore, the results of simulations are always

subject to statistical errors which have to be estimated. Besides that, finite-size

effects, unreliable generation of random numbers, inaccurate potential and numerical

techniques have to be taken as sources of systematic errors into account.

The main source of systematic errors could be the interatomic potential, which

is in our case the EAM potential. The validity of the potential is tested in our

simulations, and it was found that the potential is sufficiently reliable and gives an

adequate description of magnesium. The predictor-corrector methods is accurate

enough, provided the time step is chosen appropriately [51, 64]. A random number

generator proposed by Ziff et al. [66] which is used in our simulations was checked

earlier and considered to be very dependable [66].

Page 76: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 57

The aspects mentioned above were given special attention. In order to gather

better statistics we repeated our simulations with different initial conditions several

times, e.g. the distribution of the initial velocities of all atoms were changed by

using different seeds for the random number generator. Various correlation functions

were monitored during our simulations, and corresponding characteristic decay time

of these functions were estimated to make sure that equilibrium is indeed achieved.

An average statistical error was calculated according to recipes of statistical analysis:

∆x =s√k

(4.45)

where s is a standard deviation:

s =

k∑

i=1

(xi − x)2

k − 1(4.46)

and x is simple average value:

x =1

k

k∑

i=1

xi (4.47)

4.10 Visualization of simulations

When working on simulations with large number of atoms, looking only on graphs

sometimes does not enable identification of errors in the simulation or the true results

of the simulation. For that we used visualization in the development of our project.

The complicated geometries of the crystal surfaces inside the bulk, and the correct

implementation of periodic boundary conditions are best tested by visualization tools.

Once the simulation programs were prepared and debugged, the visualization of the

intermediate and final states helped identify phenomena suitable for quantitative

study. In one phrase, it may be stated that ”a picture is worth a thousand words”.

Page 77: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 4. NUMERICAL METHODS 58

Figure 4.10: Atomic Visualization package devoloped by the Computational PhysicsGroup, Technion [67].

The Atomic Visualization package (AViz) was used extensively in all stages of

this project. Our computational physics group developed the AViz package [67],

it is a very powerful visualization tool which helps to enhance the 3D perception.

AVIz includes a lot of various options, which let one to rotate the sample, change

relative sizes of atoms, create animations and movies, add and remove the bonds and

borders of the sample, use color coding, slice of the sample and much more. The

user-friendly interactive interface (See Fig. 3.2) simplifies the use of all these options

in the visualization of computer simulations.

Page 78: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 5

Results: Bulk melting

5.1 The objective of the bulk melting simulations

The calculations described in this chapter had two aims, first to test our choice

of potential and secondly to investigate the mechanical melting of the system. The

potential, adapted from D. Y. Sun’s [6], defines the system behavior while it is held at

constant pressure and/or temperature, during which measurements of system thermal

expansion and structural stability are performed. From the bulk simulations we aimed

to determine whether the system at the melting temperature goes through a first

order phase transition. Second, does our choice of algorithms provide good physical

behavior and if so can the potential give a good estimation of experimentally verifiable

results such as lattice constants?

59

Page 79: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 60

5.2 Initial configuration and general testing

The initial configuration was defined as described in section 4.3. We needed to de-

termine the number of atoms in each direction, including the base atoms, in order

to construct the system. Because of the non-Bravais nature of the HCP lattice the

number of atoms in each ’direction’ is twice that along a row of a single plane. In our

simulation we choose 36 atoms in each ’direction’ which gives a total of 324 atoms

in each XY plane (18x18 atoms). We chose a total of 36 such layers, giving a total

number of atoms to be 11664. This size was selected after several tests of different

system sizes to be optimal. 3D periodic boundary conditions were applied to the

system. The simulations were run on NANCO using a total of 108 cores.

Figure 5.1: Variation of the diagonal elements of the H matrix as a function of timeat 800K. The average value (starting from measurement 500) of each graph and its

fluctuation is given in the legend.

Several simulations of some 106 steps were performed to check how the system

behaved under the NtT algorithm, and whether the temperature and pressure were

Page 80: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 61

Figure 5.2: Variation of the off-diagonal elements of H matrix in time at 800K, theaverage value (starting from measurement 500) of each graph and its fluctuation is

given in the legend.

Figure 5.3: Variation of the potential energy of system for one atom with time at800K where the energy at step 0 is the energy at 0K. The average value (starting

from step 50000) the graph and its fluctuation is given in the legend.

Page 81: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 62

Figure 5.4: Variation of the internal pressure and temperature in time at 800K, theaverage value (starting from measurement 500) of each graph and its fluctuation are

given in the legend.

relatively constant with respect to their desired values. The external pressure dur-

ing the entire project was set to zero. During the simulation different properties

were measured, such as all elements of the H matrix, internal temperature, internal

pressure, order parameters and potential energy. At the start of the simulation the

system geometry was defined by approximated values of the lattice constants, which

results in large fluctuations at the beginning of the simulation until it stabilized after

about 50000 time steps. Each measurement is performed every 100 time steps, for

a total of some 500 measurements. Fig. 5.1 shows the diagonal elements of the H

matrix at 800K, it is obvious that after the first large fluctuations it reaches a steady

state where the remaining fluctuations are a result of the numerical method. Fig

5.2 shows the various off-diagonal elements of the H matrix, note how they fluctuate

around zero after the system reaches a steady state and that their values are negligible

Page 82: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 63

when compared with the diagonal values. Furthermore, the fact that the average off-

diagonal values are zero suggests that the geometrical structure is close to the initial

one. Figures 5.3 and 5.4 show potential energy, internal temperature and pressure

fluctuations during the entire simulation. The results strengthen the feeling that the

algorithm is correctly implemented. In subsequent simulations the mass variable of

the heat ’bath’ was slightly adjusted to give smaller temperature fluctuations while

the mass of the pressure ’bath’ was not changed because it is obvious from Fig. 5.4

that the pressure fluctuations are small. Fig. 5.5 show snap shots taken from different

times during of the simulation. The stability of the structure is obvious. This can

also be viewed in Fig. 5.6 which shows the evolution of the order parameter during

the simulation.

After about 106 simulation steps we switched from the NtT ensemble to the NVT

ensemble to calculate the five independent elastic constants. The results are shown

in Fig. 5.7. They show the same convergence as all the previous results, the average

value is also reached after only 50000 time steps. Here again each measurement is

performed every 100 steps.

In the next sections of this chapter we show results obtained from one long sim-

ulation where temperature was raised in successive steps. Each final state provided

the initial state from a run at a slightly increased temperature, rather than beginning

from a low temperature each time. We initally heated the bulk sample starting from

a relatively low temperature, 800K, which we know from what has been shown just

now, to remain stable after a few time steps until the end of the simulation. At

each temperature the simulation time was divided between two ensembles. First the

system was started in the NtT ensemble for 350000 time steps where each time step

is equal to dt = 0.01 × 10−15 sec. During this stage different properties such as all

Page 83: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 64

Figure 5.5: Snapshots of the solid at 800K during the simulation at different timesteps. Each snapshot is identified by the step number.

elements of the H matrix, internal temperature, internal pressure, order parameters

and potential energy were measured. In the second step the system was switched

to NVT ensemble by holding the H matrix constant for 100000 time steps, here the

Page 84: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 65

Figure 5.6: Variation of the order parameters in time at 800K. The average value(starting from measurement 500) of each graph and its fluctuation is given in the

legend. Note that the system reaches its average value after only 50000 steps.

Figure 5.7: Variation of all five independent elastic constant in time at 800K. Theaverage value (starting from measurement 500) of each graph and its fluctuation isgiven in the legend. Note that the system reaches its average value after only 50000

steps.

Page 85: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 66

main measurements, in addition to the previous ones, were the different elastic con-

stants relevant to a HCP structure and from these the values of the shear moduli

were calculated. Each measurement is performed every 100 times steps, resulting in

total of 350 ’different’ system configurations (in the first stage). This is important

to ensure the ergodicity which says that, over long periods of time, the time spent

by a particle in some region of the phase space of microstates with the same energy

is proportional to the volume of this region, i.e., that all accessible microstates are

equally probable over a long period of time.

The total of 450000 steps are repeated during each temperature increase. The

first two increases were by 50K. Starting from 900K, each increase was by 10K up to

1090K, then by 3K until the sample reached its bulk melting temperature. Fig. 5.8

shows the average values and fluctuations of the internal temperature and pressure

of the system. It is obvious that the average is the desired values and the error bars

are small and are kept of the same order until high temperatures are reached, close

to the bulk melting temperature.

5.3 Order parameters

We now describe measurements of two order parameters. One describes the crystalline

order in the XY plane which is a triangular lattice by measuring the angles between

nearest-neighbors which should be 60 apart (See Fig. 5.9). Its definition:

ηXY =

1

5N

N∑

i=1

6∑

j=2

exp

[

i6 arccos

(

~ri1 · ~rija2

)]

(5.1)

where N is the number of atoms, a is the lattice constant calculated by averaging

over the distance of each of their 6 neighbours in the same XY plane over all atoms.

The angular brackets denote averaging over time.

Page 86: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 67

Figure 5.8: The graphs show the average of the internal temperature and pressure ofthe system, the error bars are fluctuations.

Figure 5.9: The triangular structure of an HCP lattice in the XY palne.

The second order parameter describes the separation between the triangular layers

in the z direction and its definition is:

ηZ =

1

N

N∑

i=1

exp

[

i

(

c/2z · ~ri

)]

(5.2)

where c is the lattice constant calculated by averaging over the distance along the z

axis of their other 6 neighbours located not in the same XY plane .

Fig. 5.10 shows the final results of this long simulation in which the system was

Page 87: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 68

Figure 5.10: Upper graph show the order parameters vs. temperature during theheating processes while the lower graph show the corresponding order parameter

fluctuations vs. temperature. The dashed lines are present to guide the eye.

started at 800K and gradually heated until it collapsed. Fig. 5.10 is divided into two

parts. The upper part shows the order parameters vs. temperature during the heating

processes while the lower part show the corresponding order parameter fluctuations

vs. temperature.

The results show that the system maintains it structure up to about 1100K with

small fluctuations. The order parameters decrease moderately, but close to 1100K

they start to change steeply and show a sudden drop to zero at 1102K. The magne-

sium bulk melting temperature can be defined as Tb = 1102±3K. The ratio between

the bulk melting temperature and the thermodynamic one, 923K, is about 1.2Tm.

This matches the prediction [7] for the bulk melting temperature in metallic elements.

Page 88: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 69

5.4 Thermal expansion

Figure 5.11: Lattice parameter a vs. temperature during the heating processes.Dashed line are the results from the simulation, solid line is a fit to experimentalresults and the triangles are the available experimental data in this temperature

range.

The potential by D. Y. Sun et al [6] turned out to be a good choice for our

system. In addition to the results for the order parameter, the potential succeeds in

estimating values of the lattice parameters as a function of temperature with good

accuracy, deviations being less then 0.5%. The results of the thermal expansion of the

lattice parameters are shown in Figs. 5.11 and 5.12 for a and c respectively. In each

figure the dashed line is the result of the simulation, solid line is a fitted function to

experimental results [5] and the triangles are the available experimental data at these

temperatures. Note how the simulated results, dashed line, have the same trend as

the solid line up to the bulk melting temperature calculated in the previous section

to be Tb = 1102K. The errors in the lattice measurements (their fluctuations) are

Page 89: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 70

Figure 5.12: Lattice parameter c vs. temperature during the heating processes.Dashed line are the results from the simulation, solid line is a fit to experimental

results and the triangles are the available experimental data over this temperaturerange.

Figure 5.13: Volume of the system vs. temperature during the heating processes.

Page 90: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 71

less than 0.5% with respect to the averaged values.

The next important result is the volume thermal expansion, with results shown

in Fig. 5.13. The linear expansion of the volume is obvious, this behavior is typical

for many metallic elements. Furthermore, at Tb = 1102K the volume jumps suddenly

by more than 1% which is consistent with a first order phase transition from solid to

liquid.

Fig. 5.14 is a visualization of the heating process, 4 snapshots are shown from

four different temperatures 800K, 980K, 1050K and 1102K. Each snapshoot is the

final time step before the system was heated again. The red contour is kept constant

and it represents the initial size of the system, at 1050K it is noticeable that the

system is slightly larger. The atomic layers each have an initial color which each

individual atom maintains, in order to help us visualize the extent of the disorder. In

the first three snapshots the order in the system is obvious but at 1102K all signs of

order disappear, atoms become mixed with those from other layers and the volume

is significantly increased. This is a liquid. To obtain additional results from the

simulation, the elastic constants were also measured during the simulation (for the

last 100000 time steps), these results being present in Fig. 5.15 in the form of the

four independent four shear moduli C11 + C12 , C11 − C12 , 2C55 , 0.5C33. The figure

is divided into two parts, each marker shows different shear moduli; the separation is

made only to make the graphs more readable because C11 +C12 is always higher than

the other three shear moduli. Their decrease suggests that the solid becomes softer as

the temperature increases until it collapses. Again this is consistent with a first order

phase transition, we have a jump of one of the shear moduli to a lower value relative

to its value and the other three shear moduli, i.e. 0.5C33. The shear moduli do not

jump to zero according to Born’s criterion. We think this is a result of a combination

Page 91: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 72

Figure 5.14: Snapshots of the system during the heating processes.

between increasing numerical fluctuations as we approach the melting temperature,

and the fact that elastic constants are usually measured at very low frequencies (close

to zero) while in our measurements the frequency is much higher because they depend

on the system’s fluctuation which are high. This combination results in higher values

Page 92: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 73

Figure 5.15: Elastic constants vs. temperature.

Figure 5.16: Shear moduli vs. temperature. Upper curve shows simulated results asin Fig 5.15, lower curve shows extrapolated fit to experimental [85] results. Eachgroup is approximated by a large red band. The difference between the centers of

the two bands is about 20GPa.

Page 93: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 74

of the shear moduli. This can be explained by a simple example: if one would punch

water at a very slow speed one would penetrate the water with no resistance (zero

shear) but if the punch is at high speed one would feel some resistance and it even

might hurt (non-zero shear).

We tried to link our results with known experimental measurements of elastic

constants between 0K and 300K. We performed a second order polynomial fit to the

various measured values with excellent agreement between the experimental results

and the fit. Then we extrapolated the functions up to 1000K, with the results shown

in Fig 5.16. In the figure shear moduli versus temperature are shown, the experimental

[85] group of fitted graphs are plotted below and parallel to the simulated group of

graphs. Each group is approximated by a large band with dashed lines at their

centers. The upper right band is our previous simulated results and the lower, long

middle left band, is the fitted functions to the various shear moduli. We noticed a

systematic difference between these two bands of about 20GPa suggesting that our

result are reasonable with respect to our computing limitations discussed previously.

Furthermore, we tried to approach the melting temperature with small tempera-

ture jumps, 1− 3K, but the fluctuation were too large and the system still collapsed

above 1099K, which suggests an uncertainty in the bulk melting temperature of

2 − 3K.

Next, we plotted the lowest shear modulus 0.5C33, before and after correction, as

a function of the atomic volume Vatom as shown in Fig. 5.17 to check the Tallon’s

correction to the Born criterion. We see that before the correction (marked in a filled

square) the critical volume is much larger than the expected one (marked in a filled

in circle) and even larger than the experimental one (marked in a filled in triangle)

but after we shifted the shear modulus by 20GPa we found a critical volume very

Page 94: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 75

Figure 5.17: Shear modulus C33 vs VAtom. The square markers are the simulated C33

and the diamond marker are the corrected simulated C33, the dashed lines are alinear fit to C33 simulated and corrected. The sqaure filled marker is the critical

volume at Tb, the filled circular marker is the critical corrected volume at Tb and thefilled triangular marker is the corresponding experimental liquid volume at same Tb.

close to the simulated one. This correction suggests that the Tallon modification to

the Born criterion may apply in the case of HCP magnesium.

Fig. 5.18 shows results for the density of solid magnesium vs. temperature com-

pared with the liquid experimental density [84]. Note that both graphs (circular

markers and solid line) show the same trend up to the bulk melting temperature

where it falls to the liquid density value at 1102K. The error between the density

values for solid and liquid at 1102K is only about 1.5%.

The excellent agreement with experiment as well as the internal consistency con-

firms that our choice of potential is good and our implementation is correct.

Page 95: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 5. RESULTS: BULK MELTING 76

Figure 5.18: Dashed line with circular markers shows the simulated results for solidmagnesium density vs. temperature while the solid line shows the liquid

experimental density [84] vs. temperature and the horizontal dashed line is theliquid density at 1100K.

Page 96: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 6

Results & Discussion: Surface

melting

6.1 The goal

In chapter 5 we showed results for the bulk melting transition; these simulations

validate our description of the physical system. Bulk melting cannot be achieved

as easily as supercooling water below its freezing temperature, 273K, in a regular

kitchen refrigerator. The main aim of the present chapter is to investigate the phe-

nomenon of surface disordering and premelting and its strong contribution to the

thermodynamical melting temperature. The results we present here are compared

with experimental measurements.

The results will help us answer questions such as: What is the thermodynamic

melting point in our model? How do the structural and energetic properties change

as a function of temperature? Which of the HCP facets melts first? Are these

phenomena anisotropic? Another important issue we wish to examine is whether the

77

Page 97: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 78

Born scenario for the melting transition (e.g. the concept of critical volume) can also

be applied to surface melting.

6.2 Initial configuration and simulation - general

information

In our surface simulation, the system was an infinite slab (in the x and y directions)

with two identical free surfaces. The slab contains a total of 40 layers. For visualisa-

tion purposes the atoms in each layer have different colors.

For all three orientations (0001) (Fig 6.1), (1010) (Fig 6.2) and (1011) (Fig. 6.3),

refered also as the c, a and s facet respectively (see Fig. 6.4), the atoms in each plane

were arranged in an array of [16x16]. For each orientation the crystal was rotated

so that the normal to the surface is in the direction of the z axis (The procedure

is explained in appendix B). Periodic boundary conditions were applied in the XY

plane (see Fig. 6.4).

Table 6.1 summarizes the distances between nearest-neighbor atoms in the x, y

and z direction (after rotation) and the in-plane surface density, ρs, in units of the two

lattice constants a and c. In 300K the lattice parameters have the value of a = 3.2

and c = 5.2 in angstrom units. There are two remarks regarding the geometric setup

which are due to the nature of a Non-Bravais lattice. The first remark applies to the

s facet (1011), where there are two atomic planes very close to each other separated

by 16

ac√

3√4c2+3a2

≈ 0.4

A. In this case the two adjacent planes are treated as one and az

is the distance between the new ’planes’ (See Fig 6.5). The second remark applies

to all facets: in addition to the 6-fold symmetry in the XY plane the atoms are not

arranged as conveniently as in the cubic systems. There is no reflection symmetry in

Page 98: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 79

Figure 6.1: Initial configuration of Mg (0001), z is the direction normal to the freesurface.

this plane, only the z direction has this symmetry. This was taken into consideration

mainly in the measurements of the order parameters for each axis. More detailed

information on the surface geometry can be found in appendix B. In general, all

facets ’suffer’ from the absence of the simplicity of a cubic symmetry, Table 6.1 does

not fully describe the layout of the atoms, figures 6.1-6.3 convey the message better.

On substituting the values of the lattice constants a and c in Table 6.1 one gets

that the in-plane density

ρs(0001) > ρs(1010) > ρs(1011) (6.1)

Page 99: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 80

Figure 6.2: Initial configuration of Mg (1010), z is the direction normal to the freesurface.

Figure 6.3: Initial configuration of Mg (1011), z is the direction normal to the freesurface.

but if we consider the two nearby planes of an s facet as one, than the result is

different

ρs(0001) > ρs(1011) > ρs(1010) (6.2)

this fact will become important in some of the coming sections.

Page 100: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 81

Figure 6.4: Illustration showing the applied boundary conditions with a free surfacesamples.

Figure 6.5: The two dashed turquoise lines are separated by ac√

3√4c2+3a2

and each line

hides two planes separated by about 0.4

A.

The simulations were divided into two parts. The first part was done to let the

system at a given temperature to reach equilibrium, more precisely, to reach a point

where the fluctuations of various internal properties such as temperature, pressure

and energy have no significant temporal variations (beyond the statistical fluctua-

tion). At the end of the equilibration part the values of these properties are fluctuat-

ing slightly, e.g. the internal temperature fluctuation is less than 0.1T%. This part

was carried out over Neq = 50, 000 integration time steps, each time step is equal

Page 101: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 82

Surface ax ay az ρs

Mg(0001) a/2√

3a/2 c/2 2/(√

3a2)

Mg(1010)√

3a/2 c/2 a/2 2/(√

3ac)

Mg(1011) a/2√a2 + c2/2 ac

√3√

4c2+3a21

a√a2+c2

Table 6.1: List of nearest-neighbor atom projected distances along x, y and z, andof surface density for all 3 facet orientations.

to dt = 0.01 × 10−15 sec. The second part contains the measurements, where various

structural and thermodynamical properties of the system such as the internal temper-

ature, internal pressure and various order parameters were calculated, accumulated

and averaged over a long period of Nmeas = 950, 000 MD steps. The trajectories of

the atoms of the sample are produced for data analysis using the canonical ensemble

NVT, each measurement was made every 1, 000 time steps, for a total of 950 mea-

surements during a simulation which gave statistically independent data. Performing

more measurements (above 950) gave almost no additional information. Simulations

with different number of layers and/or different number of atoms in a single layer

were also performed. In the XY plane we varied the number of atoms along an in-

plane axis between 8-20 atoms. The results were similar to the bulk simulations with

different number of atoms. Too small a number of atoms emphasized the periodic

boundary conditions, due to the large cutoff radius (rcut = 7.5

A). Along the z axis

we made simulations with 40, 60 and 80 layers. The number of layers beyond 40 had

almost no influence on the final results, except showing a more gradual descent of

Page 102: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 83

measured properties such as order parameter, density profile and distance between

nearest layers (See Appendix C for details).

6.3 Structural order parameters

For each orientation and axis an order parameter (special cases will be discussed

later in the section) was defined which describes the average location of all atoms

in each layer of the system. In a perfect initial state all order parameters are unity,

except for one which will be discussed below. As the temperature increases the

value of the order parameter decreases. The reason for this can be explained by its

connection to low energy electron diffraction (LEED) intensity [79], which can be

measured experimentally. Atomic vibrations to some extent break the periodicity

of the lattice. Diffraction effects provide essentially direct information about the

vibration amplitude. The surface structure order parameter for each layer is (in most

cases):

ηl,α =

1

n2l

j∈lexp (i~gα~rj)

2⟩

(6.3)

where α = 1, 2, 3 ≡ x, y, z are indices of the Cartesian axis x, y, z and ~g1, ~g2, ~g3 =

2πaxx, 2π

ayy, 2π

azz is a set of vectors which define a set of different axes, aα is the nearest-

neighbor distance in the α direction (From table 6.1) and nl is the instantaneous

number of atoms in the layer l. The sum extends over the particles in layer l and the

angular brackets denote averaging over time.

Equation 6.3 describes all measured order parameters except for one case, that

on the (0001) surface where each layer is a triangular plane. In this case the order

parameters for the x and y axis merge into one order parameter that measures the

angle between nearest-neighbors, which when ordered are 60 apart (See Fig. 6.6).

Page 103: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 84

Its definition is similar to the one in section 5.3:

ηl,XY =

1

n2l

i∈l

6∑

j=2

exp

[

i6 arccos

(

~ri1 · ~rija2

)]

2⟩

(6.4)

Figure 6.6: The triangular structure of a single layer in the (0001) orientation.

In a perfect initial state all order parameters are unity, except for one order pa-

rameter, that for the s facet in the z direction, because here we combine two layers

with separation of about 0.4

A and the center of mass of these planes is in the mid-

dle, thus the relevant order parameter in the initial state has a value of 0.75. The

decrease of the order parameter with temperature is a result of thermal vibrations

and defect formation mainly on the surface, but also in the center of the sample.

Figures 6.7-6.14 show the results for all the various order parameters for all 3 facets.

Each figure contains a legend of all simulated temperatures. The line that connects

between the various points is to guide the eye. In Fig 6.7-6.8 we see that the c facet

which is the closest packed sample, maintains its structure all the way up to 960K

while at 970K it loses order in all the layers. As a result Tm for (0001) was defined

to be Tm = 970K± 5K. Continuing to the a facet, Fig. 6.9-6.11, one sees that for all

directions the order parameter gradually decreases up to 960K and suddenly at 970K

all order parameters fall to zero, consistent with a liquid state of the sample and a

Page 104: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 85

melting temperature of Tm = 970K ± 5K. Finally, from Fig. 6.12-6.14 we see that

the various order parameters for the s facet behave similarly to those of the a facet

but here the gradual decrease is up to 930K followed by an abrupt decrease at 940K.

The latter suggests that melting starts from the direction of the s facet and that it

drags our simulated crystal to collapse at its melting temperature Tm = 940K ± 5K.

This is not seen in the other two facets due to the periodic boundary conditions in

their XY plane which suppress the melting phase at 940K and allow the samples

to superheat. The difference between the simulated melting temperature and the

experimental melting temperature 923K can caused by several processes. The ones

with high probability are that the chosen number of atoms are not in the thermody-

namical limit, the system is scaled down which leads to higher melting temperature.

The second process can be as a result of our chosen potential which may not be fully

adjusted to the physical environment we set in the simulations.

Figure 6.7: Order parameter of the XY plane of the Mg c facet (0001) at varioustemperatures.

Page 105: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 86

Figure 6.8: Order parameter of the z axis of the Mg c facet (0001) at varioustemperatures.

Figure 6.9: Order parameter of the x axis of the Mg a facet (1010) at varioustemperatures.

Page 106: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 87

Figure 6.10: Order parameter of the y axis of the Mg a facet (1010) at varioustemperatures.

Figure 6.11: Order parameter of the z axis of the Mg a facet (1010) at varioustemperatures.

Page 107: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 88

Figure 6.12: Order parameter of the x axis of the Mg s facet (1011) at varioustemperatures.

Figure 6.13: Order parameter of the y axis of the Mg s facet (1011) at varioustemperatures.

Page 108: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 89

Figure 6.14: Order parameter of the z axis of the Mg s facet (1011) at varioustemperatures.

The anisotropy between the x and y order parameters (the periodic directions)

for a given facet (See Fig. 6.16) arises from the anisotropic structure. The different

distances between nearest atoms along each axis affect the value of the order parame-

ter and its behavior as a function temperature. Assuming, in the first approximation,

that each atom oscillates with the same amplitude in both x and y directions, i.e.

〈u2x〉 ≃

u2y

, and expanding the structure order parameters in terms of 〈u2α〉/a2

α (this

was found to be valid in our MD simulation while in general a ≃ 3.2

A and the mean

square amplitude of vibration has order of 〈u2〉 ≃ 10−2

A), we obtain:

ηl,α ≃ 1 −∑

j∈l

4π2 〈u2〉n2l a

+ ... (6.5)

Hence it follows that if ax > ay then ηx > ηy, for the case of a HCP structure when

compared with a cubic structure where the latter does not occur, e.g. in the case of s

facet (1011) (Fig. 6.17) the result are opposite, ax < ay but ηx > ηy. This is a result

Page 109: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 90

Figure 6.15: Comparison of order parameter of the layer next to the top one of the(0001) direction as a function of temperature.

Figure 6.16: Comparison of order parameter of the layer next to the top one of the(1010) direction as a function of temperature.

Page 110: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 91

Figure 6.17: Comparison of order parameter of the layer next to the top one of the(1011) direction as a function of temperature.

of the Non-Bravais lattice structure. Figures 6.8, 6.10 and 6.13 which are associated

with the original z axis (the one that intersects with the surface normal of the c facet)

remain ordered through the entire heating process. The observation emphasizes the

influence of the rather large cutoff of the potential. The same consideration can be

applied to explain the difference between the in-plane (XY plane) components of the

order parameter and the out-of-plane component (z direction), but one has to take

into account that the value of the mean square vibrational amplitude in the z direction

is larger than the ones in the XY plane. To complete the list of graphs presented, the

order parameter vs. temperature of the c facet is given in Fig. 6.15. The difference

between the XY plane and the z axis emphasize the long range potential and the

contribution of the mean square vibrational amplitude.

Page 111: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 92

6.4 Local density profile

A local density profile ρ(z) is defined as the average number of atoms in a slice of

width ∆z. In our sample z is always in the direction of the normal. The proper

choice of the width ∆z of a slice is a trade-off between two factors. First, a very

small width results in too few particles in each slice, resulting in large statistical

errors and data scattering. Second, a very large width of a slice will not show the

actual dependence of the properties on the distance from the surface. Therefore a

balance between those two requirements must be achieved. To guide the eye, ρ(z) is

represented by a continuous function defined according to Chen et al [31]:

ρ (z) =

1√2π∆z2

i

exp

(

−(z − zi)2

2∆z2

)⟩

(6.6)

where zi is the z coordinate of atom i, with z = 0 set at the bottom of the slab and

Figure 6.18: Density profile across (0001) along the z direction perpendicular to thesurface at various temperature, as indicated. y axis is normalized relatively to

maximum density profile value at low temperature.

Page 112: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 93

Figure 6.19: Density profile across (1010) along the z direction perpendicular to thesurface at various temperature, as indicated. y axis is normalized relatively to

maximum density profile value at low temperature

Figure 6.20: Density profile across (1011) along the z direction perpendicular to thesurface at various temperature, as indicated. y axis is normalized relatively to

maximum density profile value at low temperature

Page 113: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 94

the angular brackets indicate time average. ∆z was set differently for each surface and

was given the value ∆z = 0.1Lwidth where Lwidth is the width between layers in each

facet. The premelting of the crystal surface exhibits itself in the loss of long-range

order. This transition can be examined by monitoring the layer by layer modulation

of the density profile of the system at various temperatures up to the melting point

Tm. Tm was estimated in the previous section 6.3. Figures 6.18-6.20 shows results

for c, a and s facets, respectively. One sees that at low temperatures the density

profile ρ(z) consists of a series of sharp, well resolved peaks. The atoms are packed

in the layers with constant density in each layer and virtually no atoms in between

these parallel layers. As the temperature is increased the effective width of each layer

becomes broader due to the enhanced atomic vibration and the position of the peaks

move to larger values of z due to the thermal expansion.

At temperatures close to Tm the atomic vibrations become so large, especially in

the surface layers, that disorder sets in, with atomic migration taking place between

the layers. Evidence for this is given by the fact that the minima of ρ(z) between two

peaks rise to non-zero values. This is a reminiscent of a liquid-like structure, suggest-

ing that the system is crossing over to a state of ’premelting’. At some temperatures,

denoted by T∗, the density of the topmost layer becomes slightly lower than that of the

middle layers. The loss of density is accompanied by the appearance of atoms on top

of the first surface layer from both sides of the slab. These atoms are called adatoms

and the additional surface layer is termed an adlayer. As the temperature is further

raised atoms from the middle of the sample start to diffuse toward the adlayers. The

distinction between the layers becomes blurred. The generation of adatom-vacancy

pairs induces disorder and converts the topmost layers into a thin quasiliquid film.

The ’premelting’ phase begins on each facet at a different temperature, denoted by

Page 114: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 95

T∗. T∗ ≃ 900K for (0001), T∗ ≃ 700K for (1010) and T∗ ≃ 850K for (1011), as

marked in Figs. 6.18-6.20. We see that because ρs(1011) > ρs(1010) the premelting

phase starts at (1010). These results change our understanding of the physical picture

we got in the previous section 6.3. The melting may not start from the s facet but

actually from the a facet. The s facet maybe is still a solid at 940K but a disordered

one, this is understood by the remaining fluctuations of the density profile values at

the center of the sample at temperatures 940K and 970K. In the case of the a facet,

as the temperature rises we can see from both sides of the surface an increase in the

length of the ’flat’ line up to 970K where the center fluctuations becomes negligible

and the density profile is a complete ’flat’ line. This means that the entire sample has

lost order, the atoms are mixed and there is no obvious evidence of layer separation.

These leads us to believe that the a facet has melted at 970K. One has to take into

account that in this case, the results can be affect by the finite size of the samples

preventing us from giving a final verdict to the question: which of the facets melts

first?

From our measurements we can conclude the following about the formation of an

adlayer: it begins first on the least packed surface (1010), then on at (1011) facet and

finally on the close packed surface (0001) which is very close to its defined Tm. Most

of the adatoms come from the top 2-3 layers depending on the facet.

These results are in good agreement with other simulations which investigated

surface premelting of FCC and BCC metals such as Al [81], Ni [31] and Va [30]. All

show that the adlayer appears first on the least packed surface and last in the closest

packed surface at a temperature close to Tm.

Page 115: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 96

6.5 Distance between layers

Structural information, such as an interlayer relaxation and surface thermal expansion

can be calculated directly from the difference between the average distances between

the ith and (i+ 1) the layers:

di,i+1 =

1

ni+1

j∈i+1

zj −1

ni

j∈izj

(6.7)

where zi is the z coordinate of the atom i, the sum includes atoms in the layers i

Figure 6.21: Distance between the neighboring layers vs. temperatue of (1011).

and i + 1 and the angular brackets denote averaging over time. The values of di,i+1

have physical meaning at the various temperatures until premelting sets in. Above

such temperature the very concept of distinct layers becomes somewhat doubtful, even

though some structure is still visible in the local density profiles. At low temperatures

the outer surface layers exhibit an inward relaxation, i.e. ∆1,2, where

∆1,2 =d1,2 − dbulk

dbulk(6.8)

Page 116: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 97

and d1,2 is the distance in the z direction between the first and second surface layer (in

Figure 6.22: Interlayer distances, normalized by the center layer distance (’bulk’distance) of c, a and s at 800K.

Figure 6.23: Interlayer distances, normalized by the center layer distance (’bulk’distance) of c, a and s at 900K.

Page 117: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 98

this example at the bottom of the sample), and dbulk is the distance between the two

neighboring layers in the center of the sample where it behaves like a bulk. Fig. 6.21

of s facet exhibit this in a clear way. The inward relaxation can be explained as due to

a ’deficit’ of the electron density at the surface, relative to the electron density in the

bulk. The sample compensates for this ’deficit’ by contracting the distance between

the first and second layers. The next several layers exhibit a outward relaxation. The

distance between the neighboring layers increases with temperature and the thermal

expansion of the surface layers is larger than the thermal expansion of the layers in the

center of the sample (the ’bulk’). The observed ’anomalous’ thermal expansion of the

surface layers is a direct manifestation of the broken symmetry of positional inversion

at the crystal surface. Therefore, atoms rearrange their equilibrium positions in the

surface layers and probe the more anharmonic region of the potential. Trying to

compensate for the lack of nearest neighbors results in surface reconstruction. The

difference in the geometry of the various samples is reflected in their thermal expansion

in the surface region with a surface which is less packed expands more than a close

packed one. This transition can be observed by making a comparison of the behavior

of the layers at 800K for all facets (Fig. 6.22) with that at 900K (Fig. 6.23).

In general we can conclude that for all facets the physical behavior as described

above is similar but it starts at different temperatures. When the sample breaks down

the measurements of dij become incorrect. From these results we cannot conclude

which of the facets is responsible for melting. The results for the c and a facets

are shown in Fig. 6.24 and Fig. 6.25 respectively so that the reader will see the

resemblance with the s facet results.

Page 118: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 99

Figure 6.24: Distance between neighboring layers vs. temperature for (0001).

Figure 6.25: Distance between neighboring layers vs. temperature for (1010).

6.6 RMS vibration amplitude

The root mean square (RMS) of the atomic vibration at amplitude was measured

during each simulation for each of the three axes:

RMSα

l =

center

2 top/bottom

=

1∑

i∈lni

i∈l

j∈i

∣rj,α − r0j,α

(6.9)

Page 119: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 100

where l is the group of layers for each different measurement, r0 is the initial

Figure 6.26: RMS vibration amplitude of the c facet (0001) for all three axesrelative to its starting value at 800K, each graph show a comparison between thecenter sample RMS vibration amplitude with respect to the average between the

RMS vibration amplitude of the top and bottom layers.

position of an atom, ni is the number of atoms in the i layer and the angular brackets

denote averaging over time. The first measurement is the average RMS vibration

amplitude of all atoms in the center of the sample for about half of the total size of

the sample, these are the ’bulk’ atoms. The other two RMS vibration amplitude values

are the average RMS vibration amplitude of the top and bottom two layers of the

sample. A maximum deviation from initial position of an atom was defined, this cutoff

was set to be 30% of the nearest neighbor distance in each axis, according to table

6.1. It is expected that the values of the RMS vibration amplitude would increase

with temperature, but above a certain temperature, close to the facet’s Tm, the RMS

vibration amplitude would increase less than of lower temperature, suggesting that

many atoms diffuse into different layers. This signifies a transition to the liquid phase.

Page 120: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 101

Figure 6.27: RMS vibration amplitude of the a facet (1010) for all three axesrelative to its starting value at 800K, each graph show a comparison between thecenter sample RMS vibration amplitude with respect to the average between the

RMS vibration amplitude of the top and bottom layers.

Figure 6.28: Initial state of c facet (0001) and final state at 970K. Note how thelayers become mixed, especially the top and bottom layers.

Page 121: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 102

Figure 6.29: Initial state of a facet (1010) and final state at 970K. Note how thelayers become mixed, especially the top and bottom layers.

Fig. 6.26 shows the RMS vibration amplitude measurement of the c facet (0001).

It is obvious that the change in the RMS vibration amplitude value compared to the

lowest temperature for the z axis is small with respect to the x axis. Here we see that

the c facet, with a close packed orientation, maintains its solid form until it almost

reaches its melting temperature 970K but we see that the x axis contributes more

to the collapse of the sample. The x axis in this case is in the same direction as the

normal of a facet. Therefore looking at Fig. 6.27 that shows the results for the a facet

(1010) we can learn that the change in the RMS vibration amplitude values is greater

in its normal surface direction (after rotation of the a facet the a axis is equal to z

axis) and from about 40K before the melting temperature 970K the RMS vibration

amplitude values almost do not change, after a quasiliquid layer has formed at the

top and bottom of the sample. The sample is on its way to becoming fully liquid,

and by 970K becomes disordered (Figs. 6.28 and 6.29).

Page 122: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 103

We can say that despite the closed packed structure of the c facet, it manages to

catch up with the gradual transition of the a facet and they both melt at the same

temperature, about 970K.

6.7 Layer occupation and energetics

The number of atoms in the 4 bottom and top outmost layers was calculated together

with the number of atoms in the top and bottom adlayers. The first layer is the most

affected by the disordering effect of adatom-vacancy pair formation. The inner layers

keep most of their atoms at low temperature. This leads to the formation of an

adlayer on the top of the outermost layer. Figures 6.30-6.32 show the occupation of

each of the outermost 4 layers and the adlayer. Each result is an average between the

top and the bottom respective layers or adlayers. The formation of an adatom layer

begins first on the least packed surface (1010) (according to the definition of section

6.2) at around T = 600K, then at the s facet (1011) at about T = 700K and finally

at the close packed surface c (0001) at around T = 800K.

The creation of an adlayer involves the generation of vacancies in the first surface

layer, while at higher temperatures, depending on the facet, vacancies in the under-

lying layers (second, third and fourth) begin to appear via promotion of atoms to

vacant positions in the first surface layer, i.e. the so called interlayer vacancy migra-

tion mechanism. Atom migration from the deeper layers increases significantly as the

temperature approaches the melting point. At the least packed surface (1010) the

number of vacancy-adatoms pairs is larger than for the other two facets, furthermore

a correlation between number of atoms in the first layer and the adlayer is obvious

from Figs. 6.30-6.32, suggesting that practically all adatoms come from the first

Page 123: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 104

Figure 6.30: Layer occupation of the (0001) sample as a function of temperature, ’0’stands for the adlayer.

Figure 6.31: Layer occupation of the (1010) sample as a function of temperature, ’0’stands for the adlayer.

Page 124: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 105

Figure 6.32: Layer occupation of the (1011) sample as a function of temperature, ’0’stands for the adlayer.

surface layer.

The same effect of disordering and gradual thickening of the surface region was

observed in computer simulation of surface premelting for FCC and BCC metals

[28–31]. In all simulations, including ours, the least packed surface (110) in FCC,

(111) in BCC and (1010) in HCP begin to disorder first, while the most closely

packed surface (111) in FCC, (011) in BCC and (0001) in HCP preserve their ordered

crystalline structure almost up to the melting point. Note that near Tm of each facet,

the number of atoms in the adlayers are well over 1% of the total number of atoms.

Counting the equilibrium averaged number of atoms in the adlayer allows us to

estimate the surface defect formation energy Es according to the formula:

n ≡ NAdlayer

NAtoms

∝ exp

(−EskBT

)

(6.10)

where n is the adlayer occupation. The fits of the adlayer occupation vs. temperature

to the Boltzmann factor exp (−Es/kBT ) are shown in Figs. 6.33-6.35 for the (0001),

Page 125: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 106

Figure 6.33: Adlayer occupation of the (0001) sample as a function of temperature.The dotted line is an exponential fit.

Figure 6.34: Adlayer occupation of the (1010) sample as a function of temperature.The dotted line is an exponential fit.

Page 126: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 107

Figure 6.35: Adlayer occupation of the (1011) sample as a function of temperature.The dotted line is an exponential fit.

(1010) and (1011) facets, respectively.

The results of the fit for the energy surface defect formation Es are summarized in

Table 6.2. For comparison Table 6.3 presents data from other elements with different

lattice structure such as vanadium (BCC) and copper (FCC) [12]. One notices that

for all elements the close packed facet has the largest formation energy while the least

packed facet has the lowest. Furthermore, all elements with the corresponding facets’

characteristic (least packed, close packed ...) have the same order of Es.

Surface (0001) (1010) (1011)

Mg HCP Es 1.95 ± 0.02eV 0.31 ± 0.04eV 0.92 ± 0.03eV

Table 6.2: Energy of surface defects (adatom-vacancy pairs) calculated using theadlayer occupation data of the various surfaces.

Page 127: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 108

Surface (111) (001) (011)

Va (BCC) Es 0.27eV 0.84eV 2.36eV

Cu (FCC) Es 1.92eV 0.86eV 0.39eV

Table 6.3: Energy of surface defects (adatom-vacancy pairs) (results from [12]).

It is physically expected that the first facet which melts will have the lowest energy

barrier, but reality is different. First, the c facet, which is the close packed facet, has

the largest energy barrier, as is expected since in all of our previously shown results

it was clear that this facet remains ordered until 960K and then melts at 970K. In

the case of the s facet, it has a relatively large energy for surface defect formation but

despite of that we see a sharp increase in the adlayer occupation starting from 930K.

This suggests that there is a possibility that the creation of adatom-vacancy pair in the

surface layers at high temperature is not the only surface defect formation mechanism.

Calculations carried out for FCC metals [31,80] indicate that it is energetically more

favorable for the least packed surface to form a pair consisting of a divacancy and

two adatoms, than to form two independent vacancy-adatom pairs, i.e. surface defect

formation is a kind of a cooperative phenomenon. Therefore, surface defect formation

energy, calculated on the basis of information about the adlayer occupation number,

may be related to more complicated mechanisms of defect formation which can occur

in the s facet due to the special layer ordering where two layers are 0.4

A apart, and

become mixed at high temperatures (explained in more detail in section 6.2). We did

not study in detail the more complex mechanism of defects creation, only the energy

values obtain in the simplistic way were used for a straightforward estimation of the

Page 128: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 109

adatom-vacancy surface defect formation energy.

The Es values calculated for the least packed surface (1010) can be related to the

thermodynamical melting point Tm according to E. Polturak et al [10] in the form

Edef ≃ ckBTm, where c is a constant which will be calculated below and kB is the

Boltzmann constant. Here, the nucleation of a liquid phase on the free surface of a

solid can be associated with the same mechanism suggested by Born and his criterion

which states that bulk melting occurs once the specific volume of a crystalline phase

reaches a critical volume close to the liquid phase volume. The same conditions

which may lead to bulk melting are thought to occur at the surface, but at a lower

temperature. From our previous results, we observed that the quasiliquid film first

appears on the a facet, where Es is minimal with respect to other facets. Surface

defect formation is considered to be a very useful stress release mechanism. All

previous results such as order parameter, layer occupation and density profile leads

to the conclusion that the top and bottom surface layers in the premelting region

exhibit liquid-like properties. From the latter we assume that the shear elastic stress

at the surface is insignificant, this enables us to apply the Born criterion to the surface

layers and to try to explain the nature of the free surface melting by its use.

The first step towards this is to obtain a linear relation between Tm and Es, by

considering the evolution of the volume of a surface layers with temperature [10]. At

low temperature, the volume of the first crystal layer is given by V = v0N , where v0 is

the volume per atom and N is the number of atoms in the layer. When temperature

increases, the layer expands, and the atoms are displaced forming adatom-vacancy

pairs. The temperature dependence of V (T ) can be written as:

V (T ) = v0 (T )N + vdNd = v0 (T )N

(

1 +vdNd

v0 (T )N

)

(6.11)

Page 129: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 110

where vd is the volume added to the layer by a creation of on defect and Nd is the

number of surface defects. Nd is the same as NAdlayer and thus obtained by the same

Eq. 6.10. According to Born, at T = Tm the ratio V/N reaches its critical value, that

of the liquid phase, where the volume per atom is V/N ≈ vliq. When the following

is applied to Eq. 6.11 along with a natural logarithm and rearranging it, a linear

relation in the form of the Born criterion can be obtained between Es and Tm:

Es =

ln

(

vdv0 (Tm)

)

− ln

(

vliqv0 (Tm)

− 1

)

kBTm = ckBTm (6.12)

Eq. 6.12 can be simplified by approximating vd ≃ v0(Tm) in the lowest order. This

is a crude approximation, vd should be larger than v0(Tm) since it is the adatom

volume which is weakly bounded to the surface with larger vibrational amplitude.

Still, within the frame work of logarithmic accuracy this approximation is a good one

and thus Eq. 6.12 takes the simpler form:

Es = − ln

(

vliqv0 (Tm)

− 1

)

kBTm = ckBTm (6.13)

The right hand side of this equation predicts the of Es without any adjustable pa-

rameters. To check its validity, we compare the values of Es for the a facet using this

equation and our results from the MD simulations. This can also be estimated by us-

ing experimental data, the real melting temperature is 923K, the volume is obtained

from the experimental density [84] ρ which for solid at 873K is ρsolid = 1.622gr/cm3

and for liquid at 923K is ρliquid = 1.5897gr/cm3 gives the Es = 0.309eV . the results

are summarized in Table 6.4. We can conclude that there is rather a good agreement

between the theoretically predicted and calculated values of Es.

Finally, these results are supported by previous studies of FCC metals [10] and

BCC metals [12]. In the case of FCC metals a linear relation between the surface

defect formation Es energy and the melting temperature Tm (See Fig. 6.36 and Table

Page 130: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 111

Method of Calculation Es[eV ]

Calculated from simulated results, fitted function 0.312

Calculated from experimental results, Eq. 6.13 0.309

Table 6.4: Energy of surface defects obtained in three different ways.

6.5) was found. This linear relation agrees quantitatively with experiment and with

simulations of the activation energy of the surface defects, without any additional

adjustable parameters. This is encouraging because our results imply that the Born

criterion correctly describes surface melting and may be the ”missing link” which will

finally connect between these surface and bulk scenarios for the melting transition.

Figure 6.36: The activation energy of surface defects Es vs Tm for Pb, Al, Ag, Au,Cu, Ni and Pt. The solid line is a linear regression. From ref. [10].

Page 131: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 6. RESULTS & DISCUSSION: SURFACE MELTING 112

Metal Pb Al Ag Au Cu Ni Pt

Tm[K] 600 933 1235 1337 1356 1726 2046

Es[eV ] 0.18 0.26 0.37 0.32 0.41 0.49 0.49

Table 6.5: The activation energy of surface defects Es vs. Tm for FCC metals. Thedata is from ref. [10].

Page 132: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Chapter 7

Summary & Conclusions

The existing theories about melting transitions are far from complete: they raise

further questions and uncertainties. Hence the main purpose of this research was to

extend the understanding of the mechanism of melting transition to HCP lattices, such

as magnesium. In particular, the role of surfaces of solid magnesium were investigated

up to the melting temperature.

An interatomic potential proposed by D. Y. Sun et al [6] was chosen to investigate

the bulk and the surface of magnesium at different temperatures. The first part of

this research included validation of the potential on bulk samples, the computer pro-

grams and an examination of the system behavior as it draws near the bulk melting

temperature. We applied the isothermal-isotension ensemble (NtT) to hold the exter-

nal pressure and temperature constant, in order to allow thermodynamic quantities

such as the shape, volume and energy to fluctuate until they reached equilibrium.

The thermal expansion of the lattice parameters and volume were measured at

various temperatures and compared with known experimental results. The agreement

between the measured and experimental results are good, the error being less than 1%.

113

Page 133: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 7. SUMMARY & CONCLUSIONS 114

Furthermore, two order parameters were measured, one describing the structural order

of XY planes and the second the order along the z axis. As the temperature increases,

both gradually decrease from an initial value close to unity at low temperature. Also,

various independent elastic constants of the HCP lattice were measured during the

heating process, from which we could calculated the shear moduli of HCP magnesium.

The results showed that the solid is softens as its volume expands.

The heating process ended at 1102±3K which was determined to be the bulk melt-

ing temperature, Tb. Close to Tb all the properties showed a big jump in their value

which is consistent with a first phase order transition which is common to melting

transitions. The Tb obtained is equal to about 1.2Tm, where Tm is the experimentally

measured thermodynamical melting temperature which matches the prediction [7] of

the bulk melting temperature in metallic elements.

We observed that the Born criterion for the solid stability can be the trigger for

melting if we correct for the systematic difference between the experimental and the

simulated values of the various shear moduli. These suggest that in spite of the

numerical errors in the system as the temperature increases to Tb the Born criterion

is valid and can describe bulk melting in HCP magnesium, or possibly it applies to

HCP lattices in general.

The behaviour of the simulated solid magnesium density as a function of temper-

ature was examined, and then compared with the liquid experimental density. Both

showed the same linear decrease up to the bulk melting temperature. At Tb the solid

density dropped to value close to the liquid one, the difference between these values

was less than 1.5%. These results confirmed that the chosen potential is good and

our computer programs are reliable.

Page 134: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 7. SUMMARY & CONCLUSIONS 115

The second part of the project modeled samples with low-index surfaces, per-

formed in the NVT ensemble. Three common facets were studied - the c, a and s

facet. The c facet is the closest packed facet. It maintained its order almost up to

970K and suddenly collapsed, in contrast to the a facet which is the least packed

facet, that has a gradual decrease in its order up to 970K. The s facet is more dif-

ficult to understand due to its apparent Non-Bravais nature. It starts to gradually

disorder but when it is heated past 920K a sudden increase in its rate of disorder

occurs and the adlayer occupation is greatly increased causing it to loss its obvious

structure at 940K suggesting that it might be the facet which the melting transition

starts but the density profile revealed us a different scenerio where the s facet might

be still a solid but a disordered one.

Surface premelting, i.e. formation of the quasiliquid melt on the surface was

studied extensively. Properties such as structural order, adlayer occupation, density

profile, RMS vibrational ampliture and distance between nearest neighbors were cal-

culated during the simulations for all types of facets at various temperatures. We

found that when the temperature is increased the vibrations of atoms close to the

surface are larger than in the bulk, which leads to a formation of point defects close to

the surface region. These defects migrate between the surface layers causing a local

disturbance that lead to premelting. The growth of the disordered layers is dependent

upon the rate of surface defect formation and by the ability of the surface atoms to

diffuse. This results in the appearance of an adlayer on top of the top surface layer

and a quasiliquid phase appears as an intermediate layer between the solid and gas

phases. In the case of the close packed facet c, the quasiliquid phase appears just

before the total collapse of the sample, while in the least packed facet, a, the gradual

appearance of the quasiliquid phase is more noticeable. The adlayer occupation was

Page 135: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 7. SUMMARY & CONCLUSIONS 116

fitted to a Boltzmann factor in order to allow an estimate of the energy formation

of surface defects. The results showed a large activation energy for the c facet and

a low one for the a facet, with the s facet activation energy value in the middle of

the two other values. These values were close to results for various elements with

FCC and BCC lattice structures. Despite the relatively high value of the activation

energy of the s facet with respect to the a facet, the s facet lost its order faster. This

suggests that a more complex defect formation mechanism occuring for the s facet

that is more energetically favorable than the suggested mechanism herein, this could

also be caused by the special structure of the s facet that emphasizes the Non-Bravais

nature of a HCP lattice.

Among the three facets examined, we think that it is more reasonable to say that

the a facet melts first because of the following combined results, arranged from the

most to least significant: The energy formation of surface defects was lowest for the

a facet. The density profile (along the z axis) showed that at 970K the layers cannot

be distinguished anymore and that it took a liquid form where the atoms are found

(statistically) in the entire volume of the sample including the spacing between two

consequent layers. These results are backed up by the order parameters of each layer

of the a facet along the z axis. As the temperature rose, the number of surface layers

which lost their order completely increased until it reached 970K where the order

vanishes completely in all of the layers, including the center ones.

We tried to explain surface melting by applying the Born criterion to the surface

region. By arguing that the generation of point defects increases with increasing

temperature at the surface, resulting in expansion of the solid up to a point where

mechanical instability sets in the surface region, a linear relation can be obtained be-

tween the activation energy of surface defects and Tm [10]. This theoretical prediction

Page 136: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 7. SUMMARY & CONCLUSIONS 117

was tested with results of experiments and computer simulations of FCC and BCC

metals. We applied the same test to our data from the magnesium HCP structure,

evaluating the activation energy of the surface defects for the loosest packed facet a

and comparing with predicted theoretical values. Available experimental data were

used as input parameters in the theoretical calculations of surface defects formation

energy. The results were very good, deviations between the two different types of

calculation method being less than 1%. These results lead to the following general

conclusion: The Born criterion correctly describes the bulk and surface melting and

it could be the ’missing link’ which will tie together the bulk and surface scenarios of

the melting transition.

This project studied many aspects of the melting transition, using computer sim-

ulations. Still, many other questions remain to be answered. First, one could perform

the same simulations using a different type of potential for magnesium (or some other

HCP metal) and compare the results with this project. Second, improved results could

be achieved if more simulation runs were performed with many more atoms for both

types of samples, bulk and surface. The latter could be achieved by improving our

parallel code and increased (but expensive) use of supercomputers.

Another interesting problem is implementing measurements of the various shear

moduli on the surface layer versus the center layers which act as bulk, which may

shed more light on the melting transition and give additional details on the effect of

Born criterion. Also, one could try to find the more complex mechanism that causes

the s facet to lose faster its order.

Finally, the research about bulk and surface melting can be expanded to metals

with more complex structures than FCC, BCC or HCP. The next interesting one

could be a study about metals with diamond lattice structure such as tin, Sn. Maybe

Page 137: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

CHAPTER 7. SUMMARY & CONCLUSIONS 118

in the future we will be able to generalize the Born criterion to all known metals?

Maybe the Born criterion could also be applied to other non-metallic elements?

Page 138: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Appendix A

Calculation of the elastic constants

If an external force acting on a body or if one part of the body applies force on

another part, it is said that the body is in a state of stress. Stress is defined in units

of force per unit area σ = F/A and can be characterized in the general case by the

stress tensor. Strain describes the state of deformation of a solid; there is dilatational

strain which changes the volume, but not the shape and deviatoric strain which in

contrast changes the shape, but not the volume.

For a field of deformations ~u = (x, y, z), we can define a symmetric strain tensor

in the following way:

εαβ =1

2

(

∂uα∂xβ

+∂uβ∂xα

)

, α, β = 1, 2, 3 (A.1)

where 1, 2, 3 replaces the spatial coordinates x, y, z.

Hook discovered that strain ε is proportional to stress σ:

ε = Sσ or σ = Cε (A.2)

These relations between the stress and the strain could be generalized for an anisotropic

119

Page 139: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX A. CALCULATION OF THE ELASTIC CONSTANTS 120

solid, in terms of tensors:

εαβ =∑

γδ

Sαβγδσγδ or σαβ =∑

γδ

Cαβγδεγδ (A.3)

The fourth-rank elasticity tensor Cαβγδ has 3x3x3x3 = 81 components, but due to

symmetry the number of independent components of the elasticity tensor is reduced:

in cubic type lattices (SC, FCC and BCC) there are only three independent compo-

nents, while in HCP lattices there are five independent components.

It is customary to use Voigt notation in order to reduce the number of indices:

11 → 1 ⇒ C1111 ≡ C11

22 → 2 ⇒ C1122 ≡ C12

33 → 3 ⇒ C1133 ≡ C13

23, 32 → 4 ⇒ C3223 = C2323 ≡ C44

13, 31 → 5 ⇒ C3113 = C1313 ≡ C55

21, 12 → 6 ⇒ C1221 = C2121 ≡ C66

(A.4)

In this notation the elastic constant is written as Cij where the new indices i and j

will run over 1,2,3,4,5 and 6. The quadruple sum is replaced by a double sum. For

cubic lattices the independent components of the elasticity tensor [11] are:

C11, C12, C44 (A.5)

and for HCP lattices [76] they are:

C11, C12, C13, C33, C55 (A.6)

The elastic constants hint about the stability of a crystal by their relationship to the

shear moduli which should be zero at the phase transition. According to Born [2] for

cubic lattices the shear moduli are:

2C ′ = C11 − C12 , C44 (A.7)

Page 140: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX A. CALCULATION OF THE ELASTIC CONSTANTS 121

For HCP lattices one get [76]

C11 + C12 , C11 − C12 , 2C55 , 0.5C33 (A.8)

Therefore, calculation of these elastic coefficients is very important for studying

the melting transition. The elastic constants Cij are calculated by means of fluctua-

tion formulas obtained by Ray and Rahman [77]. The following will show how this is

done for the NtT ensemble using notations and definitions from section 4.7.

The elastic constants Cαβγδ are related to fluctuations of the internal stress tensor

P αβint from section 4.7 and the ensemble average of the Born term Bαβγδ. The elastic

constants are calculated in the following way:

Cαβγδ = 1V0H0iαH0jβH0lγH0kδ

−4kBT

(〈MijMlk〉 − 〈Mij〉 〈Mlk〉)+

+2NkBT(

G−1imG

−1jl +G−1

li G−1jm

)

+

+ 〈Bαβγδ〉

(A.9)

where

Mij = −1

2V H−1

ia Pabint

(

HT)−1

bj(A.10)

and

Bαβγδ =∑

i,ji<j

(

∂2U (rij)

∂r2ij

− 1

rij

∂U (rij)

∂rij

)

sijαsijβsijγsijδr2ij

(A.11)

The Born term takes a slightly more complex form when implementing an EAM

potential like the one described in section 4.2:

U =N−1∑

i=1

N∑

j=i+1

ϕ (rij) +N∑

i=1

F (ρi) (A.12)

The notations above and from section 4.2 are used below. For the NtT ensemble,

the Born term can be divided into three terms:

Bαβγδ = (B1)αβγδ + (B2)αβγδ + (B3)αβγδ (A.13)

Page 141: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX A. CALCULATION OF THE ELASTIC CONSTANTS 122

where

(B1)αβγδ =∑

i,ji<j

(

∂2ϕ (rij)

∂r2ij

− 1

rij

∂ϕ (rij)

∂rij

)

sijαsijβsijγsijδr2ij

(A.14)

(B2)αβγδ =∑

i,ji<j

(

∂2ρ (rij)

∂r2ij

− 1

rij

∂ρ (rij)

∂rij

)

sijαsijβsijγsijδr2ij

(A.15)

(B3)αβγδ =∑

i

∂2F (ρi)

∂ρ2i

giαβgiγδ (A.16)

giαβ =

Ng∑

i,ji<j

∂ρ (rij)

∂rij

sijαsijβrij

(A.17)

The main advantage of this method is the fast convergence of the stress fluctuation

term to its equilibrium value.

In order to calculate the shear elastic moduli using the above mentioned formula

two steps are required. The first is to find the zero-stress reference matrix for the

computational cell, H0, and the second is to run the NVT MD simulation to calculate

the elastic coefficients. The H0 matrix was taken to be the average of the H matrix

over 80% of the running steps in the NtT ensemble.

Page 142: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Appendix B

(0001), (1010) and (1011) facets

In our study we looked at three different orientations of the magnesium crystal. Fig.

B.1 depicts a crystal in equilibrium form and its three large facets at 0K [74]. These

facets are (0001)(c), (1010)(a) and (1011)(s). For the purposes of our simulations

each facet, except (0001), was rotated such that its free surface is in the z direction,

this way a generic computer simulation would receive three different lattice structures

thereby avoiding writing a different computer simulation for each facet.

The mathematical representation of facet c [73] is:

~Ri,j,k =

(

a

(

i+1 − P (j)P (k)

4

)

,

√3

2a

(

j +(1 − P (k))

6

)

,c

2k

)

(B.1)

where a and c are the lattice constants, as explained in section 4.3. The indices i

and j define the number of atoms in the XY plane, both must start and end in an

even number for the simulation program to work properly. The k index defines the

number of atoms in the z direction and it has the same constraints as for the previous

indices. P (x) is a parity function which returns 1 for an even number and −1 for

an odd number. Fig. B.2 shows the facet c from above the XY plane and Fig. B.3

shows the same facet from above the XZ plane. In the figures, one color represent

123

Page 143: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX B. (0001), (1010) AND (1011) FACETS 124

Figure B.1: Geometry of the facets [72].

Figure B.2: Atomic layout of facet c in the XY plane or facet a in the XZ plane.

atoms that belong to the first base vector ~b1 and second color those of the second

base vector ~b2.

Facet a is constructed in the same way as facet c, but this time the previous x

direction is free. To make x the free z axis, all axes are permutated counter clockwise,

Page 144: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX B. (0001), (1010) AND (1011) FACETS 125

Figure B.3: Atomic layout of facet c in the XZ plane or facet a in the XY plane.

x becomes z, y because x and z becomes y. Equation B.1 becomes [73]:

~Ri,j,k =

(√3

2a

(

j +(1 + P (k))

6

)

,c

2k, a

(

i+1 + P (k)

4

)

)

(B.2)

The resulting structure is similar to facet c, Fig. B.2 shows the facet a from above

the XZ plane and Fig. B.3 shows the same facet from above the XY plane.

Facet s is a little more tricky to define and rotate such that its surface normal is

in the z direction, the mathematical representation of facet s [73] being:

~Ri,j,k =

(

a

(

i+j + k

2

)

,

√3

2a

(

j +(1 − P (k))

6

)

,c

2k

)

(B.3)

Fig. B.4 show the atoms layout of facet s rotated to a view point where the front

atoms conceal the atoms behind them in the XY plane. The following steps were

taken for rotating facet s such that its normal will be in the z direction:

1. A plane that its normal is the facet s normal was defined by the determinant of

the vectors ~P1 = (a, 0, c), ~P2 =(

12a,

√3

2a, 0)

, a general vector ~r = (x, y, z) (Fig

Page 145: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX B. (0001), (1010) AND (1011) FACETS 126

B.5) and requiring its value to be zero:

x y z

a 0 c

12a

√3

2a 0

= −√

3cx+ cy +√

3az = 0 (B.4)

The vector’s ~r coefficients are the plane normal ~N =(

−√

3c, c,√

3a)

.

2. A rotation matrix R [75] was defined

R =

cθcψ cθsψ −sψ

sφsθcψ−cφsψ sφsθsψ+cφcψ sφsθ

cφsθcψ+sφsψ cφsθsψ−sφcψ cφcθ

(B.5)

where s and c are abbreviations to sin and cos respectively, the 3 angles θ, φ and

ψ are known as the Euler angels [75] which represent the amount of rotation

with respect to the 3 axes. The rotation matrix was used to find the Euler

angles that rotate the normal ~N to the z direction (0, 0, 1):

R ~N = z (B.6)

Using MATLAB, the three equations resulting from Eq. B.6 were solved giving

the required Euler angles.

3. Multiplication between the explicit form of the rotation matrix Eq. B.5 and Eq.

B.3 results in a rotated facet s such that its surface normal is in the z direction,

Fig. B.6 shows the product in the XZ plane with the additional atom shifting

to keep all atoms in a box.

Page 146: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX B. (0001), (1010) AND (1011) FACETS 127

Figure B.4: Atoms layout of facet s rotated to a view point where the front atomsconceal the atoms behind them in the XY plane.

Figure B.5: Atoms layout of facet s in the Y Z plane and the two vector that definethe plane that its normal is facet s normal.

Page 147: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX B. (0001), (1010) AND (1011) FACETS 128

Figure B.6: Atoms layout of facet s in the XZ plane after rotation and shifting tokeep all atoms in a box.

Page 148: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Appendix C

Finite size effects

Finite size effects were checked to validate our results from chapter 6. For this purpose

we ran some of our simulations again, with the same parameters, only this time we

increased the number of layers to 60 and 80 and the number of atoms along the x and

the y axis to 20 instead of 16 as for the 40 layer case. The total number of atoms in

the larger sample is 32000, resulting in a large running time, due to this we only ran

a few simulations around the temperature where the system collapsed for 40 layers.

We checked s and a facets, the c facet was not checked because it was clear from the

40 layer simulations that this dense facet is not as interesting as the s and a facets

in the context of surface melting.

We began by looking at the s facet. The most interesting result is shown in Fig.

C.1, it shows the density profile along the z axis for two temperatures, 970K and

980K. We see straight away that for the s facet the surface layers are still separated

at a higher temperature (980K) with comparison to the temperature obtained for the

40 layers. This validates the conclusion that we made regarding the s facet in section

6.4: Surface melting does not start from the s facet.

129

Page 149: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX C. FINITE SIZE EFFECTS 130

Figure C.1: Density profile across (1011) along the z direction perpendicular to thesurface at various temperature, as indicated.

Next we looked at the a facet. Fig. C.2 shows the density profile along the

z axis for three temperatures, 960K, 970K and 980K. Its behavior is similar to

that observed for the 40 layers, the surface layers are more and more mixed between

themselves and are no longer distinguishable. The central layers are also mixed but

less completely than the surface ones and they can be regarded as ’bulk’ layers. From

these results we can add that the melting temperature is slightly higher than for the

40 layers but only by a few (5 to 10) degrees.

We validated the last statement by computing the order parameters and compar-

ing them to the results obtained in the 40 layers simulations, Fig. C.3. We see that

they order parameters drop to zero at 980K in the 80 layers case and that the have

about the same magnitude and behavior as for the 40 layers case. Furthermore, we

see that the behavior at 970K for the 40 layers is similar to the behavior at 960K

and 970K for the 80 layers case and more significantly the number of ’melted’ layers

Page 150: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX C. FINITE SIZE EFFECTS 131

Figure C.2: Density profile across (1010) along the z direction perpendicular to thesurface at various temperature, as indicated.

are the same for both cases, Fig. C.4 shows a zoom for the graphs in Fig. C.3 for the

first 20 layers.

In conclusion we can state that for the system size, 16x16x40, that was chosen

in the surface melting analyses, the finite size effects are negligible when we consider

the behaviour near the surface. Within the ’bulk’ there are some minor finite size

corrections which do not affect our overall conclusions.

Page 151: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX C. FINITE SIZE EFFECTS 132

Figure C.3: Order parameter of the z axis of the Mg a facet (1010) at varioustemperatures, 40 layer are compared with 80 layers.

Figure C.4: Zoom to Fig. C.3.

Page 152: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

Appendix D

Computer programs

Main program

’md.c’

#include ” func t i on s . h”

// MPI d e f a u l t a d d i t i o n

int my rank ; // rank o f p r oc e s s

int p ; // number o f p r o c e s s e s

MPI Status s t a tu s ; // re tu rn s t a t u s f o r

r e c e i v e

// MPI a id v a r i a b l e s

int SAtoms , TAtoms , f l ag , NVE;

MPI Datatype mpi v t , mpi 1 vec ;

// Timer

t ime t s t a r t t ;

// /////////////////////////////////////

long N meas step nvt , N meas step1 ,

N meas step2 , s t ep av i z1 , s t ep av i z 2 ;

int MODE, LAST MODE, REFRESH;

matrix r , v , f , f1 , f2 , r1 , v1 , fc , tempmat ,

f tmp ; // f c i s used l a t e r i f P a r i n e l l o

and tempmat i s a temporary matr ix

c on ta i n i n g v r ea l , f tmp i s used in

mpifunc

i n t mat r i x nei , c r o s s 2 ;

vec tor n , n temp , f f t , f f r ;

i n t t e n s o r SL ;

double temp , s temp , s p re s s , p r e s s d i ag , potE ,

kinE , virsum , vvsum , omega E , Q, W;

double opxy , opz , u2 [ 3 ] [ 2 ] ;

mat mt h , hdot , hddot , h zero , e , e avg , h re f ,

pten , P i j ;

double h1vec [ 9 ] , hd1vec [ 9 ] , hdd1vec [ 9 ] , hdd2vec

[ 9 ] ;

double s , s1 , sdot , sddot , sddot1 , sddot2 ,

sdot1 ;

double vol , l en x , l en y , l en z , latxy , l a t z ,

a0 , c0 ;

long step , step0 , s t ep e , s t e p 0 c i j ;

// //////////////////////////////////////////

double c11 , c12 , c13 , c33 , c55 , c66 ;

vec tor gtemp s , gtemp r ;

t en sor g ;

mat i j k l ee avg , b avg1 , b avg2 , b avg3 ,

G inv tota l , P i jk l , Mi jk l ;

// /////////////////////////////////////////

int main ( int argc , char∗ argv [ ] )

// f i r s t two l i n e s i s f o r r e f r e s h f u n c t i o n s

f o r t he e l a s t i c cons t an t c a l c u l a t i o n

int r e f r e s h s t e p , ∗ po in te r r e fm , l a s t r e fm ;

int refm

[ ]=3000 ,10000 ,500000 ,10000000 ,500000000 ;

double tmp ;

int l a t t i c e measu rement s=1, i s , i e , m;

long i , j , t i , h r e f counte r ;

char fn [ 5 0 ] , fn tmp [ 5 0 ] ;

MPI start ( argc , argv ) ; // I n i t i a l i z e MPI

133

Page 153: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 134

l a s t r e fm = s i zeo f ( refm ) / s i zeo f ( int ) −1;

po in te r r e fm = refm ;

r e f r e s h s t e p = ∗ po in te r r e fm ;

REFRESH = 1;

s t e p 0 c i j = 0 ; // coun t e r = 0 ;

hre f counte r = 0 ;

// Let ’ s check i f t h e i n i t i a l data are

determined in s e l f c o n s i s t e n t way

i f ( s i z e ∗ s i z e ∗ s i z e /4 − Atoms)

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Check the s i z e or

Number o f Atoms \n \ t ” ) ;

f p r i n t f ( s tder r , ”\n \ t You should setup

Atoms=%d , f o r the s i z e=%d \n \ t ” , ( int

) s i z e ∗ s i z e ∗ s i z e /4 , s i z e ) ;

MPI end ( ) ;

i f ( ( ( int ) (Atoms)%(p) ) !=0)

i f (my rank==0)

f p r i n t f ( s tder r , ”\n\ t Check that number o f

atoms d i v i de s by number o f p roce s sor s ,

meaning : %d\n” , p) ;

MPI end ( ) ;

get i n form () ;

// De f a u l t s v a l u e s

l a txy = a0 ;

l a t z = c0 ;

l e n x = latxy∗ s i z e / 2 . 0 ;

l e n y = sq r t (3) ∗ l a txy∗ s i z e / 4 . 0 ;

l e n z = l a t z ∗ s i z e / 2 . 0 ;

SAtoms = ( int ) (Atoms/p) ; // Number o f atoms

per s l i c e / p ro c e s s o r

TAtoms = ( int ) (Atoms/ s i z e ) ; // To co l o r each

p lane w i t h a d i f f e r e n t c o l o r

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

MPI data s t ruct c r eat i on ( ) ; // Pr e de f i n e s data

s t r u c t u r e s t o be t r an s f e r e d / r e c i e v e d

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Atoms=%d , Atoms per

p rocce sor=%d , Number atoms in a s i n g l e

p lane=%d” , Atoms , SAtoms , TAtoms ) ;

f p r i n t f ( s tder r , ”\n La t t i c e box l ength s : x=[%g

] , y=[%g ] , z=[%g ] . ” , l en x , l en y ,

l e n z ) ;

step = step0 ;

i f (MODE==0)

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Star t i ng from the

beginn ing ” ) ;

i n i t (1) ;

i f (my rank==0)

save h0 ( ) ;

else

i f (MODE==1)

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Resuming from e x i s t i n g

s ta t e : Continue approaching to

equ i l i b r i um s t a t e ” ) ;

LAST MODE = 1 ;

else LAST MODE = 2 ;

i n i t (2) ;

i f ( l a t t i c e measu rement s )

i n i t l a t t i c e ( ) ;

l a t t i c e ( ) ;

b u i l d n e i l i s t ( ) ;

compute f ( ) ;

MPI update r v f n (3) ; // update f o r c e s t o a l l

p r o c e s s o r s

for ( i=i s ; i<i e ; i++)

for ( j =0; j <3; j++)

f [ i ] [ j ] = f f r [ i + j ∗Atoms ] ;

evalPT () ;

rahman ( ) ;

for ( i=i s ; i<i e ; i++)

for ( j =0; j <3; j++)

f [ i ] [ j ] = f f r [ i + j ∗Atoms ] ;

for ( t i =0; t i <TTotalJumps ; t i++)

i f (MODE!=2)

for ( i =0; i<N meas step1 ; i++)

for ( j =0; j<N ne i gh st ep ; j++)

step++;

pr ed i c t o r ( ) ;

Page 154: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 135

MPI update r v f n (0) ; // update

c o o r d i n a t e s t o a l l p r o c e s s o r s

pred i c torS ( ) ;

p r ed i c torP (h , hdot , hddot ) ;

compute f ( ) ;

MPI update r v f n (3) ; // update f o r c e s

t o a l l p r o c e s s o r s

evalPT () ;

rahman ( ) ;

p a r i n e l l o ( ) ;

c o r r e c t o r ( ) ;

MPI update r v f n (0) ; // update

c o o r d i n a t e s t o a l l p r o c e s s o r s

cor r ec torP (h , hdot , hddot ) ;

co r r e c to rS ( ) ;

i f ( i <(( int ) (0 . 2∗ N meas step1 ) ) )

h r e f [ 0 ] [ 0 ]= h r e f [ 0 ] [ 1 ] = h r e f

[ 0 ] [ 2 ] = 0 . 0 ;

h r e f [ 1 ] [ 0 ]= h r e f [ 1 ] [ 1 ] = h r e f

[ 1 ] [ 2 ] = 0 . 0 ;

h r e f [ 2 ] [ 0 ]= h r e f [ 2 ] [ 1 ] = h r e f

[ 2 ] [ 2 ] = 0 . 0 ;

// mat sca mul (0 , h r e f , h r e f ) ;

else

mat add (h , h re f , h r e f ) ;

h r e f counte r ++;

b u i l d n e i l i s t ( ) ;

i f ( step % step EPTVO meas == 0)

i f ( l a t t i c e measu rement s ) l a t t i c e ( ) ;

i f (my rank==0)

save EPTVOh ( ) ;

MPI Barrier (MPI COMM WORLD) ;

i f ( step % step backup == 0)

MPI update r v f n (1) ; // update

v e l o c i t i e s t o p ro c e s s o r 0 on ly !

f l a g = 0 ;

i f (my rank==0)

save h ( ) ;

sav e s ( ) ;

s a v e t o f i l e (0) ; // r&v are saved

save in form ( ) ;

MPI Barrier (MPI COMM WORLD) ;

i f ( step % s t ep av i z 1==0)

i f (my rank==0)

i f ( step <10) s p r i n t f ( fn , ”Mg 000000%ld

. xyz” , step ) ;

else i f ( step <100) s p r i n t f ( fn , ”

Mg 00000%ld . xyz” , step ) ;

else i f ( step <1000) s p r i n t f ( fn , ”

Mg 0000%ld . xyz” , step ) ;

else i f ( step <10000) s p r i n t f ( fn , ”

Mg 000%ld . xyz” , step ) ;

else i f ( step <100000) s p r i n t f ( fn , ”

Mg 00%ld . xyz” , step ) ;

else i f ( step <1000000) s p r i n t f ( fn , ”

Mg 0%ld . xyz” , step ) ;

else s p r i n t f ( fn , ”Mg %ld . xyz” , step ) ;

Aviz ( fn ) ;

// i f MODE !=2

i f ( N meas step2 )

MODE=2;

LAST MODE=1;

i f ( step % step backup != 0)

MPI update r v f n (1) ; // update v e l o c i t i e s

t o p ro c e s s o r 0 on ly !

f l a g = 0 ;

i f (my rank==0)

save h ( ) ;

sav e s ( ) ;

s a v e t o f i l e (0) ; // r&v are saved

save in form ( ) ;

MPI Barrier (MPI COMM WORLD) ;

// //////////////////////////////////////

// ////// MODE 2 ////////////////////

// /////////////////////////////////////

i f ( N meas step2 )

// Pre pe ra t i on s f o r e l a s t i c c on s t an t s

c a l c u l a t i o n

l e n x = latxy∗ s i z e / 2 . 0 ;

l e n y = sq r t (3) ∗ l a txy ∗ s i z e / 4 . 0 ;

l e n z = l a t z ∗ s i z e / 2 . 0 ;

i f (LAST MODE==2)

Page 155: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 136

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Your Dec i s i on : S tar t

s imu lat i on with the Ci j to be

measured\n” ) ;

bp recovery ( ) ; /∗ B i j k l & P i j & P i jPk l are

b e i ng r e t r i v e d ∗/

MPI Barrier (MPI COMM WORLD) ;

// i n i t u 2 ( ) ;

read h ( ) ;

i f ( l a t t i c e measu rement s ) l a t t i c e ( ) ;

b u i l d n e i l i s t ( ) ;

compute f ( ) ;

MPI update r v f n (3) ; // update f o r c e s t o

a l l p r o c e s s o r s

for ( i=i s ; i<i e ; i++)

for ( j =0; j <3; j++)

f [ i ] [ j ] = f f r [ i + j ∗Atoms ] ;

evalPT () ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Proceed ing with the

Ci j measurements . ” ) ;

r e s t a r t c a l c u l a t e C i j s t r e s s ( ) ;

u2 [ 0 ] [ 0 ] = u2 [ 1 ] [ 0 ]= u2 [ 2 ] [ 0 ]= u2 [ 0 ] [ 1 ]= u2

[ 1 ] [ 1 ]= u2 [ 2 ] [ 1 ] = 0 . 0 ;

for ( i = 0 ; i < 3 ; i++)

for ( j = 0 ; j < 3 ; j++)

h [ i ] [ j ] = h r e f [ i ] [ j ] / ( double )

h re f counte r ;

save h ( ) ;

i f (NVE==1) sdot=0;

for ( i =0; i<N meas step2 ; i++)

for ( j =0; j<N ne i gh st ep ; j++)

step++;

pr ed i c t o r ( ) ;

i f (NVE==0) pred i c torS ( ) ;

MPI update r v f n (0) ; // update

c o o r d i n a t e s t o a l l p r o c e s s o r s

compute f ( ) ;

MPI update r v f n (3) ; // update f o r c e s t o

a l l p r o c e s s o r s

evalPT () ;

i f (NVE==0) co r r e c to r S ( ) ;

c o r r e c t o r ( ) ;

MPI update r v f n (0) ; // update

c o o r d i n a t e s t o a l l p r o c e s s o r s

b u i l d n e i l i s t ( ) ;

i f ( step % step EPTVO meas == 0)

tmp = 0; // update omega E in 0 p ro c e s s o r

MPI Reduce(&omega E , &tmp , 1 , MPI DOUBLE,

MPI SUM, 0 , MPI COMM WORLD) ;

omega E = sq r t (tmp/(3∗Atoms∗temp ) ) ;

i f ( l a t t i c e measu rement s ) l a t t i c e ( ) ;

i f (my rank==0)

save EPTVOh ( ) ;

MPI Barrier (MPI COMM WORLD) ;

i f ( step % s t ep av i z 2==0)

i f ( step <10) s p r i n t f ( fn , ”Mg 000000%ld . xyz

” , step ) ;

else i f ( step <100) s p r i n t f ( fn , ”Mg 00000

%ld . xyz” , step ) ;

else i f ( step <1000) s p r i n t f ( fn , ”Mg 0000

%ld . xyz” , step ) ;

else i f ( step <10000) s p r i n t f ( fn , ”Mg 000

%ld . xyz” , step ) ;

else i f ( step <100000) s p r i n t f ( fn , ”Mg 00

%ld . xyz” , step ) ;

else i f ( step <1000000) s p r i n t f ( fn , ”Mg 0

%ld . xyz” , step ) ;

else s p r i n t f ( fn , ”Mg %ld . xyz” , step ) ;

Aviz ( fn ) ;

i f ( step % s t ep c i j mea s == 0)

c omp c i j s t r e s s ( ) ;

i f (REFRESH)

i f ( ( step − s t e p 0 c i j ) % r e f r e s h s t e p ==

0)

r e s t a r t c a l c u l a t e C i j s t r e s s ( ) ;

i f (∗ po in te r r e fm<=refm [ l a s t r e fm ] )

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Let ’ s r e f r e s h

our c a l c u l a t i o n s : %d” ,

r e f r e s h s t e p ) ;

++poin te r r e fm ;

r e f r e s h s t e p = ∗ po in te r r e fm ;

// i f ( s t e p % r e f r e s h s t e p ==0)

// i f (REFRESH )

// i f ( s t e p % s t e p c i j m e a s==0)

Page 156: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 137

i f ( step % step backup == 0)

MPI update r v f n (1) ; // update v e l o c i t i e s

t o p ro ce s s o r 0 on ly !

f l a g = 0 ;

i f (my rank==0)

sav e s ( ) ;

s a v e t o f i l e (0) ; // r&v are saved

bp backup ( ) ;

save in form ( ) ;

// i f i

// Now, save i t

i f ( N meas step2 )

i f ( step % step backup != 0)

MPI update r v f n (1) ; // update v e l o c i t i e s

t o p ro ce s s o r 0 on ly !

f l a g = 0 ;

i f (my rank==0)

sav e s ( ) ;

s a v e t o f i l e (0) ; // r&v are saved

bp backup ( ) ;

save in form ( ) ;

MPI Barrier (MPI COMM WORLD) ;

tmp = temp ;

// i f ( ( ( t i ==0) | | ( t i ==1) | | ( t i ==2)) && ( temp

<1095) )

i f ( temp<1096)

temp += 1 . 5 ; // Adding 50K i f temp i s l e s s

than 900K

else temp += TJump;

s = 1 ;

s1 = sdot = sddot = sddot1 = sddot2 = sdot1 =

0 . 0 ;

i f (my rank==0)

v e l o c i t y i n i t ( ) ;

MPI Barrier (MPI COMM WORLD) ; // A l l p r o c e s s o r s

wa i t f o r p r oc e s so r 0 t o f i n i s h randomiz ing

i n i t i a l v e l o c i t i e s

MPI exchange veloc i ty ( ) ;

s ca l ed f rame (v , Atoms) ;

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Rais ing temperature [% ld ]

time ( s ) from %gK to %gK, a l l r equ i r ed

va lues are i n i t i a l i z e d . ” , t i +1, tmp ,

temp ) ;

MODE=1;

l a s t r e fm = s i zeo f ( refm ) / s i zeo f ( int ) −1;

po in te r r e fm = refm ;

r e f r e s h s t e p = ∗ po in te r r e fm ;

s t e p 0 c i j = 0 ;

REFRESH = 1;

h re f counte r = 0 ;

i f (my rank==0)

f p r i n t f ( s tder r , ”\n\ t ∗∗∗∗∗∗∗∗∗ The Happy End

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗\n” ) ;

MPI end ( ) ;

HCP and velocity initialization subroutines

’hcp setup.c’

#include ” func t i on s . h”

// ////////////////////////////////

void c ry se tup ( )

extern matrix r ;

extern int my rank ;

extern double a0 , c0 ;

int k , h , l , pa ;

FILE ∗ f i d ;

int s i z e 2 ;

s i z e 2 =( int ) s i z e /2 ;

pa=0;

for (h=0; h< s i z e 2 ; h++)

for ( l =0; l< s i z e 2 ; l++)

for (k=0; k<s i z e 2 ; k++)

i f ( ( l %2)==0)

r [ pa ] [ 0 ] = k∗a0 ;

r [ pa ] [ 1 ] = l ∗ sq r t (3) ∗a0 /2 ;

r [ pa ] [ 2 ] = h∗c0 ;

pa++;

else

r [ pa ] [ 0 ] = k∗a0 + a0 /2 ;

Page 157: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 138

r [ pa ] [ 1 ] = ( l −1)∗ sq r t (3) ∗a0/2 + sq r t (3)

∗a0 /2 ;

r [ pa ] [ 2 ] = h∗c0 ;

pa++;

for ( l =0; l< s i z e 2 ; l++)

for (k=0; k<s i z e 2 ; k++)

r [ pa ] [ 0 ] = (k − (double ) ( l %2) /2)∗a0 + a0

/3 + a0 /6 ;

r [ pa ] [ 1 ] = l ∗ s q r t (3) ∗a0/2 + sqr t (3) ∗a0 /6 ;

r [ pa ] [ 2 ] = h∗c0 + c0 /2 ;

pa++;

i f (my rank==0)

i f ( ( f i d=fopen ( ” r0 . l og ” , ”w” ) ) !=NULL)

for (h=0; h<pa ; h++)

f p r i n t f ( f i d , ”\n %l f %l f %l f ” , r [ h ] [ 0 ] ,

r [ h ] [ 1 ] , r [ h ] [ 2 ] ) ;

f c l o s e ( f i d ) ;

// ////////////////////////////////

void v e l o c i t y i n i t (void )

extern double temp ;

extern matrix v ;

int j , k ;

double sum [ 3 ] ;

double x1 , x2 , x3 , y1 , y2 , y3 , S f ;

for ( j =0; j <3; j++)

sum [ j ] = 0 . ;

srand ( ( unsigned ) time (NULL) ) ;

/∗ Seed t he random−number g en er a t o r w i t h

c u r r en t t ime so t h a t

∗ t h e numbers w i l l be d i f f e r e n t eve ry t ime we

run . ∗/

/∗ Generate gau s s ian d i s t r i b u t i o n ∗/

for ( j =0; j<Atoms ; j++)

// RAND MAX i s t he Max i n t e g e r random

number

x1=((double ) rand ( ) ) /RAND MAX;

x2=((double ) rand ( ) ) /RAND MAX;

x3=((double ) rand ( ) ) /RAND MAX;

/∗The Box Mu l l e r method ∗/

y1=sqr t (− l og ( x1 ) )∗ cos (2∗ pi∗x2 ) ;

y2=sqr t (− l og ( x2 ) )∗ cos (2∗ pi∗x1 ) ;

y3=sqr t (− l og ( x3 ) )∗ cos (2∗ pi∗x1 ) ;

v [ j ] [ 0 ]= y1 ;

v [ j ] [ 1 ]= y2 ;

v [ j ] [ 2 ]= y3 ;

for ( k=0;k<3;k++)

sum [ k ] += v [ j ] [ k ] ;

/∗ Center o f mass v e l o c i t y ∗/

for ( k=0; k<3; k++)

sum [ k ] /= (Atoms) ;

for ( j =0; j<Atoms ; j++)

for ( k=0; k<3; k++)

v [ j ] [ k ] −= sum [ k ] ;

S f = 0 . 0 ;

for ( j =0; j<Atoms ; j++)

Sf += v [ j ] [ 0 ] ∗ v [ j ] [ 0 ] + v [ j ] [ 1 ] ∗ v [ j ] [ 1 ] + v [ j

] [ 2 ] ∗ v [ j ] [ 2 ] ;

S f = sqr t (3∗kb∗temp∗(Atoms) / Sf ) ; // Let ’ s

r e s c a l e t he v e l o c i t i e s

for ( j =0; j<Atoms ; j++)

for ( k=0;k<3;k++)

v [ j ] [ k ] ∗= Sf/ sqr t (mass ) ;

// Now check i t and be sure , t h a t T app ro p r i a t e

and Vcm=0

Sf = 0 . 0 ;

for ( j =0; j <3; j++)

sum [ j ] = 0 . 0 ;

for ( j =0; j<Atoms ; j++)

Sf += v [ j ] [ 0 ] ∗ v [ j ] [ 0 ]+ v [ j ] [ 1 ] ∗ v [ j ] [ 1 ]+ v [ j

] [ 2 ] ∗ v [ j ] [ 2 ] ;

for ( k=0;k<3;k++)

sum [ k ] = sum [ k]+v [ j ] [ k ] ;

f p r i n t f ( s tder r , ”\n Checking v e l o c i t y

i n i t i a l i z a t i o n f o r temp = %g : ” , mass∗Sf

/(3∗Atoms∗kb ) ) ;

f p r i n t f ( s tder r , ”\n Center of Mass Ve l oc i ty :

Vx=%g Vy=%g Vz=%g ” ,sum [ 0 ] , sum [ 1 ] , sum

[ 2 ] ) ;

f p r i n t f ( s tder r , ”\n

#################################”) ;

Various initialization subroutines

’initialization.c’

#include ” func t i on s . h”

Page 158: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 139

void i n i t ( int code )

extern matrix f , r , v ;

extern double s , s1 , sdot , sddot , sddot1 ,

sddot2 , sdot1 ;

extern long step ;

extern mat mt h , h re f , h zero , pten ;

extern int my rank ;

int i , j ;

s = 1 ; // the rmos t a t

s1 = sdot = sddot = sddot1 = sddot2 = sdot1 =

0 . 0 ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

pten [ i ] [ j ] = h r e f [ i ] [ j ] = 0 . 0 ;

i n i t v a r ( ) ;

i f ( code==1)

// i n i t i a l s imu l a t i on

i n i t h (h ) ;

i n i t h ( h ze ro ) ;

// i n i t e e e ( ) ;

c ry se tup ( ) ;

s ca l ed f rame ( r , Atoms) ;

Aviz ( ”Mg 0000000 . xyz” ) ;

i f (my rank==0)

v e l o c i t y i n i t ( ) ;

MPI Barrier (MPI COMM WORLD) ; // A l l

p r o c e s s o r s wa i t f o r p r oc e s s o r 0 t o

f i n i s h randomiz ing i n i t i a l v e l o c i t i e s

MPI exchange veloc i ty ( ) ;

s ca l ed f rame (v , Atoms) ;

else i f ( code==2)

// i n i t e e e ( ) ;

read h ( ) ;

read h0 ( ) ;

r ead s ( ) ;

r e a d f r om f i l e ( ” rv . l og ” ) ;

// //////////////////////////////////

void i n i t v a r ( )

extern matrix r , v , f , f1 , f2 , r1 , v1 , fc ,

tempmat , f tmp ; // f c i s used l a t e r i f

P a r i n e l l o and tempmat i s a temporary

matr ix c on ta i n i ng v r ea l , f tmp i s used in

mpifunc

extern i n t mat r i x nei , c ro s s 2 ;

extern vector n , n temp , f f t , f f r , gtemp s ,

gtemp r ;

extern i n t t e n s o r SL ;

extern mat mt hdot , hddot ;

extern t en sor g ;

extern double h1vec [ 9 ] , hd1vec [ 9 ] , hdd1vec [ 9 ] ,

hdd2vec [ 9 ] ;

extern int my rank , SAtoms ;

int i , k , i s , i e ;

r = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

v = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

f = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

f 1 = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

f 2 = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

r1 = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

v1 = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

f c = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

tempmat = dmatrix (0 , Atoms−1, 0 , ndim−1) ;

c ro s s2 = imat r i x (0 , Atoms−1, 0 , ndim−1) ;

f f t = dvector (0 , 3∗Atoms−1) ;

f f r = dvector (0 , 3∗Atoms−1) ;

n = dvector (0 , Atoms−1) ;

n temp = dvector (0 , Atoms−1) ;

g = d3tensor (0 , Atoms−1, 0 , 2 , 0 , 2) ;

gtemp s = dvector (0 , 9∗Atoms−1) ;

gtemp r = dvector (0 , 9∗Atoms−1) ;

n e i = imat r i x (0 , Atoms−1, 0 , 299) ;

SL = i3 te n s o r (0 , Atoms−1, 0 , 12 , 0 , 1) ; // 0/12

i s t he ne i ghbou r counter , 1−12/12 i s t he

number o f f i r s t ne i g hb ou r s in HCP and 0−1

f o r d i s t i n g u i s h i n g between XY p l an es !

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

for ( i=i s ; i<i s ; i++)

for ( k=0; k<3; k++)

r1 [ i ] [ k ] = v1 [ i ] [ k ] = f1 [ i ] [ k ] = f2 [ i ] [ k ] =

0 . 0 ;

for ( k=0; k<9; k++)

h1vec [ k ] = hd1vec [ k ] = hdd1vec [ k ] = hdd2vec [ k

] = 0 . 0 ;

for ( i =0; i <3; i++)

hdot [ i ] [ 0 ]= hdot [ i ] [ 1 ]= hdot [ i ] [ 2 ] =0 . 0 ;

hddot [ i ] [ 0 ]= hddot [ i ] [ 1 ]= hddot [ i ] [ 2 ] = 0 . 0 ;

// //////////////////////////////////

void i n i t h ( a )

mat mt a ;

Page 159: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 140

extern double l en x , l en y , l e n z ;

int i ;

for ( i =0; i <3; i++)

a [ i ] [ 0 ] = a [ i ] [ 1 ] = a [ i ] [ 2 ] = 0 . 0 ;

a [ 0 ] [ 0 ] = l en x ;

a [ 1 ] [ 1 ] = l en y ;

a [ 2 ] [ 2 ] = l e n z ;

// //////////////////////////////////

void i n i t e e e ( )

extern mat mt e avg ;

extern mat i j k l ee avg ;

extern long s t ep e ;

int i , j , k , l l , mode=0;

FILE ∗outd ;

i f ( ( outd=fopen ( ” ee av backup . dat ” , ” r ” ) ) !=NULL

)

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

for ( l l =0; l l <3; l l ++)

f s c a n f ( outd , ”\n %l f ” ,& ee avg [ i ] [ j ] [ k

] [ l l ] ) ;

f c l o s e ( outd ) ;

else mode=1;

i f ( ( outd=fopen ( ” e av backup . dat ” , ” r ” ) ) !=NULL )

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

f s c a n f ( outd , ” \n %l f ” ,& e avg [ i ] [ j ] ) ;

f s c a n f ( outd , ” \n %ld ” ,& s t ep e ) ;

f c l o s e ( outd ) ;

else mode=1;

i f (mode)

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

e avg [ i ] [ j ]=0 . ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

for ( l l =0; l l <3; l l ++)

ee avg [ i ] [ j ] [ k ] [ l l ]=0 . ;

s t ep e =0;

Neighbor list creation subroutine

’neighbor list.c’

#include ” func t i on s . h”

#define n e i c u t o f f ( 1 . 5∗ cu t o f f )

void b u i l d n e i l i s t ( )

extern matrix r ;

extern mat mt h ;

extern i n t mat r i x ne i ;

extern int my rank , SAtoms ;

double r d i s [ 3 ] , d i s , x , y , z ;

mat mt G, htr ;

int i , j , l , i s , i e ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

t ran spose (h , htr ) ;

mat mul ( htr , h ,G) ; /∗ b u i l d G∗/

for ( i=i s ; i<i e ; i++)

ne i [ i ] [ 0 ] =0 ;

for ( j=i +1; j<Atoms ; j++)

for ( l =0; l <3; l++)

r d i s [ l ] = r [ i ] [ l ]−r [ j ] [ l ] ;

i f ( r d i s [ l ] >0.5) r d i s [ l ]−=1.;

i f ( r d i s [ l ]<−0.5) r d i s [ l ]+=1.;

d i s = 0;

for ( l =0; l <3; l++)

d i s += r d i s [ l ]∗G[ l ] [ 0 ] ∗ r d i s [ 0 ] + rd i s [ l ]∗

G[ l ] [ 1 ] ∗ r d i s [ 1 ] + rd i s [ l ]∗G[ l ] [ 2 ] ∗ r d i s [ 2 ] ;

d i s=sq r t ( d i s ) ;

i f ( d i s < n e i cu t o f f )

ne i [ i ] [ 0 ]++;

ne i [ i ] [ n e i [ i ] [ 0 ] ] = j ;

MPI Barrier (MPI COMM WORLD) ;

Lattice related subroutines

Page 160: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 141

’lattice.c’

#include ” func t i on s . h”

#define upper l imitXY (1 . 25∗1 . 25∗ a0∗a0 )

#define l ower l imitXY (0 . 75∗0 . 75∗ a0∗a0 )

#define base vector norm2 ( ( a0/3+a0 /6) ∗( a0/3+a0

/6) + ( sqr t (3) ∗a0 /6) ∗( s q r t (3) ∗a0 /6) + c0

/2∗ c0 /2)

#define upper l im i tbase ( 1 . 1∗ 1 . 1∗

base vector norm2 )

#define l owe r l im i t b a s e ( 0 . 9∗ 0 . 9∗

base vector norm2 )

#define upper l im i tZ (1 . 25∗1 . 25∗ c0 /2∗ c0 /2)

#define l ower l im i tZ (0 . 75∗0 . 75∗ c0 /2∗ c0 /2)

void i n i t l a t t i c e (void )

extern double l en x , l en y , l en z , a0 , c0 ;

extern i n t t e n s o r SL ;

extern long step , step0 ;

extern mat mt h ;

int k , j , l , pa , s i z e 2 ;

double d i s t2 , d i s [ 3 ] , l en x2 , l en y2 , l en z2 ,

p lane ;

matrix R;

R = dmatrix (0 , Atoms−1, 0 , ndim) ; // The e x t ra

coloum in R i s t o d i s t i n g u i s h XY p lane s

l en x2 = l en x / 2 . ;

l en y2 = l en y / 2 . ;

l e n z 2 = l en z / 2 . ;

s i z e 2 = ( int ) s i z e /2 ;

pa = 0 ;

for ( j =0; j<s i z e 2 ; j++)

for ( l =0; l<s i z e 2 ; l++)

for (k=0; k<s i z e 2 ; k++)

i f ( ( l %2)==0)

R[ pa ] [ 0 ] = k∗a0 ;

R[ pa ] [ 1 ] = l ∗ s q r t (3) ∗a0 /2 ;

R[ pa ] [ 2 ] = j ∗c0 ;

R[ pa ] [ 3 ] = 0 ;

pa++;

else

R[ pa ] [ 0 ] = k∗a0 + a0 /2 ;

R[ pa ] [ 1 ] = ( l −1)∗ sq r t (3) ∗a0/2 + sq r t (3)

∗a0 /2 ;

R[ pa ] [ 2 ] = j ∗c0 ;

R[ pa ] [ 3 ] = 0 ;

pa++;

for ( l =0; l<s i z e 2 ; l++)

for (k=0; k<s i z e 2 ; k++)

R[ pa ] [ 0 ] = (k − (double ) ( l %2) /2) ∗a0 + a0

/3 + a0 /6 ;

R[ pa ] [ 1 ] = l ∗ s q r t (3) ∗a0/2 + sqr t (3) ∗a0 /6 ;

R[ pa ] [ 2 ] = j ∗c0 + c0 /2 ;

R[ pa ] [ 3 ] = 1 ;

pa++;

for ( l =0; l<Atoms ; l++)

for ( k=0; k<13; k++)

SL [ l ] [ k ] [ 0 ] = SL [ l ] [ k ] [ 1 ] = 0 . 0 ;

for ( l =0; l<Atoms ; l++)

for ( k=0; k<Atoms ; k++)

i f (k!= l )

d i s t 2 = 0 . 0 ;

d i s [ 0 ] = R[ l ] [ 0 ] −R[ k ] [ 0 ] ;

i f ( d i s [0] > l en x2 ) d i s [ 0 ] −= len x ;

i f ( d i s [0]<− l en x2 ) d i s [ 0 ] += l en x ;

d i s [ 1 ] = R[ l ] [ 1 ] −R[ k ] [ 1 ] ;

i f ( d i s [1] > l en y2 ) d i s [ 1 ] −= len y ;

i f ( d i s [1]<− l en y2 ) d i s [ 1 ] += l en y ;

d i s [ 2 ] = R[ l ] [ 2 ] −R[ k ] [ 2 ] ;

i f ( d i s [2] > l e n z 2 ) d i s [ 2 ] −= le n z ;

i f ( d i s [2]<− l e n z 2 ) d i s [ 2 ] += l en z ;

d i s t 2 = d i s [ 0 ] ∗ d i s [0 ]+ d i s [ 1 ]∗ d i s [1 ]+ d i s

[ 2 ] ∗ d i s [ 2 ] ;

p lane = fabs (R[ l ] [ 3 ] −R[ k ] [ 3 ] ) ; // s t o r e s

on ly a va l u e o f 0/1

i f ( p lane ) // two atoms from d i f f r e n t XY

p l ane s

i f ( ( d i s t2 >= lowe r l im i t ba s e ) && (

d i s t2 <= upper l im i tbase ) )

// The nea r e s t ne i g hb ou r s

SL [ l ] [ 0 ] [ 0 ]++ ;

SL [ l ] [ 0 ] [ 1 ]++ ;

SL [ l ] [ SL [ l ] [ 0 ] [ 0 ] ] [ 0 ] = k ;

SL [ l ] [ SL [ l ] [ 0 ] [ 0 ] ] [ 1 ] = 1 ;

// i f d i s t 2

else // two atoms from the same p lane

i f ( ( d i s t2 >= lower l imitXY ) && ( d i s t 2

<= upper l imitXY ) )

// The nea r e s t ne i g hb ou r s

SL [ l ] [ 0 ] [ 0 ]++ ;

Page 161: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 142

SL [ l ] [ SL [ l ] [ 0 ] [ 0 ] ] [ 0 ] = k ;

SL [ l ] [ SL [ l ] [ 0 ] [ 0 ] ] [ 1 ] = 0 ;

// i f d i s t 2

// i f i != j

f r e e dmatr i x (R, 0 , Atoms−1, 0 , ndim) ;

// //////////////////////////////////////////

void l a t t i c e (void )

extern i n t t e n s o r SL ;

extern matrix r ;

extern long step , step0 ;

extern mat mt h ;

extern double a0 , c0 , opxy , opz , temp , latxy ,

l a t z ;

extern int my rank , SAtoms , MODE;

long noxy , noz ;

double d i s t2 , d i s [ 3 ] , l a t parxy = 0 , l a t p a r z

= 0 ;

mat mt htr , G;

FILE ∗ fd ;

// v a r i a b l e s needed t o c a l c u l a t e t he order

paramaters o f HCP

double cossumxy =0.0 , sinsumxy=0.0 , cossumz =0.0 ,

sinsumz=0.0;

double r1 [ 4 ] ; // 4 th dimension f o r t he v e c t o r ’ s

s quare magnitude

double x , y , z , tmp , klat , latxytmp =0.0 ,

latztmp =0.0 , t ran s [ 4 ] , t rans temp [ 4 ] ;

char t emp f i l e [ 6 0 ] ;

int i , j , l l , ni , i s , i e , f l a g ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

t ran spose (h , htr ) ;

mat mul ( htr , h , G) ;

noxy = noz = 0 ;

for ( i=i s ; i<i e ; i++)

f l a g = 0 ;

for ( j =1; j<= 12; j++)

ni = SL [ i ] [ j ] [ 0 ] ;

for ( l l =0; l l <3; l l ++)

d i s [ l l ] = r [ i ] [ l l ]− r [ n i ] [ l l ] ;

i f ( d i s [ l l ] >0.5) d i s [ l l ]−=1;

i f ( d i s [ l l ]<−0.5) d i s [ l l ]+=1;

d i s t 2 = 0 . 0 ;

for ( l l =0; l l <3; l l ++)

d i s t 2 += d i s [ l l ]∗G[ l l ] [ 0 ] ∗ d i s [ 0 ] + d i s [ l l

]∗G[ l l ] [ 1 ] ∗ d i s [ 1 ] + d i s [ l l ]∗G[ l l ] [ 2 ] ∗ d i s [ 2 ] ;

x = d i s [ 0 ] ;

y = d i s [ 1 ] ;

z = d i s [ 2 ] ;

d i s [ 0 ] = h [ 0 ] [ 0 ] ∗ x + h [ 0 ] [ 1 ] ∗ y + h [ 0 ] [ 2 ] ∗ z ;

d i s [ 1 ] = h [ 1 ] [ 0 ] ∗ x + h [ 1 ] [ 1 ] ∗ y + h [ 1 ] [ 2 ] ∗ z ;

d i s [ 2 ] = h [ 2 ] [ 0 ] ∗ x + h [ 2 ] [ 1 ] ∗ y + h [ 2 ] [ 2 ] ∗ z ;

// Check i f t h i s atom s t i l l b e l o n g s t o

l a t t i c e

i f (SL [ i ] [ j ] [ 1 ] ) // two atoms from d i f f r e n t

XY p l ane s

i f ( ( d i s [ 2 ]∗ d i s [ 2 ] >= lowe r l im i tZ ) && (

d i s [ 2 ]∗ d i s [ 2 ] <= upper l im i tZ ) )

// The nea r e s t ne i g hbou r s

l a t p a r z += fabs (2∗ d i s [ 2 ] ) ;

noz++;

else // two atoms from the same p lane

i f ( ( d i s t 2 >= lower l imitXY ) && ( d i s t 2 <=

upper l imitXY ) )

// The nea r e s t ne i g hbou r s

l a t parxy += sq r t ( d i s t 2 ) ;

noxy++;

i f ( ( f l a g ) && (SL [ i ] [ j ] [ 1 ]==0) )

tmp = 0 ;

for ( l l =0; l l <3; l l ++)

tmp += r1 [ l l ]∗ d i s [ l l ] ;

tmp /= sqr t ( r1 [ 3 ] ∗ d i s t 2 ) ; //=cos ( t e t a 1 j )

//tmp /= ( a0∗a0 ) ; //=cos ( t e t a 1 j )

i f ( f ab s (tmp) >1.0) tmp −= 0.000001∗ f ab s (

tmp)/tmp ;

cossumxy += cos (6∗ acos (tmp) ) ; // 6− f o l d

symmetry in t he XY p lane

sinsumxy += s in (6∗ acos (tmp) ) ;

i f ( ( f l a g==0) && (SL [ i ] [ j ] [ 1 ]==0) )

for ( l l =0; l l <3; l l ++)

r1 [ l l ] = d i s [ l l ] ;

r1 [ 3 ] = d i s t 2 ;

f l a g = 1 ;

// c . j

Page 162: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 143

// Updates o f two l a t t i c e parameters and the

number s t a t i s t i c t o a l l p r o c e s s o r s

trans temp [ 0 ] = trans temp [ 1 ] = trans temp [ 2 ] =

trans temp [ 3 ] = 0 ;

t ran s [ 0 ] = l at parxy ;

t ran s [ 1 ] = (double ) noxy ;

t ran s [ 2 ] = l a t p a r z ;

t ran s [ 3 ] = (double ) noz ;

MPI Allreduce ( trans , trans temp , 4 , MPI DOUBLE,

MPI SUM, MPI COMM WORLD) ;

l a t parxy = trans temp [ 0 ] ;

noxy = ( long ) trans temp [ 1 ] ;

l a t p a r z = trans temp [ 2 ] ;

noz = ( long ) trans temp [ 3 ] ;

MPI Barrier (MPI COMM WORLD) ;

i f ( noxy )

latxytmp = lat parxy /(double ) noxy ;

i f (MODE!=2)

l atxy = latxytmp ;

i f ( noz )

latztmp = la t p a r z /(double ) noz ;

i f (MODE!=2)

l a t z = latztmp ;

k l a t = 2.0∗ pi /( l a t z /2) ; // 2 p i /( c0 /2)

for ( i=i s ; i<i e ; i++)

cossumz += cos ( k l a t ∗(h [ 2 ] [ 0 ] ∗ r [ i ] [ 0 ] + h

[ 2 ] [ 1 ] ∗ r [ i ] [ 1 ] + h [ 2 ] [ 2 ] ∗ r [ i ] [ 2 ] ) ) ;

// k∗ z r e a l

sinsumz += s in ( k l a t ∗(h [ 2 ] [ 0 ] ∗ r [ i ] [ 0 ] + h

[ 2 ] [ 1 ] ∗ r [ i ] [ 1 ] + h [ 2 ] [ 2 ] ∗ r [ i ] [ 2 ] ) ) ;

// k∗ z r e a l

// Updates o f cossumxy/z , sinsumxy / z t o

pr o ce s s o r 0

trans temp [ 0 ] = trans temp [ 1 ] = trans temp [ 2 ] =

trans temp [ 3 ] = 0 ;

t ran s [ 0 ] = cossumxy ;

t ran s [ 1 ] = sinsumz ;

t ran s [ 2 ] = cossumz ;

t ran s [ 3 ] = sinsumz ;

MPI Allreduce ( trans , trans temp , 4 , MPI DOUBLE,

MPI SUM, MPI COMM WORLD) ;

cossumxy = trans temp [ 0 ] ;

sinsumxy = trans temp [ 1 ] ;

cossumz = trans temp [ 2 ] ;

sinsumz = trans temp [ 3 ] ;

MPI Barrier (MPI COMM WORLD) ;

opxy = sqr t ( cossumxy∗cossumxy + sinsumxy∗

sinsumxy ) /(5∗Atoms) ;

opz = sq r t ( cossumz∗cossumz + sinsumz∗ sinsumz ) /

Atoms ;

s p r i n t f ( t emp f i l e , ” l a t t i c e T=%gK Atoms=%d . txt ” ,

temp , Atoms) ;

i f (my rank==0)

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ”%ld %ld %ld %l f %ld %l f %

l f %l f \n” , step , 6∗Atoms , noxy ,

latxytmp , noz , latztmp , latztmp /

latxytmp , det (h) ) ;

f c l o s e ( fd ) ;

Force calculation subroutines

’compute f.c’

#include ” func t i on s . h”

void compute f ( )

extern matrix r , f ;

extern i n t mat r i x ne i ;

extern double potE , kinE , virsum , vol , l en x ,

l en y , l en z , latxy , l a t z ;

extern vector n , n temp , f f r , f f t ;

extern mat mt pten , h ;

extern long step ;

extern int SAtoms , my rank , MODE;

extern mat i j k l b avg1 , b avg2 , b avg3 , Mi jk l ;

extern t en sor g ;

int i , j , k , l , l l , j j , kk , i i ;

double dis , r d i s [ 3 ] , x , y , z , f r , f r1 , f r 2 ;

double phi , dphi , ddphi , rho , drho , ddrho , ui ,

dui , duj , ddui ;

mat mt htr , G;

int i s , i e ; // i s t a r t and i end ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

potE = virsum = 0 . 0 ;

t ran spose (h , htr ) ;

mat mul ( htr , h ,G) ; /∗ b u i l d G∗/

for ( i =0; i <3; i++)

pten [ i ] [ 0 ]= pten [ i ] [ 1 ]= pten [ i ] [ 2 ] = 0 . ;

Page 163: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 144

for ( i =0; i<Atoms ; i++)

n [ i ] = n temp [ i ] = 0 . 0 ;

for ( j =0; j <3; j++)

f [ i ] [ j ] = f f r [ i+Atoms∗ j ] = f f t [ i+Atoms∗ j ]

= 0 . 0 ;

i f (MODE==2)

for ( k=0;k<3;k++)

g [ i ] [ j ] [ k ] = 0 . 0 ;

// f i r s t l oop c a l c ni

for ( i=i s ; i<i e ; i++)

for ( k=1; k<=ne i [ i ] [ 0 ] ; k++)

j = ne i [ i ] [ k ] ; // ne i gh atom

for ( l =0; l <3; l++)

r d i s [ l ] = r [ i ] [ l ]−r [ j ] [ l ] ;

i f ( r d i s [ l ] >0.5) r d i s [ l ]−=1.;

i f ( r d i s [ l ]<−0.5) r d i s [ l ]+=1.;

d i s = 0 . 0 ;

for ( l =0; l <3; l++)

d i s += r d i s [ l ]∗G[ l ] [ 0 ] ∗ r d i s [ 0 ] + rd i s [ l ]∗

G[ l ] [ 1 ] ∗ r d i s [ 1 ] + rd i s [ l ]∗G[ l ] [ 2 ] ∗ r d i s [ 2 ] ;

d i s = sq r t ( d i s ) ;

i f ( d i s < cu t o f f )

rho = dens i ty ( d i s ) ;

n temp [ i ] += rho ;

n temp [ j ] += rho ;

i f (MODE==2)

drho = dens i ty dot ( d i s ) ;

for ( kk=0; kk<3; kk++)

for ( l l =0; l l <3; l l ++)

g [ i ] [ kk ] [ l l ] += drho∗ r d i s [ kk ]∗ r d i s [

l l ] / d i s ;

g [ j ] [ kk ] [ l l ] += drho∗ r d i s [ kk ]∗ r d i s [

l l ] / d i s ;

MPI update r v f n (4) ; // update d e n s i t y

f u n c t i o n t o a l l p r o c e s s o r s and g i f needed

.

// THE SECOND LOOP

for ( i=i s ; i<i e ; i++)

ui = F pot (n [ i ] ) ;

dui = F pot dot (n [ i ] ) ;

potE += ui ;

for ( k=1; k<=ne i [ i ] [ 0 ] ; k++)

j = ne i [ i ] [ k ] ; /∗ ne igh atom∗/

for ( l =0; l <3; l++)

r d i s [ l ] = r [ i ] [ l ]−r [ j ] [ l ] ;

i f ( r d i s [ l ] >0.5) r d i s [ l ]−=1.;

i f ( r d i s [ l ]<−0.5) r d i s [ l ]+=1.;

d i s = 0 . 0 ;

for ( l =0; l <3; l++)

d i s += r d i s [ l ]∗G[ l ] [ 0 ] ∗ r d i s [ 0 ] + rd i s [ l ]∗

G[ l ] [ 1 ] ∗ r d i s [ 1 ] + rd i s [ l ]∗G[ l ] [ 2 ] ∗ r d i s [ 2 ] ;

d i s = sq r t ( d i s ) ;

i f ( d i s < cu t o f f )

phi = ph i pot ( d i s ) ;

dphi = ph i pot dot ( d i s ) ;

drho = dens i ty dot ( d i s ) ;

duj = F pot dot (n [ j ] ) ;

potE += phi ;

f r 1 = −dphi ;

f r 2 = −drho ∗( dui+duj ) ;

f r = f r 1+f r 2 ;

virsum += f r ∗ d i s ;

for ( l l =0; l l <3; l l ++)

f f t [ i + Atoms∗ l l ] += f r ∗ r d i s [ l l ] / d i s ;

f f t [ j + Atoms∗ l l ] −= f r ∗ r d i s [ l l ] / d i s ;

i f (MODE==2)

ddphi = ph i po t do t do t ( d i s ) ;

ddrho = dens i ty do t do t ( d i s ) ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

for ( kk=0;kk<3;kk++)

for ( l l =0; l l <3; l l ++)

// The F i r s t Born term

Page 164: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 145

b avg1 [ i i ] [ j j ] [ kk ] [ l l ] += (

ddphi−dphi/ d i s ) ∗ ( r d i s [ i i ]∗ r d i s [ j j ]∗ r d i s [ kk ]∗

r d i s [ l l ] ) /( d i s ∗ d i s ) ;

// The Second Born term

b avg2 [ i i ] [ j j ] [ kk ] [ l l ] += ( dui+

duj ) ∗ ( ddrho−drho/ d i s ) ∗ ( r d i s [ i i ]∗ r d i s [ j j ]∗

r d i s [ kk ]∗ r d i s [ l l ] ) /( d i s ∗ d i s ) ;

x = rd i s [ 0 ] ;

y = rd i s [ 1 ] ;

z = rd i s [ 2 ] ;

r d i s [ 0 ] = h [ 0 ] [ 0 ] ∗ x + h [ 0 ] [ 1 ] ∗ y + h

[ 0 ] [ 2 ] ∗ z ;

r d i s [ 1 ] = h [ 1 ] [ 0 ] ∗ x + h [ 1 ] [ 1 ] ∗ y + h

[ 1 ] [ 2 ] ∗ z ;

r d i s [ 2 ] = h [ 2 ] [ 0 ] ∗ x + h [ 2 ] [ 1 ] ∗ y + h

[ 2 ] [ 2 ] ∗ z ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

pten [ i i ] [ j j ] += f r ∗ r d i s [ i i ]∗ r d i s [ j j ] /

d i s ;

// i f ( d i s < c u t o f f )

// c y c l e : k

i f (MODE==2)

ddui = F pot dot dot (n [ i ] ) ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

for ( kk=0; kk<3; kk++)

for ( l l =0; l l <3; l l ++)

// The Third Born term

b avg3 [ i i ] [ j j ] [ kk ] [ l l ] += ddui ∗ g [

i ] [ i i ] [ j j ] ∗ g [ i ] [ kk ] [ l l ] ;

// c y c l e : i

// /////////////////////////////////

double H(double val )

i f ( val >=0)

return 1 . ;

else

return 0 . ;

// /////////////////////////////////

double H0(double val )

i f ( val >0)

return 1 . ;

else

return 0 . ;

// /////////////////////////////////

double F pot (double x)

double tmp ;

tmp = −1.0∗pow(x , 0 . 5 ) −2.1928786648389E−01∗(pow(

x , 1 . 5 ) ) +3.1798479913244E−02∗(x∗x) ;

return (tmp) ;

// /////////////////////////////////

double F pot dot (double x )

double tmp ;

tmp = −0.5/pow(x , 0 . 5 ) −2.1928786648389E−01∗(1.5∗

pow(x , 0 . 5 ) ) +3.1798479913244E−02∗(2∗x) ;

return (tmp) ;

// /////////////////////////////////

double F pot dot dot (double x )

double tmp ;

tmp = 0.5∗0 . 5∗pow(x , −1.5) −2.1928786648389E

−01∗(1.5∗0.5∗ pow(x , −0.5) ) +3.1798479913244E

−02∗(2) ;

return (tmp) ;

// /////////////////////////////////

double ph i pot (double x)

double tmp ;

Page 165: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 146

tmp = (2.0735651906182E+03/x) ∗(0.1818∗ exp

(−2.2115115867102E+01∗x) +0.5099∗ exp

(−6.5122105254908E+00∗x) +0.2802∗ exp

(−2.7844313071423E+00∗x) +0.02817∗ exp

(−1.3932522996274E+00∗x) )∗H0(1.6000 −x )+exp

(1.3795119773576E+01−1.4238449227620E+01∗x

+5.8113719144770E+00∗x∗x−9.2541810687079 E−01∗x∗

x∗x )∗H(x−1.6000)∗H0(2.6000 −x) +(−4.0533531215168

E+00∗(H(3.7−x)∗pow((3.7−x ) , 4) ) +6.9691501349841E

+00∗(H(3.7−x )∗pow((3.7−x ) , 5) ) −6.6468685095783E

+00∗(H(3.7−x )∗pow((3.7−x ) , 6) ) +2.1727482243326E

+00∗(H(3.7−x )∗pow((3.7−x ) , 7) ) −1.2374960403430E

−01∗(H(3.7−x )∗pow((3.7−x ) , 8) ) −1.0210685145201E

+00∗(H(6.0−x )∗pow((6.0−x ) , 4) ) −8.1665230208338E

−01∗(H(6.0−x )∗pow((6.0−x ) , 5) ) −1.0553724438859E

+00∗(H(6.0−x )∗pow((6.0−x ) , 6) ) −3.4513757618316E

−01∗(H(6.0−x )∗pow((6.0−x ) , 7) ) −5.5196787794434E

−02∗(H(6.0−x )∗pow((6.0−x ) , 8) ) +1.7225753251414E

−01∗(H(7.5−x )∗pow((7.5−x ) , 4) ) −5.2595300571381E

−01∗(H(7.5−x )∗pow((7.5−x ) , 5) ) +6.0129012186016E

−01∗(H(7.5−x )∗pow((7.5−x ) , 6) ) −2.9986451887671E

−01∗(H(7.5−x )∗pow((7.5−x ) , 7) ) +5.5188968432433E

−02∗(H(7.5−x )∗pow((7.5−x ) , 8) ) )∗H(x−2.6000) ;

return (tmp) ;

// /////////////////////////////////

double ph i pot dot (double x )

double tmp ;

tmp = (2.0735651906182E+03/x) ∗((1/ x

+2.2115115867102E+01) ∗0.1818∗ exp

(−2.2115115867102E+01∗x)+(1/x+6.5122105254908E

+00) ∗0.5099∗ exp (−6.5122105254908E+00∗x)+(1/x

+2.7844313071423E+00) ∗0.2802∗ exp

(−2.7844313071423E+00∗x)+(1/x+1.3932522996274E

+00) ∗0.02817∗ exp (−1.3932522996274E+00∗x ) )∗H0

(1.6000 −x ) −(−1.4238449227620E

+01+1.1622743828954E+01∗x−2.7762543206124E+00∗x

∗x)∗exp (1.3795119773576E+01−1.4238449227620E

+01∗x+5.8113719144770E+00∗x∗x−9.2541810687079E

−01∗x∗x∗x )∗H(x−1.6000)∗H0(2.6000 −x)

+(−4.0533531215168E+00∗(H(3.7−x ) ∗4∗pow((3.7−x)

, 3) ) +6.9691501349841E+00∗(H(3.7−x ) ∗5∗pow((3.7−x

) , 4) ) −6.6468685095783E+00∗(H(3.7−x) ∗6∗pow((3.7−

x ) , 5) ) +2.1727482243326E+00∗(H(3.7−x ) ∗7∗pow

((3.7−x ) , 6) ) −1.2374960403430E−01∗(H(3.7−x ) ∗8∗

pow((3.7−x ) , 7) ) −1.0210685145201E+00∗(H(6.0−x )

∗4∗pow((6.0−x) , 3) ) −8.1665230208338 E−01∗(H(6.0−x

) ∗5∗pow((6.0−x ) , 4) ) −1.0553724438859E+00∗(H(6.0−

x ) ∗6∗pow((6.0−x) , 5) ) −3.4513757618316 E−01∗(H

(6.0−x) ∗7∗pow((6.0−x ) , 6) ) −5.5196787794434E−02∗(

H(6.0−x ) ∗8∗pow((6.0−x) , 7) ) +1.7225753251414E

−01∗(H(7.5−x ) ∗4∗pow((7.5−x ) , 3) ) −5.2595300571381

E−01∗(H(7.5−x) ∗5∗pow((7.5−x ) , 4) )

+6.0129012186016E−01∗(H(7.5−x ) ∗6∗pow((7.5−x) , 5)

) −2.9986451887671 E−01∗(H(7.5−x) ∗7∗pow((7.5−x )

, 6) ) +5.5188968432433E−02∗(H(7.5−x ) ∗8∗pow((7.5−x

) , 7) ) )∗H(x−2.6000) ;

tmp = −1.0∗tmp ; // tmp i s a l r e ad y t he f o r c e so

t o e l im i n a t e t he c on f u s io n i t i s s e t back

t o be on ly t he d e r i v a t i v e o f ph i p o t w i t h

r e s p e c t t o r

return (tmp) ;

// /////////////////////////////////

double ph i po t do t dot (double x )

double tmp ;

Page 166: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 147

tmp = (2.0735651906182E+03/x) ∗ ( (2/( x∗x)

+2∗2.2115115867102E+01/x+pow(2.2115115867102E

+01 ,2) ) ∗0.1818∗ exp (−2.2115115867102E+01∗x ) +(2/(

x∗x ) +2∗6.5122105254908E+00/x+pow

(6.5122105254908E+00 ,2) ) ∗0.5099∗ exp

(−6.5122105254908E+00∗x) +(2/(x∗x)

+2∗2.7844313071423E+00/x+pow(2.7844313071423E

+00 ,2) ) ∗0.2802∗ exp (−2.7844313071423E+00∗x ) +(2/(

x∗x ) +2∗1.3932522996274E+00/x+pow

(1.3932522996274E+00 ,2) ) ∗0.02817∗ exp

(−1.3932522996274E+00∗x) )∗H0(1.6000 −x )

+((1.1622743828954E+01−2.7762543206124E+00∗2∗x )

+pow(( −1.4238449227620E+01+1.1622743828954E+01∗

x−2.7762543206124E+00∗x∗x ) , 2) )∗exp

(1.3795119773576E+01−1.4238449227620E+01∗x

+5.8113719144770E+00∗x∗x−9.2541810687079 E−01∗x∗

x∗x )∗H(x−1.6000)∗H0(2.6000 −x) +(−4.0533531215168

E+00∗(H(3.7−x) ∗4∗3∗pow((3.7−x ) , 2) )

+6.9691501349841E+00∗(H(3.7−x ) ∗5∗4∗pow((3.7−x)

, 3) ) −6.6468685095783E+00∗(H(3.7−x ) ∗6∗5∗pow

((3.7−x ) , 4) ) +2.1727482243326E+00∗(H(3.7−x ) ∗7∗6∗

pow((3.7−x ) , 5) ) −1.2374960403430E−01∗(H(3.7−x )

∗8∗7∗pow((3.7−x) , 6) ) −1.0210685145201E+00∗(H

(6.0−x) ∗4∗3∗pow((6.0−x ) , 2) ) −8.1665230208338E

−01∗(H(6.0−x ) ∗5∗4∗pow((6.0−x) , 3) )

−1.0553724438859E+00∗(H(6.0−x ) ∗6∗5∗pow((6.0−x)

, 4) ) −3.4513757618316E−01∗(H(6.0−x ) ∗7∗6∗pow

((6.0−x ) , 5) ) −5.5196787794434E−02∗(H(6.0−x ) ∗8∗7∗

pow((6.0−x ) , 6) ) +1.7225753251414E−01∗(H(7.5−x )

∗4∗3∗pow((7.5−x) , 2) ) −5.2595300571381 E−01∗(H

(7.5−x) ∗5∗4∗pow((7.5−x ) , 3) ) +6.0129012186016E

−01∗(H(7.5−x ) ∗6∗5∗pow((7.5−x) , 4) )

−2.9986451887671E−01∗(H(7.5−x ) ∗7∗6∗pow((7.5−x)

, 5) ) +5.5188968432433E−02∗(H(7.5−x ) ∗8∗7∗pow

((7.5−x ) , 6) ) )∗H(x−2.6000) ;

return (tmp) ;

// /////////////////////////////////

double dens i ty (double x)

double tmp ;

tmp = 1.9838398686504E−04∗(H(2.7−x)∗pow((2.7−x )

, 4) ) +1.0046581263528E−01∗(H(2.8−x )∗pow((2.8−x)

, 4) ) +1.0054028073177E−01∗(H(2.9−x )∗pow((2.9−x)

, 4) ) +9.9096119019299E−02∗(H(3.0−x )∗pow((3.0−x)

, 4) ) +9.0021476664876E−02∗(H(3.3−x )∗pow((3.3−x)

, 4) ) +6.8621909217769E−03∗(H(3.8−x )∗pow((3.8−x)

, 4) ) +1.2393768072070E−02∗(H(4.7−x )∗pow((4.7−x)

, 4) ) −4.7476810373812E−03∗(H(5.3−x )∗pow((5.3−x)

, 4) ) +1.2360476552220E−03∗(H(6.2−x )∗pow((6.2−x)

, 4) ) +6.2141449488021E−04∗(H(7.5−x )∗pow((7.5−x)

, 4) ) ;

return (tmp) ;

// /////////////////////////////////

double dens i ty dot (double x )

double tmp ;

tmp = 1.9838398686504E−04∗(H(2.7−x) ∗4∗pow((2.7−

x ) , 3) ) +1.0046581263528E−01∗(H(2.8−x ) ∗4∗pow

((2.8−x ) , 3) ) +1.0054028073177E−01∗(H(2.9−x ) ∗4∗

pow((2.9−x ) , 3) ) +9.9096119019299E−02∗(H(3.0−x )

∗4∗pow((3.0−x) , 3) ) +9.0021476664876E−02∗(H(3.3−x

) ∗4∗pow((3.3−x ) , 3) ) +6.8621909217769E−03∗(H(3.8−

x ) ∗4∗pow((3.8−x) , 3) ) +1.2393768072070E−02∗(H

(4.7−x) ∗4∗pow((4.7−x ) , 3) ) −4.7476810373812E−03∗(

H(5.3−x ) ∗4∗pow((5.3−x) , 3) ) +1.2360476552220E

−03∗(H(6.2−x ) ∗4∗pow((6.2−x ) , 3) ) +6.2141449488021

E−04∗(H(7.5−x) ∗4∗pow((7.5−x ) , 3) ) ;

tmp = −1.0∗tmp ; // tmp i s a l r e ad y t he f o r c e so

t o e l im i n a t e t he c on f u s io n i t i s s e t back

t o be on ly t he d e r i v a t i v e o f d e n s i t y p o t

w i t h r e s p e c t t o r

return (tmp) ;

// /////////////////////////////////

double dens i ty do t do t (double x )

double tmp ;

Page 167: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 148

tmp = 1.9838398686504E−04∗(H(2.7−x) ∗4∗3∗pow

((2.7−x ) , 2) ) +1.0046581263528E−01∗(H(2.8−x ) ∗4∗3∗

pow((2.8−x ) , 2) ) +1.0054028073177E−01∗(H(2.9−x )

∗4∗3∗pow((2.9−x) , 2) ) +9.9096119019299E−02∗(H

(3.0−x) ∗4∗3∗pow((3.0−x ) , 2) ) +9.0021476664876E

−02∗(H(3.3−x ) ∗4∗3∗pow((3.3−x) , 2) )

+6.8621909217769E−03∗(H(3.8−x ) ∗4∗3∗pow((3.8−x)

, 2) ) +1.2393768072070E−02∗(H(4.7−x ) ∗4∗3∗pow

((4.7−x ) , 2) ) −4.7476810373812E−03∗(H(5.3−x ) ∗4∗3∗

pow((5.3−x ) , 2) ) +1.2360476552220E−03∗(H(6.2−x )

∗4∗3∗pow((6.2−x) , 2) ) +6.2141449488021E−04∗(H

(7.5−x) ∗4∗3∗pow((7.5−x ) , 2) ) ;

return (tmp) ;

Parinello-Rahman & mathematical subroutines

’par rahm.c’

#include ” func t i on s . h”

void rahman ( )

// Rahman − Ca l c u l a t e t he un i t c e l l matr ix

a c c e l e r a t i o n s

extern double vol , W;

extern mat mt pten , h , hdot , hddot ;

mat mt // s t r e s s , /∗ S t r e s s t e n s o r

∗/

h tr , /∗ Transpose o f h ∗/

h t r i nv , /∗ In v e r s e o f t r a ns p os e o f h

∗/

A; /∗ P & R A matr ix ∗/

vol = det (h) ;

t ran spose (h , h t r ) ; /∗ Ca l c u l a t e sigma

= vo l ∗h t rans p os e i n v e r s e ∗/

i nv e r t ( h tr , h t r i n v ) ;

mat sca mul ( vol , h t r inv , A) ;

mat mul ( pten , A, hddot ) ;

mat sca mul (W, hddot , hddot ) ;

// //////////////////////////////////

void p a r i n e l l o ( )

extern mat mt pten , h , hdot ;

extern matrix v , f c ;

mat mt h tr , /∗ Transpose o f h ∗/

h t r dot , /∗ Transpose o f h d o t ∗/

h tmp 1 , /∗ S tor e f o r i n t e rmed i a t e terms ∗/

h tmp 2 , /∗ S tor e f o r i n t e rmed i a t e terms ∗/

G, /∗ h t r ∗ h ( me t r i c t e n s o r ) ∗/

G inv , /∗ In v e r s e o f G ∗/

G dot , /∗ De r i v a t i v e o f G ∗/

G i d ; /∗ G inv ∗ G dot ∗/

t ran spose (h , h t r ) ;

mat mul ( h tr , h ,G) ; /∗ We now have t he G

matr ix ∗/

i nv e r t (G, G inv ) ; /∗ G (−1) done

∗/

t ran spose ( hdot , h t r d o t ) ;

mat mul ( h t r dot , h , h tmp 1 ) ;

mat mul ( h tr , hdot , h tmp 2 ) ;

mat add ( h tmp 1 , h tmp 2 , G dot ) ; /∗ G dot

now comp le t e ∗/

mat mul ( G inv , G dot , G i d ) ; /∗ G inv ∗

G dot ∗/

mat vec mul ( G i d , v , fc , Atoms) ; /∗

Ca l c u l a t e c o r r e c t i o n term ∗/

// //////////////////////////////////

void pr int mat ( a )

mat mt a ;

int i ;

for ( i =0; i <3; i++)

f p r i n t f ( s tder r , ”\n” ) ;

f p r i n t f ( s tder r , ”%l f %l f %l f ” , a [ i ] [ 0 ] , a [ i

] [ 1 ] , a [ i ] [ 2 ] ) ;

// //////////////////////////////////

void mat mul (a , b , c )

mat mt a , /∗ Inpu t matr ix 1 (

in ) ∗/

b , /∗ Inpu t matr ix 2 ( in ) ∗/

c ; /∗ Re su l t matr ix ( ou t ) ∗/

// Mu l t i p l y two 3 x 3 mat r i c e s . Re su l t can

NOT ov e rw r i t e in pu t .

register int i , j ; /∗ Counters

∗/

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

c [ i ] [ j ] = a [ i ] [ 0 ] ∗ b [ 0 ] [ j ] + a [ i ] [ 1 ] ∗ b [ 1 ] [ j ]

+ a [ i ] [ 2 ] ∗ b [ 2 ] [ j ] ;

// //////////////////////////////////

Page 168: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 149

void mat sca mul ( s , a , b)

register double s ; /∗ Sca l a r ( in ) ∗/

mat mt a , /∗ Inpu t matr ix ( in ) ∗/

b ; /∗ Re su l t matr ix ( ou t ) ∗/

// Mu l t i p l y a 3x3 matr ix by a s c a l a r

register int i , j ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

b [ i ] [ j ] = s ∗ a [ i ] [ j ] ;

// //////////////////////////////////

void mat add (a , b , c )

mat mt a , /∗ Inpu t matr ix 1 (

in ) ∗/

b , /∗ Inpu t matr ix 2 ( in ) ∗/

c ; /∗ Re su l t matr ix ( ou t ) ∗/

// Add two 3 x 3 mat r i c e s .

register int i , j ; /∗ Counters

∗/

for ( i = 0 ; i < 3 ; i++)

for ( j = 0 ; j < 3 ; j++)

c [ i ] [ j ] = a [ i ] [ j ] + b [ i ] [ j ] ;

// //////////////////////////////////

void t ran spose (a , b)

mat mt a , /∗ Inpu t matr ix (

in ) ∗/

b ; /∗ Transposed matr ix ( ou t ) ∗/

// Transpose a 3 x 3 matr ix . Wi l l hand l e

ca se o f a = b

mat mt tmp ;

memcpy(tmp , a , s i zeo f tmp) ;

b [ 0 ] [ 0 ] = tmp [ 0 ] [ 0 ] ; b [ 1 ] [ 1 ] = tmp [ 1 ] [ 1 ] ; b

[ 2 ] [ 2 ] = tmp [ 2 ] [ 2 ] ;

b [ 0 ] [ 1 ] = tmp [ 1 ] [ 0 ] ; b [ 1 ] [ 0 ] = tmp [ 0 ] [ 1 ] ;

b [ 0 ] [ 2 ] = tmp [ 2 ] [ 0 ] ; b [ 2 ] [ 0 ] = tmp [ 0 ] [ 2 ] ;

b [ 1 ] [ 2 ] = tmp [ 2 ] [ 1 ] ; b [ 2 ] [ 1 ] = tmp [ 1 ] [ 2 ] ;

// //////////////////////////////////

double det ( a )

mat mt a ; /∗ Matr ix ( in ) ∗/

// Determinant o f a 3 x 3 matr ix

int i , j , k ; /∗ Counters ∗/

register double dete r = 0 . 0 ;

for ( i = 0 , j = 1 , k = 2 ; i < 3 ; i++, j=( j +1)%3,

k=(k+1)%3)

dete r += a [ 0 ] [ i ] ∗ ( a [ 1 ] [ j ]∗ a [ 2 ] [ k ] − a [ 1 ] [ k

]∗ a [ 2 ] [ j ] ) ;

return ( det e r ) ;

// //////////////////////////////////

void i nv e r t (a , b )

mat mt a , /∗ Inpu t matr ix (

in ) ∗/

b ; /∗ In v e r s e matr ix ( ou t ) ∗/

// Ca l c u l a t e t he i n v e r s e o f a 3 x3 matr ix .

Ad jo in t method .

int i , j , k , l , m, n ; /∗ Counters

∗/

register double dete r ; /∗ Rec i p ro ca l o f

de t e rm inan t ∗/

i f ( ( det e r = det ( a ) ) == 0 .0 )

f p r i n t f ( s tder r , ”\n det = 0 ! ” ) ;

d e t e r = 1. 0 / dete r ;

for ( i =0, j =1, k=2; i <3; i++, j=( j +1)%3, k=(k

+1)%3)

for ( l =0, m=1, n=2; l <3; l++, m=(m+1)%3, n=(n

+1)%3)

b [ l ] [ i ] = dete r ∗(a [ j ] [m]∗ a [ k ] [ n ] − a [ j ] [ n ]∗

a [ k ] [m] ) ;

// //////////////////////////////////

/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗

∗ 3 x 3 Matr ix − v e c t o r mu l t i p l y ( o f

mu l t i p l e v e c t o r s ) ∗

∗ The inpu t and ou tpu t v e c t o r s need not

n e c e s s a r i l y be d i s t i n c t ∗

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/

#define TINY 1.0 e−20

#define N 6

void inv (a , b)

mat c a , b ;

int i , j , k ;

double aamax ;

double vv [ 7 ] ;

int i i =0, ip , imax ;

double sum ,dum;

int indx [ 7 ] ;

/∗ f o r ( i =1; i <7; i++)

f o r ( j =1; j <7; j++)

f p r i n t f ( s t d e r r ,” %l f ” , a [ i ] [ j ] ) ;

f p r i n t f ( s t d e r r ,” \n”) ;

∗/

Page 169: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 150

for ( i =1; i<=N ; i++)

aamax = 0 . 0 ;

for ( j =1; j<=N; j++)

dum = my abs ( a [ i ] [ j ] ) ;

i f (dum > aamax) aamax=dum;

/∗ f p r i n t f ( s t d e r r ,”\ n l i n e no %d aamax=%f ” , i ,

aamax ) ; ∗/

vv [ i ]=1.0/aamax ;

for ( j =1; j<=N; j++)

for ( i =1; i <=(j −1) ; i++)

sum=a [ i ] [ j ] ;

for (k=1; k<=(i −1) ; k++)

sum = sum−a [ i ] [ k ]∗ a [ k ] [ j ] ;

a [ i ] [ j ] = sum ;

aamax = 0 . ;

for ( i=j ; i<=N; i++)

sum = a [ i ] [ j ] ;

for (k=1; k<=(j −1) ; k++)

sum = sum−a [ i ] [ k ]∗ a [ k ] [ j ] ;

a [ i ] [ j ] = sum ;

dum = vv [ i ]∗my abs (sum) ;

i f (dum >= aamax)

imax=i ;

aamax=dum;

/∗ f p r i n t f ( s t d e r r ,”\ n aamax , dum=%l f ,% l f ” ,

aamax , dum) ; ∗/

i f ( j !=imax )

for (k=1; k<=N; k++)

dum = a [ imax ] [ k ] ;

a [ imax ] [ k ] = a [ j ] [ k ] ;

a [ j ] [ k ] = dum;

vv [ imax ] = vv [ j ] ;

indx [ j ] = imax ;

i f ( a [ j ] [ j ]==0.0)

a [ j ] [ j ] = TINY;

i f ( j !=N)

dum = 1.0/ a [ j ] [ j ] ;

/∗ f p r i n t f ( s t d e r r ,”\ n a j j , dum=%l f ,% l f ” , a [ j

] [ j ] , dum) ; ∗/

for ( i=j +1; i<=N; i++)

a [ i ] [ j ] = a [ i ] [ j ]∗dum;

/∗ f p r i n t f ( s t d e r r ,”\ n a=%l f ” , a [ i ] [ j ] ) ; ∗/

#undef TINY

#undef NRANSI

/∗ (C) Copr . 1986−92 Numerical Recipes So f tware

0(9 p#3. ∗/

/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/

for ( i =1; i<=N; i++)

for ( j =1; j<=N; j++)

b [ i ] [ j ] = 0 . 0 ;

b [ i ] [ i ] = 1 . 0 ;

for ( k=1; k<=N; k++)

ip = 0 ;

for ( i =1; i<=N; i++)

ip = indx [ i ] ;

sum = b [ k ] [ ip ] ;

b [ k ] [ ip ] = b [ k ] [ i ] ;

i f ( i i )

for ( j= i i ; j<=(i −1) ; j++)

sum −= a [ i ] [ j ]∗b [ k ] [ j ] ;

else i f (sum)

i i = i ;

b [ k ] [ i ] = sum ;

for ( i=N; i >=1; i−−)

sum = b [ k ] [ i ] ;

for ( j=i +1; j<=N; j++)

sum −= a [ i ] [ j ]∗b [ k ] [ j ] ;

b [ k ] [ i ] = sum/a [ i ] [ i ] ;

/∗ (C) Copr . 1986−92 Numerical Recipes So f tware

0(9 p#3. ∗/

// //////////////////////////////////

double my abs (double x )

Page 170: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 151

i f ( x > 0 . 0 )

return x ;

else return −1.0∗x ;

// //////////////////////////////////

void mat vec mul (m, in vec , out vec , number )

int number ;

mat mt m;

matrix in vec , out vec ;

int i ;

register double aaa0 , aaa1 , aaa2 ;

i f ( i n v e c == out vec )

for ( i =0; i<number ; i++)

aaa0 = in v ec [ i ] [ 0 ] ; aaa1 = in ve c [ i ] [ 1 ] ;

aaa2 = in v e c [ i ] [ 2 ] ;

i n v e c [ i ] [ 0 ] = m[ 0 ] [ 0 ] ∗ aaa0 + m[ 0 ] [ 1 ] ∗ aaa1

+ m[ 0 ] [ 2 ] ∗ aaa2 ;

i n v e c [ i ] [ 1 ] = m[ 1 ] [ 0 ] ∗ aaa0 + m[ 1 ] [ 1 ] ∗ aaa1

+ m[ 1 ] [ 2 ] ∗ aaa2 ;

i n v e c [ i ] [ 2 ] = m[ 2 ] [ 0 ] ∗ aaa0 + m[ 2 ] [ 1 ] ∗ aaa1

+ m[ 2 ] [ 2 ] ∗ aaa2 ;

else

for ( i =0; i<number ; i++)

aaa0 = in v ec [ i ] [ 0 ] ; aaa1 = in ve c [ i ] [ 1 ] ;

aaa2 = in v e c [ i ] [ 2 ] ;

out vec [ i ] [ 0 ] = m[ 0 ] [ 0 ] ∗ aaa0 + m[ 0 ] [ 1 ] ∗ aaa1

+ m[ 0 ] [ 2 ] ∗ aaa2 ;

out vec [ i ] [ 1 ] = m[ 1 ] [ 0 ] ∗ aaa0 + m[ 1 ] [ 1 ] ∗ aaa1

+ m[ 1 ] [ 2 ] ∗ aaa2 ;

out vec [ i ] [ 2 ] = m[ 2 ] [ 0 ] ∗ aaa0 + m[ 2 ] [ 1 ] ∗ aaa1

+ m[ 2 ] [ 2 ] ∗ aaa2 ;

Predictor-Corrector subroutines

’predictor corrector.c’

#include ” func t i on s . h”

void p red i c t o r ( )

extern matrix r , v , f , f1 , f2 , r1 , v1 , tempmat ;

extern int my rank , SAtoms ;

double cr [ ]=19 . 0 , −10 . 0 , 3 . 0 ;

double cv [ ]=27 . 0 , −22 . 0 , 7 . 0 ;

double div =24.0;

int i , k , i s , i e ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

for ( i=i s ; i<i e ; i++)

for ( k=0; k<3; k++)

r1 [ i ] [ k ] = r [ i ] [ k ] ;

v1 [ i ] [ k ] = v [ i ] [ k ] ;

r [ i ] [ k ] += dt∗v [ i ] [ k ] + ( dt∗dt/ div ) ∗( cr [ 0 ]∗

f [ i ] [ k]+ cr [ 1 ]∗ f 1 [ i ] [ k]+ cr [ 2 ]∗ f 2 [ i ] [ k ] ) ;

v [ i ] [ k ] = ( r [ i ] [ k]−r1 [ i ] [ k ] ) /dt + ( dt/ div )

∗( cv [ 0 ] ∗ f [ i ] [ k]+cv [ 1 ]∗ f 1 [ i ] [ k]+cv [ 2 ]∗ f 2 [ i ] [ k ] ) ;

f 2 [ i ] [ k ] = f1 [ i ] [ k ] ;

f 1 [ i ] [ k ] = f [ i ] [ k ] ;

tempmat [ i ] [ k ] = r [ i ] [ k ] ;

// ///////////////////////////////////////

void c o r r e c t o r ( )

extern matrix r , v , f , f1 , f2 , r1 , v1 , fc ,

tempmat ; // f c i s used l a t e r i f P a r i n e l l o

extern vector f f r ;

extern int my rank , SAtoms , MODE;

extern double omega E , s , sdot ;

extern mat mt h ;

double cr [ ]=3 . 0 , 10 . 0 , −1 . 0 ;

double cv [ ]=7 . 0 , 6 . 0 , −1 . 0 ;

double div =24.0;

int i , k , i s , i e ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

omega E = 0 . 0 ;

for ( i=i s ; i<i e ; i++)

for ( k=0; k<3; k++)

f [ i ] [ k ] = f f r [ i + k∗Atoms ] ;

i f (MODE!=2)

f [ i ] [ k ] = f [ i ] [ k ] / ( s∗ s∗mass ) − f c [ i ] [ k ] −

2∗ sdot∗v [ i ] [ k ] / s ;

Page 171: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 152

else f [ i ] [ k ] = f [ i ] [ k ] / ( s∗ s∗mass ) − 2∗ sdot

∗v [ i ] [ k ] / s ;

omega E += ( ( f [ i ] [ k ] ) ∗( f [ i ] [ k ] ) ) ;

r [ i ] [ k ] = r1 [ i ] [ k]+dt∗v1 [ i ] [ k ] + ( dt∗dt/ div

) ∗( cr [ 0 ]∗ f [ i ] [ k]+ cr [ 1 ] ∗ f 1 [ i ] [ k]+ cr [ 2 ] ∗ f 2 [ i ] [ k ] )

;

v [ i ] [ k ] = ( r [ i ] [ k]−r1 [ i ] [ k ] ) /dt + ( dt/ div )

∗( cv [ 0 ] ∗ f [ i ] [ k ] + cv [ 1 ]∗ f 1 [ i ] [ k ] + cv [ 2 ]∗ f 2 [ i ] [

k ] ) ;

i f ( r [ i ] [ k ] > 1 . 5 )

r [ i ] [ k ] −= 1 . 0 ;

else i f ( r [ i ] [ k ] < −0.5)

r [ i ] [ k ] += 1 . 0 ;

tempmat [ i ] [ k ] = r [ i ] [ k ] ;

// ////////////////////////////////////////////

void pred i c torP ( hvec , hdvec , hddvec)

double hvec [ 9 ] , hdvec [ 9 ] , hddvec [ 9 ] ;

extern double h1vec [ 9 ] , hd1vec [ 9 ] , hdd1vec [ 9 ] ,

hdd2vec [ 9 ] ;

double cr [ ]=19 . 0 , −10 . 0 , 3 . 0 ;

double cv [ ]=27 . 0 , −22 . 0 , 7 . 0 ;

double div =24.0;

int i ;

for ( i =0; i <9; i++)

h1vec [ i ] = hvec [ i ] ;

hd1vec [ i ] = hdvec [ i ] ;

hvec [ i ] += dt∗hdvec [ i ] + ( dt∗dt/ div ) ∗( cr [ 0 ] ∗

hddvec [ i ]+ cr [ 1 ]∗ hdd1vec [ i ]+ cr [ 2 ]∗ hdd2vec [ i ] ) ;

hdvec [ i ] = ( hvec [ i ]−h1vec [ i ] ) /dt + ( dt/ div ) ∗(

cv [ 0 ] ∗ hddvec [ i ]+cv [ 1 ]∗ hdd1vec [ i ]+cv [ 2 ]∗ hdd2vec [

i ] ) ;

hdd2vec [ i ] = hdd1vec [ i ] ;

hdd1vec [ i ] = hddvec [ i ] ;

// /////////////////////////////////////////////

void cor r ec torP ( hvec , hdvec , hddvec)

double hvec [ 9 ] , hdvec [ 9 ] , hddvec [ 9 ] ;

extern double h1vec [ 9 ] , hd1vec [ 9 ] , hdd1vec [ 9 ] ,

hdd2vec [ 9 ] ;

double cr [ ]=3 . 0 , 10 . 0 , −1 . 0 ;

double cv [ ]=7 . 0 , 6 . 0 , −1 . 0 ;

double div =24.0;

int i ;

for ( i =0; i <9; i++)

hvec [ i ] = h1vec [ i ]+dt∗hd1vec [ i ] + ( dt∗dt/ div )

∗( cr [ 0 ] ∗ hddvec [ i ]+ cr [ 1 ]∗ hdd1vec [ i ]+ cr [ 2 ]∗

hdd2vec [ i ] ) ;

hdvec [ i ] = ( hvec [ i ]−h1vec [ i ] ) /dt + ( dt/ div ) ∗(

cv [ 0 ] ∗ hddvec [ i ]+cv [ 1 ]∗ hdd1vec [ i ]+cv [ 2 ]∗ hdd2vec [

i ] ) ;

// ////////////////////////////////////////////

void pred i c torS ( )

extern double s , s1 , sdot , sddot , sddot1 ,

sddot2 , sdot1 ;

double cr [ ]=19 . 0 , −10 . 0 , 3 . 0 ;

double cv [ ]=27 . 0 , −22 . 0 , 7 . 0 ;

double div =24.0;

s1 = s ;

sdot1 = sdot ;

s += dt∗ sdot + ( dt∗dt/ div ) ∗( cr [ 0 ]∗ sddot+cr [ 1 ]∗

sddot1+cr [ 2 ]∗ sddot2 ) ;

sdot = ( s−s1 ) /dt + ( dt/ div ) ∗( cv [ 0 ]∗ sddot+cv [ 1 ]∗

sddot1+cv [ 2 ]∗ sddot2 ) ;

sddot2 = sddot1 ;

sddot1 = sddot ;

// ////////////////////////////////////////////

void c o r r ec to r S ( )

extern double s , s1 , sdot , sddot , sddot1 ,

sddot2 , sdot1 ;

double cr [ ]=3 . 0 , 10 . 0 , −1 . 0 ;

double cv [ ]=7 . 0 , 6 . 0 , −1 . 0 ;

double div =24.0;

s = s1+dt∗ sdot1 + ( dt∗dt/ div ) ∗( cr [ 0 ]∗ sddot+cr

[ 1 ] ∗ sddot1+cr [ 2 ]∗ sddot2 ) ;

sdot = ( s−s1 ) /dt + ( dt/ div ) ∗( cv [ 0 ]∗ sddot+cv [ 1 ]∗

sddot1+cv [ 2 ]∗ sddot2 ) ;

P , T and E evaluation subroutines

’eval pto.c’

#include ” func t i on s . h”

Page 172: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 153

void evalPT ( )

extern mat mt pten , h , h zero , P i j ;

extern double temp , s temp , s p re s s , p r e s s d i ag

, virsum , kinE , s , sdot , sddot , Q, potE ;

extern matrix f , r , v , tempmat ;

extern int my rank , SAtoms , p , MODE;

extern mat i j k l P i j k l ;

extern long step ;

mat mt h tr , h inv , h t r i nv , mattmp ;

int i , l , k , j ;

double vvsum , vol , tmp , c o e f f i c i e n t , t ran s [ 9 ] ,

t rans temp [ 9 ] ;

int i s , i e ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

c o e f f i c i e n t = 1. 6021892 ; // from eV to Jou l

c o e f f i c i e n t ∗= 100; // from Jou l /Angstremˆ3

to GPa

vol = det (h) ;

vvsum = 0 . 0 ;

r e a l f r ame v ( ) ;

for ( i=i s ; i<i e ; i++)

for ( k=0; k<3; k++)

vvsum += mass∗tempmat [ i ] [ k ]∗ tempmat [ i ] [ k ]∗ (

s∗ s ) ;

for ( l =0; l <3; l++)

for (k=0; k<3; k++)

pten [ l ] [ k ] += mass∗tempmat [ i ] [ l ]∗ tempmat [

i ] [ k ]∗ ( s∗ s ) ;

tmp = 0; // update vvsum in a l l p r o c e s s o r s

MPI Allreduce(&vvsum , &tmp , 1 , MPI DOUBLE,

MPI SUM, MPI COMM WORLD) ;

vvsum = tmp ;

tmp = 0; // update virsum in 0 pr oc e s s o r

MPI Reduce(&virsum , &tmp , 1 , MPI DOUBLE,

MPI SUM, 0 , MPI COMM WORLD) ;

virsum = tmp ;

tmp = 0; // update potE in 0 pr oc e s so r

MPI Reduce(&potE , &tmp , 1 , MPI DOUBLE, MPI SUM,

0 , MPI COMM WORLD) ;

potE = tmp ;

kinE = 0.5∗ vvsum ;

s temp = vvsum/(3 . 0∗ kb∗Atoms) ;

s p r e s s = c o e f f i c i e n t ∗(temp∗Atoms∗kb + virsum

/3 . 0) / vol ;

sddot = Q∗(vvsum − (3∗Atoms+1)∗kb∗temp ) / s ;

k = 0;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

trans temp [ k ] = pten [ i ] [ j ] / vol ;

k++;

MPI Allreduce ( trans temp , trans , 9 , MPI DOUBLE,

MPI SUM, MPI COMM WORLD) ;

MPI Barrier (MPI COMM WORLD) ;

k = 0;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

pten [ i ] [ j ] = t ran s [ k ] ;

k++;

pten [ i ] [ i ] −= pres s ; /∗ Sub t ra c t a p p l i e d

p r e s s u r e from d i a g ona l ∗/

pr e s s d i ag = 0 . 0 ;

for ( k=0; k<3; k++)

p re s s d i ag += pten [ k ] [ k ] ;

p r e s s d i ag /= 3 . 0 ;

// TRUE ONLY FOR pr e s s =0! !

i f ( (MODE==2) && ( my rank==0))

t ran spose ( h zero , h t r ) ;

i nv e r t ( h zero , h inv ) ;

t ran spose ( h tr , h t r i nv ) ;

mat mul ( h inv , pten , mattmp) ;

mat mul (mattmp , h t r i nv , pten ) ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

Pi j [ i ] [ j ] += −pten [ i ] [ j ] / 2 ;

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

P i j k l [ i ] [ j ] [ k ] [ l ] += ( pten [ i ] [ j ] / 2 ) ∗(

pten [ k ] [ l ] / 2 ) ;

pr e s s d i ag ∗= c o e f f i c i e n t ;

Elastic constants evaluation subroutines

’Cijkl.c’

Page 173: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 154

#include ” func t i on s . h”

#define born (3∗3∗3∗3) // t o t a l 3ˆ4 d i f f e r e n t

Born terms

// ////////////////////////////////////

void c omp c i j s t r e s s ( )

extern mat mt h , Pij , h ze ro ;

extern double temp , s temp ;

extern long step , s t e p 0 c i j ;

extern int my rank ;

extern double c11 , c12 , c13 , c33 , c55 , c66 ,

bulk1 , bulk2 ;

extern mat i j k l b avg1 , b avg2 , b avg3 ,

G inv tota l , Mijkl , P i j k l ;

mat mt htr , G, G inv ;

mat i j k l mat i jk l tmp ;

double vol , vol0 , c o e f f i c i e n t , no , bulk1 , bulk2

;

char t emp f i l e [ 6 0 ] ;

double B to t a l s [ born ] , B t o t a l r [ born ] , tmp ;

int i , i i , j j , kk , l l ;

FILE ∗ fd ;

no = (double ) ( step−s t e p 0 c i j ) ;

vol = det ( h ze ro ) ;

vol0 = det (h ) ;

t ran spose ( h zero , htr ) ;

mat mul ( htr , h zero , G) ; /∗ b u i l d G∗/

i nv e r t (G, G inv ) ;

c o e f f i c i e n t = 1. 6021892 ; // from eV to Jou l

c o e f f i c i e n t ∗= 100; // from Jou l /Angsterm ˆ3 to

GPa

i f ( no )

i = 0 ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

for ( kk=0;kk<3; kk++)

for ( l l =0; l l <3; l l ++)

B to t a l r [ i ] = 0 ;

B t o t a l s [ i ] = b avg1 [ i i ] [ j j ] [ kk ] [ l l ]

+ b avg2 [ i i ] [ j j ] [ kk ] [ l l ] + b avg3 [ i i ] [ j j ] [ kk ] [

l l ] ;

B t o t a l s [ i ] /= no ;

i++;

MPI Reduce ( B t ot a l s , B t ot a l r , born ,

MPI DOUBLE, MPI SUM, 0 , MPI COMM WORLD) ;

i f (my rank==0)

c11 = c12 = c13 = c33 = c55 = c66 = 0 . 0 ;

i = 0 ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

for ( kk=0;kk<3; kk++)

for ( l l =0; l l <3; l l ++)

G inv to ta l [ i i ] [ j j ] [ kk ] [ l l ] = G inv

[ i i ] [ kk ]∗ G inv [ j j ] [ l l ] + G inv [ i i ] [ l l ]∗ G inv [ j j

] [ kk ] ;

Mi jk l [ i i ] [ j j ] [ kk ] [ l l ] = ( P i j k l [ i i ] [

j j ] [ kk ] [ l l ]−Pi j [ i i ] [ j j ]∗ ( P i j [ kk ] [ l l ] / no ) ) /no ;

mat i jk l tmp [ i i ] [ j j ] [ kk ] [ l l ] = (−4∗

Mijkl [ i i ] [ j j ] [ kk ] [ l l ] / ( kb∗temp ) + 2∗Atoms∗kb∗

temp∗G inv to t a l [ i i ] [ j j ] [ kk ] [ l l ] + B to t a l r [ i

] ) / vol0 ;

i++;

c11 += c o e f f i c i e n t ∗ (h [ i i ] [ 0 ] ∗ h [ j j

] [ 0 ] ∗ h [ kk ] [ 0 ] ∗ h [ l l ] [ 0 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

c12 += c o e f f i c i e n t ∗ (h [ i i ] [ 0 ] ∗ h [ j j

] [ 0 ] ∗ h [ kk ] [ 1 ] ∗ h [ l l ] [ 1 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

c13 += c o e f f i c i e n t ∗ (h [ i i ] [ 0 ] ∗ h [ j j

] [ 0 ] ∗ h [ kk ] [ 2 ] ∗ h [ l l ] [ 2 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

c33 += c o e f f i c i e n t ∗ (h [ i i ] [ 2 ] ∗ h [ j j

] [ 2 ] ∗ h [ kk ] [ 2 ] ∗ h [ l l ] [ 2 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

c55 += c o e f f i c i e n t ∗ (h [ i i ] [ 0 ] ∗ h [ j j

] [ 2 ] ∗ h [ kk ] [ 0 ] ∗ h [ l l ] [ 2 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

c66 += c o e f f i c i e n t ∗ (h [ i i ] [ 1 ] ∗ h [ j j

] [ 0 ] ∗ h [ kk ] [ 1 ] ∗ h [ l l ] [ 0 ] ∗ mat i jk l tmp [ i i ] [ j j ] [

kk ] [ l l ] ) ;

bulk1 = ( c11+c12+2∗c13+c33 /2) ∗2/9;

bulk2 = ( c33 ∗( c11+c12 )−2∗c13∗ c13 ) /( c11+c12

+2∗c33−4∗c13 ) ;

s p r i n t f ( t emp f i l e , ”Cij T=%gK Atoms=%d . txt ” ,

temp , Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ”\n %ld %l f %l f %l f %l f %

l f %l f %l f %l f ” , step , c11 , c12 ,

c13 , c33 , c55 , c66 , bulk1 , bulk2 ) ;

f c l o s e ( fd ) ;

Page 174: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 155

MPI Barrier (MPI COMM WORLD) ;

// ////////////////////////////////////

void r e s t a r t c a l c u l a t e C i j s t r e s s ( )

extern long s t ep 0 c i j , step , step0 ,

N meas step1 ;

extern mat mt P i j ;

extern mat i j k l b avg1 , b avg2 , b avg3 , P i j k l ;

extern double c11 , c12 , c13 , c33 , c55 , c66 ;

extern int my rank ;

int i i , j j , kk , l l ;

for ( i i =0; i i <3; i i ++)

for ( j j =0; j j <3; j j++)

Pi j [ i i ] [ j j ] = 0 . 0 ;

for ( kk=0;kk<3; kk++)

for ( l l =0; l l <3; l l ++)

b avg1 [ i i ] [ j j ] [ kk ] [ l l ] = 0 . 0 ;

b avg2 [ i i ] [ j j ] [ kk ] [ l l ] = 0 . 0 ;

b avg3 [ i i ] [ j j ] [ kk ] [ l l ] = 0 . 0 ;

P i j k l [ i i ] [ j j ] [ kk ] [ l l ] = 0 . 0 ;

c11=c12=c13=c33=c55=c66 = 0 . 0 ;

s t e p 0 c i j = step ;

// ////////////////////////////////////

void c omp c i j s t r a i n ( )

// Ca l c u l a t i o n o f e l a s t i c con s t an t s u s ing t he

s t r a i n f l a c t u a t i o n s !

extern double op , temp ;

extern mat mt h , h zero , e , e avg ;

extern long step , step0 , s t ep e , N meas step1 ;

extern int LAST MODE, my rank ;

mat mt h tr , h z r i , h z r i t r ;

extern mat i j k l ee avg ;

int i , j , k , l ;

ma t i j k l s i j k l ;

mat c s mn , C i j k l ;

FILE ∗outd ;

char fn [ 3 0 ] ;

double cnst , c o e f f i c i e n t ;

long num of meas ;

c o e f f i c i e n t = 1. 6021892 ; // from eV to Jou l

c o e f f i c i e n t ∗= 100; // from Jou l /Angsterm ˆ3 to

GPa

num of meas=s t ep e+step−step0 ;

i f (LAST MODE==1) num of meas−=N meas step1∗

N ne i gh st ep ;

/∗ c a l c u l a t e s t r a i n e ∗/

i nv e r t ( h zero , h z r i ) ;

t ran spose ( h z r i , h z r i t r ) ;

t ran spose (h , h t r ) ;

mat mul (h , h z r i , e ) ;

mat mul ( h tr , e , e ) ;

mat mul ( h z r i t r , e , e ) ;

for ( i =0; i <3; i++)

e [ i ] [ i ]−=1.0;

mat sca mul ( 0 . 5 , e , e ) ;

mat add ( e , e avg , e avg ) ; /∗accum . e∗/

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

ee avg [ i ] [ j ] [ k ] [ l ] += e [ i ] [ j ]∗ e [ k ] [ l ] ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

s i j k l [ i ] [ j ] [ k ] [ l ] = ( ( ee avg [ i ] [ j ] [ k ] [

l ] / ( double ) num of meas ) − ( e avg [ i ] [ j ] / ( double )

num of meas ) ∗ ( e avg [ k ] [ l ] / ( double)

num of meas ) ) ;

/∗ d i g on a l s ∗/

s mn [ 1 ] [ 1 ]= s i j k l [ 0 ] [ 0 ] [ 0 ] [ 0 ] ;

s mn [ 2 ] [ 2 ]= s i j k l [ 1 ] [ 1 ] [ 1 ] [ 1 ] ;

s mn [ 3 ] [ 3 ]= s i j k l [ 2 ] [ 2 ] [ 2 ] [ 2 ] ;

s mn [ 4 ] [ 4 ]=4 . 0∗ s i j k l [ 1 ] [ 2 ] [ 1 ] [ 2 ] ;

s mn [ 5 ] [ 5 ]=4 . 0∗ s i j k l [ 0 ] [ 2 ] [ 0 ] [ 2 ] ;

s mn [ 6 ] [ 6 ]=4 . 0∗ s i j k l [ 0 ] [ 1 ] [ 0 ] [ 1 ] ;

s mn [ 1 ] [ 2 ]= s mn [ 2 ] [ 1 ]= s i j k l [ 0 ] [ 0 ] [ 1 ] [ 1 ] ;

s mn [ 1 ] [ 3 ]= s mn [ 3 ] [ 1 ]= s i j k l [ 0 ] [ 0 ] [ 2 ] [ 2 ] ;

s mn [ 1 ] [ 4 ]= s mn [ 4 ] [ 1 ]= 2 . 0∗ s i j k l [ 0 ] [ 0 ] [ 1 ] [ 2 ] ;

s mn [ 1 ] [ 5 ]= s mn [ 5 ] [ 1 ]= 2 . 0∗ s i j k l [ 0 ] [ 0 ] [ 0 ] [ 2 ] ;

s mn [ 1 ] [ 6 ]= s mn [ 6 ] [ 1 ]= 2 . 0∗ s i j k l [ 0 ] [ 0 ] [ 0 ] [ 1 ] ;

s mn [ 2 ] [ 3 ]= s mn [ 3 ] [ 2 ]= s i j k l [ 1 ] [ 1 ] [ 2 ] [ 2 ] ;

s mn [ 2 ] [ 4 ]= s mn [ 4 ] [ 2 ]= 2 . 0∗ s i j k l [ 1 ] [ 1 ] [ 1 ] [ 2 ] ;

s mn [ 2 ] [ 5 ]= s mn [ 5 ] [ 2 ]= 2 . 0∗ s i j k l [ 1 ] [ 1 ] [ 0 ] [ 2 ] ;

s mn [ 2 ] [ 6 ]= s mn [ 6 ] [ 2 ]= 2 . 0∗ s i j k l [ 1 ] [ 1 ] [ 0 ] [ 1 ] ;

s mn [ 3 ] [ 4 ]= s mn [ 4 ] [ 3 ]= 2 . 0∗ s i j k l [ 2 ] [ 2 ] [ 1 ] [ 2 ] ;

s mn [ 3 ] [ 5 ]= s mn [ 5 ] [ 3 ]= 2 . 0∗ s i j k l [ 2 ] [ 2 ] [ 0 ] [ 2 ] ;

Page 175: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 156

s mn [ 3 ] [ 6 ]= s mn [ 6 ] [ 3 ]= 2 . 0∗ s i j k l [ 2 ] [ 2 ] [ 0 ] [ 1 ] ;

s mn [ 4 ] [ 5 ]= s mn [ 5 ] [ 4 ]= 4 . 0∗ s i j k l [ 1 ] [ 2 ] [ 0 ] [ 2 ] ;

s mn [ 4 ] [ 6 ]= s mn [ 6 ] [ 4 ]= 4 . 0∗ s i j k l [ 1 ] [ 2 ] [ 0 ] [ 1 ] ;

s mn [ 5 ] [ 6 ]= s mn [ 6 ] [ 5 ]= 4 . 0∗ s i j k l [ 0 ] [ 2 ] [ 0 ] [ 1 ] ;

inv ( s mn , C i j k l ) ;

i f (my rank==0)

i f ( step % 1000 == 0 .0 )

cnst=det ( h ze ro ) /( kb∗temp ) ;

s p r i n t f ( fn , ” s o u t %d . txt ” , num of meas ) ;

outd=fopen ( fn , ”w” ) ;

f p r i n t f ( outd , ”\n” ) ;

for ( i =1; i <7; i++)

f p r i n t f ( outd , ”\n” ) ;

for ( j =1; j <7; j++)

f p r i n t f ( outd , ” %l f ” , c o e f f i c i e n t ∗

Ci j k l [ i ] [ j ] / cnst ) ;

f c l o s e ( outd ) ;

i f ( ( outd=fopen ( ” s l i s t . txt ” , ”a+”) ) !=NULL)

f p r i n t f ( outd , ” %ld \n” , num of meas ) ;

f c l o s e ( outd ) ;

MPI Barrier (MPI COMM WORLD) ;

// ////////////////////////////////////

void e ee backup ( )

extern double ee avg [ 3 ] [ 3 ] [ 3 ] [ 3 ] ;

extern mat mt e ;

extern mat mt e avg ;

extern long step ;

extern long s t ep e , step0 , N meas step1 ;

extern int LAST MODE;

int i , j , k , l ;

FILE ∗outd ;

long num of meas ;

num of meas=s t ep e+step−step0 ;

i f (LAST MODE==1)num of meas−=N meas step1∗

N ne i gh st ep ;

i f ( step % step Ci jk l backup == 0 )

i f ( ( outd=fopen ( ” ee av backup . dat ” , ”w” ) ) !=NULL

)

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

f p r i n t f ( outd , ” \n %l f ” , ee avg [ i ] [ j

] [ k ] [ l ] ) ;

f c l o s e ( outd ) ;

i f ( ( outd=fopen ( ” e av backup . dat ” , ”w” ) ) !=NULL

)

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

f p r i n t f ( outd , ” \n %l f ” , e avg [ i ] [ j ] ) ;

f p r i n t f ( outd , ” \n %ld ” , num of meas ) ;

f c l o s e ( outd ) ;

Read and save subroutine

’read save.c’

#include ” func t i on s . h”

#define ZERRO 900000000

// //////////////////////////////

void s a v e t o f i l e ( int mode)

// This f un c t i o n i s on ly send by p ro c e s s o r 0

extern matrix r , v ;

extern mat mt h ;

extern long step , step0 ;

double x , y , z ;

int i ;

FILE ∗ fd , ∗ fdr , ∗ fdv ;

char fn [ 4 0 ] ;

i f (mode==1)

s p r i n t f ( fn , ” coord s %ld . out ” , step ) ; // f o r

f u t u r e FFT and phonon spectrum

i f ( ( fd=fopen ( fn , ”w” ) ) !=NULL)

for ( i =0; i<Atoms ; i++)

Page 176: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 157

f p r i n t f ( fd , ”%l f %l f %l f %l f %l f %l f \n ” ,

r [ i ] [ 0 ] , r [ i ] [ 1 ] , r [ i ] [ 2 ] , v [ i ] [ 0 ] , v [ i

] [ 1 ] , v [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

// i f (mode==1)

else

i f ( ( fd=fopen ( ” rv . l og ” , ”w” ) ) !=NULL)

fd r=fopen ( ” r . l og ” , ”w” ) ;

fdv=fopen ( ”v . l og ” , ”w” ) ;

for ( i =0; i<Atoms ; i++)

f p r i n t f ( fd , ”%l f %l f %l f %l f %l f %l f \n ” ,

r [ i ] [ 0 ] , r [ i ] [ 1 ] , r [ i ] [ 2 ] , v [ i ] [ 0 ] , v [ i

] [ 1 ] , v [ i ] [ 2 ] ) ;

x = h [ 0 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 0 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 0 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

y = h [ 1 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 1 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 1 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

z = h [ 2 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 2 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 2 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

f p r i n t f ( fdr , ”%l f %l f %l f \n ” ,x , y , z ) ;

x = h [ 0 ] [ 0 ] ∗ v [ i ] [ 0 ] + h [ 0 ] [ 1 ] ∗ v [ i ] [ 1 ] + h

[ 0 ] [ 2 ] ∗ v [ i ] [ 2 ] ;

y = h [ 1 ] [ 0 ] ∗ v [ i ] [ 0 ] + h [ 1 ] [ 1 ] ∗ v [ i ] [ 1 ] + h

[ 1 ] [ 2 ] ∗ v [ i ] [ 2 ] ;

z = h [ 2 ] [ 0 ] ∗ v [ i ] [ 0 ] + h [ 2 ] [ 1 ] ∗ v [ i ] [ 1 ] + h

[ 2 ] [ 2 ] ∗ v [ i ] [ 2 ] ;

f p r i n t f ( fdv , ”%l f %l f %l f \n ” ,x , y , z ) ;

f c l o s e ( fd ) ;

f c l o s e ( fd r ) ;

f c l o s e ( fdv ) ;

// //////////////////////////////

void bp recovery (void )

extern long s t ep 0 c i j , step0 ;

extern mat i j k l P i jk l , b avg1 , b avg2 , b avg3 ;

extern double c11 , c12 , c13 , c33 , c55 , c66 ;

extern double temp ;

extern int my rank ;

extern mat mt P i j ;

char t emp f i l e [ 6 0 ] ;

FILE ∗ outd ;

int i , j , k , l ;

s p r i n t f ( t emp f i l e , ”bp backup%d T=%gK Atoms=%d .

dat ” , my rank , temp , Atoms) ;

i f ( ( outd=fopen ( t emp f i l e , ” r ” ) ) !=NULL)

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

f s c a n f ( outd , ”%g ” , &Pi j [ i ] [ j ] ) ;

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

f s c a n f ( outd , ”%g %g %g %g ” , &

P i j k l [ i ] [ j ] [ k ] [ l ] , &b avg1 [ i ] [ j

] [ k ] [ l ] , &b avg2 [ i ] [ j ] [ k ] [ l ] , &

b avg3 [ i ] [ j ] [ k ] [ l ] ) ;

f s c a n f ( outd , ”\n” ) ;

f s c a n f ( outd , ”%ld\n” ,& s t e p 0 c i j ) ;

f c l o s e ( outd ) ;

else

f p r i n t f ( s tder r , ” Proces sor %d can ’ t read

bp backup . dat : s t a r t i n g again from zero

\n” , my rank ) ;

/∗Can not recover , so s t a r t from the

be g i nn i ng ∗/

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

Pi j [ i ] [ j ] = 0 . 0 ;

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

P i j k l [ i ] [ j ] [ k ] [ l ] = b avg1 [ i ] [ j ] [ k ] [ l

] = b avg2 [ i ] [ j ] [ k ] [ l ] = b avg3 [ i ] [ j ] [ k ] [ l ] =

0 . 0 ;

c11=c12=c13=c33=c55=c66 =0.0;

s t e p 0 c i j=step0 ;

// //////////////////////////////

void bp backup (void )

extern long s t e p 0 c i j ;

extern mat i j k l P i jk l , b avg1 , b avg2 , b avg3 ;

extern double temp ;

extern int my rank ;

extern mat mt P i j ;

char t emp f i l e [ 6 0 ] ;

FILE ∗ outd ;

int i , j , k , l ;

Page 177: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 158

s p r i n t f ( t emp f i l e , ”bp backup%d T=%gK Atoms=%d .

dat ” , my rank , temp , Atoms) ;

outd=fopen ( t emp f i l e , ”w” ) ;

for ( i =0; i <3; i++)

for ( j =0; j <3; j++)

f p r i n t f ( outd , ”%g ” , P i j [ i ] [ j ] ) ;

for (k=0; k<3; k++)

for ( l =0; l <3; l++)

f p r i n t f ( outd , ”%g %g %g %g ” , P i j k l [

i ] [ j ] [ k ] [ l ] , b avg1 [ i ] [ j ] [ k ] [ l ] ,

b avg2 [ i ] [ j ] [ k ] [ l ] , b avg3 [ i ] [ j ] [ k

] [ l ] ) ;

f p r i n t f ( outd , ”\n” ) ;

f p r i n t f ( outd , ”%ld\n” , s t e p 0 c i j ) ;

f c l o s e ( outd ) ;

// //////////////////////////////

void accumulate h ( )

extern mat mt h , h ze ro ;

mat add (h , h zero , h ze ro ) ; /∗ accum . h∗/

// //////////////////////////////

void s ave s ( )

// This f un c t i o n i s on ly send by p ro c e s s o r 0

extern double temp , s , sdot , sddot , s1 , sddot1 ,

sddot2 , sdot1 ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ” s T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”w” ) ) !=NULL)

f p r i n t f ( fd , ”%l f %l f %l f %l f %l f %l f %l f \n” , s ,

sdot , sddot , s1 , sddot1 , sddot2 , sdot1 )

;

f c l o s e ( fd ) ;

// //////////////////////////////

void save h ( )

// This f un c t i o n i s on ly send by p ro c e s s o r 0

extern mat mt h ;

extern double temp ;

int i ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ”h T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”w” ) ) !=NULL)

for ( i =0; i <3; i++)

f p r i n t f ( fd , ”%l f %l f %l f \n” ,h [ i ] [ 0 ] , h [ i ] [ 1 ] ,

h [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

// //////////////////////////////

void save h0 ( )

// This f un c t i o n i s on ly send by p ro c e s s o r 0

extern mat mt h zero ;

extern double temp ;

int i ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ”h0 T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”w” ) ) !=NULL)

for ( i =0; i <3; i++)

f p r i n t f ( fd , ”%l f %l f %l f \n” , h ze ro [ i ] [ 0 ] ,

h ze ro [ i ] [ 1 ] , h ze ro [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

// //////////////////////////////

void r ead s ( )

extern double s , sdot , sddot , temp , s1 , sddot1

, sddot2 , sdot1 ;

extern int my rank ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ” s T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ” r ” ) ) !=NULL)

f s c a n f ( fd , ”%l f %l f %l f %l f %l f %l f %l f \n” , &s

, &sdot , &sddot , &s1 , &sddot1 , &sddot2 ,

&sdot1 ) ;

f c l o s e ( fd ) ;

else

i f (my rank==0)

Page 178: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 159

f p r i n t f ( s tder r , ”\n \ t Can ’ t open ’%s ’ :

r e s t a r t i n g s parameters ” , t emp f i l e ) ;

s = 1 ;

s1 = sdot = sddot = sddot1 = sddot2 = sdot1 =

0 . 0 ;

// //////////////////////////////

void read h ( )

extern mat mt h ;

extern double temp ;

extern int my rank ;

int i ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ”h T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ” r ” ) ) !=NULL)

for ( i =0; i <3; i++)

f s c a n f ( fd , ”%l f %l f %l f \n” ,&h [ i ] [ 0 ] ,& h [ i

] [ 1 ] ,& h [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Can ’ t open ’%s ’ :

s t a r t i n g again ” , t emp f i l e ) ;

MPI end ( ) ;

// //////////////////////////////

void read h0 ( )

extern mat mt h zero ;

extern double temp ;

extern int my rank ;

int i ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ”h0 T=%gK Atoms=%d . l og ” , temp ,

Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ” r ” ) ) !=NULL)

for ( i =0; i <3; i++)

f s c a n f ( fd , ”%l f %l f %l f \n” ,&h zero [ i ] [ 0 ] ,&

h zero [ i ] [ 1 ] ,& h zero [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Can ’ t open ’%s ’ :

s t a r t i n g again ” , t emp f i l e ) ;

MPI end ( ) ;

// //////////////////////////////

void r e a d f r om f i l e ( fn )

char ∗ fn ;

extern matrix r , v ;

extern mat mt h ;

extern int my rank ;

int i ;

FILE ∗ fd ;

i f ( ( fd=fopen ( fn , ” r ” ) ) !=NULL)

for ( i =0; i<Atoms ; i++)

f s c a n f ( fd , ”%l f %l f %l f %l f %l f %l f \n” ,&r [ i

] [ 0 ] ,& r [ i ] [ 1 ] ,& r [ i ] [ 2 ] ,& v [ i ] [ 0 ] ,& v [ i

] [ 1 ] ,& v [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Can ’ t open ’%s ’ :

t ry i ng to open ’ r . l og ’ f i l e only (

r e i n i t i a l i z i n g v e l o c i t i e s ) . ” , fn ) ;

i f ( ( fd=fopen ( ” r . l og ” , ” r ” ) ) !=NULL)

for ( i =0; i<Atoms ; i++)

f s c a n f ( fd , ”%l f %l f %l f \n” ,&r [ i ] [ 0 ] ,& r [ i

] [ 1 ] ,& r [ i ] [ 2 ] ) ;

f c l o s e ( fd ) ;

s ca l ed f rame ( r , Atoms) ;

i f (my rank==0)

v e l o c i t y i n i t ( ) ;

MPI Barrier (MPI COMM WORLD) ; // A l l

p r o c e s s o r s wa i t f o r p r oc e s so r 0 t o

f i n i s h randomiz ing i n i t i a l v e l o c i t i e s

MPI exchange veloc i ty ( ) ;

s ca l ed f rame (v , Atoms) ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Can ’ t open ’ r . l og ’ :

ending s imu lat i on s ! ” ) ;

MPI end ( ) ;

Page 179: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 160

// //////////////////////////////

void save EPTVOh ()

extern double s temp , s p r e s s , p r e s s d i ag , opz ,

opxy , kinE , potE , omega E , temp , s ;

extern long step , step0 ;

extern mat mt h ;

FILE ∗ fd ;

char t emp f i l e [ 6 0 ] ;

s p r i n t f ( t emp f i l e , ” infoEPT T=%gK Atoms=%d . txt ” ,

temp , Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ”\n %ld %g %l f %l f %l f %l f %

g %g %g” , step , omega E , potE+kinE ,

potE , kinE , s temp , s p r e s s , p r e s s d i ag ,

s ) ;

f c l o s e ( fd ) ;

s p r i n t f ( t emp f i l e , ” i n f o or de r T=%gK Atoms=%d . txt

” , temp , Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ”\n %ld %l f %l f ” , step , opxy , opz

) ;

f c l o s e ( fd ) ;

s p r i n t f ( t emp f i l e , ” h 11 22 33 T=%gK Atoms=%d . txt

” , temp , Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ” %ld %l f %l f %l f \n” , step , h

[ 0 ] [ 0 ] , h [ 1 ] [ 1 ] , h [ 2 ] [ 2 ] ) ;

f c l o s e ( fd ) ;

s p r i n t f ( t emp f i l e , ” h 12 13 23 T=%gK Atoms=%d . txt

” , temp , Atoms) ;

i f ( ( fd=fopen ( t emp f i l e , ”a+” ) ) !=NULL)

f p r i n t f ( fd , ” %ld %l f %l f %l f %l f %l f %l f \n” ,

step , h [ 0 ] [ 1 ] , h [ 0 ] [ 2 ] , h [ 1 ] [ 2 ] , h

[ 1 ] [ 0 ] , h [ 2 ] [ 0 ] , h [ 2 ] [ 1 ] ) ;

f c l o s e ( fd ) ;

// //////////////////////////////

void get i n form (void )

extern long N meas step nvt ;

extern int MODE, REFRESH, LAST MODE, NVE;

extern long N meas step1 , N meas step2 , step ,

step0 , s t ep av i z1 , s t ep av i z 2 ;

extern double temp , Q, W, a0 , c0 ;

extern int my rank ;

f l oat s tam rea l ;

FILE ∗outd ;

i f ( ( outd=fopen ( ” aaa in f o . pr” , ” r ” ) ) !=NULL)

f s c a n f ( outd , ”\n %d”,&MODE) ;

i f (MODE==2)

LAST MODE=2;

f s c a n f ( outd , ”\n %l f ” ,&a0 ) ;

f s c a n f ( outd , ”\n %l f ” ,&c0 ) ;

f s c a n f ( outd , ”\n %l f ” ,&temp ) ;

f s c a n f ( outd , ”\n %ld ” ,&N meas step1 ) ;

i f ( N meas step1>0&&N meas step1 <100)

N meas step1 =100;

N meas step1 =(long ) N meas step1 ∗1.0/

N ne i gh st ep ;

f s c a n f ( outd , ”\n %ld ” ,&N meas step2 ) ; //

N meas step2 =0;

i f ( N meas step2>0 && N meas step2 <100)

N meas step2 =100;

N meas step2 =(long ) N meas step2 ∗1.0/

N ne i gh st ep ;

f s c a n f ( outd , ”\n %ld ” ,& step0 ) ;

f s c a n f ( outd , ”\n %l f ” ,& stam rea l ) ;

f s c a n f ( outd , ”\n %ld ” ,& s tep a v i z 1 ) ;

i f ( s t ep av i z 1 )

s t ep av i z 1=( int ) 1.0∗ N meas step1 ∗

N ne i gh st ep / s t ep av i z 1 ;

else s t ep av i z 1=ZERRO;

f s c a n f ( outd , ”\n %ld ” ,& s tep a v i z 2 ) ;

i f ( s t ep av i z 2 )

s t ep av i z 2=( int ) 1.0∗ N meas step2 ∗

N ne i gh st ep / s t ep av i z 2 ;

else s t ep av i z 2=ZERRO;

f s c a n f ( outd , ”\n %l f ” , &Q) ;

f s c a n f ( outd , ”\n %l f ” , &W) ;

f s c a n f ( outd , ”\n %d” , &NVE) ;

f s c a n f ( outd , ”\n %d ” , &REFRESH) ;

f c l o s e ( outd ) ;

i f (my rank==0)

f p r i n t f ( s tder r , ”\n Star t i ng s imu lat i on from

MODE [%d ] . ” ,MODE) ;

Page 180: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 161

f p r i n t f ( s tder r , ”\n Star t i ng s imu lat i on from

l a t t i c e parameters a0=[%g ] & c0=[%g ] .

” , a0 , c0 ) ;

f p r i n t f ( s tder r , ”\n The system ’ s temperature

%g . ” , ( f l oat ) temp ) ;

f p r i n t f ( s tder r , ”\n Number o f s t ep s [% ld ]

and measurements [% ld ] in MODE[ 1 ] . ” ,

N meas step1 ∗100 , N meas step1 ) ;

f p r i n t f ( s tder r , ”\n Number o f s t ep s [% ld ]

and measurements [% ld ] in MODE[ 2 ] . ” ,

N meas step2 ∗100 , N meas step2 ) ;

f p r i n t f ( s tder r , ”\n The l a s t step was = %ld .

” , step0 ) ;

f p r i n t f ( s tder r , ”\n The task have been

completed on = %g percent . ” , s tam rea l )

;

f p r i n t f ( s tder r , ”\n Number o f s t ep s between

av i z frames in MODE[1]=[%d ] and MODE

[2]=[%d ] . ” , s t ep av i z1 , s t ep av i z 2 ) ;

f p r i n t f ( s tder r , ”\n Heat bath mass (Q)=[%g ]

, Pressure bath mass (W)=[%g ] ” , Q, W)

;

i f (NVE)

f p r i n t f ( s tder r , ”\n Changing ensemble from

TtN to NVE in MODE[ 2 ] . ” ) ;

else f p r i n t f ( s tder r , ”\n Changing ensemble

from TtN to NVT in MODE[ 2 ] . ” ) ;

i f (REFRESH) f p r i n t f ( s tder r , ”\n With

re f r e shment s o f e l a s t i c con stan t s

c a l cu l a t i o n s . ” ) ;

else f p r i n t f ( s tder r , ”\n Without

r e f r e shment s o f e l a s t i c con stan t s

c a l cu l a t i o n s . ” ) ;

else

i f (my rank==0)

f p r i n t f ( s tder r , ”\n \ t Sorry , but I can ’ t

open the f i l e : a a a i n f o . pr” ) ;

f p r i n t f ( s tder r , ”\n \ t So I try to guess the

i n i t i a l parameters ” ) ;

f p r i n t f ( s tder r , ”\n \ t Check them and s t a r t

again ” ) ;

i f ( ( outd=fopen ( ” aa a i n f o . pr” , ”w” ) ) !=NULL)

f p r i n t f ( outd , ” \n %d ” , 0) ;

f p r i n t f ( outd , ” \n %l f ” ,3 . 1 86) ;

f p r i n t f ( outd , ” \n %l f ” , 5 . 1677) ;

f p r i n t f ( outd , ” \n %l f ” ,6 00 . 0) ;

f p r i n t f ( outd , ” \n %ld ” ,300000) ;

f p r i n t f ( outd , ” \n %ld ” ,200000) ;

f p r i n t f ( outd , ” \n %ld ” , 0) ;

f p r i n t f ( outd , ” \n %ld ” , 0) ;

f p r i n t f ( outd , ” \n %d ” ,150) ;

f p r i n t f ( outd , ” \n %d ” ,200) ;

f p r i n t f ( outd , ” \n %l f ” , 3 . 0 ) ;

f p r i n t f ( outd , ” \n %l f ” , 3 . 0 ) ;

f p r i n t f ( outd , ” \n %d ” , 0) ;

f p r i n t f ( outd , ” \n %d ” , 1) ;

f p r i n t f ( outd , ” \n

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗” ) ;

f p r i n t f ( outd , ” \n MODE [ 0 ] or [ 1 ] or [ 2 ] ” )

;

f p r i n t f ( outd , ” \n l a t t i c e parameter a0” ) ;

f p r i n t f ( outd , ” \n l a t t i c e parameter c0” ) ;

f p r i n t f ( outd , ” \n temp” ) ;

f p r i n t f ( outd , ” \n N1 steps ” ) ;

f p r i n t f ( outd , ” \n N2 steps ” ) ;

f p r i n t f ( outd , ” \n step0 ” ) ;

f p r i n t f ( outd , ” \n percentage ” ) ;

f p r i n t f ( outd , ” \n Number o f av i z frames

in MODE[0&1] ” ) ;

f p r i n t f ( outd , ” \n Number o f av i z frames

in MODE[ 2 ] ” ) ;

f p r i n t f ( outd , ” \n Heat bath mass Q

r e l a t i v e to 300K” ) ;

f p r i n t f ( outd , ” \n Pressure bath mass W

r e l a t i v e to 300K” ) ;

f p r i n t f ( outd , ” \n E l a s t i c con stan t s

c a l cu l a t ed in NVE [ 1 ] or NVT [ 0 ] in

MODE[ 2 ] ” ) ;

f p r i n t f ( outd , ” \n REFRESHMENTS 1 [ Yes ] or

0 [No ] ” ) ;

f p r i n t f ( outd , ” \n

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗” ) ;

f c l o s e ( outd ) ;

MPI end ( ) ;

// //////////////////////////////

void save in form (void )

extern int MODE,LAST MODE, REFRESH, NVE;

extern long N meas step1 , N meas step2 , step ,

step0 , s t ep av i z1 , s t ep av i z 2 ;

extern double temp , Q, W, a0 , c0 ;

extern t ime t s t a r t t ;

extern int my rank ;

f l oat percent ;

Page 181: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 162

FILE ∗outd ;

int f l a g =0;

char t emp f i l e [ 6 0 ] ;

// Timer

t ime t t i l l t ;

double t o t a l ;

s p r i n t f ( t emp f i l e , ” aaa in f o . pr . txt ” ) ;

i f (my rank==0)

i f ( ( outd=fopen ( t emp f i l e , ”w” ) ) !=NULL)

i f (MODE==0)

f p r i n t f ( outd , ” \n %d ” , 1) ;

else f p r i n t f ( outd , ” \n %d ” ,MODE) ;

f p r i n t f ( outd , ” \n %l f ” , a0 ) ;

f p r i n t f ( outd , ” \n %l f ” , c0 ) ;

f p r i n t f ( outd , ” \n %g ” , temp ) ;

f p r i n t f ( outd , ” \n %ld ” , N meas step1∗

N ne i gh st ep ) ;

f p r i n t f ( outd , ” \n %ld ” , N meas step2∗

N ne i gh st ep ) ;

f p r i n t f ( outd , ” \n %ld ” , step ) ;

i f (MODE==0)

percent=( f l oat ) 100 . 0∗ ( step−step0 ) /( (

N meas step1+N meas step2 )∗N ne i gh st ep ) ;

i f (MODE==1)

i f ( N meas step1 )

percent=( f l oat ) 100 . 0∗ ( step−step0 ) /( (

N meas step1+N meas step2 )∗N ne i gh st ep ) ;

else percent =0;

i f (MODE==2)

i f (LAST MODE==1)

i f ( N meas step2 )

percent=( f l oat ) 100 . 0∗ ( step−step0 ) /( (

N meas step2+N meas step1 )∗N ne i gh st ep ) ;

else percent =0;

i f (LAST MODE==2)

i f ( N meas step2 )

percent=( f l oat ) 100 . 0∗ ( step−step0 ) /(

N meas step2∗N ne i gh st ep ) ;

else percent =0;

f p r i n t f ( outd , ” \n %f ” , percent ) ;

i f ( ( s t ep av i z 1 !=ZERRO) && ( s t ep av i z 1 !=0) )

f p r i n t f ( outd , ” \n %d” , ( int ) 1 . 0∗ (

N meas step1 )∗N ne i gh st ep /

s t ep av i z 1 ) ;

else f p r i n t f ( outd , ” \n %d” , 0) ;

i f ( ( s t ep av i z 2 !=ZERRO) && ( s t ep av i z 2 !=0) )

f p r i n t f ( outd , ” \n %d” , ( int ) 1 . 0∗ (

N meas step2 )∗N ne i gh st ep /

s t ep av i z 2 ) ;

else f p r i n t f ( outd , ” \n %d” , 0) ;

f p r i n t f ( outd , ” \n %l f ” , Q) ; //∗ temp /600

f p r i n t f ( outd , ” \n %l f ” , W) ; //∗ temp /600

f p r i n t f ( outd , ” \n %d” , NVE) ;

f p r i n t f ( outd , ” \n %d” , REFRESH) ;

f p r i n t f ( outd , ”\n

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗” ) ;

f p r i n t f ( outd , ” \n MODE [ 0 ] or [ 1 ] or [ 2 ] ” ) ;

f p r i n t f ( outd , ” \n l a t t i c e parameter a0” ) ;

f p r i n t f ( outd , ” \n l a t t i c e parameter c0” ) ;

f p r i n t f ( outd , ” \n temp” ) ;

f p r i n t f ( outd , ” \n N1 steps ” ) ;

f p r i n t f ( outd , ” \n N2 steps ” ) ;

f p r i n t f ( outd , ” \n step0 ” ) ;

f p r i n t f ( outd , ” \n percentage ” ) ;

f p r i n t f ( outd , ” \n Number o f av i z frames in

MODE[0&1] ” ) ;

f p r i n t f ( outd , ” \n Number o f av i z frames in

MODE[ 2 ] ” ) ;

f p r i n t f ( outd , ” \n Heat bath mass Q r e l a t i v e

to 300K” ) ;

f p r i n t f ( outd , ” \n Pressure bath mass W

r e l a t i v e to 300K”) ;

f p r i n t f ( outd , ” \n E l a s t i c con stan t s

c a l cu l a t ed in NVE [ 0 ] or NVT [ 1 ] ” , 1) ;

f p r i n t f ( outd , ” \n REFRESHMENTS 1 [ Yes ] or 0

[No ] ” ) ;

f p r i n t f ( outd , ” \n

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗” ) ;

f p r i n t f ( outd , ”\n Percentage completed [% f %]

in t o t a l running time : ” , percent ) ;

f p r i n t f ( s tder r , ”\n Percentage completed [% f

%] in t o t a l running time : ” , percent ) ;

/// Timer s e c t i o n

t i l l t = time (NULL) ; //Timer o f f

t o t a l = d i f f t ime ( t i l l t , s t a r t t ) ;

i f ( tota l <60)

f p r i n t f ( s t d e r r , ”%l f s ec ” , t o t a l ) ;

f p r i n t f ( outd , ”%l f s ec ” , t o t a l ) ;

else i f ( tota l <3600)

Page 182: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 163

int min ;

double sec ;

min = ( int ) t o t a l /60;

s ec = to t a l − (double ) (min∗60) ;

f p r i n t f ( s t d e r r , ”%d min , %l f s ec ” , min

, sec ) ;

f p r i n t f ( outd , ”%d min , %l f s ec ” , min ,

sec ) ;

else

int hour , min ;

double sec ;

hour = ( int ) t o t a l /3600;

min = ( int ) ( tota l −(double ) 3600∗ hour )

/60;

s ec = to t a l − (double ) ( (min + hour ∗60)

∗60) ;

f p r i n t f ( s td e r r , ”%d hour , %d min , %

l f s ec ” , hour , min , sec ) ;

f p r i n t f ( outd , ”%d hour , %d min , %l f

s ec ” , hour , min , sec ) ;

f c l o s e ( outd ) ;

else

f p r i n t f ( s tder r , ”\n Can ’ t open the f i l e : ’

a aa in f o . pr . txt ’ ” ) ;

f l a g = 1 ;

MPI Barrier (MPI COMM WORLD) ;

i f ( f l a g )

MPI end ( ) ;

// //////////////////////////////

double determ (double x00 , double x01 , double

x10 , double x11 )

return ( x00∗x11−x01∗x10 ) ;

Visualization subroutine

’visualization.c’

#include ” func t i on s . h”

void Aviz (char ∗ fn )

extern matrix r ;

extern mat mt h ;

extern int my rank , TAtoms ;

double x , y , z ;

int i , f l a g =0;

FILE ∗ fd ;

char ∗ c o l o r [ ]=”a1” , ”a2” , ”a3” , ”a4” , ”a5” , ”a6” , ”

a7” , ”a8” , ”a9” ,

”b1” , ”b2” , ”b3” , ”b4” , ”b5” , ”b6” , ”b7” , ”b8” , ”b9

” ,

” c1” , ”c2” , ” c3” , ” c4” , ”c5” , ” c6” , ” c7” , ”c8” , ” c9

” ,

”d1” , ”d2” , ”d3” , ”d4” , ”d5” , ”d6” , ”d7” , ”d8” , ”d9

” ,

” e1” , ”e2” , ” e3” , ” e4” , ”e5” , ” e6” , ” e7” , ”e8” , ” e9

” ,

” f1 ” , ” f2 ” , ” f3 ” , ” f4 ” , ” f5 ” , ” f6 ” , ” f7 ” , ” f8 ” , ” f9

” ,

”g1” , ”g2” , ”g3” , ”g4” , ”g5” , ”g6” , ”g7” , ”g8” , ”g9

” ,

”h1” , ”h2” , ”h3” , ”h4” , ”h5” , ”h6” , ”h7” , ”h8” , ”h9

” ,

” i 1 ” , ” i 2 ” , ” i 3 ” , ” i 4 ” , ” i 5 ” , ” i 6 ” , ” i 7 ” , ” i8 ” , ” i 9

” ,

” j1 ” , ” j2 ” , ” j3 ” , ” j4 ” , ” j5 ” , ” j6 ” , ” j7 ” , ” j8 ” , ” j9

” ,

” l 1 ” , ” l 2 ” , ” l 3 ” , ” l 4 ” , ” l 5 ” , ” l 6 ” , ” l 7 ” , ” l8 ” , ” l 9

” ,

”m1” , ”m2” , ”m3” , ”m4” , ”m5” , ”m6” , ”m7” , ”m8” , ”m9

” ;

i f (my rank==0)

i f ( ( fd=fopen ( fn , ”w” ) ) !=NULL)

f p r i n t f ( fd , ” %d \n” , Atoms) ;

f p r i n t f ( fd , ”##Ci j k l s imu l at i on s o f bulk

magnesium\n” ) ;

for ( i =0; i<Atoms ; i++)

x = h [ 0 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 0 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 0 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

y = h [ 1 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 1 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 1 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

z = h [ 2 ] [ 0 ] ∗ r [ i ] [ 0 ] + h [ 2 ] [ 1 ] ∗ r [ i ] [ 1 ] + h

[ 2 ] [ 2 ] ∗ r [ i ] [ 2 ] ;

f p r i n t f ( fd , ”%s %l f %l f %l f \n” , c o l o r [ (

int ) f l o o r ( i /TAtoms ) ] , x , y , z ) ;

f c l o s e ( fd ) ;

else f l a g =1;

i f ( f l a g )

Page 183: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 164

i f (my rank==0)

f p r i n t f ( s tder r , ” I can ’ t open the f i l e ’%s ’ ”

, fn ) ;

MPI end ( ) ;

MPI custom subroutines

’mpifunc.c’

#include ” func t i on s . h”

// ////////////////////////////////////

void MPI update r v f n ( int d)

// d=0 on ly update r ; d=1 on ly update v ; d=2

update r and v , d=3 update f , d=4 update n

and g

extern MPI Datatype mpi 1 vec ;

extern int SAtoms , my rank , p , MODE;

extern matrix r , v , tempmat , f ;

extern vector n , n temp , gtemp r , gtemp s , f f r

, f f t ;

extern t en sor g ;

extern MPI Status s ta tu s ;

int l ima , dim , limb , i s , i e , i , j , k , count ;

l ima = my rank∗SAtoms ;

l imb = (my rank+1)∗SAtoms ;

i s = my rank∗SAtoms ;

i e = (my rank+1)∗SAtoms ;

MPI Barrier (MPI COMM WORLD) ;

i f ( ( d==0) | | (d==2))

MPI Allgather (&tempmat [ l ima ] [ 0 ] , Atoms/p ,

mpi 1 vec , &r [ 0 ] [ 0 ] , Atoms/p , mpi 1 vec ,

MPI COMM WORLD) ;

i f ( ( d==1) | | (d==2))

for ( i=i s ; i<i e ; i++)

for (dim=0; dim<3; dim++)

tempmat [ i ] [ dim ] = v [ i ] [ dim ] ;

MPI Gather(&tempmat [ l ima ] [ 0 ] , Atoms/p ,

mpi 1 vec , &v [ 0 ] [ 0 ] , Atoms/p , mpi 1 vec , 0 ,

MPI COMM WORLD) ;

i f (d==3)

MPI Allreduce(& f f t [ 0 ] , &f f r [ 0 ] , 3∗Atoms ,

MPI DOUBLE, MPI SUM, MPI COMM WORLD) ;

i f (d==4)

MPI Allreduce(&n temp [ 0 ] , &n [ 0 ] , Atoms ,

MPI DOUBLE, MPI SUM, MPI COMM WORLD) ;

i f (MODE==2) // update g f un c t i o n t o a l l

p r o c e s s o r s

for ( i =0; i<Atoms ; i++)

count = 0 ;

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

gtemp r [ i+count∗Atoms ] = 0 ;

gtemp s [ i+count∗Atoms ] = g [ i ] [ j ] [ k ] ;

count++;

MPI Allreduce(&gtemp s [ 0 ] , &gtemp r [ 0 ] , 9∗

Atoms , MPI DOUBLE, MPI SUM, MPI COMM WORLD) ;

for ( i =0; i<Atoms ; i++)

for ( j =0; j <3; j++)

for (k=0; k<3; k++)

g [ i ] [ j ] [ k ] = gtemp r [ i+count∗Atoms ] ;

MPI Barrier (MPI COMM WORLD) ;

// ////////////////////////////////////

void MPI data s t ruct c r eat i on ( )

extern MPI Datatype mpi v t , mpi 1 vec ;

i n t v e c t o r b l ock l ength s , d i sp lacements ;

int i , j , t1 , t2 ;

b l o ck l eng th s = iv e c t o r (0 , Atoms−1) ;

d i sp lacements = iv e c t o r (0 , Atoms−1) ;

for ( i =0; i<Atoms ; i++)

b l o ck l eng th s [ i ] = 3 ;

d i sp lacements [ i ] = 3∗ i ;

t1 = 3 ;

t2 = 0 ;

MPI Type indexed (1 , &t1 , &t2 , MPI DOUBLE, &

mpi 1 vec ) ;

MPI Type commit(&mpi 1 vec ) ;

MPI Type indexed (Atoms , &b lo ck l eng th s [ 0 ] , &

di sp lacements [ 0 ] , MPI DOUBLE, &mpi v t ) ;

MPI Type commit(&mpi v t ) ;

f r e e i v e c t o r ( b l ock l ength s , 0 , Atoms−1) ;

f r e e i v e c t o r ( d i sp lacements , 0 , Atoms−1) ;

Page 184: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 165

// ////////////////////////////////////

void MPI exchange veloc i ty ( )

extern int my rank ;

extern matrix v ;

extern MPI Datatype mpi v t ;

extern MPI Status s ta tu s ;

MPI Bcast(&v [ 0 ] [ 0 ] , 1 , mpi v t , 0 ,

MPI COMM WORLD) ;

MPI Barrier (MPI COMM WORLD) ;

// ////////////////////////////////////

void MPI start ( int argc , char∗ argv [ ] )

extern int my rank , p ;

extern t ime t s t a r t t ;

MPI Init(&argc , &argv ) ; // S t a r t up MPI

MPI Comm size (MPI COMM WORLD, &p) ; //Find out

number o f p r o c e s s e s

MPI Comm rank (MPI COMM WORLD, &my rank ) ; //Find

out p ro ce s s rank

i f (my rank==0)

s t a r t t = time (NULL) ; //Timer s e t

// ////////////////////////////////////

void MPI end ( )

extern int my rank ;

extern t ime t s t a r t t , end t ;

extern double t o t a l t ;

MPI Barrier (MPI COMM WORLD) ; // Wait f o r a l l

p r o c e s s e s t o a r r i v e

MPI Final i ze ( ) ; // Shut down MPI

f p r i n t f ( s tder r , ”\n Exit ing from proc es s or %d” ,

my rank ) ;

e x i t (0) ;

All functions concentrated header file

’functions.h’

#ifndef FUNCTIONS H

#define FUNCTIONS H

#include <s t d i o . h>

#include <math . h>

#include <memory . h>

#include <mpi . h>

#include <time . h>

#include ” i n i t d a t a . h”

#include ”g . h”

typedef double mat mt [ 3 ] [ 3 ] ;

typedef double mat i j k l [ 3 ] [ 3 ] [ 3 ] [ 3 ] ;

typedef double mat c [ 7 ] [ 7 ] ;

void i n i t p bc (void ) ;

void pbc backup (void ) ;

void pbc recover (void ) ;

void bp backup (void ) ;

void bp recovery (void ) ;

// ////////////////////////////////////

double determ (double x00 , double x01 , double x10 ,

double x11 ) ;

void i n i t l a t t i c e (void ) ;

void l a t t i c e (void ) ;

void i n i t e e e ( ) ;

void e ee backup ( ) ;

void get i n form (void ) ;

void save in form (void ) ;

// Fri Oct 12 2 3 : 25 :5 8 2001

void v e l o c i t y i n i t (void ) ;

void s a v e t o f i l e ( int mode) ;

void save EPTVOh(void ) ;

double my abs (double x ) ;

void compute f ( ) ;

void c ry se tup ( ) ;

void save h ( ) ;

void save h0 ( ) ;

void s ave s ( ) ;

void read h ( ) ;

void read h0 ( ) ;

void r ead s0 ( ) ;

void s c a l e v e l ( ) ;

void r e a d f r om f i l e ( ) ;

void b u i l d n e i l i s t ( ) ;

void p red i c t o r ( ) ;

void c o r r e c t o r ( ) ;

void evalPT ( ) ;

void l e ap f ro g ( ) ;

void sca l ed f rame ( ) ;

void r ea l f r ame ( ) ;

Page 185: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 166

void r e a l f r ame v ( ) ;

void i n i t v a r ( ) ;

void pred i c torP ( ) ;

void cor r ec torP ( ) ;

void pred i c torS ( ) ;

void c o r r ec to r S ( ) ;

void rahman ( ) ;

void p a r i n e l l o ( ) ;

void i n i t ( ) ;

void accumulate h ( ) ;

void c omp c i j s t r a i n ( ) ;

void c omp c i j s t r e s s ( ) ;

void r e s t a r t c a l c u l a t e C i j s t r e s s ( ) ;

/∗matr ix f u n c t i o n s ∗/

void pr int mat ( ) ;

void mat mul ( ) ;

void mat sca mul ( ) ;

void mat add ( ) ;

void t ran spose ( ) ;

double det ( ) ;

void i nv e r t ( ) ;

void mat vec mul ( ) ;

void inv ( ) ;

void Aviz (char ∗ fn ) ;

void i n i t h (mat mt a ) ;

// Dens i t y

double dens i ty (double p r d i s ) ;

double dens i ty dot (double p r d i s ) ;

double dens i ty do t do t (double p r d i s ) ;

// Phi p o t e n t i a l

double ph i pot (double p r d i s ) ;

double ph i pot dot (double p r d i s ) ;

double ph i po t do t dot (double p r d i s ) ;

// F p o t e n t i a l

double F pot (double) ;

double F pot dot (double) ;

double F pot dot dot (double x ) ;

//MPI f un c t i o n

void MPI update r v f n ( int ) ;

void MPI data s t ruct c r eat i on ( ) ;

void MPI exchange veloc i ty ( ) ;

void MPI start ( int argc , char∗ argv [ ] ) ; //

I n i t i a l i z e MPI and s t a r t s t a k i n g t ime .

void MPI end ( ) ; // Stop MPI, e x i t s t h e

program and c a l c u l a t e t o t a l running t ime .

#endif

General initial data setup

’initdata.h’

#ifndef INITDATA H

#define INITDATA H

#define s i z e 36 // doub l e number o f atoms

in a row

#define Atoms 11664 // Atoms = ( s i z e ˆ3) /4

// Number o f atoms : f o r example s i z e 20 −>

2000

#define N ne i gh st ep 100

#define step backup 10000

#define step EPTVO meas 100

#define s t ep rv meas 2000000

#define s t ep c i j mea s 100

#define s t ep Ci jk l backup 20000

#define pres s 0 . 0 // s e t p o i n t p r e s s u r e

#define dt 0.001 // [ d t ]=10.18 f s

//#de f i n e TstepJump 5000 // Number o f s t e p s

between r i s i n g o f t empera tu r e

#define TJump 1 // Add i t i on t o t empera tu r e

eve ry TstepJump

//#de f i n e TstepJump 10000 // Number o f s t e p s

between r i s i n g o f t empera tu r e

//#de f i n e TstepJumpMin 1000 // Minimum

number o f s t e p s between r i s i n g o f

t empera tu r e

#define TTotalJumps 1 // Number o f

t empera tu r e jumps (400000 s t e p s )

//#de f i n e TstepJumpMin 9999 // Minimum

number o f s t e p s between r i s i n g o f

t empera tu r e

// S p e c i f i c e lement d e f i n i t i o n s

#define cu t o f f 7 . 5 // in Angstrom

#define mass 24.3050 // mass o f Mg in

atomic mass u n i t s

// Constants

#define pi

3.1415926535897932384626433832795

#define kb 0.0000862 // eV/K

#define ndim 3

#endif

Makefile of all the ’c’ ’h’ files

’Makefile’

INCS=in i t d a t a . h f unc t i on s . h g . h

CC=mpicc −O5

LIBS=−lm − l c −L$(PWD)/ l i b −L$(PWD)/ − l t r e e

Page 186: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 167

OBJS= md. o l a t t i c e . o par rahm . o C i j k l . o

hcp setup . o compute f . o e va l p to . o

i n i t i a l i z a t i o n . o p r e d i c t o r c o r r e c t o r . o

r ead save . o n e i g hb o r l i s t . o v i s u a l i z a t i o n . o

s c a l e un s c a l e . o mpifunc . o

EFILE=./Magnesium . pr . mpi

$ (EFILE) : $ (OBJS) $ (INCS)

@echo ” l i n k i n g . . . ”

@$(CC) $ (OBJS) −o $ (EFILE) $ (LIBS)

@echo ”Done ! ”

par rahm . o : par rahm . c $ (INCS)

$ (CC) −c par rahm . c

hcp setup . o : hcp setup . c $ (INCS)

$ (CC) −c hcp setup . c

n e i g h b o r l i s t . o : n e i g h b o r l i s t . c $ (INCS)

$ (CC) −c n e i g h bo r l i s t . c

compute f . o : compute f . c $ (INCS)

$ (CC) −c compute f . c

e va l p to . o : ev a l p to . c $ (INCS)

$ (CC) −c eva l p to . c

i n i t i a l i z a t i o n . o : i n i t i a l i z a t i o n . c $ (INCS)

$ (CC) −c i n i t i a l i z a t i o n . c

p r e d i c t o r c o r r e c t o r . o : p r e d i c t o r c o r r e c t o r . c

$ (INCS)

$ (CC) −c p r e d i c t o r c o r r e c t o r . c

r ead save . o : r ead save . c $ (INCS)

$ (CC) −c r ead save . c

v i s u a l i z a t i o n . o : v i s u a l i z a t i o n . c $ (INCS)

$ (CC) −c v i s u a l i z a t i o n . c

C i j k l . o : C i j k l . c $ (INCS)

$ (CC) −c C i j k l . c

s c a l e un s c a l e . o : s c a l e un s c a l e . c $ (INCS)

$ (CC) −c s c a l e un s c a l e . c

l a t t i c e . o : l a t t i c e . c $ (INCS)

$ (CC) −c l a t t i c e . c

md. o : md. c $ (INCS)

$ (CC) −c md. c

mpifunc . o : mpifunc . c $ (INCS)

$ (CC) −c mpifunc . c

c l ean :

rm −f ∗ . o ∗ .∗˜ Makef i l e ˜ $ (EFILE)

c l e an f :

rm −f ∗ . txt ∗ . xyz ∗ . back ∗ . l og

c l e a n a l l :

rm −f ∗ . o ∗ .∗˜ Makef i l e ˜ $ (EFILE) ∗ . txt ∗ . xyz

∗ . back ∗ . l og

backup :

cp ∗ . h ∗ . c Makef i l e ∗ . / Backup

File input example

’aaa info.pr’

0

3.250000

5.300000

800

350000

100000

0

0

175

50

0 . 5

0.073

0

1

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗

MODE [ 0 ] or [ 1 ] or [ 2 ]

l a t t i c e parameter a0

l a t t i c e parameter c0

temp

N1 steps

N2 steps

step0

percentage

Number o f av i z frames in MODE[0&1]

Number o f av i z frames in MODE[ 2 ]

Heat bath mass Q r e l a t i v e to 300K

Pressure bath mass W r e l a t i v e to 300K

Page 187: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

APPENDIX D. COMPUTER PROGRAMS 168

E l a s t i c con stan t s c a l cu l a t ed in NVE [ 0 ] or NVT

[ 1 ]

REFRESHMENTS 1 [ Yes ] or 0 [No ]

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗

Page 188: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

References

[1] F. Lindemann, Z.Phys, 11, 609, (1910)

[2] M. Born, Journ. Of Chem. Phys., 7, 591, (1939)

[3] A. R. Ubbeldone, Melting and Crystal Structure, Clarendon press, Oxford,

(1965)

[4] T.A. Weber and F.H. Stillinger, Journ. of Chem. Phys., 81, 5095, (1984)

[5] Horst E. Friedrich and Barry L. Mordike, Magnesium Technology, Springer

Berlin Heidelberg, (2006)

[6] D. Y. Sun, M. I. Mendelev, C. A. Becker, K. Kudin, Tomorr Haxhimali, M.

Asta, J. J. Hoyt, A. Karma and D. J. Srolovitz, Phys. Rev. B, 73, 024116,

(2006)

[7] K. Lu and Y. Li, Phys. Rev. Lett., 80, 4474, (1998)

[8] J. Daeges, H. Geiter and J. H. Peperezko, Phys. Lett. A, 119, 79, (1986)

[9] A. Trayanov and E. Tosatti, Phys. Rev. B, 38, 6961, (1988)

[10] E. Polturak, private communication

169

Page 189: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 170

[11] A. Kanigel, The Role of Defects in the Melting Transition, Research Thesis,

Technion, (1999)

[12] S. Sorkin, Point Defects, Lattice Structure and Melting, Research Thesis,

Technion, (2003)

[13] K. C. Prince, U. Breuer and H. P. Bonzel, Phys. Rev. Lett., 60, 12, (1988)

[14] A. R Ubbeldone, Melting and Crystal Structure, Clarendon press, Oxford,

(1965)

[15] G. Grimvall and S. Sjodin, Physica Scripta, 10, 340, (1974)

[16] L. H. Cohen, W. Klement and G.C. Kennedy, Phys. Rev., 145, 519, (1966)

[17] Z. H. Jin, P. Gumbsch, K. Lu and E. Ma, Phys. Rev. Lett., 87, 055703,

(2001)

[18] L. Hunter, S. Siegel, Phys. Rev., 61, 84, (1942)

[19] Y. P. Varshni, Phys. Rev. B, 2, 3953, (1970)

[20] R. M. Nicklow and A. A. Young, Phys. Rev., 129, 1936, (1963)

[21] A. W. Lawson, Phys. Rev., 48, 85, (1950)

[22] J. Wang, S. Yip, S. R. Phillpot and D. Wolf, Phys. Rev. Lett., 71 4182,

(1993)

[23] J. Wang, J. Li and S. Yip, Phys. Rev. B, 52, 12627, (1995)

[24] J. L. Tallon, Phyl. Mag. A, 39, 151, (1979)

Page 190: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 171

[25] G. Tammann, Z. Phys. Chem., 68, 205, (1910)

[26] J. Frenkel and J. F. Van der Veen, Phys. Rev. B, 34, 7506, (1986)

[27] J. Frenkel and J. F. Van der Veen, Phys. Rev. Lett, 54, 134, (1986)

[28] H. Hakkinen and U. Landman, Phys. Rev. Lett., 71, 1023, (1993)

[29] H. Hakkinen and M.Manninen, Phys. Rev. B, 46, 1725, (1992)

[30] V. Sorkin, E. Polturak and Joan Adler, Phys. Rev. B., 68, 174103, (2003)

[31] E. T. Chen, R. N. Barnett, and U. Landman, Phys. Rev. B, 41, 439, (1990)

[32] J. F. van der Veen, Phase Transitions in Surface Films 2, ed. H. Traub,

Plenum Press, New York, (1991)

[33] W. Lipowsky, Phys. Rev. Lett, 49, 1575, (1982)

[34] W. Lipowsky and W. Speth, Phys. Rev. B, 28, 3983, (1983)

[35] W. Lipowsky, U. Breuer, K. C. Prince, and H. P. Bonzel, Phys. Rev. Lett.,

62, 913, (1989)

[36] A. Traynov and E.Tossati, Phys. Rev. B, 38, 6961, (1989)

[37] R. Ohnesorge, H. Lwen and H. Wagner, Phys. Rev. E, 50, 4801, (1994)

[38] S. Iarlori, P. Carnevali, F. Ercolessi and E. Tosatti, Surf. Sci., 211/212,

55, (1989)

[39] O. Tomagnini, F. Ercolessi, S. Iarlori, F. D. Di Tolla and E. Tosatti, Phys.

Rev. Lett., 76, 1118, (1996)

Page 191: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 172

[40] A. Hashibon, Atomistic study of structural correlations at a model solid/liq-

uid metal interface, Research Thesis, Technion, (2002)

[41] A. Hashibon, J, Adler, M. Finnis and W. D. Kaplan, Computational Ma-

terials Science, 24, 443, (2002)

[42] O. M. Magnussen, Phys. Rev. Lett., 74, 4444, (1995)

[43] I. Rice, J. Brawn, S. Pott, Chem. Phys., 87, 3069, (1987)

[44] A. Trayanov and E. Tosatti, Phys. Rev. Lett., 59, 2207, (1987)

[45] A. S. Levi and E.Tosatti, Surf. Sci., 189/196, 641, (1990)

[46] J. Krim, J. P. Coulomb and J. Bouzidi, Phys. Rev. Lett., 58, 583, (1987)

[47] R. Ohnesorge, H. Lowen, and H. Wagner, Phys. Rev. E, 50, 4801, (1994)

[48] J. P. Hansen and I. R. McDonald, Theory of Simple Liquids, 2nd ed.,

Academic, London, (1986)

[49] Amit Kumer, http://www.personal.psu.edu/auk183/MolDynamics

/Molecular%20Dynamics%20Simulations.html

[50] D. C. Rapaport, The Art of Molecular Dynamics Simulation Second Edi-

tion, Cambridge Univeristy Press, (2004)

[51] H. Haile, MD simulation elementary methods, Willey, (1989)

[52] Gear, Numerical initial value problems in ordinary differential equations,

Prentice Hall, EngleWood, (1973)

[53] J. Ray and A. Rahman, J. Chem. Phys., 80 , 4423, (1984)

Page 192: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 173

[54] J. Ray and A. Rahman, J. Chem. Phys., 82 , 4243, (1985)

[55] RBNI’s nanocluster computer NANCO,

http://phycomp.technion.ac.il/˜nanco/

[56] Elastic Constants Calculation Of Solid Argon:

Serial & Parallel Realization, Pavel Bavli,

http://phycomp.technion.ac.il/˜pavelba/Comp Phys/Project/Project.html

[57] The Message Passing Interface (MPI) standard,

http://www-unix.mcs.anl.gov/mpi/

[58] Z. G. Xia, D. Y. Sun, M. Asta and J. J. Hoyt, Phys. Rev. B, 75, 012103,

(2007)

[59] Y. Liu, J. B. Adams, F. Ercolessi, and J. A. Moriarty, Modell. Simul.

Mater. Sci. Eng. 4, 293, (1996)

[60] S. Nose, Molec. Phys., 81, 511, (1984)

[61] W. G. Hoover, Phys. Rev. A, 31, 1695, (1985)

[62] D. Frenkel and B. Smit, Understanding Molecular Simulations: From Al-

gorithms to Applications, Academic Press, (1996)

[63] W. G. Hoover, Time Reversibility, Computer Simulation and Chaos, World

Scientific, (1999)

[64] G. Sutmann, Classical Molecular Dynamics,

http://www.fz-juelich.de/nic-series/volume10

[65] G. Sundman, Celestial Mech., 11, 469, (1985)

Page 193: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 174

[66] B. Ziff, Computers in Physics, 12, 385, (1998)

[67] J. Adler, A. Hashibon, N. Schreiber, A. Sorkin, S. Sorkin and G. Wagner,

Comp. Phys. Comm., 12, No.5, 623, (2002)

http://phycomp.technion.ac.il/˜aviz/index.html

[68] Neil W. Ashcroft and N. David Mermin, Solid State Physics, Saunders

College, (1976)

[69] M. Born, Proc. Camb. Phil. Soc. 38, 82 (1942); ibid. 40, 262 (1944)

[70] M. Parinello and A. Rahman, Phys. Rev. Lett., 45, 1196, (1980)

[71] V. V. Kulagina, S. V. Eremeev and A. I. Potekaev, Russian Physics Journal,

48, 2, (2005)

[72] A. Hashibon, J. Adler, Gideon Baum and S. G. Lipson, Phys. Rev. B., 58,

7, (1998)

[73] G. Baum, Equilibrium Shapes for HCP crystals Research Thesis, Technion,

(1994)

[74] R. V. Ramanujan, Mat. Sci. and Engi. B, 32, 125, (1995)

[75] Wikipedia, Euler angles, http://en.wikipedia.org/wiki/Euler angles

[76] L. Fast, J. M. Wills, B. Johansson and O. Eriksson, Phys. Rev. B, 51, 24,

(1995)

[77] J. R. Ray, M. C. Moody and A. Rahman, Phys. Rev. B., 32, 2, (1985)

[78] http://www.math-linux.com/spip.php?article54

Page 194: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

REFERENCES 175

[79] H. Lowen, Phys. Rep. 237, 249 (1994)

[80] E. T. Chen, R. N. Barnett, and U. Landman, Phys. Rev. B., 40, 924,

(1989)

[81] P. Stolz, J. K. Norskov, and U. Landman, Phys. Rev. Lett., 61, 440, (1988)

[82] J. Yang, W. Hu, S. Xiao and G. Yi, Phys. Stat. Sol, 244, 1913, (2007)

[83] J. A. Moriarty and J. D. Althoff, Phys. Rev. B. Con. Mat. ,51, 9, (1995)

[84] http://www.magnesium.com/w3/data-bank/index.php?mgw=153

[85] L. J. Slutsky and C. W. Garland, Phys. Rev., 107, 972, (1957)

Page 195: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

HCP ibixqa dkzd

ilaa lat

Page 196: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

HCP ibixqa dkzdxwgn lr xeaig

x`ez zlawl zeyix d ly iwlg ielin myldwifita mir nl xhqibnilaa lat

l`xyil ibelepkh oekn — oeipkhd hpql ybed2009 lixt` dtig h"qyz oqip

Page 197: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

wxehlet lin` 'texte xl ` dpgei 'x zkx da dyrp xwgn lr xeaigdwifitl dhlewta

d ez zxkd

dai pd zitqkd dkinzd lr r nl zine`l oxwle oeipkhl d en ip`izenlzyda

Page 198: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

xivwzdpenzd lr zillk dnkqd zniiw `l .meid r ixnbl oaen epi`y i eqi jildz `ed dkzdmze`y mixbz`e zel`y milrnd migezt oii r miax mihaid ,jildzd xear zilwifitd.xeztl yiowlg .dkzdd jildz z` zexiaqnd zeixe`iz xtqn erved ,20-d d`nd jldnarivd 1[ Lindemann .d ig` dxeva yiabd lka ygxznd ig` jildzk dkzdl eqgiizdwvend ly zipkn zeaivi i` l`k dkzdd z` dxiaqdy dpey`xd d ig`d dixe`izd z`ze epzd xy`k jzen wvend Lindemann it lr .mineh`d ly zexaben ze epzn raepd[2] Born .ineh` oiad wgxndn mieqn iqgi wlgl xarn zeler zeineh`d zeinxzdzeaivil xyewn xy` (lfep xefbl ozip `l) dxifbd zegek ly zenlrdk dkzdd z` xi bdmipepet ze epza `hazn `ed ygxzn l"pd xy`ky orh Born ,yiabd bixq ly zipkndinxz xevii lr miqqeand miakxen xzei mil en mpyi .qexwl bixyl zenxebd zene n g` meh` ly mewna mineh` ipy ,meh`a xqeg enk ,bixyd jeza minbt ly iphpetqx qd ly dqixwl liaen dxehxtnhd z`lrdl liawna l"pd ly xabend xeviid ,'ekeipt enk ,miipevig mihwt` oeayga migwel `l elld mil end . [3, 4] bixqa geeh jex`dzxievnd dpenza ,sqepa .dkzdd yigxza aeyg aikxn zeidl milekid ,yiabd ly ghymil end .dtivx dkzd e` dkzdd ly zg` df`t wx oeayga gwlp ,elld mil end i i lrlr xzi zkxren `id llk jx a la` ,Tm ,dkzdd zxehxtnh ly aeyig xyt`n elld.d indb

Page 199: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

xivwzjildza ghyd ipt ly m iwtz lr eply dpadd z` aigxdl iziqip ily xwgnaipevig ugl i`pz zgzy meifpbn `ed xgapd hpnl`d .HCP iptn ilra zekzn ly dkzddmin ew mixwgn .aygn zeivleniq zervn`a nlp `yepd . [5] HCP dpan el yi qt`jildza ghyd ipt iwtz z` d`xd [12] oiwxeq .qe [11] lbipw .r i i lr eyrpy.dn`zda mei pee zyegp mihpnl`d xear ,BCC-e FCC dpan ilra miyiab xear dkzddmbe mx`zl zelwa ozip xy` (Bravais) deexa bixy dpan ilra md elld mihpnl`d ipydeexa bixq eppi` `edy oeeikn dpey meipfbn .di`x zieef lka heyt ixefgn xe iq xyt`n.zilwifitd zkxrnd xe`iza jeaiq xveidzeivleniq xear yeniyl xgap [6] eixage D. Y. Sun i"r rvedy ineh` oia l`ivphet-ifit zepekz xear zkxrnd ly zinxz zebdpzd ly aeyig lr w ap l`ivphetd .aygndmb eayeg xzid oia .ghy ipt `ll iteqpi` mlyen meifpbn ly ze`nbe a zepey zeilw-xtnhd z`lrd mr xi mdly jxrd xnelk ,dtevnd itk eid ze`vezd ,shear modulize`vezd ,swz Born oeixhixw m`d w ap .wvend gtp ly jekix x`zn df xa ,dxeheply miaeyigd ly zeixnep ze`ibye zinipt zeaivi i`n d`vezk j` ixyt` dfy efnx.e`elna xa d z` we al ozip did `l1102± 3K lr rawp epyl zeivleniqd it lr ,Tb mlyen yiab ly dkzdd zxehxtnhipt `ll mlyend yiabd ly d`vez df .Tm = 923K iieqipdn xzei deab `ed xy`k`ed Tm-l Tb oia qgid .qxewe zipkn aivi `l `ed ea ihixw gtp r agxznd ghymlyen yiab ly lr meniga dkzdd zxehxtnh ly [7] iefgd qgil mi`znd 1.2Tmipt ,d arnay ,llba d arn dxiyi d i nl ozip `l wven ly lr menig .zekzn xearDaeges z`f lka .Tm-a yiabd zkzdl mxebd dxnbl milrdl ozip `l mixg` minbte ghyiwiwlg ietiv i i lr l"pd d aerd lr xabzdl dhiy rivdy oey`xd uelgd did [8] eixagesqkd iwiwlg z` mngl gilvd `ed ,adf mr (oexwin 160 r 120-k ly xhew ilra) sqkyeniy zxfra ghyd ipt z` milrdl mileki epgp` aygn zeivleniqa .Tm lrn 25Kzertyd `ll mlyen yiab lr enll ozip df zxfra ,mipeeikd lka miixefgn dty i`pza

Page 200: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

d xivwz.ghy ipt ly-epd zf`tl divaihw`d ziibxp`y oeeikn ghyd ipt lr dligzn miyiab ly dkzdz` dnilrn ghyd ipt lr lfepd zaky .yiabd mipt bpk ghyd ipt lr xzei dkenp lfhwt` lr i`xg`d aivi `l wven zf`tl jxevd z` zrxebe lfepd zf`t zeedzdl meqgndoraha zeibelepnept md ghyd ipt zkzd `yepa miihxe`izd mil end ax .lrd menig-xe`iz drved dpexg`l wx .drtezd ly ineh`d dpand lr r ind z` zegipfn md oklxe`izd .mixi p fb iyiab ly zeihhq zepekz xiaqdl zlbeqnd [9] zitewqexwin diitk aygn zeivleniqn xwira dzlbzd ghyd ipt lr dkzdd zrtez ly itewqexwind.o`k x`ezydty i`pz ly dlrtd i i lr zepey zexehxtnha ghyd ipt ly dkzd epxwg epgp`.iyteg x`yp lnxepd oeeike ghyd ipt lnxepl miavipd mipeeikd ipy lr wx miixefgnghyd ipt zeivleniq .s-e a ,c d`t mi`xwp md ,exwgp meifpbn ly ghy ipt yely,a-e c ,zexg`d ze`td izy xy`k .Tm = 940 ± 5K-a dpey`x zkzip s d`ty e`xdzeipan zepekz enk ,ervea zepey ze i n divleniqd jldna .T = 970K-a gi ekzipd`t dxehxtnhd z`lrd jldna .ze`td zyely lk xear zepey zexehxtnha ,zeibxp`eipt lr mineh`d ze epza diilr epi`x ,mihlea miiepiy zlrae zpiiprn ikd dziid soia exbd l"pd minbtd .miiz ewp minbt xevile ipyl g` rixtdl dligzdy r dtydikd dakyd lrn dy g daky exvi mb md .ghyd iptl miaexwd mineh`d zeakylkk .xzei zeinipt zeaky l` dpeilrd dakydn l b x q i`d .adlayer z`xwpd dpeilrm wd zrtez ly dlgzd z`f ,lfep ien zaky ghyd ipt lr xvep dler dxehxtnhdy,a d`t ,dkenp ikd mineh`d zetitv day d`ta e`n zwdaen z`f drtez ,dkzd r hrnk dyai zx`yp c d`t .ddeab ikd `id mineh`d zetitv da c d`t znerlilra zekzn xear min ew mixwgna etvp zedf ze`vez .970K-a dly dkzdd zxenzz` d ai` xy` s d`ta ygxzd elawzdy miriztnd mixa d g` .BCC-e FCC dpanbixy zpekz s d`tay d aerl xyew xa d .zexg`d ze`td izy iptl 30K-k x qd aex

Page 201: MELTING IN HCP LATTICES - Technionphycomp.technion.ac.il/~pavelba/Thesis/RelatedFiles/... · 2009-08-05 · D Computer programs 133 References 168 Hebrew Abstract b. List of Figures

e xivwz.zyb en ikd deexa `ld.yiabd ghy ipt zkzd ly drtezd z` xiaqdl zpn lr Born ly l ena epynzydgtpd okle mdly zehytzdl mxeb ghyd ipt lr miiz ewp minbt ly deabd fekixdribne aivi eppi` bixqd df jxrl xarn xy`k ,ihixw jxrl ribn ef dakya meh`l rvenndzkzdl dfd l end ly meyi [10] E. Polturak it lr .zipkn dkzd z`xew ea jildzlziibxp` oiae zinpi enxzd dkzdd zxehxtnh oia ix`ipil qgil jilen yiabd ghy iptFCC bixq dpan ilra zekznl dxye` xak ef d`eap .miighyn minbt ly zexveeidqelki` z` ep n eply dxwna .xzeia dkenpd zighynd zetitv ilra ze`tl BCC-ezexveeid zibxp` z` epayig z`f jnq lre dxehxtnha zelzk (adlayer) ztqepd dakydit lr l"pd dibxp`d zkxrdl miipeiqip mipezpa epynzyd sqepa .miighyn minbt lydkenpd zighynd mineh`d zetitv zlra a d`t xear w ap `yepd .ihxe`izd l endze`vezd jnq lr .aeyigd zexev izy oia e`n daeh dn`zd `vnp dxear ,xzeia(mlyen yiab) zipkn dkzd x`zl leki Born ly l eny dpwqnl eprbd zeivleniqdxywl dleki xy` "dxqgd dilegd" zeidl leki df l en ,(ghyd ipt) zinpi enxz dkzde.dkzdd ihixqz ipy oia