# doc-cache created by Octave 9.2.0
# name: cache
# type: cell
# rows: 3
# columns: 18
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
calcAnisotropy


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 128
    Ax = Xstd/Xmean, if the sign of Xmax and Xmin is same.
    Ax = ∞         , If the sign of Xmax and Xmin is opposite.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
    Ax = Xstd/Xmean, if the sign of Xmax and Xmin is same.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
calcBulk


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 642
  ========================== Bulk Modulus ================================
    Input parameter: 
                    �� x, Initial value of optimization function.
                    �� S, Compliance matrix S
                    �� n2d, mesh number of [0,2��] in 2D calculation
                    �� planeC, 2D plane, such as plane (111)
                    �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D.
    Out parameter: 
                    �� P, return Poisson's Ratio. 
                    �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ========================== Bulk Modulus ================================
 ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
calcCauchyPressure


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 111
 Average Cauchy’s pressure based on Wang's model
 CP/B  = -1.620*G/B + 0.955
 ref: RSC Adv., 2016, 6, 44561.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 Average Cauchy’s pressure based on Wang's model
 CP/B  = -1.620*G/B + 0.95...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
calcCompress


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 640
  ====================== Linear Compressibility ===========================
    Input parameter:
                    �� x, Initial value of optimization function.
                    �� S, Compliance matrix S
                    �� n2d, mesh number of [0,2��] in 2D calculation
                    �� planeC, 2D plane, such as plane (111)
                    �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D.
    Out parameter:
                    �� P, return Poisson's Ratio.
                    �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ====================== Linear Compressibility ===========================
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
calcFractureToughness


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2239
  ========================== Fracture Toughness =============================
    Input parameter:
                    Mt is a struct variable:
                                             KIC.model:
                                                        if KIC.model = 'M'/'Mazhnik', selecting Mazhnik's model, U = E (Young's modulus), V = P (Poisson's Ratio)
                                                        if KIC.model = 'N'/'Niu', selecting Niu's model, U = G (shear modulus), V = B (bulk modulus)
                                             KIC.V0    - V0 is the volume per atom;
                                             KIC.gEFr  - gEFr is the relative DOS at the Fermi level;
                                             KIC.material  - 'IC' refers to ionic or covalent crystals; 'PM' refers to pure metals; 'IM' refers to intermetallics;
                    For intermetallics AmBn: KIC.m     - m is the number in the chemical formula AmBn;
                                             KIC.n     - n is the number in the chemical formula AmBn;
                                             KIC.XA    - XA refers to the Allen scale electronegativity of elements A;
                                             KIC.XB    - XB refers to the Allen scale electronegativity of elements B;
                                            
    Out parameter: 
                    —— Kic, return Fracture Toughness [MPa*m^(1/2)]
    refs:
        Niu's model: J. Appl. Phys. 125, 065105 (2019)
        Kic[Niu] = (1+α)*V0^(1/6)*G*(B/G)^(1/2).
        For ionic or covalent crystals: α = 0;
        For pure metals:                α = 43*(g(E_F)_R)^(1/4);
        For intermetallics:             α = 43*(g(E_F)_R)^(1/4)*f_EN, where
        f_EN = β/[1+((C1_m*C1_n)/C2_(m+n))*sqrt((X_A-X_B)^2/(X_A*X_B))]^γ.
        
        
        Mazhnik's model: J. Appl. Phys. 126, 125109 (2019)
        Kic[Mazhnik] = fEN*α^(-1/2)*V0^(1/6)*[α(V)*E]^(3/2).
        For ionic or covalent crystals: α = 8840,  fEN = 1, 
        For pure metals:                α = 2,     fEN = 1, 
        For intermetallics:             α = 2,     f_EN = β/[1+((C1_m*C1_n)/C2_(m+n))*sqrt((X_A-X_B)^2/(X_A*X_B))]^γ.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ========================== Fracture Toughness =============================...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
calcHardness


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 925
  ========================== Vickers hardness =============================
    Input parameter:
                    if flag = 'M', selecting Mazhnik's model, U = E (Young's modulus), V = P (Poisson's Ratio)
                    if flag = 'C', selecting Chen's model, U = G (shear modulus), V = B (bulk modulus)
                    if flag = 'T', selecting Tian's model, U = G (shear modulus), V = B (bulk modulus)
    Out parameter: 
                    —— Hv, return Vickers hardness. 
    refs:
        Mazhnik's model: J. Appl. Phys. 126, 125109 (2019)
        Hv[Mazhnik] = 0.096*((1-8.5*v+19.5*v^2)*E)/(1-7.5*v+12.2*v^2+19.6*v^3).

        Chen's model: Intermetallics 19 (2011) 1275e1281
        Hv[chen]    = 2*(k^2*G)^0.585-3, where k = G/B.

        Tian's model: Int. Journal of Refractory Metals and Hard Materials 33 (2012) 93�C106
        Hv[Tian]    = 0.92*k^1.137*G^0.708, where k = G/B.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ========================== Vickers hardness =============================
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
calcPoisson


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 740
   ========================= Poisson's Ratio ==============================
    Input parameter: 
                    - x, Initial value of optimization function.
                    - nChi, mesh number of azimuth -
                    - S1111, 
                    - S, Compliance matrix S
                    - n2d, mesh number of [0,2-] in 2D calculation
                    - planeC, 2D plane, such as plane (111)
                    - flag, 'max', 'min' or 'neg'.
                    - flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D.
    Out parameter: 
                    - P, return Poisson's Ratio. 
                    - negFlag, if there is a negative Poisson's ratio, then true, otherwise false.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
   ========================= Poisson's Ratio ==============================
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
calcPugh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 518
  ==========================  Pugh ratio =============================
    Input parameter:
                   B - bulk modulus
                   G - shear modulus,
                   Pr = B/G, where B is bulk modulus, G is shear modulus.
                   if Pr > 1.75
                            Re = 'Ductile';
                   else
                            Re = 'Brittle';
                   end
    Out parameter: 
                   Pr, return  Pugh's ratio. 
    refs:
                    



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ==========================  Pugh ratio =============================
    I...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
calcPwaveModulus


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 274
  ==========================  Pugh ratio =============================
    Input parameter:
                   B - bulk modulus
                   G - shear modulus,
    Out parameter: 
                   Pw = B+4*G/3, P-wave modulus.
    refs:
                    



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ==========================  Pugh ratio =============================
    I...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
calcShear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 710
  ========================== Shear Modulus ================================
    Input parameter: 
                     x, Initial value of optimization function.
                     nChi, mesh number of azimuth ��
                     S, Compliance matrix S
                     n2d, mesh number of [0,2��] in 2D calculation
                     planeC, 2D plane, such as plane (111)
                     flag, 'max', 'min' or 'neg'.
                     flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D.
    Out parameter: 
                     P, return Poisson's Ratio. 
                     negFlag, if there is a negative Poisson's ratio, then true, otherwise false.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ========================== Shear Modulus ================================
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
calcYoung


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 643
  ========================== Youngs Modulus ===============================
    Input parameter: 
                    �� x, Initial value of optimization function.
                    �� S, Compliance matrix S
                    �� n2d, mesh number of [0,2��] in 2D calculation
                    �� planeC, 2D plane, such as plane (111)
                    �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D.
    Out parameter: 
                    �� P, return Poisson's Ratio. 
                    �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  ========================== Youngs Modulus ===============================
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
checkStability


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 677
   ========= Check the mechanical stability of crystal structure ==========
    Input parameter: 
                      filename, the file name that contains the file path.
                      N, mesh number of azimuth   and ��
                      n2d, mesh number of [0,2π] in 2D calculation
                      nChi, mesh number of azimuth
                      Re, initialized output results
                      teps, the difference between a number and 0 or 1, if less than or equal to teps, it is considered to be equal to 0 or 1.
    Out parameter: 
                      Re, output results include various crystal mechanical parameters Or empty. 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
   ========= Check the mechanical stability of crystal structure ==========
...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
getBondType


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
  if Cp < 0, covalent bond compounds,else ionic/metallic bonds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
  if Cp < 0, covalent bond compounds,else ionic/metallic bonds




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
getCrystalType


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 751
 Judging the type of crystal system according to the stiffness matrix C
 Cubic        -- 3 independent elastic constants: C11, C44, C12;
 Hexagonal    -- 5 independent elastic constants: C11, C33, C44, C12, C13
 Tetragonal   -- 7 independent elastic constants: C11, C33, C44, C66, C12, C13, C16
 Trigonal     -- 7 independent elastic constants: C11, C33, C44, C12, C13, C14, C15
 Orthorhombic -- 9 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C23
 Monoclinic   -- 13 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C23, C15, C25, C35, C46
 Triclinic    -- 21  independent elastic constants: C11, C12, C13, C14, C15, C16,C22, C23, C24, C25, C26, C33, C34, C35, C36, C44, C45, C46, C55, C56, C66



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 Judging the type of crystal system according to the stiffness matrix C
 Cub...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
getDuctility


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
 P = B/G, where B is bulk modulus, G is shear modulus.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 P = B/G, where B is bulk modulus, G is shear modulus.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
isNegativePoisson


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 490
    Input:
         Dir - Direction need to be checked, size: 1*3 or 3*1.
    Output
         negFlag: if true  (Negative Poisson’s ratio in Dir);
                  if false (Positive Poisson’s ratio in Dir).
         arealP - Areal Poisson’s ratio in plane(Dir).

    Ref: Guo, C. Y . and Wheeler, L., J. Mech. Phys. Solids, 54, 690–707,2006.
    Areal Poisson’s ratio: The average of all values of Poisson’s ratio taken within the plane normal to a chosen direction.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
    Input:
         Dir - Direction need to be checked, size: 1*3 or 3*1.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
isStable


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 494
    Input parameter: C, which is a 6*6 Stifness matrix.
    Out parameter: flag, If stable, flag = true; else, flag = false.

	The necessary and sufficient stability conditions for single crystal:
	Refs:
	[1] T.C.T. TING, Anisotropic Elasticity: Theory and Applications (Oxford University Press,1996, Page 18-21).
    [2] F��lix Mouhat and Francois-Xavier Coudert, PHYSICAL REVIEW B 90, 224104 (2014).
    [3] G V Sin��ko and N A Smirnov 2002 J. Phys.: Condens. Matter 14 6989.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
    Input parameter: C, which is a 6*6 Stifness matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
mechanics


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 356
   ========= Calculation of crystal mechanical parameters ==========
    Input parameter:
                      inputData, input data including stiffness matrix C, etc
                      filename, the file name that contains the file path.
    Out parameter:
                      Re, output results include various crystal mechanical parameters.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
   ========= Calculation of crystal mechanical parameters ==========
    Inp...





