An Integrated Software for Computing Mechanical Properties of Crystalline Material by Means of XRD

: An integrated software for calculating the major mechanical properties of materials was newly programmed. The material mechanical properties are determined from a peak position and the broadness of X-ray diffraction (XRD) line using proﬁle function method, including Gaussian, Parabola, Half-width, and Centroid. The X-ray diffraction line in software is also corrected by the generalized X-ray absorption function. The results show that the precision coefﬁcient (R 2 ) of the d hkl -sin 2 ψ linear regression depends on tested materials and the method of the 2 θ determination. The Parabola and Gaussian methods show greater ﬁtting accuracy in comparison to the other two methods in determining stress. The mechanical properties calculated using this software agreed well with the values determined from the conventional methods. In addition, this XRD software also allows computing the 95% conﬁdential limits of the results from a single measurement without conducting repetitive measurements. Therefore, the new software allows widening the experimental scopes of an X-ray diffraction device in both laboratories and the industrial sector.


Introduction
Since they were discovered in 1890, X-rays and the techniques using X-ray diffraction [1,2] have shown great progress and have seen a variety of applications in industry because of their advantages over other nondestructive techniques. They can evaluate many mechanical properties including stress [2][3][4], crystalline grain size [5], phase composition analysis [6,7], hardness [8], the thickness of plating or coating layer [9,10], etc. Moreover, X-ray diffraction has also been used to identify modifications of phase, texture, dislocation density, and mechanical twins of materials [11]. Ultrasonic and magnetic techniques have many applications for many kinds of materials at the macro level to determine material inhomogeneity; however, they cannot determine the properties at the micro-and nanolevel. The laser technique can only determine the outer profile of the sample surface such as roughness. The microscopic technique is used to observe crystalline microstructure, and when combined with image processing, it can determine crystal grain size, phase components in multi-phase materials, and layer thickness [12]; however, it has difficulty in determining the state of materials such as stress, hardness, etc. Fortunately, X-rays with short wavelengths can detect the change or characteristics of a crystalline matrix from macro-to micro-and even nano-level, and it can therefore determine the hereabove parameters of crystalline materials. Moreover, a distinguished advantage of the XRD method over the other methods is that it can determine the standard deviations from a single measurement without replication of measurement. This is because the diffraction of i.
Residual stress computation for the aluminum alloy A1060; ii.
Surface hardness of quenched and tempered carbon steel JIS-type S50C; iii.
Quantitative analysis for triple-phase carbide T15K6 containing three phases, WC, TiC, and Co; iv.
Thickness measurement of the nickel-coating layer on substrate carbon steel S45C; v.
Determining grain size of the zeolite material ZSM-5.
The demonstration measurements using X-rays and conventional methods were also compared to verify the validity of the computation and thus the applicability to the manufacturing site. All XRD measurements in this study use the X-ray characteristic CuKα with a wavelength λ of 1.5 Å and Ni foil filter. The use of a graphical user interface (GUI) also allows beginner-level programmers to easily reprogram resource codes for their individual computation.

Selection of Development Language
Structured programming (SP) languages such as Basic, Pascal, and C have a common structure [19]: Programs = Data structures + Algorithms The advantage of SP includes ease of following; however, for large projects, the resource code cannot be reused and the algorithm strictly depends on the data structure. In contrast, object-oriented programming languages, including Turbo Pascal, C++, and C#, use the classes containing functions and variables to solve tasks of the objects [20]. Among these strong languages, C# is a .NET Framework background language, and is easy for programmers to use since it has various libraries of functions and parameters [20,21]. Therefore, in this study, C# is used to build the new analyzing software XPro 2.0.
The routine of the software is as below: Step 1: Measurement data are read. They are raw data files, obtained from the commercial X-ray diffractometer, which is Panalytical XPert system in this paper.
Step 2: Analyzing X-ray diffraction lines; background and LPA factor correction.
Step 3: Determining peak positions with many mathematical functions.
Step 4: Calculation of the mechanical properties.
Step 5: Representation of computed values.

