contentsrin.io/wp-content/uploads/2014/06/cds411.pdf · 1.1 projectile motion with air resistance...

31
CONTENTS SemesterReport Contents 1 Semester Assignments 3 1.1 Projectile Motion with Air Resistance ................................... 3 1.1.1 Explanation .............................................. 3 1.1.2 Results ................................................ 3 1.2 Particle in a Rectangular Potential Well .................................. 5 1.2.1 Explaination ............................................. 5 1.2.2 Results ................................................ 5 2 APW Assignments 6 2.1 Cubic Lattice Constants ........................................... 6 2.2 Lattice Volumes ................................................ 6 2.2.1 Explanation .............................................. 6 2.2.2 Results ................................................ 6 2.2.3 FCC .................................................. 7 2.2.4 BCC .................................................. 7 2.2.5 SC ................................................... 7 2.3 Iridium .................................................... 8 2.4 Superconductivity Transition Tempurature ................................ 9 2.4.1 Explanation .............................................. 9 2.4.2 Results ................................................ 9 2.5 Platinum ................................................... 11 2.6 Numerical Integration, Iridium ....................................... 12 2.6.1 Explanation .............................................. 12 2.6.2 Results ................................................ 13 2.7 Gold ...................................................... 13 2.8 Rigid Band Model .............................................. 14 2.8.1 Explanation .............................................. 14 2.8.2 Results ................................................ 14 2.9 Specific Heat Gamma ............................................ 15 2.9.1 Explanation .............................................. 15 2.9.2 Results ................................................ 15 2.9.3 Results ................................................ 15 2.10 Angular Momentum of Density of States .................................. 15 2.11 Stoner Criterion ............................................... 15 2.11.1 Explanation .............................................. 15 2.11.2 Results ................................................ 16 2.12 {p,z}-Density of States and Energy in the FCC Lattice Structure .................... 16 2.12.1 Explanation .............................................. 16 2.12.2 Results ................................................ 16 2.13 Alloy Predictions: Virtual Crystal and Diatomic ............................. 18 2.13.1 Virtual Crysal Approximation .................................... 18 2.13.2 Diatomic Model ........................................... 18 2.13.3 NaCl vs. CsCl ............................................ 18 2.13.4 Results ................................................ 19 2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures ................. 22 2.14.1 Results ................................................ 22 2.14.2 Explanation .............................................. 23 2.14.3 Insulator ............................................... 23 3 Source Code 25 3.1 General Scripts ................................................ 25 3.1.1 Plot 2D Graph, Given Two 1D Arrays (Python) ......................... 25 3.1.2 Plot 2D Arrays from Text in Two Columns (Python) ....................... 25 3.2 Assignment Specific Scripts ......................................... 26 3.2.1 Projectile Motion with Air Resistance (Python) .......................... 26 1

Upload: vannguyet

Post on 13-May-2018

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

CONTENTS SemesterReport

Contents

1 Semester Assignments 31.1 Projectile Motion with Air Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.1.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Particle in a Rectangular Potential Well . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2.1 Explaination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 APW Assignments 62.1 Cubic Lattice Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2 Lattice Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.3 FCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.4 BCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.5 SC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3 Iridium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Superconductivity Transition Tempurature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.5 Platinum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.6 Numerical Integration, Iridium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.6.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.6.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.7 Gold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.8 Rigid Band Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.8.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.8.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.9 Specific Heat Gamma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.9.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.9.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.9.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.10 Angular Momentum of Density of States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.11 Stoner Criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.11.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.11.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.12 {p,z}-Density of States and Energy in the FCC Lattice Structure . . . . . . . . . . . . . . . . . . . . 162.12.1 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.12.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.13 Alloy Predictions: Virtual Crystal and Diatomic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.13.1 Virtual Crysal Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.13.2 Diatomic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.13.3 NaCl vs. CsCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.13.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures . . . . . . . . . . . . . . . . . 222.14.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.14.2 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.14.3 Insulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Source Code 253.1 General Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.1.1 Plot 2D Graph, Given Two 1D Arrays (Python) . . . . . . . . . . . . . . . . . . . . . . . . . 253.1.2 Plot 2D Arrays from Text in Two Columns (Python) . . . . . . . . . . . . . . . . . . . . . . . 25

3.2 Assignment Specific Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.2.1 Projectile Motion with Air Resistance (Python) . . . . . . . . . . . . . . . . . . . . . . . . . . 26

1

Page 2: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

CONTENTS SemesterReport

3.2.2 Energy of Particle in a Rectangular Potential Well (Python) . . . . . . . . . . . . . . . . . . 273.2.3 Script to Autonomize Bash Interaction With monoatom.com, and diatom.com (Python) . . . 273.2.4 Superconductivity Transition Temperature (Python) . . . . . . . . . . . . . . . . . . . . . . . 29

3.3 Superconductivity Transition Tempurature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.3.1 2D (Python) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.3.2 4D - Contour Plot (Matlab) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.4 Numerical Integration (Matlab) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.5 Column-stripping Tailored to Calculating z-DOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4 References 31

2

Page 3: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

1 Semester Assignments SemesterReport

1 Semester Assignments

1.1 Projectile Motion with Air Resistance

Abstract

Determine the trajectory of a baseball accounting for air resistance, compare to idealized trajectory.

1.1.1 Explanation

When air drag is omitted, the only force acting on a projectile with mass m is its weight,~w = m~g. In this case,the components of acceleration are: ax = 0, ay = −g. Its not difficult to include the force of air resistance in theequations for a projectile, but solving them for the position and velocity as functions of time, or the shape of thepath, can get quite complex. Fortunately, it is fairly easy to make quite precise numerical approximations to thesesolutions, using a computer.To include air drag, we must include the force that air is exerting on the body, this is f = kmv2. The constantof proportionality k, depends on the density of air p, the silhouette area A of the body (its area as seen from thefront), the mass m of the body, and a dimensionless constant C called the drag coefficient that depends on theshape of the body. In terms of these quantities, k is given by k = pCA

2m .

The x- and y-components of acceleration become ax = −kvvx , ay = −g − kvvy.Where v = (v2

x + v2y)1/2.

During a time interval ∆t, the average x-component of acceleration is ∆vx = ax∆t.the x-velocity vx changes by an amount ∆vx = ax∆t.Similarly, vy changes by an amount ∆vy = ay∆t.So the values of the x-velocity and y-velocity at the end of the interval are

