# Residue

Chemfiles.ResidueType

A Residue is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc.

source
Chemfiles.ResidueType
Residue(name::String) -> Residue
Residue(name::String, id::Any) -> Residue


Create a new residue with the given name and optional residue identifier id.

source
Chemfiles.ResidueMethod
Residue(topology::Topology, index::Integer) -> Residue


Get a copy of the residue at index from a topology.

The residue index in the topology is not always the same as the residue identifier.

source
Base.containsMethod
contains(residue::Residue, index::Integer) -> Bool


Check if the atom at the given index is in the residue.

source
Base.sizeMethod
size(residue::Residue) -> Int64


Get the number of atoms in a residue.

source
Chemfiles.add_atom!Method
add_atom!(residue::Residue, index::Integer)


Add the atom at the given index in the residue.

source
Chemfiles.atomsMethod
atoms(residue::Residue) -> Array{UInt64,1}


Get the atoms in a $residue$. This function returns a list of indexes.

source
Chemfiles.idMethod
id(residue::Residue) -> Int64


Get the identifier of a residue in the initial topology.

source
Chemfiles.residue_for_atomMethod
residue_for_atom(topology::Topology, index::Integer) -> Union{Nothing, Residue}


Get a copy of the residue containing the atom at index in the topology.

This function will return nothing if the atom is not in a residue, or if the index is bigger than the number of atoms in the topology.

source
Chemfiles.set_property!Method
set_property!(residue::Residue, name::String, value::Union{Bool, Float64, Array{Float64,1}, String})


Set a named property for the given residue.

source