Lorentz-Polarization and Absorption (LPA) Factor
There are two inclination methods using X-ray diffraction, including the iso-and side-inclination methods (sometimes called Ωand Ψ-type goniometers); however, the latter gives measurement at higher ψ angles. The absorption function for iso-inclination has been calculated [16]; however, side-inclination has not been calculated. Therefore, this research will introduce the determination of the general absorption function for material using the iso-and side-inclination method. Figures 1 and 2 show the incident beam AO and diffracted beam OB from a material fraction with sizes l 1 × l 2 × dz at the depth z from the surface. OD is the diffraction plane normal. The incident and diffraction beams, respectively, make angles α and β to the normal of the specimen. 2θ is the diffraction angle and η = 90 • − θ. The angles ψ 0 and ψ are the angles between incident beam and normal of the diffraction l plane. Therefore, the X-ray intensity diffracted from the fraction is given by where a is the diffraction efficiency and µ is the linear absorption coefficient of the measured material. The irradiated area S is rectangular with the dimensions l 1 and l 2 . AB and BC in Equation (1) cos α· cos β cos α+cos β cial X-ray diffractometer, which is Panalytical XPert system in this paper.
Step 2: Analyzing X-ray diffraction lines; background and LPA factor correction.
Step 3: Determining peak positions with many mathematical functions.
Step 4: Calculation of the mechanical properties.
Step 5: Representation of computed values.

Lorentz-Polarization and Absorption (LPA) Factor
There are two inclination methods using X-ray diffraction, including the iso-and side-inclination methods (sometimes called Ω-and Ψ-type goniometers); however, the latter gives measurement at higher ψ angles. The absorption function for iso-inclination has been calculated [16]; however, side-inclination has not been calculated. Therefore, this research will introduce the determination of the general absorption function for material using the iso-and side-inclination method. Figures 1 and 2 show the incident beam AO and diffracted beam OB from a material fraction with sizes l1 × l2 × dz at the depth z from the surface. OD is the diffraction plane normal. The incident and diffraction beams, respectively, make angles α and β to the normal of the specimen. 2θ is the diffraction angle and η = 90 0 − θ. The angles ψ0 and ψ are the angles between incident beam and normal of the diffraction l plane. Therefore, the X-ray intensity diffracted from the fraction is given by where a is the diffraction efficiency and μ is the linear absorption coefficient of the measured material. The irradiated area S is rectangular with the dimensions l1 and l2. AB and BC in Equation (1) cos .cos cos cos Omitting the constants, we obtain the generalized absorption factor for anisotropic material:  Omitting the constants, we obtain the generalized absorption factor for anisotropic material: A = I I 0 = l 1 l 2 cos α· cos β cos α + cos β (2)

Without Limitation of the Irradiated Area
In the case of the Iso-inclination method without limitation of the irradiated area, substituting l 1 =1/cosα and l 2 = 1 into Equation (2) gives us: In the fixed-ψ 0 method, the following relations hold: α = ψ 0 , β = ψ 0 + 2η, η = 90 • − θ. Substituting these Equations into the generalized Equation (3), we have the absorption factor for the fixed-ψ 0 method: In the fixed-ψ method, the following relation holds: By substituting the relation into the generalized absorption factor in Equation (3), we obtain the absorption factor in the fixed-ψ method: In the case of the side-inclination method, by substituting l 1 = 1/cosψ and l 2 = 1/cosη into Equation (2), we obtain the generalized absorption factor: In the fixed-η 0 method, the incident x-rays make an angle η 0 to the normal specimen, and we have cosα = cosψsinη 0 and cosβ = cosψsinη* where η* = 180 • − 2θ − η 0 and η 0 = 90 • − θ 0 . Substituting the above relations into Equation (6), we have the absorption function: In the fixed-η method, by substituting θ 0 = θ into Equation (7), we obtain the absorption function: Since A is a constant, the absorption correction in this method is omitted.

