5#ifndef GEMMI_CALCULATE_HPP_
6#define GEMMI_CALCULATE_HPP_
16 for (
const auto&
child :
obj.children())
28 for (
const auto&
child :
obj.children())
33 return (!
sel ||
sel->matches(atom)) ? 1 : 0;
39 for (
const auto&
child :
obj.children())
44 return (!
sel ||
sel->matches(atom)) ? atom.
occ : 0;
50 for (
const auto&
child :
obj.children())
66 for (
const auto&
child :
obj.children()) {
79 for (
const auto&
child :
obj.children()) {
81 range.first = std::min(range.first,
r.first);
82 range.second = std::max(range.second,
r.second);
94 for (
const Residue& residue : chain.residues)
95 for (
const Atom& atom : residue.atoms) {
98 if (atom.aniso.nonzero()) {
99 std::array<double,3>
eig = atom.aniso.calculate_eigenvalues();
100 auto u = std::minmax({
eig[0],
eig[1],
eig[2]});
101 range.first = std::min(range.first, u.first *
u_to_b());
102 range.second = std::max(range.second, u.second *
u_to_b());
104 range.first = std::min(range.first, (
double) atom.b_iso);
105 range.second = std::max(range.second, (
double) atom.b_iso);
113 for (
const auto&
child :
obj.children())
130 if (!
st.cell.is_crystal())
131 fail(
"calculate_fractional_box(): Structure has no unit cell for fractionalization");
133 for (
const Model& model :
st.models)
134 for (
const Chain& chain : model.chains)
135 for (
const Residue& res : chain.residues)
136 for (
const Atom& atom : res.atoms)
137 box.extend(
st.cell.fractionalize(atom.pos));
166 double y = u.cross(w).dot(
b1);
167 double x = u.dot(w) *
b1.length();
168 return std::atan2(y, x);
174 if (a && b && c &&
d)
215 const std::array<double, 4>&
coeff) {
Data structures to store macromolecular structure models.
double calculate_b_est(const Atom &atom)
double calculate_mass(const T &obj)
double calculate_chiral_volume(const Position &actr, const Position &a1, const Position &a2, const Position &a3)
CenterOfMass calculate_center_of_mass(const T &obj)
void expand_box(const T &obj, Box< Position > &box)
double calculate_omega(const Residue &res, const Residue &next)
Box< Position > calculate_box(const Structure &st, double margin=0.)
GEMMI_DLL std::array< double, 4 > find_best_plane(const std::vector< Atom * > &atoms)
double get_distance_from_plane(const Position &pos, const std::array< double, 4 > &coeff)
double calculate_dihedral(const Position &p0, const Position &p1, const Position &p2, const Position &p3)
double count_occupancies(const T &obj, const Selection *sel=nullptr)
bool has_hydrogen(const T &obj)
double calculate_angle(const Position &p0, const Position &p1, const Position &p2)
Box< Fractional > calculate_fractional_box(const Structure &st, double margin=0.)
constexpr double rad(double angle)
bool is_peptide_bond_cis(const Atom *ca1, const Atom *c, const Atom *n, const Atom *ca2, double tolerance_deg)
GEMMI_DLL FTransform parse_triplet_as_ftransform(const std::string &s)
std::array< double, 2 > calculate_phi_psi(const Residue *prev, const Residue &res, const Residue *next)
std::pair< double, double > calculate_b_aniso_range(const Model &model)
uses min/max eigenvalues of Baniso, or Biso if B-factor is isotropic
GEMMI_DLL SMat33< double > calculate_u_from_tls(const TlsGroup &tls, const Position &pos)
void fail(const std::string &msg)
double calculate_dihedral_from_atoms(const Atom *a, const Atom *b, const Atom *c, const Atom *d)
the return value is in the same range as that of atan2(), i.e. [-pi, pi]
std::pair< float, float > calculate_b_iso_range(const T &obj)
constexpr double u_to_b()
size_t count_atom_sites(const T &obj, const Selection *sel=nullptr)
Represents atom site in macromolecular structure (~100 bytes).
std::vector< Chain > chains
Coordinates in Angstroms - orthogonal (Cartesian) coordinates.
const Atom * get_ca() const
const Atom * get_c() const
const Atom * get_n() const
std::array< double, 3 > calculate_eigenvalues() const
Based on https://en.wikipedia.org/wiki/Eigenvalue_algorithm To calculate both eigenvalues and eigenve...