vx + ∆vx = vx + ax∆t vy + ∆vy = vy + ay∆t

While this is happening, the projectile is moving, so the coordinates are also changing. The average x-velocityduring the time interval ∆t is the average of the value vx (at the beginning of the interval) and vx + ∆vx (at theend of the interval), or vx + ∆vx/2. During ∆t the coordinate x changes by an amount

∆x = (vx + ∆vx/2)∆t = vx∆t+ x

and similarly for y.So the coordinates of the projectile at the end of the interval are

x+ ∆x = x+ vx∆t y + ∆y = y + vy∆tThe general algorithm that I used to approach this problem* is as follows:Step 1: Identify the parameters of the problem, m, A, C, and p, and evaluate k.Step 2: Choose the time interval ∆t and the initial values of x, y, vx, vy and t.Step 3: Choose the maximum number of intervals N or the maximum time tmax = N∆t for which you wantto get the numerical solution.Step 4: Loop (or iterate) Steps 5 through 9 while n < N or t < tmaxStep 5: Calculate the acceleration components.Step 6: Print x, y, vx, vy, ax, and ay.Step 7: Calculate the new velocity componentsStep 8: Calculate the new coordinates.Step 9: Increment the time by ∆t⇒ t = t+ ∆tStep 10: Stop.Step 11: Plot x, y values.

1.1.2 Results

The radius of the baseball is given as r = 0.0366m, and A = πr2. The mass is m = 0.145kg, the drag coefficient isC = 0.5, and the density of air is p = 1.2 kg

m3 . In this example the baseball was given an initial velocity of 50m/s atan angle of 35 above the +x-axis. You can see that both the range of the baseball and the maximum height reachedare substantially less than the zero-drag calculation would lead you to believe. Calculating a baseballs trajectory

3

Page 4: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

1.1 Projectile Motion with Air Resistance SemesterReport

and ignoring air drag is quite unrealistic. Air drag is an important part of the game of baseball!

The source code used to implement this algorithm is in Source Code [3.2.1].

4

Page 5: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

1.2 Particle in a Rectangular Potential Well SemesterReport

1.2 Particle in a Rectangular Potential Well

Abstract

Find the roots of a given equation, by solving for e.

tan

(L

√2m× e

h2

)= 2 × e(v − e)

2e− v

1.2.1 Explanation

Note that e is the unknown, and the given constants arev = 10 eVL = 3 angstromsm = mass of electronh= planck’s constant/2π

Solving for e will result in finding the possible energy levels of a particle in a rectangular potential well. In orderto get sensible results, one must manipulate the equation to eliminate division by zero.

I did this by solving the following equation for e, and plotting the attempted values with respect to the resultand searching for intersections with the x-axis. In other words, we are searching for values of e that satisfy thefollowing equation

(2e− v)sin

(L

√2m× e

h2

)− cos

(√2m× e

h2

))(2(e(v − e))1/2) = 0

I achieved this result by subtracting the RHS of the equation from the LHS, and multiplying both sides by

cos

(L√

2m× eh2

)to eliminate division by zero.

1.2.2 Results

The two roots found* were 2.0 ≤ e ≤ 2.1, and 7.4 ≤ e ≤ 7.5.The graph below demonstrates the relationship between the electric potential and the energy level. The resultchanges sign (crosses the x-axis) between: [2.0, 2.1] and [7.4, 7.5].

The source code used to implement this algorithm is in Source Code [3.2.2].

5

Page 6: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2 APW Assignments SemesterReport

2 APW Assignments

2.1 Cubic Lattice Constants

Two of the primary metallic crystal lattice structures are face-centered cubic (FCC) and body-centered cubic (BCC).The face-centered cubic structure has atoms located at each of the corners and the centers of all the cubic faces[figure 1]. The body-centered cubic unit cell has atoms at each of the eight corners of a cube (like the cubic unitcell) and one atom in the center of the cube [figure 2]. The simple-cubic (SC) unit cell has one atom at each corner[figure 3].

In this case, the lattice constant refers to the constant distance between atoms in a crystal lattice. The re-lated geometry of these structures reveals approximate relation between the FCC, BCC and SC lattice constants.a3fcc

4 =a3bcc

2 = a3sc, where aα = lattice constant in α configuration, and α ∈ [FCC,BCC, SC].

To find the lattice constant of Ir, Pt, and Au, one must input a starting guess value. I referred to the tableprovided to find my initial guess for the lattice constant of the element, then converted the given constant in tounits of the Bohr radius. In the following calculations, 6 lattice constants were processed - starting from the initialguess and stepping down by increments of 0.2 to find the lowest total energy. The lowest total energy found inthis way correlates to the lattice constant of the elements ground state - in either the FCC, BCC or SC structure,depending on which structure specified in the initial command.

The materials Iridium, Platinum, and Gold have an FCC ground state structure, so I calculated the lattice constantfor FCC first, and generated my initial guess for the BCC and SC lattice constants using a manipulation of therelationship above, abcc = 2−1/3afcc, and

afcc

41/3 = asc, respectively.

2.2 Lattice Volumes

2.2.1 Explanation

A three-dimensional space lattice can be fully defined using just three (non-coplanar) vectors. The lattice isconstructed by placing a point at every possible combination of the three vectors and any multiples of them(positive or negative). The vectors used for this operation are known as the primitive vectors for the lattice. [9]

The primitive cell is defined by the primitive axes (vectors) ~a1, ~a2, and ~a3. The volume, Vc , of the primitive cell isgiven by the parallelepiped from the above axes as

Vc = | ~a1 · ( ~a2 × ~a3)|

.

2.2.2 Results

1.) Given that the primitive vectors for the simple cubic structure lattice are

a 0 00 a 00 0 a

,

Using the formula from the Explanation, Vc = | ~a1 ·( ~a2× ~a3)|.

a00

· 0

a0

× 0

0a

=

a00

· a2

00

= a3

6

Page 7: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.2 Lattice Volumes SemesterReport

2.) Given that the primitive vectors for the hexagonal lattice are

√3a2 0 0−a2 a 00 0 c

Using the formula from the Explanation, Vc = | ~a1 · ( ~a2 × ~a3)|.

3a2−a20)

· 0

a0