With Limitation of the Irradiated Area
In the case of the Iso-inclination method without limitation of the irradiated area, substituting l 1 = 1 and l 2 = 1 into Equation (2) gives us: In the fixed-ψ 0 method, the following relations hold: α = ψ 0 , β = ψ 0 + 2η, η = 90 • − θ. Substituting these Equations into the generalized Equation (9) gives us the absorption factor for the fixed-ψ 0 method: In the fixed-ψ method, the following relation holds: Substituting the relation into the generalized absorption factor in Equation (9), we obtain the absorption factor in the fixed-ψ method: In the case of the side-inclination using the fixed-η 0 method, the incident X-rays make an angle η 0 to the normal specimen, and we have cosα = cosψsinη 0 and cosβ = cosψsinη* where η 0 = 90 • − θ 0 and η* = 180 • − 2θ − η 0 . Substituting the above relations into Equation (9), we have the following absorption function: In the fixed-η method, substituting θ 0 = θ into Equation (12), we obtain the absorption function: Figure 3 shows the X-ray intensities obtained from the measurement data files measured from the diffraction device. The most important line parameters include line peak position p and broadness B for specific diffraction planes (hkl), which are computed and displayed on the screen. The peak position determination methods and correction for the LPA factor and the background can be selected.   Figure 4 shows the diagram to smooth the roughly measured X-ray counts. The data are calculated from three data (x1,y1), (xi,yi), and (x2,y2), with an interval of n × c, where n is   Figure 4 shows the diagram to smooth the roughly measured X-ray counts. The data are calculated from three data (x 1 ,y 1 ), (x i ,y i ), and (x 2 ,y 2 ), with an interval of n × c, where n is an integer and c is the step size of diffraction angle 2θ. The slope tanα of the line (1,2) is:  Figure 4 shows the diagram to smooth the roughly measured X-ray counts. The data are calculated from three data (x1,y1), (xi,yi), and (x2,y2), with an interval of n × c, where n is an integer and c is the step size of diffraction angle 2θ. The slope tanα of the line (1,2) is:

Smoothing
For most normal measurements, the angle α is preset at 10° to distinguish between the diffraction peak and the background diffraction. The value of n can be preset between 1 and 10 to change the smoothing level.

Stress Measurement by X-ray Diffraction
Stress determination is based on lattice strain, which is expressed by the following Bragg's law as: where λ is wavelength, θ is Bragg angle, dhkl is interplanar spacing, and n is an integer. If the Bragg angle θ in the stress direction is measured, the lattice spacing dhkl, and thus the stress, is determined. Figure 5 shows the coordinate system 11, 22, and 33 on the surface of the specimen. The stress measurement direction L3 is the normal plane of the crystalline matrix. The stresses σij generate the strains εij For most normal measurements, the angle α is preset at 10 • to distinguish between the diffraction peak and the background diffraction. The value of n can be preset between 1 and 10 to change the smoothing level.

