當前位置: 首頁>>代碼示例>>Python>>正文


Python PrimitiveCell.for_face_centered_cubic_lattice方法代碼示例

本文整理匯總了Python中simphony.cuds.primitive_cell.PrimitiveCell.for_face_centered_cubic_lattice方法的典型用法代碼示例。如果您正苦於以下問題:Python PrimitiveCell.for_face_centered_cubic_lattice方法的具體用法?Python PrimitiveCell.for_face_centered_cubic_lattice怎麽用?Python PrimitiveCell.for_face_centered_cubic_lattice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在simphony.cuds.primitive_cell.PrimitiveCell的用法示例。


在下文中一共展示了PrimitiveCell.for_face_centered_cubic_lattice方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_primitive_cell_for_face_centered_cubic_lattice

# 需要導入模塊: from simphony.cuds.primitive_cell import PrimitiveCell [as 別名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_face_centered_cubic_lattice [as 別名]
    def test_primitive_cell_for_face_centered_cubic_lattice(self):
        with self.assertRaises(ValueError):
            PrimitiveCell.for_face_centered_cubic_lattice(-1)

        pc = PrimitiveCell.for_face_centered_cubic_lattice(self.a)
        self.assertIsInstance(pc, PrimitiveCell)
        self.assertEqual(pc.bravais_lattice,
                         BravaisLattice.FACE_CENTERED_CUBIC)
        assert_array_equal(pc.p1, (0, self.a/2, self.a/2))
        assert_array_equal(pc.p2, (self.a/2, 0, self.a/2))
        assert_array_equal(pc.p3, (self.a/2, self.a/2, 0))
開發者ID:simphony,項目名稱:simphony-common,代碼行數:13,代碼來源:test_primitive_cell.py

示例2: make_face_centered_cubic_lattice

# 需要導入模塊: from simphony.cuds.primitive_cell import PrimitiveCell [as 別名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_face_centered_cubic_lattice [as 別名]
def make_face_centered_cubic_lattice(name, h, size, origin=(0, 0, 0)):
    """Create and return a 3D face-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_face_centered_cubic_lattice(h)
    return Lattice(name, pc, size, origin)
開發者ID:kitchoi,項目名稱:simphony-common,代碼行數:22,代碼來源:lattice.py

示例3: tuple

# 需要導入模塊: from simphony.cuds.primitive_cell import PrimitiveCell [as 別名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_face_centered_cubic_lattice [as 別名]
                          [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.
factory = PrimitiveCell.for_body_centered_tetragonal_lattice
pcs = rotate_primitive_cell(factory(1., 0.5))
datasets.append(create_polydata_from_pc(*pcs))
開發者ID:simphony,項目名稱:simphony-mayavi,代碼行數:32,代碼來源:lattice_from_dataset_example.py


注:本文中的simphony.cuds.primitive_cell.PrimitiveCell.for_face_centered_cubic_lattice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。