repeat#

biotite.structure.repeat(atoms, coord)[source]#

Repeat atoms (AtomArray or AtomArrayStack) multiple times in the same model with different coordinates.

Parameters:
atomsAtomArray, shape=(n,) or AtomArrayStack, shape=(m,n)

The atoms to be repeated.

coordndarray, dtype=float, shape=(k,n,3) or shape=(k,m,n,3)

The coordinates to be used for the repeated atoms. The length of first dimension determines the number of repeats. If atoms is an AtomArray 3 dimensions, otherwise 4 dimensions are required.

Returns:
repeated: AtomArray, shape=(n*k,) or AtomArrayStack, shape=(m,n*k)

The repeated atoms. Whether an AtomArray or an AtomArrayStack is returned depends on the input atoms.

Examples

>>> atoms = array([
...     Atom([1,2,3], res_id=1, atom_name="N"),
...     Atom([4,5,6], res_id=1, atom_name="CA"),
...     Atom([7,8,9], res_id=1, atom_name="C")
... ])
>>> print(atoms)
            1      N                1.000    2.000    3.000
            1      CA               4.000    5.000    6.000
            1      C                7.000    8.000    9.000
>>> repeat_coord = np.array([
...     [[0,0,0], [1,1,1], [2,2,2]],
...     [[3,3,3], [4,4,4], [5,5,5]]
... ])
>>> print(repeat(atoms, repeat_coord))
            1      N                0.000    0.000    0.000
            1      CA               1.000    1.000    1.000
            1      C                2.000    2.000    2.000
            1      N                3.000    3.000    3.000
            1      CA               4.000    4.000    4.000
            1      C                5.000    5.000    5.000