当前位置: 首页>>代码示例>>Python>>正文


Python PrimitiveCell.for_hexagonal_lattice方法代码示例

本文整理汇总了Python中simphony.cuds.primitive_cell.PrimitiveCell.for_hexagonal_lattice方法的典型用法代码示例。如果您正苦于以下问题:Python PrimitiveCell.for_hexagonal_lattice方法的具体用法?Python PrimitiveCell.for_hexagonal_lattice怎么用?Python PrimitiveCell.for_hexagonal_lattice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simphony.cuds.primitive_cell.PrimitiveCell的用法示例。


在下文中一共展示了PrimitiveCell.for_hexagonal_lattice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_primitive_cell_for_hexagonal_lattice

# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_hexagonal_lattice [as 别名]
    def test_primitive_cell_for_hexagonal_lattice(self):
        with self.assertRaises(ValueError):
            PrimitiveCell.for_hexagonal_lattice(-1, -2)

        pc = PrimitiveCell.for_hexagonal_lattice(self.a, self.c)
        self.assertIsInstance(pc, PrimitiveCell)
        self.assertEqual(pc.bravais_lattice,
                         BravaisLattice.HEXAGONAL)
        assert_array_equal(pc.p1, (self.a, 0, 0))
        assert_array_equal(pc.p2, (self.a/2, self.a*np.sqrt(3)/2, 0))
        assert_array_equal(pc.p3, (0, 0, self.c))
开发者ID:simphony,项目名称:simphony-common,代码行数:13,代码来源:test_primitive_cell.py

示例2: make_hexagonal_lattice

# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_hexagonal_lattice [as 别名]
def make_hexagonal_lattice(name, hxy, hz, size, origin=(0, 0, 0)):
    """Create and return a 3D hexagonal lattice.

    Parameters
    ----------
    name : str
    hxy : float
        lattice spacing in the xy-plane
    hz : float
        lattice spacing in the z-direction
    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_hexagonal_lattice(hxy, hz)
    return Lattice(name, pc, size, origin)
开发者ID:kitchoi,项目名称:simphony-common,代码行数:24,代码来源:lattice.py

示例3: rotate_primitive_cell

# 需要导入模块: from simphony.cuds.primitive_cell import PrimitiveCell [as 别名]
# 或者: from simphony.cuds.primitive_cell.PrimitiveCell import for_hexagonal_lattice [as 别名]
# 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))

# hexagonal lattice in a rotated coor. sys.
pcs = rotate_primitive_cell(PrimitiveCell.for_hexagonal_lattice(1., 0.5))
datasets.append(create_polydata_from_pc(*pcs))

# orthorhombic lattice in a rotated coor. sys.
factory = PrimitiveCell.for_orthorhombic_lattice
pcs = rotate_primitive_cell(factory(0.5, 0.8, 1.,))
datasets.append(create_polydata_from_pc(*pcs))

# orthorhombic lattice in a rotated coor. sys.
# although the primitive cell has BravaisLattice.ORTHORHOMBIC attribute,
# two of the edges are the same lengths,
# so it would be recognised as at tetragonal lattice
factory = PrimitiveCell.for_orthorhombic_lattice
pcs = rotate_primitive_cell(factory(0.5, 1., 1.,))
datasets.append(create_polydata_from_pc(*pcs))
开发者ID:simphony,项目名称:simphony-mayavi,代码行数:31,代码来源:lattice_from_dataset_example.py


注:本文中的simphony.cuds.primitive_cell.PrimitiveCell.for_hexagonal_lattice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。