Stress Measurement by X-ray Diffraction
Stress determination is based on lattice strain, which is expressed by the following Bragg's law as: nλ = 2d hkl sinθ (15) where λ is wavelength, θ is Bragg angle, d hkl is interplanar spacing, and n is an integer. If the Bragg angle θ in the stress direction is measured, the lattice spacing d hkl , and thus the stress, is determined. Figure 5 shows the coordinate system 11, 22, and 33 on the surface of the specimen. The stress measurement direction L 3 is the normal plane of the crystalline matrix. The stresses σ ij generate the strains ε ij .  The strain ε L 33 in the measurement direction is determined from the lattice spacing d hkl as [2,3] where d 0 is the lattice spacing in the non-stress state. Equation (16) can be expressed in terms of strains ε ij (i,j = 1 to 3) in the specimen coordinate system by the tensor transformation as where a 3k, a 3l are, respectively, the directional cosines between the normal of the diffraction plane and the axes 11, 22, and 33 to the direction cosine matrix as shown in Figure 5 by From Equations (16)-(18), the relation between a strain in the laboratory system and the strain components in the specimen system is: = ε 11 cos 2 ϕ sin 2 ψ + ε 12 sin 2ϕ sin 2 ψ + ε 22 sin 2 ϕ sin 2 ψ +ε 33 cos 2 ψ + ε 13 cos ϕ sin 2ψ + ε 23 sin ϕ sin 2ψ (19) From the elastic theory, strain-stress relation gives: E (σ 13 cos ϕ + σ 23 sin ϕ) sin 2ψ (20) where E is the Young's modulus and v is Poisson's ratio. For a plane stress state of the specimen, the third stress components are zero. Equation (20) becomes: where σ φ is the term stress in the φ azimuth. Equation (21) can be written as: If we put m as the slope of the straight line fitted to the lattice spacing d in the d hkl -sin 2 ψ diagram, the stress can be determined as: where m is the slope in Equation (22). Now, m is determined experimentally from the sin 2 ψ diagram by fitting a straight line to a set of experimental points (d hkl1, sin 2 ψ 1 ), (d hkl2, sin 2 ψ 2 ), . . . (d hkln, sin 2 ψ n ) using the least-squared method. The precision coefficient (R 2 ) of the linear regression is determined as: where SS residual and SS total are the sum squared of regression error and sum squared total error of experimental values in comparison to the estimated values, f i is predicted or estimated function, and d hkl = 1 n n ∑ i=1 d hkli is the mean of the experimental data.

Analysis of Stress
The dialog box in Figure 6 allows us to select the material and its elastic constants used to determine stress. This also allows us to revise a material or add a new material and then save it to the program library. Figure 7 shows the display for choosing methods of peak position determination, and the correction factors used for stress computation. The corrected X-ray diffraction line, peak positions, and stress and their 95% confidential limits representing the reproducibility of the calculated value are shown. sin 2 ψ2), … (dhkln, sin 2 ψn) using the least-squared method. The precision coefficient (R 2 ) of the linear regression is determined as:

Analysis of Stress
The dialog box in Figure 6 allows us to select the material and its elastic constants used to determine stress. This also allows us to revise a material or add a new material and then save it to the program library. Figure 7 shows the display for choosing methods of peak position determination, and the correction factors used for stress computation. The corrected X-ray diffraction line, peak positions, and stress and their 95% confidential limits representing the reproducibility of the calculated value are shown.  The sample was made from aluminum alloy 1060 with dimensions of 250 × 50 × 5 mm. The sample surface was ground to remove the surface layer of about 1 mm and then polished with emery paper to obtain the roughness of 0.64 μm. Table 1 shows the experimental conditions for stress measurement using XRD.  The sample was made from aluminum alloy 1060 with dimensions of 250 × 50 × 5 mm. The sample surface was ground to remove the surface layer of about 1 mm and then polished with emery paper to obtain the roughness of 0.64 µm. Table 1 shows the experimental conditions for stress measurement using XRD.  Table 2 shows the residual stresses of aluminum alloy 1060 calculated from XPro 2.0. The peak positions are computed using four methods of peak position determination Parabola, Gaussian, Half-width, and Centroid with their 95% confidence limits. They are also compared to the result computed from the commercial Origin. The stress values determined from the Parabola method and Gaussian curve method strongly agree with the Origin. They have a precision coefficient R 2 of fitting regression of 0.91 ± 0.06 and 0.89 ± 0.08, respectively. In contrast, the Half-width and the Centroid methods gave much larger 95% confidential limits with lower R 2 of 0.72 ± 0.15 and 0.68 ± 0.18, respectively. Therefore, the Parabola and Gaussian methods are the most suitable in XRD stress investigation.

