[ase-users] Translate only atoms of a certain type

Duy Le ttduyle at gmail.com
Wed Nov 15 16:30:01 CET 2017


This is how I rotate a group of atoms. You can modify it to do simple
translation.

Duy

def rotate_group( atoms, group, axis, angle, center ):
    """ Rotate a group of atoms

    Parameters
    ----------
    atoms:  ase.Atoms object
         The system of which a group of atoms need to be rotated
    group:  list
         List of indices of atoms of a group
    axis: 3 element array
         Vector indicating the direction of rotation axis
    angle: Scalar (rad)
         Rotate angle
    center: 3 element array
         Position of rotation center

    Returns
    -------
    atoms: ase.Atoms object
         Modified ase.Atoms object with group rotated.

    Examples
    --------

    See also
    --------

    Update
    ------
    10/25/2016: duy.le at ucf.edu started this routine
    """

    subsys = atoms[ group ]

    subsys.rotate( axis, angle, center, rotate_cell = False )

    atoms.positions[ group ] = subsys.positions

    return atoms


On Wed, Nov 15, 2017 at 9:59 AM, fabian via ase-users <
ase-users at listserv.fysik.dtu.dk> wrote:

> Dear all
>
> I  want to translate a molecule on my surface slab. At the moment i am
> doing this "by Hand" in the CONTCAR file after a calculation is done.
>
> Is there a way to translated all the atoms of a certain type or over a
> certain height threshold by for example half a lattice vector within ASE?
>
> I would be glad for any pointers in the right direction
>
>
> All the best
>
>
> fabian
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20171115/8728b6da/attachment.html>


More information about the ase-users mailing list