Residue¶
-
class Residue¶
A
Residue
is a group of atoms belonging to the same logical unit. They can be molecules, amino-acids in a protein, monomers in polymers, etc.Iterating over a
Residue
gives the indexes of the atoms in the associatedTopology
.Public Functions
-
explicit Residue(std::string name)¶
Create a new residue with a given
name
and no residue id.
-
Residue(std::string name, int64_t resid)¶
Create a new residue with a given
name
and residue idresid
.
-
inline const std::string &name() const¶
Get the name of the residue.
-
inline size_t size() const¶
Get the size of the residue, i.e. the number of atoms in this residue.
-
void add_atom(size_t i)¶
Add an atom with index
i
to this residueIf the atom is already in the residue, this does nothing.
-
bool contains(size_t i) const¶
Check if the residue contains a given atom with index
i
-
inline const property_map &properties() const¶
Get the map of properties asociated with this residue. This map might be iterated over to list the properties of the residue, or directly accessed.
-
inline void set(std::string name, Property value)¶
Set an arbitrary
Property
for this residue with the givenname
andvalue
. If a property with this name already exist, it is replaced with the new value.
-
inline optional<const Property&> get(const std::string &name) const¶
Get the
Property
with the givenname
for this residue if it exists.If no property with the given
name
is found, this function returnsnullopt
.
-
template<Property::Kind kind>
inline optional<typename property_metadata<kind>::type> get(const std::string &name) const¶ Get the
Property
with the givenname
for this residue if it exists, and check that it has the requiredkind
.If no property with the given
name
is found, this function returnsnullopt
.If a property with the given
name
is found, but has a different kind, this function emits a warning and returnsnullopt
.
-
explicit Residue(std::string name)¶