Analysis of Phase Compositions
The phase compositions of multi-phase materials (triple-phase carbide in this study) can be analyzed simply using XPro 2.0. Figure 8 is diffraction peaks in accordance with the diffraction planes for various phases. A formula for calculating the phase component was proposed in the previous studies [6,7] as the following. Figure 9 represents the diffraction line from a three-phase material. The areas under a peak of a phase are the diffracted energy portion of that phase. Therefore, the phase composition is determined from the energy portion q α , q β, and q γ diffracted from phases α, β, and γ with the total diffracted energy of material as: are the energy portion diffracted from phase α, β, γ from the ith plane (hkl) i for wavelength λ j .

Analysis of Phase Compositions
The phase compositions of multi-phase materials (triple-phase carbide in this study) can be analyzed simply using XPro 2.0. Figure 8 is diffraction peaks in accordance with the diffraction planes for various phases. A formula for calculating the phase component was proposed in the previous studies [6,7] as the following.  Figure 9 represents the diffraction line from a three-phase material. The areas under a peak of a phase are the diffracted energy portion of that phase. Therefore, the phase composition is determined from the energy portion qα, qβ, and qγ diffracted from phases α, β, and γ with the total diffracted energy of material as:  Five samples of commercial triple-phase ceramic T15K6, containing three phases WC-TiC-Co, were prepared with dimensions of 15 × 15 × 20 (mm). The average chemical compositions of the phases WC, TiC, and Co, respectively, were 78.63%, 14.17%, and 6.79%, together with their 95% confidence limits. Table 3 lists the XRD experimental conditions for analyzing phase compositions of carbide T15K6. Table 4 compares the phase composition determined from the XRD method and chemical analysis method, which is known as a traditional and accurate technique for determining compositions. The results show good agreement between the methods, confirming the validity of proposed Equations (25) and (26) using the XRD technique. Table 3. XRD conditions for analyzing phase compositions of T15K6.

Measurement Method
 Type, Fixed- Preset time 5 s Step size 0.02 ○ Voltage and current 20 kV and 10 mA  Five samples of commercial triple-phase ceramic T15K6, containing three phases WC-TiC-Co, were prepared with dimensions of 15 × 15 × 20 (mm). The average chemical compositions of the phases WC, TiC, and Co, respectively, were 78.63%, 14.17%, and 6.79%, together with their 95% confidence limits. Table 3 lists the XRD experimental conditions for analyzing phase compositions of carbide T15K6.  Table 4 compares the phase composition determined from the XRD method and chemical analysis method, which is known as a traditional and accurate technique for determining compositions. The results show good agreement between the methods, confirming the validity of proposed Equations (25) and (26) using the XRD technique.

Evaluation of Hardness
Many studies have found that the full width of the maximum X-ray diffraction line (half-width) has a relation to the dislocation or disordering of crystalline matrixes. This is a result of many changes in the crystalline matrix in various industrial processes such as alloying by other metallic elements, hardening by quenching, plastic deformation, fatigue stress, etc. In this study, the hardening levels of quenched steel specimens were nondestructively investigated using XRD. A previous study has determined a linear relation between the Rockwell hardness HRC and the half-width of the diffraction line of quenched and tempered carbon steel [8]: where B = 2 √ 2 ln 2σ = 0.35σ is the half-width of the diffraction line and σ is the standard deviation of the Gaussian curve. In the case of the parabola method, where FHW is the full width at half of the maximum X-ray intensity of the diffraction line. Ten JIS-type S50C samples with dimensions of 50 × 50 × 200 mm were quenched at 850 • C in water, and then nine of them were tempered from 250 • C to 650 • C, in steps of 50 • C, for 45 min to eliminate the inhomogeneous distribution. The sample surfaces were polished with emery paper and then electrolytically polished to remove about 1 mm of the surface layer. The hardness of samples was measured using the Rockwell hardness testing method. Table 5 shows the experimental conditions for XRD measurement.  Figure 10 compares the HRC hardness with the line half-width. A straight line is fitted to the experimental points to establish the relation between FHW and HRC using Equations (27) and (28). From this practical linear relation, the hardness of quenched carbon steel can be easily estimated from the measured half-width. The same procedure can be applied to determine the hardness of quenched copper, stainless steel, plastically deformed steel, nickel alloys, etc.

