コード例 #1
0
 def test_init(self):
     c2 = NthOrderElasticTensor(self.c2.tolist())
     c3 = NthOrderElasticTensor(self.c3.tolist())
     c4 = NthOrderElasticTensor(np.zeros([3] * 8))
     for n, c in enumerate([c2, c3, c4]):
         self.assertEqual(c.order, n + 2)
     self.assertRaises(ValueError, NthOrderElasticTensor, np.zeros([3] * 5))
コード例 #2
0
 def setUp(self):
     with open(os.path.join(test_dir, 'test_toec_data.json')) as f:
         self.data_dict = json.load(f)
     self.strains = [Strain(sm) for sm in self.data_dict['strains']]
     self.pk_stresses = [Stress(d) for d in self.data_dict['pk_stresses']]
     self.c2 = NthOrderElasticTensor.from_voigt(self.data_dict["C2_raw"])
     self.c3 = NthOrderElasticTensor.from_voigt(self.data_dict["C3_raw"])
コード例 #3
0
 def setUp(self):
     with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "test_toec_data.json")) as f:
         self.data_dict = json.load(f)
     self.strains = [Strain(sm) for sm in self.data_dict["strains"]]
     self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]]
     self.c2 = NthOrderElasticTensor.from_voigt(self.data_dict["C2_raw"])
     self.c3 = NthOrderElasticTensor.from_voigt(self.data_dict["C3_raw"])
コード例 #4
0
 def setUp(self):
     with open(os.path.join(test_dir, 'test_toec_data.json')) as f:
         self.data_dict = json.load(f)
     self.strains = [Strain(sm) for sm in self.data_dict['strains']]
     self.pk_stresses = [Stress(d) for d in self.data_dict['pk_stresses']]
     self.c2 = NthOrderElasticTensor.from_voigt(self.data_dict["C2_raw"])
     self.c3 = NthOrderElasticTensor.from_voigt(self.data_dict["C3_raw"])
コード例 #5
0
 def test_from_diff_fit(self):
     c3 = NthOrderElasticTensor.from_diff_fit(
         self.strains,
         self.pk_stresses,
         eq_stress=self.data_dict["eq_stress"],
         order=3,
     )
     self.assertArrayAlmostEqual(c3.voigt, self.data_dict["C3_raw"], decimal=2)
コード例 #6
0
 def test_from_diff_fit(self):
     c3 = NthOrderElasticTensor.from_diff_fit(self.strains, self.pk_stresses,
                                              eq_stress = self.data_dict["eq_stress"],
                                              order=3)
     self.assertArrayAlmostEqual(c3.voigt, self.data_dict["C3_raw"], decimal=2)