當前位置: 首頁>>代碼示例>>Python>>正文


Python Strain.from_deformation方法代碼示例

本文整理匯總了Python中pymatgen.analysis.elasticity.strain.Strain.from_deformation方法的典型用法代碼示例。如果您正苦於以下問題:Python Strain.from_deformation方法的具體用法?Python Strain.from_deformation怎麽用?Python Strain.from_deformation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymatgen.analysis.elasticity.strain.Strain的用法示例。


在下文中一共展示了Strain.from_deformation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from pymatgen.analysis.elasticity.strain import Strain [as 別名]
# 或者: from pymatgen.analysis.elasticity.strain.Strain import from_deformation [as 別名]
    def setUp(self):
        self.norm_str = Strain.from_deformation([[1.02, 0, 0], [0, 1, 0], [0, 0, 1]])
        self.ind_str = Strain.from_deformation([[1, 0.02, 0], [0, 1, 0], [0, 0, 1]])

        self.non_ind_str = Strain.from_deformation([[1, 0.02, 0.02], [0, 1, 0], [0, 0, 1]])

        with warnings.catch_warnings(record=True):
            warnings.simplefilter("always")
            self.no_dfm = Strain([[0.0, 0.01, 0.0], [0.01, 0.0002, 0.0], [0.0, 0.0, 0.0]])
開發者ID:shyamd,項目名稱:pymatgen,代碼行數:11,代碼來源:test_strain.py

示例2: test_from_strain_stress_list

# 需要導入模塊: from pymatgen.analysis.elasticity.strain import Strain [as 別名]
# 或者: from pymatgen.analysis.elasticity.strain.Strain import from_deformation [as 別名]
 def test_from_strain_stress_list(self):
     strain_list = [Strain.from_deformation(def_matrix)
                    for def_matrix in self.def_stress_dict['deformations']]
     stress_list = [stress for stress in self.def_stress_dict['stresses']]
     with warnings.catch_warnings(record = True):
         et_fl = -0.1*ElasticTensor.from_strain_stress_list(strain_list, stress_list)
         self.assertArrayAlmostEqual(et_fl.round(2),
                                     [[59.29, 24.36, 22.46, 0, 0, 0],
                                      [28.06, 56.91, 22.46, 0, 0, 0],
                                      [28.06, 25.98, 54.67, 0, 0, 0],
                                      [0, 0, 0, 26.35, 0, 0],
                                      [0, 0, 0, 0, 26.35, 0],
                                      [0, 0, 0, 0, 0, 26.35]])
開發者ID:jwyoon89,項目名稱:pymatgen,代碼行數:15,代碼來源:test_elastic.py

示例3: run_task

# 需要導入模塊: from pymatgen.analysis.elasticity.strain import Strain [as 別名]
# 或者: from pymatgen.analysis.elasticity.strain.Strain import from_deformation [as 別名]
    def run_task(self, fw_spec):
        v, _ = get_vasprun_outcar(self.get("calc_dir", "."), parse_dos=False, parse_eigen=False)
        stress = v.ionic_steps[-1]['stress']
        defo = self['deformation']
        d_ind = np.nonzero(defo - np.eye(3))
        delta = Decimal((defo - np.eye(3))[d_ind][0])
        # Shorthand is d_X_V, X is voigt index, V is value
        dtype = "_".join(["d", str(reverse_voigt_map[d_ind][0]),
                          "{:.0e}".format(delta)])
        strain = Strain.from_deformation(defo)
        defo_dict = {'deformation_matrix': defo,
                     'strain': strain.tolist(),
                     'stress': stress}

        return FWAction(mod_spec=[{'_set': {
            'deformation_tasks->{}'.format(dtype): defo_dict}}])
開發者ID:hackingmaterials,項目名稱:MatMethods,代碼行數:18,代碼來源:glue_tasks.py

示例4: test_energy_density

# 需要導入模塊: from pymatgen.analysis.elasticity.strain import Strain [as 別名]
# 或者: from pymatgen.analysis.elasticity.strain.Strain import from_deformation [as 別名]
    def test_energy_density(self):

        film_elac = ElasticTensor.from_voigt([
            [324.32,  187.3,   170.92,    0.,      0.,      0.],
            [187.3,   324.32,  170.92,    0.,      0.,      0.],
            [170.92,  170.92,  408.41,    0.,      0.,      0.],
            [0.,      0.,      0.,    150.73,    0.,      0.],
            [0.,      0.,      0.,      0.,    150.73,    0.],
            [0.,      0.,      0.,      0.,      0.,    238.74]])

        dfm = Deformation([[ -9.86004855e-01,2.27539582e-01,-4.64426035e-17],
                           [ -2.47802121e-01,-9.91208483e-01,-7.58675185e-17],
                           [ -6.12323400e-17,-6.12323400e-17,1.00000000e+00]])

        self.assertAlmostEqual(film_elac.energy_density(dfm.green_lagrange_strain),
            0.00125664672793)

        film_elac.energy_density(Strain.from_deformation([[ 0.99774738,  0.11520994, -0.        ],
                                        [-0.11520994,  0.99774738,  0.        ],
                                        [-0.,         -0.,          1.,        ]]))
開發者ID:czhengsci,項目名稱:pymatgen,代碼行數:22,代碼來源:test_elastic.py


注:本文中的pymatgen.analysis.elasticity.strain.Strain.from_deformation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。