本文整理匯總了Python中simphony.cuds.primitive_cell.PrimitiveCell.for_base_centered_monoclinic_lattice方法的典型用法代碼示例。如果您正苦於以下問題:Python PrimitiveCell.for_base_centered_monoclinic_lattice方法的具體用法?Python PrimitiveCell.for_base_centered_monoclinic_lattice怎麽用?Python PrimitiveCell.for_base_centered_monoclinic_lattice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類simphony.cuds.primitive_cell.PrimitiveCell
的用法示例。
在下文中一共展示了PrimitiveCell.for_base_centered_monoclinic_lattice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_primitive_cell_for_base_centered_monoclinic_lattice
# 需要導入模塊: from simphony.cuds.primitive_cell import PrimitiveCell [as 別名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_base_centered_monoclinic_lattice [as 別名]
def test_primitive_cell_for_base_centered_monoclinic_lattice(self):
with self.assertRaises(ValueError):
PrimitiveCell.for_base_centered_monoclinic_lattice(
-1, -2, -3, 0.5)
with self.assertRaises(ValueError):
PrimitiveCell.for_base_centered_monoclinic_lattice(
1, 2, 3, np.pi)
p1 = (self.a*np.sin(self.beta), 0, self.a*np.cos(self.beta))
p2 = (self.a*np.sin(self.beta)/2, self.b/2,
self.a*np.cos(self.beta)/2)
pc = PrimitiveCell.for_base_centered_monoclinic_lattice(
self.a, self.b, self.c, self.beta)
self.assertIsInstance(pc, PrimitiveCell)
self.assertEqual(pc.bravais_lattice,
BravaisLattice.BASE_CENTERED_MONOCLINIC)
assert_array_equal(pc.p1, p1)
assert_array_equal(pc.p2, p2)
assert_array_equal(pc.p3, (0, 0, self.c))
示例2: make_base_centered_monoclinic_lattice
# 需要導入模塊: from simphony.cuds.primitive_cell import PrimitiveCell [as 別名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_base_centered_monoclinic_lattice [as 別名]
def make_base_centered_monoclinic_lattice(name, hs, beta, size,
origin=(0, 0, 0)):
"""Create and return a 3D base-centered monoclinic lattice.
Parameters
----------
name : str
hs : float
lattice spacing in each axis direction
beta: float
angle between the (conventional) unit cell edges (in radians),
size : int[3]
Number of lattice nodes in each axis direction.
origin : float[3], default value = (0, 0, 0)
lattice origin
Returns
-------
lattice : Lattice
A reference to a Lattice object.
"""
pc = PrimitiveCell.for_base_centered_monoclinic_lattice(
hs[0], hs[1], hs[2], beta)
return Lattice(name, pc, size, origin)