在我的論文中,會先介紹我所使用的第一原理計算工具CASTEP,以及了解二倍頻係數程式與其所採用的公式對照,以及它如何使用CASTEP的光學計算結果獲得二倍頻係數,進而使我了解要如何使用這光學計算結果應用在我要做的計算全頻譜的三倍頻係數程式,並且介紹程式中所使用到的近似或是轉換公式,最後再與其他研究群所做的結果做比較。 In my thesis, I will first introduce CASTEP, a first principle calculation program. Then I will describe how I learned the relation between the equation of second harmonic generation (SHG) and the tool SHG code, and how to use it to obtain the SHG coefficients form a CASTEP optics calculation result. Finally, I use this experience to implement the equation of the third harmonic generation (THG) into a computer code. I will introduce the approximate or conversion formulas that I use in my code, and compare my results with them from other research groups.