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


Python build.bulk方法代码示例

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


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

示例1: get_ase_rocksalt

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def get_ase_rocksalt(A='Li', B='Cl'):
    assert A in ['Li', 'Mg']
    # Add Na, K
    assert B in ['H', 'F', 'Cl', 'O']
    # Add Br, I
    from ase.lattice import bulk
    if A=='Li':
        if B=='H':
            ase_atom = bulk('LiH', 'rocksalt', a=4.0834*A2B)
        elif B=='F':
            ase_atom = bulk('LiF', 'rocksalt', a=4.0351*A2B)
        elif B=='Cl':
            ase_atom = bulk('LiCl', 'rocksalt', a=5.13*A2B)
    elif A=='Mg' and B=='O':
        ase_atom = bulk('MgO', 'rocksalt', a=4.213*A2B)
    else:
        raise NotImplementedError('No formula found for system ',
            A, B, '.  Choose a different system?  Or add it to the list!')

    return ase_atom 
开发者ID:pyscf,项目名称:pyscf,代码行数:22,代码来源:lattice.py

示例2: create_hkl_surface

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def create_hkl_surface(lattice, hkl, layers, vacuum=1.0, center=False):
    """
    Use ase.build.surface to build a surface with surface normal (hkl).

    Args:
        lattice (pyiron.atomistics.structure.atoms.Atoms/str): bulk Atoms
            instance or str, e.g. "Fe", from which to build the surface
        hkl (list): miller indices of surface to be created
        layers (int): # of atomic layers in the surface
        vacuum (float): vacuum spacing
        center (bool): shift all positions to center the surface
            in the cell

    Returns:
        pyiron.atomistics.structure.atoms.Atoms instance: Required surface
    """
    # https://gitlab.com/ase/ase/blob/master/ase/lattice/surface.py
    s.publication_add(publication_ase())

    surface = ase_surf(lattice, hkl, layers)
    z_max = np.max(surface.positions[:, 2])
    surface.cell[2, 2] = z_max + vacuum
    if center:
        surface.positions += 0.5 * surface.cell[2] - [0, 0, z_max/2]
    return surface 
开发者ID:pyiron,项目名称:pyiron,代码行数:27,代码来源:generator.py

示例3: test_surface

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_surface(self):
        """Test catkit.build.surface generator."""
        slab = surface('Pd', size=(2, 2, 4), vacuum=10)

        # Slab should have 16 Pd atoms
        assert(len(slab) == 16)
        degree = slab.degree

        test_degree = np.array(
            [9, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 9])

        assert_array_equal(degree, test_degree)

        correct_surf_atoms = np.array([12, 13, 14, 15])
        assert_array_equal(slab.get_surface_atoms(), correct_surf_atoms)

        # Test the ability to pass an atoms object
        atoms = bulk('Pd', cubic=True)
        slab = surface(atoms, size=(2, 2, 4), vacuum=10)

        # Test orthogonalization search
        slab = surface(atoms, size=(1, 4), vacuum=10) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:24,代码来源:test_build.py

示例4: get_ase_wurtzite

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def get_ase_wurtzite(A='Zn', B='O'):
    # Lattice constants taken from wikipedia (TODO: is wikipedia a valid
    # citation at this point? en.wikipedia.org/wiki/Lattice_constant)
    assert A in ['Zn']
    assert B in ['O']
    from ase.lattice import bulk
    if A=='Zn' and B=='O':
        ase_atom = bulk('ZnO', 'wurtzite', a=3.25*A2B, c=5.2*A2B)
    else:
        raise NotImplementedError('No formula found for system ',
            A, B, '.  Choose a different system?  Or add it to the list!')
    return ase_atom 
开发者ID:pyscf,项目名称:pyscf,代码行数:14,代码来源:lattice.py