× 0

0c

=

3a2−a20)

· ca00

=√

3a2c2

3.) Face-centered cubic: 0.74 Body-centered cubic: 0.68 Simple cubic: 0.52

2.2.3 FCC

The primitive unit cell for the body-centered cubic (FCC) crystal structure contains several fractions taken from 4atoms: one on each corner of the cube (1/8 8 from the corners plus 1/2 6 from the faces). Because the volume ofeach corner atom is shared between adjacent cells, each FCC cell contains one atom. [10] A line that is drawn fromone corner of a face of the the cube through the center of the face and to the other corner of the face passes through4r, where r is the radius of an atom. Therefore, the length of each side of the FCC structure can be related to theradius of the atom by a = 2

√2r.

Knowing this and the formula for the volume of a sphere, it becomes possible to calculate the APF as follows:

APF =NatomsVatomVcrystal

=4(4/3)πr3

(2√

2r)3=

π

3√

2≈ 0.74

2.2.4 BCC

The primitive unit cell for the body-centered cubic (BCC) crystal structure contains several fractions taken fromnine atoms: one on each corner of the cube and one atom in the center (one lattice point in the center of the unitcell in addition to the eight corner points. It has a net total of 2 lattice points per unit cell (1/8 8 + 1). Becausethe volume of each corner atom is shared between adjacent cells, each BCC cell contains two atoms. [10] Eachcorner atom touches the center atom. A line that is drawn from one corner of the cube through the center and tothe other corner passes through 4r, where r is the radius of an atom. By geometry, the length of the diagonal isa√

3. Therefore, the length of each side of the BCC structure can be related to the radius of the atom by

a =4r√

3

Knowing this and the formula for the volume of a sphere, it becomes possible to calculate the APF as follows:

APF =NatomsVatomVcrystal

=2(4/3)πr3

(4r/√

3)3=π√

3

8≈ 0.68

2.2.5 SC

The primitive unit cell for the body-centered cubic (SC) crystal structure contains several fractions taken from 4atoms: one on each corner of the cube. [10] Because the volume of each corner atom is shared between adjacentcells, each SC cell contains one atom (1/8 × 8). A line that is drawn from one corner of the cube through thecenter and to the other corner passes through 2r, where r is the radius of an atom. By geometry, the length of thediagonal is a

√3. Therefore, the length of each side of the SC structure can be related to the radius of the atom by

a = 2r

Knowing this and the formula for the volume of a sphere, it becomes possible to calculate the APF as follows:

APF =NatomsVatomVcrystal

=(4/3)πr3

(2r)=π

6≈ 0.52

7

Page 8: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.3 Iridium SemesterReport

2.3 Iridium

Atomic Number = 77Valence electrons = 9

Iridium (Ir)

Lattice Constant (Bohr) FCC BCC SC

Initial Guess 7.8 6.2 4.8Calculated Value 7.250232 5.821170 4.948790Experimentally Observed Value[2] 7.2565

Bulk Modulus (MBar) FCC BCC

Calculated Value 3.82471 2.13808Experimentally Observed Value[2] 3.2

Energy (Ry) FCC BCC SC

Total Energy -35695.78155 -35695.73008 -35695.59751Fermi Energy 0.78310 0.75494 0.50183

Figure 1: Total Energy Plot

Figure 2: FCC: Ir (in equilibrium)

Band Structure Density of States

8

Page 9: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.4 Superconductivity Transition Tempurature SemesterReport

Figure 3: BCC: Ir (in equilibrium)Band Structure Density of States

Figure 4: SC: Ir (in equilibrium)Band Structure

2.4 Superconductivity Transition Tempurature

2.4.1 Explanation

Superconductivity is the complete disappearance of electric resistance in materials that are cooled to extremely lowtemperatures, usually between 1 K and 10 K. The temperature at which resistance ceases is the transition temper-ature (Tc). The parameter µ* is called the Coulomb psuedopotential and has a value of 0.13 for transition metals,and 0.1 for simple metals. The parameter θD is the Debye tempurature, an approximation of the low temperatureheat capacity of insulating, crystalline solids.

A crystal is a complicated many body system of electrons and ions whose properties are determined by the Coulombinteraction. One may break the crystal Hamiltonian into an electronic part, a lattice part, and interaction terms [1].When split in this way, the interaction term represents the interactions of the electrons and the quanta of the latticevibrations, the phonons. The electronphonon interaction is expanded in powers of the interaction which involvesthe singleion potential of the electrons in the potential of the ions [1]. The parameter λ is the Electron-phononcoupling constant, and represents the approximate strength of this interaction.

2.4.2 Results

The graphs below represent crossections of Tc(µ∗, λ, θD). I used a for loop for each individual variable, setting theother two variables to their value for Iridium.

Tc(µ∗, λ, θD) =θD1.4

exp

[1.04(1 + λ)

λ− µ ∗ −0.62λµ∗

]

9

Page 10: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.4 Superconductivity Transition Tempurature SemesterReport

Figure 5: 2D crossections of Superconductivity Transition Tempurature with respect to µ∗, λ, and θD.The source code used to implement these algorithms is in Source Code [3.3.1].

Tc vs. µ* Tc vs. λ

Tc vs. θD

Figure 6: 4D Contour Plot of Superconductivity Transition Tempurature (Tc represented with color) with respectto µ∗, λ, and θD. The source code used to implement this algorithm is in Source Code [3.3.2].

10

Page 11: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.5 Platinum SemesterReport

2.5 Platinum

Atomic Number = 78Valence electrons = 10

Platinum (Pt)

Lattice Constant (Bohr) FCC BCC SC

Initial Guess 7.8 6.4 5.2Calculated Value 7.412070 5.91153 5.064800Experimentally Observed Value[3] 7.4077

Bulk Modulus (MBar) FCC BCC

Calculated Value 2.85016 2.76436Experimentally Observed Value[3] 2.3

Energy (Ry) FCC BCC SC

Total Energy -36872.53319 -36872.51929 -36872.39915Fermi Energy 0.59395 0.64262 0.38548

Figure 7: Total Energy Plot

Figure 8: FCC: Pt (in equilibrium)Band Structure Density of States

11

Page 12: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.6 Numerical Integration, Iridium SemesterReport

Figure 9: BCC: Pt (in equilibrium)Band Structure Density of States

Figure 10: SC: Pt (in equilibrium)Band Structure

2.6 Numerical Integration, Iridium

Abstract

Prove that the following relations are correct:∫RE

σdR < Z, where Z ≡ atomic number,∫E

N(E)dE = valence electrons

Given that, for Iridium:

Atomic Numer = 77Valence Electrons = 9.

2.6.1 Explanation

In order to complete the numerical integration, I used the ”trapz(X,Y)” function in Matlab - this function completesnumerical integration via the trapezoidal rule: provided two arrays (i.e. X and Y).For the first, integration, using data from pteqfccsigt.dat,

X = R (column 1)Y = σ (column 2)

Note that trapz(X,Y) should be slightly larger than ”Z”, the total number of electrons.For the second integration, you use data from pteqfcc.dos.plot,

12

Page 13: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.7 Gold SemesterReport

X = total energy (column 2)Y = total DOS (column 3)

trapz(X,Y) should result in the number of valence electrons.

2.6.2 Results

Using a python code to strip the data from the column formats in both raw data files, I found that∫RE

σdR ≈ trapz(R, σ) = 77.1551 ≈ 77

∫E

N(E)dE ≈ trapz(total energy, total DOS) = 8.9993 ≈ 9

The source code used to implement this algorithm is in Source Code [3.4].

2.7 Gold

Atomic Number = 79Valence electrons = 11

Gold (Au)

Lattice Constant (Bohr) FCC BCC SC

Initial Guess 8.2 6.6 5.4Calculated Value 7.710720 6.12581 5.29576Experimentally Observed Value[4] 7.713

Bulk Modulus (MBar) FCC BCC

Calculated Value 2.85016 0.95693Experimentally Observed Value[4] 2.3

Energy (Ry) FCC BCC SC

Total Energy -36872.53319 -38074.48735 -38074.407340Fermi Energy 0.59395 0.56383 0.29552

Figure 11: Total Energy Plot

13

Page 14: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.8 Rigid Band Model SemesterReport

Figure 12: FCC: Au (in equilibrium)Band Structure Density of States

Figure 13: BCC: Au (in equilibrium)Band Structure Density of States

2.8 Rigid Band Model

Abstract

A tabulation of N(E) for valence electron numbers.

2.8.1 Explanation

The rigid-band model assumes that the electronic density of states of an alloy can be inferred from that of the hostelements.Certain features of the energy bands and density of states can be captured by the Rigid Band Model. Havingcompleted a calculation of the DOS for a certain element, we can shift the Fermi Level EF to the right or left andpredict the values for DOS at a new EF for other elements in the same row of the periodic table.

2.8.2 Results

Using my middle material, Platinum, and data from pteqfcc.dos.plot, using correlating valence electron values, Iinferred an approximation of the DOS of Iridium and Gold at the Fermi level. Once I found a valence electronvalue closest to the known values for Iridium (9) and Gold (11), I scanned across the columns to find the listedDOS value in the same row.

14

Page 15: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.9 Specific Heat Gamma SemesterReport

Density of States at Fermi-Level

Element Rigid Band Approx Calculated ValueIr 16.77 12.67Pt 26.9038 26.9038Au 3.3 3.8408

2.9 Specific Heat Gamma

2.9.1 Explanation

All matter has a temperature associated with it. The temperature of matter is a direct measure of the motion ofthe atom or molecule. Motion requires energy, there is a directly proportional relationship between temperatureand energy. A type of energy is heat, gain heat causes an atom to gain energy, and the same applies for losing it.The specific heat γ of an object is the measure of how much will the temperature of an object increase or decreaseby the gain or loss of heat energy. Typically, to have experiments match with theoretical posulations, we must adda constant, λ to the equation. This constant is different for every material. I calculated λ using the APW scripts.I compared this value with an inferred λ. using the known experimental values of γ for each element.

2.9.2 Results

γ = 0.17(1 + λ)N(EF )N(EF ) = density of states at fermi levelthus, λ = γ

0.17N(EF ) − 1

Ir = λ = 3.10.17∗12.67679 − 1 = 0.43847

Pt = λ = 6.80.17∗16.55817 − 1 = 1.416

Au = λ = 0.7490.17∗3.84080 − 1 = 0.147

Note that calculated γ is smaller than experimental γ, compared with a chart provided within Dr. Papacon-stantopoulos’s book excerpt.

2.9.3 Results

Element (FCC) Specific Heat γ(mJmol−1deg−2) Electron-Phonon Coupling λCalculated γ Inferred γ Calculated λ Inferred λ

Ir 3.1 2.7067 0.23136 0.43847Pt 6.8 4.48742 0.56291 1.416Au 0.74982 0.12587 0.147

2.10 Angular Momentum of Density of States

Angular momentum components of the density of states.Element EF N(EF ) s p eg t2g f

Ir 0.78310 12.67679 0.10167 0.30625 5.05350 6.48428 0.18394Pt 0.64002 28.88115 0.20670 0.30688 7.48264 20.12128 0.14162Au 0.54352 3.84080 0.60473 0.72113 0.77344 1.26098 0.02160

2.11 Stoner Criterion

2.11.1 Explanation

The condition which has to be satisfied for the appearance of ferromagnetism in an element is the Stoner criterion.

N(EF )I > 1

15

Page 16: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.12 {p,z}-Density of States and Energy in the FCC Lattice Structure SemesterReport

Where N(EF ) is the DOS of a paramagnetic state at the Fermi energy. If the Stoner criterion is satisfied, then theferromagnetic state is favorable.

2.11.2 Results

None of the elements I examined (Iridium, Platinum, and Gold) are ferromagnetic, and their Stoner Criterion’s are,as expected, less than 1.

Element (FCC) Stoner Criterion

Ir 0.2676Pt 0.3440Au 0.0575

2.12 {p,z}-Density of States and Energy in the FCC Lattice Structure

2.12.1 Explanation

The K X-ray spectrum is proportional to the p-DOS, and Np(E).Note that the green line in the plots below indicates the Fermi Energy of the lattice. The L or M X-ray spectra areproportional to Nx, where

Nx(E) = Ns(E) +2

5Nd(E)

I will refer to this sum as the z-DOS, note that the use of z is arbitrary.

2.12.2 Results

In order to find Nd(E), I summed it’s components, which are Neg(E) and Nt2g(E).

Figure 14: FCC: Ir (in equilibrium)p-DOS against E z-DOS against E

16

Page 17: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.12 {p,z}-Density of States and Energy in the FCC Lattice Structure SemesterReport

Figure 15: FCC: Pt (in equilibrium)p-DOS against E z-DOS against E

Figure 16: FCC: Au (in equilibrium)p-DOS against E z-DOS against E

17

Page 18: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.13 Alloy Predictions: Virtual Crystal and Diatomic SemesterReport

2.13 Alloy Predictions: Virtual Crystal and Diatomic

2.13.1 Virtual Crysal Approximation

If we wish to calculate the energy bands and DOS of a substitutionally disordered alloy we can use the followingapproximate method known as the Virtual Crystal Approximation (VCA). In the VCA the bands and DOS of alloyand total energy, AxB1−x, are found by assuming an ideal new element C whose atomic number as well as thenumber of valence electrons, denoted by Z, are both calculated by the following equation

Z = xZA + (1− x)ZB

where ZA and ZB are the atomic numbers(or numbers of valence electrons) of the component elements A and B.To pursue the VCA, we create new files for the hypothetical element C for different x in the subdirectories Libinand Softin.

In order to estimate the properties of the Alloys, I averaged the relevant constants of the individual elementsproperties in their BCC. Using this method of approximation, properties of the alloy IrAu were evident withoutcalculation, for the input constants used for calculation were equivalent to Pt.

2.13.2 Diatomic Model

In order to estimate the properties of the Alloys, I added the valence electrons of both elements together, to forma composite of the shared electrons. I studied these alloys in both the CSCL and NACL configurations.

2.13.3 NaCl vs. CsCl

CsCl NaCl

The crystal structure of cesium chloride differs from that of sodium chloride. This is due to the relative differencein sizes of Cs and Na atoms. Thus, the structure of fcc NaCl changes to bcc CsCl, coordination changes from 6:6to 8:8. If you can surround a positive ion (caesium) with eight chloride ions rather than just six (and vice versafor the chloride ions), then you should have a more stable crystal [10]. Sodium ions are smaller than caesium ionsbecause they have fewer layers of electrons around them thus (there is a difference in the ratios of the cation andanion radii). When we replace the caesium ion with a sodium ion, the chloride ions must keep contact with thesodium [10]. This shrinks the whole lattice arrangement, bringing the chloride ions into contact with each other,causing repulsion [10]. Any gain in attractions because you have eight chlorides around the sodium rather than sixis more than countered by the new repulsions between the chloride ions themselves [8]. When sodium chloride is6:6-coordinated, there are no such repulsions - and so that is the best way for it to organise itself [8].

Which structure a simple 1:1 compound like NaCl or CsCl crystallizes in depends on the radius ratio of thepositive and the negative ions. If the radius of the positive ion is bigger than 73% of that of the negative ion, then8:8-co-ordination is possible. Less than that (down to 41%) then you get 6:6-co-ordination [8].

In CsCl, the caesium ion is about 93% of the size of the chloride ion - so is easily within the range where8:8-co-ordination is possible. But with NaCl, the sodium ion is only about 52% of the size of the chloride ion, thereis about 6:6-co-ordination [8].

18

Page 19: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.13 Alloy Predictions: Virtual Crystal and Diatomic SemesterReport

2.13.4 Results

I used lattice constant of the elements in their BCC structure as a starting guess for the CsCl Diatomic Model ofthe alloys, and incremented downwards by .2 from there.I used lattice constant of the elements in their FCC structure as a starting guess for the NaCl Diatomic Model ofthe alloys, and incremented downwards by .2 from there.

It should be noted while viewing the graphs of band structures below that there are more bands above the Fermienergy of these alloys. These bands are not viewable due to a bug in the APW-package used to create the ”BandStructure ”graphs.

IrPt BCC CSCL

Lattice Constant (Bohr) Virtual Crystal Diatomic ModelInitial Guess 6.4 6.0Calculated Value 5.855660 5.85168

Bulk Modulus (MBar)

Calculated Value 3.11600 3.26146

Energy (Ry)Total Energy -36281.000046 -72568.26534Fermi Energy 0.69955 0.70785

PtAu BCC CSCL

Lattice Constant (Bohr) Virtual Crystal Diatomic ModelInitial Guess 6.2 6.6Calculated Value 5.375920 5.99422

Bulk Modulus (MBar)

Calculated Value 2.76436 2.32590

Energy (Ry)

Total Energy -37470.207449 -74947.01509Fermi Energy 0.64262 0.58543

NaCl IrC PtC AuC

Lattice Constant (Bohr)Initial Guess 9.3 8.8 8.8Calculated Value 9.03558 8.40565 8.62030FCC Value 7.25 7.41 7.71With 0.525 Radii Ratio 8.48343

Energy (Ry)

Total Energy -35770.290788 -36947.663797 -358149.65376Fermi Energy 0.74613 0.78403 0.65429

19

Page 20: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.13 Alloy Predictions: Virtual Crystal and Diatomic SemesterReport

Figure 17: BCC: IrPt (in equilibrium)Band Structure Density of States

Figure 18: BCC: PtAu (in equilibrium)Band Structure Density of States

Figure 19: CSCL: IrPt (in equilibrium)Band Structure Density of States

20

Page 21: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.13 Alloy Predictions: Virtual Crystal and Diatomic SemesterReport

Figure 20: CSCL: PtAu (in equilibrium)Band Structure Density of States

Figure 21: NACL: Density of States

IrC (in equilibrium) PtC (in equilibrium)

AuC (in equilibrium)Color Key: Observing the above graphs, we can see that themain contribution to the total density of states is the t2g-DOS.

21

Page 22: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures SemesterReport

2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures

2.14.1 Results

Note that in the diamond structure Carbon has two atoms in the unit cell, thus I will represent the diamondconfigurations energy as it’s total energy divided by 2, to compare with the total energy of Carbon in it’s FCC andBCC structures, both containing 1 atom in the unit cell.

Diamond FCC BCC

Lattice Constant (Bohr)Initial Guess

8.0 6.0 5.0Calculated Values

7.235 5.760940 4.420020

Total Energy (Ry)-75.32576 -75.296920 -75.312833

We can see that out of the three structures, Carbon is at lowest energy in a diamond configuration, followed by FCCand BCC, respectively. This makes sense, as the diamond structure is Carbon’s ground state. Also, as expected,the lattice constants of Carbon in FCC and BCC are significantly smaller than in the diamond configuration.

Figure 22: Unit cell structure of (a) the diamond cubic lattice showing the two interpenetrating face-centered cubiclattices, and (b) the cell of cubic close packed structure for comparison.

There is a problem with our method of calculating the lattice constant using the muffin-tin approximation. Inour method, the spheres touch and leave some space outside called the interstitial volume [fig 23.a].If the interstitial volume is small in comparison to the volume of the atom-centered spheres, then the muffin-tinapproximation method works well. For example, FCC has a ratio of .74 sphere volume and .26 interstitial volume(see Section 2.2 for further information on FCC and BCC lattice properties).

The volume that the diamond lattice occupies inside spheres is much smaller than in FCC or BCC lattice con-figurations, this discrepant large interstitial volume introduces a serious error in our lattice constant calculationusing muffin-tin approximation. This is why calculated lattice constants are incorrect but the total energy of theconfiguration is computerd correctly.

22

Page 23: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures SemesterReport

Figure 23: 2-D cross-section of a unit cell. (a) the cubic lattice showing four non-overlapping ”spheres” centeredon the atomic positions (b)the cubic lattice showing four overlapping ”spheres” centered on the atomic positionsfor comparison.

In order to approach the experimentally observed value, we allow the spheres to overlap. This reduces theinterstitial volume [fig 23.b]. However, the overlapping spheres violate the predefined mathematical definitions usedto evaluate the properties of a system, so the overlapping should be small (in my case, I used 1.0 for no overlap,and 1.05 for overlap). This overlapping muffin-tin approximation allowed for some correction to the muffin-tinapproximation, and is more accurate than the non-overlapping approximation (see table below).

Further examination of Carbon in it’s Diamond Structure

Lattice Constant (Bohr) Total Energy (Ry)Initial Guess 8.0Calculated No Overlap 7.235 -75.32576

Overlap 7.053410 -75.4218Experimentally Observed 6.748

2.14.2 Explanation

Non-overlapping spheres are centered on the atomic positions. Within these regions, the screened potential ex-perienced by an electron is approximated to be spherically symmetric about the given nucleus. In the remaininginterstitial region, the potential is approximated as a constant. Continuity of the potential between the atom-centered spheres and interstitial region is enforced. [5]

In the interstitial region of constant potential, the single electron wave functions can be expanded in terms of planewaves. In the atom-centered regions, the wave functions can be expanded in terms of spherical harmonics and theeigenfunctions of a radial Schrodinger equation. Such use of functions other than plane waves as basis functions isthe augmented plane-wave (APW) approach. [6]

2.14.3 Insulator

In previous element combinations, we have graphed the densities of states against energy. We know the materialsare metals for the Fermi energy of these configurations hit the density of states. In nonmetals, there is a gap in thedensity of states where the Fermi energy lies.

This is easily seen in the graph above, indicated by a large green line where the Fermi energy is approximatedto be.

The experimentally observed value for Diamond’s energy gap is 0.4042 Ry. Comparing this to our calculatedvalue of 0.3810 Ry, we see that our calculated gap is slightly smaller than the exprimental value. This is becuasein muffin-tin approximated calculations, using density functional theory, the gap is typically underestimated [7].

23

Page 24: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

2.14 Comparison of Carbon in Diamond, BCC and FCC Lattice Structures SemesterReport

Figure 24: C in Diamond: Density Of States

24

Page 25: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3 Source Code SemesterReport

3 Source Code

3.1 General Scripts

3.1.1 Plot 2D Graph, Given Two 1D Arrays (Python)

I wrote an an add-on script that implements a python plug-in, matplotlib-1.0.1 to plot the x and y values for anytwo given arrays. Note that I will reuse this script for multiple assignments.

#! user/bin/pythonimport matplotlib.pyplot as plt

def plot_traj(x, y, show):plt.plot(x, y)plt.xlabel(’x’); plt.ylabel(’y’)#plt.set_xlim(0, 250); plt.set_ylim(0, 50)if show == 0: plt.show()return

3.1.2 Plot 2D Arrays from Text in Two Columns (Python)

I wrote an an add-on script that reads a given .txt file, with information in an array with two columns, each columncorrelating to a variable. Note that I will reuse this script for multiple assignments.

#!/usr/bin/pythonimport plot2D as plot

path = "CDS411_/"#this is the equivalent of executing the following path commands:#cd ˜/home/rin/Dropbox/Py#cd /CDS411_el = "" #element name, i.e. ir, au, ptname, name2 = "fcc", "bcc"

x_list = []y_list = []

def execute(filename, num=1):getArrays(filename, file_len(filename), num)

def file_len(filename):with open(filename) as f:for i, l in enumerate(f):

passreturn i + 1

def getArrays(filename, length, num):#reads document and stores texttry:

with open(filename, "r") as f:data_txt = [line.split() for line in f]

except IOError, e:print ’fail on open’ + str(e)

#stores text as arrays (column 0, and column 1)for x in xrange(length):

data1 = float(data_txt[x][0]); x_list.append(data1)data2 = float(data_txt[x][1]); y_list.append(data2)

plot.plot(x_list, y_list, num)del x_list[:]del y_list[:]

execute(path + el + name + ".txt")execute(path + el + name2 + ".txt", 0)

The program runs twice, storing two sets of arrays. The second run executes the plot module (using the trigger0 - see plot2D.py), to superimpose the two plots, resulting in the graphs shown in semester assignments - latticeconstants.

25

Page 26: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3.2 Assignment Specific Scripts SemesterReport

3.2 Assignment Specific Scripts

3.2.1 Projectile Motion with Air Resistance (Python)

The script below implements the algorithm discussed in the semester assignment - projectile motion with airresistance.

#! user/bin/pythonimport mathimport plot as plot

"""Catherine Ray8/31/12CDS 411Assignment: Determine the trajectory of a baseball accounting for air resistance,compare to idealized trajectory."""

#---global constantsrow = 1.2 #air densityc = 0.5 #coefficient of air resistancer = 0.0366 #radiusa = math.pi*(r**2) #surface area of baseball facem = 0.145 #massk0 = (row*c*a)/(2*m) #find constant kangle = 35; rad = math.radians(angle) # initial angle, convert to radiansv_0 = 50v_0x = v_0*math.cos(rad)v_0y = v_0*math.sin(rad)g = 9.81t_int = 3.0/100 #arbitrary t interval, with airtime = v_0**2*math.sin(2*rad)/(g*v_0*math.cos(rad))t_inc = time/100 # "" , without airx_list = []; y_list = []#---/global constants

def execute():proj_motion(k0) #trajectory with air resistanceprint "-----------------------\n", \"Exit the graph window to terminate this program.", "\n-----------------------"proj_motion(0, 0) ’’’trajectory without air resistance,0 triggers the plot script, so plots are superimposed for comparison’’’

def proj_motion(drag, num=1):k = dragt = 0; n = 0 # zero countersx, y = 0, 0 #set initial (x, y) valuesv_x = v_0x; v_y = v_0y #set initial velocity component valueswhile n < 100:

#update magnitude of velocityv = (v_x**2 + v_y**2)**0.5#update acceleration componentsa_x = -k*v*v_x; a_y = -g-k*v*v_y#update velocity componentsv_x = v_0x + a_x*tv_y = v_0y + a_y*t#update coordinatesx = v_x*t + 0.5*a_x*(t_int**2); x_list.append(x)

#increment counters (time, number of iterations)#Note: time interval dependent on which trajectoryif k == k0:

y = v_y*t - 0.5*a_y*(t_int**2); y_list.append(y)t = t + t_intprint_info(x, y, v_x, v_y, a_x, a_y, n, t) #print results

elif k == 0:y = v_y*t - 0.5*a_y*(t**2); y_list.append(y)t = t+t_inc

n = n+1plot.plot_traj(x_list, y_list, num) #plot x and y

26

Page 27: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3.2 Assignment Specific Scripts SemesterReport

del x_list[:]; del y_list[:] #zero arrays for new plot

def print_info(x, y, v_x, v_y, a_x, a_y, n, t):print n+1, "] t = %f\n" %t, "x = %f, \

y = %f\nv_x = %f, v_y = %f\na_x = %f, a_y = %f\n\n" \%(x, y, v_x, v_y, a_x, a_y)

print "The angle and initial velocity you have selected \are %d and %d\n" %(angle, v_0)

execute()

In order to run this code, one must have python 2.7.3, and matplotlib 1.0.1. Save both files in one folder, asassn0 plt.py and projectile.py, respectively. One can create new folders using the commandsmkdir foldernameOpen your terminal window, navigate to the path of your newly created folder using the commandcd /yourpath/foldernamepython projectile.py

3.2.2 Energy of Particle in a Rectangular Potential Well (Python)

#Solve schrodinger equation given that L = 3 angstroms, v = 10 eV

import mathimport plot2D as plot

c_list = []e_list = []L = 3;v = 10;m = 1; # mass of electronh2 = 7.6199682; #h bar squared

for E in range(0,81,1):E = E*0.1; e_list.append(E)c = (math.cos(L*((2*m*E/(h2))**0.5))*(2*E - v)*math.tan(L*((2*m*E/(h2))**0.5)) - \

math.cos(L*((2*m*E/(h2))**0.5))*2*(((E*(v-E)))**0.5)); c_list.append(c)

print "Result changes sign between:"for i in range(0,80,1):

if c_list[i]*c_list[i+1] < 0:print e_list[i], e_list[i+1]

plot.plot_traj(e_list, c_list, 0) #plot x and y

3.2.3 Script to Autonomize Bash Interaction With monoatom.com, and diatom.com (Python)

#!/usr/bin/pythonimport pexpectimport time

mypassword = ’your_password’mypassword2 = ’your_password2’

el = {’ir’: [77, 9, 0], ’pt’: [78, 10, 1], ’au’:[79, 11, 2], ’c’: [6,4]}minE, maxE = ’-0.3’, ’2.0’

def execute():print "matom (m), datom (d)?"trial = raw_input()print "Separate your entries with whitespace."if trial == "d":

name1, name2, trials, latticetype = raw_input("1st-element 2nd-element #-of-trialslattice-type\n").split()

activate_datom(name1, name2, trials, latticetype)elif trial == "m":

name1, trials, latticetype = raw_input("Element #-of-trials lattice-type\n").split()

27

Page 28: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3.2 Assignment Specific Scripts SemesterReport

activate_matom(name1, trials, latticetype)

def activate_datom(name1, name2, trials, latticetype):name = name1+name2atomicnumber1 = el[name1][0]atomicnumber2 = el[name2][0]valence = el[name1][1] + el[name2][1] #composite valence electronsminE1, maxE1 = ’0’, ’0’info = {’cscl’: [’35’, ’11’, [’6.6’,’6.6’]], ’nacl’: [’89’, ’21’, [’9’,’9’,’9’]]} #name: [kpt,

code]kpt = info[latticetype][0] #number of kpointscode = info[latticetype][1] #structure codelatticeconstant = 9#info[latticetype][2][el[name1][2]]