Thickness of Coating Layer
To determine the thickness of the coating layer, the measurements using tilt angles ψ and ψ0 were used. When "Count" is pressed, the thickness of the coating layer is determined, as shown in Figure 11. The coating thickness t is determined from the formulas as below [10]:

Thickness of Coating Layer
To determine the thickness of the coating layer, the measurements using tilt angles ψ and ψ 0 were used. When "Count" is pressed, the thickness of the coating layer is determined, as shown in Figure 11. The coating thickness t is determined from the formulas as below [10]: where θ is Bragg angle and µ and µ f are the linear absorption coefficients of the substrate and coating layer used, respectively, and I ψ is the maximum X-ray intensity in the fixed-ψ method. where  is Bragg angle and µ and μf are the linear absorption coefficients of the substrate and coating layer used, respectively, and Iψ is the maximum X-ray intensity in the fixed-ψ method.
Three JIS-type SS400 samples with dimensions of 10 × 40 × 40 mm were polished, electroplated for 6 to 30 min to obtain the thicknesses of 2 µm, 2.25 µm, 2.75 µm, 3.25 µm and 3.5 µm, and observed directly under a microscope (MS). The thicknesses were measured by the Eddy current technique at nine positions in the central area of each sample to obtain the average values and their standard deviations. Table 6 lists experimental conditions for XRD thickness measurements. Figure 11 shows the diffraction lines of the 3 µm plating sample. Table 7 compares the thickness of nickel-coating layers, measured using microscope techniques, Eddy current (EC), and XRD. The XRD technique allows determining 95% confidence limits of the computed values using a single measurement. The three techniques gave agreed thickness, and they are within the confidential limits. Ni foil Voltage and current 20 kV and 10 mA Figure 11. Dialog box for determining the thickness of the nickel-plating layer.  Three JIS-type SS400 samples with dimensions of 10 × 40 × 40 mm were polished, electroplated for 6 to 30 min to obtain the thicknesses of 2 µm, 2.25 µm, 2.75 µm, 3.25 µm and 3.5 µm, and observed directly under a microscope (MS). The thicknesses were measured by the Eddy current technique at nine positions in the central area of each sample to obtain the average values and their standard deviations. Table 6 lists experimental conditions for XRD thickness measurements. Figure 11 shows the diffraction lines of the 3 µm plating sample. Table 7 compares the thickness of nickel-coating layers, measured using microscope techniques, Eddy current (EC), and XRD. The XRD technique allows determining 95% confidence limits of the computed values using a single measurement. The three techniques gave agreed thickness, and they are within the confidential limits. Ni foil Voltage and current 20 kV and 10 mA

Determination of Crystalline Grain Size
The well-known Scherrer formula below is used to calculate a grain size t [1]: where K is a constant referring to the cell geometry of lattice, where K = 0.94 for the cubic lattice; λ is X-ray wave length; B is the half-width of diffraction line; and θ B is the Bragg angle of a peak position. The experimental conditions for determining grain size of commercial synthetic zeolite ZSM-5 used in environment treatment are listed in Table 8. Table 9 represents the grain sizes of zeolite crystals, determined from XRD and observed using SEM techniques. It is shown that the XRD technique gives accurate results, in comparison to the SEM method.

Conclusions
The following conclusions are made: a. Various functions for determining major mechanical properties of crystalline materials were integrated into the computational program as shown in Section 3; b.
Generalized absorption functions for many measurement methods were embedded into the program to accurately determine the peak positions of the X-ray diffraction lines; c.
The properties of many kinds of materials measured using XRD are compared to the conventional techniques, and they showed high agreement; d.
The new computation program shows the high applicability of a universal X-ray diffraction device in evaluating crystalline materials.
Some proposals for further research include the evaluation of surface roughness or the measurement of various kinds of alloys and stainless steels.