示例5: get_ase_zincblende

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def get_ase_zincblende(A='Ga', B='As'):
    # Lattice constants from Shishkin and Kresse, PRB 75, 235102 (2007)
    assert A in ['Si', 'Ga', 'Cd', 'Zn', 'B', 'Al']
    assert B in ['C', 'As', 'S', 'O', 'N', 'P']
    from ase.lattice import bulk
    if A=='Si' and B=='C':
        ase_atom = bulk('SiC', 'zincblende', a=4.350*A2B)
    elif A=='Ga' and B=='As':
        ase_atom = bulk('GaAs', 'zincblende', a=5.648*A2B)
    elif A=='Ga' and B=='N':
        ase_atom = bulk('GaN', 'zincblende', a=4.520*A2B)
    elif A=='Cd' and B=='S':
        ase_atom = bulk('CdS', 'zincblende', a=5.832*A2B)
    elif A=='Zn' and B=='S':
        ase_atom = bulk('ZnS', 'zincblende', a=5.420*A2B)
    elif A=='Zn' and B=='O':
        ase_atom = bulk('ZnO', 'zincblende', a=4.580*A2B)
    elif A=='B' and B=='N':
        ase_atom = bulk('BN', 'zincblende', a=3.615*A2B)
    elif A=='Al' and B=='P':
        ase_atom = bulk('AlP', 'zincblende', a=5.451*A2B)
    else:
        raise NotImplementedError('No formula found for system ',
            A, B, '.  Choose a different system?  Or add it to the list!')

    return ase_atom 
开发者ID:pyscf,项目名称:pyscf,代码行数:28,代码来源:lattice.py

示例6: get_ase_diamond_primitive

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def get_ase_diamond_primitive(atom='C'):
    """Get the ASE atoms for primitive (2-atom) diamond unit cell."""
    from ase.build import bulk
    if atom == 'C':
        ase_atom = bulk('C', 'diamond', a=3.5668*A2B)
    elif atom == 'Si':
        ase_atom = bulk('Si', 'diamond', a=5.431*A2B)
    elif atom == 'Ge':
        ase_atom = bulk('Ge', 'diamond', a=5.658*A2B)
    else:
        raise NotImplementedError('No formula found for system ',
            atom, '.  Choose a different system?  Or add it to the list!')
    return ase_atom 
开发者ID:pyscf,项目名称:pyscf,代码行数:15,代码来源:lattice.py

示例7: get_ase_graphene_xxx

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def get_ase_graphene_xxx(vacuum=5.0):
    """Get the ASE atoms for primitive (2-atom) graphene unit cell."""
    from ase.lattice import bulk
    ase_atom = bulk('C', 'hcp', a=2.46*A2B, c=vacuum*A2B)
    ase_atom.positions[1,2] = 0.0
    return ase_atom 
开发者ID:pyscf,项目名称:pyscf,代码行数:8,代码来源:lattice.py

示例8: create_ase_bulk

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def create_ase_bulk(
    name,
    crystalstructure=None,
    a=None,
    c=None,
    covera=None,
    u=None,
    orthorhombic=False,
    cubic=False,
):
    """
    Creating bulk systems using ASE bulk module. Crystal structure and lattice constant(s) will be guessed if not
    provided.

    name (str): Chemical symbol or symbols as in 'MgO' or 'NaCl'.
    crystalstructure (str): Must be one of sc, fcc, bcc, hcp, diamond, zincblende,
                            rocksalt, cesiumchloride, fluorite or wurtzite.
    a (float): Lattice constant.
    c (float): Lattice constant.
    c_over_a (float): c/a ratio used for hcp.  Default is ideal ratio: sqrt(8/3).
    u (float): Internal coordinate for Wurtzite structure.
    orthorhombic (bool): Construct orthorhombic unit cell instead of primitive cell which is the default.
    cubic (bool): Construct cubic unit cell if possible.

    Returns:

        pyiron.atomistics.structure.atoms.Atoms: Required bulk structure
    """
    s.publication_add(publication_ase())
    return bulk(
        name=name,
        crystalstructure=crystalstructure,
        a=a,
        c=c,
        covera=covera,
        u=u,
        orthorhombic=orthorhombic,
        cubic=cubic,
    ) 
开发者ID:pyiron,项目名称:pyiron,代码行数:41,代码来源:generator.py

