Tutorial

Matlab routines for fcc crystal analysis

- Peter Schall -

This short tutorial should help you to learn how to use the Matlab routines.
If you have further question about using the routines, please contact me (see address below)
Allright. Let’s start by creating a small fcc crystal lattice using

>> X = fcclattice(5,5,5);

X now contains the x,y,z coordinates of an fcc lattice of size 5 by 5 by 5 unit cells.
To visualize the crystal lattice, let’s draw spheres on the lattice sites. Type:

>> showbeads(X,1/sqrt(2));

Your crystal should look like the one in figure 1.
By the way, the second argument in “showbeads” sets the size of the spheres. We have chosen a value so that the spheres are just touching. Now let’s rotate the crystal in order to align the particle rows with the x and y axis. Type

>> X = rotate_z(X,45);

This command rotates the crystal by 45° around the z-axis. To check the new crystal orientation, type again:

>> showbeads(X,1/sqrt(2));

The crystal should appear as shown in figure 2. Great. You have just rotated the entire crystal.

Now, let’s try something else. Let’s strain the crystal along the x-direction by some amount, say 3%. Type:

>> X(:,1) = X(:,1) .* 1.03;

We can calculate and visualize the strainfield that we have just introduced by using the strainfield.m routine. Type

>> eps = strainfield(X);

and

>> showbeadscolorcoded(X,eps(:,1),-0.05,0.05,1/sqrt(2),3,5,1);

The second command visualizes component 1 of the epsilon tensor (=exx); minimum and maximum values of the colorcode are set to -0.05 and 0.05, respectively. The value 1/sqrt(2) defines the sphere size again. The last three numbers specify the section of the crystal to be drawn: here, we only plot a crystal section between x=3 and x=5 (the 1 at the end indicates the x-direction). You should see the spheres with uniform red-ish color, as shown in figure 3. The uniform color indicates that we have just introduced a homogeneous strainfield with a strain of about 3%. Now, you can explore introducing an inhomogeneous strain field. For example, displace just two particles by typing:

>> X(188,1) = X(188,1) * 0.97;

>> X(63,1) = X(63,1) * 0.97;

This command displaces the particles with the numbers 188 and 63 by 3 percent to smaller x. Visualize the resulting strainfield using

>> eps = strainfield(X);

>> showbeadscolorcoded(X,eps(:,1),-0.05,0.05,1/sqrt(2),3,5,1);

You should see a strain distribution such as the one in figure 4. We have introduced an inhomogeneous strain field. This strain field has not only a compressive, but also a shear component. You can visualize the shear component exy (tensor component 2) using 

>> showbeadscolorcoded(X,eps(:,2),-0.05,0.05,1/sqrt(2),3,5,1);

Congratulations! You are now able to calculate and visualize the local strain field of any distorted fcc crystal lattice! A real lattice maybe distorted around a point defect or a dislocation line. To calculate and visualize this strainfield, you just align the crystal so that the particle rows lie parallel to the x and y directions (as we did above) and set the reference lattice constant d0 in the strainfield.m routine to the actual crystal lattice constant.

In the real case, it is often necessary to smooth the strain distribution. You can do so by using the commands:

>> average_eps = averagestrainfield(X,eps);

>> showbeadscolorcoded(X,average_eps(:,1),-0.05,0.05,1/sqrt(2),3,5,1);

The resulting strain distribution (fig. 5) looks much smoother, doesn’t it ?

 

For further questions or comments, please contact me:

pschall@science.uva.nl

 

fcccrystal

Fig. 1: Fcc crystal lattice plotted using the “showbeads.m” routine

fcccrystalrotated

Fig. 2: Fcc crystal of fig. 1, rotated around the z-axis by 45°.

crystalstrained

Fig. 3: Section through the crystal perpendicular to the x-axis. The red color indicates that the crystal is uniformly strained by 3 % (see colorbar).

crystalstrained2

Fig. 4: Section through the strained crystal perpendicular to the x-axis. The blue particles in the center have been moved by 3% to smaller x-values. The color indicates the strain field component exx.

crystalstrained2(average)

Fig. 5: Same crystal section as in figure 3, but here showing the averaged strain distribution exx.