11#include <unordered_map>
36 return asu != Asu::Different ? atoms[0]->pos.dist(atoms[1]->pos) :
NAN;
38 double calculate_z_(
double d)
const {
return std::abs(
d - restr->
value) / restr->
esd; }
39 double calculate_z()
const {
return calculate_z_(calculate()); }
54 atoms[2]->pos, atoms[3]->pos);
57 return angle_z(calculate(), *restr, 360. / std::max(1, restr->
period));
65 atoms[2]->pos, atoms[3]->pos);
68 double calc = calculate();
69 if (restr->
sign == ChiralityType::Negative ||
70 (restr->
sign == ChiralityType::Both &&
calc < 0))
101 int atom1_name_id = 0;
102 int atom2_name_id = 0;
119 return id ==
o.id && alias ==
o.alias && altloc ==
o.altloc;
150 if (chemcomps.size() == 1)
151 return *chemcomps[0].cc;
152 assert(!chemcomps.empty());
154 if (
it.altloc == altloc)
156 return *chemcomps[0].cc;
173 while (
e != res_infos.end() &&
e->res->group_key() == b->res->group_key())
181 for (
int i = 0; (size_t)
i !=
t.atoms.size(); ++
i)
187 std::ostream* warnings =
nullptr;
188 bool only_bonds =
false;
214 if (
rule.rkind == RKind::Bond)
215 return &bonds[
rule.index];
220 auto range = bond_index.equal_range(a);
221 for (
auto i = range.first;
i != range.second; ++
i) {
223 if ((
bond->atoms[0] == b &&
bond->atoms[1] == a) ||
224 (
bond->atoms[1] == b &&
bond->atoms[0] == a))
232 const Atom* c)
const {
233 auto range = angle_index.equal_range(b);
234 for (
auto i = range.first;
i != range.second; ++
i) {
236 if ((
ang->atoms[0] == a &&
ang->atoms[2] == c) ||
237 (
ang->atoms[0] == c &&
ang->atoms[2] == a))
278 if (warnings ==
nullptr)
280 *warnings <<
"Warning: " <<
msg << std::endl;
285 std::vector<std::unique_ptr<Restraints>> rt_storage;
287 std::unordered_map<std::string, std::unique_ptr<ChemComp>> cc_cache;
289 std::vector<std::unique_ptr<ChemComp>> cc_storage;
double calculate_chiral_volume(const Position &actr, const Position &a1, const Position &a2, const Position &a3)
GEMMI_DLL std::unique_ptr< Topo > prepare_topology(Structure &st, MonLib &monlib, size_t model_index, HydrogenChange h_change, bool reorder, std::ostream *warnings=nullptr, bool ignore_unknown_links=false, bool use_cispeps=false)
double calculate_dihedral(const Position &p0, const Position &p1, const Position &p2, const Position &p3)
GEMMI_DLL std::vector< AtomAddress > find_missing_atoms(const Topo &topo, bool including_hydrogen=false)
double calculate_angle(const Position &p0, const Position &p1, const Position &p2)
bool in_vector(const T &x, const std::vector< T > &v)
double angle_z(double value_rad, const Restr &restr, double full=360.)
void fail(const std::string &msg)
GEMMI_DLL std::unique_ptr< ChemComp > make_chemcomp_with_restraints(const Residue &res)
Represents atom site in macromolecular structure (~100 bytes).
bool is_wrong(double volume) const
const Restraints::Angle * restr
std::array< Atom *, 3 > atoms
double calculate_z() const
std::array< Atom *, 2 > atoms
double calculate_z() const
const Restraints::Bond * restr
iterator group_end(iterator b) const
std::vector< ResInfo >::iterator iterator
std::string subchain_name
std::vector< ResInfo > res_infos
ChainInfo(ResidueSpan &subchain, const Chain &chain, const Entity *ent)
std::array< Atom *, 4 > atoms
double calculate_z(double ideal_abs_vol, double esd) const
const Restraints::Chirality * restr
std::vector< Rule > link_rules
std::ptrdiff_t res_distance() const
bool operator==(const Mod &o) const
const Restraints::Plane * restr
bool has(const Atom *atom) const
std::vector< Atom * > atoms
void add_mod(const std::string &m, const ChemComp::Aliasing *aliasing, char altloc)
std::vector< Rule > monomer_rules
std::vector< FinalChemComp > chemcomps
const ChemComp & get_final_chemcomp(char altloc) const
std::array< Atom *, 4 > atoms
const Restraints::Torsion * restr
double calculate_z() const
Topo & operator=(Topo const &)=delete
void apply_all_restraints(const MonLib &monlib)
Link * find_polymer_link(const AtomAddress &a1, const AtomAddress &a2)
const Restraints::Angle * take_angle(const Atom *a, const Atom *b, const Atom *c) const
void initialize_refmac_topology(Structure &st, Model &model0, MonLib &monlib, bool ignore_unknown_links=false)
std::vector< Plane > planes
std::vector< ChainInfo > chain_infos
std::vector< Angle > angles
static int has_atom(const Atom *a, const T &t)
void apply_restraints_from_link(Link &link, const MonLib &monlib)
Topo(Topo const &)=delete
std::multimap< const Atom *, Bond * > bond_index
void set_cispeps_in_structure(Structure &st)
std::multimap< const Atom *, Angle * > angle_index
Bond * first_bond_in_link(const Link &link)
double ideal_chiral_abs_volume(const Chirality &ch) const
const Restraints::Bond * take_bond(const Atom *a, const Atom *b) const
std::vector< Chirality > chirs
std::vector< Bond > bonds
std::vector< Torsion > torsions
GEMMI_COLD void err(const std::string &msg) const
std::vector< Rule > apply_restraints(const Restraints &rt, Residue &res, Residue *res2, Asu asu, char altloc1, char altloc2, bool require_alt)
std::multimap< const Atom *, Torsion * > torsion_index
ResInfo * find_resinfo(const Residue *res)
const Chirality * get_chirality(const Atom *ctr) const
std::vector< Link > extras
std::multimap< const Atom *, Plane * > plane_index