示例9: setup_metal

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def setup_metal(self):
        """Get the atoms objects."""
        symbols = ['Ag', 'Au', 'Cu', 'Pt', 'Pd', 'Ir', 'Rh', 'Ni', 'Co']
        images = []
        for s in symbols:
            rs = get_radius(atomic_numbers[s])
            a = 2 * rs * 2 ** 0.5
            atoms = bulk(s, crystalstructure='bcc', a=a)
            images.append(atoms)
        return images 
开发者ID:SUNCAT-Center,项目名称:CatLearn,代码行数:12,代码来源:test_bulk_fp_gen.py

示例10: test_bulk_fp_gen

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_bulk_fp_gen(self):
        """Test the feature generation."""
        images = self.setup_metal()
        images = images_connectivity(images)

        gen = FeatureGenerator()
        train_fpv = default_fingerprinters(gen, 'bulk') + [gen.bag_edges]
        matrix = gen.return_vec(images, train_fpv)
        labels = gen.return_names(train_fpv)
        print(np.shape(matrix), print(type(matrix)))
        self.assertTrue(len(labels) == np.shape(matrix)[1]) 
开发者ID:SUNCAT-Center,项目名称:CatLearn,代码行数:13,代码来源:test_bulk_fp_gen.py

示例11: test_slab_generator

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_slab_generator(self):
        """Test that no exception is raised when running SlabGenerator."""
        atoms = bulk('Pd', 'fcc', cubic=True)

        SlabGenerator(atoms, miller_index=(1, 1, 1), layers=6, vacuum=4)
        SlabGenerator(atoms, miller_index=(1, 1, 0), layers=6, vacuum=4)
        SlabGenerator(atoms, miller_index=(1, 0, 0), layers=6, vacuum=4)
        SlabGenerator(atoms, miller_index=(0, 0, 0, 1), layers=6) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:10,代码来源:test_surfaces.py

示例12: test_terminations

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_terminations(self):
        """Test termination finding on fcc(211)."""
        atoms = bulk('Pd', 'fcc', a=4, cubic=True)
        atoms[3].symbol = 'Cu'

        gen = SlabGenerator(
            atoms, miller_index=(2, 1, 1), layers=8, vacuum=4)

        gen.get_slab(iterm=1) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:11,代码来源:test_surfaces.py

示例13: test_gcd_miller_index

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_gcd_miller_index(self):
        """Test that miller indices are properly reduces to their
        greatest common divisor.
        """
        atoms = bulk('Pd', 'fcc')
        gen = SlabGenerator(atoms, miller_index=(3, 3, 3),
                            layers=3, layer_type='trim')

        np.testing.assert_array_equal(gen.miller_index, [1, 1, 1]) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:11,代码来源:test_surfaces.py

示例14: test_matrix_notation_search

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_matrix_notation_search(self):
        """Test the matrix notation algorithm."""
        atoms = bulk('Pd', 'fcc', cubic=True)
        gen = SlabGenerator(atoms, miller_index=(1, 1, 1), layers=6)

        gen.get_slab(size=1)
        gen.get_slab(size=[[1, 0], [0, 1]]) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:9,代码来源:test_surfaces.py

示例15: test_nonlocal_fingerprinting

# 需要导入模块: from ase import build [as 别名]
# 或者: from ase.build import bulk [as 别名]
def test_nonlocal_fingerprinting(self):
        """Test the non-local fingerprint example"""
        atoms = bulk('Pd', cubic=True)
        atoms[3].symbol = 'Pt'

        slab = surface('Al', size=(2, 2, 3), a=3.8, vacuum=10)

        images = [atoms, slab]

        parameters = [
            'atomic_number',
            'atomic_radius',
            'atomic_volume',
        ]

        operations = [
            'periodic_convolution',
            ['periodic_convolution', {'d': 1}]
        ]

        fp = Fingerprinter(images)
        fingerprints = fp.get_fp(parameters, operations)

        truth = np.array([
            [12432.0, 7.562800000000001, 320.44, 136896.0, 90.7488, 3844.8],
            [2028.0, 24.53879999999999, 1200.0, 20280.0, 245.388, 12000.0]])

        np.testing.assert_allclose(fingerprints, truth) 
开发者ID:SUNCAT-Center,项目名称:CatKit,代码行数:30,代码来源:test_generator.py


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