c = cdstunnel()print "starting diatom.com"c.sendline(’./diatom.com ’+ name1 + ’ ’ + name2 + ’ eq ’ + latticetype)commands = [0, 0, 1, 6, 5, 1, name, code, kpt, latticeconstant, 1, .2, name1, name2,

atomicnumber1, atomicnumber2, 0.5, 0.85, valence, minE, maxE, 5000, minE1, maxE1, 12, 1]test(commands, c)

def activate_matom(name, trials, latticetype):atomicnumber1 = el[name][0]valence = el[name][1]info = {’fcc’: [[’7.8’, ’7.8’, ’8.2’],’89’, ’20’], ’bcc’: [[’6.2’,’6.4’,’6.6’], ’55’, ’10’], ’sc

’: [[’5.4’, ’5.8’, ’5.6’],’35’, ’25’]} #name: [[latticeconstants for each element],kpt, code]

kpt = info[latticetype][1]code = info[latticetype][2]latticeconstant = info[latticetype][0][el[name][2]]

c = cdstunnel()print "starting monoatom.com"c.sendline(’./monoatom.com ’ + name + " " + latticetype)commands = [0, 0, 1, 6, 5, 0, 1, name, code, kpt, latticeconstant, 1, .2, name, atomicnumber1,

0.85, valence, minE, maxE, 5000, 6, 1]test(commands, c)

