Atom

class rnamake.atom.Atom(name, coords)[source]

Bases: object

Stores atomic information from pdb file, design is to be extremely lightweight only storing the atom name and coordinates.

Parameters:
  • name (str) – name of atom
  • coords (numpy.array) – 3d coordinates of atom’s position
Attributes:
name : str
Atomic name
coords : np.array
Atomic coordinates
Examples:
>>> a = Atom("P",[1.0,2.0,3.0])
>>> a.name
P

>>> a.coords
[1.0 2.0 3.0]

>>> print a
<Atom(name ='P', coords='1.0 2.0 3.0')>
copy()[source]

Deep copies the current atom instance.

Returns:an Atom object
Examples:
>>> a = Atom("P",[1.0,2.0,3.0])
>>> a_copy = a.copy()
>>> print a_copy.name
P
to_pdb_str(acount=1)[source]

prints the current atom to a pdb string

Parameters:acount (int) – the atom number of the atom in pdb file
Examples:
>>> a = Atom("P",[1.0,2.0,3.0])
>>> a.to_pdb_str()
ATOM      1  P   C   A   1       1.000   2.000   3.000  1.00 62.18           P

>>> a.to_pdb_str(10)
ATOM     10  P   C   A   1       1.000   2.000   3.000  1.00 62.18           P
to_str()[source]

returns string version of atom.

Returns:str
Examples:
>>> atom = atom.Atom("H1", np.array([0, 1, 2]))
>>> string = atom.to_str()
"H1 0.0 1.0 2.0"