def escoef(CrystalType, Ord): if Ord == 3: coef3, StrainMode, coef2 = essym.gen_strain_mode(CrystalType, Ord) return (coef3, coef2, StrainMode) elif Ord == 2: coef2, StrainMode = essym.gen_strain_mode(CrystalType, Ord) return coef2
def post(V0, Flag_Fig=1, Flag_Ord=3, EEnergy="EEnergy.txt", INPUT="INPUT"): #StrainMode = read_strainmode(STRAINMODE) (CrystalType, Ord, flag_se, StrainList) = get_post_param(INPUT) E = read_e(EEnergy) if flag_se == "e": coef_e, StrainMode = essym.gen_strain_mode(CrystalType, Ord) elif flag_se == "s": pass coef_fit = get_coef(StrainList / 100., E, V0, flag_se, Flag_Ord) #print coef_fit coef2 = coef_e.coef2 coef3 = coef_e.coef3 (C2, C3) = get_cij(coef_fit, coef2, coef3, flag_se) if Flag_Fig == 1: esfit.multiesplot(StrainList / 100., E, coef_fit, flag_se, Flag_Ord, V0) return (C2, C3)
def post(V0, Flag_Fig=1, Flag_Ord=3, EEnergy="EEnergy.txt", INPUT="INPUT"): ''' Post function for elastic3rd using INPUT and Energy file Parameters ---------- V0: float The volumn of the crystal, only required for Flag_SE = "e" Flag_Fig: 0 or 1 0 for don't show the fitting figures, 1 for show Flg_Ord: int 2-9, the order of polyfit used in fitting EEnergy: str The name of the energy file which is generated by Elastic3rd INPUT: str The file contain the input parameters, used in Elastic3rd Return ------ C2: np.ndarray SOECs, solved by Least squares method C3: np.ndarray TOECs, if the number of coefficient equals to the number of independent equations, then solved by solving the equations if the number of coefficient less than the number of independent equations, then solved by Least squares method ''' #StrainMode = read_strainmode(STRAINMODE) (CrystalType, Ord, flag_se, StrainList) = get_post_param(INPUT) E = read_e(EEnergy) if flag_se == "e": coef_e, StrainMode = essym.gen_strain_mode(CrystalType, Ord) elif flag_se == "s": pass coef_fit = get_coef(StrainList/100., E, V0, flag_se, Flag_Ord) #print coef_fit coef2 = coef_e.coef2 coef3 = coef_e.coef3 (C2, C3) = get_cij(coef_fit, coef2, coef3, flag_se) if Flag_Fig == 1: esfit.multiesplot(StrainList/100., E, coef_fit, flag_se, Flag_Ord, V0) return (C2, C3)
print( "####################Start test for symmetry module#########################" ) print("*************Start of the test for symmetry script*************") print("1. This is the test for a specific strain mode.") # Generate the coefficients for a given strain mode and specific crystal type CrystalType = 'c1' Ord = 3 Strain = np.array([[1, 0, 0, 2, 2, 0]]) (Cijk, StrainModeCoef, StrainMode) = essym.CoefForSingleMode(CrystalType, Ord, Strain) print(StrainMode) print("------End of test for a specific strain mode.------\n") print("2. This is the test for a specific crystal symmetry.") #Generate the coefficient for specific crystal type CrystalType = 'c1' Ord = 3 (StrainModeCoef, StrainMode) = essym.gen_strain_mode(CrystalType, Ord) print(StrainMode) print(StrainModeCoef.coef3) print(StrainModeCoef.coef2) print("------End of test for a given symmetry.------\n") print("*************End of test for symmetry script*************") #End of test for symmetry script print( "####################End test for symmetry module###########################" )