def cdstunnel():c = pexpect.spawn(’ssh [email protected].’)print "spawned"#time.sleep(4)#c.sendline("yes")time.sleep(6)c.sendline(mypassword)time.sleep(6)print "in mason"c.expect(" monitoring to law enforcement officials. ")time.sleep(1)c.sendline(’ssh [email protected].’)time.sleep(3)c.expect(’Password:’)time.sleep(3)c.sendline(mypassword2)print "in cds"time.sleep(3)c.sendline(’cd ˜/apw’)time.sleep(3)return(c)

def test(array, c):for x in array:

time.sleep(3)c.sendline(str(x))

print c.beforec.interact()

execute()

28

Page 29: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3.3 Superconductivity Transition Tempurature SemesterReport

3.2.4 Superconductivity Transition Temperature (Python)

#Catherine Ray#CDS 411#Verify the equation given to calculateimport math#info for IR FCCdebye = 420lam = 6.96776temp = 0.00006

#Verifymu = 1.3temp1 = (debye/1.4)*math.e**(-(1.04*(1+lam)) /(lam - mu - 0.62*lam*mu))print temp1

if (temp - .02) < temp1 < (temp + .02):print "The equation works!"for mu in range(0, 101):

mu = mu*.1T = (debye/1.4)*math.e**(-(1.04*(1+lam))/(lam - mu - 0.62*lam*mu))

