本文整理汇总了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]])
示例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]])
示例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}}])
示例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., ]]))