本文整理汇总了Python中simphony.cuds.primitive_cell.PrimitiveCell.for_body_centered_cubic_lattice方法的典型用法代码示例。如果您正苦于以下问题:Python PrimitiveCell.for_body_centered_cubic_lattice方法的具体用法?Python PrimitiveCell.for_body_centered_cubic_lattice怎么用?Python PrimitiveCell.for_body_centered_cubic_lattice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simphony.cuds.primitive_cell.PrimitiveCell
的用法示例。
在下文中一共展示了PrimitiveCell.for_body_centered_cubic_lattice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_primitive_cell_for_body_centered_cubic_lattice
# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_body_centered_cubic_lattice [as 别名]
def test_primitive_cell_for_body_centered_cubic_lattice(self):
with self.assertRaises(ValueError):
PrimitiveCell.for_body_centered_cubic_lattice(-1)
pc = PrimitiveCell.for_body_centered_cubic_lattice(self.a)
self.assertIsInstance(pc, PrimitiveCell)
self.assertEqual(pc.bravais_lattice,
BravaisLattice.BODY_CENTERED_CUBIC)
assert_array_equal(pc.p1, (self.a, 0, 0))
assert_array_equal(pc.p2, (0, self.a, 0))
assert_array_equal(pc.p3, (self.a/2, self.a/2, self.a/2))
示例2: make_body_centered_cubic_lattice
# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_body_centered_cubic_lattice [as 别名]
def make_body_centered_cubic_lattice(name, h, size, origin=(0, 0, 0)):
"""Create and return a 3D body-centered cubic lattice.
Parameters
----------
name : str
h : float
lattice spacing
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_body_centered_cubic_lattice(h)
return Lattice(name, pc, size, origin)
示例3: tuple
# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_body_centered_cubic_lattice [as 别名]
[0, 0, 1]])
# rotate y-z for angle2 about x
yz_rot = numpy.array([[1, 0, 0],
[0, numpy.cos(angle2), numpy.sin(angle2)],
[0, numpy.sin(-angle2), numpy.cos(angle2)]])
# rotate x-y, then y-z
xyz_rot = numpy.inner(xy_rot, yz_rot)
return tuple(numpy.inner(xyz_rot, p) for p in (pc.p1, pc.p2, pc.p3))
# a cubic lattice on a rotated coordinates represented using PolyData
pcs = rotate_primitive_cell(PrimitiveCell.for_cubic_lattice(1.))
datasets.append(create_polydata_from_pc(*pcs))
# BCC lattice in a rotated coor. sys.
pcs = rotate_primitive_cell(PrimitiveCell.for_body_centered_cubic_lattice(1.))
datasets.append(create_polydata_from_pc(*pcs))
# FCC lattice in a rotated coor. sys.
pcs = rotate_primitive_cell(PrimitiveCell.for_face_centered_cubic_lattice(1.))
datasets.append(create_polydata_from_pc(*pcs))
# rhombohedral lattice in a rotated coor. sys.
pcs = rotate_primitive_cell(PrimitiveCell.for_rhombohedral_lattice(1., 1.))
datasets.append(create_polydata_from_pc(*pcs))
# tetragonal lattice in a rotated coor. sys.
pcs = rotate_primitive_cell(PrimitiveCell.for_tetragonal_lattice(0.5, 1.))
datasets.append(create_polydata_from_pc(*pcs))
# body_centered_tetragonal lattice in a rotated coor. sys.