print "%f \t %f" % (mu, T)else: print "You have failed, check your variable values."

3.3 Superconductivity Transition Tempurature

3.3.1 2D (Python)

#Catherine Ray#CDS 411#Verify the equation given to calculate , write to file "textfile"import math#info for IR FCCdebye = 420lam = 0.23temp = 0.00006

print "lam, mu, or debye?"var = raw_input.lower()

#Verifymu = .13temp1 = (debye/1.4)*math.e**(-(1.04*(1+lam)) /(lam - mu - 0.62*lam*mu))print temp1text_file = open("temp0.txt", "w")

if (temp - .02) < temp1 < (temp + .02):print "The equation works!"

if var == ’lam’: lamT()elif var == ’mu’: muT()elif var == ’debye’: debyeT()

else: print "You have failed, check your variable values."

def lamT():for lam in range(2, 21):

lam = lam*0.1if lam - mu - 0.62*lam*mu != 0:

T = (debye/1.4)*math.e**(-(1.04*(1+lam))/(lam - mu - 0.62*lam*mu))print "%f \t %f \n" % (T, lam)text_file.write("%f \t %f \n" % (T, lam))

else: pass

def muT():for mu in range(5, 21):

mu = mu*.01if lam - mu - 0.62*lam*mu != 0:

T = (debye/1.4)*math.e**(-(1.04*(1+lam))/(lam - mu - 0.62*lam*mu))text_file.write("%f \t %f \n" % (T, mu))

