Class atom

Class Documentation

class atom

The class atom encapsulates the data in _atom_site and _atom_site_anisotrop.

The class atom is a kind of flyweight class. It can be copied with low overhead. All data is stored in the underlying mmCIF categories but some very often used fields are cached in the impl.

It is also possible to have symmetry copies of atoms. They share the same data in the cif::category but their location differs by using a symmetry operator.

Public Functions

inline atom()

Construct a new, empty atom object.

inline atom(std::shared_ptr<atom_impl> impl)

Construct a new atom object using impl as impl.

Parameters

impl – The implementation objectt

inline atom(const atom &rhs)

Copy construct a new atom object.

inline atom(const datablock &db, const row_handle &row)

Construct a new atom object based on a cif::row.

Parameters
  • db – The datablock where the _atom_site category resides

  • row – The row containing the data for this atom

inline atom(const atom &rhs, const point &symmmetry_location, const std::string &symmetry_operation)

A special constructor to create symmetry copies.

Parameters
  • rhs – The original atom to copy

  • symmmetry_location – The symmetry location

  • symmetry_operation – The symmetry operator used

inline explicit operator bool() const

To quickly test if the atom has data.

atom &operator=(const atom &rhs) = default

Copy assignement operator.

inline std::string get_property(std::string_view name) const

Return the field named name in the _atom_site category for this atom.

inline int get_property_int(std::string_view name) const

Return the field named name in the _atom_site category for this atom cast to an int.

inline float get_property_float(std::string_view name) const

Return the field named name in the _atom_site category for this atom cast to a float.

inline void set_property(const std::string_view name, const std::string &value)

Set value for the field named name in the _atom_site category to value.

template<typename T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
inline void set_property(const std::string_view name, const T &value)

Set value for the field named name in the _atom_site category to value.

inline const std::string &id() const

Return the ID of the _atom_site record.

Note

Although I’ve never seen anything other than integers, the standard says this should be a string and so we use that.

inline cif::atom_type get_type() const

Return the type of the atom.

inline point get_location() const

Return the cached location of this atom.

inline void set_location(point p)

Set the location of this atom, will set both the cached data as well as the data in the underlying _atom_site category.

inline void translate(point t)

Translate the position of this atom by t.

inline void rotate(quaternion q)

Rotate the position of this atom by q.

inline void rotate(quaternion q, point p)

rotate the coordinates of this atom by q around point p

inline void translate_and_rotate(point t, quaternion q)

Translate and rotate the position of this atom by t and q.

inline void translate_rotate_and_translate(point t1, quaternion q, point t2)

Translate, rotate and translate again the coordinates this atom by t1 , q and t2.

inline const row_handle get_row() const

for direct access to underlying data, be careful!

inline const row_handle get_row_aniso() const

for direct access to underlying data, be careful!

inline bool is_symmetry_copy() const

Return if the atom is actually a symmetry copy or the original one.

inline std::string symmetry() const

Return the symmetry operator used.

inline bool is_water() const

Return true if this atom is part of a water molecule.

inline int get_charge() const

Return the charge.

inline float get_occupancy() const

Return the occupancy.

inline std::string get_label_asym_id() const

Return the label_asym_id property.

inline int get_label_seq_id() const

Return the label_seq_id property.

inline std::string get_label_atom_id() const

Return the label_atom_id property.

inline std::string get_label_alt_id() const

Return the label_alt_id property.

inline std::string get_label_comp_id() const

Return the label_comp_id property.

inline std::string get_label_entity_id() const

Return the label_entity_id property.

inline std::string get_auth_asym_id() const

Return the auth_asym_id property.

inline std::string get_auth_seq_id() const

Return the auth_seq_id property.

inline std::string get_auth_atom_id() const

Return the auth_atom_id property.

inline std::string get_auth_alt_id() const

Return the auth_alt_id property.

inline std::string get_auth_comp_id() const

Return the auth_comp_id property.

inline std::string get_pdb_ins_code() const

Return the pdb_ins_code property.

inline bool is_alternate() const

Return true if this atom is an alternate.

inline std::string pdb_id() const

Convenience method to return a string that might be ID in PDB space.

inline bool operator==(const atom &rhs) const

Compare two atoms.

inline bool operator!=(const atom &rhs) const

Compare two atoms.

inline bool is_back_bone() const

Is this atom a backbone atom.

inline void swap(atom &b)

swap

inline int compare(const atom &b) const

Compare this atom with b.

inline bool operator<(const atom &rhs) const

Should this atom sort before rhs.

Friends

friend std::ostream &operator<<(std::ostream &os, const atom &atom)

Write the atom to std::ostream os.