本文整理汇总了Python中pymatgen.analysis.local_env.CrystalNN类的典型用法代码示例。如果您正苦于以下问题:Python CrystalNN类的具体用法?Python CrystalNN怎么用?Python CrystalNN使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CrystalNN类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_noble_gas_material
def test_noble_gas_material(self):
cnn = CrystalNN()
self.assertEqual(cnn.get_cn(self.he_bcc, 0, use_weights=False), 0)
cnn = CrystalNN(distance_cutoffs=(1.25, 5))
self.assertEqual(cnn.get_cn(self.he_bcc, 0, use_weights=False), 8)
示例2: test_discrete_cn
def test_discrete_cn(self):
cnn = CrystalNN()
cn_array = []
expected_array = [6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
for idx, _ in enumerate(self.lifepo4):
cn_array.append(cnn.get_cn(self.lifepo4, idx))
self.assertSequenceEqual(cn_array, expected_array)
示例3: test_weighted_cn
def test_weighted_cn(self):
cnn = CrystalNN(weighted_cn=True)
cn_array = []
expected_array = [6.0449, 6.0431, 6.0449, 6.0431, 5.6262, 5.6253,
5.6258, 5.6258, 3.9936, 3.9936, 3.9936, 3.9936,
3.9183, 3.7318, 3.7259, 3.781, 3.781, 3.7259,
3.7318, 3.9183, 3.9183, 3.7318, 3.7248, 3.7819,
3.7819, 3.7248, 3.7318, 3.9183]
for idx, _ in enumerate(self.lifepo4):
cn_array.append(cnn.get_cn(self.lifepo4, idx, use_weights=True))
self.assertArrayAlmostEqual(expected_array, cn_array, 2)
示例4: test_weighted_cn
def test_weighted_cn(self):
cnn = CrystalNN(weighted_cn=True)
cn_array = []
expected_array = [5.8962, 5.8996, 5.8962, 5.8996, 5.7195, 5.7195,
5.7202, 5.7194, 4.0012, 4.0012, 4.0012, 4.0009,
3.3897, 3.2589, 3.1218, 3.1914, 3.1914, 3.1218,
3.2589, 3.3897, 3.3897, 3.2589, 3.1207, 3.1924,
3.1915, 3.1207, 3.2598, 3.3897]
for idx, _ in enumerate(self.lifepo4):
cn_array.append(cnn.get_cn(self.lifepo4, idx, use_weights=True))
self.assertArrayAlmostEqual(expected_array, cn_array, 2)
示例5: test_weighted_cn
def test_weighted_cn(self):
cnn = CrystalNN(weighted_cn=True)
cn_array = []
expected_array = [5.863, 5.8716, 5.863 , 5.8716, 5.7182, 5.7182, 5.719,
5.7181, 3.991 , 3.991 , 3.991 , 3.9907, 3.5997, 3.525,
3.4133, 3.4714, 3.4727, 3.4133, 3.525 , 3.5997,
3.5997, 3.525 , 3.4122, 3.4738, 3.4728, 3.4109,
3.5259, 3.5997]
for idx, _ in enumerate(self.lifepo4):
cn_array.append(cnn.get_cn(self.lifepo4, idx, use_weights=True))
self.assertArrayAlmostEqual(expected_array, cn_array, 2)
示例6: test_shifted_sites
def test_shifted_sites(self):
cnn = CrystalNN()
sites = [[0., 0.2, 0.2], [0, 0, 0]]
struct = Structure([7, 0, 0, 0, 7, 0, 0, 0, 7], ['I'] * len(sites), sites)
bonded_struct = cnn.get_bonded_structure(struct)
sites_shifted = [[1., 0.2, 0.2], [0, 0, 0]]
struct_shifted = Structure([7, 0, 0, 0, 7, 0, 0, 0, 7], ['I'] * len(sites_shifted),
sites_shifted)
bonded_struct_shifted = cnn.get_bonded_structure(struct_shifted)
self.assertEqual(len(bonded_struct.get_connected_sites(0)),
len(bonded_struct_shifted.get_connected_sites(0)))
示例7: test_sanity
def test_sanity(self):
with self.assertRaises(ValueError):
cnn = CrystalNN()
cnn.get_cn(self.lifepo4, 0, use_weights=True)
with self.assertRaises(ValueError):
cnn = CrystalNN(weighted_cn=True)
cnn.get_cn(self.lifepo4, 0, use_weights=False)
示例8: setUp
def setUp(self):
cnn = CrystalNN()
self.lifepo = cnn.get_bonded_structure(self.get_structure('LiFePO4'))
self.graphite = cnn.get_bonded_structure(self.get_structure('Graphite'))
self.cscl = cnn.get_bonded_structure(self.get_structure('CsCl'))
tricky_structure = Structure(
[5.79, 0., 0., 0, 5.79, 0., 0., 0., 5.79],
['B', 'C', 'C', 'C', 'C', 'N', 'N', 'N', 'N', 'Ag'],
[[0.0, 0.0, 0.0], [0.842, 0.842, 0.842], [0.158, 0.842, 0.158],
[0.158, 0.158, 0.842], [0.842, 0.158, 0.158],
[0.726, 0.726, 0.726], [0.274, 0.726, 0.274],
[0.274, 0.274, 0.726], [0.726, 0.274, 0.274], [0.5, 0.5, 0.5]])
self.tricky_structure = cnn.get_bonded_structure(tricky_structure)
mol_structure = Structure(
[[-2.316, 2.316, 2.160], [2.316, -2.316, 2.160],
[2.316, 2.316, -2.160]],
['H', 'C', 'N'],
[[0.752, 0.752, 0.000], [0.004, 0.004, 0.], [0.272, 0.272, 0.]])
self.mol_structure = cnn.get_bonded_structure(mol_structure)
示例9: test_x_diff_weight
def test_x_diff_weight(self):
cnn = CrystalNN(weighted_cn=True, x_diff_weight=0)
self.assertAlmostEqual(cnn.get_cn(self.lifepo4, 0, use_weights=True),
5.9522, 2)
示例10: test_cation_anion
def test_cation_anion(self):
cnn = CrystalNN(weighted_cn=True, cation_anion=True)
self.assertAlmostEqual(cnn.get_cn(self.lifepo4, 0, use_weights=True),
5.8630, 2)
示例11: test_fixed_length
def test_fixed_length(self):
cnn = CrystalNN(fingerprint_length=30)
nndata = cnn.get_nn_data(self.lifepo4, 0)
self.assertEqual(len(nndata.cn_weights), 30)
self.assertEqual(len(nndata.cn_nninfo), 30)