29

Page 30: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

3.4 Numerical Integration (Matlab) SemesterReport

print "%f \t %f \n" % (T, mu)else: pass

def debyeT():for debye in range(0, 801):

debye = debye-100T = (debye/1.4)*math.e**(-(1.04*(1+lam))/(lam - mu - 0.62*lam*mu))text_file.write("%f \t %f \n" % (T, debye))print "%f \t %f \n" % (T, debye)

3.3.2 4D - Contour Plot (Matlab)

%debye = x, lam = y, mu = z, c = Tx = linspace(-100,700,101);y = linspace(0.3,2.0,101);[X, Y] = meshgrid(x,y);Z = meshgrid(linspace(0.05,0.2,101));C = (X/1.4)*exp(-(1.04*(1+Y)/(Y - Z - 0.62*Y*Z)));surfc(X,Y,Z,C);%axis equalaxis([-100 900 0.3 2.5 0.05 0.25]);rotate3d on%colormap_index = fix((color_data-cmin)/(cmax-cmin)*cm_length)+1set(gcf(), ’Renderer’, ’painters’)colorbarxlabel(’Debye’);ylabel(’Lambda’);zlabel(’Mu*’);

3.4 Numerical Integration (Matlab)

Y = [0.0, ... , 0.0287];X = [-0.3, ... , 2.0];floor(trapz(X,Y))

