本文整理汇总了Python中diffpy.pdffit2.PdfFit.bond_length_atoms方法的典型用法代码示例。如果您正苦于以下问题:Python PdfFit.bond_length_atoms方法的具体用法?Python PdfFit.bond_length_atoms怎么用?Python PdfFit.bond_length_atoms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.pdffit2.PdfFit
的用法示例。
在下文中一共展示了PdfFit.bond_length_atoms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPdfFit
# 需要导入模块: from diffpy.pdffit2 import PdfFit [as 别名]
# 或者: from diffpy.pdffit2.PdfFit import bond_length_atoms [as 别名]
#.........这里部分代码省略.........
self.assertRaises(pdffit2.unassignedError, self.P.pdesel, -100)
return
#
# def test_selectAtomType(self):
# """check PdfFit.selectAtomType()
# """
# return
#
# def test_selectAtomIndex(self):
# """check PdfFit.selectAtomIndex()
# """
# return
#
# def test_selectAll(self):
# """check PdfFit.selectAll()
# """
# return
#
# def test_selectNone(self):
# """check PdfFit.selectNone()
# """
# return
def test_bond_angle(self):
"""check PdfFit.bond_angle()
"""
self.P.read_struct(datafile('Ni.stru'))
a, e = self.P.bond_angle(1, 2, 3)
self.assertAlmostEqual(60.0, a, self.places)
self.assertRaises(ValueError, self.P.bond_angle, 0, 1, 2)
self.assertRaises(ValueError, self.P.bond_angle, 1, 2, 7)
return
def test_bond_length_atoms(self):
"""check PdfFit.bond_length_atoms()
"""
self.P.read_struct(datafile('Ni.stru'))
self.P.read_struct(datafile('PbScW25TiO3.stru'))
dij, ddij = self.P.bond_length_atoms(1, 5)
self.assertAlmostEqual(4.03635, dij, self.places)
self.P.setphase(1)
self.assertRaises(ValueError, self.P.bond_length_atoms, 1, 5)
return
def test_bond_length_types(self):
"""check PdfFit.bond_length_types()
"""
self.P.read_struct(datafile('Ni.stru'))
self.P.read_struct(datafile('PbScW25TiO3.stru'))
dPbO = self.P.bond_length_types('Pb', 'O', 0.1, 3.0)
# check if keys are present
self.failUnless('dij' in dPbO)
self.failUnless('ddij' in dPbO)
self.failUnless('ij0' in dPbO)
self.failUnless('ij1' in dPbO)
# check if they have the same length
npts = len(dPbO['dij'])
self.assertEqual(npts, len(dPbO['ddij']))
self.assertEqual(npts, len(dPbO['ij0']))
self.assertEqual(npts, len(dPbO['ij1']))
# 8 Pb atoms have coordination 12 in perovskite structure
self.assertEqual(8*12, len(dPbO['dij']))
self.P.setphase(1)
dfcc = self.P.bond_length_types('ALL', 'ALL', 0.1, 2.6)
# 4 Ni atoms with coordination 12
self.assertEqual(4*12, len(dfcc['dij']))