Skip to content

Structure

AtomsAndBonds(parent_molecule_object)

A class for adding and deleting atoms and bonds

Initializes the pymolecule.AtomsAndBonds class.

PARAMETER DESCRIPTION
parent_molecule_object

The pymolecule.Molecule object associated with this class.

parent_molecule = parent_molecule_object instance-attribute

add_atom(record_name='ATOM', serial=1, name='X', resname='XXX', chainid='X', resseq=1, occupancy=0.0, tempfactor=0.0, charge='', element='X', coordinates=np.array([0.0, 0.0, 0.0]))

Adds an atom.

PARAMETER DESCRIPTION
record_name

An optional string, the record name of the atom. "ATOM" is the default.

DEFAULT: 'ATOM'

serial

An optional int, the serial field of the atom. 1 is the default.

DEFAULT: 1

name

An optional string, the name of the atom. "X" is the default.

DEFAULT: 'X'

resname

An optional string, the resname of the atom. "XXX" is the default.

DEFAULT: 'XXX'

chainid

An optional string, chainid of the atom. "X" is the default.

DEFAULT: 'X'

resseq

An optional int, the resseq field of the atom. 1 is the default.

DEFAULT: 1

occupancy

An optional float, the occupancy of the atom. 0.0 is the default.

DEFAULT: 0.0

tempfactor

An optional float, the tempfactor of the atom. 0.0 is the default.

DEFAULT: 0.0

charge

An optional string, the charge of the atom. "" is the default.

DEFAULT: ''

element

An optional string, the element of the atom. "X" is the default.

DEFAULT: 'X'

coordinates

An optional np.array, the (x, y, z) coordinates of the atom. np.array([0.0, 0.0, 0.0]) is the default.

DEFAULT: array([0.0, 0.0, 0.0])

add_bond(index1, index2, order=1)

Adds a bond.

PARAMETER DESCRIPTION
index1

An int, the index of the first atom of the bonded pair.

index2

An int, the index of the second atom of the bonded pair.

order

An optional int, the order of the bond. 1 by default.

DEFAULT: 1

create_bonds_by_distance(remove_old_bond_data=True, delete_excessive_bonds=True)

Determines which atoms are bound to each other based on their proximity.

PARAMETER DESCRIPTION
remove_old_bond_data

An optional boolean, whether or not to discard old bond data before adding in bonds determined by distance. True by default.

DEFAULT: True

delete_excessive_bonds

An optional boolean, whether or not to check for and delete excessive bonds. True by default.

DEFAULT: True

delete_atom(index)

Deletes an atom.

PARAMETER DESCRIPTION
index

An int, the index of the atom to delete.

delete_bond(index1, index2)

Deletes a bond.

PARAMETER DESCRIPTION
index1

An int, the index of the first atom of the bonded pair.

index2

An int, the index of the second atom of the bonded pair.

index_of_first_bond_partner_of_element(atom_index, the_element)

For a given atom of interest, returns the index of the first neighbor of a specified element.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom of interest.

the_element

A string specifying the desired element of the neighbor.

RETURNS DESCRIPTION

An int, the index of the first neighbor atom of the specified element. If no such neighbor exists, returns -1.

number_of_bond_partners_of_element(atom_index, the_element)

Counts the number of atoms of a given element bonded to a specified atom of interest.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom of interest.

the_element

A string describing the element of the neighbors to be counted.

RETURNS DESCRIPTION

An int, the number of neighboring atoms of the specified element.