X = [1e-05, ..., 2.66208];Y = [0.005950361367344, ... , 3.886178012198];floor(trapz(X,Y))

3.5 Column-stripping Tailored to Calculating z-DOS

#!/usr/bin/pythonimport pexpectprint "Input name of element in lower case."name = raw_input()filename = name + "eqfcc.dos.plot.txt"filename2 = name + ".txt"filename3 = name + "_new_column.txt"

def execute(filename):getArrays(filename, file_len(filename))

def file_len(filename):with open(filename) as f:

for i, l in enumerate(f):pass

return i + 1

def getArrays(filename, length):

try:with open(filename, "r") as f:

data_txt = [line.split() for line in f]except IOError, e:

print ’fail on open’ + str(e)

txtwrite = open(filename2, "w")for x in xrange(length):

sDOS = float(data_txt[x][3]);

30

Page 31: Contentsrin.io/wp-content/uploads/2014/06/CDS411.pdf · 1.1 Projectile Motion with Air Resistance ... 2.13 Alloy Predictions: ... When air drag is omitted,

4 References SemesterReport

dDOS = float(data_txt[x][5]) + float(data_txt[x][6]);DOS = sDOS + (2/5)*dDOStxtwrite.write("%f \n" % (DOS))

child = pexpect.spawn(’paste %s %s > %s’ % (filename, filename2, filename3))child.sendline("vi " + filename3)

execute(filename)

4 References

[1] http://en.wikipedia.org/wiki/Superconductivity[2] http://en.wikipedia.org/wiki/Platinum[3] http://en.wikipedia.org/wiki/Iridium[4] http://en.wikipedia.org/wiki/Gold[5] http://en.wikipedia.org/wiki/Muffin-tin approximation[6] http://en.wikipedia.org/wiki/Band gap[7] http://en.wikipedia.org/wiki/Density functional theory[8] http://wikis.lib.ncsu.edu/index.php/HaliteNaCl[9] http://en.wikipedia.org/wiki/Primitive cell[10] http://en.wikipedia.org/wiki/Cubic crystal system

31