Beispiel #1
0
def scale_structure(structure: orm.StructureData,
                    scale_factor: orm.Float) -> orm.StructureData:
    """Scale the structure with the given scaling factor."""
    ase = structure.get_ase().copy()
    ase.set_cell(ase.get_cell() * float(scale_factor)**(1 / 3),
                 scale_atoms=True)
    return orm.StructureData(ase=ase)
Beispiel #2
0
    def _generate_structure(scale=None):
        """Return a `StructureData` representing bulk silicon."""
        from aiida.orm import StructureData

        param = 5.43
        cell = [[param / 2., param / 2., 0], [param / 2., 0, param / 2.],
                [0, param / 2., param / 2.]]
        structure = StructureData(cell=cell)
        structure.append_atom(position=(0., 0., 0.), symbols='Si', name='Si')
        structure.append_atom(position=(param / 4., param / 4., param / 4.),
                              symbols='Si',
                              name='SiDiff')

        if scale:
            the_ase = structure.get_ase()
            new_ase = the_ase.copy()
            new_ase.set_cell(the_ase.get_cell() * float(scale),
                             scale_atoms=True)
            new_structure = StructureData(ase=new_ase)
            structure = new_structure

        return structure