/// Returns the polarity of the bond. This is calculated as the /// absolute value of the difference in electronegativity between the /// two atoms in the bond. Real Bond::polarity() const { if(atom1()->atomicNumber() == atom2()->atomicNumber()){ return 0; } return std::abs(atom1()->electronegativity() - atom2()->electronegativity()); }
/// Returns the dipole moment for the bond. Vector3 Bond::dipoleMoment() const { Point3 a = atom1()->position(); Point3 b = atom2()->position(); Real qa = atom1()->partialCharge(); Real qb = atom2()->partialCharge(); return (a - b) * (qa - qb); }
void SolventAccessibleSurface::createEdge(Position j) { SASEdge* edge = edges_[j]; edge->index_ = j; RSEdge* rsedge = reduced_surface_->edges_[j]; if (rsedge->face_[0] != NULL) { edge->vertex_[0] = vertices_[rsedge->face_[0]->index_]; edge->vertex_[1] = vertices_[rsedge->face_[1]->index_]; } else { edge->vertex_[0] = NULL; edge->vertex_[1] = NULL; } edge->face_[0] = faces_[rsedge->vertex_[0]->index_]; edge->face_[1] = faces_[rsedge->vertex_[1]->index_]; edge->angle_ = rsedge->angle_; edge->circle_.p = rsedge->center_of_torus_; edge->circle_.radius = rsedge->radius_of_torus_; TSphere3<double> atom1(reduced_surface_->atom_[rsedge->vertex_[0]->atom_]); TSphere3<double> atom2(reduced_surface_->atom_[rsedge->vertex_[1]->atom_]); edge->circle_.n = atom1.p-atom2.p; }
// --- Properties ---------------------------------------------------------- // /// Returns the atom at \p index in the bond. Index must be either /// \c 0 or \c 1. Atom* Bond::atom(size_t index) const { return index == 0 ? atom1() : atom2(); }
/// Returns the length of the bond. Length is in Angstroms. Real Bond::length() const { return atom1()->distance(atom2()); }
// --- Geometry ------------------------------------------------------------ // /// Returns the center point of the bond. The center is equal to the /// midpoint between the two atoms in the bond. Point3 Bond::center() const { return chemkit::geometry::midpoint(atom1()->position(), atom2()->position()); }
/// Returns \c true if either of the two atoms in the bond are /// terminal. bool Bond::isTerminal() const { return atom1()->isTerminal() || atom2()->isTerminal(); }
/// Returns \c true if the bond contains an atom of the element \p a /// and an atom of the element \p b. /// /// For example, to check if this is a carbonyl bond you could use: /// \code /// if(bond->containsBoth(Atom::Carbon, Atom::Oxygen) && bond->order() == Bond::Double){ /// // it is a carbonyl /// } /// \endcode bool Bond::containsBoth(const Element &a, const Element &b) const { return (atom1()->is(a) && atom2()->is(b)) || (atom2()->is(a) && atom1()->is(b)); }
/// Returns \c true if the bond contains an atom of the given /// \p element. bool Bond::contains(const Element &element) const { return atom1()->is(element) || atom2()->is(element); }
// --- Structure ----------------------------------------------------------- // /// Returns \c true if the bond contains atom. bool Bond::contains(const Atom *atom) const { return atom1() == atom || atom2() == atom; }